[edk2-devel] [PATCH 03/16] UefiCpuPkg/MtrrUnitTest: Update UnitTestGetFirmwareVariableMtrrCount.

Yuanhao Xie posted 16 patches 12 months ago
Only 11 patches received!
[edk2-devel] [PATCH 03/16] UefiCpuPkg/MtrrUnitTest: Update UnitTestGetFirmwareVariableMtrrCount.
Posted by Yuanhao Xie 12 months ago
Update UnitTestGetFirmwareVariableMtrrCount for the case the when
Fixed MTRRs are not supported.

The original implementation returns FALSE when either fixed MTRR isn't
supported or the number of variable MTRRs is 0. The correct behavior
should return FALSE only when both fixed MTRR isn't supported and the
number of variable MTRRs is 0.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
index ac18d9d25d..75ae4d65b9 100644
--- a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
+++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
@@ -550,7 +550,7 @@ UnitTestGetFirmwareVariableMtrrCount (
   InitializeMtrrRegs (&SystemParameter);
   PatchPcdSet32 (PcdCpuNumberOfReservedVariableMtrrs, 2);
   Result = GetFirmwareVariableMtrrCount ();
-  UT_ASSERT_EQUAL (Result, 0);
+  UT_ASSERT_EQUAL (Result, SystemParameter.VariableMtrrCount - 2);
 
   //
   // Expect ASSERT() if variable MTRR count is > MTRR_NUMBER_OF_VARIABLE_MTRR
-- 
2.36.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108559): https://edk2.groups.io/g/devel/message/108559
Mute This Topic: https://groups.io/mt/101331020/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-