2 Native Platform Configuration Database (PCD) PPI
4 Different with the EFI_PCD_PPI defined in PI 1.2 specification, the native
5 PCD PPI provide interfaces for dynamic and dynamic-ex type PCD.
6 The interfaces for dynamic type PCD do not require the token space guid as parameter,
7 but interfaces for dynamic-ex type PCD require token space guid as parameter.
9 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
10 SPDX-License-Identifier: BSD-2-Clause-Patent
17 #define PCD_PPI_GUID \
18 { 0x6e81c58, 0x4ad7, 0x44bc, { 0x83, 0x90, 0xf1, 0x2, 0x65, 0xf7, 0x24, 0x80 } }
20 #define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
23 Sets the SKU value for subsequent calls to set or get PCD token values.
25 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
26 SetSku() is normally called only once by the system.
28 For each item (token), the database can hold a single value that applies to all SKUs,
29 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
30 SKU-specific values are called SKU enabled.
32 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
33 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
34 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
35 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
36 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
37 set for that Id, the results are unpredictable.
39 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
40 set values associated with a PCD token.
47 (EFIAPI
*PCD_PPI_SET_SKU
)(
52 Retrieves an 8-bit value for a given PCD token.
54 Retrieves the current byte-sized value for a PCD token number.
55 If the TokenNumber is invalid, the results are unpredictable.
57 @param[in] TokenNumber The PCD token number.
59 @return The UINT8 value.
64 (EFIAPI
*PCD_PPI_GET8
)(
69 Retrieves a 16-bit value for a given PCD token.
71 Retrieves the current 16-bit value for a PCD token number.
72 If the TokenNumber is invalid, the results are unpredictable.
74 @param[in] TokenNumber The PCD token number.
76 @return The UINT16 value.
81 (EFIAPI
*PCD_PPI_GET16
)(
86 Retrieves a 32-bit value for a given PCD token.
88 Retrieves the current 32-bit value for a PCD token number.
89 If the TokenNumber is invalid, the results are unpredictable.
91 @param[in] TokenNumber The PCD token number.
93 @return The UINT32 value.
98 (EFIAPI
*PCD_PPI_GET32
)(
103 Retrieves a 64-bit value for a given PCD token.
105 Retrieves the current 64-bit value for a PCD token number.
106 If the TokenNumber is invalid, the results are unpredictable.
108 @param[in] TokenNumber The PCD token number.
110 @return The UINT64 value.
115 (EFIAPI
*PCD_PPI_GET64
)(
120 Retrieves a pointer to a value for a given PCD token.
122 Retrieves the current pointer to the buffer for a PCD token number.
123 Do not make any assumptions about the alignment of the pointer that
124 is returned by this function call. If the TokenNumber is invalid,
125 the results are unpredictable.
127 @param[in] TokenNumber The PCD token number.
129 @return The pointer to the buffer to be retrieved.
134 (EFIAPI
*PCD_PPI_GET_POINTER
)(
139 Retrieves a Boolean value for a given PCD token.
141 Retrieves the current boolean value for a PCD token number.
142 Do not make any assumptions about the alignment of the pointer that
143 is returned by this function call. If the TokenNumber is invalid,
144 the results are unpredictable.
146 @param[in] TokenNumber The PCD token number.
148 @return The Boolean value.
153 (EFIAPI
*PCD_PPI_GET_BOOLEAN
)(
158 Retrieves the size of the value for a given PCD token.
160 Retrieves the current size of a particular PCD token.
161 If the TokenNumber is invalid, the results are unpredictable.
163 @param[in] TokenNumber The PCD token number.
165 @return The size of the value for the PCD token.
170 (EFIAPI
*PCD_PPI_GET_SIZE
)(
175 Retrieves an 8-bit value for a given PCD token and token space.
177 Retrieves the 8-bit value of a particular PCD token.
178 If the TokenNumber is invalid or the token space
179 specified by Guid does not exist, the results are
182 @param[in] Guid The token space for the token number.
183 @param[in] TokenNumber The PCD token number.
185 @return The size 8-bit value for the PCD token.
190 (EFIAPI
*PCD_PPI_GET_EX_8
)(
191 IN CONST EFI_GUID
*Guid
,
196 Retrieves a 16-bit value for a given PCD token and token space.
198 Retrieves the 16-bit value of a particular PCD token.
199 If the TokenNumber is invalid or the token space
200 specified by Guid does not exist, the results are
203 @param[in] Guid The token space for the token number.
204 @param[in] TokenNumber The PCD token number.
206 @return The size 16-bit value for the PCD token.
211 (EFIAPI
*PCD_PPI_GET_EX_16
)(
212 IN CONST EFI_GUID
*Guid
,
217 Retrieves a 32-bit value for a given PCD token and token space.
219 Retrieves the 32-bit value of a particular PCD token.
220 If the TokenNumber is invalid or the token space
221 specified by Guid does not exist, the results are
224 @param[in] Guid The token space for the token number.
225 @param[in] TokenNumber The PCD token number.
227 @return The size 32-bit value for the PCD token.
232 (EFIAPI
*PCD_PPI_GET_EX_32
)(
233 IN CONST EFI_GUID
*Guid
,
238 Retrieves a 64-bit value for a given PCD token and token space.
240 Retrieves the 64-bit value of a particular PCD token.
241 If the TokenNumber is invalid or the token space
242 specified by Guid does not exist, the results are
245 @param[in] Guid The token space for the token number.
246 @param[in] TokenNumber The PCD token number.
248 @return The size 64-bit value for the PCD token.
253 (EFIAPI
*PCD_PPI_GET_EX_64
)(
254 IN CONST EFI_GUID
*Guid
,
259 Retrieves a pointer to a value for a given PCD token and token space.
261 Retrieves the current pointer to the buffer for a PCD token number.
262 Do not make any assumptions about the alignment of the pointer that
263 is returned by this function call. If the TokenNumber is invalid,
264 the results are unpredictable.
266 @param[in] Guid The token space for the token number.
267 @param[in] TokenNumber The PCD token number.
269 @return The pointer to the buffer to be retrieved.
274 (EFIAPI
*PCD_PPI_GET_EX_POINTER
)(
275 IN CONST EFI_GUID
*Guid
,
280 Retrieves an Boolean value for a given PCD token and token space.
282 Retrieves the Boolean value of a particular PCD token.
283 If the TokenNumber is invalid or the token space
284 specified by Guid does not exist, the results are
287 @param[in] Guid The token space for the token number.
288 @param[in] TokenNumber The PCD token number.
290 @return The size Boolean value for the PCD token.
295 (EFIAPI
*PCD_PPI_GET_EX_BOOLEAN
)(
296 IN CONST EFI_GUID
*Guid
,
301 Retrieves the size of the value for a given PCD token and token space.
303 Retrieves the current size of a particular PCD token.
304 If the TokenNumber is invalid, the results are unpredictable.
306 @param[in] Guid The token space for the token number.
307 @param[in] TokenNumber The PCD token number.
309 @return The size of the value for the PCD token.
314 (EFIAPI
*PCD_PPI_GET_EX_SIZE
)(
315 IN CONST EFI_GUID
*Guid
,
320 Sets an 8-bit value for a given PCD token.
322 When the PCD service sets a value, it will check to ensure that the
323 size of the value being set is compatible with the Token's existing definition.
324 If it is not, an error will be returned.
326 @param[in] TokenNumber The PCD token number.
327 @param[in] Value The value to set for the PCD token.
329 @retval EFI_SUCCESS The procedure returned successfully.
330 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
331 being set was incompatible with a call to this function.
332 Use GetSize() to retrieve the size of the target data.
333 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
338 (EFIAPI
*PCD_PPI_SET8
)(
339 IN UINTN TokenNumber
,
344 Sets a 16-bit value for a given PCD token.
346 When the PCD service sets a value, it will check to ensure that the
347 size of the value being set is compatible with the Token's existing definition.
348 If it is not, an error will be returned.
350 @param[in] TokenNumber The PCD token number.
351 @param[in] Value The value to set for the PCD token.
353 @retval EFI_SUCCESS The procedure returned successfully.
354 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
355 being set was incompatible with a call to this function.
356 Use GetSize() to retrieve the size of the target data.
357 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
362 (EFIAPI
*PCD_PPI_SET16
)(
363 IN UINTN TokenNumber
,
368 Sets a 32-bit value for a given PCD token.
370 When the PCD service sets a value, it will check to ensure that the
371 size of the value being set is compatible with the Token's existing definition.
372 If it is not, an error will be returned.
374 @param[in] TokenNumber The PCD token number.
375 @param[in] Value The value to set for the PCD token.
377 @retval EFI_SUCCESS The procedure returned successfully.
378 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
379 being set was incompatible with a call to this function.
380 Use GetSize() to retrieve the size of the target data.
381 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
386 (EFIAPI
*PCD_PPI_SET32
)(
387 IN UINTN TokenNumber
,
392 Sets a 64-bit value for a given PCD token.
394 When the PCD service sets a value, it will check to ensure that the
395 size of the value being set is compatible with the Token's existing definition.
396 If it is not, an error will be returned.
398 @param[in] TokenNumber The PCD token number.
399 @param[in] Value The value to set for the PCD token.
401 @retval EFI_SUCCESS The procedure returned successfully.
402 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
403 being set was incompatible with a call to this function.
404 Use GetSize() to retrieve the size of the target data.
405 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
410 (EFIAPI
*PCD_PPI_SET64
)(
411 IN UINTN TokenNumber
,
416 Sets a value of a specified size for a given PCD token.
418 When the PCD service sets a value, it will check to ensure that the
419 size of the value being set is compatible with the Token's existing definition.
420 If it is not, an error will be returned.
422 @param[in] TokenNumber The PCD token number.
423 @param[in, out] SizeOfValue A pointer to the length of the value being set for the PCD token.
424 On input, if the SizeOfValue is greater than the maximum size supported
425 for this TokenNumber then the output value of SizeOfValue will reflect
426 the maximum size supported for this TokenNumber.
427 @param[in] Buffer The buffer to set for the PCD token.
429 @retval EFI_SUCCESS The procedure returned successfully.
430 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
431 being set was incompatible with a call to this function.
432 Use GetSize() to retrieve the size of the target data.
433 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
438 (EFIAPI
*PCD_PPI_SET_POINTER
)(
439 IN UINTN TokenNumber
,
440 IN OUT UINTN
*SizeOfValue
,
445 Sets an Boolean value for a given PCD token.
447 When the PCD service sets a value, it will check to ensure that the
448 size of the value being set is compatible with the Token's existing definition.
449 If it is not, an error will be returned.
451 @param[in] TokenNumber The PCD token number.
452 @param[in] Value The value to set for the PCD token.
454 @retval EFI_SUCCESS The procedure returned successfully.
455 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
456 being set was incompatible with a call to this function.
457 Use GetSize() to retrieve the size of the target data.
458 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
463 (EFIAPI
*PCD_PPI_SET_BOOLEAN
)(
464 IN UINTN TokenNumber
,
469 Sets an 8-bit value for a given PCD token.
471 When the PCD service sets a value, it will check to ensure that the
472 size of the value being set is compatible with the Token's existing definition.
473 If it is not, an error will be returned.
475 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
476 @param[in] TokenNumber The PCD token number.
477 @param[in] Value The value to set for the PCD token.
479 @retval EFI_SUCCESS The procedure returned successfully.
480 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
481 being set was incompatible with a call to this function.
482 Use GetSize() to retrieve the size of the target data.
483 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
488 (EFIAPI
*PCD_PPI_SET_EX_8
)(
489 IN CONST EFI_GUID
*Guid
,
490 IN UINTN TokenNumber
,
495 Sets a 16-bit value for a given PCD token.
497 When the PCD service sets a value, it will check to ensure that the
498 size of the value being set is compatible with the Token's existing definition.
499 If it is not, an error will be returned.
501 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
502 @param[in] TokenNumber The PCD token number.
503 @param[in] Value The value to set for the PCD token.
505 @retval EFI_SUCCESS The procedure returned successfully.
506 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
507 being set was incompatible with a call to this function.
508 Use GetSize() to retrieve the size of the target data.
509 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
514 (EFIAPI
*PCD_PPI_SET_EX_16
)(
515 IN CONST EFI_GUID
*Guid
,
516 IN UINTN TokenNumber
,
521 Sets a 32-bit value for a given PCD token.
523 When the PCD service sets a value, it will check to ensure that the
524 size of the value being set is compatible with the Token's existing definition.
525 If it is not, an error will be returned.
527 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
528 @param[in] TokenNumber The PCD token number.
529 @param[in] Value The value to set for the PCD token.
531 @retval EFI_SUCCESS The procedure returned successfully.
532 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
533 being set was incompatible with a call to this function.
534 Use GetSize() to retrieve the size of the target data.
535 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
540 (EFIAPI
*PCD_PPI_SET_EX_32
)(
541 IN CONST EFI_GUID
*Guid
,
542 IN UINTN TokenNumber
,
547 Sets a 64-bit value for a given PCD token.
549 When the PCD service sets a value, it will check to ensure that the
550 size of the value being set is compatible with the Token's existing definition.
551 If it is not, an error will be returned.
553 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
554 @param[in] TokenNumber The PCD token number.
555 @param[in] Value The value to set for the PCD token.
557 @retval EFI_SUCCESS The procedure returned successfully.
558 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
559 being set was incompatible with a call to this function.
560 Use GetSize() to retrieve the size of the target data.
561 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
566 (EFIAPI
*PCD_PPI_SET_EX_64
)(
567 IN CONST EFI_GUID
*Guid
,
568 IN UINTN TokenNumber
,
573 Sets a value of a specified size for a given PCD token.
575 When the PCD service sets a value, it will check to ensure that the
576 size of the value being set is compatible with the Token's existing definition.
577 If it is not, an error will be returned.
579 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
580 @param[in] TokenNumber The PCD token number.
581 @param[in, out] SizeOfValue A pointer to the length of the value being set for the PCD token.
582 On input, if the SizeOfValue is greater than the maximum size supported
583 for this TokenNumber then the output value of SizeOfValue will reflect
584 the maximum size supported for this TokenNumber.
585 @param[in] Buffer The buffer to set for the PCD token.
587 @retval EFI_SUCCESS The procedure returned successfully.
588 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
589 being set was incompatible with a call to this function.
590 Use GetSize() to retrieve the size of the target data.
591 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
596 (EFIAPI
*PCD_PPI_SET_EX_POINTER
)(
597 IN CONST EFI_GUID
*Guid
,
598 IN UINTN TokenNumber
,
599 IN OUT UINTN
*SizeOfValue
,
604 Sets an Boolean value for a given PCD token.
606 When the PCD service sets a value, it will check to ensure that the
607 size of the value being set is compatible with the Token's existing definition.
608 If it is not, an error will be returned.
610 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
611 @param[in] TokenNumber The PCD token number.
612 @param[in] Value The value to set for the PCD token.
614 @retval EFI_SUCCESS The procedure returned successfully.
615 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
616 being set was incompatible with a call to this function.
617 Use GetSize() to retrieve the size of the target data.
618 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
623 (EFIAPI
*PCD_PPI_SET_EX_BOOLEAN
)(
624 IN CONST EFI_GUID
*Guid
,
625 IN UINTN TokenNumber
,
630 Callback on SET function prototype definition.
632 This notification function serves two purposes. Firstly, it notifies the module
633 which did the registration that the value of this PCD token has been set. Secondly,
634 it provides a mechanism for the module which did the registration to intercept the set
635 operation and override the value been set if necessary. After the invocation of the
636 callback function, TokenData will be used by PCD service PEIM to modify the internal data
639 @param[in] CallBackGuid The PCD token GUID being set.
640 @param[in] CallBackToken The PCD token number being set.
641 @param[in, out] TokenData A pointer to the token data being set.
642 @param[in] TokenDataSize The size, in bytes, of the data being set.
649 (EFIAPI
*PCD_PPI_CALLBACK
)(
650 IN CONST EFI_GUID
*CallBackGuid OPTIONAL
,
651 IN UINTN CallBackToken
,
652 IN OUT VOID
*TokenData
,
653 IN UINTN TokenDataSize
657 Specifies a function to be called anytime the value of a designated token is changed.
659 @param[in] TokenNumber The PCD token number.
660 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
661 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
663 @retval EFI_SUCCESS The PCD service has successfully established a call event
664 for the CallBackToken requested.
665 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
670 (EFIAPI
*PCD_PPI_CALLBACK_ONSET
)(
671 IN CONST EFI_GUID
*Guid OPTIONAL
,
672 IN UINTN TokenNumber
,
673 IN PCD_PPI_CALLBACK CallBackFunction
677 Cancels a previously set callback function for a particular PCD token number.
679 @param[in] TokenNumber The PCD token number.
680 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
681 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
683 @retval EFI_SUCCESS The PCD service has successfully established a call event
684 for the CallBackToken requested.
685 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
690 (EFIAPI
*PCD_PPI_CANCEL_CALLBACK
)(
691 IN CONST EFI_GUID
*Guid OPTIONAL
,
692 IN UINTN TokenNumber
,
693 IN PCD_PPI_CALLBACK CallBackFunction
697 Retrieves the next valid token number in a given namespace.
699 This is useful since the PCD infrastructure contains a sparse list of token numbers,
700 and one cannot a priori know what token numbers are valid in the database.
702 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
703 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
704 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
705 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
706 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
707 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
708 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
709 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
712 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
713 This is an optional parameter that may be NULL. If this parameter is NULL, then a request
714 is being made to retrieve tokens from the default token space.
715 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
717 @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
718 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
723 (EFIAPI
*PCD_PPI_GET_NEXT_TOKEN
)(
724 IN CONST EFI_GUID
*Guid OPTIONAL
,
725 IN OUT UINTN
*TokenNumber
729 Retrieves the next valid PCD token namespace for a given namespace.
731 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
732 token namespaces on a platform.
734 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
735 namespace from which the search will start. On output, it designates the next valid
736 token namespace on the platform. If *Guid is NULL, then the GUID of the first token
737 space of the current platform is returned. If the search cannot locate the next valid
738 token namespace, an error is returned and the value of *Guid is undefined.
740 @retval EFI_SUCCESS The PCD service retrieved the value requested.
741 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
746 (EFIAPI
*PCD_PPI_GET_NEXT_TOKENSPACE
)(
747 IN OUT CONST EFI_GUID
**Guid
751 /// This service abstracts the ability to set/get Platform Configuration Database (PCD).
754 PCD_PPI_SET_SKU SetSku
;
760 PCD_PPI_GET_POINTER GetPtr
;
761 PCD_PPI_GET_BOOLEAN GetBool
;
762 PCD_PPI_GET_SIZE GetSize
;
764 PCD_PPI_GET_EX_8 Get8Ex
;
765 PCD_PPI_GET_EX_16 Get16Ex
;
766 PCD_PPI_GET_EX_32 Get32Ex
;
767 PCD_PPI_GET_EX_64 Get64Ex
;
768 PCD_PPI_GET_EX_POINTER GetPtrEx
;
769 PCD_PPI_GET_EX_BOOLEAN GetBoolEx
;
770 PCD_PPI_GET_EX_SIZE GetSizeEx
;
776 PCD_PPI_SET_POINTER SetPtr
;
777 PCD_PPI_SET_BOOLEAN SetBool
;
779 PCD_PPI_SET_EX_8 Set8Ex
;
780 PCD_PPI_SET_EX_16 Set16Ex
;
781 PCD_PPI_SET_EX_32 Set32Ex
;
782 PCD_PPI_SET_EX_64 Set64Ex
;
783 PCD_PPI_SET_EX_POINTER SetPtrEx
;
784 PCD_PPI_SET_EX_BOOLEAN SetBoolEx
;
786 PCD_PPI_CALLBACK_ONSET CallbackOnSet
;
787 PCD_PPI_CANCEL_CALLBACK CancelCallback
;
788 PCD_PPI_GET_NEXT_TOKEN GetNextToken
;
789 PCD_PPI_GET_NEXT_TOKENSPACE GetNextTokenSpace
;
792 extern EFI_GUID gPcdPpiGuid
;