mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-02 00:08:43 +00:00
hv: modularization: remove global variable efiloader_sig.
Simplify multiboot API by removing the global variable efiloader_sig. Replaced by constant at the use site. Tracked-On: #5661 Signed-off-by: Yi Liang <yi.liang@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
67926cee81
commit
e8a76868c9
@ -314,9 +314,3 @@ cpu_primary32_pdt_addr:
|
|||||||
.quad address + 0x83
|
.quad address + 0x83
|
||||||
address = address + 0x200000
|
address = address + 0x200000
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
#ifdef CONFIG_MULTIBOOT2
|
|
||||||
.global efiloader_sig
|
|
||||||
efiloader_sig:
|
|
||||||
.asciz "EL64"
|
|
||||||
#endif
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
#include <ld_sym.h>
|
#include <ld_sym.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
|
|
||||||
/* The following are assembly varaibles defined in arch/x86/boot/cpu_primary.S */
|
/* boot_regs store the multiboot info magic and address, defined in
|
||||||
/* boot_regs store the multiboot info magic and address */
|
arch/x86/boot/cpu_primary.S.
|
||||||
|
*/
|
||||||
extern uint32_t boot_regs[2];
|
extern uint32_t boot_regs[2];
|
||||||
extern char *efiloader_sig;
|
|
||||||
|
|
||||||
/* Push sp magic to top of stack for call trace */
|
/* Push sp magic to top of stack for call trace */
|
||||||
#define SWITCH_TO(rsp, to) \
|
#define SWITCH_TO(rsp, to) \
|
||||||
@ -91,7 +91,7 @@ void init_primary_pcpu(void)
|
|||||||
/* Clear BSS */
|
/* Clear BSS */
|
||||||
(void)memset(&ld_bss_start, 0U, (size_t)(&ld_bss_end - &ld_bss_start));
|
(void)memset(&ld_bss_start, 0U, (size_t)(&ld_bss_end - &ld_bss_start));
|
||||||
|
|
||||||
init_acrn_multiboot_info(boot_regs[0], boot_regs[1], efiloader_sig);
|
init_acrn_multiboot_info(boot_regs[0], boot_regs[1]);
|
||||||
|
|
||||||
init_debug_pre();
|
init_debug_pre();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ struct acrn_multiboot_info {
|
|||||||
struct efi_info mi_efi_info;
|
struct efi_info mi_efi_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_acrn_multiboot_info(uint32_t magic, uint32_t info, char *sig);
|
void init_acrn_multiboot_info(uint32_t magic, uint32_t info);
|
||||||
int32_t sanitize_acrn_multiboot_info(uint32_t magic, uint32_t info);
|
int32_t sanitize_acrn_multiboot_info(uint32_t magic, uint32_t info);
|
||||||
struct acrn_multiboot_info *get_acrn_multiboot_info(void);
|
struct acrn_multiboot_info *get_acrn_multiboot_info(void);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ static struct acrn_multiboot_info acrn_mbi = { 0U };
|
|||||||
|
|
||||||
static int32_t mbi_status;
|
static int32_t mbi_status;
|
||||||
|
|
||||||
void init_acrn_multiboot_info(uint32_t magic, uint32_t info, char *sig)
|
void init_acrn_multiboot_info(uint32_t magic, uint32_t info)
|
||||||
{
|
{
|
||||||
if (boot_from_multiboot1(magic, info)) {
|
if (boot_from_multiboot1(magic, info)) {
|
||||||
struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)info));
|
struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)info));
|
||||||
@ -84,7 +84,7 @@ void init_acrn_multiboot_info(uint32_t magic, uint32_t info, char *sig)
|
|||||||
mbi_status = 0;
|
mbi_status = 0;
|
||||||
#ifdef CONFIG_MULTIBOOT2
|
#ifdef CONFIG_MULTIBOOT2
|
||||||
} else if (boot_from_multiboot2(magic)) {
|
} else if (boot_from_multiboot2(magic)) {
|
||||||
mbi_status = multiboot2_to_acrn_mbi(&acrn_mbi, hpa2hva_early((uint64_t)info), sig);
|
mbi_status = multiboot2_to_acrn_mbi(&acrn_mbi, hpa2hva_early((uint64_t)info));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
mbi_status = -ENODEV;
|
mbi_status = -ENODEV;
|
||||||
|
@ -36,11 +36,11 @@ static void mb2_mods_to_mbi(struct acrn_multiboot_info *mbi,
|
|||||||
/**
|
/**
|
||||||
* @pre mbi != NULL && mb2_tag_efi64 != 0
|
* @pre mbi != NULL && mb2_tag_efi64 != 0
|
||||||
*/
|
*/
|
||||||
static void mb2_efi64_to_mbi(struct acrn_multiboot_info *mbi, const struct multiboot2_tag_efi64 *mb2_tag_efi64,
|
static void mb2_efi64_to_mbi(struct acrn_multiboot_info *mbi, const struct multiboot2_tag_efi64 *mb2_tag_efi64)
|
||||||
char *sig)
|
|
||||||
{
|
{
|
||||||
|
const uint32_t efiloader_sig = 0x34364c45; /* "EL64" */
|
||||||
mbi->mi_efi_info.efi_systab = (uint32_t)(uint64_t)mb2_tag_efi64->pointer;
|
mbi->mi_efi_info.efi_systab = (uint32_t)(uint64_t)mb2_tag_efi64->pointer;
|
||||||
mbi->mi_efi_info.efi_loader_signature = (uint32_t)(uint64_t)sig;
|
mbi->mi_efi_info.efi_loader_signature = efiloader_sig;
|
||||||
mbi->mi_flags |= MULTIBOOT_INFO_HAS_EFI64;
|
mbi->mi_flags |= MULTIBOOT_INFO_HAS_EFI64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ static void mb2_efimmap_to_mbi(struct acrn_multiboot_info *mbi,
|
|||||||
/**
|
/**
|
||||||
* @pre mbi != NULL
|
* @pre mbi != NULL
|
||||||
*/
|
*/
|
||||||
int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info, char *sig)
|
int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info)
|
||||||
{
|
{
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
struct multiboot2_tag *mb2_tag, *mb2_tag_end;
|
struct multiboot2_tag *mb2_tag, *mb2_tag_end;
|
||||||
@ -92,7 +92,7 @@ int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info,
|
|||||||
mbi->mi_acpi_rsdp_va = ((struct multiboot2_tag_new_acpi *)mb2_tag)->rsdp;
|
mbi->mi_acpi_rsdp_va = ((struct multiboot2_tag_new_acpi *)mb2_tag)->rsdp;
|
||||||
break;
|
break;
|
||||||
case MULTIBOOT2_TAG_TYPE_EFI64:
|
case MULTIBOOT2_TAG_TYPE_EFI64:
|
||||||
mb2_efi64_to_mbi(mbi, (const struct multiboot2_tag_efi64 *)mb2_tag, sig);
|
mb2_efi64_to_mbi(mbi, (const struct multiboot2_tag_efi64 *)mb2_tag);
|
||||||
break;
|
break;
|
||||||
case MULTIBOOT2_TAG_TYPE_EFI_MMAP:
|
case MULTIBOOT2_TAG_TYPE_EFI_MMAP:
|
||||||
mb2_efimmap_to_mbi(mbi, (const struct multiboot2_tag_efi_mmap *)mb2_tag);
|
mb2_efimmap_to_mbi(mbi, (const struct multiboot2_tag_efi_mmap *)mb2_tag);
|
||||||
|
@ -89,7 +89,7 @@ static inline bool boot_from_multiboot2(uint32_t magic)
|
|||||||
return (magic == MULTIBOOT2_INFO_MAGIC);
|
return (magic == MULTIBOOT2_INFO_MAGIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info, char *sig);
|
int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline bool boot_from_multiboot1(uint32_t magic, uint32_t info)
|
static inline bool boot_from_multiboot1(uint32_t magic, uint32_t info)
|
||||||
|
Loading…
Reference in New Issue
Block a user