]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PCD/Dxe/Service.h
MdeModulePkg PCD: Update PCD database structure definition to match BaseTools
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Service.h
index 54e38e5599d6e880a2dc7e631487e491c905beb6..0257a3487cc4c7d904c9b08dc8bdaecb54866193 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private functions used by PCD DXE driver.\r
 \r
-Copyright (c) 2006 - 2010, 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
@@ -17,8 +17,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <PiDxe.h>\r
 #include <Guid/PcdDataBaseHobGuid.h>\r
+#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
@@ -30,6 +35,74 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 \r
+//\r
+// 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      6\r
+\r
+//\r
+// PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.\r
+//\r
+#if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)\r
+  #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
@@ -743,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
@@ -911,6 +1005,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
@@ -922,6 +1017,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
@@ -982,16 +1078,16 @@ BuildPcdDxeDataBase (
   );\r
 \r
 /**\r
-  Get local token number according to dynamic-ex PCD's {token space guid:token number}\r
+  Get Token Number according to dynamic-ex PCD's {token space guid:token number}\r
 \r
   A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r
   in DEC file. PCD database maintain a mapping table that translate pair of {token\r
-  space guid: token number} to local token number.\r
+  space guid: token number} to Token Number.\r
   \r
   @param Guid            Token space guid for dynamic-ex PCD entry.\r
   @param ExTokenNumber   Dynamic-ex PCD token number.\r
 \r
-  @return local token number for dynamic-ex PCD.\r
+  @return Token Number for dynamic-ex PCD.\r
 \r
 **/\r
 UINTN\r
@@ -1066,9 +1162,39 @@ SetPtrTypeSize (
   IN    OUT   UINTN             *CurrentSize\r
   );\r
 \r
-extern PCD_DATABASE * mPcdDatabase;\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
+extern  PCD_DATABASE   mPcdDatabase;\r
+\r
+extern  UINT32         mPcdTotalTokenCount; \r
+extern  UINT32         mPeiLocalTokenCount; \r
+extern  UINT32         mDxeLocalTokenCount; \r
+extern  UINT32         mPeiNexTokenCount;   \r
+extern  UINT32         mDxeNexTokenCount;  \r
+extern  UINT32         mPeiExMapppingTableSize;\r
+extern  UINT32         mDxeExMapppingTableSize;\r
+extern  UINT32         mPeiGuidTableSize;\r
+extern  UINT32         mDxeGuidTableSize;\r
+\r
+extern  BOOLEAN        mPeiExMapTableEmpty; \r
+extern  BOOLEAN        mDxeExMapTableEmpty; \r
+extern  BOOLEAN        mPeiDatabaseEmpty;\r
 \r
-extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;\r
+extern  EFI_GUID     **TmpTokenSpaceBuffer;\r
+extern  UINTN          TmpTokenSpaceBufferCount;\r
 \r
 extern EFI_LOCK mPcdDatabaseLock;\r
 \r