mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-31 11:25:30 +00:00
The patch has below changes: 1. rename mi_loader_name in acrn_boot_info struct to loader_name; 2. change loader_name type from pointer to array to avoid accessing original multiboot info region; 3. remove mi_drivers_length and mi_drivers_addr which are never used; Tracked-On: #5661 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2021 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <types.h>
|
|
#include <errno.h>
|
|
#include <asm/pgtable.h>
|
|
#include <boot.h>
|
|
#include <rtl.h>
|
|
#include <logmsg.h>
|
|
|
|
static struct acrn_boot_info acrn_bi = { 0U };
|
|
|
|
void init_acrn_boot_info(uint32_t *registers)
|
|
{
|
|
(void)init_multiboot_info(registers);
|
|
/* TODO: add more boot protocol support here */
|
|
}
|
|
|
|
int32_t sanitize_acrn_boot_info(struct acrn_boot_info *abi)
|
|
{
|
|
int32_t abi_status = 0;
|
|
|
|
if (abi->mi_mods_count == 0U) {
|
|
pr_err("no boot module info found");
|
|
abi_status = -EINVAL;
|
|
}
|
|
|
|
if (abi->mi_mmap_entries == 0U) {
|
|
pr_err("no boot mmap info found");
|
|
abi_status = -EINVAL;
|
|
}
|
|
|
|
if ((abi->mi_efi_info.efi_systab == 0U) && (abi->mi_efi_info.efi_systab_hi == 0U)) {
|
|
pr_err("no uefi info found!");
|
|
}
|
|
|
|
if (abi->loader_name[0] == '\0') {
|
|
pr_err("no bootloader name found!");
|
|
abi_status = -EINVAL;
|
|
} else {
|
|
printf("%s Bootloader: %s\n", abi->protocol_name, abi->loader_name);
|
|
}
|
|
|
|
return abi_status;
|
|
}
|
|
|
|
/*
|
|
* @post retval != NULL
|
|
*/
|
|
struct acrn_boot_info *get_acrn_boot_info(void)
|
|
{
|
|
return &acrn_bi;
|
|
}
|