mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-04 22:47:00 +00:00
Previously sanitize_multiboot_info() was called after init_debug_pre() because the debug message can only print after uart is initialized. On the other hand, multiboot cmdline need to be parsed before init_debug_pre() because the cmdline could override uart settings and make sure debug message printed successfully. This cause multiboot info was parsed in two stages. The patch revise the multiboot parse logic that split sanitize_multiboot_info() api and use init_acrn_multiboot_info() api for the early stage. The most of multiboot info will be initialized during this stage and no debug message need to be printed. After uart is initialized, the sanitize_multiboot_info() would do sanitize multiboot info and print needed debug messages. Tracked-On: #4885 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
78 lines
1.7 KiB
C
78 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/* this is for de-privilege guest vboot method */
|
|
|
|
#include <types.h>
|
|
#include <acrn_common.h>
|
|
#include <pgtable.h>
|
|
#include <logmsg.h>
|
|
#include <rtl.h>
|
|
#include <vlapic.h>
|
|
#include <lapic.h>
|
|
#include <per_cpu.h>
|
|
#include <guest/vm.h>
|
|
#include <boot.h>
|
|
#include <deprivilege_boot.h>
|
|
|
|
static struct depri_boot_context depri_boot_ctx;
|
|
static struct lapic_regs depri_boot_lapic_regs;
|
|
|
|
static void init_depri_boot(void)
|
|
{
|
|
static bool depri_initialized = false;
|
|
struct acrn_multiboot_info *mbi = get_multiboot_info();
|
|
|
|
if (!depri_initialized) {
|
|
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES) == 0U) {
|
|
pr_err("no multiboot drivers for depri_boot found");
|
|
} else {
|
|
(void)memcpy_s(&depri_boot_ctx, sizeof(struct depri_boot_context),
|
|
hpa2hva((uint64_t)mbi->mi_drives_addr),
|
|
sizeof(struct depri_boot_context));
|
|
save_lapic(&depri_boot_lapic_regs);
|
|
}
|
|
depri_initialized = true;
|
|
}
|
|
}
|
|
|
|
const struct depri_boot_context *get_depri_boot_ctx(void)
|
|
{
|
|
return &depri_boot_ctx;
|
|
}
|
|
|
|
const struct lapic_regs *get_depri_boot_lapic_regs(void)
|
|
{
|
|
return &depri_boot_lapic_regs;
|
|
}
|
|
|
|
static uint64_t get_depri_boot_ap_trampoline(void)
|
|
{
|
|
return depri_boot_ctx.ap_trampoline_buf;
|
|
}
|
|
|
|
static const void* get_depri_boot_rsdp(void)
|
|
{
|
|
return (const void*)hpa2hva((uint64_t)(depri_boot_ctx.rsdp));
|
|
}
|
|
|
|
static void init_depri_boot_irq(void)
|
|
{
|
|
/* nothing to do for now */
|
|
}
|
|
|
|
static struct vboot_operations depri_boot_ops = {
|
|
.init = init_depri_boot,
|
|
.get_ap_trampoline = get_depri_boot_ap_trampoline,
|
|
.get_rsdp = get_depri_boot_rsdp,
|
|
.init_irq = init_depri_boot_irq,
|
|
};
|
|
|
|
struct vboot_operations* get_deprivilege_boot_ops(void)
|
|
{
|
|
return &depri_boot_ops;
|
|
}
|