diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-06-23 14:41:16 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-06-23 14:41:16 +0000 |
commit | 4276d5dacfd4812abc1d7a1bd1da995d7002ee9e (patch) | |
tree | e761b29520a4c86b05082fe2c13ca356f0bedd7a /EdkModulePkg | |
parent | e88ea4239b6530720cf2d99ba1798ba9950b5f51 (diff) | |
download | edk2-4276d5dacfd4812abc1d7a1bd1da995d7002ee9e.tar.gz edk2-4276d5dacfd4812abc1d7a1bd1da995d7002ee9e.tar.bz2 edk2-4276d5dacfd4812abc1d7a1bd1da995d7002ee9e.zip |
1) Add in support to traverse taken space
2) Remove unused import in DynamicTokenValue.java.
3) Support Byte Stream input for Pointer type Dynamic PCD entry in FPD file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@616 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg')
-rw-r--r-- | EdkModulePkg/Universal/PCD/Dxe/Pcd.c | 120 | ||||
-rw-r--r-- | EdkModulePkg/Universal/PCD/Dxe/Service.c | 2 | ||||
-rw-r--r-- | EdkModulePkg/Universal/PCD/Pei/Pcd.c | 34 | ||||
-rw-r--r-- | EdkModulePkg/Universal/PCD/Pei/Service.h | 8 |
4 files changed, 150 insertions, 14 deletions
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Pcd.c b/EdkModulePkg/Universal/PCD/Dxe/Pcd.c index 55040fe159..26bb7d807e 100644 --- a/EdkModulePkg/Universal/PCD/Dxe/Pcd.c +++ b/EdkModulePkg/Universal/PCD/Dxe/Pcd.c @@ -553,7 +553,9 @@ DxePcdGetNextToken ( );
}
- if (!DXE_EXMAP_TABLE_EMPTY) {
+ if ((ExTokenNumber == PCD_INVALID_TOKEN_NUMBER) &&
+ !DXE_EXMAP_TABLE_EMPTY
+ ) {
ExTokenNumber = ExGetNextTokeNumber (
Guid,
ExTokenNumber,
@@ -569,3 +571,119 @@ DxePcdGetNextToken ( return EFI_SUCCESS;
}
+
+EFI_GUID **
+GetDistinctTokenSpace (
+ IN OUT UINTN *ExMapTableSize,
+ IN DYNAMICEX_MAPPING *ExMapTable,
+ IN EFI_GUID *GuidTable
+ )
+{
+ EFI_GUID **DistinctTokenSpace;
+ UINTN OldGuidIndex;
+ UINTN TsIdx;
+ UINTN Idx;
+
+
+ DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));
+ ASSERT (DistinctTokenSpace != NULL);
+
+ TsIdx = 0;
+ OldGuidIndex = ExMapTable[0].ExGuidIndex;
+ DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];
+ for (Idx = 1; Idx < PEI_EXMAPPING_TABLE_SIZE; Idx++) {
+ if (ExMapTable[Idx].ExGuidIndex != OldGuidIndex) {
+ OldGuidIndex = ExMapTable[Idx].ExGuidIndex;
+ DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];
+ }
+ }
+
+ *ExMapTableSize = TsIdx;
+ return DistinctTokenSpace;
+
+}
+
+
+STATIC EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE] = { 0 };
+
+EFI_STATUS
+EFIAPI
+DxePcdGetNextTokenSpace (
+ IN OUT CONST EFI_GUID **Guid
+ )
+{
+ UINTN Idx;
+ UINTN Idx2;
+ UINTN Idx3;
+ UINTN PeiTokenSpaceTableSize;
+ UINTN DxeTokenSpaceTableSize;
+ EFI_GUID **PeiTokenSpaceTable;
+ EFI_GUID **DxeTokenSpaceTable;
+ BOOLEAN Match;
+
+ ASSERT (Guid != NULL);
+
+ if (PEI_EXMAP_TABLE_EMPTY && DXE_EXMAP_TABLE_EMPTY) {
+ if (*Guid != NULL) {
+ return EFI_NOT_FOUND;
+ } else {
+ return EFI_SUCCESS;
+ }
+ }
+
+
+ if (TmpTokenSpaceBuffer[0] != NULL) {
+ PeiTokenSpaceTableSize = 0;
+
+ if (!PEI_EXMAP_TABLE_EMPTY) {
+ PeiTokenSpaceTableSize = PEI_EXMAPPING_TABLE_SIZE;
+ PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,
+ mPcdDatabase->PeiDb.Init.ExMapTable,
+ mPcdDatabase->PeiDb.Init.GuidTable
+ );
+ CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);
+ }
+
+ if (!DXE_EXMAP_TABLE_EMPTY) {
+ DxeTokenSpaceTableSize = DXE_EXMAPPING_TABLE_SIZE;
+ DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,
+ mPcdDatabase->DxeDb.Init.ExMapTable,
+ mPcdDatabase->DxeDb.Init.GuidTable
+ );
+
+ //
+ // Make sure EFI_GUID in DxeTokenSpaceTable does not exist in PeiTokenSpaceTable
+ //
+ for (Idx2 = 0, Idx3 = PeiTokenSpaceTableSize; Idx2 < DxeTokenSpaceTableSize; Idx2++) {
+ Match = FALSE;
+ for (Idx = 0; Idx < PeiTokenSpaceTableSize; Idx++) {
+ if (CompareGuid (TmpTokenSpaceBuffer[Idx], DxeTokenSpaceTable[Idx2])) {
+ Match = TRUE;
+ break;
+ }
+ }
+ if (!Match) {
+ TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];
+ }
+ }
+ }
+ }
+
+ if (*Guid == NULL) {
+ *Guid = TmpTokenSpaceBuffer[0];
+ return EFI_SUCCESS;
+ }
+
+ for (Idx = 0; Idx < (PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE); Idx++) {
+ if(CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {
+ Idx++;
+ *Guid = TmpTokenSpaceBuffer[Idx];
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+
+}
+
+
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Service.c b/EdkModulePkg/Universal/PCD/Dxe/Service.c index 9513143f26..97518510d6 100644 --- a/EdkModulePkg/Universal/PCD/Dxe/Service.c +++ b/EdkModulePkg/Universal/PCD/Dxe/Service.c @@ -263,7 +263,7 @@ ExGetNextTokeNumber ( if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
return ExMapTable[Idx].ExTokenNumber;
}
-
+
for ( ; Idx < SizeOfExMapTable; Idx++) {
if (ExMapTable[Idx].ExTokenNumber == TokenNumber) {
Idx++;
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.c b/EdkModulePkg/Universal/PCD/Pei/Pcd.c index 34af220f66..dfcb56981e 100644 --- a/EdkModulePkg/Universal/PCD/Pei/Pcd.c +++ b/EdkModulePkg/Universal/PCD/Pei/Pcd.c @@ -52,7 +52,8 @@ PCD_PPI mPcdPpiInstance = { PeiRegisterCallBackOnSet,
PcdUnRegisterCallBackOnSet,
- PeiPcdGetNextToken
+ PeiPcdGetNextToken,
+ PeiPcdGetNextTokenSpace
};
@@ -568,7 +569,7 @@ PeiPcdGetNextToken ( EFI_STATUS
EFIAPI
-PeiPcdGetNextTokenSpaceGuid (
+PeiPcdGetNextTokenSpace (
IN OUT CONST EFI_GUID **Guid
)
{
@@ -579,17 +580,15 @@ PeiPcdGetNextTokenSpaceGuid ( UINTN i;
BOOLEAN Found;
- if (*Guid == NULL) {
- if (PEI_EXMAP_TABLE_EMPTY) {
- return EFI_SUCCESS;
+ ASSERT (Guid != NULL);
+
+ if (PEI_EXMAP_TABLE_EMPTY) {
+ if (*Guid != NULL) {
+ return EFI_NOT_FOUND;
} 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
@@ -598,6 +597,16 @@ PeiPcdGetNextTokenSpaceGuid ( //
PeiPcdDb = GetPcdDatabase ();
+ ExMapTable = PeiPcdDb->Init.ExMapTable;
+
+ if (*Guid == NULL) {
+ //
+ // return the first Token Space Guid.
+ //
+ *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
+ return EFI_SUCCESS;
+ }
+
MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);
if (MatchGuid == NULL) {
@@ -606,8 +615,6 @@ PeiPcdGetNextTokenSpaceGuid ( GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
- ExMapTable = PeiPcdDb->Init.ExMapTable;
-
Found = FALSE;
for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {
@@ -617,12 +624,15 @@ PeiPcdGetNextTokenSpaceGuid ( }
if (Found) {
+ i++;
for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++ ) {
if (ExMapTable[i].ExGuidIndex != GuidTableIdx ) {
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];
return EFI_SUCCESS;
}
}
+ *Guid = NULL;
+ return EFI_SUCCESS;
}
return EFI_NOT_FOUND;
diff --git a/EdkModulePkg/Universal/PCD/Pei/Service.h b/EdkModulePkg/Universal/PCD/Pei/Service.h index 563e82ae22..d3e7139ff4 100644 --- a/EdkModulePkg/Universal/PCD/Pei/Service.h +++ b/EdkModulePkg/Universal/PCD/Pei/Service.h @@ -381,6 +381,14 @@ PeiPcdGetNextToken ( )
;
+
+EFI_STATUS
+EFIAPI
+PeiPcdGetNextTokenSpace (
+ IN CONST EFI_GUID **Guid
+ )
+;
+
extern EFI_GUID gPcdDataBaseHobGuid;
extern EFI_GUID gPcdPeiCallbackFnTableHobGuid;
|