mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
hv: set default MAX_EFI_MMAP_ENTRIES to 350
In previous implementation we leave MAX_EFI_MMAP_ENTRIES in config tool and let end user to configure it. However it is hard for end user to understand how to configure it, also it is hard for board_inspector to get this value automatically because this info is only meaningful during the kernel boot stage and there is no such info available after boot in Linux toolset. This patch hardcode the value to 350, and ASSERT if the board need more efi mmap entries to run ACRN. User could modify the MAX_EFI_MMAP_ENTRIES macro in case ASSERT occurs in DEBUG stage. The More size of hv_memdesc[] only consume very little memory, the overhead is (size * sizeof(struct efi_memory_desc)), i.e. (size * 40) in bytes. Tracked-On: #6442 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@Intel.com>
This commit is contained in:
parent
546de2bfa9
commit
914341c9aa
@ -11,7 +11,7 @@
|
||||
#include <logmsg.h>
|
||||
|
||||
static uint32_t hv_memdesc_nr;
|
||||
static struct efi_memory_desc hv_memdesc[CONFIG_MAX_EFI_MMAP_ENTRIES];
|
||||
static struct efi_memory_desc hv_memdesc[MAX_EFI_MMAP_ENTRIES];
|
||||
|
||||
static void sort_efi_mmap_entries(void)
|
||||
{
|
||||
@ -30,18 +30,19 @@ static void sort_efi_mmap_entries(void)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre (uefi_info->memmap_size / uefi_info->memdesc_size) <= MAX_EFI_MMAP_ENTRIES
|
||||
*/
|
||||
void init_efi_mmap_entries(struct efi_info *uefi_info)
|
||||
{
|
||||
void *efi_memmap = (void *)((uint64_t)uefi_info->memmap | ((uint64_t)uefi_info->memmap_hi << 32U));
|
||||
struct efi_memory_desc *efi_memdesc = (struct efi_memory_desc *)efi_memmap;
|
||||
uint32_t entry = 0U;
|
||||
uint32_t efi_memdesc_nr = uefi_info->memmap_size / uefi_info->memdesc_size;
|
||||
|
||||
ASSERT(efi_memdesc_nr <= MAX_EFI_MMAP_ENTRIES);
|
||||
|
||||
while ((void *)efi_memdesc < (efi_memmap + uefi_info->memmap_size)) {
|
||||
if (entry >= CONFIG_MAX_EFI_MMAP_ENTRIES) {
|
||||
pr_err("Too many efi memmap entries, entries up %d are ignored.", CONFIG_MAX_EFI_MMAP_ENTRIES);
|
||||
break;
|
||||
}
|
||||
|
||||
hv_memdesc[entry] = *efi_memdesc;
|
||||
|
||||
/* Per UEFI spec, EFI_MEMORY_DESCRIPTOR array element returned in MemoryMap.
|
||||
|
@ -8,6 +8,8 @@
|
||||
#define EFI_MMAP_H
|
||||
#include <types.h>
|
||||
|
||||
#define MAX_EFI_MMAP_ENTRIES 350U
|
||||
|
||||
void init_efi_mmap_entries(struct efi_info *uefi_info);
|
||||
|
||||
uint32_t get_efi_mmap_entries_count(void);
|
||||
|
Loading…
Reference in New Issue
Block a user