hv: update the flow to get trampoline buffer in direct boot mode

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>
This commit is contained in:
Yonghua Huang 2019-11-04 18:09:55 +08:00 committed by ACRN System Integration
parent c09723bda9
commit 95a9f6d9a0

View File

@ -11,15 +11,20 @@
#include <cpu.h> #include <cpu.h>
#include <direct_boot.h> #include <direct_boot.h>
/*AP trampoline code buffer base address.*/
static uint64_t ap_trampoline_buf;
static void init_direct_boot(void) static void init_direct_boot(void)
{ {
/* nothing to do for now */ if (ap_trampoline_buf == 0UL) {
ap_trampoline_buf = e820_alloc_low_memory(CONFIG_LOW_RAM_SIZE);
}
} }
/* @post: return != 0UL */ /* @post: return != 0UL */
static uint64_t get_direct_boot_ap_trampoline(void) static uint64_t get_direct_boot_ap_trampoline(void)
{ {
return e820_alloc_low_memory(CONFIG_LOW_RAM_SIZE); return ap_trampoline_buf;
} }
static void* get_direct_boot_rsdp(void) static void* get_direct_boot_rsdp(void)