summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c')
-rw-r--r--MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
index 96bb9add8b..6304b7fc6c 100644
--- a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
+++ b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
@@ -56,6 +56,7 @@ CHAR16 *mMemoryTypeString[] = {
L"EfiPalCode",
L"EfiPersistentMemory",
L"EfiOSReserved",
+ L"EfiOemReserved",
};
CHAR16 *mSubsystemString[] = {
@@ -214,6 +215,38 @@ GetDriverNameString (
}
/**
+ Memory type to string.
+
+ @param[in] MemoryType Memory type.
+
+ @return Pointer to string.
+
+**/
+CHAR16 *
+ProfileMemoryTypeToStr (
+ IN EFI_MEMORY_TYPE MemoryType
+ )
+{
+ UINTN Index;
+
+ if ((UINT32) MemoryType >= 0x80000000) {
+ //
+ // OS reserved memory type.
+ //
+ Index = EfiMaxMemoryType;
+ } else if ((UINT32) MemoryType >= 0x70000000) {
+ //
+ // OEM reserved memory type.
+ //
+ Index = EfiMaxMemoryType + 1;
+ } else {
+ Index = MemoryType;
+ }
+
+ return mMemoryTypeString[Index];
+}
+
+/**
Dump memory profile allocate information.
@param[in] DriverInfo Pointer to memory profile driver info.
@@ -240,7 +273,7 @@ DumpMemoryProfileAllocInfo (
Print (L" CallerAddress - 0x%016lx (Offset: 0x%08x)\n", AllocInfo->CallerAddress, (UINTN) (AllocInfo->CallerAddress - DriverInfo->ImageBase));
Print (L" SequenceId - 0x%08x\n", AllocInfo->SequenceId);
Print (L" Action - 0x%08x (%s)\n", AllocInfo->Action, mActionString[(AllocInfo->Action < sizeof(mActionString)/sizeof(mActionString[0])) ? AllocInfo->Action : 0]);
- Print (L" MemoryType - 0x%08x (%s)\n", AllocInfo->MemoryType, mMemoryTypeString[(AllocInfo->MemoryType < sizeof(mMemoryTypeString)/sizeof(mMemoryTypeString[0])) ? AllocInfo->MemoryType : (sizeof(mMemoryTypeString)/sizeof(mMemoryTypeString[0]) - 1)]);
+ Print (L" MemoryType - 0x%08x (%s)\n", AllocInfo->MemoryType, ProfileMemoryTypeToStr (AllocInfo->MemoryType));
Print (L" Buffer - 0x%016lx\n", AllocInfo->Buffer);
Print (L" Size - 0x%016lx\n", AllocInfo->Size);
@@ -282,7 +315,7 @@ DumpMemoryProfileDriverInfo (
Print (L" FileType - 0x%02x (%s)\n", DriverInfo->FileType, mFileTypeString[(DriverInfo->FileType < sizeof(mFileTypeString)/sizeof(mFileTypeString[0])) ? DriverInfo->FileType : 0]);
Print (L" CurrentUsage - 0x%016lx\n", DriverInfo->CurrentUsage);
Print (L" PeakUsage - 0x%016lx\n", DriverInfo->PeakUsage);
- for (TypeIndex = 0; TypeIndex <= EfiMaxMemoryType; TypeIndex++) {
+ for (TypeIndex = 0; TypeIndex < sizeof (DriverInfo->CurrentUsageByType) / sizeof (DriverInfo->CurrentUsageByType[0]); TypeIndex++) {
if ((DriverInfo->CurrentUsageByType[TypeIndex] != 0) ||
(DriverInfo->PeakUsageByType[TypeIndex] != 0)) {
Print (L" CurrentUsage[0x%02x] - 0x%016lx (%s)\n", TypeIndex, DriverInfo->CurrentUsageByType[TypeIndex], mMemoryTypeString[TypeIndex]);
@@ -327,7 +360,7 @@ DumpMemoryProfileContext (
Print (L" Revision - 0x%04x\n", Context->Header.Revision);
Print (L" CurrentTotalUsage - 0x%016lx\n", Context->CurrentTotalUsage);
Print (L" PeakTotalUsage - 0x%016lx\n", Context->PeakTotalUsage);
- for (TypeIndex = 0; TypeIndex <= EfiMaxMemoryType; TypeIndex++) {
+ for (TypeIndex = 0; TypeIndex < sizeof (Context->CurrentTotalUsageByType) / sizeof (Context->CurrentTotalUsageByType[0]); TypeIndex++) {
if ((Context->CurrentTotalUsageByType[TypeIndex] != 0) ||
(Context->PeakTotalUsageByType[TypeIndex] != 0)) {
Print (L" CurrentTotalUsage[0x%02x] - 0x%016lx (%s)\n", TypeIndex, Context->CurrentTotalUsageByType[TypeIndex], mMemoryTypeString[TypeIndex]);