From 1cf243b38505709f6d060d038865b5a4eab011cc Mon Sep 17 00:00:00 2001 From: Shankar C Date: Fri, 12 Jul 2024 16:48:08 +0530 Subject: [PATCH] AmdMinBoardPkg/PeiBoardInitPreMemLib: AmdMemoryInfoRange fix EndofAmdMemoryInfoHobPpiGuidCallBack() should only consume information from AmdMemoryInfoRange structure. Hence, the structure should not be modified Cc: Abdul Lateef Attar Cc: Abner Chang Cc: Paul Grimes Signed-off-by: Shankar C --- .../PeiBoardInitPreMemLib/PeiMemoryInit.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Platform/AMD/AmdMinBoardPkg/Library/PeiBoardInitPreMemLib/PeiMemoryInit.c b/Platform/AMD/AmdMinBoardPkg/Library/PeiBoardInitPreMemLib/PeiMemoryInit.c index 03f08214e26..b6e18a2158d 100644 --- a/Platform/AMD/AmdMinBoardPkg/Library/PeiBoardInitPreMemLib/PeiMemoryInit.c +++ b/Platform/AMD/AmdMinBoardPkg/Library/PeiBoardInitPreMemLib/PeiMemoryInit.c @@ -89,7 +89,22 @@ EndofAmdMemoryInfoHobPpiGuidCallBack ( FixedPcdGet32 (PcdAmdSmramAreaSize) )); - AmdMemoryInfoRange->Size -= FixedPcdGet32 (PcdAmdSmramAreaSize); + if (AmdMemoryInfoRange->Size) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + SYSTEM_MEMORY_ATTRIBUTES, + AmdMemoryInfoRange->Base, + AmdMemoryInfoRange->Size - FixedPcdGet32 (PcdAmdSmramAreaSize) + ); + + DEBUG (( + DEBUG_INFO, + "SYSTEM_MEMORY: Base = 0x%lX, Size = 0x%lX\n", + AmdMemoryInfoRange->Base, + AmdMemoryInfoRange->Size - FixedPcdGet32 (PcdAmdSmramAreaSize) + )); + } + break; } if (AmdMemoryInfoRange->Size) {