diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-02-11 08:19:29 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-02-11 08:19:29 +0000 |
commit | 6ac15f7c8a1cfad9e0ca0dfd8643fd9c79b757cd (patch) | |
tree | e329f4622d68000b0beccebe2d044a5d6ee4587a | |
parent | 6ddd3af70b11da43538e98a54a4b7f6b3480f181 (diff) | |
download | edk2-platforms-6ac15f7c8a1cfad9e0ca0dfd8643fd9c79b757cd.tar.xz |
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
-rw-r--r-- | MdeModulePkg/Universal/PCD/Dxe/Service.c | 87 | ||||
-rw-r--r-- | MdeModulePkg/Universal/PCD/Pei/Service.c | 8 |
2 files changed, 66 insertions, 29 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c index 59038fb452..fc6f6b4414 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c @@ -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,34 +131,56 @@ GetWorker ( }
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
-
Guid = GuidTable + VariableHead->GuidTableIndex;
Name = (UINT16*)(StringTable + VariableHead->StringIndex);
- 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);
+
+ 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);
}
- CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
- FreePool (Data);
+ RetPtr = (VOID *) VaraiableDefaultBuffer;
+ } 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;
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,13 +831,20 @@ 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) {
- 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;
- }
+ }
break;
case PCD_TYPE_DATA:
diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c b/MdeModulePkg/Universal/PCD/Pei/Service.c index ab3059c735..66e72f75e7 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Service.c +++ b/MdeModulePkg/Universal/PCD/Pei/Service.c @@ -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,7 +641,11 @@ GetWorker ( //
// 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);
+ }
}
}
|