From 655511932f325fde2ff45ac000ab41f2f0d67ca4 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Thu, 3 Jun 2021 19:40:50 +0800 Subject: [PATCH] HV: modularization: remove multiboot_priv.h Leave a multiboot_priv.h in multiboot folder is redundant, so remove it. Also, as a public interface, boot.h need not to include multiboot_std.h; Tracked-On: #5661 Signed-off-by: Victor Sun Reviewed-by: Jason Chen CJ --- hypervisor/boot/include/boot.h | 1 - hypervisor/boot/multiboot/multiboot.c | 9 +++-- hypervisor/boot/multiboot/multiboot2.c | 18 ++++++++-- hypervisor/boot/multiboot/multiboot_priv.h | 38 ---------------------- 4 files changed, 23 insertions(+), 43 deletions(-) delete mode 100644 hypervisor/boot/multiboot/multiboot_priv.h diff --git a/hypervisor/boot/include/boot.h b/hypervisor/boot/include/boot.h index 48b005a05..6c89a5bfd 100644 --- a/hypervisor/boot/include/boot.h +++ b/hypervisor/boot/include/boot.h @@ -7,7 +7,6 @@ #ifndef BOOT_H #define BOOT_H -#include #include #include diff --git a/hypervisor/boot/multiboot/multiboot.c b/hypervisor/boot/multiboot/multiboot.c index d7bb8a357..3afa4934a 100644 --- a/hypervisor/boot/multiboot/multiboot.c +++ b/hypervisor/boot/multiboot/multiboot.c @@ -8,12 +8,12 @@ #include #include #include -#include "multiboot_priv.h" +#include /** * @pre abi != NULL */ -int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) { +static int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) { uint32_t i; struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)mb_info)); struct multiboot_mmap *mmap = (struct multiboot_mmap *)hpa2hva_early((uint64_t)mbi->mi_mmap_addr); @@ -65,6 +65,11 @@ int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) { return 0; } +static inline bool boot_from_multiboot(uint32_t magic, uint32_t info) +{ + return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U)); +} + int32_t init_multiboot_info(uint32_t *registers) { int32_t ret = -ENODEV; diff --git a/hypervisor/boot/multiboot/multiboot2.c b/hypervisor/boot/multiboot/multiboot2.c index 44530cc00..74da8e249 100644 --- a/hypervisor/boot/multiboot/multiboot2.c +++ b/hypervisor/boot/multiboot/multiboot2.c @@ -7,8 +7,8 @@ #include #include #include +#include #include -#include "multiboot_priv.h" /** * @pre abi != NULL && mb2_tag_mmap != NULL @@ -62,7 +62,7 @@ static void mb2_efimmap_to_abi(struct acrn_boot_info *abi, /** * @pre abi != NULL */ -int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info) +static int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info) { int32_t ret = 0; struct multiboot2_tag *mb2_tag, *mb2_tag_end; @@ -130,6 +130,20 @@ int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info) return ret; } +static inline bool boot_from_multiboot2(uint32_t magic) +{ + /* + * Multiboot spec states that the Multiboot information structure may be placed + * anywhere in memory by the boot loader. + * + * Seems both SBL and GRUB won't place multiboot1 MBI structure at 0 address, + * but GRUB could place Multiboot2 MBI structure at 0 address until commit + * 0f3f5b7c13fa9b67 ("multiboot2: Set min address for mbi allocation to 0x1000") + * which dates on Dec 26 2019. + */ + return (magic == MULTIBOOT2_INFO_MAGIC); +} + int32_t init_multiboot2_info(uint32_t *registers) { int32_t ret = -ENODEV; diff --git a/hypervisor/boot/multiboot/multiboot_priv.h b/hypervisor/boot/multiboot/multiboot_priv.h deleted file mode 100644 index 75a4f4f04..000000000 --- a/hypervisor/boot/multiboot/multiboot_priv.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2020 Intel Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef MULTIBOOT_PRIV_H -#define MULTIBOOT_PRIV_H - -static inline bool boot_from_multiboot(uint32_t magic, uint32_t info) -{ - return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U)); -} - -int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info); - -#ifdef CONFIG_MULTIBOOT2 -/* - * @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info - */ -static inline bool boot_from_multiboot2(uint32_t magic) -{ - /* - * Multiboot spec states that the Multiboot information structure may be placed - * anywhere in memory by the boot loader. - * - * Seems both SBL and GRUB won't place multiboot1 MBI structure at 0 address, - * but GRUB could place Multiboot2 MBI structure at 0 address until commit - * 0f3f5b7c13fa9b67 ("multiboot2: Set min address for mbi allocation to 0x1000") - * which dates on Dec 26 2019. - */ - return (magic == MULTIBOOT2_INFO_MAGIC); -} - -int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info); -#endif - -#endif /* MULTIBOOT_PRIV_H */