mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-02 21:46:58 +00:00
Currently, memory with size of 'CONFIG_LOW_RAM_SIZE' will be allocated when 'get_direct_boot_ap_trampoline()' is called. This patch refine the implementation of of above function, it returns the base address of trampoline buffer when called, and the memory is allocated when vboot module is initialized. Tracked-On: #3992 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
51 lines
979 B
C
51 lines
979 B
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/* this is for direct guest_boot method */
|
|
|
|
#include <types.h>
|
|
#include <e820.h>
|
|
#include <cpu.h>
|
|
#include <direct_boot.h>
|
|
|
|
/*AP trampoline code buffer base address.*/
|
|
static uint64_t ap_trampoline_buf;
|
|
|
|
static void init_direct_boot(void)
|
|
{
|
|
if (ap_trampoline_buf == 0UL) {
|
|
ap_trampoline_buf = e820_alloc_low_memory(CONFIG_LOW_RAM_SIZE);
|
|
}
|
|
}
|
|
|
|
/* @post: return != 0UL */
|
|
static uint64_t get_direct_boot_ap_trampoline(void)
|
|
{
|
|
return ap_trampoline_buf;
|
|
}
|
|
|
|
static void* get_direct_boot_rsdp(void)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static void init_direct_boot_irq(void)
|
|
{
|
|
CPU_IRQ_ENABLE();
|
|
}
|
|
|
|
static struct vboot_operations direct_boot_ops = {
|
|
.init = init_direct_boot,
|
|
.get_ap_trampoline = get_direct_boot_ap_trampoline,
|
|
.get_rsdp = get_direct_boot_rsdp,
|
|
.init_irq = init_direct_boot_irq,
|
|
};
|
|
|
|
struct vboot_operations* get_direct_boot_ops(void)
|
|
{
|
|
return &direct_boot_ops;
|
|
}
|