]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PCD/Dxe/Service.h
MdeModulePkg: Update PCD driver to support the optimized PcdDataBase
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Service.h
index 292a74cfb5a036dae04d0421c7397a5dfcddcd52..cd0e227705166429f79dd8d1b8a35456d96ad7ad 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private functions used by PCD DXE 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
@@ -20,6 +20,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/PcdDataBaseSignatureGuid.h>\r
 #include <Protocol/Pcd.h>\r
 #include <Protocol/PiPcd.h>\r
+#include <Protocol/PcdInfo.h>\r
+#include <Protocol/PiPcdInfo.h>\r
+#include <Protocol/VarCheck.h>\r
+#include <Protocol/VariableLock.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiLib.h>\r
@@ -35,7 +39,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // Please make sure the PCD Serivce DXE Version is consistent with\r
 // the version of the generated DXE PCD Database by build tool.\r
 //\r
-#define PCD_SERVICE_DXE_VERSION      4\r
+#define PCD_SERVICE_DXE_VERSION      7\r
 \r
 //\r
 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.\r
@@ -44,6 +48,61 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   #error "Please make sure the version of PCD DXE Service and the generated PCD DXE 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
+DxeGetPcdInfoGetInfo (\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
+DxeGetPcdInfoGetInfoEx (\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
+DxeGetPcdInfoGetSku (\r
+  VOID\r
+  );\r
+\r
 //\r
 // Protocol Interface function declaration.\r
 //\r
@@ -757,6 +816,27 @@ typedef struct {
 // Internal Functions\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
+DxeGetPcdInfo (\r
+  IN CONST  EFI_GUID        *Guid,\r
+  IN        UINTN           TokenNumber,\r
+  OUT       EFI_PCD_INFO    *PcdInfo\r
+  );\r
+\r
 /**\r
   Wrapper function for setting non-pointer type value for a PCD entry.\r
 \r
@@ -881,24 +961,6 @@ ExGetWorker (
   IN UINTN                  GetSize\r
   );\r
 \r
-/**\r
-  Find the local token number according to system SKU ID.\r
-\r
-  @param LocalTokenNumber PCD token number\r
-  @param Size             The size of PCD entry.\r
-  @param IsPeiDb          If TRUE, the PCD entry is initialized in PEI phase.\r
-                          If False, the PCD entry is initialized in DXE phase.\r
-\r
-  @return Token number according to system SKU ID.\r
-\r
-**/\r
-UINT32\r
-GetSkuEnabledTokenNumber (\r
-  UINT32 LocalTokenNumber,\r
-  UINTN  Size,\r
-  BOOLEAN IsPeiDb\r
-  );\r
-\r
 /**\r
   Get Variable which contains HII type PCD entry.\r
 \r
@@ -925,6 +987,7 @@ GetHiiVariable (
   \r
   @param VariableGuid    Guid of variable which stored value of a HII-type PCD.\r
   @param VariableName    Unicode name of variable which stored value of a HII-type PCD.\r
+  @param SetAttributes   Attributes bitmask to set for the variable.\r
   @param Data            Value want to be set.\r
   @param DataSize        Size of value\r
   @param Offset          Value offset of HII-type PCD in variable.\r
@@ -936,6 +999,7 @@ EFI_STATUS
 SetHiiVariable (\r
   IN  EFI_GUID     *VariableGuid,\r
   IN  UINT16       *VariableName,\r
+  IN  UINT32       SetAttributes,\r
   IN  CONST VOID   *Data,\r
   IN  UINTN        DataSize,\r
   IN  UINTN        Offset\r
@@ -1080,6 +1144,36 @@ SetPtrTypeSize (
   IN    OUT   UINTN             *CurrentSize\r
   );\r
 \r
+/**\r
+  VariableLockProtocol callback\r
+  to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.\r
+\r
+  @param[in] Event      Event whose notification function is being invoked.\r
+  @param[in] Context    Pointer to the notification function's context.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+VariableLockCallBack (\r
+  IN EFI_EVENT          Event,\r
+  IN VOID               *Context\r
+  );\r
+\r
+/**\r
+  Update PCD database base on current SkuId\r
+\r
+  @param   SkuId     Current SkuId\r
+  @param   IsPeiDb   Whether to update PEI PCD database.\r
+\r
+  @retval EFI_SUCCESS    Update PCD database successfully.\r
+  @retval EFI_NOT_FOUND  Not found PCD database for current SkuId.\r
+**/\r
+EFI_STATUS\r
+UpdatePcdDatabase (\r
+  IN SKU_ID        SkuId,\r
+  IN BOOLEAN       IsPeiDb\r
+  );\r
+\r
 extern  PCD_DATABASE   mPcdDatabase;\r
 \r
 extern  UINT32         mPcdTotalTokenCount; \r