From 734c775dc6987ca88a9f91fba0e685a864963f69 Mon Sep 17 00:00:00 2001 From: Bo He Date: Tue, 6 Aug 2024 10:46:46 +0800 Subject: [PATCH] efiwrapper: add E820_VENDOR_RSVD type in lpmemmap 1. filter insert_mem_descr for crash dump 2. update the E820_VENDOR_RSVD to EfiLoaderCode Test Done: 1. android boot 2. crashdump function works Tracked-On: OAM-126205 Signed-off-by: Bo He Signed-off-by: Haoyu Tang --- drivers/lpmemmap/lpmemmap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/lpmemmap/lpmemmap.c b/drivers/lpmemmap/lpmemmap.c index ed23833..e9e6e9c 100644 --- a/drivers/lpmemmap/lpmemmap.c +++ b/drivers/lpmemmap/lpmemmap.c @@ -46,6 +46,7 @@ static EFI_MEMORY_DESCRIPTOR *efimemmap; #define E820_ACPI 3 #define E820_NVS 4 #define E820_UNUSABLE 5 +#define E820_VENDOR_RSVD 6 #define EFI_MAX_ADDRESS ((UINTN)~0) static EFI_STATUS e820_to_efi(unsigned int e820, UINT32 *efi) @@ -71,6 +72,10 @@ static EFI_STATUS e820_to_efi(unsigned int e820, UINT32 *efi) *efi = EfiUnusableMemory; return EFI_SUCCESS; + case E820_VENDOR_RSVD: + *efi = EfiLoaderCode; + return EFI_SUCCESS; + default: return EFI_NOT_FOUND; } @@ -400,7 +405,9 @@ static EFI_GET_MEMORY_MAP saved_memmap_bs; static EFI_STATUS lpmemmap_init(EFI_SYSTEM_TABLE *st) { EFI_STATUS ret; +#ifndef __CRASH_DUMP EFI_PHYSICAL_ADDRESS start, data, end; +#endif if (!st) return EFI_INVALID_PARAMETER; @@ -413,6 +420,7 @@ static EFI_STATUS lpmemmap_init(EFI_SYSTEM_TABLE *st) if (EFI_ERROR(ret)) return ret; +#ifndef __CRASH_DUMP start = ALIGN_DOWN((EFI_PHYSICAL_ADDRESS)(UINTN)_start, EFI_PAGE_SIZE); data = ALIGN_UP((EFI_PHYSICAL_ADDRESS)(UINTN)_heap, EFI_PAGE_SIZE); ret = insert_mem_descr(start, data, EfiLoaderCode); @@ -423,7 +431,7 @@ static EFI_STATUS lpmemmap_init(EFI_SYSTEM_TABLE *st) ret = insert_mem_descr(data, end, EfiLoaderData); if (EFI_ERROR(ret)) goto err; - +#endif saved_memmap_bs = st->BootServices->GetMemoryMap; st->BootServices->GetMemoryMap = get_memory_map; st->BootServices->AllocatePages = allocate_pages; @@ -432,9 +440,11 @@ static EFI_STATUS lpmemmap_init(EFI_SYSTEM_TABLE *st) return EFI_SUCCESS; +#ifndef __CRASH_DUMP err: free_efimemmap(); return ret; +#endif } static EFI_STATUS lpmemmap_exit(EFI_SYSTEM_TABLE *st)