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);
|
RetPtr = (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
GuidTable = (EFI_GUID *) (&mPcdDatabase->PeiDb.Init.GuidTable[0]);
|
GuidTable = (EFI_GUID *) (&mPcdDatabase->PeiDb.Init.GuidTable[0]);
|
||||||
|
@ -130,34 +131,56 @@ GetWorker (
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
||||||
|
|
||||||
Guid = GuidTable + VariableHead->GuidTableIndex;
|
Guid = GuidTable + VariableHead->GuidTableIndex;
|
||||||
Name = (UINT16*)(StringTable + VariableHead->StringIndex);
|
Name = (UINT16*)(StringTable + VariableHead->StringIndex);
|
||||||
VaraiableDefaultBuffer = (UINT8 *) PcdDb + VariableHead->DefaultValueOffset;
|
|
||||||
|
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
||||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
//
|
||||||
if (Status == EFI_SUCCESS) {
|
// If a HII type PCD's datum type is VOID*, the DefaultValueOffset is the index of
|
||||||
if (GetSize == 0) {
|
// string array in string table.
|
||||||
//
|
//
|
||||||
// It is a pointer type. So get the MaxSize reserved for
|
StringTableIdx = *(UINT16*)((UINT8 *) PcdDb + VariableHead->DefaultValueOffset);
|
||||||
// this PCD entry.
|
VaraiableDefaultBuffer = (VOID *) (StringTable + StringTableIdx);
|
||||||
//
|
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||||
GetPtrTypeSize (TmpTokenNumber, &GetSize);
|
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);
|
||||||
}
|
}
|
||||||
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
|
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
||||||
FreePool (Data);
|
} else {
|
||||||
|
VaraiableDefaultBuffer = (UINT8 *) PcdDb + VariableHead->DefaultValueOffset;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// If the operation is successful, we copy the data
|
||||||
|
// to the default value buffer in the PCD Database.
|
||||||
|
// So that we can free the Data allocated in GetHiiVariable.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// If the operation is not successful,
|
||||||
|
// Return 1) either the default value specified by Platform Integrator
|
||||||
|
// 2) Or the value Set by a PCD set operation.
|
||||||
|
//
|
||||||
|
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// If the operation is successful, we copy the data
|
|
||||||
// to the default value buffer in the PCD Database.
|
|
||||||
// So that we can free the Data allocated in GetHiiVariable.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// If the operation is not successful,
|
|
||||||
// Return 1) either the default value specified by Platform Integrator
|
|
||||||
// 2) Or the value Set by a PCD set operation.
|
|
||||||
//
|
|
||||||
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_TYPE_STRING:
|
case PCD_TYPE_STRING:
|
||||||
|
@ -788,6 +811,7 @@ SetWorker (
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
if (PtrType) {
|
if (PtrType) {
|
||||||
if (!SetPtrTypeSize (TmpTokenNumber, Size)) {
|
if (!SetPtrTypeSize (TmpTokenNumber, Size)) {
|
||||||
|
@ -807,13 +831,20 @@ SetWorker (
|
||||||
Guid = GuidTable + VariableHead->GuidTableIndex;
|
Guid = GuidTable + VariableHead->GuidTableIndex;
|
||||||
Name = (UINT16*) (StringTable + VariableHead->StringIndex);
|
Name = (UINT16*) (StringTable + VariableHead->StringIndex);
|
||||||
VariableOffset = VariableHead->Offset;
|
VariableOffset = VariableHead->Offset;
|
||||||
|
|
||||||
Status = SetHiiVariable (Guid, Name, Data, *Size, VariableOffset);
|
Status = SetHiiVariable (Guid, Name, Data, *Size, VariableOffset);
|
||||||
|
|
||||||
if (EFI_NOT_FOUND == Status) {
|
if (EFI_NOT_FOUND == Status) {
|
||||||
CopyMem (PcdDb + VariableHead->DefaultValueOffset, Data, *Size);
|
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;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_TYPE_DATA:
|
case PCD_TYPE_DATA:
|
||||||
|
|
|
@ -412,6 +412,7 @@ SetWorker (
|
||||||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||||
case PCD_TYPE_VPD:
|
case PCD_TYPE_VPD:
|
||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
|
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -624,6 +625,7 @@ GetWorker (
|
||||||
return (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
return (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
{
|
{
|
||||||
VariableHead = (VARIABLE_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
|
VariableHead = (VARIABLE_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
|
||||||
|
@ -639,7 +641,11 @@ GetWorker (
|
||||||
//
|
//
|
||||||
// Return the default value specified by Platform Integrator
|
// Return the default value specified by Platform Integrator
|
||||||
//
|
//
|
||||||
return (VOID *) ((UINT8 *) PeiPcdDb + VariableHead->DefaultValueOffset);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue