Skip to content

Commit

Permalink
efiwrapper: add E820_VENDOR_RSVD type in lpmemmap
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Haoyu Tang <[email protected]>
  • Loading branch information
bhe4 committed Oct 10, 2024
1 parent 2e00b24 commit 734c775
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/lpmemmap/lpmemmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 734c775

Please sign in to comment.