MdeModulePkg Pcd(DXE): Use correct TokenNumber to call GetPtrTypeSize () when SKU ID enabled.

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
This commit is contained in:
Star Zeng 2013-12-06 09:24:47 +00:00 committed by lzeng14
parent 97997527ee
commit d5ad0813ac
1 changed files with 7 additions and 1 deletions

View File

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