From 520a0222d379477672e8cef5a30225204dfdf8db Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Thu, 20 Feb 2020 15:15:03 +0800 Subject: [PATCH] HV: re-arch boot component header The patch re-arch boot component header files by: - moving multiboot.h from include/arch/x86/ to boot/include/ and keep this header for multiboot1 protocol data struct only; - moving multiboot related MACROs in cpu_primary.S to multiboot.h; - creating an independent boot.h to store acrn specific boot information for other files' reference; Tracked-On: #4419 Signed-off-by: Victor Sun Acked-by: Eddie Dong --- hypervisor/arch/x86/boot/cpu_primary.S | 4 ++-- hypervisor/arch/x86/e820.c | 2 +- hypervisor/arch/x86/seed/seed.c | 2 +- hypervisor/boot/cmdline.c | 3 +-- hypervisor/boot/guest/deprivilege_boot.c | 2 +- hypervisor/boot/guest/vboot_info.c | 2 +- hypervisor/boot/guest/vboot_wrapper.c | 2 +- hypervisor/boot/include/boot.h | 17 +++++++++++++++++ .../arch/x86 => boot/include}/multiboot.h | 16 ++++++++++------ hypervisor/include/arch/x86/vm_config.h | 2 +- 10 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 hypervisor/boot/include/boot.h rename hypervisor/{include/arch/x86 => boot/include}/multiboot.h (91%) diff --git a/hypervisor/arch/x86/boot/cpu_primary.S b/hypervisor/arch/x86/boot/cpu_primary.S index bbb917b60..6c1c2b431 100644 --- a/hypervisor/arch/x86/boot/cpu_primary.S +++ b/hypervisor/arch/x86/boot/cpu_primary.S @@ -21,9 +21,9 @@ * the macros involved are changed. */ +#include /* MULTIBOOT HEADER */ -#define MULTIBOOT_HEADER_MAGIC 0x1badb002 -#define MULTIBOOT_HEADER_FLAGS 0x00000002 /*flags bit 1 : enable mem_*, mmap_**/ +#define MULTIBOOT_HEADER_FLAGS MULTIBOOT_HEADER_NEED_MEMINFO .extern cpu_primary_save32 .extern cpu_primary_save64 diff --git a/hypervisor/arch/x86/e820.c b/hypervisor/arch/x86/e820.c index 3d57a517b..6a9ff3231 100644 --- a/hypervisor/arch/x86/e820.c +++ b/hypervisor/arch/x86/e820.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include /* diff --git a/hypervisor/arch/x86/seed/seed.c b/hypervisor/arch/x86/seed/seed.c index d3de607cb..3cd91ceb1 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/cmdline.c b/hypervisor/boot/cmdline.c index cd77a5d07..a68c98bc1 100644 --- a/hypervisor/boot/cmdline.c +++ b/hypervisor/boot/cmdline.c @@ -6,11 +6,10 @@ #include #include -#include +#include #include #include #include -#include void parse_hv_cmdline(void) { diff --git a/hypervisor/boot/guest/deprivilege_boot.c b/hypervisor/boot/guest/deprivilege_boot.c index fb172c55f..895c2d68a 100644 --- a/hypervisor/boot/guest/deprivilege_boot.c +++ b/hypervisor/boot/guest/deprivilege_boot.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include static struct depri_boot_context depri_boot_ctx; diff --git a/hypervisor/boot/guest/vboot_info.c b/hypervisor/boot/guest/vboot_info.c index d6188f5a5..43bfd4b6e 100644 --- a/hypervisor/boot/guest/vboot_info.c +++ b/hypervisor/boot/guest/vboot_info.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/hypervisor/boot/guest/vboot_wrapper.c b/hypervisor/boot/guest/vboot_wrapper.c index f264400cf..54fb09602 100644 --- a/hypervisor/boot/guest/vboot_wrapper.c +++ b/hypervisor/boot/guest/vboot_wrapper.c @@ -4,11 +4,11 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include #include #include #include #include +#include #include #include #include diff --git a/hypervisor/boot/include/boot.h b/hypervisor/boot/include/boot.h new file mode 100644 index 000000000..861847dff --- /dev/null +++ b/hypervisor/boot/include/boot.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2020 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef BOOT_H_ +#define BOOT_H_ + +#include + +#define MAX_BOOTARGS_SIZE 2048U + +/* boot_regs store the multiboot info magic and address */ +extern uint32_t boot_regs[2]; + +#endif /* BOOT_H_ */ diff --git a/hypervisor/include/arch/x86/multiboot.h b/hypervisor/boot/include/multiboot.h similarity index 91% rename from hypervisor/include/arch/x86/multiboot.h rename to hypervisor/boot/include/multiboot.h index b35e6501a..6dfe1140e 100644 --- a/hypervisor/include/arch/x86/multiboot.h +++ b/hypervisor/boot/include/multiboot.h @@ -7,16 +7,20 @@ #ifndef MULTIBOOT_H #define MULTIBOOT_H -#include +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 #define MULTIBOOT_INFO_MAGIC 0x2BADB002U + +/* MULTIBOOT HEADER FLAGS */ +#define MULTIBOOT_HEADER_NEED_MEMINFO 0x00000002 + +/* MULTIBOOT INFO FLAGS */ #define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004U #define MULTIBOOT_INFO_HAS_MODS 0x00000008U #define MULTIBOOT_INFO_HAS_MMAP 0x00000040U #define MULTIBOOT_INFO_HAS_DRIVES 0x00000080U #define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200U -/* maximum lengt of the guest OS' command line parameter string */ -#define MAX_BOOTARGS_SIZE 2048U +#ifndef ASSEMBLER struct multiboot_info { uint32_t mi_flags; @@ -83,6 +87,6 @@ struct multiboot_module { uint32_t mm_reserved; }; -/* boot_regs store the multiboot header address */ -extern uint32_t boot_regs[2]; -#endif +#endif /* ASSEMBLER */ + +#endif /* MULTIBOOT_H */ diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index b7c74094f..7b34c51db 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include