]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/PcdLib.h
MdePkg and MdeModulePkg Pcd: Add the new EFI_GET_PCD_INFO_PROTOCOL and EFI_GET_PCD_IN...
[mirror_edk2.git] / MdePkg / Include / Library / PcdLib.h
index 8deb6f758e07126b61abac1d677bc0f332974e4b..1ea4ac7ceca47850000cdb6d9b29f8d07dc65ccf 100644 (file)
@@ -14,7 +14,7 @@
   There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),\r
   PatchPcdGetXX(), and PatchPcdSetXX().\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -532,6 +532,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define PcdSetBool(TokenName, Value)        _PCD_SET_MODE_BOOL_##TokenName  ((Value))\r
 \r
 \r
+/**\r
+  Retrieves a token number based on a GUID and a token name.\r
+\r
+  Returns the token number for the token specified by Guid and TokenName.\r
+\r
+  @param   Guid        Pointer to a 128-bit unique value that designates \r
+                       which namespace to retrieve a value from.\r
+  @param   TokenName   The name of the PCD token to retrieve a current value for.                 \r
+\r
+  @return  Return the token number.\r
+\r
+**/\r
+#define PcdTokenEx(Guid,TokenName)  _PCD_TOKEN_EX_##TokenName(Guid)\r
+\r
 /**\r
   Retrieves an 8-bit PCD token value based on a GUID and a token name.\r
 \r
@@ -548,8 +562,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return  An 8-bit PCD token value.\r
 \r
 **/\r
-#define PcdGetEx8(Guid, TokenName)          LibPcdGetEx8    ((Guid), _PCD_TOKEN_##TokenName)\r
-\r
+#define PcdGetEx8(Guid, TokenName)          LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))\r
 \r
 /**\r
   Retrieves a 16-bit PCD token value based on a GUID and a token name.\r
@@ -567,7 +580,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return  A 16-bit PCD token value.\r
 \r
 **/\r
-#define PcdGetEx16(Guid, TokenName)         LibPcdGetEx16   ((Guid), _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx16(Guid, TokenName)         LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))\r
 \r
 \r
 /**\r
@@ -586,7 +599,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return  A 32-bit PCD token value.\r
 \r
 **/\r
-#define PcdGetEx32(Guid, TokenName)         LibPcdGetEx32   ((Guid), _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx32(Guid, TokenName)         LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))\r
 \r
 \r
 /**\r
@@ -605,7 +618,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return  A 64-bit PCD token value.\r
 \r
 **/\r
-#define PcdGetEx64(Guid, TokenName)         LibPcdGetEx64   ((Guid), _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx64(Guid, TokenName)         LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))\r
 \r
 \r
 /**\r
@@ -624,7 +637,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return  A pointer to a PCD token buffer.\r
 \r
 **/\r
-#define PcdGetExPtr(Guid, TokenName)        LibPcdGetExPtr  ((Guid), _PCD_TOKEN_##TokenName)\r
+#define PcdGetExPtr(Guid, TokenName)        LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))\r
 \r
 \r
 /**\r
@@ -643,7 +656,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return  A Boolean PCD token value.\r
 \r
 **/\r
-#define PcdGetExBool(Guid, TokenName)       LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)\r
+#define PcdGetExBool(Guid, TokenName)       LibPcdGetExBool  ((Guid), PcdTokenEx(Guid,TokenName))\r
 \r
 \r
 /**\r
@@ -663,7 +676,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return Return the Value that was set.\r
 \r
 **/\r
-#define PcdSetEx8(Guid, TokenName, Value)   LibPcdSetEx8   ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
+#define PcdSetEx8(Guid, TokenName, Value)   LibPcdSetEx8   ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
 \r
 \r
 /**\r
@@ -683,7 +696,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return Return the Value that was set.\r
 \r
 **/\r
-#define PcdSetEx16(Guid, TokenName, Value)  LibPcdSetEx16  ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
+#define PcdSetEx16(Guid, TokenName, Value)  LibPcdSetEx16  ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
 \r
 \r
 /**\r
@@ -703,7 +716,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return Return the Value that was set.\r
 \r
 **/\r
-#define PcdSetEx32(Guid, TokenName, Value)  LibPcdSetEx32  ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
+#define PcdSetEx32(Guid, TokenName, Value)  LibPcdSetEx32  ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
 \r
 \r
 /**\r
@@ -723,7 +736,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return Return the Value that was set.\r
 \r
 **/\r
-#define PcdSetEx64(Guid, TokenName, Value)  LibPcdSetEx64  ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
+#define PcdSetEx64(Guid, TokenName, Value)  LibPcdSetEx64  ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
 \r
 \r
 /**\r
@@ -752,7 +765,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \\r
-                                            LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))\r
+                                            LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))\r
 \r
 \r
 /**\r
@@ -773,7 +786,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/                                         \r
 #define PcdSetExBool(Guid, TokenName, Value) \\r
-                                            LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))\r
+                                            LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
 \r
 \r
 /**\r
@@ -1503,4 +1516,89 @@ LibPatchPcdSetPtr (
   IN CONST  VOID        *Buffer\r
   );\r
 \r
+typedef enum {\r
+  PCD_TYPE_8,\r
+  PCD_TYPE_16,\r
+  PCD_TYPE_32,\r
+  PCD_TYPE_64,\r
+  PCD_TYPE_BOOL,\r
+  PCD_TYPE_PTR\r
+} PCD_TYPE;\r
+\r
+typedef struct {\r
+  ///\r
+  /// The returned information associated with the requested TokenNumber. If\r
+  /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.\r
+  ///\r
+  PCD_TYPE          PcdType;\r
+  ///\r
+  /// The size of the data in bytes associated with the TokenNumber specified. If\r
+  /// TokenNumber is 0, then PcdSize is set 0.\r
+  ///\r
+  UINTN             PcdSize;\r
+  ///\r
+  /// The null-terminated ASCII string associated with a given token. If the\r
+  /// TokenNumber specified was 0, then this field corresponds to the null-terminated\r
+  /// ASCII string associated with the token's namespace Guid. If NULL, there is no\r
+  /// name associated with this request.\r
+  ///\r
+  CHAR8             *PcdName;\r
+} PCD_INFO;\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
+  If TokenNumber is not in the default token space specified, then ASSERT().\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
+VOID\r
+EFIAPI\r
+LibPcdGetInfo (\r
+  IN        UINTN           TokenNumber,\r
+  OUT       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
+  If TokenNumber is not in the token space specified by Guid, then ASSERT().\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
+VOID\r
+EFIAPI\r
+LibPcdGetInfoEx (\r
+  IN CONST  GUID            *Guid,\r
+  IN        UINTN           TokenNumber,\r
+  OUT       PCD_INFO        *PcdInfo\r
+  );\r
+\r
+/**\r
+  Retrieve the currently set SKU Id.\r
+\r
+  If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().\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
+LibPcdGetSku (\r
+  VOID\r
+  );\r
+\r
 #endif\r