]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PCD/Pei/Service.h
MdeModulePkg: Update PCD driver to support the optimized PcdDataBase
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Pei / Service.h
index 1928dcb928ea44270fd7a91637a3f33a332d7fc3..3a7910a900c8261ccbc2bf428b953e516acf8865 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The internal header file declares the private functions used by PeiPcd driver.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -19,8 +19,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Ppi/ReadOnlyVariable2.h>\r
 #include <Ppi/Pcd.h>\r
 #include <Ppi/PiPcd.h>\r
+#include <Ppi/PcdInfo.h>\r
+#include <Ppi/PiPcdInfo.h>\r
 #include <Guid/PcdDataBaseHobGuid.h>\r
 #include <Guid/PcdDataBaseSignatureGuid.h>\r
+#include <Guid/VariableFormat.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PeimEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
@@ -28,13 +31,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PeiServicesLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-\r
+#include <Library/MemoryAllocationLib.h>\r
 \r
 //\r
 // Please make sure the PCD Serivce PEIM Version is consistent with\r
 // the version of the generated PEIM PCD Database by build tool.\r
 //\r
-#define PCD_SERVICE_PEIM_VERSION      4\r
+#define PCD_SERVICE_PEIM_VERSION      7\r
 \r
 //\r
 // PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.\r
@@ -43,6 +46,61 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   #error "Please make sure the version of PCD PEIM Service and the generated PCD PEI Database match."\r
 #endif\r
 \r
+/**\r
+  Retrieve additional information associated with a PCD token in the default token space.\r
+\r
+  This includes information such as the type of value the TokenNumber is associated with as well as possible\r
+  human readable name that is associated with the token.\r
+\r
+  @param[in]    TokenNumber The PCD token number.\r
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.\r
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
+\r
+  @retval  EFI_SUCCESS      The PCD information was returned successfully.\r
+  @retval  EFI_NOT_FOUND    The PCD service could not find the requested token number.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetPcdInfoGetInfo (\r
+  IN        UINTN           TokenNumber,\r
+  OUT       EFI_PCD_INFO    *PcdInfo\r
+  );\r
+\r
+/**\r
+  Retrieve additional information associated with a PCD token.\r
+\r
+  This includes information such as the type of value the TokenNumber is associated with as well as possible\r
+  human readable name that is associated with the token.\r
+\r
+  @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]    TokenNumber The PCD token number.\r
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.\r
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
+\r
+  @retval  EFI_SUCCESS      The PCD information was returned successfully.\r
+  @retval  EFI_NOT_FOUND    The PCD service could not find the requested token number.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetPcdInfoGetInfoEx (\r
+  IN CONST  EFI_GUID        *Guid,\r
+  IN        UINTN           TokenNumber,\r
+  OUT       EFI_PCD_INFO    *PcdInfo\r
+  );\r
+\r
+/**\r
+  Retrieve the currently set SKU Id.\r
+\r
+  @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
+            default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
+            Id is returned.\r
+**/\r
+UINTN\r
+EFIAPI\r
+PeiGetPcdInfoGetSku (\r
+  VOID\r
+  );\r
+\r
 //\r
 // PPI Interface Implementation Declaration.\r
 //\r
@@ -753,6 +811,26 @@ PeiPcdGetNextTokenSpace (
   IN OUT CONST EFI_GUID           **Guid\r
   );\r
 \r
+/**\r
+  Retrieve additional information associated with a PCD token.\r
+\r
+  This includes information such as the type of value the TokenNumber is associated with as well as possible\r
+  human readable name that is associated with the token.\r
+\r
+  @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]    TokenNumber The PCD token number.\r
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.\r
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. \r
+\r
+  @retval  EFI_SUCCESS      The PCD information was returned successfully\r
+  @retval  EFI_NOT_FOUND    The PCD service could not find the requested token number.\r
+**/\r
+EFI_STATUS\r
+PeiGetPcdInfo (\r
+  IN CONST  EFI_GUID        *Guid,\r
+  IN        UINTN           TokenNumber,\r
+  OUT       EFI_PCD_INFO    *PcdInfo\r
+  );\r
 \r
 /* Internal Function definitions */\r
 /**\r
@@ -942,27 +1020,14 @@ PeiRegisterCallBackWorker (
 \r
   @param  FileHandle  Handle of the file the external PCD database binary located.\r
 \r
+  @return Pointer to PCD database.\r
+\r
 **/\r
-VOID\r
+PEI_PCD_DATABASE *\r
 BuildPcdDatabase (\r
   IN EFI_PEI_FILE_HANDLE    FileHandle\r
   );\r
 \r
-/**\r
-  Get SKU ID tabble from PCD database.\r
-\r
-  @param LocalTokenNumberTableIdx Index of local token number in token number table.\r
-  @param Database                 PCD Database in PEI phase\r
-\r
-  @return Pointer to SKU ID array table\r
-\r
-**/\r
-SKU_ID *\r
-GetSkuIdArray (\r
-  IN    UINTN             LocalTokenNumberTableIdx,\r
-  IN    PEI_PCD_DATABASE  *Database\r
-  );\r
-\r
 /**\r
   Get index of PCD entry in size table.\r
 \r