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>
This commit is contained in:
YuanhaoXie 2023-07-04 11:35:23 +08:00 committed by mergify[bot]
parent 0103d09ebe
commit cc070b88e4
1 changed files with 13 additions and 0 deletions

View File

@ -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;
}