mirror of https://github.com/acidanthera/audk.git
Support HII VOID* dynamic/dynamicEx type PCD.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9990 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
6ddd3af70b
commit
6ac15f7c8a
|
@ -122,6 +122,7 @@ GetWorker (
|
|||
RetPtr = (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
||||
break;
|
||||
|
||||
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||
case PCD_TYPE_HII:
|
||||
if (IsPeiDb) {
|
||||
GuidTable = (EFI_GUID *) (&mPcdDatabase->PeiDb.Init.GuidTable[0]);
|
||||
|
@ -130,9 +131,30 @@ GetWorker (
|
|||
}
|
||||
|
||||
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
||||
|
||||
Guid = GuidTable + VariableHead->GuidTableIndex;
|
||||
Name = (UINT16*)(StringTable + VariableHead->StringIndex);
|
||||
|
||||
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
||||
//
|
||||
// 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);
|
||||
VaraiableDefaultBuffer = (VOID *) (StringTable + StringTableIdx);
|
||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
if (GetSize == 0) {
|
||||
//
|
||||
// It is a pointer type. So get the MaxSize reserved for
|
||||
// this PCD entry.
|
||||
//
|
||||
GetPtrTypeSize (TmpTokenNumber, &GetSize);
|
||||
}
|
||||
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
|
||||
FreePool (Data);
|
||||
}
|
||||
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
||||
} else {
|
||||
VaraiableDefaultBuffer = (UINT8 *) PcdDb + VariableHead->DefaultValueOffset;
|
||||
|
||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||
|
@ -158,6 +180,7 @@ GetWorker (
|
|||
// 2) Or the value Set by a PCD set operation.
|
||||
//
|
||||
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCD_TYPE_STRING:
|
||||
|
@ -788,6 +811,7 @@ SetWorker (
|
|||
}
|
||||
break;
|
||||
|
||||
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||
case PCD_TYPE_HII:
|
||||
if (PtrType) {
|
||||
if (!SetPtrTypeSize (TmpTokenNumber, Size)) {
|
||||
|
@ -807,11 +831,18 @@ SetWorker (
|
|||
Guid = GuidTable + VariableHead->GuidTableIndex;
|
||||
Name = (UINT16*) (StringTable + VariableHead->StringIndex);
|
||||
VariableOffset = VariableHead->Offset;
|
||||
|
||||
Status = SetHiiVariable (Guid, Name, Data, *Size, VariableOffset);
|
||||
|
||||
if (EFI_NOT_FOUND == Status) {
|
||||
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
||||
CopyMem (
|
||||
StringTable + *(UINT16 *)(PcdDb + VariableHead->DefaultValueOffset),
|
||||
Data,
|
||||
*Size
|
||||
);
|
||||
} else {
|
||||
CopyMem (PcdDb + VariableHead->DefaultValueOffset, Data, *Size);
|
||||
}
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -412,6 +412,7 @@ SetWorker (
|
|||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||
case PCD_TYPE_VPD:
|
||||
case PCD_TYPE_HII:
|
||||
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -624,6 +625,7 @@ GetWorker (
|
|||
return (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
||||
}
|
||||
|
||||
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||
case PCD_TYPE_HII:
|
||||
{
|
||||
VariableHead = (VARIABLE_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
|
||||
|
@ -639,9 +641,13 @@ 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)];
|
||||
} else {
|
||||
return (VOID *) ((UINT8 *) PeiPcdDb + VariableHead->DefaultValueOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case PCD_TYPE_DATA:
|
||||
return (VOID *) ((UINT8 *)PeiPcdDb + Offset);
|
||||
|
|
Loading…
Reference in New Issue