Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test

2020-07-26 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Ni, Ray 
> Sent: Friday, July 24, 2020 2:42 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Shao, Ming
> ; Dong, Eric ; Laszlo Ersek
> ; Sean Brogan ; Bret
> Barkelew ; Yao, Jiewen
> 
> Subject: [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test
> 
> Add host based unit tests for the MtrrLib services.
> The BaseLib services AsmCpuid(), AsmReadMsr64(), and
> AsmWriteMsr64() are hooked and provide simple emulation
> of the CPUID leafs and MSRs required by the MtrrLib to
> run as a host based unit test.
> 
> Test cases are developed for each of the API.
> 
> For the most important APIs MtrrSetMemoryAttributesInMtrrSettings()
> and MtrrSetMemoryAttributeInMtrrSettings(), random inputs are
> generated and fed to the APIs to make sure the implementation is
> good. The test application accepts an optional parameter which
> specifies how many iterations of feeding random inputs to the two
> APIs. The overall number of test cases increases when the iteration
> increases. Default iteration is 10 when no parameter is specified.
> 
> Signed-off-by: Ray Ni 
> Signed-off-by: Michael D Kinney 
> Signed-off-by: Ming Shao 
> Cc: Michael D Kinney 
> Cc: Ming Shao 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Sean Brogan 
> Cc: Bret Barkelew 
> Cc: Jiewen Yao 
> ---
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.c| 1140 +
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.h|  171 +++
>  .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf  |   39 +
>  UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c |  913 +
>  UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc|   31 +
>  5 files changed, 2294 insertions(+)
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTestHost.inf
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
>  create mode 100644 UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> new file mode 100644
> index 00..2eac41fc74
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> @@ -0,0 +1,1140 @@
> +/** @file
> 
> +  Unit tests of the MtrrLib instance of the MtrrLib class
> 
> +
> 
> +  Copyright (c) 2020, Intel Corporation. All rights reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include "MtrrLibUnitTest.h"
> 
> +
> 
> +STATIC CONST MTRR_LIB_SYSTEM_PARAMETER mDefaultSystemParameter
> = {
> 
> +  42, TRUE, TRUE, CacheUncacheable, 12
> 
> +};
> 
> +
> 
> +STATIC MTRR_LIB_SYSTEM_PARAMETER mSystemParameters[] = {
> 
> +  { 38, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 42, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 48, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +};
> 
> +
> 
> +UINT32mFixedMtrrsIndex[] = {
> 
> +  MSR_IA32_MTRR_FIX64K_0,
> 
> +  MSR_IA32_MTRR_FIX16K_8,
> 
> +  MSR_IA32_MTRR_FIX16K_A,
> 
> +  MSR_IA32_MTRR_FIX4K_C,
> 
> +  MSR_IA32_MTRR_FIX4K_C8000,
> 
> +  MSR_IA32_MTRR_FIX4K_D,
> 
> +  MSR_IA32_MTRR_FIX4K_D8000,
> 
> +  MSR_IA32_MTRR_FIX4K_E,
> 
> +  MSR_IA32_MTRR_FIX4K_E8000,
> 
> +  MSR_IA32_MTRR_FIX4K_F,
> 
> +  MSR_IA32_MTRR_FIX4K_F8000
> 
> +};
> 
> +STATIC_ASSERT (
> 
> +  (ARRAY_SIZE (mFixedMtrrsIndex) == MTRR_NUMBER_OF_FIXED_MTRR),
> 
> +  "gFixedMtrrIndex does NOT contain all the fixed MTRRs!"
> 
> +  );
> 
> +
> 
> +//
> 
> +// Context structure to be used for most of the test cases.
> 
> +//
> 
> +typedef struct {
> 
> +  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
> 
> +} MTRR_LIB_TEST_CONTEXT;
> 
> +
> 
> +//
> 
> +// Context structure to be used for GetFirmwareVariableMtrrCount() test.
> 
> +//
> 
> +typedef struct {
> 
> +  UINT32  NumberOfReservedVariableMtrrs;
> 
> +  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
> 
> +} MTRR_LIB_GET_FIRMWARE_VARIABLE_MTRR_COUNT_CONTEXT;
> 
> +
> 
> +STATIC CHAR8 *mCacheDescription[] = { "UC", "WC", "N/A", "N/A", "WT",
> "WP", "WB" };
> 
> +
> 
> +/**
> 
> +  Compare the actual memory ranges against expected memory ranges and
> 

Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test

2020-07-24 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Ni, Ray 
> Sent: Thursday, July 23, 2020 11:42 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ;
> Shao, Ming ; Dong, Eric
> ; Laszlo Ersek
> ; Sean Brogan
> ; Bret Barkelew
> ; Yao, Jiewen
> 
> Subject: [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add
> host based unit test
> 
> Add host based unit tests for the MtrrLib services.
> The BaseLib services AsmCpuid(), AsmReadMsr64(), and
> AsmWriteMsr64() are hooked and provide simple emulation
> of the CPUID leafs and MSRs required by the MtrrLib to
> run as a host based unit test.
> 
> Test cases are developed for each of the API.
> 
> For the most important APIs
> MtrrSetMemoryAttributesInMtrrSettings()
> and MtrrSetMemoryAttributeInMtrrSettings(), random
> inputs are
> generated and fed to the APIs to make sure the
> implementation is
> good. The test application accepts an optional
> parameter which
> specifies how many iterations of feeding random inputs
> to the two
> APIs. The overall number of test cases increases when
> the iteration
> increases. Default iteration is 10 when no parameter is
> specified.
> 
> Signed-off-by: Ray Ni 
> Signed-off-by: Michael D Kinney
> 
> Signed-off-by: Ming Shao ++
> Cc: Michael D Kinney 
> Cc: Ming Shao 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Sean Brogan 
> Cc: Bret Barkelew 
> Cc: Jiewen Yao 
> ---
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.c| 1140
> +
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.h|  171
> +++
>  .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf  |   39 +
>  UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c |  913
> +
>  UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc|   31 +
>  5 files changed, 2294 insertions(+)
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTestHost
> .inf
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
>  create mode 100644
> UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc
> 
> diff --git
> a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> new file mode 100644
> index 00..2eac41fc74
> --- /dev/null
> +++
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> @@ -0,0 +1,1140 @@
> +/** @file
> 
> +  Unit tests of the MtrrLib instance of the MtrrLib
> class
> 
> +
> 
> +  Copyright (c) 2020, Intel Corporation. All rights
> reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include "MtrrLibUnitTest.h"
> 
> +
> 
> +STATIC CONST MTRR_LIB_SYSTEM_PARAMETER
> mDefaultSystemParameter = {
> 
> +  42, TRUE, TRUE, CacheUncacheable, 12
> 
> +};
> 
> +
> 
> +STATIC MTRR_LIB_SYSTEM_PARAMETER mSystemParameters[] =
> {
> 
> +  { 38, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 42, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 48, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +};
> 
> +
> 
> +UINT32mFixedMtrrsIndex[] = {
> 
> +  MSR_IA32_MTRR_FIX64K_0,
> 
> +  MSR_IA32_MTRR_FIX16K_8,
> 
> +  MSR_IA32_MTRR_FIX16K_A,
> 
> +  MSR_IA32_MTRR_FIX4K_C,
> 
> +  MSR_IA32_MTRR_FIX4K_C8000,
> 
> +  MSR_IA32_MTRR_FIX4K_D,
> 
> +  MSR_IA32_MTRR_FIX4K_D8000,
> 
> +  MSR_IA32_MTRR_FIX4K_E,
> 
> +  MSR_IA32_MTRR_FIX4K_E8000,
> 
> +  MSR_IA32_MTRR_FIX4K_F,
> 
> +  MSR_IA32_MTRR_FIX4K_F8000
> 
> +};
> 
> +STATIC_ASSERT (
> 
> +  (ARRAY_SIZE (mFixedMtrrsIndex) ==
> MTRR_NUMBER_OF_FIXED_MTRR),
> 
> +  "gFixedMtrrIndex does NOT contain all the fixed
> MTRRs!"
> 
> +  );
> 
> +
> 
> +//
> 
> +// Context structure to be used for most of the test
> cases.
> 
> +//
> 
> +typedef struct {
> 
> +  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
> 
> +} MTRR_LIB_TEST_CONTEXT;
> 
> +
> 
> +//
> 
> +// Context structure to be used for
> GetFirmwareVariableMtrrCount() test.
> 
> +//
> 
> +typedef struct {
> 
> +  UINT32
> NumberOfReservedVariableMtrrs;
> 
> +  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
> 
> +} MTRR_LIB_GET_FIRMWARE_VARIABLE_MTRR_COUNT_CONTEXT;
> 
> +
> 
> +STATIC CHAR8 *mCacheDescription[] = { "UC", "WC",
> "N/A", "N/A", "WT", "WP", "WB" };
> 
> +
> 
> +/**
> 
> +  Compare the actual memory 

Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test

2020-07-24 Thread Laszlo Ersek
On 07/24/20 08:41, Ray Ni wrote:
> Add host based unit tests for the MtrrLib services.
> The BaseLib services AsmCpuid(), AsmReadMsr64(), and
> AsmWriteMsr64() are hooked and provide simple emulation
> of the CPUID leafs and MSRs required by the MtrrLib to
> run as a host based unit test.
> 
> Test cases are developed for each of the API.
> 
> For the most important APIs MtrrSetMemoryAttributesInMtrrSettings()
> and MtrrSetMemoryAttributeInMtrrSettings(), random inputs are
> generated and fed to the APIs to make sure the implementation is
> good. The test application accepts an optional parameter which
> specifies how many iterations of feeding random inputs to the two
> APIs. The overall number of test cases increases when the iteration
> increases. Default iteration is 10 when no parameter is specified.
> 
> Signed-off-by: Ray Ni 
> Signed-off-by: Michael D Kinney 
> Signed-off-by: Ming Shao 
> Cc: Michael D Kinney 
> Cc: Ming Shao 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Sean Brogan 
> Cc: Bret Barkelew 
> Cc: Jiewen Yao 
> ---
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.c| 1140 +
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.h|  171 +++
>  .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf  |   39 +
>  UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c |  913 +
>  UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc|   31 +
>  5 files changed, 2294 insertions(+)
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
>  create mode 100644 
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTestHost.inf
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
>  create mode 100644 UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc

Acked-by: Laszlo Ersek 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63249): https://edk2.groups.io/g/devel/message/63249
Mute This Topic: https://groups.io/mt/75761809/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test

2020-07-24 Thread Ni, Ray
Add host based unit tests for the MtrrLib services.
The BaseLib services AsmCpuid(), AsmReadMsr64(), and
AsmWriteMsr64() are hooked and provide simple emulation
of the CPUID leafs and MSRs required by the MtrrLib to
run as a host based unit test.

Test cases are developed for each of the API.

For the most important APIs MtrrSetMemoryAttributesInMtrrSettings()
and MtrrSetMemoryAttributeInMtrrSettings(), random inputs are
generated and fed to the APIs to make sure the implementation is
good. The test application accepts an optional parameter which
specifies how many iterations of feeding random inputs to the two
APIs. The overall number of test cases increases when the iteration
increases. Default iteration is 10 when no parameter is specified.

Signed-off-by: Ray Ni 
Signed-off-by: Michael D Kinney 
Signed-off-by: Ming Shao 
Cc: Michael D Kinney 
Cc: Ming Shao 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Jiewen Yao 
---
 .../MtrrLib/UnitTest/MtrrLibUnitTest.c| 1140 +
 .../MtrrLib/UnitTest/MtrrLibUnitTest.h|  171 +++
 .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf  |   39 +
 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c |  913 +
 UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc|   31 +
 5 files changed, 2294 insertions(+)
 create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
 create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
 create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTestHost.inf
 create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
 create mode 100644 UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc

diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c 
b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
new file mode 100644
index 00..2eac41fc74
--- /dev/null
+++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
@@ -0,0 +1,1140 @@
+/** @file
+  Unit tests of the MtrrLib instance of the MtrrLib class
+
+  Copyright (c) 2020, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MtrrLibUnitTest.h"
+
+STATIC CONST MTRR_LIB_SYSTEM_PARAMETER mDefaultSystemParameter = {
+  42, TRUE, TRUE, CacheUncacheable, 12
+};
+
+STATIC MTRR_LIB_SYSTEM_PARAMETER mSystemParameters[] = {
+  { 38, TRUE, TRUE, CacheUncacheable,12 },
+  { 38, TRUE, TRUE, CacheWriteBack,  12 },
+  { 38, TRUE, TRUE, CacheWriteThrough,   12 },
+  { 38, TRUE, TRUE, CacheWriteProtected, 12 },
+  { 38, TRUE, TRUE, CacheWriteCombining, 12 },
+
+  { 42, TRUE, TRUE, CacheUncacheable,12 },
+  { 42, TRUE, TRUE, CacheWriteBack,  12 },
+  { 42, TRUE, TRUE, CacheWriteThrough,   12 },
+  { 42, TRUE, TRUE, CacheWriteProtected, 12 },
+  { 42, TRUE, TRUE, CacheWriteCombining, 12 },
+
+  { 48, TRUE, TRUE, CacheUncacheable,12 },
+  { 48, TRUE, TRUE, CacheWriteBack,  12 },
+  { 48, TRUE, TRUE, CacheWriteThrough,   12 },
+  { 48, TRUE, TRUE, CacheWriteProtected, 12 },
+  { 48, TRUE, TRUE, CacheWriteCombining, 12 },
+};
+
+UINT32mFixedMtrrsIndex[] = {
+  MSR_IA32_MTRR_FIX64K_0,
+  MSR_IA32_MTRR_FIX16K_8,
+  MSR_IA32_MTRR_FIX16K_A,
+  MSR_IA32_MTRR_FIX4K_C,
+  MSR_IA32_MTRR_FIX4K_C8000,
+  MSR_IA32_MTRR_FIX4K_D,
+  MSR_IA32_MTRR_FIX4K_D8000,
+  MSR_IA32_MTRR_FIX4K_E,
+  MSR_IA32_MTRR_FIX4K_E8000,
+  MSR_IA32_MTRR_FIX4K_F,
+  MSR_IA32_MTRR_FIX4K_F8000
+};
+STATIC_ASSERT (
+  (ARRAY_SIZE (mFixedMtrrsIndex) == MTRR_NUMBER_OF_FIXED_MTRR),
+  "gFixedMtrrIndex does NOT contain all the fixed MTRRs!"
+  );
+
+//
+// Context structure to be used for most of the test cases.
+//
+typedef struct {
+  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
+} MTRR_LIB_TEST_CONTEXT;
+
+//
+// Context structure to be used for GetFirmwareVariableMtrrCount() test.
+//
+typedef struct {
+  UINT32  NumberOfReservedVariableMtrrs;
+  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
+} MTRR_LIB_GET_FIRMWARE_VARIABLE_MTRR_COUNT_CONTEXT;
+
+STATIC CHAR8 *mCacheDescription[] = { "UC", "WC", "N/A", "N/A", "WT", "WP", 
"WB" };
+
+/**
+  Compare the actual memory ranges against expected memory ranges and return 
PASS when they match.
+
+  @param ExpectedMemoryRanges Expected memory ranges.
+  @param ExpectedMemoryRangeCount Count of expected memory ranges.
+  @param ActualRanges Actual memory ranges.
+  @param ActualRangeCount Count of actual memory ranges.
+
+  @retval UNIT_TEST_PASSED  Test passed.
+  @retval othersTest failed.
+**/
+UNIT_TEST_STATUS
+VerifyMemoryRanges (
+  IN MTRR_MEMORY_RANGE  *ExpectedMemoryRanges,
+  IN UINTN  ExpectedMemoryRangeCount,
+  IN MTRR_MEMORY_RANGE  *ActualRanges,
+  IN UINTN  ActualRangeCount
+  )
+{
+  UINTN  Index;
+  UT_ASSERT_EQUAL (ExpectedMemoryRangeCount, ActualRangeCount);
+  for (Index = 0; Index < ExpectedMemoryRangeCount; Index++) {
+UT_ASSERT_EQUAL