mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-09 12:49:24 +00:00
HV: modularization improve UEFI macro control code
1. in UEFI bsp code, not need UEFI macro; it is controlled in makefile. 2. in vm/acpi/interrupt code, unify the API name for SBL & UEFI. 3. remove unnecessary header including and unused code. Tracked-On: #1842 Signed-off-by: Minggui Cao <minggui.cao@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
@@ -23,29 +23,14 @@
|
||||
|
||||
#define UOS_DEFAULT_START_ADDR (0x100000000UL)
|
||||
|
||||
struct acpi_info {
|
||||
uint8_t x86_family;
|
||||
uint8_t x86_model;
|
||||
struct pm_s_state_data pm_s_state;
|
||||
/* TODO: we can add more acpi info field here if needed. */
|
||||
};
|
||||
|
||||
/**********************************/
|
||||
/* EXTERNAL VARIABLES */
|
||||
/**********************************/
|
||||
/* BSP Interfaces */
|
||||
void init_bsp(void);
|
||||
uint64_t bsp_get_ap_trampoline(void);
|
||||
void *bsp_get_rsdp(void);
|
||||
void bsp_init_irq(void);
|
||||
|
||||
#ifndef CONFIG_CONSTANT_ACPI
|
||||
void acpi_fixup(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
|
||||
void *get_rsdp_from_uefi(void);
|
||||
void *get_ap_trampoline_buf(void);
|
||||
const struct efi_context *get_efi_ctx(void);
|
||||
const struct lapic_regs *get_efi_lapic_regs(void);
|
||||
#endif
|
||||
|
||||
#endif /* BSP_EXTERN_H */
|
||||
|
19
hypervisor/bsp/include/uefi/uefi.h
Normal file
19
hypervisor/bsp/include/uefi/uefi.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _UEFI_H_
|
||||
#define _UEFI_H_
|
||||
|
||||
struct efi_context {
|
||||
struct acrn_vcpu_regs vcpu_regs;
|
||||
void *rsdp;
|
||||
void *ap_trampoline_buf;
|
||||
} __packed;
|
||||
|
||||
const struct efi_context *get_efi_ctx(void);
|
||||
const struct lapic_regs *get_efi_lapic_regs(void);
|
||||
|
||||
#endif
|
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <hypervisor.h>
|
||||
#include <e820.h>
|
||||
|
||||
void init_bsp(void)
|
||||
{
|
||||
@@ -12,3 +13,18 @@ void init_bsp(void)
|
||||
acpi_fixup();
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t bsp_get_ap_trampoline(void)
|
||||
{
|
||||
return e820_alloc_low_memory(CONFIG_LOW_RAM_SIZE);
|
||||
}
|
||||
|
||||
void *bsp_get_rsdp(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void bsp_init_irq(void)
|
||||
{
|
||||
CPU_IRQ_ENABLE();
|
||||
}
|
||||
|
@@ -7,9 +7,7 @@
|
||||
#include <hypervisor.h>
|
||||
#include <multiboot.h>
|
||||
#include <boot_context.h>
|
||||
#include <vm0_boot.h>
|
||||
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
#include <uefi.h>
|
||||
|
||||
static struct efi_context efi_ctx;
|
||||
static struct lapic_regs uefi_lapic_regs;
|
||||
@@ -28,14 +26,15 @@ static void efi_init(void)
|
||||
pr_err("no multiboot drivers for uefi found");
|
||||
} else {
|
||||
|
||||
memcpy_s(&efi_ctx, sizeof(struct efi_context), hpa2hva((uint64_t)mbi->mi_drives_addr), sizeof(struct efi_context));
|
||||
memcpy_s(&efi_ctx, sizeof(struct efi_context), hpa2hva((uint64_t)mbi->mi_drives_addr),
|
||||
sizeof(struct efi_context));
|
||||
save_lapic(&uefi_lapic_regs);
|
||||
efi_initialized = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *get_rsdp_from_uefi(void)
|
||||
void *bsp_get_rsdp(void)
|
||||
{
|
||||
if (!efi_initialized) {
|
||||
efi_init();
|
||||
@@ -44,14 +43,14 @@ void *get_rsdp_from_uefi(void)
|
||||
return hpa2hva((uint64_t)efi_ctx.rsdp);
|
||||
}
|
||||
|
||||
void *get_ap_trampoline_buf(void)
|
||||
uint64_t bsp_get_ap_trampoline(void)
|
||||
{
|
||||
return efi_ctx.ap_trampoline_buf;
|
||||
return (uint64_t)efi_ctx.ap_trampoline_buf;
|
||||
}
|
||||
|
||||
const struct efi_context *get_efi_ctx(void)
|
||||
{
|
||||
return (const struct efi_context *)&efi_ctx;
|
||||
return &efi_ctx;
|
||||
}
|
||||
|
||||
const struct lapic_regs *get_efi_lapic_regs(void)
|
||||
@@ -59,7 +58,9 @@ const struct lapic_regs *get_efi_lapic_regs(void)
|
||||
return &uefi_lapic_regs;
|
||||
}
|
||||
|
||||
#endif
|
||||
void bsp_init_irq(void)
|
||||
{
|
||||
}
|
||||
|
||||
void init_bsp(void)
|
||||
{
|
||||
@@ -68,8 +69,6 @@ void init_bsp(void)
|
||||
#endif
|
||||
parse_hv_cmdline();
|
||||
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
if (!efi_initialized)
|
||||
efi_init();
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user