8. PCD

8.1. PCD Protocol Definitions

8.1.1. PCD Protocol

8.1.1.1. EFI_PCD_PROTOCOL

Summary

A platform database that contains a variety of current platform settings or directives that can be accessed by a driver or application.

GUID

#define EFI_PCD_PROTOCOL_GUID \
  { 0x13a3f0f6, 0x264a, 0x3ef0, \
  { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }

Protocol Interface Structure

typedef struct _EFI_PCD_PROTOCOL {
  EFI_PCD_PROTOCOL_SET_SKU          SetSk ;

  EFI_PCD_PROTOCOL_GET_8                Get8;
  EFI_PCD_PROTOCOL_GET_16               Get16;
  EFI_PCD_PROTOCOL_GET_32               Get32;
  EFI_PCD_PROTOCOL_GET_64               Get64;
  EFI_PCD_PROTOCOL_GET_POINTER          GetPtr;
  EFI_PCD_PROTOCOL_GET_BOOLEAN          GetBool;
  EFI_PCD_PROTOCOL_GET_SIZE             GetSize;

  EFI_PCD_PROTOCOL_SET_8                Set8;
  EFI_PCD_PROTOCOL_SET_16               Set16;
  EFI_PCD_PROTOCOL_SET_32               Set32;
  EFI_PCD_PROTOCOL_SET_64               Set64;
  EFI_PCD_PROTOCOL_SET_POINTER          SetPtr;
  EFI_PCD_PROTOCOL_SET_BOOLEAN          SetBool;

  EFI_PCD_PROTOCOL_CALLBACK_ON_SET      CallbackOnSet;
  EFI_PCD_PROTOCOL_CANCEL_CALLBACK      CancelCallback;
  EFI_PCD_PROTOCOL_GET_NEXT_TOKEN       GetNextToken;
  EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;
} EFI_PCD_PROTOCOL;

Parameters

SetSku

Establish a current SKU value for the PCD service to use for subsequent data Get/Set requests.

Get8

Retrieve an 8-bit value from the PCD service using a GUIDed token namespace.

Get16

Retrieve a 16-bit value from the PCD service using a GUIDed token namespace.

Get32

Retrieve a 32-bit value from the PCD service using a GUIDed token namespace.

Get64

Retrieve a 64-bit value from the PCD service using a GUIDed token namespace.

GetPtr

Retrieve a pointer to a value from the PCD service using a GUIDed token namespace. Can be used to retrieve an array of bytes that may represent a data structure, ASCII string, or Unicode string

GetBool

Retrieve a Boolean value from the PCD service using a GUIDed token namespace.

GetSize

Retrieve the size of a particular PCD Token value using a GUIDed token namespace.

Set8

Set an 8-bit value in the PCD service using a GUIDed token namespace

Set16

Set a 16-bit value in the PCD service using a GUIDed token namespace.

Set32

Set a 32-bit value in the PCD service using a GUIDed token namespace.

Set64

Set a 64-bit value in the PCD service using a GUIDed token namespace.

SetPtr

Set a pointer to a value in the PCD service using a GUIDed token namespace. Can be used to set an array of bytes that may represent a data structure, ASCII string, or Unicode string

SetBool

Set a Boolean value in the PCD service using a GUIDed token namespace.

CallBackOnSet

Establish a notification to alert when a particular PCD Token value is set.

CancelCallBackOnSet

Cancel a previously set notification for a particular PCD Token value.

GetNextToken

Retrieve the next token number that is contained in the PCD name-space.

GetNextTokenSpace

Retrieve the next valid PCD token namespace for a given name-space.

Description

Callers to this protocol must be at a TPL_APPLICATION task priority level.

This is the base PCD service API that provides an abstraction for accessing configuration content in the platform. It a seamless mechanism for extracting information regardless of where the information is stored (such as in Read-only data, or an EFI Variable).

This protocol allows access to data through size-granular APIs and provides a mechanism for a firmware component to monitor specific settings and be alerted when a setting is changed.

8.1.1.2. EFI_PCD_PROTOCOL.SetSku ()

Summary

Sets the SKU value for subsequent calls to set or get PCD token values.

Prototype

typedef
VOID
(EFIAPI *EFI_PCD_PROTOCOL_SET_SKU) (
  IN UINTN          SkuId
  );

Parameter

SkuId

The SKU value to set.

Description

SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is normally called only once by the system.

For each item (token), the database can hold a single value that applies to all SKUs, or multiple values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific values are called SKU enabled.

The SKU Id of zero is reserved as a default. For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn’t valid for the specified token, the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that Id, the results are unpredictable.

8.1.1.3. EFI_PCD_PROTOCOL.Get8 ()

Summary

Retrieves an 8-bit value for a given PCD token.

Prototype

typedef
UINT8
(EFIAPI *EFI_PCD_PROTOCOL_GET_8) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.4. EFI_PCD_PROTOCOL.Get16 ()

Summary

Retrieves a 16-bit value for a given PCD token.

Prototype

typedef
UINT16
(EFIAPI *EFI_PCD_PROTOCOL_GET_16) (
  IN CONST EFI_GUID                 *Guid,
  IN UINTN                          TokenNumbe*
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current word-sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.5. EFI_PCD_PROTOCOL.Get32 ()

Summary

Retrieves a 32-bit value for a given PCD token.

Prototype

typedef
UINT32
(EFIAPI *EFI_PCD_PROTOCOL_GET_32) (
  IN CONST EFI_GUID               *Guid,
  IN UINTN                        TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current 32-bit sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.6. EFI_PCD_PROTOCOL.Get64 ()

Summary

Retrieves a 64 -bit value for a given PCD token.

Prototype

typedef
UINT64
(EFIAPI *EFI_PCD_PROTOCOL_GET_64) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber
  );

Parameter

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the 64-bit sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.7. EFI_PCD_PROTOCOL.GetPtr ()

Summary

Retrieves a pointer to a value for a given PCD token.

Prototype

typedef
VOID *
(EFIAPI *EFI_PCD_PROTOCOL_GET_POINTER) (
  IN CONST EFI_GUID                   *Guid,
  IN UINTN                            TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current pointer to the value for a PCD token number. Do not make any assumptions about the alignment of the pointer that is returned by this function call. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.8. EFI_PCD_PROTOCOL.GetBool ()

Summary

Retrieves a Boolean value for a given PCD token.

Prototype

typedef
BOOLEAN
(EFIAPI *EFI_PCD_PROTOCOL_GET_BOOLEAN) (
  IN CONST EFI_GUID                   *Guid,
  IN UINTN                            TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current BOOLEAN-sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.9. EFI_PCD_PROTOCOL.GetSize ()

Summary

Retrieves the size of the value for a given PCD token.

Prototype

typedef
UINTN
(EFIAPI *EFI_PCD_PROTOCOL_GET_SIZE) (
  IN CONST EFI_GUID               *Guid,
  IN UINTN                        TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are unpredictable.

8.1.1.10. EFI_PCD_PROTOCOL.Set8 ()

Summary

Sets an 8-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_8) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber,
  IN UINT 8                     Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.6 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.1.11. EFI_PCD_PROTOCOL.Set16 ()

Summary

Sets a 16-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_16) (
  IN CONST EFI_GUID         *Guid,
  IN UINTN                  TokenNumber,
  IN UINT16                 Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.The 128-bit unique value that designates the namespace from which to extract the value.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.7 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.1.12. EFI_PCD_PROTOCOL.Set32 ()

Summary

Sets a 32-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_32) (
  IN CONST EFI_GUID       *Guid,
  IN UINTN                TokenNumber,
  IN UINT32               Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.8 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.1.13. EFI_PCD_PROTOCOL.Set64 ()

Summary

Sets a 64-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_64) (
  IN CONST EFI_GUID         *Guid,
  IN UINTN                  TokenNumber,
  IN UINT64                 Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.9 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.1.14. EFI_PCD_PROTOCOL.SetPtr ()

Summary

Sets a value of a specified size for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER) (
  IN CONST EFI_GUID   *Guid,
  IN UINTN            TokenNumber,
  IN OUT UINTN        *SizeOfValue,
  IN VOID             *Buffer
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

SizeOfValue

The length of the value being set for the PCD token. If too large of a length is specified, upon return from this function the value of SizeOfValue will reflect the maximum size for the PCD token.

Buffer

A pointer to the buffer containing the value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.10 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. The SizeofValue parameter reflects the maximum size of the PCD token referenced. Use GetSize() to retrieve the current size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.1.15. EFI_PCD_PROTOCOL.SetBool ()

Summary

Sets a Boolean value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_BOOLEAN) (
  IN CONST EFI_GUID           *Guid,
  IN UINTN                    TokenNumber,
  IN BOOLEAN                  Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

Token

NumberThe PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.11 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatiable with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.1.16. EFI_PCD_PROTOCOL.CallbackOnSet ()

Summary

Specifies a function to be called anytime the value of a designated token is changed.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK_ON_SET) (
  IN CONST EFI_GUID               *Guid, OPTIONAL
  IN UINTN                        CallBackToken,
  IN EFI_PCD_PROTOCOL_CALLBACK    CallBackFunction
  );

Parameters

Guid

The 128-bit unique value that designates which namespace to monitor. If NULL , use the standard platform namespace.

CallBackToken

The PCD token number to monitor.

CallBackFunction

The function prototype called when the value associated with the CallBackToken is set.

typedef
VOID
(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK) {
  IN EFI_GUID                 *Guid, OPTIONAL
  IN UINTN                    CallBackToken,
  IN OUT VOID                 *TokenData,
  IN UINTN                    TokenDataSize
  };

Description

Specifies a function to be called anytime the value of a designated token is changed.

Status Codes Returned

Table 8.12 Status Codes Returned

EFI_SUCCESS

The PCD service has successfully established a call event for the CallBackToken requested.

EFI_NOT_FOUND

The PCD service could not find the referenced token number.

8.1.1.17. EFI_PCD_PROTOCOL.CancelCallback ()

Summary

Cancels a previously set callback function for a particular PCD token number.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_CANCEL_CALLBACK) (
  IN CONST EFI_GUID             *Guid, OPTIONAL
  IN UINTN                      CallBackToken,
  IN EFI_PCD_PROTOCOL_CALLBACK  CallBackFunction
  );

Parameters

Guid

The 128-bit unique value that designates which namespace to monitor. If NULL , use the standard platform namespace.

CallBackToken

The PCD token number for which to cancel monitoring.

CallBackFunction

The function prototype that was originally passed to the CallBackOnSet function.

Description

Cancels a callback function that was set through a previous call to the CallBackOnSet function.

Status Codes Returned

Table 8.13 Status Codes Returned

EFI_SUCCESS

The PCD service has cancelled the call event associated with the CallBackToken.

EFI_INVALID_PARAMETER

The PCD service did not match the CallBackFunction to one that is currently being monitored.

EFI_NOT_FOUND

The PCD service could not find data the requested token number.

8.1.1.18. EFI_PCD_PROTOCOL.GetNextToken ()

Summary

Retrieves the next valid PCD token for a given namespace.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN) (
  IN CONST EFI_GUID         *Guid, OPTIONAL
  IN UINTN                  *TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to retrieve the next token.

TokenNumber

A pointer to the PCD token number to use to find the subsequent token number. To retrieve the “first” token, have the pointer reference a TokenNumber value of 0.

Description

Gets the next valid token number in a given namespace. This is useful since the PCD infrastructure contains a sparse list of token numbers, and one cannot a priori know what token numbers are valid in the database.

Status Codes Returned

Table 8.14 Status Codes Returned

EFI_SUCCESS

The PCD service has retrieved the value requested.

EFI_NOT_FOUND

The PCD service could not find data from the requested token number.

8.1.1.19. EFI_PCD_PROTOCOL.GetNextTokenSpace ()

Summary

Retrieves the next valid PCD token namespace for a given namespace.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE) (
  IN OUT CONST EFI_GUID           **Guid
  );

Parameters

Guid

An indirect pointer to EFI_GUID . On input it designates a known token namespace from which the search will start. On output, it designates the next valid token namespace on the platform. If *Guid is NULL , then the GUID of the first token space of the current platform is returned. If the search cannot locate the next valid token namespace, an error is returned and the value of *Guid is undefined.

Description

Gets the next valid token namespace for a given namespace. This is useful to traverse the valid token namespaces on a platform.

Status Codes Returned

Table 8.15 Status Codes Returned

EFI_SUCCESS

The PCD service retrieved the value requested.

EFI_NOT_FOUND

The PCD service could not find the next valid token namespace.

8.1.2. Get PCD Information Protocol

8.1.2.1. EFI_GET_PCD_INFO_PROTOCOL

Summary

The protocol that provides additional information about items that reside in the PCD database.

GUID

#define EFI_GET_PCD_INFO_PROTOCOL_GUID \
  { 0xfd0f4478, 0xefd, 0x461d, \
  { 0xba, 0x2d, 0xe5, 0x8c, 0x45, 0xfd, 0x5f, 0x5e } }

Protocol Interface Structure

typedef struct _EFI_GET_PCD_INFO_PROTOCOL {
  EFI_GET_PCD_INFO_PROTOCOL_GET_INFO GetInfo;
  EFI_GET_PCD_INFO_PROTOCOL_GET_SKU GetSku;
} EFI_GET_PCD_INFO_PROTOCOL;

Parameters

GetInfo

Retrieve additional information associated with a PCD.

GetSku

Retrieve the currently set SKU Id.

Description

Callers to this protocol must be at a TPL_APPLICATION task priority level.

This is the PCD service to use when querying for some additional data that can be contained in the PCD database.

8.1.2.2. EFI_GET_PCD_INFO_PROTOCOL.GetInfo ()

Summary

Retrieve additional information associated with a PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_GET_PCD_INFO_PROTOCOL_GET_INFO) (
  IN CONST EFI_GUID     *Guid,
  IN UINTN              TokenNumber,
  OUT EFI_PCD_INFO      *PcdInfo
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

PcdInfo

The returned information associated with the requested TokenNumber. See related definitions below.

Description

GetInfo() retrieves additional information associated with a PCD token. This includes information such as the type of value the TokenNumber is associated with as well as possible human readable name that is associated with the token.

typedef struct {
  EFI_PCD_TYPE  PcdType;
  UINTN         PcdSize;
  CHAR8         *PcdName;
} EFI_PCD_INFO;
PcdType

The returned information associated with the requested TokenNumber . If TokenNumber is 0, then PcdType is set to EFI_PCD_TYPE_8 .

PcdSize

The size of the data in bytes associated with the TokenNumber specified. If TokenNumber is 0, then PcdSize is set 0.

PcdName

The null-terminated ASCII string associated with a given token. If the TokenNumber specified was 0, then this field corresponds to the null-terminated ASCII string associated with the token’s namespace Guid . If NULL, there is no name associated with this request.

typedef enum {
  EFI_PCD_TYPE_8,
  EFI_PCD_TYPE_16,
  EFI_PCD_TYPE_32,
  EFI_PCD_TYPE_64,
  EFI_PCD_TYPE_BOOL,
  EFI_PCD_TYPE_PTR
} EFI_PCD_TYPE;

Status Codes Returned

Table 8.16 Status Codes Returned

EFI_SUCCESS

The PCD information was returned successfully

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.1.2.3. EFI_GET_PCD_INFO_PROTOCOL.GetSku ()

Summary

Retrieve the currently set SKU Id.

Prototype

typedef
UINTN
(EFIAPI *EFI_GET_PCD_INFO_PROTOCOL_GET_SKU) (
  VOID
  );

Description

GetSku() returns the currently set SKU Id. If the platform has not set at a SKU Id, then the default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU Id is returned.

8.2. PCD PPI Definitions

8.2.1. PCD PPI

8.2.1.1. EFI_PEI_PCD_PPI

Summary

A platform database that contains a variety of current platform settings or directives that can be accessed by a driver or application.

GUID

#define EFI_PEI_PCD_PPI_GUID \
  { 0x1f34d25, 0x4de2, 0x23ad, \
  { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }

PPI Structure

typedef struct {
  EFI_PEI_PCD_PPI_SET_SKU               SetSku;

  EFI_PEI_PCD_PPI_GET_8                 Get8;
  EFI_PEI_PCD_PPI_GET_16                Get16;
  EFI_PEI_PCD_PPI_GET_32                Get32;
  EFI_PEI_PCD_PPI_GET_64                Get64;
  EFI_PEI_PCD_PPI_GET_POINTER           GetPtr;
  EFI_PEI_PCD_PPI_GET_BOOLEAN           GetBool;
  EFI_PEI_PCD_PPI_GET_SIZE              GetSize;
  EFI_PEI_PCD_PPI_SET_8                 Set8;

  EFI_PEI_PCD_PPI_SET_16                Set16;
  EFI_PEI_PCD_PPI_SET_32                Set32;
  EFI_PEI_PCD_PPI_SET_64                Set64;
  EFI_PEI_PCD_PPI_SET_POINTER           SetPtr;
  EFI_PEI_PCD_PPI_SET_BOOLEAN           SetBool;

  EFI_PEI_PCD_PPI_CALLBACK_ON_SET       CallbackOnSet;
  EFI_PEI_PCD_PPI_CANCEL_CALLBACK       CancelCallback;
  EFI_PEI_PCD_PPI_GET_NEXT_TOKEN        GetNextToken;
  EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE  GetNextTokenSpace;
} EFI_PEI_PCD_PPI;

Parameters

SetSku

Establish a current SKU value for the PCD service to use for subsequent data Get/Set requests.

Get8

Retrieve an 8-bit value from the PCD service using a GUIDed token namespace.

Get16

Retrieve a 16-bit value from the PCD service using a GUIDed token namespace.

Get32

Retrieve a 32-bit value from the PCD service using a GUIDed token namespace.

Get64

Retrieve a 64-bit value from the PCD service using a GUIDed token namespace.

GetPtr

Retrieve a pointer to a value from the PCD service using a GUIDed token namespace. Can be used to retrieve an array of bytes that represents a data structure, ASCII string, or Unicode string

GetBool

Retrieve a Boolean value from the PCD service using a GUIDed token namespace.

GetBool

Retrieve the size of a particular PCD Token value using a GUIDed token namespace.

Set8

Set an 8-bit value in the PCD service using a GUIDed token namespace.

Set16

Set a 16-bit value in the PCD service using a GUIDed token namespace.

Set32

Set a 32-bit value in the PCD service using a GUIDed token namespace.

Set64

Set a 64-bit value in the PCD service using a GUIDed token namespace.

SetPtr

Set a pointer to a value in the PCD service using a GUIDed token namespace. Can be used to set an array of bytes that represents a data structure, ASCII string, or Unicode string

SetBool

Set a Boolean value in the PCD service using a GUIDed token namespace.

CallBackOnSet

Establish a notification when a particular PCD Token value is set.

CancelCallBackOnSet

Cancel a previously set notification for a particular PCD Token value.

GetNextToken

Retrieve the next token number that is contained in the PCD namespace.

Description

This is the base PCD service API that provides an abstraction for accessing configuration content in the platform. It is a seamless mechanism for extracting information regardless of where the information is stored (such as in Read-only data in an EFI Variable).

This ppi provides access to data through size-granular APIs and provides a mechanism for a firmware component to monitor specific settings and be alerted when a setting is changed.

8.2.1.2. EFI_PEI_PCD_PPI.SetSku ()

Summary

Sets the SKU value for subsequent calls to set or get PCD token values.

Prototype

typedef
VOID
(EFIAPI *EFI_PEI_PCD_PPI_SET_SKU) (
  IN UINTN          SkuId
  );

Parameters

SkuId

The SKU value to set.

Description

SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is normally called only once by the system.

For each item (token), the database can hold a single value that applies to all SKUs, or multiple values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific values are called SKU enabled. The SKU Id of zero is reserved as a default. For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku() . If no SKU Id is set or the currently set SKU Id isn’t valid for the specified token, the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that Id, the results are unpredictable.

8.2.1.3. EFI_PEI_PCD_PPI.Get8 ()

Summary

Retrieves an 8-bit value for a given PCD token.

Prototype

typedef
UINT8
(EFIAPI *EFI_PEI_PCD_PPI_GET_8) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                       TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates which namespace to extract the value from.

TokenNumber

The PCD token number.

Description

Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.2.1.4. EFI_PEI_PCD_PPI.Get16 ()

Summary

Retrieves a value for a given PCD token.

Prototype

typedef
UINT16
(EFIAPI *EFI_PEI_PCD_PPI_GET_16) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                       TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current word-sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.2.1.5. EFI_PEI_PCD_PPI.Get32 ()

Summary

Retrieves a 32-bit value for a given PCD token.

Prototype

typedef
UINT32
(EFIAPI *EFI_PEI_PCD_PPI_GET_32) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                       TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current 32-bit value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.2.1.6. EFI_PEI_PCD_PPI.Get64 ()

Summary

Retrieves a 64-bit value for a given PCD token.

Prototype

typedef
UINT64
(EFIAPI *EFI_PEI_PCD_PPI_GET_64) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the 64-bit value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.2.1.7. EFI_PEI_PCD_PPI.GetPtr ()

Summary

Retrieves a pointer to the value for a given PCD token.

Prototype

typedef
VOID *
(EFIAPI *EFI_PEI_PCD_PPI_GET_POINTER) (
  IN CONST EFI_GUID                   *Guid,
  IN UINTN                            TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current pointer to the value for a PCD token number. There should not be any alignment assumptions about the pointer that is returned by this function call. If the TokenNumber is invalid, the results are unpredictable.

EFI_PEI_PCD_PPI.GetBool ()

Summary

Retrieves a Boolean value for a given PCD token.

Prototype

typedef
BOOLEAN
(EFIAPI *EFI_PEI_PCD_PPI_GET_BOOLEAN) (
  IN CONST EFI_GUID                   *Guid,
  IN UINTN                            TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is invalid, the results are unpredictable.

8.2.1.8. EFI_PEI_PCD_PPI.GetSize ()

Summary

Retrieves the size of the value for a given PCD token.

Prototype

typedef
UINTN
(EFIAPI *EFI_PEI_PCD_PPI_GET_SIZE) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Description

Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are unpredictable.

8.2.1.9. EFI_PEI_PCD_PPI.Set8 ()

Summary

Sets an 8-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_8) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber,
  IN UINT8                      Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.17 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.1.10. EFI_PEI_PCD_PPI.Set16 ()

Summary

Sets a 16-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_16) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber,
  IN UINT16                     Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.18 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.1.11. EFI_PEI_PCD_PPI.Set32 ()

Summary

Sets a 32-bit value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_32) (
  IN CONST EFI_GUID             *Guid,
  IN UINTN                      TokenNumber,
  IN UINT32                     Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.19 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.1.12. EFI_PEI_PCD_PPI.Set64 ()

Summary

Sets a 64-bit value for a given PCD token.

Prototype

EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_64) (
  IN CONST EFI_GUID         *Guid,
  IN UINTN                  TokenNumber,
  IN UINT64                 Value
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.20 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.1.13. EFI_PEI_PCD_PPI.SetPtr ()

Summary

Sets a value of the specified size for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_POINTER) (
  IN CONST EFI_GUID         *Guid,
  IN UINTN                  TokenNumber,
  IN OUT UINTN              *SizeOfValue,
  IN VOID                   *Buffer
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

SizeOfValue

The length of the value being set for the PCD token. If too large of a length is specified, upon return from this function the value of SizeOfValue will reflect the maximum size for the PCD token.

Buffer

A pointer to the buffer containing the value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.21 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool to retrieve the size of the target data.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. The SizeofValue() parameter reflects the maximum size of the PCD token referenced. Use GetSize() to retrieve the current size of the target data

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.1.14. EFI_PEI_PCD_PPI.SetBool()

Summary

Sets a Boolean value for a given PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_BOOLEAN) (
  IN CONST EFI_GUID           Guid,
  IN UINTN                    TokenNumber,
  IN BOOLEAN                  Value
  );

Prototype

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

Value

The value to set for the PCD token.

Description

When the PCD service sets a value, it will check to ensure that the size of the value being set is compatible with the Token’s existing definition. If it is not, an error will be returned.

Status Codes Returned

Table 8.22 Status Codes Returned

EFI_SUCCESS

The PCD service has set the value requested.

EFI_INVALID_PARAMETER

The PCD service determined that the size of the data being set was incompatible with a call to this function. Use GetBool() to retrieve the size of the target data.

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.1.15. EFI_PEI_PCD_PPI.CallbackOnSet ()

Summary

Specifies a function to be called anytime the value of a designated token is changed.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET) (
  IN CONST EFI_GUID             *Guid, OPTIONAL
  IN UINTN                      CallBackToken,
  IN EFI_PEI_PCD_PPI_CALLBACK   CallBackFunction
  );

Parameters

Guid

The 128-bit unique value that designates which namespace to monitor. If NULL , use the standard platform namespace.

CallBackToken

The PCD token number to monitor.

CallBackFunction

The function prototype that will be called when the value associated with the CallBackToken is set.

typedef
VOID
(EFIAPI * EFI_PEI_PCD_PPI_CALLBACK ) {
IN EFI_GUID               *Guid, OPTIONAL,
IN UINTN                  CallBackToken,
IN OUT VOID               *TokenData,
IN UINTN                  TokenDatSize
  };

Description

Specifies a function to be called anytime the value of a designated token is changed.

Status Codes Returned

Table 8.23 Status Codes Returned

EFI_SUCCESS

The PCD service has successfully established a call event for the CallBackToken requested.

EFI_NOT_FOUND

The PCD service could not find the referenced token number.

8.2.1.16. EFI_PEI_PCD_PPI.CancelCallback ()

Summary

Cancels a previously set callback function for a particular PCD token number.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK) (
  IN CONST EFI_GUID             *Guid, OPTIONAL
  IN UINTN                      CallBackToken,
  IN EFI_PEI_PCD_PPI_CALLBACK   CallBackFunction
  );

Parameters

Guid

The 128-bit unique value that designates which namespace to monitor. If NULL, use the standard platform namespace.

CallBackToken

The PCD token number to cancel monitoring.

CallBackFunction

The function prototype that was originally passed to the CallBackOnSet function.

Description

Cancels a callback function that was set through a previous call to the CallBackOnSet function.

Status Codes Returned

Table 8.24 Status Codes Returned

EFI_SUCCESS

The PCD service has cancelled the call event associated with the CallBackToken.

EFI_INVALID_PARAMETER

The PCD service did not match the CallBackFunction to one that is currently being monitored.

EFI_NOT_FOUND

The PCD service could not find data the requested token number.

8.2.1.17. EFI_PEI_PCD_PPI.GetNextToken ()

Summary

Retrieves the next valid PCD token for a given namespace.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN) (
  IN CONST EFI_GUID             *Guid, OPTIONAL
  IN UINTN                      *TokenNumber
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

A pointer to the PCD token number to use to find the subsequent token number. To retrieve the “first” token, have the pointer reference a TokenNumber value of 0.

Description

This provides a means by which to get the next valid token number in a given namespace. This is useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori know what token numbers are valid in the database.

Status Codes Returned

Table 8.25 Status Codes Returned

EFI_SUCCESS

The PCD service has retrieved the value requested

EFI_NOT_FOUND

The PCD service could not find data from the requested token number

8.2.1.18. EFI_PEI_PCD_PPI.GetNextTokenSpace ()

Summary

Retrieves the next valid PCD token namespace for a given namespace.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE) (
  IN OUT CONST EFI_GUID           **Guid
  );

Parameters

Guid

An indirect pointer to EFI_GUID . On input it designates a known token namespace from which the search will start. On output, it designates the next valid token namespace on the platform. If * Guid is NULL , then the GUID of the first token space of the current platform is returned. If the search cannot locate the next valid token namespace, an error is returned and the value of * Guid is undefined.

Description

Gets the next valid token namespace for a given namespace. This is useful to traverse the valid token namespaces on a platform.

Status Codes Returned

Table 8.26 Status Codes Returned

EFI_SUCCESS

The PCD service retrieved the value requested

EFI_NOT_FOUND

The PCD service could not find the next valid token namespace

8.2.2. Get PCD Information PPI

8.2.2.1. EFI_GET_PCD_INFO_PPI

Summary

The PPI that provides additional information about items that reside in the PCD database.

GUID

#define EFI_GET_PCD_INFO_PPI_GUID \
  { 0xa60c6b59, 0xe459, 0x425d, \
  { 0x9c, 0x69, 0xb, 0xcc, 0x9c, 0xb2, 0x7d, 0x81 } }

Protocol Interface Structure

typedef struct _EFI_GET_PCD_INFO_PPI {
  EFI_GET_PCD_INFO_PPI_GET_INFO     GetInfo;
  EFI_GET_PCD_INFO_PPI_GET_SKU      GetSku;
} EFI_GET_PCD_INFO_PPI;

Parameters

GetInfo

Retrieve additional information associated with a PCD.

GetSku

Retrieve the currently set SKU Id.

Description

This is the PCD service to use when querying for some additional data that can be contained in the PCD database.

8.2.2.2. EFI_GET_PCD_INFO_PPI.GetInfo ()

Summary

Retrieve additional information associated with a PCD token.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_GET_PCD_INFO_PPI_GET_INFO) (
  IN CONST EFI_GUID     *Guid,
  IN UINTN              TokenNumber,
  OUT EFI_PCD_INFO      *PcdInfo
  );

Parameters

Guid

The 128-bit unique value that designates the namespace from which to extract the value.

TokenNumber

The PCD token number.

PcdInfo

The returned information associated with the requested TokenNumber.

Description

GetInfo() retrieves additional information associated with a PCD token. This includes information such as the type of value the TokenNumber is associated with as well as possible human readable name that is associated with the token.

Status Codes Returned

Table 8.27 Status Codes Returned

EFI_SUCCESS

The PCD information was returned successfully

EFI_NOT_FOUND

The PCD service could not find the requested token number.

8.2.2.3. EFI_GET_PCD_INFO_PPI.GetSku ()

Summary

Retrieve the currently set SKU Id.

Prototype

typedef
UINTN
(EFIAPI *EFI_GET_PCD_INFO_PPI_GET_SKU) (
  VOID
  );

Description

GetSku() returns the currently set SKU Id. If the platform has not set at a SKU Id, then the default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU Id is returned.