public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"Kumar, Rahul1" <rahul1.kumar@intel.com>,
	Philippe Mathieu-Daude <philmd@redhat.com>
Subject: Re: [Patch V2 5/7] UefiCpuPkg/MtrrLib/UnitTest: Fix 32-bit GCC build issues
Date: Thu, 4 Nov 2021 04:59:24 +0000	[thread overview]
Message-ID: <BN0PR11MB56962F0B12D3571A2663EAE68C8D9@BN0PR11MB5696.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211103225954.1680-6-michael.d.kinney@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@intel.com> 
Sent: Thursday, November 4, 2021 7:00 AM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>; Philippe Mathieu-Daude <philmd@redhat.com>
Subject: [Patch V2 5/7] UefiCpuPkg/MtrrLib/UnitTest: Fix 32-bit GCC build issues

When using UT_ASSERT_EQUAL() on a pointer value, it must be cast to UINTN.  This follows the samples provided with the UnitTestFrameworkPkg.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
index 30ee1dc32522..e84b9390601d 100644
--- a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
+++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
@@ -599,7 +599,7 @@ UnitTestMtrrGetFixedMtrr (
     }
 
     Result = MtrrGetFixedMtrr (&FixedSettings);
-    UT_ASSERT_EQUAL (Result, &FixedSettings);
+    UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&FixedSettings);
     UT_ASSERT_MEM_EQUAL (&FixedSettings, &ExpectedFixedSettings, sizeof (FixedSettings));
   }
 
@@ -612,7 +612,7 @@ UnitTestMtrrGetFixedMtrr (
   ZeroMem (&FixedSettings, sizeof (FixedSettings));
   ZeroMem (&ExpectedFixedSettings, sizeof (ExpectedFixedSettings));
   Result = MtrrGetFixedMtrr (&FixedSettings);
-  UT_ASSERT_EQUAL (Result, &FixedSettings);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&FixedSettings);
   UT_ASSERT_MEM_EQUAL (&ExpectedFixedSettings, &FixedSettings, sizeof (ExpectedFixedSettings));
 
   return UNIT_TEST_PASSED;
@@ -653,7 +653,7 @@ UnitTestMtrrGetAllMtrrs (
     AsmWriteMsr64 (MSR_IA32_MTRR_PHYSMASK0 + (Index << 1), VariableMtrr[Index].Mask);
   }
   Result = MtrrGetAllMtrrs (&Mtrrs);
-  UT_ASSERT_EQUAL (Result, &Mtrrs);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&Mtrrs);
   UT_ASSERT_MEM_EQUAL (Mtrrs.Variables.Mtrr, VariableMtrr, sizeof (MTRR_VARIABLE_SETTING) * SystemParameter.VariableMtrrCount);
 
   //
@@ -665,7 +665,7 @@ UnitTestMtrrGetAllMtrrs (
   SystemParameter.MtrrSupported = FALSE;
   InitializeMtrrRegs (&SystemParameter);
   Result = MtrrGetAllMtrrs (&Mtrrs);
-  UT_ASSERT_EQUAL (Result, &Mtrrs);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&Mtrrs);
   UT_ASSERT_MEM_EQUAL (&ExpectedMtrrs, &Mtrrs, sizeof (ExpectedMtrrs));
 
   //
@@ -718,7 +718,7 @@ UnitTestMtrrSetAllMtrrs (
     GenerateRandomMtrrPair (SystemParameter.PhysicalAddressBits, GenerateRandomCacheType (), &Mtrrs.Variables.Mtrr[Index], NULL);
   }
   Result = MtrrSetAllMtrrs (&Mtrrs);
-  UT_ASSERT_EQUAL (Result, &Mtrrs);
+  UT_ASSERT_EQUAL ((UINTN)Result, (UINTN)&Mtrrs);
 
   UT_ASSERT_EQUAL (AsmReadMsr64 (MSR_IA32_MTRR_DEF_TYPE), Mtrrs.MtrrDefType);
   for (Index = 0; Index < SystemParameter.VariableMtrrCount; Index++) {
--
2.32.0.windows.1


  reply	other threads:[~2021-11-04  4:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 22:59 [Patch V2 0/7] Fix package build issues Michael D Kinney
2021-11-03 22:59 ` [Patch V2 1/7] DynamicTablesPkg: Add missing BaseStackCheckLib instance Michael D Kinney
2021-11-03 22:59 ` [Patch V2 2/7] NetworkPkg/NetworkPkg.dsc: Add RngLib mapping for ARM and RISCV64 Michael D Kinney
2021-11-04  0:20   ` Abner Chang
     [not found]   ` <16B42FEF94831C39.15345@groups.io>
2021-11-04  0:23     ` [edk2-devel] " Abner Chang
2021-11-03 22:59 ` [Patch V2 3/7] SecurityPkg/SecurityPkg.dsc: Add missing RngLib " Michael D Kinney
2021-11-04  0:21   ` Abner Chang
2021-11-03 22:59 ` [Patch V2 4/7] SignedCapsulePkg/SignedCapsulePkg.dsc: Add RngLib mapping Michael D Kinney
2021-11-04  0:21   ` Abner Chang
2021-11-03 22:59 ` [Patch V2 5/7] UefiCpuPkg/MtrrLib/UnitTest: Fix 32-bit GCC build issues Michael D Kinney
2021-11-04  4:59   ` Ni, Ray [this message]
2021-11-03 22:59 ` [Patch V2 6/7] MdeModulePkg/Variable/RuntimeDxeUnitTest: Fix 32-bit GCC builds Michael D Kinney
2021-11-03 23:46   ` [EXTERNAL] " Bret Barkelew
2021-11-04  0:34   ` [edk2-devel] " Wu, Hao A
2021-11-03 22:59 ` [Patch V2 7/7] BaseTools/Conf: Fix Linux GCC ARM build issues with HII Michael D Kinney
2021-11-04  6:17   ` 回复: [edk2-devel] " gaoliming
2021-11-04 10:49   ` Leif Lindholm
2021-11-04 17:08     ` [edk2-devel] " Michael D Kinney
2021-11-05  3:01       ` Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN0PR11MB56962F0B12D3571A2663EAE68C8D9@BN0PR11MB5696.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox