diff options
author | YuanhaoXie <yuanhao.xie@intel.com> | 2023-07-04 11:35:23 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-10-09 08:22:02 +0000 |
commit | cc070b88e4ffef9d7acf3965058a4ab737f3cbde (patch) | |
tree | f71abdc1850bb414667afe33f149d7f2addbf903 | |
parent | 0103d09ebe6dede5b3cbea09c9e3f64662d8cabf (diff) | |
download | edk2-cc070b88e4ffef9d7acf3965058a4ab737f3cbde.tar.gz edk2-cc070b88e4ffef9d7acf3965058a4ab737f3cbde.tar.bz2 edk2-cc070b88e4ffef9d7acf3965058a4ab737f3cbde.zip |
UefiCpuPkg/MtrrUnitTest: Update UnitTestMtrrGetFixedMtrr().
UnitTestMtrrGetFixedMtrr updated for the case that fixed MtrrLib
is not always supported.
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
-rw-r--r-- | UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c index e16b93f2a6..b42edb0d84 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;
}
|