MdeModulePkg Pcd(DXE): Use correct TokenNumber to call GetPtrTypeSize () when SKU...
authorStar Zeng <star.zeng@intel.com>
Fri, 6 Dec 2013 09:24:47 +0000 (09:24 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 6 Dec 2013 09:24:47 +0000 (09:24 +0000)
In GetLocalTokenNumber () of Service.c(DXE), the TokenNumber is wrong to call GetPtrTypeSize ().
GetPtrTypeSize need the original TokenNumber.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob C Feng <bob.c.feng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14936 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/PCD/Dxe/Service.c

index b082f0a..3a41bf5 100644 (file)
@@ -50,6 +50,7 @@ GetLocalTokenNumber (
   IN UINTN              TokenNumber\r
   )\r
 {\r
+  UINTN                 TmpTokenNumber;\r
   UINT32                *LocalTokenNumberTable;\r
   UINT32                LocalTokenNumber;\r
   UINTN                 Size;\r
@@ -62,6 +63,11 @@ GetLocalTokenNumber (
   //\r
   TokenNumber--;\r
 \r
+  //\r
+  // Backup the TokenNumber passed in as GetPtrTypeSize need the original TokenNumber\r
+  // \r
+  TmpTokenNumber = TokenNumber;\r
+\r
   LocalTokenNumberTable  = IsPeiDb ? (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset) : \r
                                      (UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset);\r
   TokenNumber            = IsPeiDb ? TokenNumber : TokenNumber - mPeiLocalTokenCount;\r
@@ -72,7 +78,7 @@ GetLocalTokenNumber (
 \r
   if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {\r
     if (Size == 0) {\r
-      GetPtrTypeSize (TokenNumber, &MaxSize);\r
+      GetPtrTypeSize (TmpTokenNumber, &MaxSize);\r
     } else {\r
       MaxSize = Size;\r
     }\r