diff --git a/hypervisor/arch/x86/e820.c b/hypervisor/arch/x86/e820.c index a835150b2..2be74aa50 100644 --- a/hypervisor/arch/x86/e820.c +++ b/hypervisor/arch/x86/e820.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/hypervisor/arch/x86/seed/seed.c b/hypervisor/arch/x86/seed/seed.c index 0c0546c16..43b1e09aa 100644 --- a/hypervisor/arch/x86/seed/seed.c +++ b/hypervisor/arch/x86/seed/seed.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include "seed_abl.h" diff --git a/hypervisor/boot/acpi_base.c b/hypervisor/boot/acpi_base.c index 4f7854fa3..f4cb5b42f 100644 --- a/hypervisor/boot/acpi_base.c +++ b/hypervisor/boot/acpi_base.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include static struct acpi_table_rsdp *acpi_rsdp; diff --git a/hypervisor/boot/cmdline.c b/hypervisor/boot/cmdline.c index 72bed57e7..8496140ed 100644 --- a/hypervisor/boot/cmdline.c +++ b/hypervisor/boot/cmdline.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/hypervisor/boot/include/boot.h b/hypervisor/boot/include/boot.h index 4d4a8845a..689084298 100644 --- a/hypervisor/boot/include/boot.h +++ b/hypervisor/boot/include/boot.h @@ -7,60 +7,15 @@ #ifndef BOOT_H_ #define BOOT_H_ -#include -#ifdef CONFIG_MULTIBOOT2 -#include -#endif -#include -#include -#include +#include -#define MAX_BOOTARGS_SIZE 2048U -/* The modules in multiboot are: Pre-launched VM: kernel/ramdisk/acpi; SOS VM: kernel/ramdisk */ -#define MAX_MODULE_NUM (3U * PRE_VM_NUM + 2U * SOS_VM_NUM) - -/* The vACPI module size is fixed to 1MB */ -#define ACPI_MODULE_SIZE MEM_1M - -/* extended flags for acrn multiboot info from multiboot2 */ -#define MULTIBOOT_INFO_HAS_EFI_MMAP 0x00010000U -#define MULTIBOOT_INFO_HAS_EFI64 0x00020000U - -struct acrn_multiboot_info { - uint32_t mi_flags; /* the flags is back-compatible with multiboot1 */ - - const char *mi_cmdline; - const char *mi_loader_name; - - uint32_t mi_mods_count; - const void *mi_mods_va; - struct multiboot_module mi_mods[MAX_MODULE_NUM]; - - uint32_t mi_drives_length; - uint32_t mi_drives_addr; - - uint32_t mi_mmap_entries; - const void *mi_mmap_va; - struct multiboot_mmap mi_mmap_entry[E820_MAX_ENTRIES]; - - const void *mi_acpi_rsdp_va; - struct efi_info mi_efi_info; -}; +#ifndef ASSEMBLER /* boot_regs store the multiboot info magic and address */ extern uint32_t boot_regs[2]; extern char *efiloader_sig; -/* - * The extern declaration for acrn_mbi is for cmdline.c use only, other functions should use - * get_multiboot_info() API to access struct acrn_mbi because it has explict @post condition - */ -extern struct acrn_multiboot_info acrn_mbi; -struct acrn_multiboot_info *get_multiboot_info(void); -void init_acrn_multiboot_info(void); -int32_t sanitize_multiboot_info(void); -void parse_hv_cmdline(void); -const void* get_rsdp_ptr(void); +#endif /* ASSEMBLER */ #endif /* BOOT_H_ */ diff --git a/hypervisor/boot/include/multiboot.h b/hypervisor/boot/include/multiboot.h index 6dfe1140e..43b8e5186 100644 --- a/hypervisor/boot/include/multiboot.h +++ b/hypervisor/boot/include/multiboot.h @@ -7,6 +7,10 @@ #ifndef MULTIBOOT_H #define MULTIBOOT_H +#ifdef CONFIG_MULTIBOOT2 +#include +#endif + #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 #define MULTIBOOT_INFO_MAGIC 0x2BADB002U @@ -20,8 +24,23 @@ #define MULTIBOOT_INFO_HAS_DRIVES 0x00000080U #define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200U +/* extended flags for acrn multiboot info from multiboot2 */ +#define MULTIBOOT_INFO_HAS_EFI_MMAP 0x00010000U +#define MULTIBOOT_INFO_HAS_EFI64 0x00020000U + +#define MAX_BOOTARGS_SIZE 2048U +/* The modules in multiboot are: Pre-launched VM: kernel/ramdisk/acpi; SOS VM: kernel/ramdisk */ +#define MAX_MODULE_NUM (3U * PRE_VM_NUM + 2U * SOS_VM_NUM) + +/* The vACPI module size is fixed to 1MB */ +#define ACPI_MODULE_SIZE MEM_1M + #ifndef ASSEMBLER +#include +#include +#include + struct multiboot_info { uint32_t mi_flags; @@ -87,6 +106,40 @@ struct multiboot_module { uint32_t mm_reserved; }; +struct acrn_multiboot_info { + uint32_t mi_flags; /* the flags is back-compatible with multiboot1 */ + + const char *mi_cmdline; + const char *mi_loader_name; + + uint32_t mi_mods_count; + const void *mi_mods_va; + struct multiboot_module mi_mods[MAX_MODULE_NUM]; + + uint32_t mi_drives_length; + uint32_t mi_drives_addr; + + uint32_t mi_mmap_entries; + const void *mi_mmap_va; + struct multiboot_mmap mi_mmap_entry[E820_MAX_ENTRIES]; + + const void *mi_acpi_rsdp_va; + struct efi_info mi_efi_info; +}; + +/* + * The extern declaration for acrn_mbi is for cmdline.c use only, other functions should use + * get_multiboot_info() API to access struct acrn_mbi because it has explict @post condition + */ +extern struct acrn_multiboot_info acrn_mbi; + +void init_acrn_multiboot_info(void); +struct acrn_multiboot_info *get_multiboot_info(void); +int32_t sanitize_multiboot_info(void); + +void parse_hv_cmdline(void); +const void* get_rsdp_ptr(void); + #endif /* ASSEMBLER */ #endif /* MULTIBOOT_H */ diff --git a/hypervisor/boot/multiboot/multiboot.c b/hypervisor/boot/multiboot/multiboot.c index fdf49da22..8846da965 100644 --- a/hypervisor/boot/multiboot/multiboot.c +++ b/hypervisor/boot/multiboot/multiboot.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include "multiboot_priv.h" diff --git a/hypervisor/boot/multiboot/multiboot2.c b/hypervisor/boot/multiboot/multiboot2.c index a3b30b3c3..f7a3ec012 100644 --- a/hypervisor/boot/multiboot/multiboot2.c +++ b/hypervisor/boot/multiboot/multiboot2.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "multiboot_priv.h" diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index c5ddf0d68..7a3292564 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -9,8 +9,8 @@ #include #include -#include #include +#include #include #include #include