From 10e4e4f6277decbc58038cd54b38732fc167e369 Mon Sep 17 00:00:00 2001 From: Jiewen Yao Date: Wed, 29 Jun 2016 10:19:57 +0800 Subject: [PATCH] MdeModulePkg/PiSmmCore: Replace BASE_4GB with MAX_ADDRESS check. PI specification Vol 4 - SMM does not have any limitation of BASE_4GB for SMM. So we should replace BASE_4GB check with MAX_ADDRESS check to make sure the SMM memory is accessible by SMM Core. Cc: Jeff Fan Cc: Michael D Kinney Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Reviewed-by: Jeff Fan Reviewed-by: Michael D Kinney Reviewed-by: Laszlo Ersek --- MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 2 +- MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c index acfcc83e4f..acb852b8dd 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c @@ -1556,7 +1556,7 @@ SmmIplEntry ( } if (gSmmCorePrivate->SmramRanges[Index].CpuStart >= BASE_1MB) { - if ((gSmmCorePrivate->SmramRanges[Index].CpuStart + gSmmCorePrivate->SmramRanges[Index].PhysicalSize) <= BASE_4GB) { + if ((gSmmCorePrivate->SmramRanges[Index].CpuStart + gSmmCorePrivate->SmramRanges[Index].PhysicalSize - 1) <= MAX_ADDRESS) { if (gSmmCorePrivate->SmramRanges[Index].PhysicalSize >= MaxSize) { MaxSize = gSmmCorePrivate->SmramRanges[Index].PhysicalSize; mCurrentSmramRange = &gSmmCorePrivate->SmramRanges[Index]; diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c b/MdeModulePkg/Core/PiSmmCore/Pool.c index 761988e416..79847b4bb6 100644 --- a/MdeModulePkg/Core/PiSmmCore/Pool.c +++ b/MdeModulePkg/Core/PiSmmCore/Pool.c @@ -67,7 +67,7 @@ SmmInitializeMemoryServices ( } if (SmramRanges[Index].CpuStart >= BASE_1MB) { - if ((SmramRanges[Index].CpuStart + SmramRanges[Index].PhysicalSize) <= BASE_4GB) { + if ((SmramRanges[Index].CpuStart + SmramRanges[Index].PhysicalSize - 1) <= MAX_ADDRESS) { if (SmramRanges[Index].PhysicalSize >= MaxSize) { MaxSize = SmramRanges[Index].PhysicalSize; CurrentSmramRangesIndex = Index;