From bb5545b663e1d8ac4fd37003d5ba26fafdad5831 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Mon, 3 Jul 2006 15:40:49 +0000 Subject: Add PcdDxe and PcdPEIM to all-arch for EdkModulePkg-All-Archs.fpd Fix a few bugs in PcdDxe and PcdPEIM git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@722 6f19259b-4bc3-4df7-8a09-765794883524 --- EdkModulePkg/Universal/PCD/Dxe/Service.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'EdkModulePkg/Universal/PCD/Dxe') diff --git a/EdkModulePkg/Universal/PCD/Dxe/Service.c b/EdkModulePkg/Universal/PCD/Dxe/Service.c index 97518510d6..717a4345ea 100644 --- a/EdkModulePkg/Universal/PCD/Dxe/Service.c +++ b/EdkModulePkg/Universal/PCD/Dxe/Service.c @@ -742,19 +742,23 @@ GetExPcdTokenNumber ( EFI_GUID *MatchGuid; UINTN MatchGuidIdx; - ExMap = mPcdDatabase->PeiDb.Init.ExMapTable; - GuidTable = mPcdDatabase->PeiDb.Init.GuidTable; - - MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->PeiDb.Init.GuidTable), Guid); - ASSERT (MatchGuid != NULL); + if (!PEI_DATABASE_EMPTY) { + ExMap = mPcdDatabase->PeiDb.Init.ExMapTable; + GuidTable = mPcdDatabase->PeiDb.Init.GuidTable; + + MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->PeiDb.Init.GuidTable), Guid); + + if (MatchGuid != NULL) { - MatchGuidIdx = MatchGuid - GuidTable; - - for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) { - if ((ExTokenNumber == ExMap[i].ExTokenNumber) && - (MatchGuidIdx == ExMap[i].ExGuidIndex)) { - return ExMap[i].LocalTokenNumber; + MatchGuidIdx = MatchGuid - GuidTable; + + for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) { + if ((ExTokenNumber == ExMap[i].ExTokenNumber) && + (MatchGuidIdx == ExMap[i].ExGuidIndex)) { + return ExMap[i].LocalTokenNumber; + } + } } } @@ -762,6 +766,10 @@ GetExPcdTokenNumber ( GuidTable = mPcdDatabase->DxeDb.Init.GuidTable; MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->DxeDb.Init.GuidTable), Guid); + // + // We need to ASSERT here. If GUID can't be found in GuidTable, this is a + // error in the BUILD system. + // ASSERT (MatchGuid != NULL); MatchGuidIdx = MatchGuid - GuidTable; @@ -769,7 +777,7 @@ GetExPcdTokenNumber ( for (i = 0; i < DXE_EXMAPPING_TABLE_SIZE; i++) { if ((ExTokenNumber == ExMap[i].ExTokenNumber) && (MatchGuidIdx == ExMap[i].ExGuidIndex)) { - return ExMap[i].LocalTokenNumber + PEI_LOCAL_TOKEN_NUMBER; + return ExMap[i].LocalTokenNumber; } } -- cgit v1.2.3