Update string offset and default offset from UINT16 to STRING_HEAD to match the generated PCD database.

Signed-off-by: lgao4
Reviewed-by: jliu66

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13081 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2012-03-06 08:47:29 +00:00
parent fcb6f89d01
commit 6cfc729256
2 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
/** @file
Help functions used by PCD DXE driver.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -55,7 +55,7 @@ GetWorker (
EFI_STATUS Status;
UINT32 LocalTokenNumber;
UINT32 Offset;
UINT16 StringTableIdx;
STRING_HEAD StringTableIdx;
BOOLEAN IsPeiDb;
//
@ -139,7 +139,7 @@ GetWorker (
// If a HII type PCD's datum type is VOID*, the DefaultValueOffset is the index of
// string array in string table.
//
StringTableIdx = *(UINT16*)((UINT8 *) PcdDb + VariableHead->DefaultValueOffset);
StringTableIdx = *(STRING_HEAD*)((UINT8 *) PcdDb + VariableHead->DefaultValueOffset);
VaraiableDefaultBuffer = (VOID *) (StringTable + StringTableIdx);
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
if (Status == EFI_SUCCESS) {
@ -184,7 +184,7 @@ GetWorker (
break;
case PCD_TYPE_STRING:
StringTableIdx = *(UINT16*)((UINT8 *) PcdDb + Offset);
StringTableIdx = *(STRING_HEAD*)((UINT8 *) PcdDb + Offset);
RetPtr = (VOID *) (StringTable + StringTableIdx);
break;
@ -815,7 +815,7 @@ SetWorker (
case PCD_TYPE_STRING:
if (SetPtrTypeSize (TmpTokenNumber, Size)) {
CopyMem (StringTable + *((UINT16 *)InternalData), Data, *Size);
CopyMem (StringTable + *((STRING_HEAD *)InternalData), Data, *Size);
Status = EFI_SUCCESS;
} else {
Status = EFI_INVALID_PARAMETER;
@ -847,7 +847,7 @@ SetWorker (
if (EFI_NOT_FOUND == Status) {
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
CopyMem (
StringTable + *(UINT16 *)(PcdDb + VariableHead->DefaultValueOffset),
StringTable + *(STRING_HEAD *)(PcdDb + VariableHead->DefaultValueOffset),
Data,
*Size
);

View File

@ -2,7 +2,7 @@
The driver internal functions are implmented here.
They build Pei PCD database, and provide access service to PCD database.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -360,7 +360,7 @@ SetWorker (
{
UINT32 LocalTokenNumber;
PEI_PCD_DATABASE *PeiPcdDb;
UINT16 StringTableIdx;
STRING_HEAD StringTableIdx;
UINTN Offset;
VOID *InternalData;
UINTN MaxSize;
@ -432,7 +432,7 @@ SetWorker (
case PCD_TYPE_STRING:
if (SetPtrTypeSize (TokenNumber, Size, PeiPcdDb)) {
StringTableIdx = *((UINT16 *)InternalData);
StringTableIdx = *((STRING_HEAD *)InternalData);
CopyMem (&PeiPcdDb->Init.StringTable[StringTableIdx], Data, *Size);
return EFI_SUCCESS;
} else {
@ -594,7 +594,7 @@ GetWorker (
UINTN DataSize;
VOID *Data;
UINT8 *StringTable;
UINT16 StringTableIdx;
STRING_HEAD StringTableIdx;
PEI_PCD_DATABASE *PeiPcdDb;
UINT32 LocalTokenNumber;
UINTN MaxSize;
@ -654,7 +654,7 @@ GetWorker (
// Return the default value specified by Platform Integrator
//
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
return (VOID*)&StringTable[*(UINT16*)((UINT8*)PeiPcdDb + VariableHead->DefaultValueOffset)];
return (VOID*)&StringTable[*(STRING_HEAD*)((UINT8*)PeiPcdDb + VariableHead->DefaultValueOffset)];
} else {
return (VOID *) ((UINT8 *) PeiPcdDb + VariableHead->DefaultValueOffset);
}
@ -665,7 +665,7 @@ GetWorker (
return (VOID *) ((UINT8 *)PeiPcdDb + Offset);
case PCD_TYPE_STRING:
StringTableIdx = * (UINT16*) ((UINT8 *) PeiPcdDb + Offset);
StringTableIdx = * (STRING_HEAD*) ((UINT8 *) PeiPcdDb + Offset);
return (VOID *) (&StringTable[StringTableIdx]);
default: