arch/x86: rename CONFIG_X86_MULTIBOOT and related to CONFIG_MULTIBOOT

Simple naming change, since MULTIBOOT is clear enough by itself and
"namespacing" it to X86 is unnecessary and/or inappropriate.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
Charles E. Youse 2019-09-27 14:53:40 -04:00 committed by Andrew Boie
parent 2cf52476ea
commit 200056df2f
12 changed files with 114 additions and 115 deletions

View File

@ -91,12 +91,12 @@ config X86_ACPI
config X86_MEMMAP_ENTRIES
int "Number of memory map entries"
range 1 256
default 1 if !X86_MULTIBOOT_MEMMAP
default 64 if X86_MULTIBOOT_MEMMAP
default 1 if !MULTIBOOT_MEMMAP
default 64 if MULTIBOOT_MEMMAP
help
Maximum number of memory regions to hold in the memory map.
config X86_MULTIBOOT
config MULTIBOOT
bool "Generate multiboot header"
default y
help
@ -105,9 +105,9 @@ config X86_MULTIBOOT
to leave this option on if you're not sure. It only expands the
text segment by 12-16 bytes and is typically ignored if not needed.
if X86_MULTIBOOT
if MULTIBOOT
config X86_MULTIBOOT_INFO
config MULTIBOOT_INFO
bool "Preserve multiboot information structure"
default n
help
@ -116,33 +116,33 @@ config X86_MULTIBOOT_INFO
display driver) need to refer to information in this structure,
and so set this option to preserve the data in a permanent location.
config X86_MULTIBOOT_MEMMAP
config MULTIBOOT_MEMMAP
bool "Use multiboot memory map if provided"
default n
select X86_MULTIBOOT_INFO
select MULTIBOOT_INFO
help
Use the multiboot memory map if the loader provides one.
config X86_MULTIBOOT_FRAMEBUF
config MULTIBOOT_FRAMEBUF
bool "Multiboot framebuffer support"
default n
select DISPLAY
select FRAMEBUF_DISPLAY
select X86_MULTIBOOT_INFO
select MULTIBOOT_INFO
if X86_MULTIBOOT_FRAMEBUF
if MULTIBOOT_FRAMEBUF
config X86_MULTIBOOT_FRAMEBUF_X
config MULTIBOOT_FRAMEBUF_X
int "Multiboot framebuffer X pixels"
default 640
config X86_MULTIBOOT_FRAMEBUF_Y
config MULTIBOOT_FRAMEBUF_Y
int "Multiboot framebuffer Y pixels"
default 480
endif # X86_MULTIBOOT_FRAMEBUF
endif # MULTIBOOT_FRAMEBUF
endif # X86_MULTIBOOT
endif # MULTIBOOT
config X86_VERY_EARLY_CONSOLE
bool "Support very early boot printk"

View File

@ -12,9 +12,9 @@ zephyr_library_sources(memmap.c)
zephyr_library_sources_if_kconfig(pcie.c)
zephyr_library_sources_if_kconfig(reboot_rst_cnt.c)
zephyr_library_sources_if_kconfig(multiboot.c)
zephyr_library_sources_ifdef(CONFIG_X86_ACPI acpi.c)
zephyr_library_sources_ifdef(CONFIG_X86_MULTIBOOT multiboot.c)
zephyr_library_sources_ifdef(CONFIG_X86_VERY_EARLY_CONSOLE early_serial.c)
if(CONFIG_X86_LONGMODE)

View File

@ -43,11 +43,11 @@
SECTION_FUNC(TEXT_START, __start)
#ifdef CONFIG_X86_MULTIBOOT_INFO
#ifdef CONFIG_MULTIBOOT_INFO
/*
* If we were loaded by a multiboot-compliant loader, then EAX
* contains X86_MULTIBOOT_EAX_MAGIC and EBX points to a 'struct
* x86_multiboot_info' somewhere in memory that the kernel load
* contains MULTIBOOT_EAX_MAGIC and EBX points to a 'struct
* multiboot_info' somewhere in memory that the kernel load
* image doesn't claim. Since the kernel will consider such memory
* "free", we must copy the contents of the struct before the kernel
* decides to use that RAM for something else. However, we can't
@ -59,7 +59,7 @@ SECTION_FUNC(TEXT_START, __start)
* EBX (0) if the multiboot data isn't valid.
*/
cmpl $X86_MULTIBOOT_EAX_MAGIC, %eax
cmpl $MULTIBOOT_EAX_MAGIC, %eax
je 1f
xorl %ebx, %ebx
1:
@ -390,7 +390,7 @@ z_x86_idt:
.long _idt_base_address /* physical start address */
#ifdef CONFIG_X86_MULTIBOOT
#ifdef CONFIG_MULTIBOOT
/*
* The multiboot header must be in the first 8 Kb of the kernel image
* (not including the ELF section header(s)) and be aligned on a
@ -399,19 +399,19 @@ z_x86_idt:
.balign 4,0x90
.long X86_MULTIBOOT_HEADER_MAGIC
.long X86_MULTIBOOT_HEADER_FLAGS
.long -(X86_MULTIBOOT_HEADER_MAGIC + X86_MULTIBOOT_HEADER_FLAGS)
.long MULTIBOOT_HEADER_MAGIC
.long MULTIBOOT_HEADER_FLAGS
.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
#ifdef CONFIG_X86_MULTIBOOT_FRAMEBUF
#ifdef CONFIG_MULTIBOOT_FRAMEBUF
.fill 5,4,0 /* (unused exec layout) */
.long 0 /* linear graphics mode */
.long CONFIG_X86_MULTIBOOT_FRAMEBUF_X /* width */
.long CONFIG_X86_MULTIBOOT_FRAMEBUF_Y /* height */
.long CONFIG_MULTIBOOT_FRAMEBUF_X /* width */
.long CONFIG_MULTIBOOT_FRAMEBUF_Y /* height */
.long 32 /* depth */
#endif /* CONFIG_X86_MULTIBOOT_FRAMEBUF */
#endif /* CONFIG_MULTIBOOT_FRAMEBUF */
#endif /* CONFIG_X86_MULTIBOOT */
#endif /* CONFIG_MULTIBOOT */
#ifdef CONFIG_SET_GDT

View File

@ -8,7 +8,7 @@
#include <arch/x86/acpi.h>
#include <arch/x86/multiboot.h>
FUNC_NORETURN void z_x86_prep_c(struct x86_multiboot_info *info)
FUNC_NORETURN void z_x86_prep_c(struct multiboot_info *info)
{
_kernel.nested = 0;
_kernel.irq_stack = Z_THREAD_STACK_BUFFER(_interrupt_stack) +
@ -18,8 +18,8 @@ FUNC_NORETURN void z_x86_prep_c(struct x86_multiboot_info *info)
z_x86_early_serial_init();
#endif
#ifdef CONFIG_X86_MULTIBOOT_INFO
z_x86_multiboot_init(info);
#ifdef CONFIG_MULTIBOOT_INFO
z_multiboot_init(info);
#else
ARG_UNUSED(info);
#endif

View File

@ -24,8 +24,8 @@ __start:
* Remember not to clobber EBX until we've copied the boot info struct!
*/
#ifdef CONFIG_X86_MULTIBOOT_INFO
cmpl $X86_MULTIBOOT_EAX_MAGIC, %eax
#ifdef CONFIG_MULTIBOOT_INFO
cmpl $MULTIBOOT_EAX_MAGIC, %eax
je 1f
xorl %ebx, %ebx
1:
@ -108,19 +108,19 @@ __start:
rep stosq
#endif
#ifdef CONFIG_X86_MULTIBOOT_INFO
#ifdef CONFIG_MULTIBOOT_INFO
/* If EBX isn't 0, then we have a valid multiboot info struct. */
testl %ebx, %ebx
jz 1f
movl %ebx, %esi
movl $__X86_MULTIBOOT_INFO_SIZEOF, %ecx
movq $x86_multiboot_info, %rdi
movl $__MULTIBOOT_INFO_SIZEOF, %ecx
movq $multiboot_info, %rdi
rep
movsb
1:
#endif /* CONFIG_X86_MULTIBOOT_INFO */
#endif /* CONFIG_MULTIBOOT_INFO */
/*
* set up SSE in case something uses the floating-point unit during
@ -159,18 +159,18 @@ mxcsr: .long X86_MXCSR_SANE
* version in ia32/crt0.S. They should be refactored into a common file.
*/
#ifdef CONFIG_X86_MULTIBOOT
#ifdef CONFIG_MULTIBOOT
.align 4
.long X86_MULTIBOOT_HEADER_MAGIC
.long X86_MULTIBOOT_HEADER_FLAGS
.long -(X86_MULTIBOOT_HEADER_MAGIC + X86_MULTIBOOT_HEADER_FLAGS)
#ifdef CONFIG_X86_MULTIBOOT_FRAMEBUF
.long MULTIBOOT_HEADER_MAGIC
.long MULTIBOOT_HEADER_FLAGS
.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
#ifdef CONFIG_MULTIBOOT_FRAMEBUF
.fill 5,4,0 /* (unused exec layout) */
.long 0 /* linear graphics mode */
.long CONFIG_X86_MULTIBOOT_FRAMEBUF_X /* width */
.long CONFIG_X86_MULTIBOOT_FRAMEBUF_Y /* height */
.long CONFIG_MULTIBOOT_FRAMEBUF_X /* width */
.long CONFIG_MULTIBOOT_FRAMEBUF_Y /* height */
.long 32 /* depth */
#endif /* CONFIG_X86_MULTIBOOT_FRAMEBUF */
#endif /* CONFIG_MULTIBOOT_FRAMEBUF */
#endif
/*

View File

@ -9,9 +9,9 @@
#include <arch/x86/multiboot.h>
#include <arch/x86/memmap.h>
#ifdef CONFIG_X86_MULTIBOOT_INFO
#ifdef CONFIG_MULTIBOOT_INFO
struct x86_multiboot_info x86_multiboot_info;
struct multiboot_info multiboot_info;
/*
* called very early in the boot process to fetch data out of the multiboot
@ -28,22 +28,22 @@ static inline void clear_memmap(int index)
}
}
void z_x86_multiboot_init(struct x86_multiboot_info *info)
void z_multiboot_init(struct multiboot_info *info)
{
if (info != NULL) {
memcpy(&x86_multiboot_info, info, sizeof(*info));
memcpy(&multiboot_info, info, sizeof(*info));
}
#ifdef CONFIG_X86_MULTIBOOT_MEMMAP
#ifdef CONFIG_MULTIBOOT_MEMMAP
/*
* If the extended map (basically, the equivalent of
* the BIOS E820 map) is available, then use that.
*/
if ((info->flags & X86_MULTIBOOT_INFO_FLAGS_MMAP) &&
if ((info->flags & MULTIBOOT_INFO_FLAGS_MMAP) &&
(x86_memmap_source < X86_MEMMAP_SOURCE_MULTIBOOT_MMAP)) {
u32_t address = info->mmap_addr;
struct x86_multiboot_mmap *mmap;
struct multiboot_mmap *mmap;
int index = 0;
u32_t type;
@ -55,16 +55,16 @@ void z_x86_multiboot_init(struct x86_multiboot_info *info)
x86_memmap[index].length = mmap->length;
switch (mmap->type) {
case X86_MULTIBOOT_MMAP_RAM:
case MULTIBOOT_MMAP_RAM:
type = X86_MEMMAP_ENTRY_RAM;
break;
case X86_MULTIBOOT_MMAP_ACPI:
case MULTIBOOT_MMAP_ACPI:
type = X86_MEMMAP_ENTRY_ACPI;
break;
case X86_MULTIBOOT_MMAP_NVS:
case MULTIBOOT_MMAP_NVS:
type = X86_MEMMAP_ENTRY_NVS;
break;
case X86_MULTIBOOT_MMAP_DEFECTIVE:
case MULTIBOOT_MMAP_DEFECTIVE:
type = X86_MEMMAP_ENTRY_DEFECTIVE;
break;
default:
@ -82,7 +82,7 @@ void z_x86_multiboot_init(struct x86_multiboot_info *info)
/* If no extended map is available, fall back to the basic map. */
if ((info->flags & X86_MULTIBOOT_INFO_FLAGS_MEM) &&
if ((info->flags & MULTIBOOT_INFO_FLAGS_MEM) &&
(x86_memmap_source < X86_MEMMAP_SOURCE_MULTIBOOT_MEM)) {
x86_memmap[0].base = 0;
x86_memmap[0].length = info->mem_lower * 1024ULL;
@ -97,26 +97,26 @@ void z_x86_multiboot_init(struct x86_multiboot_info *info)
x86_memmap_source = X86_MEMMAP_SOURCE_MULTIBOOT_MEM;
}
#endif /* CONFIG_X86_MULTIBOOT_MEMMAP */
#endif /* CONFIG_MULTIBOOT_MEMMAP */
}
#ifdef CONFIG_X86_MULTIBOOT_FRAMEBUF
#ifdef CONFIG_MULTIBOOT_FRAMEBUF
#include <display/framebuf.h>
static struct framebuf_dev_data multiboot_framebuf_data = {
.width = CONFIG_X86_MULTIBOOT_FRAMEBUF_X,
.height = CONFIG_X86_MULTIBOOT_FRAMEBUF_Y
.width = CONFIG_MULTIBOOT_FRAMEBUF_X,
.height = CONFIG_MULTIBOOT_FRAMEBUF_Y
};
static int multiboot_framebuf_init(struct device *dev)
{
struct framebuf_dev_data *data = FRAMEBUF_DATA(dev);
struct x86_multiboot_info *info = &x86_multiboot_info;
struct multiboot_info *info = &multiboot_info;
if ((info->flags & X86_MULTIBOOT_INFO_FLAGS_FB) &&
(info->fb_width >= CONFIG_X86_MULTIBOOT_FRAMEBUF_X) &&
(info->fb_height >= CONFIG_X86_MULTIBOOT_FRAMEBUF_Y) &&
if ((info->flags & MULTIBOOT_INFO_FLAGS_FB) &&
(info->fb_width >= CONFIG_MULTIBOOT_FRAMEBUF_X) &&
(info->fb_height >= CONFIG_MULTIBOOT_FRAMEBUF_Y) &&
(info->fb_bpp == 32) && (info->fb_addr_hi == 0)) {
/*
* We have a usable multiboot framebuffer - it is 32 bpp
@ -128,8 +128,8 @@ static int multiboot_framebuf_init(struct device *dev)
u16_t adj_y;
u32_t *buffer;
adj_x = info->fb_width - CONFIG_X86_MULTIBOOT_FRAMEBUF_X;
adj_y = info->fb_height - CONFIG_X86_MULTIBOOT_FRAMEBUF_Y;
adj_x = info->fb_width - CONFIG_MULTIBOOT_FRAMEBUF_X;
adj_y = info->fb_height - CONFIG_MULTIBOOT_FRAMEBUF_Y;
data->pitch = (info->fb_pitch / 4) + adj_x;
adj_x /= 2;
adj_y /= 2;
@ -152,6 +152,6 @@ DEVICE_AND_API_INIT(multiboot_framebuf,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&framebuf_display_api);
#endif /* CONFIG_X86_MULTIBOOT_FRAMEBUF */
#endif /* CONFIG_MULTIBOOT_FRAMEBUF */
#endif /* CONFIG_X86_MULTIBOOT_INFO */
#endif /* CONFIG_MULTIBOOT_INFO */

View File

@ -16,9 +16,8 @@
GEN_OFFSET_SYM(_thread_arch_t, flags);
/* size of struct x86_multiboot_info, used by crt0.S/locore.S */
/* size of struct multiboot_info, used by crt0.S/locore.S */
GEN_ABSOLUTE_SYM(__X86_MULTIBOOT_INFO_SIZEOF,
sizeof(struct x86_multiboot_info));
GEN_ABSOLUTE_SYM(__MULTIBOOT_INFO_SIZEOF, sizeof(struct multiboot_info));
GEN_ABS_SYM_END

View File

@ -4,7 +4,7 @@
if BOARD_GPMRB
config X86_MULTIBOOT
config MULTIBOOT
default n
config BOARD

View File

@ -16,7 +16,7 @@
* present, that means only those pertaining to the framebuffer.
*/
struct x86_multiboot_info {
struct multiboot_info {
u32_t flags;
u32_t mem_lower;
u32_t mem_upper;
@ -34,15 +34,15 @@ struct x86_multiboot_info {
u8_t fb_color_info[6];
};
extern struct x86_multiboot_info x86_multiboot_info;
extern struct multiboot_info multiboot_info;
extern void z_x86_multiboot_init(struct x86_multiboot_info *);
extern void z_multiboot_init(struct multiboot_info *);
/*
* the mmap_addr field points to a series of entries of the following form.
*/
struct x86_multiboot_mmap {
struct multiboot_mmap {
u32_t size;
u64_t base;
u64_t length;
@ -52,24 +52,24 @@ struct x86_multiboot_mmap {
#endif /* _ASMLANGUAGE */
/*
* Possible values for x86_multiboot_mmap.type field.
* Possible values for multiboot_mmap.type field.
* Other values should be assumed to be unusable ranges.
*/
#define X86_MULTIBOOT_MMAP_RAM 1 /* available RAM */
#define X86_MULTIBOOT_MMAP_ACPI 3 /* reserved for ACPI */
#define X86_MULTIBOOT_MMAP_NVS 4 /* ACPI non-volatile */
#define X86_MULTIBOOT_MMAP_DEFECTIVE 5 /* defective RAM module */
#define MULTIBOOT_MMAP_RAM 1 /* available RAM */
#define MULTIBOOT_MMAP_ACPI 3 /* reserved for ACPI */
#define MULTIBOOT_MMAP_NVS 4 /* ACPI non-volatile */
#define MULTIBOOT_MMAP_DEFECTIVE 5 /* defective RAM module */
/*
* Magic numbers: the kernel multiboot header (see crt0.S) begins with
* X86_MULTIBOOT_HEADER_MAGIC to signal to the booter that it supports
* multiboot. On kernel entry, EAX is set to X86_MULTIBOOT_EAX_MAGIC to
* MULTIBOOT_HEADER_MAGIC to signal to the booter that it supports
* multiboot. On kernel entry, EAX is set to MULTIBOOT_EAX_MAGIC to
* signal that the boot loader is multiboot compliant.
*/
#define X86_MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define X86_MULTIBOOT_EAX_MAGIC 0x2BADB002
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define MULTIBOOT_EAX_MAGIC 0x2BADB002
/*
* Typically, we put no flags in the multiboot header, as it exists solely
@ -77,24 +77,24 @@ struct x86_multiboot_mmap {
* is when we want the loader to configure the framebuffer for us.
*/
#define X86_MULTIBOOT_HEADER_FLAG_MEM (1 << 1) /* want mem_/mmap_* info */
#define X86_MULTIBOOT_HEADER_FLAG_FB (1 << 2) /* want fb_* info */
#define MULTIBOOT_HEADER_FLAG_MEM (1 << 1) /* want mem_/mmap_* info */
#define MULTIBOOT_HEADER_FLAG_FB (1 << 2) /* want fb_* info */
#ifdef CONFIG_X86_MULTIBOOT_FRAMEBUF
#define X86_MULTIBOOT_HEADER_FLAGS \
(X86_MULTIBOOT_HEADER_FLAG_FB | X86_MULTIBOOT_HEADER_FLAG_MEM)
#ifdef CONFIG_MULTIBOOT_FRAMEBUF
#define MULTIBOOT_HEADER_FLAGS \
(MULTIBOOT_HEADER_FLAG_FB | MULTIBOOT_HEADER_FLAG_MEM)
#else
#define X86_MULTIBOOT_HEADER_FLAGS X86_MULTIBOOT_HEADER_FLAG_MEM
#define MULTIBOOT_HEADER_FLAGS MULTIBOOT_HEADER_FLAG_MEM
#endif
/* The flags in the boot info structure tell us which fields are valid. */
#define X86_MULTIBOOT_INFO_FLAGS_MEM (1 << 0) /* mem_* valid */
#define X86_MULTIBOOT_INFO_FLAGS_MMAP (1 << 6) /* mmap_* valid */
#define X86_MULTIBOOT_INFO_FLAGS_FB (1 << 12) /* fb_* 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 */
/* The only fb_type we support is RGB. No text modes and no color palettes. */
#define X86_MULTIBOOT_INFO_FB_TYPE_RGB 1
#define MULTIBOOT_INFO_FB_TYPE_RGB 1
#endif /* ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ */

View File

@ -10,4 +10,4 @@ target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/timer.c)
target_sources(app PRIVATE src/memmap.c)
target_sources_ifdef(CONFIG_X86_ACPI app PRIVATE src/acpi.c)
target_sources_ifdef(CONFIG_X86_MULTIBOOT app PRIVATE src/multiboot.c)
target_sources_ifdef(CONFIG_MULTIBOOT app PRIVATE src/multiboot.c)

View File

@ -1,6 +1,6 @@
CONFIG_X86_ACPI=y
CONFIG_X86_MULTIBOOT_INFO=y
CONFIG_X86_MULTIBOOT_MEMMAP=y
CONFIG_X86_MULTIBOOT_FRAMEBUF=y
CONFIG_MULTIBOOT_INFO=y
CONFIG_MULTIBOOT_MEMMAP=y
CONFIG_MULTIBOOT_FRAMEBUF=y
CONFIG_COUNTER=y
CONFIG_COUNTER_CMOS=y

View File

@ -8,7 +8,7 @@
void multiboot(void)
{
#ifndef CONFIG_X86_MULTIBOOT_INFO
#ifndef CONFIG_MULTIBOOT_INFO
printk("MULTIBOOT: info struct NOT preserved.\n\n");
#else
/*
@ -17,36 +17,36 @@ void multiboot(void)
* (highly unlikely) we DID get a valid struct, but it was empty.
*/
if (!x86_multiboot_info.flags) {
if (!multiboot_info.flags) {
printk("MULTIBOOT: info struct UNAVAILABLE or EMPTY.\n\n");
} else {
printk("MULTIBOOT: boot info structure available.\n");
printk("\tFlags = 0x%08x\n", x86_multiboot_info.flags);
printk("\tFlags = 0x%08x\n", multiboot_info.flags);
}
if (x86_multiboot_info.flags & X86_MULTIBOOT_INFO_FLAGS_MEM) {
if (multiboot_info.flags & MULTIBOOT_INFO_FLAGS_MEM) {
printk("\tBasic memory map: lower = %dK, upper = %dK.\n",
x86_multiboot_info.mem_lower,
x86_multiboot_info.mem_upper);
multiboot_info.mem_lower,
multiboot_info.mem_upper);
} else {
printk("\tNo basic memory map available.\n");
}
if (x86_multiboot_info.flags & X86_MULTIBOOT_INFO_FLAGS_MMAP) {
if (multiboot_info.flags & MULTIBOOT_INFO_FLAGS_MMAP) {
printk("\tExtended memory map was at 0x%08x (%d bytes).\n",
x86_multiboot_info.mmap_addr,
x86_multiboot_info.mmap_length);
multiboot_info.mmap_addr,
multiboot_info.mmap_length);
} else {
printk("\tNo extended memory map available.\n");
}
if (x86_multiboot_info.flags & X86_MULTIBOOT_INFO_FLAGS_FB) {
if (multiboot_info.flags & MULTIBOOT_INFO_FLAGS_FB) {
printk("\tFramebuffer %dbpp %dX%d (pitch %d) @ %08x.\n",
x86_multiboot_info.fb_bpp,
x86_multiboot_info.fb_width,
x86_multiboot_info.fb_height,
x86_multiboot_info.fb_pitch,
x86_multiboot_info.fb_addr_lo);
multiboot_info.fb_bpp,
multiboot_info.fb_width,
multiboot_info.fb_height,
multiboot_info.fb_pitch,
multiboot_info.fb_addr_lo);
} else {
printk("\tFramebuffer data not present.\n");
}