UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN
authorLiming Gao <liming.gao@intel.com>
Tue, 11 Jul 2017 03:33:58 +0000 (11:33 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 26 Jul 2017 01:00:30 +0000 (09:00 +0800)
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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c

index 7a76730..54c9827 100644 (file)
@@ -149,7 +149,7 @@ CpuInitDataInitialize (
   CpuFeaturesData = GetCpuFeaturesData ();\r
   CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);\r
   ASSERT (CpuFeaturesData->InitOrder != NULL);\r
-  CpuFeaturesData->BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);\r
+  CpuFeaturesData->BitMaskSize = (UINT32) PcdGetSize (PcdCpuFeaturesSupport);\r
 \r
   //\r
   // Collect CPU Features information\r
index 338f1a4..dd6a82b 100644 (file)
@@ -29,7 +29,7 @@ IsCpuFeatureMatch (
   IN UINT8               *SecondFeatureMask\r
   )\r
 {\r
-  UINT32                 BitMaskSize;\r
+  UINTN                 BitMaskSize;\r
 \r
   BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);\r
   if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) == 0) {\r
@@ -51,7 +51,7 @@ DumpCpuFeatureMask (
 {\r
   UINTN                  Index;\r
   UINT8                  *Data8;\r
-  UINT32                 BitMaskSize;\r
+  UINT                 BitMaskSize;\r
 \r
   BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);\r
   Data8       = (UINT8 *) FeatureMask;\r
@@ -258,7 +258,7 @@ RegisterCpuFeatureWorker (
   CPU_FEATURES_DATA          *CpuFeaturesData;\r
   CPU_FEATURES_ENTRY         *CpuFeatureEntry;\r
   LIST_ENTRY                 *Entry;\r
-  UINT32                     BitMaskSize;\r
+  UINT                     BitMaskSize;\r
   BOOLEAN                    FeatureExist;\r
 \r
   BitMaskSize     = PcdGetSize (PcdCpuFeaturesSupport);\r
@@ -267,7 +267,7 @@ RegisterCpuFeatureWorker (
     InitializeListHead (&CpuFeaturesData->FeatureList);\r
     InitializeSpinLock (&CpuFeaturesData->MsrLock);\r
     InitializeSpinLock (&CpuFeaturesData->MemoryMappedLock);\r
-    CpuFeaturesData->BitMaskSize = BitMaskSize;\r
+    CpuFeaturesData->BitMaskSize = (UINT32) BitMaskSize;\r
   }\r
   ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize);\r
 \r