public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN
@ 2017-07-11  3:33 Liming Gao
  2017-07-11 15:08 ` Fan, Jeff
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2017-07-11  3:33 UTC (permalink / raw)
  To: edk2-devel

PcdGetSize() returns UINTN data type. The consumer code should use UINTN data
to get its size.

This issue is found when PcdCpuFeaturesSupport is configured as patchable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 2 +-
 .../Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c       | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 5e11b2b..e305aca 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -149,7 +149,7 @@ CpuInitDataInitialize (
   CpuFeaturesData = GetCpuFeaturesData ();
   CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);
   ASSERT (CpuFeaturesData->InitOrder != NULL);
-  CpuFeaturesData->BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+  CpuFeaturesData->BitMaskSize = (UINT32) PcdGetSize (PcdCpuFeaturesSupport);
 
   //
   // Collect CPU Features information
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
index 338f1a4..dd6a82b 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
@@ -29,7 +29,7 @@ IsCpuFeatureMatch (
   IN UINT8               *SecondFeatureMask
   )
 {
-  UINT32                 BitMaskSize;
+  UINTN                 BitMaskSize;
 
   BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
   if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) == 0) {
@@ -51,7 +51,7 @@ DumpCpuFeatureMask (
 {
   UINTN                  Index;
   UINT8                  *Data8;
-  UINT32                 BitMaskSize;
+  UINTN                  BitMaskSize;
 
   BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
   Data8       = (UINT8 *) FeatureMask;
@@ -258,7 +258,7 @@ RegisterCpuFeatureWorker (
   CPU_FEATURES_DATA          *CpuFeaturesData;
   CPU_FEATURES_ENTRY         *CpuFeatureEntry;
   LIST_ENTRY                 *Entry;
-  UINT32                     BitMaskSize;
+  UINTN                      BitMaskSize;
   BOOLEAN                    FeatureExist;
 
   BitMaskSize     = PcdGetSize (PcdCpuFeaturesSupport);
@@ -267,7 +267,7 @@ RegisterCpuFeatureWorker (
     InitializeListHead (&CpuFeaturesData->FeatureList);
     InitializeSpinLock (&CpuFeaturesData->MsrLock);
     InitializeSpinLock (&CpuFeaturesData->MemoryMappedLock);
-    CpuFeaturesData->BitMaskSize = BitMaskSize;
+    CpuFeaturesData->BitMaskSize = (UINT32) BitMaskSize;
   }
   ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize);
 
-- 
2.8.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN
  2017-07-11  3:33 [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN Liming Gao
@ 2017-07-11 15:08 ` Fan, Jeff
  0 siblings, 0 replies; 2+ messages in thread
From: Fan, Jeff @ 2017-07-11 15:08 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

Reviewed-by: Jeff Fan <jeff.fan@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Tuesday, July 11, 2017 11:34 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN

PcdGetSize() returns UINTN data type. The consumer code should use UINTN data to get its size.

This issue is found when PcdCpuFeaturesSupport is configured as patchable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 2 +-
 .../Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c       | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 5e11b2b..e305aca 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -149,7 +149,7 @@ CpuInitDataInitialize (
   CpuFeaturesData = GetCpuFeaturesData ();
   CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);
   ASSERT (CpuFeaturesData->InitOrder != NULL);
-  CpuFeaturesData->BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+  CpuFeaturesData->BitMaskSize = (UINT32) PcdGetSize 
+ (PcdCpuFeaturesSupport);
 
   //
   // Collect CPU Features information
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
index 338f1a4..dd6a82b 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
@@ -29,7 +29,7 @@ IsCpuFeatureMatch (
   IN UINT8               *SecondFeatureMask
   )
 {
-  UINT32                 BitMaskSize;
+  UINTN                 BitMaskSize;
 
   BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
   if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) == 0) { @@ -51,7 +51,7 @@ DumpCpuFeatureMask (  {
   UINTN                  Index;
   UINT8                  *Data8;
-  UINT32                 BitMaskSize;
+  UINTN                  BitMaskSize;
 
   BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
   Data8       = (UINT8 *) FeatureMask;
@@ -258,7 +258,7 @@ RegisterCpuFeatureWorker (
   CPU_FEATURES_DATA          *CpuFeaturesData;
   CPU_FEATURES_ENTRY         *CpuFeatureEntry;
   LIST_ENTRY                 *Entry;
-  UINT32                     BitMaskSize;
+  UINTN                      BitMaskSize;
   BOOLEAN                    FeatureExist;
 
   BitMaskSize     = PcdGetSize (PcdCpuFeaturesSupport);
@@ -267,7 +267,7 @@ RegisterCpuFeatureWorker (
     InitializeListHead (&CpuFeaturesData->FeatureList);
     InitializeSpinLock (&CpuFeaturesData->MsrLock);
     InitializeSpinLock (&CpuFeaturesData->MemoryMappedLock);
-    CpuFeaturesData->BitMaskSize = BitMaskSize;
+    CpuFeaturesData->BitMaskSize = (UINT32) BitMaskSize;
   }
   ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize);
 
--
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-11 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-11  3:33 [Patch] UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN Liming Gao
2017-07-11 15:08 ` Fan, Jeff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox