mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 03:40:27 +00:00
HV:EFI-STUB:UEFI loader name supporting
In the current design, UEFI loader name is not supported, it is hard to ditinguish UEFI boot loader (efi stub in the code) from other multiboot compiliant boot loader (such as SBL, ABL, GRUB etc) explicitly. From long term, it is better that detect boot loader according to loader name and use different boot method according to different boot loader and VM configuration flag. Allocate memory to store UEFI loader name statically, set MULTIBOOT_INFO_BOOT_LOADER_NAME in flag of the multiboot header, store host physical start address of loader name in the multiboot header according to multiboot protocol. V5-->V6: Update "Tracked-On" Tracked-On: #2944 Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
048d72fd94
commit
a13c19b450
@@ -247,6 +247,8 @@ switch_to_guest_mode(EFI_HANDLE image, EFI_PHYSICAL_ADDRESS hv_hpa)
|
||||
struct acpi_table_rsdp *rsdp = NULL;
|
||||
int32_t i;
|
||||
EFI_CONFIGURATION_TABLE *config_table;
|
||||
char *uefi_boot_loader_name;
|
||||
const char loader_name[BOOT_LOADER_NAME_SIZE] = UEFI_BOOT_LOADER_NAME;
|
||||
|
||||
err = allocate_pool(EfiLoaderData, EFI_BOOT_MEM_SIZE, (VOID *)&addr);
|
||||
if (err != EFI_SUCCESS) {
|
||||
@@ -259,6 +261,9 @@ switch_to_guest_mode(EFI_HANDLE image, EFI_PHYSICAL_ADDRESS hv_hpa)
|
||||
mbi = MBOOT_INFO_PTR(addr);
|
||||
efi_ctx = BOOT_CTX_PTR(addr);
|
||||
|
||||
uefi_boot_loader_name = BOOT_LOADER_NAME_PTR(addr);
|
||||
memcpy(uefi_boot_loader_name, loader_name, BOOT_LOADER_NAME_SIZE);
|
||||
|
||||
/* reserve secondary memory region for CPU trampoline code */
|
||||
err = emalloc_reserved_mem(&addr, CONFIG_LOW_RAM_SIZE, MEM_ADDR_1MB);
|
||||
if (err != EFI_SUCCESS)
|
||||
@@ -302,6 +307,12 @@ switch_to_guest_mode(EFI_HANDLE image, EFI_PHYSICAL_ADDRESS hv_hpa)
|
||||
mbi->mi_flags |= MULTIBOOT_INFO_HAS_DRIVES;
|
||||
mbi->mi_drives_addr = (UINT32)(UINTN)efi_ctx;
|
||||
|
||||
/* Set boot loader name in the multiboot header of UEFI, this name is used by hypervisor;
|
||||
* The host physical start address of boot loader name is stored in multiboot header.
|
||||
*/
|
||||
mbi->mi_flags |= MULTIBOOT_INFO_HAS_LOADER_NAME;
|
||||
mbi->mi_loader_name = (UINT32)uefi_boot_loader_name;
|
||||
|
||||
asm volatile ("pushf\n\t"
|
||||
"pop %0\n\t"
|
||||
: "=r"(efi_ctx->vcpu_regs.rflags)
|
||||
|
Reference in New Issue
Block a user