Revision: 17462
http://sourceforge.net/p/edk2/code/17462
Author: lzeng14
Date: 2015-05-18 01:30:04 +0000 (Mon, 18 May 2015)
Log Message:
-----------
MdeModulePkg: Update memory profile for OEM reserved memory type.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
trunk/edk2/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
trunk/edk2/MdeModulePkg/Include/Guid/MemoryProfile.h
trunk/edk2/MdeModulePkg/MdeModulePkg.dec
trunk/edk2/MdeModulePkg/MdeModulePkg.uni
Modified:
trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
===================================================================
--- trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
2015-05-18 01:29:00 UTC (rev 17461)
+++ trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
2015-05-18 01:30:04 UTC (rev 17462)
@@ -56,6 +56,7 @@
L"EfiPalCode",
L"EfiPersistentMemory",
L"EfiOSReserved",
+ L"EfiOemReserved",
};
CHAR16 *mSubsystemString[] = {
@@ -214,6 +215,38 @@
}
/**
+ 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 @@
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 @@
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 @@
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]);
Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c 2015-05-18
01:29:00 UTC (rev 17461)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c 2015-05-18
01:30:04 UTC (rev 17462)
@@ -13,6 +13,7 @@
**/
#include "DxeMain.h"
+#include "Imem.h"
#define IS_UEFI_MEMORY_PROFILE_ENABLED ((PcdGet8
(PcdMemoryProfilePropertyMask) & BIT0) != 0)
@@ -737,8 +738,9 @@
/**
Return if this memory type needs to be recorded into memory profile.
- If BIOS memory type (0 ~ EfiMaxMemoryType), it checks bit (1 << MemoryType).
+ If BIOS memory type (0 ~ EfiMaxMemoryType - 1), it checks bit (1 <<
MemoryType).
If OS memory type (0x80000000 ~ 0xFFFFFFFF), it checks bit63 -
0x8000000000000000.
+ If OEM memory type (0x70000000 ~ 0x7FFFFFFF), it checks bit62 -
0x4000000000000000.
@param MemoryType Memory type.
@@ -753,8 +755,10 @@
{
UINT64 TestBit;
- if ((UINT32) MemoryType >= 0x80000000) {
+ if ((UINT32) MemoryType >= MEMORY_TYPE_OS_RESERVED_MIN) {
TestBit = BIT63;
+ } else if ((UINT32) MemoryType >= MEMORY_TYPE_OEM_RESERVED_MIN) {
+ TestBit = BIT62;
} else {
TestBit = LShiftU64 (1, MemoryType);
}
@@ -768,8 +772,9 @@
/**
Convert EFI memory type to profile memory index. The rule is:
- If BIOS memory type (0 ~ EfiMaxMemoryType), ProfileMemoryIndex = MemoryType.
+ If BIOS memory type (0 ~ EfiMaxMemoryType - 1), ProfileMemoryIndex =
MemoryType.
If OS memory type (0x80000000 ~ 0xFFFFFFFF), ProfileMemoryIndex =
EfiMaxMemoryType.
+ If OEM memory type (0x70000000 ~ 0x7FFFFFFF), ProfileMemoryIndex =
EfiMaxMemoryType + 1.
@param MemoryType Memory type.
@@ -781,8 +786,10 @@
IN EFI_MEMORY_TYPE MemoryType
)
{
- if ((UINT32) MemoryType >= 0x80000000) {
+ if ((UINT32) MemoryType >= MEMORY_TYPE_OS_RESERVED_MIN) {
return EfiMaxMemoryType;
+ } else if ((UINT32) MemoryType >= MEMORY_TYPE_OEM_RESERVED_MIN) {
+ return EfiMaxMemoryType + 1;
} else {
return MemoryType;
}
Modified: trunk/edk2/MdeModulePkg/Include/Guid/MemoryProfile.h
===================================================================
--- trunk/edk2/MdeModulePkg/Include/Guid/MemoryProfile.h 2015-05-18
01:29:00 UTC (rev 17461)
+++ trunk/edk2/MdeModulePkg/Include/Guid/MemoryProfile.h 2015-05-18
01:30:04 UTC (rev 17462)
@@ -1,7 +1,7 @@
/** @file
Memory profile data structure.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD
License
which accompanies this distribution. The full text of the license may be
found at
@@ -16,8 +16,9 @@
#define _MEMORY_PROFILE_H_
//
-// For BIOS MemoryType (0 ~ EfiMaxMemoryType), it is recorded in
UsageByType[MemoryType]. (Each valid entry has one entry)
+// For BIOS MemoryType (0 ~ EfiMaxMemoryType - 1), it is recorded in
UsageByType[MemoryType]. (Each valid entry has one entry)
// For OS MemoryType (0x80000000 ~ 0xFFFFFFFF), it is recorded in
UsageByType[EfiMaxMemoryType]. (All types are combined into one entry)
+// For OEM MemoryType (0x70000000 ~ 0x7FFFFFFF), it is recorded in
UsageByType[EfiMaxMemoryType + 1]. (All types are combined into one entry)
//
typedef struct {
@@ -27,21 +28,21 @@
} MEMORY_PROFILE_COMMON_HEADER;
#define MEMORY_PROFILE_CONTEXT_SIGNATURE SIGNATURE_32 ('M','P','C','T')
-#define MEMORY_PROFILE_CONTEXT_REVISION 0x0001
+#define MEMORY_PROFILE_CONTEXT_REVISION 0x0002
typedef struct {
MEMORY_PROFILE_COMMON_HEADER Header;
UINT64 CurrentTotalUsage;
UINT64 PeakTotalUsage;
- UINT64 CurrentTotalUsageByType[EfiMaxMemoryType + 1];
- UINT64 PeakTotalUsageByType[EfiMaxMemoryType + 1];
+ UINT64 CurrentTotalUsageByType[EfiMaxMemoryType + 2];
+ UINT64 PeakTotalUsageByType[EfiMaxMemoryType + 2];
UINT64 TotalImageSize;
UINT32 ImageCount;
UINT32 SequenceCount;
} MEMORY_PROFILE_CONTEXT;
#define MEMORY_PROFILE_DRIVER_INFO_SIGNATURE SIGNATURE_32 ('M','P','D','I')
-#define MEMORY_PROFILE_DRIVER_INFO_REVISION 0x0001
+#define MEMORY_PROFILE_DRIVER_INFO_REVISION 0x0002
typedef struct {
MEMORY_PROFILE_COMMON_HEADER Header;
@@ -55,8 +56,8 @@
UINT32 AllocRecordCount;
UINT64 CurrentUsage;
UINT64 PeakUsage;
- UINT64 CurrentUsageByType[EfiMaxMemoryType + 1];
- UINT64 PeakUsageByType[EfiMaxMemoryType + 1];
+ UINT64 CurrentUsageByType[EfiMaxMemoryType + 2];
+ UINT64 PeakUsageByType[EfiMaxMemoryType + 2];
} MEMORY_PROFILE_DRIVER_INFO;
typedef enum {
Modified: trunk/edk2/MdeModulePkg/MdeModulePkg.dec
===================================================================
--- trunk/edk2/MdeModulePkg/MdeModulePkg.dec 2015-05-18 01:29:00 UTC (rev
17461)
+++ trunk/edk2/MdeModulePkg/MdeModulePkg.dec 2015-05-18 01:30:04 UTC (rev
17462)
@@ -902,6 +902,7 @@
# EfiMemoryMappedIOPortSpace 0x1000<BR>
# EfiPalCode 0x2000<BR>
# EfiPersistentMemory 0x4000<BR>
+ # OEM Reserved 0x4000000000000000<BR>
# OS Reserved 0x8000000000000000<BR>
#
# e.g. Reserved+ACPINvs+ACPIReclaim+RuntimeCode+RuntimeData are needed,
0x661 should be used.<BR>
Modified: trunk/edk2/MdeModulePkg/MdeModulePkg.uni
===================================================================
--- trunk/edk2/MdeModulePkg/MdeModulePkg.uni 2015-05-18 01:29:00 UTC (rev
17461)
+++ trunk/edk2/MdeModulePkg/MdeModulePkg.uni 2015-05-18 01:30:04 UTC (rev
17462)
@@ -522,6 +522,8 @@
+
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits