[edk2-devel] [PATCH 09/16] UefiCpuPkg/MtrrUnitTest: Update UnitTestMtrrGetFixedMtrr().
Yuanhao Xie
yuanhao.xie at intel.com
Wed Sep 13 04:26:32 UTC 2023
UnitTestMtrrGetFixedMtrr updated for the case that fixed MtrrLib
is not always supported.
Signed-off-by: Yuanhao Xie <yuanhao.xie at intel.com>
Cc: Eric Dong <eric.dong at intel.com>
Cc: Rahul Kumar <rahul1.kumar at intel.com>
Cc: Gerd Hoffmann <kraxel at redhat.com>
Cc: Ray Ni <ray.ni at intel.com>
---
UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
index de9db4fcb4..2905b091a5 100644
--- a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
+++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
@@ -650,6 +650,19 @@ UnitTestMtrrGetFixedMtrr (
UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&FixedSettings);
UT_ASSERT_MEM_EQUAL (&ExpectedFixedSettings, &FixedSettings, sizeof (ExpectedFixedSettings));
+ //
+ // Negative test case when Fixed MTRRs are not supported
+ //
+ SystemParameter.MtrrSupported = TRUE;
+ SystemParameter.FixedMtrrSupported = FALSE;
+ InitializeMtrrRegs (&SystemParameter);
+
+ ZeroMem (&FixedSettings, sizeof (FixedSettings));
+ ZeroMem (&ExpectedFixedSettings, sizeof (ExpectedFixedSettings));
+ Result = MtrrGetFixedMtrr (&FixedSettings);
+ UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&FixedSettings);
+ UT_ASSERT_MEM_EQUAL (&ExpectedFixedSettings, &FixedSettings, sizeof (ExpectedFixedSettings));
+
return UNIT_TEST_PASSED;
}
--
2.36.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108565): https://edk2.groups.io/g/devel/message/108565
Mute This Topic: https://groups.io/mt/101331027/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list