From db9b00f1d58516fec77df359e99ee60ed3da0278 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Mon, 18 May 2015 01:30:04 +0000 Subject: MdeModulePkg: Update memory profile for OEM reserved memory type. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17462 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c index 1ae991b702..2c6713f5e9 100644 --- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c +++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c @@ -13,6 +13,7 @@ **/ #include "DxeMain.h" +#include "Imem.h" #define IS_UEFI_MEMORY_PROFILE_ENABLED ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) @@ -737,8 +738,9 @@ UnregisterMemoryProfileImage ( /** 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 @@ CoreNeedRecordProfile ( { 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 @@ CoreNeedRecordProfile ( /** 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 @@ GetProfileMemoryIndex ( 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; } -- cgit v1.2.3