]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add PCD protocol/ppi defined in PI 1.2, which is different with early PCD protocol...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 8 Sep 2009 01:56:30 +0000 (01:56 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 8 Sep 2009 01:56:30 +0000 (01:56 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9243 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Ppi/PiPcd.h [new file with mode: 0644]
MdePkg/Include/Protocol/PiPcd.h [new file with mode: 0644]
MdePkg/MdePkg.dec

diff --git a/MdePkg/Include/Ppi/PiPcd.h b/MdePkg/Include/Ppi/PiPcd.h
new file mode 100644 (file)
index 0000000..f4edfff
--- /dev/null
@@ -0,0 +1,414 @@
+/** @file\r
+  Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3\r
+\r
+  A platform database that contains a variety of current platform settings or \r
+  directives that can be accessed by a driver or application.\r
+  PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.\r
+  \r
+  Callers to this protocol must be at a TPL_APPLICATION task priority level.\r
+  This is the base PCD service API that provides an abstraction for accessing configuration content in\r
+  the platform. It a seamless mechanism for extracting information regardless of where the\r
+  information is stored (such as in Read-only data, or an EFI Variable).\r
+  This protocol allows access to data through size-granular APIs and provides a mechanism for a\r
+  firmware component to monitor specific settings and be alerted when a setting is changed.\r
+\r
+  Copyright (c) 2009, Intel Corporation                                                         \r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  @par Revision Reference: \r
+  PI Version 1.2 Vol 3.\r
+**/\r
+\r
+#ifndef __PI_PCD_PPI_H__\r
+#define __PI_PCD_PPI_H__\r
+\r
+extern EFI_GUID gEfiPeiPcdPpiGuid;\r
+\r
+#define EFI_PEI_PCD_PPI_GUID \\r
+  { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }\r
+\r
+#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
+\r
+/**\r
+  SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is\r
+  normally called only once by the system.\r
+  For each item (token), the database can hold a single value that applies to all SKUs, or multiple\r
+  values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific\r
+  values are called SKU enabled.\r
+  The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are\r
+  not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.\r
+  For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no\r
+  SKU Id is set or the currently set SKU Id isn’t valid for the specified token, the system uses the\r
+  default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that\r
+  Id, the results are unpredictable.\r
+  \r
+  @param[in]    SkuId   The SKU value to set.\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_SKU)(\r
+  IN UINTN SkuId\r
+);\r
+\r
+/**\r
+  Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,\r
+  the results are unpredictable.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number.\r
+  \r
+  @return 8-bit value for a given PCD token.\r
+**/\r
+typedef\r
+UINT8\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_8)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,\r
+  the results are unpredictable.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number.\r
+  \r
+  @return 16-bit value for a given PCD token.\r
+**/\r
+typedef\r
+UINT16\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_16)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current 32-bit value for a PCD token number. If the TokenNumber is invalid, the\r
+  results are unpredictable.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number.\r
+  \r
+  @return 32-bit value for a given PCD token.  \r
+**/\r
+typedef\r
+UINT32\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_32)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current pointer to the value for a PCD token number. There should not be any\r
+  alignment assumptions about the pointer that is returned by this function call. If the TokenNumber\r
+  is invalid, the results are unpredictable.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number.\r
+**/\r
+typedef\r
+VOID *\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_POINTER)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is\r
+  invalid, the results are unpredictable.\r
+\r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number.\r
+  \r
+  @return Boolean value for a given PCD token.\r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_BOOLEAN)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
+  unpredictable.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number.  \r
+  \r
+  @return the size of the value for a given PCD token.\r
+**/\r
+typedef\r
+UINTN\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_SIZE)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Sets an 8-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token’s existing definition. If it is not, an error will be returned.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  @param[in]    Value         The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_8)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT8     Value\r
+);\r
+\r
+/**\r
+  Sets an 16-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token’s existing definition. If it is not, an error will be returned.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  @param[in]    Value         The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_16)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT16    Value\r
+);\r
+\r
+/**\r
+  Sets an 32-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token’s existing definition. If it is not, an error will be returned.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  @param[in]    Value         The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_32)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT32    Value\r
+);\r
+\r
+/**\r
+  Sets an 64-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token’s existing definition. If it is not, an error will be returned.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  @param[in]    Value         The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_64)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT64    Value\r
+);\r
+\r
+/**\r
+  Sets a value of the specified size for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token’s existing definition. If it is not, an error will be returned.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  @param[in]    SizeOfValue   The length of the Value being set for the PCD token.\r
+  @param[in]    Buffer        A pointer to the buffer containing the value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_POINTER)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINTN     SizeOfValue,\r
+  IN        VOID      *Buffer\r
+);\r
+\r
+/**\r
+  Sets a Boolean value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token’s existing definition. If it is not, an error will be returned.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  @param[in]    Value         The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_BOOLEAN)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        BOOLEAN   Value\r
+);\r
+\r
+typedef\r
+VOID\r
+(EFIAPI *PCD_PPI_CALLBACK)(\r
+  IN EFI_GUID *Guid     OPTIONAL,\r
+  IN UINTN    CallBackToken,\r
+  IN VOID     *TokenData,\r
+  IN UINTN    TokenDatSize\r
+);\r
+\r
+/**\r
+  Specifies a function to be called anytime the value of a designated token is changed.\r
+  \r
+  @param[in]    Guid              The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
+                                  the standard platform namespace.\r
+  @param[in]    CallBackToken     The PCD token number to monitor.\r
+  @param[in]    CallBackFunction  The function prototype that will be called when the value associated with the\r
+                                  CallBackToken is set.\r
+\r
+  @retval EFI_SUCCESS     The PCD service has successfully established a call event for the\r
+                          CallBackToken requested.\r
+  @retval EFI_NOT_FOUND   The PCD service could not find the referenced token number.                       \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_CALL_BACK_ON_SET)(\r
+  IN CONST  EFI_GUID          *Guid   OPTIONAL,\r
+  IN        UINTN             CallBackToken,\r
+  IN        PCD_PPI_CALLBACK  CallBackFunction\r
+);\r
+\r
+/**\r
+  Cancels a previously set callback function for a particular PCD token number.\r
+  \r
+  @param[in]  Guid              The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
+                                the standard platform namespace.\r
+  @param[in]  CallBackToken     The PCD token number to cancel monitoring.\r
+  @param[in]  CallBackFunction  The function prototype that was originally passed to the CallBackOnSet function.\r
+  \r
+  @retval     EFI_SUCCESS       The PCD service has cancelled the call event associated with the\r
+                                CallBackToken.\r
+  @retval     EFI_INVALID_PARAMETER   The PCD service did not match the CallBackFunction to one\r
+                                      that is currently being monitored.\r
+  @retval     EFI_NOT_FOUND     The PCD service could not find data the requested token number.                                 \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALL_BACK)(\r
+  IN CONST  EFI_GUID          *Guid   OPTIONAL,\r
+  IN        UINTN             CallBackToken,\r
+  IN        PCD_PPI_CALLBACK  CallBackFunction\r
+);\r
+\r
+/**\r
+  Retrieves the next valid PCD token for a given namespace.\r
+  \r
+  This provides a means by which to get the next valid token number in a given namespace. This is\r
+  useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori\r
+  know what token numbers are valid in the database.\r
+  \r
+  @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.\r
+  @param[in]    TokenNumber   The PCD token number. \r
+  \r
+  @retval   EFI_SUCCESS       The PCD service has retrieved the value requested.\r
+  @retval   EFI_NOT_FOUND     The PCD service could not find data from the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(\r
+  IN CONST  EFI_GUID      *Guid     OPTIONAL,\r
+  IN        UINTN         *TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the next valid PCD token namespace for a given namespace.\r
+  \r
+  Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
+  token namespaces on a platform.\r
+  \r
+  @param[in, out]   Guid    An indirect pointer to EFI_GUID. On input it designates a known token\r
+                            namespace from which the search will start. On output, it designates the next valid\r
+                            token namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
+                            space of the current platform is returned. If the search cannot locate the next valid\r
+                            token namespace, an error is returned and the value of *Guid is undefined.\r
+                            \r
+  @retval  EFI_SUCCESS      The PCD service retrieved the value requested.\r
+  @retval  EFI_NOT_FOUND    The PCD service could not find the next valid token namespace.                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(\r
+  IN OUT CONST EFI_GUID     **Guid\r
+);\r
+\r
+typedef struct {\r
+  EFI_PEI_PCD_PPI_SET_SKU               SetSku;\r
+  EFI_PEI_PCD_PPI_GET_EX_8              GetEx8;\r
+  EFI_PEI_PCD_PPI_GET_EX_16             GetEx16;\r
+  EFI_PEI_PCD_PPI_GET_EX_32             GetEx32;\r
+  EFI_PEI_PCD_PPI_GET_EX_64             GetEx64;\r
+  EFI_PEI_PCD_PPI_GET_EX_POINTER        GetExPtr;\r
+  EFI_PEI_PCD_PPI_GET_EX_BOOLEAN        GetExBool;\r
+  EFI_PEI_PCD_PPI_GET_EX_SIZE           GetExSize;\r
+  EFI_PEI_PCD_PPI_SET_EX_8              SetEx8;\r
+  EFI_PEI_PCD_PPI_SET_EX_16             SetEx16;\r
+  EFI_PEI_PCD_PPI_SET_EX_32             SetEx32;\r
+  EFI_PEI_PCD_PPI_SET_EX_64             SetEx64;\r
+  EFI_PEI_PCD_PPI_SET_EX_POINTER        SetExPtr;\r
+  EFI_PEI_PCD_PPI_SET_EX_BOOLEAN        SetExBool;\r
+  EFI_PEI_PCD_PPI_CALLBACK_ON_SET       CallbackOnSet;\r
+  EFI_PEI_PCD_PPI_CANCEL_CALLBACK       CancelCallback;\r
+  EFI_PEI_PCD_PPI_GET_NEXT_TOKEN        GetNextToken;\r
+  EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE  GetNextTokenSpace;\r
+} EFI_PEI_PCD_PPI;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/PiPcd.h b/MdePkg/Include/Protocol/PiPcd.h
new file mode 100644 (file)
index 0000000..5cc8bd8
--- /dev/null
@@ -0,0 +1,422 @@
+/** @file\r
+  Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3\r
+\r
+  A platform database that contains a variety of current platform settings or \r
+  directives that can be accessed by a driver or application.\r
+  PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.\r
+  \r
+  Callers to this protocol must be at a TPL_APPLICATION task priority level.\r
+  This is the base PCD service API that provides an abstraction for accessing configuration content in\r
+  the platform. It a seamless mechanism for extracting information regardless of where the\r
+  information is stored (such as in Read-only data, or an EFI Variable).\r
+  This protocol allows access to data through size-granular APIs and provides a mechanism for a\r
+  firmware component to monitor specific settings and be alerted when a setting is changed.\r
+\r
+  Copyright (c) 2009, Intel Corporation                                                         \r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  @par Revision Reference: \r
+  PI Version 1.2 Vol 3.\r
+**/\r
+\r
+#ifndef __PI_PCD_H__\r
+#define __PI_PCD_H__\r
+\r
+extern EFI_GUID gEfiPcdProtocolGuid;\r
+\r
+#define EFI_PCD_PROTOCOL_GUID \\r
+  { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }\r
+\r
+#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
+\r
+/**\r
+  SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is\r
+  normally called only once by the system.\r
+  For each item (token), the database can hold a single value that applies to all SKUs, or multiple\r
+  values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific\r
+  values are called SKU enabled.\r
+  The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are\r
+  not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.\r
+  For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no SKU\r
+  Id is set or the currently set SKU Id isn’t valid for the specified token, the system uses the default\r
+  SKU Id. If the system attempts to use the default SKU Id and no value has been set for that Id, the\r
+  results are unpredictable.\r
+  \r
+  @param[in]  SkuId   The SKU value to set.\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_SKU)(\r
+  IN UINTN SkuId\r
+);\r
+\r
+/**\r
+  Retrieves an 8-bit value for a given PCD token.\r
+  If the TokenNumber is invalid, the results are unpredictable.\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
+  \r
+  @return 8-bit value for a given PCD token.\r
+**/\r
+typedef\r
+UINT8\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_8)(\r
+  IN CONST EFI_GUID   *Guid,\r
+  IN       UINTN      TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current word-sized value for a PCD token number. \r
+  If the TokenNumber is invalid, the results are unpredictable.\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
+  \r
+  @return word-sized value for a given PCD token.  \r
+**/\r
+typedef\r
+UINT16\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_16)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current 32-bit sized value for a PCD token number. \r
+  If the TokenNumber is invalid, the results are unpredictable.\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
+\r
+  @return 32-bit value for a given PCD token.\r
+**/\r
+typedef\r
+UINT32\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_32)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the 64-bit sized value for a PCD token number. \r
+  If the TokenNumber is invalid, the results are unpredictable.\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
+\r
+  @return 64-bit value for a given PCD token.\r
+  \r
+**/\r
+typedef\r
+UINT64\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_64)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current pointer to the value for a PCD token number. Do not make any assumptions\r
+  about the alignment of the pointer that is returned by this function call. If the TokenNumber is\r
+  invalid, the results are unpredictable.\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
+\r
+  @return pointer to a value for a given PCD token.\r
+**/\r
+typedef\r
+VOID *\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_POINTER)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current BOOLEAN-sized value for a PCD token number. If the TokenNumber is\r
+  invalid, the results are unpredictable.\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
+  \r
+  @return Boolean value for a given PCD token.\r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_BOOLEAN)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
+  unpredictable.\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
+  \r
+  @return the size of the value for a given PCD token.\r
+**/\r
+typedef\r
+UINTN\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_EX_SIZE)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber\r
+);\r
+\r
+/**\r
+  Sets an 8-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token's existing definition. If it is not, an error will be returned.\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[in]    Value       The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_EX_8)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT8     Value\r
+);\r
+\r
+/**\r
+  Sets an 16-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token's existing definition. If it is not, an error will be returned.\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[in]    Value       The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_EX_16)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT16    Value\r
+);\r
+\r
+/**\r
+  Sets an 32-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token's existing definition. If it is not, an error will be returned.\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[in]    Value       The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_EX_32)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT32    Value\r
+);\r
+\r
+/**\r
+  Sets an 64-bit value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token's existing definition. If it is not, an error will be returned.\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[in]    Value       The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_EX_64)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINT64    Value\r
+);\r
+\r
+/**\r
+  Sets a value of a specified size for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token's existing definition. If it is not, an error will be returned.\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[in]    SizeOfValue The length of the value being set for the PCD token.\r
+  @param[in]    Buffer      A pointer to the buffer containing the value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER_EX)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        UINTN     SizeOfValue,\r
+  IN        VOID      *Buffer\r
+);\r
+\r
+/**\r
+  Sets a Boolean value for a given PCD token.\r
+  \r
+  When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
+  compatible with the Token's existing definition. If it is not, an error will be returned.\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[in]    Value       The value to set for the PCD token.\r
+  \r
+  @retval   EFI_SUCCESS             The PCD service has set the value requested\r
+  @retval   EFI_INVALID_PARAMETER   The PCD service determined that the size of the data being set was\r
+                                    incompatible with a call to this function. Use GetSizeEx() to\r
+                                    retrieve the size of the target data.\r
+  @retval   EFI_NOT_FOUND           The PCD service could not find the requested token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_SET_EX_BOOLEAN)(\r
+  IN CONST  EFI_GUID  *Guid,\r
+  IN        UINTN     TokenNumber,\r
+  IN        BOOLEAN   Value\r
+);\r
+\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK)(\r
+  IN EFI_GUID *Guid           OPTIONAL,\r
+  IN UINTN    CallBackToken,\r
+  IN VOID     *TokenData,\r
+  IN UINTN    TokenDataSize\r
+);\r
+\r
+/**\r
+  Specifies a function to be called anytime the value of a designated token is changed.\r
+  \r
+  @param[in]    Guid              The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]    CallBackToken     The PCD token number to monitor.\r
+  @param[in]    CallBackFunction  The function prototype called when the value associated with the CallBackToken is set.\r
+  \r
+  @retval EFI_SUCCESS     The PCD service has successfully established a call event for the CallBackToken requested.\r
+  @retval EFI_NOT_FOUND   The PCD service could not find the referenced token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK_ON_SET)(\r
+  IN CONST  EFI_GUID                  *Guid           OPTIONAL,\r
+  IN        UINTN                     CallBackToken,\r
+  IN        EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r
+);\r
+\r
+/**\r
+  Cancels a callback function that was set through a previous call to the CallBackOnSet function.\r
+  \r
+  @param[in]    Guid              The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]    CallBackToken     The PCD token number to monitor.\r
+  @param[in]    CallBackFunction  The function prototype called when the value associated with the CallBackToken is set.\r
+  \r
+  @retval EFI_SUCCESS     The PCD service has successfully established a call event for the CallBackToken requested.\r
+  @retval EFI_NOT_FOUND   The PCD service could not find the referenced token number.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_CANCEL_CALLBACK)(\r
+  IN CONST  EFI_GUID                  *Guid OPTIONAL,\r
+  IN        UINTN                     CallBackToken,\r
+  IN        EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r
+);\r
+\r
+/**\r
+  Gets the next valid token number in a given namespace. This is useful since the PCD infrastructure\r
+  contains a sparse list of token numbers, and one cannot a priori know what token numbers are valid\r
+  in the database.\r
+  \r
+  @param[in]    Guid              The 128-bit unique value that designates the namespace from which to retrieve the next token.\r
+  @param[in]    TokenNumber       A pointer to the PCD token number to use to find the subsequent token number. To\r
+                                  retrieve the "first" token, have the pointer reference a TokenNumber value of 0.\r
+  @retval EFI_SUCCESS           The PCD service has retrieved the value requested\r
+  @retval EFI_NOT_FOUND         The PCD service could not find data from the requested token number.                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN)(\r
+  IN CONST  EFI_GUID  *Guid, OPTIONAL\r
+  IN        UINTN     *TokenNumber\r
+);\r
+\r
+/**\r
+  Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
+  token namespaces on a platform.\r
+  \r
+  @param[in, out]   Guid    An indirect pointer to EFI_GUID. On input it designates a known token namespace\r
+                            from which the search will start. On output, it designates the next valid token\r
+                            namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
+                            space of the current platform is returned. If the search cannot locate the next valid\r
+                            token namespace, an error is returned and the value of *Guid is undefined.\r
+                    \r
+  @retval   EFI_SUCCESS   The PCD service retrieved the value requested.\r
+  @retval   EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE)(\r
+  IN OUT CONST EFI_GUID **Guid\r
+);\r
+\r
+typedef struct _EFI_PCD_PROTOCOL {\r
+  EFI_PCD_PROTOCOL_SET_SKU              SetSku;\r
+  EFI_PCD_PROTOCOL_GET_EX_8             Get8Ex;\r
+  EFI_PCD_PROTOCOL_GET_EX_16            Get16Ex;\r
+  EFI_PCD_PROTOCOL_GET_EX_32            Get32Ex;\r
+  EFI_PCD_PROTOCOL_GET_EX_64            Get64Ex;\r
+  EFI_PCD_PROTOCOL_GET_EX_POINTER       GetPtrEx;\r
+  EFI_PCD_PROTOCOL_GET_EX_BOOLEAN       GetBoolEx;\r
+  EFI_PCD_PROTOCOL_GET_EX_SIZE          GetSizeEx;\r
+  EFI_PCD_PROTOCOL_SET_EX_8             Set8Ex;\r
+  EFI_PCD_PROTOCOL_SET_EX_16            Set16Ex;\r
+  EFI_PCD_PROTOCOL_SET_EX_32            Set32Ex;\r
+  EFI_PCD_PROTOCOL_SET_EX_64            Set64Ex;\r
+  EFI_PCD_PROTOCOL_SET_EX_POINTER       SetPtrEx;\r
+  EFI_PCD_PROTOCOL_SET_EX_BOOLEAN       SetBoolEx;\r
+  EFI_PCD_PROTOCOL_CALLBACK_ON_SET      CallbackOnSet;\r
+  EFI_PCD_PROTOCOL_CANCEL_CALLBACK      CancelCallback;\r
+  EFI_PCD_PROTOCOL_GET_NEXT_TOKEN       GetNextToken;\r
+  EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
+} EFI_PCD_PROTOCOL;\r
+\r
+#endif\r
index c3fcbcffce8191f8ced6e5617118bf7e0fb7e9aa..aaa8476a9f0be7a1dc815e811638a65eb0af72c1 100644 (file)
   ## Include/Ppi/ReportStatusCodeHandler.h\r
   gEfiPeiRscHandlerPpiGuid           = { 0x65d394, 0x9951, 0x4144, {0x82, 0xa3, 0xa, 0xfc, 0x85, 0x79, 0xc2, 0x51 }}\r
   \r
+  ## Include/Ppi/PiPcd.h\r
+  gEfiPeiPcdPpiGuid                  = { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }\r
+  \r
 [Protocols]\r
   #\r
   # Protocols defined in PI1.0.\r
   ## Include/Protocol/SmmIoTrapDispatch2.h\r
   gEfiSmmIoTrapDispatch2ProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }}\r
 \r
+  ## Include/Protocol/PiPcd.h\r
+  gEfiPcdProtocolGuid = { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }\r
+  \r
   #\r
   # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1\r
   #\r