1) remove some dead code from WinNtBusDriver.c
2) change PCD_INVALID_TOKEN_NUMBER to 0 as stipulated in MWG spec and PCD spec. 3) support returning a Default Value when a read failure by variable service for PCD entry with Variable Enabled. 4) Remove a lot of unreferenced JAVA import from CollectPCDAction.java, PCDAutoGenAction.java, MemoryDatabaseManager.java, Token.java and UsageInstance.java. 5) Opimized to merge elements in all tables in PCD database for make the code compact. 6) Did a tighter check on how dynamic PCD entry is referenced in each module. 7) Update the PCD driver/PEIM and PCD database generation verion to 2. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@605 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -46,12 +46,27 @@ PeiRegisterCallBackWorker (
|
||||
|
||||
if (Guid == NULL) {
|
||||
TokenNumber = ExTokenNumber;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
ASSERT (TokenNumber < PEI_NEX_TOKEN_NUMBER);
|
||||
} else {
|
||||
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
LocalTokenNumber = GetPcdDatabase()->Init.LocalTokenNumberTable[TokenNumber];
|
||||
|
||||
ASSERT ((LocalTokenNumber & PCD_TYPE_HII) == 0);
|
||||
@@ -248,6 +263,13 @@ InvokeCallbackOnSet (
|
||||
PCD_PPI_CALLBACK *CallbackTable;
|
||||
UINTN Idx;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
|
||||
if (Guid == NULL)
|
||||
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
|
||||
|
||||
@@ -287,6 +309,13 @@ SetWorker (
|
||||
UINTN Offset;
|
||||
VOID *InternalData;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
|
||||
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
|
||||
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
@@ -305,7 +334,7 @@ SetWorker (
|
||||
// type PCD entry in ExSetWorker.
|
||||
//
|
||||
if (TokenNumber < PEI_NEX_TOKEN_NUMBER) {
|
||||
InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);
|
||||
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, Size);
|
||||
}
|
||||
|
||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
|
||||
@@ -425,9 +454,16 @@ GetWorker (
|
||||
UINT32 LocalTokenNumber;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
|
||||
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
|
||||
|
||||
Size = PeiPcdGetSize(TokenNumber);
|
||||
Size = PeiPcdGetSize(TokenNumber + 1);
|
||||
|
||||
ASSERT (GetSize == Size || GetSize == 0);
|
||||
|
||||
@@ -464,16 +500,14 @@ GetWorker (
|
||||
return (VOID *) ((UINT8 *) Data + VariableHead->Offset);
|
||||
} else {
|
||||
//
|
||||
// BugBug: Need to support default value. The current implementation
|
||||
// will return a memory buffer with ALL ZERO.
|
||||
//
|
||||
return AllocateZeroPool (Size);
|
||||
// Return the default value specified by Platform Integrator
|
||||
//
|
||||
return (VOID *) ((UINT8 *) PeiPcdDb + VariableHead->DefaultValueOffset);
|
||||
}
|
||||
}
|
||||
|
||||
case PCD_TYPE_DATA:
|
||||
return (VOID *) ((UINT8 *)PeiPcdDb + Offset);
|
||||
break;
|
||||
|
||||
case PCD_TYPE_STRING:
|
||||
StringTableIdx = (UINT16) *((UINT8 *) PeiPcdDb + Offset);
|
||||
|
Reference in New Issue
Block a user