summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/PCD/Pei/Pcd.c
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-23 04:30:23 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-23 04:30:23 +0000
commit58f1099f3dd6d1d7606cc57046e59488d4cbf023 (patch)
tree47bfe658743b7f4d7757893c54f2432d3f272986 /EdkModulePkg/Universal/PCD/Pei/Pcd.c
parent90f7b6a81b96a112f196ff80e7cade4f951264a1 (diff)
downloadedk2-platforms-58f1099f3dd6d1d7606cc57046e59488d4cbf023.tar.xz
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
Diffstat (limited to 'EdkModulePkg/Universal/PCD/Pei/Pcd.c')
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Pcd.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.c b/EdkModulePkg/Universal/PCD/Pei/Pcd.c
index b41d3ed09b..34af220f66 100644
--- a/EdkModulePkg/Universal/PCD/Pei/Pcd.c
+++ b/EdkModulePkg/Universal/PCD/Pei/Pcd.c
@@ -169,6 +169,13 @@ PeiPcdGetSize (
IN UINTN TokenNumber
)
{
+ //
+ // 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);
return GetPcdDatabase()->Init.SizeTable[TokenNumber];
@@ -559,10 +566,10 @@ PeiPcdGetNextToken (
return EFI_SUCCESS;
}
-EFI_GUID *
+EFI_STATUS
EFIAPI
PeiPcdGetNextTokenSpaceGuid (
- IN CONST EFI_GUID *Guid
+ IN OUT CONST EFI_GUID **Guid
)
{
UINTN GuidTableIdx;
@@ -572,9 +579,17 @@ PeiPcdGetNextTokenSpaceGuid (
UINTN i;
BOOLEAN Found;
- if (PEI_EXMAP_TABLE_EMPTY) {
- return NULL;
- }
+ if (*Guid == NULL) {
+ if (PEI_EXMAP_TABLE_EMPTY) {
+ return EFI_SUCCESS;
+ } else {
+ //
+ // return the first Token Space Guid.
+ //
+ *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
+ return EFI_SUCCESS;
+ }
+ }
//
// Assume PCD Database AutoGen tool is sorting the ExMap based on the following order
@@ -583,10 +598,10 @@ PeiPcdGetNextTokenSpaceGuid (
//
PeiPcdDb = GetPcdDatabase ();
- MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), Guid);
+ MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);
if (MatchGuid == NULL) {
- return NULL;
+ return EFI_NOT_FOUND;
}
GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
@@ -604,16 +619,13 @@ PeiPcdGetNextTokenSpaceGuid (
if (Found) {
for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++ ) {
if (ExMapTable[i].ExGuidIndex != GuidTableIdx ) {
- if (i < PEI_EXMAPPING_TABLE_SIZE) {
- return &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];
- } else {
- return NULL;
- }
+ *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];
+ return EFI_SUCCESS;
}
}
}
- return NULL;
+ return EFI_NOT_FOUND;
}