summaryrefslogtreecommitdiffstats
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.c614
1 files changed, 333 insertions, 281 deletions
diff --git a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
index 99a2d52db1..326603503f 100644
--- a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
+++ b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
@@ -24,7 +24,7 @@
#include <Guid/MemoryProfile.h>
#include <Guid/PiSmmCommunicationRegionTable.h>
-CHAR8 *mActionString[] = {
+CHAR8 *mActionString[] = {
"Unknown",
"gBS->AllocatePages",
"gBS->FreePages",
@@ -32,7 +32,7 @@ CHAR8 *mActionString[] = {
"gBS->FreePool",
};
-CHAR8 *mSmmActionString[] = {
+CHAR8 *mSmmActionString[] = {
"SmmUnknown",
"gSmst->SmmAllocatePages",
"gSmst->SmmFreePages",
@@ -41,37 +41,37 @@ CHAR8 *mSmmActionString[] = {
};
typedef struct {
- MEMORY_PROFILE_ACTION Action;
- CHAR8 *String;
+ MEMORY_PROFILE_ACTION Action;
+ CHAR8 *String;
} ACTION_STRING;
-ACTION_STRING mExtActionString[] = {
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES, "Lib:AllocatePages"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES, "Lib:AllocateRuntimePages"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES, "Lib:AllocateReservedPages"},
- {MEMORY_PROFILE_ACTION_LIB_FREE_PAGES, "Lib:FreePages"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES, "Lib:AllocateAlignedPages"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES, "Lib:AllocateAlignedRuntimePages"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES, "Lib:AllocateAlignedReservedPages"},
- {MEMORY_PROFILE_ACTION_LIB_FREE_ALIGNED_PAGES, "Lib:FreeAlignedPages"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL, "Lib:AllocatePool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL, "Lib:AllocateRuntimePool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL, "Lib:AllocateReservedPool"},
- {MEMORY_PROFILE_ACTION_LIB_FREE_POOL, "Lib:FreePool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL, "Lib:AllocateZeroPool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL, "Lib:AllocateRuntimeZeroPool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL, "Lib:AllocateReservedZeroPool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL, "Lib:AllocateCopyPool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL, "Lib:AllocateRuntimeCopyPool"},
- {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL, "Lib:AllocateReservedCopyPool"},
- {MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL, "Lib:ReallocatePool"},
- {MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL, "Lib:ReallocateRuntimePool"},
- {MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL, "Lib:ReallocateReservedPool"},
+ACTION_STRING mExtActionString[] = {
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES, "Lib:AllocatePages" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES, "Lib:AllocateRuntimePages" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES, "Lib:AllocateReservedPages" },
+ { MEMORY_PROFILE_ACTION_LIB_FREE_PAGES, "Lib:FreePages" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES, "Lib:AllocateAlignedPages" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES, "Lib:AllocateAlignedRuntimePages" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES, "Lib:AllocateAlignedReservedPages" },
+ { MEMORY_PROFILE_ACTION_LIB_FREE_ALIGNED_PAGES, "Lib:FreeAlignedPages" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL, "Lib:AllocatePool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL, "Lib:AllocateRuntimePool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL, "Lib:AllocateReservedPool" },
+ { MEMORY_PROFILE_ACTION_LIB_FREE_POOL, "Lib:FreePool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL, "Lib:AllocateZeroPool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL, "Lib:AllocateRuntimeZeroPool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL, "Lib:AllocateReservedZeroPool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL, "Lib:AllocateCopyPool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL, "Lib:AllocateRuntimeCopyPool" },
+ { MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL, "Lib:AllocateReservedCopyPool" },
+ { MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL, "Lib:ReallocatePool" },
+ { MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL, "Lib:ReallocateRuntimePool" },
+ { MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL, "Lib:ReallocateReservedPool" },
};
-CHAR8 mUserDefinedActionString[] = {"UserDefined-0x80000000"};
+CHAR8 mUserDefinedActionString[] = { "UserDefined-0x80000000" };
-CHAR8 *mMemoryTypeString[] = {
+CHAR8 *mMemoryTypeString[] = {
"EfiReservedMemoryType",
"EfiLoaderCode",
"EfiLoaderData",
@@ -91,7 +91,7 @@ CHAR8 *mMemoryTypeString[] = {
"EfiOemReserved",
};
-CHAR8 *mSubsystemString[] = {
+CHAR8 *mSubsystemString[] = {
"Unknown",
"NATIVE",
"WINDOWS_GUI",
@@ -110,7 +110,7 @@ CHAR8 *mSubsystemString[] = {
"Unknown",
};
-CHAR8 *mFileTypeString[] = {
+CHAR8 *mFileTypeString[] = {
"Unknown",
"RAW",
"FREEFORM",
@@ -128,27 +128,27 @@ CHAR8 *mFileTypeString[] = {
};
#define PROFILE_NAME_STRING_LENGTH 64
-CHAR8 mNameString[PROFILE_NAME_STRING_LENGTH + 1];
+CHAR8 mNameString[PROFILE_NAME_STRING_LENGTH + 1];
//
// Profile summary information
//
-#define MEMORY_PROFILE_ALLOC_SUMMARY_INFO_SIGNATURE SIGNATURE_32 ('M','P','A','S')
-#define MEMORY_PROFILE_ALLOC_SUMMARY_INFO_REVISION 0x0001
+#define MEMORY_PROFILE_ALLOC_SUMMARY_INFO_SIGNATURE SIGNATURE_32 ('M','P','A','S')
+#define MEMORY_PROFILE_ALLOC_SUMMARY_INFO_REVISION 0x0001
typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- PHYSICAL_ADDRESS CallerAddress;
- MEMORY_PROFILE_ACTION Action;
- CHAR8 *ActionString;
- UINT32 AllocateCount;
- UINT64 TotalSize;
+ MEMORY_PROFILE_COMMON_HEADER Header;
+ PHYSICAL_ADDRESS CallerAddress;
+ MEMORY_PROFILE_ACTION Action;
+ CHAR8 *ActionString;
+ UINT32 AllocateCount;
+ UINT64 TotalSize;
} MEMORY_PROFILE_ALLOC_SUMMARY_INFO;
typedef struct {
- UINT32 Signature;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO AllocSummaryInfo;
- LIST_ENTRY Link;
+ UINT32 Signature;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO AllocSummaryInfo;
+ LIST_ENTRY Link;
} MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA;
typedef struct {
@@ -159,13 +159,13 @@ typedef struct {
} MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA;
typedef struct {
- UINT32 Signature;
- MEMORY_PROFILE_CONTEXT *Context;
- LIST_ENTRY *DriverSummaryInfoList;
+ UINT32 Signature;
+ MEMORY_PROFILE_CONTEXT *Context;
+ LIST_ENTRY *DriverSummaryInfoList;
} MEMORY_PROFILE_CONTEXT_SUMMARY_DATA;
-LIST_ENTRY mImageSummaryQueue = INITIALIZE_LIST_HEAD_VARIABLE (mImageSummaryQueue);
-MEMORY_PROFILE_CONTEXT_SUMMARY_DATA mMemoryProfileContextSummary;
+LIST_ENTRY mImageSummaryQueue = INITIALIZE_LIST_HEAD_VARIABLE (mImageSummaryQueue);
+MEMORY_PROFILE_CONTEXT_SUMMARY_DATA mMemoryProfileContextSummary;
/**
Get the file name portion of the Pdb File Name.
@@ -181,14 +181,14 @@ MEMORY_PROFILE_CONTEXT_SUMMARY_DATA mMemoryProfileContextSummary;
**/
VOID
GetShortPdbFileName (
- IN CHAR8 *PdbFileName,
- OUT CHAR8 *AsciiBuffer
+ IN CHAR8 *PdbFileName,
+ OUT CHAR8 *AsciiBuffer
)
{
- UINTN IndexPdb; // Current work location within a Pdb string.
- UINTN IndexBuffer; // Current work location within a Buffer string.
- UINTN StartIndex;
- UINTN EndIndex;
+ UINTN IndexPdb; // Current work location within a Pdb string.
+ UINTN IndexBuffer; // Current work location within a Buffer string.
+ UINTN StartIndex;
+ UINTN EndIndex;
ZeroMem (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1);
@@ -196,7 +196,9 @@ GetShortPdbFileName (
AsciiStrnCpyS (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1, " ", 1);
} else {
StartIndex = 0;
- for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++);
+ for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++) {
+ }
+
for (IndexPdb = 0; PdbFileName[IndexPdb] != 0; IndexPdb++) {
if ((PdbFileName[IndexPdb] == '\\') || (PdbFileName[IndexPdb] == '/')) {
StartIndex = IndexPdb + 1;
@@ -233,18 +235,18 @@ GetShortPdbFileName (
**/
CHAR8 *
GetDriverNameString (
- IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo
- )
+ IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo
+ )
{
- EFI_STATUS Status;
- CHAR16 *NameString;
- UINTN StringSize;
+ EFI_STATUS Status;
+ CHAR16 *NameString;
+ UINTN StringSize;
//
// Method 1: Get the name string from image PDB
//
if (DriverInfo->PdbStringOffset != 0) {
- GetShortPdbFileName ((CHAR8 *) ((UINTN) DriverInfo + DriverInfo->PdbStringOffset), mNameString);
+ GetShortPdbFileName ((CHAR8 *)((UINTN)DriverInfo + DriverInfo->PdbStringOffset), mNameString);
return mNameString;
}
@@ -254,13 +256,13 @@ GetDriverNameString (
//
NameString = NULL;
StringSize = 0;
- Status = GetSectionFromAnyFv (
- &DriverInfo->FileName,
- EFI_SECTION_USER_INTERFACE,
- 0,
- (VOID **) &NameString,
- &StringSize
- );
+ Status = GetSectionFromAnyFv (
+ &DriverInfo->FileName,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&NameString,
+ &StringSize
+ );
if (!EFI_ERROR (Status)) {
//
// Method 2: Get the name string from FFS UI section
@@ -268,6 +270,7 @@ GetDriverNameString (
if (StrLen (NameString) > PROFILE_NAME_STRING_LENGTH) {
NameString[PROFILE_NAME_STRING_LENGTH] = 0;
}
+
UnicodeStrToAsciiStrS (NameString, mNameString, sizeof (mNameString));
FreePool (NameString);
return mNameString;
@@ -291,17 +294,17 @@ GetDriverNameString (
**/
CHAR8 *
ProfileMemoryTypeToStr (
- IN EFI_MEMORY_TYPE MemoryType
+ IN EFI_MEMORY_TYPE MemoryType
)
{
- UINTN Index;
+ UINTN Index;
- if ((UINT32) MemoryType >= 0x80000000) {
+ if ((UINT32)MemoryType >= 0x80000000) {
//
// OS reserved memory type.
//
Index = EfiMaxMemoryType;
- } else if ((UINT32) MemoryType >= 0x70000000) {
+ } else if ((UINT32)MemoryType >= 0x70000000) {
//
// OEM reserved memory type.
//
@@ -331,30 +334,33 @@ ProfileActionToStr (
IN BOOLEAN IsForSmm
)
{
- UINTN Index;
- UINTN ActionStringCount;
- CHAR8 **ActionString;
+ UINTN Index;
+ UINTN ActionStringCount;
+ CHAR8 **ActionString;
if (IsForSmm) {
- ActionString = mSmmActionString;
+ ActionString = mSmmActionString;
ActionStringCount = ARRAY_SIZE (mSmmActionString);
} else {
- ActionString = mActionString;
+ ActionString = mActionString;
ActionStringCount = ARRAY_SIZE (mActionString);
}
- if ((UINTN) (UINT32) Action < ActionStringCount) {
+ if ((UINTN)(UINT32)Action < ActionStringCount) {
return ActionString[Action];
}
+
for (Index = 0; Index < ARRAY_SIZE (mExtActionString); Index++) {
if (mExtActionString[Index].Action == Action) {
return mExtActionString[Index].String;
}
}
+
if ((Action & MEMORY_PROFILE_ACTION_USER_DEFINED_MASK) != 0) {
if (UserDefinedActionString != NULL) {
return UserDefinedActionString;
}
+
AsciiSPrint (mUserDefinedActionString, sizeof (mUserDefinedActionString), "UserDefined-0x%08x", Action);
return mUserDefinedActionString;
}
@@ -376,20 +382,20 @@ ProfileActionToStr (
**/
MEMORY_PROFILE_ALLOC_INFO *
DumpMemoryProfileAllocInfo (
- IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo,
- IN UINTN AllocIndex,
- IN MEMORY_PROFILE_ALLOC_INFO *AllocInfo,
- IN BOOLEAN IsForSmm
+ IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo,
+ IN UINTN AllocIndex,
+ IN MEMORY_PROFILE_ALLOC_INFO *AllocInfo,
+ IN BOOLEAN IsForSmm
)
{
- CHAR8 *ActionString;
+ CHAR8 *ActionString;
if (AllocInfo->Header.Signature != MEMORY_PROFILE_ALLOC_INFO_SIGNATURE) {
return NULL;
}
if (AllocInfo->ActionStringOffset != 0) {
- ActionString = (CHAR8 *) ((UINTN) AllocInfo + AllocInfo->ActionStringOffset);
+ ActionString = (CHAR8 *)((UINTN)AllocInfo + AllocInfo->ActionStringOffset);
} else {
ActionString = NULL;
}
@@ -398,14 +404,14 @@ DumpMemoryProfileAllocInfo (
Print (L" Signature - 0x%08x\n", AllocInfo->Header.Signature);
Print (L" Length - 0x%04x\n", AllocInfo->Header.Length);
Print (L" Revision - 0x%04x\n", AllocInfo->Header.Revision);
- Print (L" CallerAddress - 0x%016lx (Offset: 0x%08x)\n", AllocInfo->CallerAddress, (UINTN) (AllocInfo->CallerAddress - DriverInfo->ImageBase));
+ 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 (%a)\n", AllocInfo->Action, ProfileActionToStr (AllocInfo->Action, ActionString, IsForSmm));
Print (L" MemoryType - 0x%08x (%a)\n", AllocInfo->MemoryType, ProfileMemoryTypeToStr (AllocInfo->MemoryType));
Print (L" Buffer - 0x%016lx\n", AllocInfo->Buffer);
Print (L" Size - 0x%016lx\n", AllocInfo->Size);
- return (MEMORY_PROFILE_ALLOC_INFO *) ((UINTN) AllocInfo + AllocInfo->Header.Length);
+ return (MEMORY_PROFILE_ALLOC_INFO *)((UINTN)AllocInfo + AllocInfo->Header.Length);
}
/**
@@ -421,19 +427,20 @@ DumpMemoryProfileAllocInfo (
**/
MEMORY_PROFILE_DRIVER_INFO *
DumpMemoryProfileDriverInfo (
- IN UINTN DriverIndex,
- IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo,
- IN BOOLEAN IsForSmm
+ IN UINTN DriverIndex,
+ IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo,
+ IN BOOLEAN IsForSmm
)
{
- UINTN TypeIndex;
- MEMORY_PROFILE_ALLOC_INFO *AllocInfo;
- UINTN AllocIndex;
- CHAR8 *NameString;
+ UINTN TypeIndex;
+ MEMORY_PROFILE_ALLOC_INFO *AllocInfo;
+ UINTN AllocIndex;
+ CHAR8 *NameString;
if (DriverInfo->Header.Signature != MEMORY_PROFILE_DRIVER_INFO_SIGNATURE) {
return NULL;
}
+
Print (L" MEMORY_PROFILE_DRIVER_INFO (0x%x)\n", DriverIndex);
Print (L" Signature - 0x%08x\n", DriverInfo->Header.Signature);
Print (L" Length - 0x%04x\n", DriverInfo->Header.Length);
@@ -441,32 +448,36 @@ DumpMemoryProfileDriverInfo (
NameString = GetDriverNameString (DriverInfo);
Print (L" FileName - %a\n", NameString);
if (DriverInfo->PdbStringOffset != 0) {
- Print (L" Pdb - %a\n", (CHAR8 *) ((UINTN) DriverInfo + DriverInfo->PdbStringOffset));
+ Print (L" Pdb - %a\n", (CHAR8 *)((UINTN)DriverInfo + DriverInfo->PdbStringOffset));
}
+
Print (L" ImageBase - 0x%016lx\n", DriverInfo->ImageBase);
Print (L" ImageSize - 0x%016lx\n", DriverInfo->ImageSize);
Print (L" EntryPoint - 0x%016lx\n", DriverInfo->EntryPoint);
- Print (L" ImageSubsystem - 0x%04x (%a)\n", DriverInfo->ImageSubsystem, mSubsystemString[(DriverInfo->ImageSubsystem < sizeof(mSubsystemString)/sizeof(mSubsystemString[0])) ? DriverInfo->ImageSubsystem : 0]);
- Print (L" FileType - 0x%02x (%a)\n", DriverInfo->FileType, mFileTypeString[(DriverInfo->FileType < sizeof(mFileTypeString)/sizeof(mFileTypeString[0])) ? DriverInfo->FileType : 0]);
+ Print (L" ImageSubsystem - 0x%04x (%a)\n", DriverInfo->ImageSubsystem, mSubsystemString[(DriverInfo->ImageSubsystem < sizeof (mSubsystemString)/sizeof (mSubsystemString[0])) ? DriverInfo->ImageSubsystem : 0]);
+ Print (L" FileType - 0x%02x (%a)\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 < sizeof (DriverInfo->CurrentUsageByType) / sizeof (DriverInfo->CurrentUsageByType[0]); TypeIndex++) {
if ((DriverInfo->CurrentUsageByType[TypeIndex] != 0) ||
- (DriverInfo->PeakUsageByType[TypeIndex] != 0)) {
+ (DriverInfo->PeakUsageByType[TypeIndex] != 0))
+ {
Print (L" CurrentUsage[0x%02x] - 0x%016lx (%a)\n", TypeIndex, DriverInfo->CurrentUsageByType[TypeIndex], mMemoryTypeString[TypeIndex]);
Print (L" PeakUsage[0x%02x] - 0x%016lx (%a)\n", TypeIndex, DriverInfo->PeakUsageByType[TypeIndex], mMemoryTypeString[TypeIndex]);
}
}
+
Print (L" AllocRecordCount - 0x%08x\n", DriverInfo->AllocRecordCount);
- AllocInfo = (MEMORY_PROFILE_ALLOC_INFO *) ((UINTN) DriverInfo + DriverInfo->Header.Length);
+ AllocInfo = (MEMORY_PROFILE_ALLOC_INFO *)((UINTN)DriverInfo + DriverInfo->Header.Length);
for (AllocIndex = 0; AllocIndex < DriverInfo->AllocRecordCount; AllocIndex++) {
AllocInfo = DumpMemoryProfileAllocInfo (DriverInfo, AllocIndex, AllocInfo, IsForSmm);
if (AllocInfo == NULL) {
return NULL;
}
}
- return (MEMORY_PROFILE_DRIVER_INFO *) AllocInfo;
+
+ return (MEMORY_PROFILE_DRIVER_INFO *)AllocInfo;
}
/**
@@ -481,17 +492,18 @@ DumpMemoryProfileDriverInfo (
**/
VOID *
DumpMemoryProfileContext (
- IN MEMORY_PROFILE_CONTEXT *Context,
- IN BOOLEAN IsForSmm
+ IN MEMORY_PROFILE_CONTEXT *Context,
+ IN BOOLEAN IsForSmm
)
{
- UINTN TypeIndex;
- MEMORY_PROFILE_DRIVER_INFO *DriverInfo;
- UINTN DriverIndex;
+ UINTN TypeIndex;
+ MEMORY_PROFILE_DRIVER_INFO *DriverInfo;
+ UINTN DriverIndex;
if (Context->Header.Signature != MEMORY_PROFILE_CONTEXT_SIGNATURE) {
return NULL;
}
+
Print (L"MEMORY_PROFILE_CONTEXT\n");
Print (L" Signature - 0x%08x\n", Context->Header.Signature);
Print (L" Length - 0x%04x\n", Context->Header.Length);
@@ -500,23 +512,26 @@ DumpMemoryProfileContext (
Print (L" PeakTotalUsage - 0x%016lx\n", Context->PeakTotalUsage);
for (TypeIndex = 0; TypeIndex < sizeof (Context->CurrentTotalUsageByType) / sizeof (Context->CurrentTotalUsageByType[0]); TypeIndex++) {
if ((Context->CurrentTotalUsageByType[TypeIndex] != 0) ||
- (Context->PeakTotalUsageByType[TypeIndex] != 0)) {
+ (Context->PeakTotalUsageByType[TypeIndex] != 0))
+ {
Print (L" CurrentTotalUsage[0x%02x] - 0x%016lx (%a)\n", TypeIndex, Context->CurrentTotalUsageByType[TypeIndex], mMemoryTypeString[TypeIndex]);
Print (L" PeakTotalUsage[0x%02x] - 0x%016lx (%a)\n", TypeIndex, Context->PeakTotalUsageByType[TypeIndex], mMemoryTypeString[TypeIndex]);
}
}
+
Print (L" TotalImageSize - 0x%016lx\n", Context->TotalImageSize);
Print (L" ImageCount - 0x%08x\n", Context->ImageCount);
Print (L" SequenceCount - 0x%08x\n", Context->SequenceCount);
- DriverInfo = (MEMORY_PROFILE_DRIVER_INFO *) ((UINTN) Context + Context->Header.Length);
+ DriverInfo = (MEMORY_PROFILE_DRIVER_INFO *)((UINTN)Context + Context->Header.Length);
for (DriverIndex = 0; DriverIndex < Context->ImageCount; DriverIndex++) {
DriverInfo = DumpMemoryProfileDriverInfo (DriverIndex, DriverInfo, IsForSmm);
if (DriverInfo == NULL) {
return NULL;
}
}
- return (VOID *) DriverInfo;
+
+ return (VOID *)DriverInfo;
}
/**
@@ -537,6 +552,7 @@ DumpMemoryProfileDescriptor (
if (Descriptor->Header.Signature != MEMORY_PROFILE_DESCRIPTOR_SIGNATURE) {
return NULL;
}
+
Print (L" MEMORY_PROFILE_DESCRIPTOR (0x%x)\n", DescriptorIndex);
Print (L" Signature - 0x%08x\n", Descriptor->Header.Signature);
Print (L" Length - 0x%04x\n", Descriptor->Header.Length);
@@ -544,7 +560,7 @@ DumpMemoryProfileDescriptor (
Print (L" Address - 0x%016lx\n", Descriptor->Address);
Print (L" Size - 0x%016lx\n", Descriptor->Size);
- return (MEMORY_PROFILE_DESCRIPTOR *) ((UINTN) Descriptor + Descriptor->Header.Length);
+ return (MEMORY_PROFILE_DESCRIPTOR *)((UINTN)Descriptor + Descriptor->Header.Length);
}
/**
@@ -557,15 +573,16 @@ DumpMemoryProfileDescriptor (
**/
VOID *
DumpMemoryProfileFreeMemory (
- IN MEMORY_PROFILE_FREE_MEMORY *FreeMemory
+ IN MEMORY_PROFILE_FREE_MEMORY *FreeMemory
)
{
- MEMORY_PROFILE_DESCRIPTOR *Descriptor;
- UINTN DescriptorIndex;
+ MEMORY_PROFILE_DESCRIPTOR *Descriptor;
+ UINTN DescriptorIndex;
if (FreeMemory->Header.Signature != MEMORY_PROFILE_FREE_MEMORY_SIGNATURE) {
return NULL;
}
+
Print (L"MEMORY_PROFILE_FREE_MEMORY\n");
Print (L" Signature - 0x%08x\n", FreeMemory->Header.Signature);
Print (L" Length - 0x%04x\n", FreeMemory->Header.Length);
@@ -573,7 +590,7 @@ DumpMemoryProfileFreeMemory (
Print (L" TotalFreeMemoryPages - 0x%016lx\n", FreeMemory->TotalFreeMemoryPages);
Print (L" FreeMemoryEntryCount - 0x%08x\n", FreeMemory->FreeMemoryEntryCount);
- Descriptor = (MEMORY_PROFILE_DESCRIPTOR *) ((UINTN) FreeMemory + FreeMemory->Header.Length);
+ Descriptor = (MEMORY_PROFILE_DESCRIPTOR *)((UINTN)FreeMemory + FreeMemory->Header.Length);
for (DescriptorIndex = 0; DescriptorIndex < FreeMemory->FreeMemoryEntryCount; DescriptorIndex++) {
Descriptor = DumpMemoryProfileDescriptor (DescriptorIndex, Descriptor);
if (Descriptor == NULL) {
@@ -581,7 +598,7 @@ DumpMemoryProfileFreeMemory (
}
}
- return (VOID *) Descriptor;
+ return (VOID *)Descriptor;
}
/**
@@ -594,22 +611,23 @@ DumpMemoryProfileFreeMemory (
**/
VOID *
DumpMemoryProfileMemoryRange (
- IN MEMORY_PROFILE_MEMORY_RANGE *MemoryRange
+ IN MEMORY_PROFILE_MEMORY_RANGE *MemoryRange
)
{
- MEMORY_PROFILE_DESCRIPTOR *Descriptor;
- UINTN DescriptorIndex;
+ MEMORY_PROFILE_DESCRIPTOR *Descriptor;
+ UINTN DescriptorIndex;
if (MemoryRange->Header.Signature != MEMORY_PROFILE_MEMORY_RANGE_SIGNATURE) {
return NULL;
}
+
Print (L"MEMORY_PROFILE_MEMORY_RANGE\n");
Print (L" Signature - 0x%08x\n", MemoryRange->Header.Signature);
Print (L" Length - 0x%04x\n", MemoryRange->Header.Length);
Print (L" Revision - 0x%04x\n", MemoryRange->Header.Revision);
Print (L" MemoryRangeCount - 0x%08x\n", MemoryRange->MemoryRangeCount);
- Descriptor = (MEMORY_PROFILE_DESCRIPTOR *) ((UINTN) MemoryRange + MemoryRange->Header.Length);
+ Descriptor = (MEMORY_PROFILE_DESCRIPTOR *)((UINTN)MemoryRange + MemoryRange->Header.Length);
for (DescriptorIndex = 0; DescriptorIndex < MemoryRange->MemoryRangeCount; DescriptorIndex++) {
Descriptor = DumpMemoryProfileDescriptor (DescriptorIndex, Descriptor);
if (Descriptor == NULL) {
@@ -617,7 +635,7 @@ DumpMemoryProfileMemoryRange (
}
}
- return (VOID *) Descriptor;
+ return (VOID *)Descriptor;
}
/**
@@ -632,28 +650,30 @@ DumpMemoryProfileMemoryRange (
**/
VOID *
ScanMemoryProfileBySignature (
- IN PHYSICAL_ADDRESS ProfileBuffer,
- IN UINT64 ProfileSize,
- IN UINT32 Signature
+ IN PHYSICAL_ADDRESS ProfileBuffer,
+ IN UINT64 ProfileSize,
+ IN UINT32 Signature
)
{
MEMORY_PROFILE_COMMON_HEADER *CommonHeader;
- UINTN ProfileEnd;
+ UINTN ProfileEnd;
- ProfileEnd = (UINTN) (ProfileBuffer + ProfileSize);
- CommonHeader = (MEMORY_PROFILE_COMMON_HEADER *) (UINTN) ProfileBuffer;
- while ((UINTN) CommonHeader < ProfileEnd) {
+ ProfileEnd = (UINTN)(ProfileBuffer + ProfileSize);
+ CommonHeader = (MEMORY_PROFILE_COMMON_HEADER *)(UINTN)ProfileBuffer;
+ while ((UINTN)CommonHeader < ProfileEnd) {
if (CommonHeader->Signature == Signature) {
//
// Found it.
//
- return (VOID *) CommonHeader;
+ return (VOID *)CommonHeader;
}
+
if (CommonHeader->Length == 0) {
ASSERT (FALSE);
return NULL;
}
- CommonHeader = (MEMORY_PROFILE_COMMON_HEADER *) ((UINTN) CommonHeader + CommonHeader->Length);
+
+ CommonHeader = (MEMORY_PROFILE_COMMON_HEADER *)((UINTN)CommonHeader + CommonHeader->Length);
}
return NULL;
@@ -670,26 +690,26 @@ ScanMemoryProfileBySignature (
**/
VOID
DumpMemoryProfile (
- IN PHYSICAL_ADDRESS ProfileBuffer,
- IN UINT64 ProfileSize,
- IN BOOLEAN IsForSmm
+ IN PHYSICAL_ADDRESS ProfileBuffer,
+ IN UINT64 ProfileSize,
+ IN BOOLEAN IsForSmm
)
{
- MEMORY_PROFILE_CONTEXT *Context;
- MEMORY_PROFILE_FREE_MEMORY *FreeMemory;
- MEMORY_PROFILE_MEMORY_RANGE *MemoryRange;
+ MEMORY_PROFILE_CONTEXT *Context;
+ MEMORY_PROFILE_FREE_MEMORY *FreeMemory;
+ MEMORY_PROFILE_MEMORY_RANGE *MemoryRange;
- Context = (MEMORY_PROFILE_CONTEXT *) ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_CONTEXT_SIGNATURE);
+ Context = (MEMORY_PROFILE_CONTEXT *)ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_CONTEXT_SIGNATURE);
if (Context != NULL) {
DumpMemoryProfileContext (Context, IsForSmm);
}
- FreeMemory = (MEMORY_PROFILE_FREE_MEMORY *) ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_FREE_MEMORY_SIGNATURE);
+ FreeMemory = (MEMORY_PROFILE_FREE_MEMORY *)ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_FREE_MEMORY_SIGNATURE);
if (FreeMemory != NULL) {
DumpMemoryProfileFreeMemory (FreeMemory);
}
- MemoryRange = (MEMORY_PROFILE_MEMORY_RANGE *) ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_MEMORY_RANGE_SIGNATURE);
+ MemoryRange = (MEMORY_PROFILE_MEMORY_RANGE *)ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_MEMORY_RANGE_SIGNATURE);
if (MemoryRange != NULL) {
DumpMemoryProfileMemoryRange (MemoryRange);
}
@@ -706,20 +726,21 @@ DumpMemoryProfile (
**/
MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *
GetAllocSummaryInfoByCallerAddress (
- IN PHYSICAL_ADDRESS CallerAddress,
- IN MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData
+ IN PHYSICAL_ADDRESS CallerAddress,
+ IN MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData
)
{
- LIST_ENTRY *AllocSummaryInfoList;
- LIST_ENTRY *AllocSummaryLink;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO *AllocSummaryInfo;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
+ LIST_ENTRY *AllocSummaryInfoList;
+ LIST_ENTRY *AllocSummaryLink;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO *AllocSummaryInfo;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
AllocSummaryInfoList = DriverSummaryInfoData->AllocSummaryInfoList;
for (AllocSummaryLink = AllocSummaryInfoList->ForwardLink;
AllocSummaryLink != AllocSummaryInfoList;
- AllocSummaryLink = AllocSummaryLink->ForwardLink) {
+ AllocSummaryLink = AllocSummaryLink->ForwardLink)
+ {
AllocSummaryInfoData = CR (
AllocSummaryLink,
MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA,
@@ -731,6 +752,7 @@ GetAllocSummaryInfoByCallerAddress (
return AllocSummaryInfoData;
}
}
+
return NULL;
}
@@ -746,12 +768,12 @@ GetAllocSummaryInfoByCallerAddress (
**/
MEMORY_PROFILE_ALLOC_INFO *
CreateAllocSummaryInfo (
- IN OUT MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData,
- IN MEMORY_PROFILE_ALLOC_INFO *AllocInfo
+ IN OUT MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData,
+ IN MEMORY_PROFILE_ALLOC_INFO *AllocInfo
)
{
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO *AllocSummaryInfo;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO *AllocSummaryInfo;
if (AllocInfo->Header.Signature != MEMORY_PROFILE_ALLOC_INFO_SIGNATURE) {
return NULL;
@@ -764,27 +786,29 @@ CreateAllocSummaryInfo (
return NULL;
}
- AllocSummaryInfoData->Signature = MEMORY_PROFILE_ALLOC_SUMMARY_INFO_SIGNATURE;
- AllocSummaryInfo = &AllocSummaryInfoData->AllocSummaryInfo;
+ AllocSummaryInfoData->Signature = MEMORY_PROFILE_ALLOC_SUMMARY_INFO_SIGNATURE;
+ AllocSummaryInfo = &AllocSummaryInfoData->AllocSummaryInfo;
AllocSummaryInfo->Header.Signature = MEMORY_PROFILE_ALLOC_SUMMARY_INFO_SIGNATURE;
AllocSummaryInfo->Header.Length = sizeof (*AllocSummaryInfo);
AllocSummaryInfo->Header.Revision = MEMORY_PROFILE_ALLOC_SUMMARY_INFO_REVISION;
- AllocSummaryInfo->CallerAddress = AllocInfo->CallerAddress;
- AllocSummaryInfo->Action = AllocInfo->Action;
+ AllocSummaryInfo->CallerAddress = AllocInfo->CallerAddress;
+ AllocSummaryInfo->Action = AllocInfo->Action;
if (AllocInfo->ActionStringOffset != 0) {
- AllocSummaryInfo->ActionString = (CHAR8 *) ((UINTN) AllocInfo + AllocInfo->ActionStringOffset);
+ AllocSummaryInfo->ActionString = (CHAR8 *)((UINTN)AllocInfo + AllocInfo->ActionStringOffset);
} else {
- AllocSummaryInfo->ActionString = NULL;
+ AllocSummaryInfo->ActionString = NULL;
}
+
AllocSummaryInfo->AllocateCount = 0;
AllocSummaryInfo->TotalSize = 0;
InsertTailList (DriverSummaryInfoData->AllocSummaryInfoList, &AllocSummaryInfoData->Link);
}
+
AllocSummaryInfo = &AllocSummaryInfoData->AllocSummaryInfo;
- AllocSummaryInfo->AllocateCount ++;
+ AllocSummaryInfo->AllocateCount++;
AllocSummaryInfo->TotalSize += AllocInfo->Size;
- return (MEMORY_PROFILE_ALLOC_INFO *) ((UINTN) AllocInfo + AllocInfo->Header.Length);
+ return (MEMORY_PROFILE_ALLOC_INFO *)((UINTN)AllocInfo + AllocInfo->Header.Length);
}
/**
@@ -799,13 +823,13 @@ CreateAllocSummaryInfo (
**/
MEMORY_PROFILE_DRIVER_INFO *
CreateDriverSummaryInfo (
- IN OUT MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *ContextSummaryData,
- IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo
+ IN OUT MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *ContextSummaryData,
+ IN MEMORY_PROFILE_DRIVER_INFO *DriverInfo
)
{
- MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData;
- MEMORY_PROFILE_ALLOC_INFO *AllocInfo;
- UINTN AllocIndex;
+ MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData;
+ MEMORY_PROFILE_ALLOC_INFO *AllocInfo;
+ UINTN AllocIndex;
if (DriverInfo->Header.Signature != MEMORY_PROFILE_DRIVER_INFO_SIGNATURE) {
return NULL;
@@ -815,20 +839,22 @@ CreateDriverSummaryInfo (
if (DriverSummaryInfoData == NULL) {
return NULL;
}
- DriverSummaryInfoData->Signature = MEMORY_PROFILE_DRIVER_INFO_SIGNATURE;
- DriverSummaryInfoData->DriverInfo = DriverInfo;
- DriverSummaryInfoData->AllocSummaryInfoList = (LIST_ENTRY *) (DriverSummaryInfoData + 1);
+
+ DriverSummaryInfoData->Signature = MEMORY_PROFILE_DRIVER_INFO_SIGNATURE;
+ DriverSummaryInfoData->DriverInfo = DriverInfo;
+ DriverSummaryInfoData->AllocSummaryInfoList = (LIST_ENTRY *)(DriverSummaryInfoData + 1);
InitializeListHead (DriverSummaryInfoData->AllocSummaryInfoList);
InsertTailList (ContextSummaryData->DriverSummaryInfoList, &DriverSummaryInfoData->Link);
- AllocInfo = (MEMORY_PROFILE_ALLOC_INFO *) ((UINTN) DriverInfo + DriverInfo->Header.Length);
+ AllocInfo = (MEMORY_PROFILE_ALLOC_INFO *)((UINTN)DriverInfo + DriverInfo->Header.Length);
for (AllocIndex = 0; AllocIndex < DriverInfo->AllocRecordCount; AllocIndex++) {
AllocInfo = CreateAllocSummaryInfo (DriverSummaryInfoData, AllocInfo);
if (AllocInfo == NULL) {
return NULL;
}
}
- return (MEMORY_PROFILE_DRIVER_INFO *) AllocInfo;
+
+ return (MEMORY_PROFILE_DRIVER_INFO *)AllocInfo;
}
/**
@@ -842,24 +868,24 @@ CreateDriverSummaryInfo (
**/
MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *
CreateContextSummaryData (
- IN PHYSICAL_ADDRESS ProfileBuffer,
- IN UINT64 ProfileSize
+ IN PHYSICAL_ADDRESS ProfileBuffer,
+ IN UINT64 ProfileSize
)
{
- MEMORY_PROFILE_CONTEXT *Context;
- MEMORY_PROFILE_DRIVER_INFO *DriverInfo;
- UINTN DriverIndex;
+ MEMORY_PROFILE_CONTEXT *Context;
+ MEMORY_PROFILE_DRIVER_INFO *DriverInfo;
+ UINTN DriverIndex;
- Context = (MEMORY_PROFILE_CONTEXT *) ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_CONTEXT_SIGNATURE);
+ Context = (MEMORY_PROFILE_CONTEXT *)ScanMemoryProfileBySignature (ProfileBuffer, ProfileSize, MEMORY_PROFILE_CONTEXT_SIGNATURE);
if (Context == NULL) {
return NULL;
}
- mMemoryProfileContextSummary.Signature = MEMORY_PROFILE_CONTEXT_SIGNATURE;
- mMemoryProfileContextSummary.Context = Context;
+ mMemoryProfileContextSummary.Signature = MEMORY_PROFILE_CONTEXT_SIGNATURE;
+ mMemoryProfileContextSummary.Context = Context;
mMemoryProfileContextSummary.DriverSummaryInfoList = &mImageSummaryQueue;
- DriverInfo = (MEMORY_PROFILE_DRIVER_INFO *) ((UINTN) Context + Context->Header.Length);
+ DriverInfo = (MEMORY_PROFILE_DRIVER_INFO *)((UINTN)Context + Context->Header.Length);
for (DriverIndex = 0; DriverIndex < Context->ImageCount; DriverIndex++) {
DriverInfo = CreateDriverSummaryInfo (&mMemoryProfileContextSummary, DriverInfo);
if (DriverInfo == NULL) {
@@ -880,22 +906,22 @@ CreateContextSummaryData (
**/
VOID
DumpContextSummaryData (
- IN MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *ContextSummaryData,
- IN BOOLEAN IsForSmm
+ IN MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *ContextSummaryData,
+ IN BOOLEAN IsForSmm
)
{
- MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
- LIST_ENTRY *DriverSummaryInfoList;
- LIST_ENTRY *DriverSummaryLink;
- LIST_ENTRY *AllocSummaryInfoList;
- LIST_ENTRY *AllocSummaryLink;
- MEMORY_PROFILE_DRIVER_INFO *DriverInfo;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO *AllocSummaryInfo;
- CHAR8 *NameString;
+ MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
+ LIST_ENTRY *DriverSummaryInfoList;
+ LIST_ENTRY *DriverSummaryLink;
+ LIST_ENTRY *AllocSummaryInfoList;
+ LIST_ENTRY *AllocSummaryLink;
+ MEMORY_PROFILE_DRIVER_INFO *DriverInfo;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO *AllocSummaryInfo;
+ CHAR8 *NameString;
if (ContextSummaryData == NULL) {
- return ;
+ return;
}
Print (L"\nSummary Data:\n");
@@ -903,7 +929,8 @@ DumpContextSummaryData (
DriverSummaryInfoList = ContextSummaryData->DriverSummaryInfoList;
for (DriverSummaryLink = DriverSummaryInfoList->ForwardLink;
DriverSummaryLink != DriverSummaryInfoList;
- DriverSummaryLink = DriverSummaryLink->ForwardLink) {
+ DriverSummaryLink = DriverSummaryLink->ForwardLink)
+ {
DriverSummaryInfoData = CR (
DriverSummaryLink,
MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA,
@@ -920,17 +947,19 @@ DumpContextSummaryData (
}
if (DriverInfo->PdbStringOffset != 0) {
- Print (L" (Pdb - %a)\n", (CHAR8 *) ((UINTN) DriverInfo + DriverInfo->PdbStringOffset));
+ Print (L" (Pdb - %a)\n", (CHAR8 *)((UINTN)DriverInfo + DriverInfo->PdbStringOffset));
} else {
Print (L"\n");
}
+
Print (L"Caller List:\n");
- Print(L" Count Size RVA Action\n");
- Print(L"========== ================== ================== (================================)\n");
+ Print (L" Count Size RVA Action\n");
+ Print (L"========== ================== ================== (================================)\n");
AllocSummaryInfoList = DriverSummaryInfoData->AllocSummaryInfoList;
for (AllocSummaryLink = AllocSummaryInfoList->ForwardLink;
AllocSummaryLink != AllocSummaryInfoList;
- AllocSummaryLink = AllocSummaryLink->ForwardLink) {
+ AllocSummaryLink = AllocSummaryLink->ForwardLink)
+ {
AllocSummaryInfoData = CR (
AllocSummaryLink,
MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA,
@@ -939,7 +968,8 @@ DumpContextSummaryData (
);
AllocSummaryInfo = &AllocSummaryInfoData->AllocSummaryInfo;
- Print(L"0x%08x 0x%016lx <== 0x%016lx",
+ Print (
+ L"0x%08x 0x%016lx <== 0x%016lx",
AllocSummaryInfo->AllocateCount,
AllocSummaryInfo->TotalSize,
AllocSummaryInfo->CallerAddress - DriverInfo->ImageBase
@@ -947,7 +977,8 @@ DumpContextSummaryData (
Print (L" (%a)\n", ProfileActionToStr (AllocSummaryInfo->Action, AllocSummaryInfo->ActionString, IsForSmm));
}
}
- return ;
+
+ return;
}
/**
@@ -958,24 +989,25 @@ DumpContextSummaryData (
**/
VOID
DestroyContextSummaryData (
- IN OUT MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *ContextSummaryData
+ IN OUT MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *ContextSummaryData
)
{
- MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData;
- MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
- LIST_ENTRY *DriverSummaryInfoList;
- LIST_ENTRY *DriverSummaryLink;
- LIST_ENTRY *AllocSummaryInfoList;
- LIST_ENTRY *AllocSummaryLink;
+ MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA *DriverSummaryInfoData;
+ MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA *AllocSummaryInfoData;
+ LIST_ENTRY *DriverSummaryInfoList;
+ LIST_ENTRY *DriverSummaryLink;
+ LIST_ENTRY *AllocSummaryInfoList;
+ LIST_ENTRY *AllocSummaryLink;
if (ContextSummaryData == NULL) {
- return ;
+ return;
}
DriverSummaryInfoList = ContextSummaryData->DriverSummaryInfoList;
for (DriverSummaryLink = DriverSummaryInfoList->ForwardLink;
DriverSummaryLink != DriverSummaryInfoList;
- ) {
+ )
+ {
DriverSummaryInfoData = CR (
DriverSummaryLink,
MEMORY_PROFILE_DRIVER_SUMMARY_INFO_DATA,
@@ -987,7 +1019,8 @@ DestroyContextSummaryData (
AllocSummaryInfoList = DriverSummaryInfoData->AllocSummaryInfoList;
for (AllocSummaryLink = AllocSummaryInfoList->ForwardLink;
AllocSummaryLink != AllocSummaryInfoList;
- ) {
+ )
+ {
AllocSummaryInfoData = CR (
AllocSummaryLink,
MEMORY_PROFILE_ALLOC_SUMMARY_INFO_DATA,
@@ -1003,7 +1036,8 @@ DestroyContextSummaryData (
RemoveEntryList (&DriverSummaryInfoData->Link);
FreePool (DriverSummaryInfoData);
}
- return ;
+
+ return;
}
/**
@@ -1018,14 +1052,14 @@ GetUefiMemoryProfileData (
VOID
)
{
- EFI_STATUS Status;
- EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
- VOID *Data;
- UINT64 Size;
- MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *MemoryProfileContextSummaryData;
- BOOLEAN RecordingState;
-
- Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **) &ProfileProtocol);
+ EFI_STATUS Status;
+ EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
+ VOID *Data;
+ UINT64 Size;
+ MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *MemoryProfileContextSummaryData;
+ BOOLEAN RecordingState;
+
+ Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **)&ProfileProtocol);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "UefiMemoryProfile: Locate MemoryProfile protocol - %r\n", Status));
return Status;
@@ -1035,13 +1069,13 @@ GetUefiMemoryProfileData (
// Set recording state if needed.
//
RecordingState = MEMORY_PROFILE_RECORDING_DISABLE;
- Status = ProfileProtocol->GetRecordingState (ProfileProtocol, &RecordingState);
+ Status = ProfileProtocol->GetRecordingState (ProfileProtocol, &RecordingState);
if (RecordingState == MEMORY_PROFILE_RECORDING_ENABLE) {
ProfileProtocol->SetRecordingState (ProfileProtocol, MEMORY_PROFILE_RECORDING_DISABLE);
}
- Size = 0;
- Data = NULL;
+ Size = 0;
+ Data = NULL;
Status = ProfileProtocol->GetData (
ProfileProtocol,
&Size,
@@ -1052,7 +1086,7 @@ GetUefiMemoryProfileData (
goto Done;
}
- Data = AllocateZeroPool ((UINTN) Size);
+ Data = AllocateZeroPool ((UINTN)Size);
if (Data == NULL) {
Status = EFI_OUT_OF_RESOURCES;
Print (L"UefiMemoryProfile: AllocateZeroPool (0x%x) - %r\n", Size, Status);
@@ -1069,15 +1103,14 @@ GetUefiMemoryProfileData (
goto Done;
}
-
Print (L"UefiMemoryProfileSize - 0x%x\n", Size);
Print (L"======= UefiMemoryProfile begin =======\n");
- DumpMemoryProfile ((PHYSICAL_ADDRESS) (UINTN) Data, Size, FALSE);
+ DumpMemoryProfile ((PHYSICAL_ADDRESS)(UINTN)Data, Size, FALSE);
//
// Dump summary information
//
- MemoryProfileContextSummaryData = CreateContextSummaryData ((PHYSICAL_ADDRESS) (UINTN) Data, Size);
+ MemoryProfileContextSummaryData = CreateContextSummaryData ((PHYSICAL_ADDRESS)(UINTN)Data, Size);
if (MemoryProfileContextSummaryData != NULL) {
DumpContextSummaryData (MemoryProfileContextSummaryData, FALSE);
DestroyContextSummaryData (MemoryProfileContextSummaryData);
@@ -1112,29 +1145,29 @@ GetSmramProfileData (
VOID
)
{
- EFI_STATUS Status;
- UINTN CommSize;
- UINT8 *CommBuffer;
- EFI_SMM_COMMUNICATE_HEADER *CommHeader;
- SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO *CommGetProfileInfo;
- SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *CommGetProfileData;
- SMRAM_PROFILE_PARAMETER_RECORDING_STATE *CommRecordingState;
- UINTN ProfileSize;
- VOID *ProfileBuffer;
- EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
- UINTN MinimalSizeNeeded;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
- UINT32 Index;
- EFI_MEMORY_DESCRIPTOR *Entry;
- VOID *Buffer;
- UINTN Size;
- UINTN Offset;
- MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *MemoryProfileContextSummaryData;
- BOOLEAN RecordingState;
+ EFI_STATUS Status;
+ UINTN CommSize;
+ UINT8 *CommBuffer;
+ EFI_SMM_COMMUNICATE_HEADER *CommHeader;
+ SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO *CommGetProfileInfo;
+ SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *CommGetProfileData;
+ SMRAM_PROFILE_PARAMETER_RECORDING_STATE *CommRecordingState;
+ UINTN ProfileSize;
+ VOID *ProfileBuffer;
+ EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
+ UINTN MinimalSizeNeeded;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
+ UINT32 Index;
+ EFI_MEMORY_DESCRIPTOR *Entry;
+ VOID *Buffer;
+ UINTN Size;
+ UINTN Offset;
+ MEMORY_PROFILE_CONTEXT_SUMMARY_DATA *MemoryProfileContextSummaryData;
+ BOOLEAN RecordingState;
ProfileBuffer = NULL;
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **)&SmmCommunication);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "SmramProfile: Locate SmmCommunication protocol - %r\n", Status));
return Status;
@@ -1142,56 +1175,73 @@ GetSmramProfileData (
MinimalSizeNeeded = sizeof (EFI_GUID) +
sizeof (UINTN) +
- MAX (sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO),
- MAX (sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET),
- sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE)));
- MinimalSizeNeeded += MAX (sizeof (MEMORY_PROFILE_CONTEXT),
- MAX (sizeof (MEMORY_PROFILE_DRIVER_INFO),
- MAX (sizeof (MEMORY_PROFILE_ALLOC_INFO),
- MAX (sizeof (MEMORY_PROFILE_DESCRIPTOR),
- MAX (sizeof (MEMORY_PROFILE_FREE_MEMORY),
- sizeof (MEMORY_PROFILE_MEMORY_RANGE))))));
+ MAX (
+ sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO),
+ MAX (
+ sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET),
+ sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE)
+ )
+ );
+ MinimalSizeNeeded += MAX (
+ sizeof (MEMORY_PROFILE_CONTEXT),
+ MAX (
+ sizeof (MEMORY_PROFILE_DRIVER_INFO),
+ MAX (
+ sizeof (MEMORY_PROFILE_ALLOC_INFO),
+ MAX (
+ sizeof (MEMORY_PROFILE_DESCRIPTOR),
+ MAX (
+ sizeof (MEMORY_PROFILE_FREE_MEMORY),
+ sizeof (MEMORY_PROFILE_MEMORY_RANGE)
+ )
+ )
+ )
+ )
+ );
Status = EfiGetSystemConfigurationTable (
&gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &PiSmmCommunicationRegionTable
+ (VOID **)&PiSmmCommunicationRegionTable
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "SmramProfile: Get PiSmmCommunicationRegionTable - %r\n", Status));
return Status;
}
+
ASSERT (PiSmmCommunicationRegionTable != NULL);
- Entry = (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable + 1);
- Size = 0;
+ Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1);
+ Size = 0;
for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {
if (Entry->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages);
+ Size = EFI_PAGES_TO_SIZE ((UINTN)Entry->NumberOfPages);
if (Size >= MinimalSizeNeeded) {
break;
}
}
- Entry = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + PiSmmCommunicationRegionTable->DescriptorSize);
+
+ Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize);
}
+
ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries);
- CommBuffer = (UINT8 *) (UINTN) Entry->PhysicalStart;
+ CommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart;
//
// Set recording state if needed.
//
RecordingState = MEMORY_PROFILE_RECORDING_DISABLE;
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *) &CommBuffer[0];
+ CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof (gEdkiiMemoryProfileGuid));
CommHeader->MessageLength = sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE);
- CommRecordingState = (SMRAM_PROFILE_PARAMETER_RECORDING_STATE *) &CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
+ CommRecordingState = (SMRAM_PROFILE_PARAMETER_RECORDING_STATE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
CommRecordingState->Header.Command = SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE;
CommRecordingState->Header.DataLength = sizeof (*CommRecordingState);
CommRecordingState->Header.ReturnStatus = (UINT64)-1;
CommRecordingState->RecordingState = MEMORY_PROFILE_RECORDING_DISABLE;
CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
- Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
+ Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "SmramProfile: SmmCommunication - %r\n", Status));
return Status;
@@ -1201,13 +1251,14 @@ GetSmramProfileData (
Print (L"SmramProfile: GetRecordingState - 0x%0x\n", CommRecordingState->Header.ReturnStatus);
return EFI_SUCCESS;
}
+
RecordingState = CommRecordingState->RecordingState;
if (RecordingState == MEMORY_PROFILE_RECORDING_ENABLE) {
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *) &CommBuffer[0];
+ CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof (gEdkiiMemoryProfileGuid));
CommHeader->MessageLength = sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE);
- CommRecordingState = (SMRAM_PROFILE_PARAMETER_RECORDING_STATE *) &CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
+ CommRecordingState = (SMRAM_PROFILE_PARAMETER_RECORDING_STATE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
CommRecordingState->Header.Command = SMRAM_PROFILE_COMMAND_SET_RECORDING_STATE;
CommRecordingState->Header.DataLength = sizeof (*CommRecordingState);
CommRecordingState->Header.ReturnStatus = (UINT64)-1;
@@ -1220,18 +1271,18 @@ GetSmramProfileData (
//
// Get Size
//
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *) &CommBuffer[0];
+ CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof (gEdkiiMemoryProfileGuid));
CommHeader->MessageLength = sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO);
- CommGetProfileInfo = (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO *) &CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
+ CommGetProfileInfo = (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
CommGetProfileInfo->Header.Command = SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO;
CommGetProfileInfo->Header.DataLength = sizeof (*CommGetProfileInfo);
CommGetProfileInfo->Header.ReturnStatus = (UINT64)-1;
CommGetProfileInfo->ProfileSize = 0;
CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
- Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
+ Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
ASSERT_EFI_ERROR (Status);
if (CommGetProfileInfo->Header.ReturnStatus != 0) {
@@ -1240,7 +1291,7 @@ GetSmramProfileData (
goto Done;
}
- ProfileSize = (UINTN) CommGetProfileInfo->ProfileSize;
+ ProfileSize = (UINTN)CommGetProfileInfo->ProfileSize;
//
// Get Data
@@ -1252,28 +1303,29 @@ GetSmramProfileData (
goto Done;
}
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *) &CommBuffer[0];
- CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof(gEdkiiMemoryProfileGuid));
+ CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
+ CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof (gEdkiiMemoryProfileGuid));
CommHeader->MessageLength = sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET);
- CommGetProfileData = (SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *) &CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
+ CommGetProfileData = (SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
CommGetProfileData->Header.Command = SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET;
CommGetProfileData->Header.DataLength = sizeof (*CommGetProfileData);
CommGetProfileData->Header.ReturnStatus = (UINT64)-1;
CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
- Buffer = (UINT8 *) CommHeader + CommSize;
- Size -= CommSize;
+ Buffer = (UINT8 *)CommHeader + CommSize;
+ Size -= CommSize;
- CommGetProfileData->ProfileBuffer = (PHYSICAL_ADDRESS) (UINTN) Buffer;
- CommGetProfileData->ProfileOffset = 0;
+ CommGetProfileData->ProfileBuffer = (PHYSICAL_ADDRESS)(UINTN)Buffer;
+ CommGetProfileData->ProfileOffset = 0;
while (CommGetProfileData->ProfileOffset < ProfileSize) {
- Offset = (UINTN) CommGetProfileData->ProfileOffset;
+ Offset = (UINTN)CommGetProfileData->ProfileOffset;
if (Size <= (ProfileSize - CommGetProfileData->ProfileOffset)) {
- CommGetProfileData->ProfileSize = (UINT64) Size;
+ CommGetProfileData->ProfileSize = (UINT64)Size;
} else {
- CommGetProfileData->ProfileSize = (UINT64) (ProfileSize - CommGetProfileData->ProfileOffset);
+ CommGetProfileData->ProfileSize = (UINT64)(ProfileSize - CommGetProfileData->ProfileOffset);
}
+
Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
ASSERT_EFI_ERROR (Status);
@@ -1282,18 +1334,18 @@ GetSmramProfileData (
Print (L"GetProfileData - 0x%x\n", CommGetProfileData->Header.ReturnStatus);
goto Done;
}
- CopyMem ((UINT8 *) ProfileBuffer + Offset, (VOID *) (UINTN) CommGetProfileData->ProfileBuffer, (UINTN) CommGetProfileData->ProfileSize);
- }
+ CopyMem ((UINT8 *)ProfileBuffer + Offset, (VOID *)(UINTN)CommGetProfileData->ProfileBuffer, (UINTN)CommGetProfileData->ProfileSize);
+ }
Print (L"SmramProfileSize - 0x%x\n", ProfileSize);
Print (L"======= SmramProfile begin =======\n");
- DumpMemoryProfile ((PHYSICAL_ADDRESS) (UINTN) ProfileBuffer, ProfileSize, TRUE);
+ DumpMemoryProfile ((PHYSICAL_ADDRESS)(UINTN)ProfileBuffer, ProfileSize, TRUE);
//
// Dump summary information
//
- MemoryProfileContextSummaryData = CreateContextSummaryData ((PHYSICAL_ADDRESS) (UINTN) ProfileBuffer, ProfileSize);
+ MemoryProfileContextSummaryData = CreateContextSummaryData ((PHYSICAL_ADDRESS)(UINTN)ProfileBuffer, ProfileSize);
if (MemoryProfileContextSummaryData != NULL) {
DumpContextSummaryData (MemoryProfileContextSummaryData, TRUE);
DestroyContextSummaryData (MemoryProfileContextSummaryData);
@@ -1310,11 +1362,11 @@ Done:
// Restore recording state if needed.
//
if (RecordingState == MEMORY_PROFILE_RECORDING_ENABLE) {
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *) &CommBuffer[0];
+ CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof (gEdkiiMemoryProfileGuid));
CommHeader->MessageLength = sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE);
- CommRecordingState = (SMRAM_PROFILE_PARAMETER_RECORDING_STATE *) &CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
+ CommRecordingState = (SMRAM_PROFILE_PARAMETER_RECORDING_STATE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
CommRecordingState->Header.Command = SMRAM_PROFILE_COMMAND_SET_RECORDING_STATE;
CommRecordingState->Header.DataLength = sizeof (*CommRecordingState);
CommRecordingState->Header.ReturnStatus = (UINT64)-1;
@@ -1341,11 +1393,11 @@ Done:
EFI_STATUS
EFIAPI
UefiMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = GetUefiMemoryProfileData ();
if (EFI_ERROR (Status)) {