arch/x86: multiboot: add bootargs support
Add bootargs support for multiboot. This implements get_bootargs() when multiboot and bootargs are selected in config. Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com> Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
This commit is contained in:
parent
49fc106c60
commit
0cf726b8ef
6 changed files with 90 additions and 30 deletions
|
@ -22,9 +22,35 @@
|
|||
*/
|
||||
|
||||
cmpl $MULTIBOOT_EAX_MAGIC, %eax
|
||||
|
||||
#ifndef CONFIG_DYNAMIC_BOOTARGS
|
||||
je 1f
|
||||
xorl %ebx, %ebx
|
||||
1:
|
||||
#else
|
||||
movl $multiboot_cmdline, %edi
|
||||
je setup_copy_cmdline
|
||||
xorl %ebx, %ebx
|
||||
jmp end_cmdline
|
||||
|
||||
setup_copy_cmdline:
|
||||
testl $MULTIBOOT_INFO_FLAGS_CMDLINE, __multiboot_info_t_flags_OFFSET(%ebx)
|
||||
jz end_cmdline
|
||||
|
||||
movl $multiboot_cmdline + CONFIG_BOOTARGS_ARGS_BUFFER_SIZE - 1, %edx
|
||||
movl __multiboot_info_t_cmdline_OFFSET(%ebx), %esi
|
||||
copy_cmdline:
|
||||
cmpl %esi, %edx
|
||||
je end_cmdline
|
||||
cmpb $0, (%esi)
|
||||
je end_cmdline
|
||||
|
||||
movsb
|
||||
jmp copy_cmdline
|
||||
end_cmdline:
|
||||
movb $0, (%edi)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC_DISABLE
|
||||
|
|
|
@ -11,6 +11,15 @@
|
|||
|
||||
struct multiboot_info multiboot_info;
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_BOOTARGS
|
||||
__pinned_noinit char multiboot_cmdline[CONFIG_BOOTARGS_ARGS_BUFFER_SIZE];
|
||||
|
||||
const char *get_bootargs(void)
|
||||
{
|
||||
return multiboot_cmdline;
|
||||
}
|
||||
#endif /* CONFIG_DYNAMIC_BOOTARGS */
|
||||
|
||||
/*
|
||||
* called very early in the boot process to fetch data out of the multiboot
|
||||
* info struct. we need to grab the relevant data before any dynamic memory
|
||||
|
|
|
@ -14,9 +14,18 @@
|
|||
#include "ia32_offsets.c"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MULTIBOOT_INFO
|
||||
#include <zephyr/arch/x86/multiboot_info.h>
|
||||
#endif
|
||||
|
||||
GEN_OFFSET_SYM(x86_boot_arg_t, boot_type);
|
||||
GEN_OFFSET_SYM(x86_boot_arg_t, arg);
|
||||
|
||||
GEN_OFFSET_SYM(_thread_arch_t, flags);
|
||||
|
||||
#ifdef CONFIG_MULTIBOOT_INFO
|
||||
GEN_OFFSET_SYM(multiboot_info_t, flags);
|
||||
GEN_OFFSET_SYM(multiboot_info_t, cmdline);
|
||||
#endif
|
||||
|
||||
GEN_ABS_SYM_END
|
||||
|
|
|
@ -9,32 +9,7 @@
|
|||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Multiboot (version 1) boot information structure.
|
||||
*
|
||||
* Only fields/values of interest to Zephyr are enumerated: at
|
||||
* present, that means only those pertaining to the framebuffer.
|
||||
*/
|
||||
|
||||
struct multiboot_info {
|
||||
uint32_t flags;
|
||||
uint32_t mem_lower;
|
||||
uint32_t mem_upper;
|
||||
uint32_t unused0[8];
|
||||
uint32_t mmap_length;
|
||||
uint32_t mmap_addr;
|
||||
uint32_t unused1[9];
|
||||
uint32_t fb_addr_lo;
|
||||
uint32_t fb_addr_hi;
|
||||
uint32_t fb_pitch;
|
||||
uint32_t fb_width;
|
||||
uint32_t fb_height;
|
||||
uint8_t fb_bpp;
|
||||
uint8_t fb_type;
|
||||
uint8_t fb_color_info[6];
|
||||
};
|
||||
#include "multiboot_info.h"
|
||||
|
||||
extern struct multiboot_info multiboot_info;
|
||||
|
||||
|
@ -105,9 +80,10 @@ struct multiboot_mmap {
|
|||
|
||||
/* The flags in the boot info structure tell us which fields are valid. */
|
||||
|
||||
#define MULTIBOOT_INFO_FLAGS_MEM (1 << 0) /* mem_* valid */
|
||||
#define MULTIBOOT_INFO_FLAGS_MMAP (1 << 6) /* mmap_* valid */
|
||||
#define MULTIBOOT_INFO_FLAGS_FB (1 << 12) /* fb_* valid */
|
||||
#define MULTIBOOT_INFO_FLAGS_MEM BIT(0) /* mem_* valid */
|
||||
#define MULTIBOOT_INFO_FLAGS_CMDLINE BIT(2) /* cmdline* valid */
|
||||
#define MULTIBOOT_INFO_FLAGS_MMAP BIT(6) /* mmap_* valid */
|
||||
#define MULTIBOOT_INFO_FLAGS_FB BIT(12) /* fb_* valid */
|
||||
|
||||
/* The only fb_type we support is RGB. No text modes and no color palettes. */
|
||||
|
||||
|
|
40
include/zephyr/arch/x86/multiboot_info.h
Normal file
40
include/zephyr/arch/x86/multiboot_info.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_INFO_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_INFO_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Multiboot (version 1) boot information structure.
|
||||
*
|
||||
* Only fields/values of interest to Zephyr are enumerated
|
||||
*/
|
||||
|
||||
struct multiboot_info {
|
||||
uint32_t flags;
|
||||
uint32_t mem_lower;
|
||||
uint32_t mem_upper;
|
||||
uint32_t unused0;
|
||||
uint32_t cmdline;
|
||||
uint32_t unused1[6];
|
||||
uint32_t mmap_length;
|
||||
uint32_t mmap_addr;
|
||||
uint32_t unused2[9];
|
||||
uint32_t fb_addr_lo;
|
||||
uint32_t fb_addr_hi;
|
||||
uint32_t fb_pitch;
|
||||
uint32_t fb_width;
|
||||
uint32_t fb_height;
|
||||
uint8_t fb_bpp;
|
||||
uint8_t fb_type;
|
||||
uint8_t fb_color_info[6];
|
||||
};
|
||||
|
||||
typedef struct multiboot_info multiboot_info_t;
|
||||
|
||||
#endif
|
|
@ -1005,7 +1005,7 @@ config BOOTARGS
|
|||
|
||||
config DYNAMIC_BOOTARGS
|
||||
bool "Support dynamic bootargs"
|
||||
depends on BOOTARGS
|
||||
depends on BOOTARGS && MULTIBOOT_INFO
|
||||
help
|
||||
Enables dynamic bootargs support.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue