]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Add in support to traverse taken space
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 23 Jun 2006 14:41:16 +0000 (14:41 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 23 Jun 2006 14:41:16 +0000 (14:41 +0000)
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

13 files changed:
EdkModulePkg/Universal/PCD/Dxe/Pcd.c
EdkModulePkg/Universal/PCD/Dxe/Service.c
EdkModulePkg/Universal/PCD/Pei/Pcd.c
EdkModulePkg/Universal/PCD/Pei/Service.h
MdePkg/Include/Library/PcdLib.h
MdePkg/Include/Ppi/Pcd.h
MdePkg/Include/Protocol/Pcd.h
MdePkg/Library/BasePcdLibNull/PcdLib.c
MdePkg/Library/DxePcdLib/DxePcdLib.c
MdePkg/Library/PeiPcdLib/PeiPcdLib.c
Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java
Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java

index 55040fe159386576feff909d34d5fae48c34cd6d..26bb7d807e02cae2b53a92006bb7f45338441a09 100644 (file)
@@ -553,7 +553,9 @@ DxePcdGetNextToken (
                         );\r
   }\r
 \r
                         );\r
   }\r
 \r
-  if (!DXE_EXMAP_TABLE_EMPTY) {\r
+  if ((ExTokenNumber == PCD_INVALID_TOKEN_NUMBER) &&\r
+      !DXE_EXMAP_TABLE_EMPTY\r
+    ) {\r
     ExTokenNumber = ExGetNextTokeNumber (\r
                         Guid,\r
                         ExTokenNumber,\r
     ExTokenNumber = ExGetNextTokeNumber (\r
                         Guid,\r
                         ExTokenNumber,\r
@@ -569,3 +571,119 @@ DxePcdGetNextToken (
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+EFI_GUID **\r
+GetDistinctTokenSpace (\r
+  IN OUT    UINTN             *ExMapTableSize,\r
+  IN        DYNAMICEX_MAPPING *ExMapTable,\r
+  IN        EFI_GUID          *GuidTable\r
+  )\r
+{\r
+  EFI_GUID  **DistinctTokenSpace;\r
+  UINTN     OldGuidIndex;\r
+  UINTN     TsIdx;\r
+  UINTN     Idx;\r
+\r
+\r
+  DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));\r
+  ASSERT (DistinctTokenSpace != NULL);\r
+\r
+  TsIdx = 0;\r
+  OldGuidIndex = ExMapTable[0].ExGuidIndex;\r
+  DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];\r
+  for (Idx = 1; Idx < PEI_EXMAPPING_TABLE_SIZE; Idx++) {\r
+    if (ExMapTable[Idx].ExGuidIndex != OldGuidIndex) {\r
+      OldGuidIndex = ExMapTable[Idx].ExGuidIndex;\r
+      DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];\r
+    }\r
+  }\r
+\r
+  *ExMapTableSize = TsIdx;\r
+  return DistinctTokenSpace;\r
+    \r
+}\r
+  \r
+\r
+STATIC EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE] = { 0 };\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+DxePcdGetNextTokenSpace (\r
+  IN OUT CONST EFI_GUID               **Guid\r
+  )\r
+{\r
+  UINTN               Idx;\r
+  UINTN               Idx2;\r
+  UINTN               Idx3;\r
+  UINTN               PeiTokenSpaceTableSize;\r
+  UINTN               DxeTokenSpaceTableSize;\r
+  EFI_GUID            **PeiTokenSpaceTable;\r
+  EFI_GUID            **DxeTokenSpaceTable;\r
+  BOOLEAN             Match;\r
+\r
+  ASSERT (Guid != NULL);\r
+  \r
+  if (PEI_EXMAP_TABLE_EMPTY && DXE_EXMAP_TABLE_EMPTY) {\r
+    if (*Guid != NULL) {\r
+      return EFI_NOT_FOUND;\r
+    } else {\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+  \r
+  \r
+  if (TmpTokenSpaceBuffer[0] != NULL) {\r
+    PeiTokenSpaceTableSize = 0;\r
+\r
+    if (!PEI_EXMAP_TABLE_EMPTY) {\r
+      PeiTokenSpaceTableSize = PEI_EXMAPPING_TABLE_SIZE;\r
+      PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,\r
+                            mPcdDatabase->PeiDb.Init.ExMapTable,\r
+                            mPcdDatabase->PeiDb.Init.GuidTable\r
+                            );\r
+      CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);\r
+    }\r
+\r
+    if (!DXE_EXMAP_TABLE_EMPTY) {\r
+      DxeTokenSpaceTableSize = DXE_EXMAPPING_TABLE_SIZE;\r
+      DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,\r
+                            mPcdDatabase->DxeDb.Init.ExMapTable,\r
+                            mPcdDatabase->DxeDb.Init.GuidTable\r
+                            );\r
+\r
+      //\r
+      // Make sure EFI_GUID in DxeTokenSpaceTable does not exist in PeiTokenSpaceTable\r
+      //\r
+      for (Idx2 = 0, Idx3 = PeiTokenSpaceTableSize; Idx2 < DxeTokenSpaceTableSize; Idx2++) {\r
+        Match = FALSE;\r
+        for (Idx = 0; Idx < PeiTokenSpaceTableSize; Idx++) {\r
+          if (CompareGuid (TmpTokenSpaceBuffer[Idx], DxeTokenSpaceTable[Idx2])) {\r
+            Match = TRUE;\r
+            break;\r
+          }\r
+        }\r
+        if (!Match) {\r
+          TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+  if (*Guid == NULL) {\r
+    *Guid = TmpTokenSpaceBuffer[0];\r
+    return EFI_SUCCESS;\r
+  }\r
+  \r
+  for (Idx = 0; Idx < (PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE); Idx++) {\r
+    if(CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {\r
+      Idx++;\r
+      *Guid = TmpTokenSpaceBuffer[Idx];\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+\r
+}\r
+\r
+\r
index 9513143f26a15398a4b06dceaea8aff9d8da37c3..97518510d6c63db29b53c4b5f753a2219c140c66 100644 (file)
@@ -263,7 +263,7 @@ ExGetNextTokeNumber (
     if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {\r
       return ExMapTable[Idx].ExTokenNumber;\r
     }\r
     if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {\r
       return ExMapTable[Idx].ExTokenNumber;\r
     }\r
-    \r
+\r
     for ( ; Idx < SizeOfExMapTable; Idx++) {\r
       if (ExMapTable[Idx].ExTokenNumber == TokenNumber) {\r
         Idx++;\r
     for ( ; Idx < SizeOfExMapTable; Idx++) {\r
       if (ExMapTable[Idx].ExTokenNumber == TokenNumber) {\r
         Idx++;\r
index 34af220f6686ded58515fd20fb4aa9c2b33ea5af..dfcb56981ede8391d36c9d84e1a8055ec0486bca 100644 (file)
@@ -52,7 +52,8 @@ PCD_PPI mPcdPpiInstance = {
 \r
   PeiRegisterCallBackOnSet,\r
   PcdUnRegisterCallBackOnSet,\r
 \r
   PeiRegisterCallBackOnSet,\r
   PcdUnRegisterCallBackOnSet,\r
-  PeiPcdGetNextToken\r
+  PeiPcdGetNextToken,\r
+  PeiPcdGetNextTokenSpace\r
 };\r
 \r
 \r
 };\r
 \r
 \r
@@ -568,7 +569,7 @@ PeiPcdGetNextToken (
 \r
 EFI_STATUS\r
 EFIAPI\r
 \r
 EFI_STATUS\r
 EFIAPI\r
-PeiPcdGetNextTokenSpaceGuid (\r
+PeiPcdGetNextTokenSpace (\r
   IN OUT CONST EFI_GUID               **Guid\r
   )\r
 {\r
   IN OUT CONST EFI_GUID               **Guid\r
   )\r
 {\r
@@ -579,17 +580,15 @@ PeiPcdGetNextTokenSpaceGuid (
   UINTN               i;\r
   BOOLEAN             Found;\r
 \r
   UINTN               i;\r
   BOOLEAN             Found;\r
 \r
-   if (*Guid == NULL) {\r
-    if (PEI_EXMAP_TABLE_EMPTY) {\r
-      return EFI_SUCCESS;\r
+  ASSERT (Guid != NULL);\r
+\r
+  if (PEI_EXMAP_TABLE_EMPTY) {\r
+    if (*Guid != NULL) {\r
+      return EFI_NOT_FOUND;\r
     } else {\r
     } else {\r
-      //\r
-      // return the first Token Space Guid.\r
-      //\r
-      *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];\r
       return EFI_SUCCESS;\r
     }\r
       return EFI_SUCCESS;\r
     }\r
-   }\r
+  }\r
 \r
   //\r
   // Assume PCD Database AutoGen tool is sorting the ExMap based on the following order\r
 \r
   //\r
   // Assume PCD Database AutoGen tool is sorting the ExMap based on the following order\r
@@ -598,6 +597,16 @@ PeiPcdGetNextTokenSpaceGuid (
   //\r
   PeiPcdDb = GetPcdDatabase ();\r
 \r
   //\r
   PeiPcdDb = GetPcdDatabase ();\r
 \r
+  ExMapTable = PeiPcdDb->Init.ExMapTable;\r
+\r
+  if (*Guid == NULL) {\r
+    //\r
+    // return the first Token Space Guid.\r
+    //\r
+    *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
   MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);\r
 \r
   if (MatchGuid == NULL) {\r
   MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);\r
 \r
   if (MatchGuid == NULL) {\r
@@ -606,8 +615,6 @@ PeiPcdGetNextTokenSpaceGuid (
   \r
   GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;\r
 \r
   \r
   GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;\r
 \r
-  ExMapTable = PeiPcdDb->Init.ExMapTable;\r
-\r
   Found = FALSE;\r
   for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {\r
     if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {\r
   Found = FALSE;\r
   for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {\r
     if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {\r
@@ -617,12 +624,15 @@ PeiPcdGetNextTokenSpaceGuid (
   }\r
 \r
   if (Found) {\r
   }\r
 \r
   if (Found) {\r
+    i++;\r
     for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++ ) {\r
       if (ExMapTable[i].ExGuidIndex != GuidTableIdx ) {\r
         *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];\r
         return EFI_SUCCESS;\r
       }\r
     }\r
     for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++ ) {\r
       if (ExMapTable[i].ExGuidIndex != GuidTableIdx ) {\r
         *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];\r
         return EFI_SUCCESS;\r
       }\r
     }\r
+    *Guid = NULL;\r
+    return EFI_SUCCESS;\r
   }\r
 \r
   return EFI_NOT_FOUND;\r
   }\r
 \r
   return EFI_NOT_FOUND;\r
index 563e82ae22e4a890a87c977db6f0aef6f5fb3ad1..d3e7139ff4fe2d066df52378da92d5c705a28997 100644 (file)
@@ -381,6 +381,14 @@ PeiPcdGetNextToken (
   )\r
 ;\r
 \r
   )\r
 ;\r
 \r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeiPcdGetNextTokenSpace (\r
+  IN CONST EFI_GUID           **Guid\r
+  )\r
+;\r
+\r
 extern EFI_GUID gPcdDataBaseHobGuid;\r
 \r
 extern EFI_GUID gPcdPeiCallbackFnTableHobGuid;\r
 extern EFI_GUID gPcdDataBaseHobGuid;\r
 \r
 extern EFI_GUID gPcdPeiCallbackFnTableHobGuid;\r
index 2f797640a047e363060df8a2a4c4ec8452cfce17..5858cfc475bfead410f6cf1caf563bfe017fc143 100644 (file)
@@ -436,10 +436,20 @@ LibPcdSet64 (
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
-  the value specified by Value.     Value is returned.\r
-  If Value is NULL, then ASSERT().\r
+  the value specified by Buffer and SizeOfValue.  Buffer to\r
+  be set is returned. The content of the buffer could be \r
+  overwritten if a Callback on SET is registered with this\r
+  TokenNumber.\r
+  \r
+  If SizeOfValue is greater than the maximum \r
+  size support by TokenNumber, then set SizeOfValue to the \r
+  maximum size supported by TokenNumber and return NULL to \r
+  indicate that the set operation was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
+  @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
@@ -448,9 +458,9 @@ LibPcdSet64 (
 VOID*\r
 EFIAPI\r
 LibPcdSetPtr (\r
 VOID*\r
 EFIAPI\r
 LibPcdSetPtr (\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Value\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Value\r
   );\r
 \r
 \r
   );\r
 \r
 \r
@@ -561,26 +571,30 @@ LibPcdSetEx64 (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Sets a buffer for the token specified by TokenNumber and \r
-  Guid to the value specified by Value. Value is returned.\r
-  If Guid is NULL, then ASSERT().\r
-  If Value is NULL, then ASSERT().\r
+  Sets a buffer for the token specified by TokenNumber to the value specified by \r
+  Buffer and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
+  the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r
+  supported by TokenNumber and return NULL to indicate that the set operation \r
+  was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
-  @param[in]  Value The 8-bit value to set.\r
+  @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
+  @param[in]  Buffer A pointer to the buffer to set.\r
 \r
 \r
-  @retval VOID * Return the value been set.\r
+  @retval VOID * Return the pinter to the buffer been set.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
-  IN CONST GUID        *Guid,\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Value\r
+  IN      CONST GUID        *Guid,\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   );\r
 \r
 \r
   );\r
 \r
 \r
@@ -697,4 +711,30 @@ LibPcdGetNextToken (
   IN UINTN                    TokenNumber\r
   );\r
 \r
   IN UINTN                    TokenNumber\r
   );\r
 \r
+\r
+\r
+/**\r
+  Retrieves the next PCD token space from a token space specified by Guid.\r
+  Guid of NULL is reserved to mark the default local token namespace on the current\r
+  platform. If Guid is NULL, then the GUID of the first non-local token space of the \r
+  current platform is returned. If Guid is the last non-local token space, \r
+  then NULL is returned. \r
+\r
+  If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r
+\r
+\r
+  \r
+  @param[in]  Pointer to a 128-bit unique value that designates from which namespace \r
+              to start the search.\r
+\r
+  @retval CONST GUID *  The next valid token namespace.\r
+\r
+**/\r
+\r
+CONST GUID*           \r
+EFIAPI\r
+LibPcdGetNextTokenSpace (\r
+  IN CONST GUID  *Guid\r
+  );\r
+\r
 #endif\r
 #endif\r
index 360eea3bebf9a9f1e0e10da2b51bc51b0e6d453b..a67e79c01c745af6c9c33bf8b717b5d4da1517ef 100644 (file)
@@ -256,6 +256,12 @@ EFI_STATUS
   IN OUT  UINTN               *TokenNumber\r
   );\r
 \r
   IN OUT  UINTN               *TokenNumber\r
   );\r
 \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PPI_GET_NEXT_TOKENSPACE) (\r
+  IN OUT CONST EFI_GUID         **Guid\r
+  );\r
+\r
 typedef struct {\r
   PCD_PPI_SET_SKU              SetSku;\r
 \r
 typedef struct {\r
   PCD_PPI_SET_SKU              SetSku;\r
 \r
@@ -292,6 +298,7 @@ typedef struct {
   PCD_PPI_CALLBACK_ONSET       CallbackOnSet;\r
   PCD_PPI_CANCEL_CALLBACK      CancelCallback;\r
   PCD_PPI_GET_NEXT_TOKEN       GetNextToken;\r
   PCD_PPI_CALLBACK_ONSET       CallbackOnSet;\r
   PCD_PPI_CANCEL_CALLBACK      CancelCallback;\r
   PCD_PPI_GET_NEXT_TOKEN       GetNextToken;\r
+  PCD_PPI_GET_NEXT_TOKENSPACE  GetNextTokenSpace;\r
 } PCD_PPI;\r
 \r
 \r
 } PCD_PPI;\r
 \r
 \r
index 07517ffbb1d5d72413b903ee2b2c5815818a3382..8869ad2be13497106ff517274131a4dd85eb006f 100644 (file)
@@ -256,6 +256,14 @@ EFI_STATUS
   IN OUT  UINTN               *TokenNumber\r
   );\r
 \r
   IN OUT  UINTN               *TokenNumber\r
   );\r
 \r
+\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE) (\r
+  IN      CONST EFI_GUID      **Guid\r
+  );\r
+\r
+\r
 typedef struct {\r
   PCD_PROTOCOL_SET_SKU              SetSku;\r
 \r
 typedef struct {\r
   PCD_PROTOCOL_SET_SKU              SetSku;\r
 \r
@@ -292,6 +300,7 @@ typedef struct {
   PCD_PROTOCOL_CALLBACK_ONSET       CallbackOnSet;\r
   PCD_PROTOCOL_CANCEL_CALLBACK      CancelCallback;\r
   PCD_PROTOCOL_GET_NEXT_TOKEN       GetNextToken;\r
   PCD_PROTOCOL_CALLBACK_ONSET       CallbackOnSet;\r
   PCD_PROTOCOL_CANCEL_CALLBACK      CancelCallback;\r
   PCD_PROTOCOL_GET_NEXT_TOKEN       GetNextToken;\r
+  PCD_PROTOCOL_GET_NEXT_TOKENSPACE  GetNextTokenSpace;\r
 } PCD_PROTOCOL;\r
 \r
 #endif\r
 } PCD_PROTOCOL;\r
 \r
 #endif\r
index 1dcb6fe0ba7b896588e3997a3eb1d14aa50f73e4..832100758fc1516f9917ebd61941517ded1b7908 100644 (file)
@@ -434,10 +434,20 @@ LibPcdSet64 (
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
-  the value specified by Value. Value is returned.\r
-  If Value is NULL, then ASSERT().\r
+  the value specified by Buffer and SizeOfValue.  Buffer to\r
+  be set is returned. The content of the buffer could be \r
+  overwritten if a Callback on SET is registered with this\r
+  TokenNumber.\r
+  \r
+  If SizeOfValue is greater than the maximum \r
+  size support by TokenNumber, then set SizeOfValue to the \r
+  maximum size supported by TokenNumber and return NULL to \r
+  indicate that the set operation was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
+  @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
@@ -446,9 +456,9 @@ LibPcdSet64 (
 VOID *\r
 EFIAPI\r
 LibPcdSetPtr (\r
 VOID *\r
 EFIAPI\r
 LibPcdSetPtr (\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Buffer\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   )\r
 {\r
   ASSERT (Buffer != NULL);\r
   )\r
 {\r
   ASSERT (Buffer != NULL);\r
@@ -593,26 +603,30 @@ LibPcdSetEx64 (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Sets a buffer for the token specified by TokenNumber and \r
-  Guid to the value specified by Value. Value is returned.\r
-  If Guid is NULL, then ASSERT().\r
-  If Value is NULL, then ASSERT().\r
+  Sets a buffer for the token specified by TokenNumber to the value specified by \r
+  Buffer and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
+  the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r
+  supported by TokenNumber and return NULL to indicate that the set operation \r
+  was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
-  @param[in]  Value The 8-bit value to set.\r
+  @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
+  @param[in]  Buffer A pointer to the buffer to set.\r
 \r
 \r
-  @retval VOID * Return the value been set.\r
+  @retval VOID * Return the pinter to the buffer been set.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
-  IN CONST GUID        *Guid,\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Buffer\r
+  IN      CONST GUID        *Guid,\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   )\r
 {\r
   ASSERT (Guid != NULL);\r
   )\r
 {\r
   ASSERT (Guid != NULL);\r
@@ -729,3 +743,31 @@ LibPcdGetNextToken (
 {\r
   return 0;\r
 }\r
 {\r
   return 0;\r
 }\r
+\r
+\r
+\r
+/**\r
+  Retrieves the next PCD token space from a token space specified by Guid.\r
+  Guid of NULL is reserved to mark the default local token namespace on the current\r
+  platform. If Guid is NULL, then the GUID of the first non-local token space of the \r
+  current platform is returned. If Guid is the last non-local token space, \r
+  then NULL is returned. \r
+\r
+  If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r
+\r
+\r
+  \r
+  @param[in]  Pointer to a 128-bit unique value that designates from which namespace \r
+              to start the search.\r
+\r
+  @retval CONST GUID *  The next valid token namespace.\r
+\r
+**/\r
+CONST GUID*           \r
+EFIAPI\r
+LibPcdGetNextTokenSpace (\r
+  IN CONST GUID  *Guid\r
+  )\r
+{\r
+  return NULL;\r
+}\r
index c20fad23023a0474bbf0dfbea03de7d34a1ae7cc..ee517715f552b68744d410e929b16a73f92deb05 100644 (file)
@@ -483,28 +483,47 @@ LibPcdSet64 (
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
-  the value specified by Value. Value is returned.\r
-  If Value is NULL, then ASSERT().\r
+  the value specified by Buffer and SizeOfValue.  Buffer to\r
+  be set is returned. The content of the buffer could be \r
+  overwritten if a Callback on SET is registered with this\r
+  TokenNumber.\r
+  \r
+  If SizeOfValue is greater than the maximum \r
+  size support by TokenNumber, then set SizeOfValue to the \r
+  maximum size supported by TokenNumber and return NULL to \r
+  indicate that the set operation was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
+  @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
 \r
 **/\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
 \r
 **/\r
+\r
 VOID *\r
 EFIAPI\r
 LibPcdSetPtr (\r
 VOID *\r
 EFIAPI\r
 LibPcdSetPtr (\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Buffer\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   )\r
 {\r
   EFI_STATUS Status;\r
   )\r
 {\r
   EFI_STATUS Status;\r
+  UINTN      Size;\r
   \r
   \r
-  ASSERT (Buffer != NULL);\r
+  ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);\r
 \r
 \r
-  Status = mPcd->SetPtr (TokenNumber, SizeOfBuffer, Buffer);\r
+  Size = LibPcdGetSize (TokenNumber);\r
+  \r
+  if (*SizeOfBuffer > Size) {\r
+    *SizeOfBuffer = Size;\r
+    return NULL;\r
+  }\r
+\r
+  Status = mPcd->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);\r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -678,34 +697,45 @@ LibPcdSetEx64 (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Sets a buffer for the token specified by TokenNumber and \r
-  Guid to the value specified by Value. Value is returned.\r
-  If Guid is NULL, then ASSERT().\r
-  If Value is NULL, then ASSERT().\r
+  Sets a buffer for the token specified by TokenNumber to the value specified by \r
+  Buffer and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
+  the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r
+  supported by TokenNumber and return NULL to indicate that the set operation \r
+  was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
-  @param[in]  Value The 8-bit value to set.\r
+  @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
+  @param[in]  Buffer A pointer to the buffer to set.\r
 \r
 \r
-  @retval VOID * Return the value been set.\r
+  @retval VOID * Return the pinter to the buffer been set.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
-  IN CONST GUID        *Guid,\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Buffer\r
+  IN      CONST GUID        *Guid,\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   )\r
 {\r
   )\r
 {\r
-  EFI_STATUS Status;\r
+  EFI_STATUS  Status;\r
+  UINTN       Size;\r
 \r
   ASSERT (Guid != NULL);\r
   ASSERT (Buffer != NULL);\r
 \r
 \r
   ASSERT (Guid != NULL);\r
   ASSERT (Buffer != NULL);\r
 \r
-  Status = mPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);\r
+  Size = LibPcdGetExSize (Guid, TokenNumber);\r
+  if (*SizeOfBuffer > Size) {\r
+    *SizeOfBuffer = Size;\r
+    return NULL;\r
+  }\r
+\r
+  Status = mPcd->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);\r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -849,3 +879,37 @@ LibPcdGetNextToken (
   return TokenNumber;\r
 }\r
 \r
   return TokenNumber;\r
 }\r
 \r
+\r
+\r
+/**\r
+  Retrieves the next PCD token space from a token space specified by Guid.\r
+  Guid of NULL is reserved to mark the default local token namespace on the current\r
+  platform. If Guid is NULL, then the GUID of the first non-local token space of the \r
+  current platform is returned. If Guid is the last non-local token space, \r
+  then NULL is returned. \r
+\r
+  If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r
+\r
+\r
+  \r
+  @param[in]  Pointer to a 128-bit unique value that designates from which namespace \r
+              to start the search.\r
+\r
+  @retval CONST GUID *  The next valid token namespace.\r
+\r
+**/\r
+CONST GUID*           \r
+EFIAPI\r
+LibPcdGetNextTokenSpace (\r
+  IN CONST GUID  *Guid\r
+  )\r
+{\r
+  EFI_STATUS Status;\r
+\r
+  Status = mPcd->GetNextTokenSpace (&Guid);\r
+\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Guid;\r
+}\r
+\r
index fca14af8684f3bbba5cb59fa2f5fa4f88e074d36..a73d804797836441a2df70cb6906f4956fe846df 100644 (file)
@@ -555,10 +555,20 @@ LibPcdSet64 (
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
-  the value specified by Value. Value is returned.\r
-  If Value is NULL, then ASSERT().\r
+  the value specified by Buffer and SizeOfValue.  Buffer to\r
+  be set is returned. The content of the buffer could be \r
+  overwritten if a Callback on SET is registered with this\r
+  TokenNumber.\r
+  \r
+  If SizeOfValue is greater than the maximum \r
+  size support by TokenNumber, then set SizeOfValue to the \r
+  maximum size supported by TokenNumber and return NULL to \r
+  indicate that the set operation was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
+  @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
   @param[in]  Value A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
@@ -567,18 +577,27 @@ LibPcdSet64 (
 VOID *\r
 EFIAPI\r
 LibPcdSetPtr (\r
 VOID *\r
 EFIAPI\r
 LibPcdSetPtr (\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Buffer\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   )\r
 {\r
   EFI_STATUS Status;\r
   )\r
 {\r
   EFI_STATUS Status;\r
-  PCD_PPI * PcdPpi;\r
+  PCD_PPI    *PcdPpi;\r
+  UINTN      Size;\r
 \r
   PcdPpi = GetPcdPpiPtr ();\r
 \r
   PcdPpi = GetPcdPpiPtr ();\r
+  \r
+  ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);\r
 \r
 \r
+  Size = LibPcdGetSize (TokenNumber);\r
+  \r
+  if (*SizeOfBuffer > Size) {\r
+    *SizeOfBuffer = Size;\r
+    return NULL;\r
+  }\r
 \r
 \r
-  Status = PcdPpi->SetPtr (TokenNumber, SizeOfBuffer, Buffer);\r
+  Status = PcdPpi->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);\r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -764,34 +783,45 @@ LibPcdSetEx64 (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Sets a buffer for the token specified by TokenNumber and \r
-  Guid to the value specified by Value. Value is returned.\r
-  If Guid is NULL, then ASSERT().\r
-  If Value is NULL, then ASSERT().\r
+  Sets a buffer for the token specified by TokenNumber to the value specified by \r
+  Buffer and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
+  the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r
+  supported by TokenNumber and return NULL to indicate that the set operation \r
+  was not actually performed. \r
+  \r
+  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
-  @param[in]  Value The 8-bit value to set.\r
+  @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
+  @param[in]  Buffer A pointer to the buffer to set.\r
 \r
 \r
-  @retval VOID * Return the value been set.\r
+  @retval VOID * Return the pinter to the buffer been set.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 LibPcdSetExPtr (\r
-  IN CONST GUID        *Guid,\r
-  IN UINTN             TokenNumber,\r
-  IN UINTN             SizeOfBuffer,\r
-  IN VOID              *Buffer\r
+  IN      CONST GUID        *Guid,\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
   )\r
 {\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-  PCD_PPI * PcdPpi;\r
+  EFI_STATUS      Status;\r
+  PCD_PPI         *PcdPpi;\r
+  UINTN           Size;\r
 \r
   PcdPpi = GetPcdPpiPtr ();\r
 \r
 \r
   PcdPpi = GetPcdPpiPtr ();\r
 \r
-  Status = PcdPpi->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);\r
+  Size = LibPcdGetExSize (Guid, TokenNumber);\r
+  if (*SizeOfBuffer > Size) {\r
+    *SizeOfBuffer = Size;\r
+    return NULL;\r
+  }\r
+\r
+  Status = PcdPpi->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);\r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -944,3 +974,41 @@ LibPcdGetNextToken (
 \r
   return TokenNumber;\r
 }\r
 \r
   return TokenNumber;\r
 }\r
+\r
+\r
+/**\r
+  Retrieves the next PCD token space from a token space specified by Guid.\r
+  Guid of NULL is reserved to mark the default local token namespace on the current\r
+  platform. If Guid is NULL, then the GUID of the first non-local token space of the \r
+  current platform is returned. If Guid is the last non-local token space, \r
+  then NULL is returned. \r
+\r
+  If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r
+\r
+\r
+  \r
+  @param[in]  Pointer to a 128-bit unique value that designates from which namespace \r
+              to start the search.\r
+\r
+  @retval CONST GUID *  The next valid token namespace.\r
+\r
+**/\r
+CONST GUID*           \r
+EFIAPI\r
+LibPcdGetNextTokenSpace (\r
+  IN CONST GUID  *Guid\r
+  )\r
+{\r
+  EFI_STATUS Status;\r
+  PCD_PPI * PcdPpi;\r
+\r
+  PcdPpi = GetPcdPpiPtr ();\r
+\r
+\r
+  Status = PcdPpi->GetNextTokenSpace (&Guid);\r
+\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Guid;\r
+}\r
+\r
index cf94885847058374f4a0fb5fa4a099795c76f5ae..f6ea239b3830ef5a189c0116e6b90d22b88f8a0b 100644 (file)
@@ -1684,7 +1684,14 @@ class PcdDatabase {
                     */\r
                 s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.vpdOffset);\r
             } else {\r
                     */\r
                 s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.vpdOffset);\r
             } else {\r
-                s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.value);\r
+                if (t.isByteStreamType()) {\r
+                    //\r
+                    // Byte stream type input has their own "{" "}", so we won't help to insert.\r
+                    //\r
+                    s += tab + tab + String.format(" %s ", t.skuData.get(i).value.value);\r
+                } else {\r
+                    s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.value);\r
+                }\r
             }\r
             \r
             if (i != t.skuData.size() - 1) {\r
             }\r
             \r
             if (i != t.skuData.size() - 1) {\r
index 54c89573026f841c1cd3bcd8560f3e132d92fd86..65c15a5eb53b4d902e96f6b577b220bf63dcacce 100644 (file)
@@ -15,10 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/  \r
 package org.tianocore.build.pcd.entity;\r
 \r
 **/  \r
 package org.tianocore.build.pcd.entity;\r
 \r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.List;\r
-import java.util.Map;\r
 import java.util.UUID;\r
 \r
 import org.tianocore.build.pcd.exception.EntityException;\r
 import java.util.UUID;\r
 \r
 import org.tianocore.build.pcd.exception.EntityException;\r
index 7d1e0191dbe3e8c1b3cde278857e2a56829dabdf..46a90cb02497d0ecb639884a4986fae8d519d194 100644 (file)
@@ -707,6 +707,23 @@ public class Token {
 \r
         return false;\r
     }\r
 \r
         return false;\r
     }\r
+    \r
+    public boolean isByteStreamType () {\r
+        String str = getDynamicDefaultValue();\r
+\r
+        if (str == null) {\r
+            return false;\r
+        }\r
+\r
+        if (datumType == Token.DATUM_TYPE.POINTER &&\r
+            str.startsWith("{") && \r
+            str.endsWith("}")) {\r
+            return true;\r
+        }\r
+\r
+        return false;\r
+        \r
+    }\r
 \r
     public String getStringTypeString () {                       \r
         return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);\r
 \r
     public String getStringTypeString () {                       \r
         return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);\r