HV: modularization: name change on acrn_multiboot_info

The acrn_multiboot_info structure stores acrn specific boot info and should
not be limited to support multiboot protocol related structure only.

This patch only do below changes:

	1. change name of acrn_multiboot_info to acrn_boot_info;
	2. change name of mbi to abi because of the change in 1, also the
	   naming might bring confusion with native multiboot info;

Tracked-On: #5661

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Victor Sun 2021-05-21 11:12:24 +08:00 committed by wenlingz
parent bc828dff19
commit c9841d7618
11 changed files with 128 additions and 128 deletions

View File

@ -103,13 +103,13 @@ void init_e820(void)
uint32_t i; uint32_t i;
uint64_t top_addr_space = CONFIG_PLATFORM_RAM_SIZE + PLATFORM_LO_MMIO_SIZE; uint64_t top_addr_space = CONFIG_PLATFORM_RAM_SIZE + PLATFORM_LO_MMIO_SIZE;
struct acrn_multiboot_info *mbi = get_acrn_multiboot_info(); struct acrn_boot_info *abi = get_acrn_boot_info();
struct multiboot_mmap *mmap = mbi->mi_mmap_entry; struct multiboot_mmap *mmap = abi->mi_mmap_entry;
hv_e820_entries_nr = mbi->mi_mmap_entries; hv_e820_entries_nr = abi->mi_mmap_entries;
dev_dbg(DBG_LEVEL_E820, "mmap addr 0x%x entries %d\n", dev_dbg(DBG_LEVEL_E820, "mmap addr 0x%x entries %d\n",
mbi->mi_mmap_entry, hv_e820_entries_nr); abi->mi_mmap_entry, hv_e820_entries_nr);
for (i = 0U; i < hv_e820_entries_nr; i++) { for (i = 0U; i < hv_e820_entries_nr; i++) {

View File

@ -91,11 +91,11 @@ 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]); init_acrn_boot_info(boot_regs[0], boot_regs[1]);
init_debug_pre(); init_debug_pre();
if (sanitize_acrn_multiboot_info(boot_regs[0], boot_regs[1]) != 0) { if (sanitize_acrn_boot_info(boot_regs[0], boot_regs[1]) != 0) {
panic("Multiboot info error!"); panic("Multiboot info error!");
} }

View File

@ -41,12 +41,12 @@ static uint32_t parse_seed_arg(void)
{ {
const char *cmd_src = NULL; const char *cmd_src = NULL;
char *arg, *arg_end; char *arg, *arg_end;
struct acrn_multiboot_info *mbi = get_acrn_multiboot_info(); struct acrn_boot_info *abi = get_acrn_boot_info();
uint32_t i = SEED_ARG_NUM - 1U; uint32_t i = SEED_ARG_NUM - 1U;
uint32_t len; uint32_t len;
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) { if ((abi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
cmd_src = mbi->mi_cmdline; cmd_src = abi->mi_cmdline;
} }
if (cmd_src != NULL) { if (cmd_src != NULL) {

View File

@ -71,7 +71,7 @@ void init_acpi(void)
{ {
struct acpi_table_rsdp *rsdp = NULL; struct acpi_table_rsdp *rsdp = NULL;
rsdp = (struct acpi_table_rsdp *)(get_acrn_multiboot_info()->mi_acpi_rsdp_va); rsdp = (struct acpi_table_rsdp *)(get_acrn_boot_info()->mi_acpi_rsdp_va);
if (rsdp == NULL) { if (rsdp == NULL) {
uint16_t *addr; uint16_t *addr;

View File

@ -22,7 +22,7 @@
#define DBG_LEVEL_BOOT 6U #define DBG_LEVEL_BOOT 6U
/** /**
* @pre vm != NULL && mbi != NULL * @pre vm != NULL && mod != NULL
*/ */
static void init_vm_ramdisk_info(struct acrn_vm *vm, const struct multiboot_module *mod) static void init_vm_ramdisk_info(struct acrn_vm *vm, const struct multiboot_module *mod)
{ {
@ -109,9 +109,9 @@ static int32_t init_vm_kernel_info(struct acrn_vm *vm, const struct multiboot_mo
static char mod_cmdline[PRE_VM_NUM + SOS_VM_NUM][MAX_BOOTARGS_SIZE] = { '\0' }; static char mod_cmdline[PRE_VM_NUM + SOS_VM_NUM][MAX_BOOTARGS_SIZE] = { '\0' };
/** /**
* @pre vm != NULL && mbi != NULL * @pre vm != NULL && abi != NULL
*/ */
static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_multiboot_info *mbi) static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_boot_info *abi)
{ {
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id); struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
@ -140,9 +140,9 @@ static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_multiboo
* This is very helpful when one of configured bootargs need to be revised at GRUB runtime * This is very helpful when one of configured bootargs need to be revised at GRUB runtime
* (e.g. "root="), since the later one would override the previous one if multiple bootargs exist. * (e.g. "root="), since the later one would override the previous one if multiple bootargs exist.
*/ */
if (((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) && (*(mbi->mi_cmdline) != '\0')) { if (((abi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) && (*(abi->mi_cmdline) != '\0')) {
if (strncat_s((char *)vm->sw.bootargs_info.src_addr, MAX_BOOTARGS_SIZE, if (strncat_s((char *)vm->sw.bootargs_info.src_addr, MAX_BOOTARGS_SIZE,
mbi->mi_cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) { abi->mi_cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) {
pr_err("failed to merge mbi cmdline to SOS bootargs!"); pr_err("failed to merge mbi cmdline to SOS bootargs!");
} }
} }
@ -162,16 +162,16 @@ static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_multiboo
} }
} }
/* @pre mbi != NULL && tag != NULL /* @pre abi != NULL && tag != NULL
*/ */
static struct multiboot_module *get_mod_by_tag(const struct acrn_multiboot_info *mbi, const char *tag) static struct multiboot_module *get_mod_by_tag(const struct acrn_boot_info *abi, const char *tag)
{ {
uint8_t i; uint8_t i;
struct multiboot_module *mod = NULL; struct multiboot_module *mod = NULL;
struct multiboot_module *mods = (struct multiboot_module *)(&mbi->mi_mods[0]); struct multiboot_module *mods = (struct multiboot_module *)(&abi->mi_mods[0]);
uint32_t tag_len = strnlen_s(tag, MAX_MOD_TAG_LEN); uint32_t tag_len = strnlen_s(tag, MAX_MOD_TAG_LEN);
for (i = 0U; i < mbi->mi_mods_count; i++) { for (i = 0U; i < abi->mi_mods_count; i++) {
const char *mm_string = (char *)hpa2hva((uint64_t)(mods + i)->mm_string); const char *mm_string = (char *)hpa2hva((uint64_t)(mods + i)->mm_string);
uint32_t mm_str_len = strnlen_s(mm_string, MAX_MOD_TAG_LEN); uint32_t mm_str_len = strnlen_s(mm_string, MAX_MOD_TAG_LEN);
const char *p_chr = mm_string + tag_len; /* point to right after the end of tag */ const char *p_chr = mm_string + tag_len; /* point to right after the end of tag */
@ -196,18 +196,18 @@ static struct multiboot_module *get_mod_by_tag(const struct acrn_multiboot_info
return mod; return mod;
} }
/* @pre vm != NULL && mbi != NULL /* @pre vm != NULL && abi != NULL
*/ */
static int32_t init_vm_sw_load(struct acrn_vm *vm, const struct acrn_multiboot_info *mbi) static int32_t init_vm_sw_load(struct acrn_vm *vm, const struct acrn_boot_info *abi)
{ {
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id); struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
struct multiboot_module *mod; struct multiboot_module *mod;
int32_t ret = -EINVAL; int32_t ret = -EINVAL;
dev_dbg(DBG_LEVEL_BOOT, "mod counts=%d\n", mbi->mi_mods_count); dev_dbg(DBG_LEVEL_BOOT, "mod counts=%d\n", abi->mi_mods_count);
/* find kernel module first */ /* find kernel module first */
mod = get_mod_by_tag(mbi, vm_config->os_config.kernel_mod_tag); mod = get_mod_by_tag(abi, vm_config->os_config.kernel_mod_tag);
if (mod != NULL) { if (mod != NULL) {
const char *mm_string = (char *)hpa2hva((uint64_t)mod->mm_string); const char *mm_string = (char *)hpa2hva((uint64_t)mod->mm_string);
uint32_t mm_str_len = strnlen_s(mm_string, MAX_BOOTARGS_SIZE); uint32_t mm_str_len = strnlen_s(mm_string, MAX_BOOTARGS_SIZE);
@ -226,16 +226,16 @@ static int32_t init_vm_sw_load(struct acrn_vm *vm, const struct acrn_multiboot_i
if (ret == 0) { if (ret == 0) {
/* Currently VM bootargs only support Linux guest */ /* Currently VM bootargs only support Linux guest */
if (vm->sw.kernel_type == KERNEL_BZIMAGE) { if (vm->sw.kernel_type == KERNEL_BZIMAGE) {
init_vm_bootargs_info(vm, mbi); init_vm_bootargs_info(vm, abi);
} }
/* check whether there is a ramdisk module */ /* check whether there is a ramdisk module */
mod = get_mod_by_tag(mbi, vm_config->os_config.ramdisk_mod_tag); mod = get_mod_by_tag(abi, vm_config->os_config.ramdisk_mod_tag);
if (mod != NULL) { if (mod != NULL) {
init_vm_ramdisk_info(vm, mod); init_vm_ramdisk_info(vm, mod);
} }
if (is_prelaunched_vm(vm)) { if (is_prelaunched_vm(vm)) {
mod = get_mod_by_tag(mbi, vm_config->acpi_config.acpi_mod_tag); mod = get_mod_by_tag(abi, vm_config->acpi_config.acpi_mod_tag);
if ((mod != NULL) && ((mod->mm_mod_end - mod->mm_mod_start) == ACPI_MODULE_SIZE)) { if ((mod != NULL) && ((mod->mm_mod_end - mod->mm_mod_start) == ACPI_MODULE_SIZE)) {
init_vm_acpi_info(vm, mod); init_vm_acpi_info(vm, mod);
} else { } else {
@ -259,11 +259,11 @@ static int32_t init_vm_sw_load(struct acrn_vm *vm, const struct acrn_multiboot_i
*/ */
int32_t init_vm_boot_info(struct acrn_vm *vm) int32_t init_vm_boot_info(struct acrn_vm *vm)
{ {
struct acrn_multiboot_info *mbi = get_acrn_multiboot_info(); struct acrn_boot_info *abi = get_acrn_boot_info();
int32_t ret = -EINVAL; int32_t ret = -EINVAL;
stac(); stac();
ret = init_vm_sw_load(vm, mbi); ret = init_vm_sw_load(vm, abi);
clac(); clac();
return ret; return ret;

View File

@ -25,7 +25,7 @@
#include <efi.h> #include <efi.h>
#include <vm_configurations.h> #include <vm_configurations.h>
struct acrn_multiboot_info { struct acrn_boot_info {
uint32_t mi_flags; /* the flags is back-compatible with multiboot1 */ uint32_t mi_flags; /* the flags is back-compatible with multiboot1 */
const char *mi_cmdline; const char *mi_cmdline;
@ -46,9 +46,9 @@ 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); void init_acrn_boot_info(uint32_t magic, uint32_t info);
int32_t sanitize_acrn_multiboot_info(uint32_t magic, uint32_t info); int32_t sanitize_acrn_boot_info(uint32_t magic, uint32_t info);
struct acrn_multiboot_info *get_acrn_multiboot_info(void); struct acrn_boot_info *get_acrn_boot_info(void);
#endif /* ASSEMBLER */ #endif /* ASSEMBLER */

View File

@ -12,114 +12,114 @@
#include <logmsg.h> #include <logmsg.h>
#include "multiboot_priv.h" #include "multiboot_priv.h"
static struct acrn_multiboot_info acrn_mbi = { 0U }; static struct acrn_boot_info acrn_bi = { 0U };
static int32_t mbi_status; static int32_t abi_status;
void init_acrn_multiboot_info(uint32_t magic, uint32_t info) void init_acrn_boot_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));
acrn_mbi.mi_flags = mbi->mi_flags; acrn_bi.mi_flags = mbi->mi_flags;
acrn_mbi.mi_drives_addr = mbi->mi_drives_addr; acrn_bi.mi_drives_addr = mbi->mi_drives_addr;
acrn_mbi.mi_drives_length = mbi->mi_drives_length; acrn_bi.mi_drives_length = mbi->mi_drives_length;
acrn_mbi.mi_cmdline = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline); acrn_bi.mi_cmdline = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline);
acrn_mbi.mi_loader_name = (char *)hpa2hva_early((uint64_t)mbi->mi_loader_name); acrn_bi.mi_loader_name = (char *)hpa2hva_early((uint64_t)mbi->mi_loader_name);
acrn_mbi.mi_mmap_entries = mbi->mi_mmap_length / sizeof(struct multiboot_mmap); acrn_bi.mi_mmap_entries = mbi->mi_mmap_length / sizeof(struct multiboot_mmap);
acrn_mbi.mi_mmap_va = (struct multiboot_mmap *)hpa2hva_early((uint64_t)mbi->mi_mmap_addr); acrn_bi.mi_mmap_va = (struct multiboot_mmap *)hpa2hva_early((uint64_t)mbi->mi_mmap_addr);
acrn_mbi.mi_mods_count = mbi->mi_mods_count; acrn_bi.mi_mods_count = mbi->mi_mods_count;
acrn_mbi.mi_mods_va = (struct multiboot_module *)hpa2hva_early((uint64_t)mbi->mi_mods_addr); acrn_bi.mi_mods_va = (struct multiboot_module *)hpa2hva_early((uint64_t)mbi->mi_mods_addr);
mbi_status = 0; abi_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)); abi_status = multiboot2_to_acrn_bi(&acrn_bi, hpa2hva_early((uint64_t)info));
#endif #endif
} else { } else {
mbi_status = -ENODEV; abi_status = -ENODEV;
} }
} }
int32_t sanitize_acrn_multiboot_info(uint32_t magic, uint32_t info) int32_t sanitize_acrn_boot_info(uint32_t magic, uint32_t info)
{ {
if ((acrn_mbi.mi_mmap_entries != 0U) && (acrn_mbi.mi_mmap_va != NULL)) { if ((acrn_bi.mi_mmap_entries != 0U) && (acrn_bi.mi_mmap_va != NULL)) {
if (acrn_mbi.mi_mmap_entries > MAX_MMAP_ENTRIES) { if (acrn_bi.mi_mmap_entries > MAX_MMAP_ENTRIES) {
pr_err("Too many E820 entries %d\n", acrn_mbi.mi_mmap_entries); pr_err("Too many E820 entries %d\n", acrn_bi.mi_mmap_entries);
acrn_mbi.mi_mmap_entries = MAX_MMAP_ENTRIES; acrn_bi.mi_mmap_entries = MAX_MMAP_ENTRIES;
} }
if (boot_from_multiboot1(magic, info)) { if (boot_from_multiboot1(magic, info)) {
uint32_t mmap_entry_size = sizeof(struct multiboot_mmap); uint32_t mmap_entry_size = sizeof(struct multiboot_mmap);
(void)memcpy_s((void *)(&acrn_mbi.mi_mmap_entry[0]), (void)memcpy_s((void *)(&acrn_bi.mi_mmap_entry[0]),
(acrn_mbi.mi_mmap_entries * mmap_entry_size), (acrn_bi.mi_mmap_entries * mmap_entry_size),
(const void *)acrn_mbi.mi_mmap_va, (const void *)acrn_bi.mi_mmap_va,
(acrn_mbi.mi_mmap_entries * mmap_entry_size)); (acrn_bi.mi_mmap_entries * mmap_entry_size));
} }
#ifdef CONFIG_MULTIBOOT2 #ifdef CONFIG_MULTIBOOT2
if (boot_from_multiboot2(magic)) { if (boot_from_multiboot2(magic)) {
uint32_t i; uint32_t i;
struct multiboot2_mmap_entry *mb2_mmap = (struct multiboot2_mmap_entry *)acrn_mbi.mi_mmap_va; struct multiboot2_mmap_entry *mb2_mmap = (struct multiboot2_mmap_entry *)acrn_bi.mi_mmap_va;
for (i = 0U; i < acrn_mbi.mi_mmap_entries; i++) { for (i = 0U; i < acrn_bi.mi_mmap_entries; i++) {
acrn_mbi.mi_mmap_entry[i].baseaddr = (mb2_mmap + i)->addr; acrn_bi.mi_mmap_entry[i].baseaddr = (mb2_mmap + i)->addr;
acrn_mbi.mi_mmap_entry[i].length = (mb2_mmap + i)->len; acrn_bi.mi_mmap_entry[i].length = (mb2_mmap + i)->len;
acrn_mbi.mi_mmap_entry[i].type = (mb2_mmap + i)->type; acrn_bi.mi_mmap_entry[i].type = (mb2_mmap + i)->type;
} }
} }
#endif #endif
acrn_mbi.mi_flags |= MULTIBOOT_INFO_HAS_MMAP; acrn_bi.mi_flags |= MULTIBOOT_INFO_HAS_MMAP;
} else { } else {
acrn_mbi.mi_flags &= ~MULTIBOOT_INFO_HAS_MMAP; acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_MMAP;
} }
if (acrn_mbi.mi_mods_count > MAX_MODULE_NUM) { if (acrn_bi.mi_mods_count > MAX_MODULE_NUM) {
pr_err("Too many multiboot modules %d\n", acrn_mbi.mi_mods_count); pr_err("Too many multiboot modules %d\n", acrn_bi.mi_mods_count);
acrn_mbi.mi_mods_count = MAX_MODULE_NUM; acrn_bi.mi_mods_count = MAX_MODULE_NUM;
} }
if (acrn_mbi.mi_mods_count != 0U) { if (acrn_bi.mi_mods_count != 0U) {
if (boot_from_multiboot1(magic, info) && (acrn_mbi.mi_mods_va != NULL)) { if (boot_from_multiboot1(magic, info) && (acrn_bi.mi_mods_va != NULL)) {
(void)memcpy_s((void *)(&acrn_mbi.mi_mods[0]), (void)memcpy_s((void *)(&acrn_bi.mi_mods[0]),
(acrn_mbi.mi_mods_count * sizeof(struct multiboot_module)), (acrn_bi.mi_mods_count * sizeof(struct multiboot_module)),
(const void *)acrn_mbi.mi_mods_va, (const void *)acrn_bi.mi_mods_va,
(acrn_mbi.mi_mods_count * sizeof(struct multiboot_module))); (acrn_bi.mi_mods_count * sizeof(struct multiboot_module)));
} }
acrn_mbi.mi_flags |= MULTIBOOT_INFO_HAS_MODS; acrn_bi.mi_flags |= MULTIBOOT_INFO_HAS_MODS;
} else { } else {
acrn_mbi.mi_flags &= ~MULTIBOOT_INFO_HAS_MODS; acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_MODS;
} }
if ((acrn_mbi.mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) { if ((acrn_bi.mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) {
pr_err("no multiboot module info found"); pr_err("no multiboot module info found");
mbi_status = -EINVAL; abi_status = -EINVAL;
} }
if ((acrn_mbi.mi_flags & MULTIBOOT_INFO_HAS_MMAP) == 0U) { if ((acrn_bi.mi_flags & MULTIBOOT_INFO_HAS_MMAP) == 0U) {
pr_err("wrong multiboot flags: 0x%08x", acrn_mbi.mi_flags); pr_err("wrong multiboot flags: 0x%08x", acrn_bi.mi_flags);
mbi_status = -EINVAL; abi_status = -EINVAL;
} }
#ifdef CONFIG_MULTIBOOT2 #ifdef CONFIG_MULTIBOOT2
if (boot_from_multiboot2(magic)) { if (boot_from_multiboot2(magic)) {
if (acrn_mbi.mi_efi_info.efi_memmap_hi != 0U) { if (acrn_bi.mi_efi_info.efi_memmap_hi != 0U) {
pr_err("the EFI mmap address should be less than 4G!"); pr_err("the EFI mmap address should be less than 4G!");
acrn_mbi.mi_flags &= ~MULTIBOOT_INFO_HAS_EFI_MMAP; acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_EFI_MMAP;
mbi_status = -EINVAL; abi_status = -EINVAL;
} }
if ((acrn_mbi.mi_flags & (MULTIBOOT_INFO_HAS_EFI64 | MULTIBOOT_INFO_HAS_EFI_MMAP)) == 0U) { if ((acrn_bi.mi_flags & (MULTIBOOT_INFO_HAS_EFI64 | MULTIBOOT_INFO_HAS_EFI_MMAP)) == 0U) {
pr_err("no multiboot2 uefi info found!"); pr_err("no multiboot2 uefi info found!");
} }
} }
#endif #endif
if (acrn_mbi.mi_loader_name[0] == '\0') { if (acrn_bi.mi_loader_name[0] == '\0') {
pr_err("no bootloader name found!"); pr_err("no bootloader name found!");
mbi_status = -EINVAL; abi_status = -EINVAL;
} else { } else {
printf("Multiboot%s Bootloader: %s\n", boot_from_multiboot1(magic, info) ? "" : "2", acrn_mbi.mi_loader_name); printf("Multiboot%s Bootloader: %s\n", boot_from_multiboot1(magic, info) ? "" : "2", acrn_bi.mi_loader_name);
} }
return mbi_status; return abi_status;
} }
/* /*
@ -127,7 +127,7 @@ int32_t sanitize_acrn_multiboot_info(uint32_t magic, uint32_t info)
* @post retval->mi_flags & MULTIBOOT_INFO_HAS_MMAP != 0U * @post retval->mi_flags & MULTIBOOT_INFO_HAS_MMAP != 0U
* @post (retval->mi_mmap_entries > 0U) && (retval->mi_mmap_entries <= MAX_MMAP_ENTRIES) * @post (retval->mi_mmap_entries > 0U) && (retval->mi_mmap_entries <= MAX_MMAP_ENTRIES)
*/ */
struct acrn_multiboot_info *get_acrn_multiboot_info(void) struct acrn_boot_info *get_acrn_boot_info(void)
{ {
return &acrn_mbi; return &acrn_bi;
} }

View File

@ -11,57 +11,57 @@
#include "multiboot_priv.h" #include "multiboot_priv.h"
/** /**
* @pre mbi != NULL && mb2_tag_mmap != NULL * @pre abi != NULL && mb2_tag_mmap != NULL
*/ */
static void mb2_mmap_to_mbi(struct acrn_multiboot_info *mbi, const struct multiboot2_tag_mmap *mb2_tag_mmap) static void mb2_mmap_to_abi(struct acrn_boot_info *abi, const struct multiboot2_tag_mmap *mb2_tag_mmap)
{ {
/* multiboot2 mmap tag header occupied 16 bytes */ /* multiboot2 mmap tag header occupied 16 bytes */
mbi->mi_mmap_entries = (mb2_tag_mmap->size - 16U) / sizeof(struct multiboot2_mmap_entry); abi->mi_mmap_entries = (mb2_tag_mmap->size - 16U) / sizeof(struct multiboot2_mmap_entry);
mbi->mi_mmap_va = (struct multiboot2_mmap_entry *)mb2_tag_mmap->entries; abi->mi_mmap_va = (struct multiboot2_mmap_entry *)mb2_tag_mmap->entries;
} }
/** /**
* @pre mbi != NULL && mb2_tag_mods != NULL * @pre abi != NULL && mb2_tag_mods != NULL
*/ */
static void mb2_mods_to_mbi(struct acrn_multiboot_info *mbi, static void mb2_mods_to_abi(struct acrn_boot_info *abi,
uint32_t mbi_mod_idx, const struct multiboot2_tag_module *mb2_tag_mods) uint32_t mbi_mod_idx, const struct multiboot2_tag_module *mb2_tag_mods)
{ {
if (mbi_mod_idx < MAX_MODULE_NUM) { if (mbi_mod_idx < MAX_MODULE_NUM) {
mbi->mi_mods[mbi_mod_idx].mm_mod_start = mb2_tag_mods->mod_start; abi->mi_mods[mbi_mod_idx].mm_mod_start = mb2_tag_mods->mod_start;
mbi->mi_mods[mbi_mod_idx].mm_mod_end = mb2_tag_mods->mod_end; abi->mi_mods[mbi_mod_idx].mm_mod_end = mb2_tag_mods->mod_end;
mbi->mi_mods[mbi_mod_idx].mm_string = (uint32_t)(uint64_t)mb2_tag_mods->cmdline; abi->mi_mods[mbi_mod_idx].mm_string = (uint32_t)(uint64_t)mb2_tag_mods->cmdline;
} }
} }
/** /**
* @pre mbi != NULL && mb2_tag_efi64 != 0 * @pre abi != 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_abi(struct acrn_boot_info *abi, const struct multiboot2_tag_efi64 *mb2_tag_efi64)
{ {
const uint32_t efiloader_sig = 0x34364c45; /* "EL64" */ const uint32_t efiloader_sig = 0x34364c45; /* "EL64" */
mbi->mi_efi_info.efi_systab = (uint32_t)(uint64_t)mb2_tag_efi64->pointer; abi->mi_efi_info.efi_systab = (uint32_t)(uint64_t)mb2_tag_efi64->pointer;
mbi->mi_efi_info.efi_loader_signature = efiloader_sig; abi->mi_efi_info.efi_loader_signature = efiloader_sig;
mbi->mi_flags |= MULTIBOOT_INFO_HAS_EFI64; abi->mi_flags |= MULTIBOOT_INFO_HAS_EFI64;
} }
/** /**
* @pre mbi != NULL && mb2_tag_efimmap != 0 * @pre abi != NULL && mb2_tag_efimmap != 0
*/ */
static void mb2_efimmap_to_mbi(struct acrn_multiboot_info *mbi, static void mb2_efimmap_to_abi(struct acrn_boot_info *abi,
const struct multiboot2_tag_efi_mmap *mb2_tag_efimmap) const struct multiboot2_tag_efi_mmap *mb2_tag_efimmap)
{ {
mbi->mi_efi_info.efi_memdesc_size = mb2_tag_efimmap->descr_size; abi->mi_efi_info.efi_memdesc_size = mb2_tag_efimmap->descr_size;
mbi->mi_efi_info.efi_memdesc_version = mb2_tag_efimmap->descr_vers; abi->mi_efi_info.efi_memdesc_version = mb2_tag_efimmap->descr_vers;
mbi->mi_efi_info.efi_memmap = (uint32_t)(uint64_t)mb2_tag_efimmap->efi_mmap; abi->mi_efi_info.efi_memmap = (uint32_t)(uint64_t)mb2_tag_efimmap->efi_mmap;
mbi->mi_efi_info.efi_memmap_size = mb2_tag_efimmap->size - 16U; abi->mi_efi_info.efi_memmap_size = mb2_tag_efimmap->size - 16U;
mbi->mi_efi_info.efi_memmap_hi = (uint32_t)(((uint64_t)mb2_tag_efimmap->efi_mmap) >> 32U); abi->mi_efi_info.efi_memmap_hi = (uint32_t)(((uint64_t)mb2_tag_efimmap->efi_mmap) >> 32U);
mbi->mi_flags |= MULTIBOOT_INFO_HAS_EFI_MMAP; abi->mi_flags |= MULTIBOOT_INFO_HAS_EFI_MMAP;
} }
/** /**
* @pre mbi != NULL * @pre abi != NULL
*/ */
int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info) int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, 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;
@ -75,27 +75,27 @@ int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info)
while ((mb2_tag->type != MULTIBOOT2_TAG_TYPE_END) && (mb2_tag < mb2_tag_end)) { while ((mb2_tag->type != MULTIBOOT2_TAG_TYPE_END) && (mb2_tag < mb2_tag_end)) {
switch (mb2_tag->type) { switch (mb2_tag->type) {
case MULTIBOOT2_TAG_TYPE_CMDLINE: case MULTIBOOT2_TAG_TYPE_CMDLINE:
mbi->mi_cmdline = ((struct multiboot2_tag_string *)mb2_tag)->string; abi->mi_cmdline = ((struct multiboot2_tag_string *)mb2_tag)->string;
mbi->mi_flags |= MULTIBOOT_INFO_HAS_CMDLINE; abi->mi_flags |= MULTIBOOT_INFO_HAS_CMDLINE;
break; break;
case MULTIBOOT2_TAG_TYPE_MMAP: case MULTIBOOT2_TAG_TYPE_MMAP:
mb2_mmap_to_mbi(mbi, (const struct multiboot2_tag_mmap *)mb2_tag); mb2_mmap_to_abi(abi, (const struct multiboot2_tag_mmap *)mb2_tag);
break; break;
case MULTIBOOT2_TAG_TYPE_MODULE: case MULTIBOOT2_TAG_TYPE_MODULE:
mb2_mods_to_mbi(mbi, mod_idx, (const struct multiboot2_tag_module *)mb2_tag); mb2_mods_to_abi(abi, mod_idx, (const struct multiboot2_tag_module *)mb2_tag);
mod_idx++; mod_idx++;
break; break;
case MULTIBOOT2_TAG_TYPE_BOOT_LOADER_NAME: case MULTIBOOT2_TAG_TYPE_BOOT_LOADER_NAME:
mbi->mi_loader_name = ((struct multiboot2_tag_string *)mb2_tag)->string; abi->mi_loader_name = ((struct multiboot2_tag_string *)mb2_tag)->string;
break; break;
case MULTIBOOT2_TAG_TYPE_ACPI_NEW: case MULTIBOOT2_TAG_TYPE_ACPI_NEW:
mbi->mi_acpi_rsdp_va = ((struct multiboot2_tag_new_acpi *)mb2_tag)->rsdp; abi->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); mb2_efi64_to_abi(abi, (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_abi(abi, (const struct multiboot2_tag_efi_mmap *)mb2_tag);
break; break;
default: default:
if (mb2_tag->type > MULTIBOOT2_TAG_TYPE_LOAD_BASE_ADDR) { if (mb2_tag->type > MULTIBOOT2_TAG_TYPE_LOAD_BASE_ADDR) {
@ -118,7 +118,7 @@ int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info)
+ ((mb2_tag->size + (MULTIBOOT2_INFO_ALIGN - 1U)) & ~(MULTIBOOT2_INFO_ALIGN - 1U))); + ((mb2_tag->size + (MULTIBOOT2_INFO_ALIGN - 1U)) & ~(MULTIBOOT2_INFO_ALIGN - 1U)));
} }
mbi->mi_mods_count = mod_idx; abi->mi_mods_count = mod_idx;
return ret; return ret;
} }

View File

@ -29,7 +29,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); int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, 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)

View File

@ -73,10 +73,10 @@ static uint64_t create_zero_page(struct acrn_vm *vm)
#ifdef CONFIG_MULTIBOOT2 #ifdef CONFIG_MULTIBOOT2
if (is_sos_vm(vm)) { if (is_sos_vm(vm)) {
struct acrn_multiboot_info *mbi = get_acrn_multiboot_info(); struct acrn_boot_info *abi = get_acrn_boot_info();
(void)memcpy_s(&(zeropage->boot_efi_info), sizeof(zeropage->boot_efi_info), (void)memcpy_s(&(zeropage->boot_efi_info), sizeof(zeropage->boot_efi_info),
&(mbi->mi_efi_info), sizeof(mbi->mi_efi_info)); &(abi->mi_efi_info), sizeof(abi->mi_efi_info));
} }
#endif #endif
/* copy part of the header into the zero page */ /* copy part of the header into the zero page */

View File

@ -29,10 +29,10 @@ static void parse_hvdbg_cmdline(void)
{ {
const char *start = NULL; const char *start = NULL;
const char *end = NULL; const char *end = NULL;
struct acrn_multiboot_info *mbi = get_acrn_multiboot_info(); struct acrn_boot_info *abi = get_acrn_boot_info();
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) { if ((abi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
start = mbi->mi_cmdline; start = abi->mi_cmdline;
} }
while ((start != NULL) && ((*start) != '\0')) { while ((start != NULL) && ((*start) != '\0')) {