mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-13 10:54:25 +00:00
In the current design, hypervisor only detects two kinds of multiboot compiliant firwares (UEFI loader and non-UEFI loader), It can't detect other multiboot compliant firware (such GRUB loader) and can't detect UEFI loader explicitly since loader name is not supported by UEFI loader (efi stub). In the logical partition scenario on KBL NUC i7, one multiboot compliant firware is used to boot hypervisor and load guest OS image, and firware runtime service shall be disable to avoid interference. So GRUB can be selected as a candidate to enable logical partition scenario on KBL NUC i7. Update firware detection and operations selecting logic to detect more multiboot compiliant firware (such as GRUB and UEFI loader) explicitly, different operations is selected according to the boot load name through a static mapping table between boot load name and firmware operations. GRUB loader can use the SBL operations to handle multiboot information parsing and vm booting since these multiboot compiliant firmware (SBL/ABL/GRUB) which boots hypervisor (binary format), provides multiboot information and the start address of guest OS image(binary format) in the same way, and only runs on boot time. From MISRA C view, viarble array is not allowed, so define the static array for above mapping table; From security view, it is better use strncmp insteads of strcmp. TODO: In future, need to redesign boot moudle to suport different boot loader, different VM boot, and different guest OS. V2-->V3: Update firmware detection logic to handle GRUB loader which is need to provided multiboot information to the hypervisor (such as the address of guest OS image); V3-->V4: Update firmware detection and operations selecting logic to enable GRUB loader support in hypervisor; V4-->V5: Separte UEFI loader name supporting in a separate patch, and update commit comment to make patch clearer. 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>
40 lines
845 B
C
40 lines
845 B
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef FIRMWARE_H
|
|
|
|
#define FIRMWARE_H
|
|
|
|
#define NUM_FIRMWARE_SUPPORTING 4U
|
|
|
|
struct acrn_vm;
|
|
struct firmware_operations {
|
|
void (*init)(void);
|
|
uint64_t (*get_ap_trampoline)(void);
|
|
void *(*get_rsdp)(void);
|
|
void (*init_irq)(void);
|
|
int32_t (*init_vm_boot_info)(struct acrn_vm *vm);
|
|
};
|
|
|
|
struct firmware_candidates {
|
|
const char name[20];
|
|
size_t name_sz;
|
|
struct firmware_operations *(*ops)(void);
|
|
};
|
|
|
|
void init_firmware_operations(void);
|
|
void init_firmware(void);
|
|
uint64_t firmware_get_ap_trampoline(void);
|
|
void *firmware_get_rsdp(void);
|
|
void firmware_init_irq(void);
|
|
int32_t firmware_init_vm_boot_info(struct acrn_vm *vm);
|
|
|
|
#ifndef CONFIG_CONSTANT_ACPI
|
|
void acpi_fixup(void);
|
|
#endif
|
|
|
|
#endif /* end of include guard: FIRMWARE_H */
|