2 PCD Library Class Interface Declarations
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
23 #define PcdToken(TokenName) _PCD_TOKEN_##TokenName
27 // Feature Flag is in the form of a global constant
29 #define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName
33 // Fixed is fixed at build time
35 #define FixedPcdGet8(TokenName) _PCD_VALUE_##TokenName
36 #define FixedPcdGet16(TokenName) _PCD_VALUE_##TokenName
37 #define FixedPcdGet32(TokenName) _PCD_VALUE_##TokenName
38 #define FixedPcdGet64(TokenName) _PCD_VALUE_##TokenName
39 #define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName
42 #define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName)
46 // (Binary) Patch is in the form of a global variable
48 #define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
49 #define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
50 #define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
51 #define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
52 #define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
53 #define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
55 #define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
56 #define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
57 #define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
58 #define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
59 #define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
60 #define PatchPcdSetPtr(TokenName, Size, Buffer) \
62 _gPcd_BinaryPatch_##TokenName, \
63 (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
69 // Dynamic is via the protocol with only the TokenNumber as argument
70 // It can also be Patch or Fixed type based on a build option
72 #define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName
73 #define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName
74 #define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
75 #define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName
76 #define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName
77 #define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName
82 #define PcdSet8(TokenName, Value) _PCD_SET_MODE_8_##TokenName ((Value))
83 #define PcdSet16(TokenName, Value) _PCD_SET_MODE_16_##TokenName ((Value))
84 #define PcdSet32(TokenName, Value) _PCD_SET_MODE_32_##TokenName ((Value))
85 #define PcdSet64(TokenName, Value) _PCD_SET_MODE_64_##TokenName ((Value))
86 #define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \
87 _PCD_SET_MODE_PTR_##TokenName ((SizeOfBuffer), (Buffer))
88 #define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))
91 // Dynamic Ex is to support binary distribution
93 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), _PCD_TOKEN_##TokenName)
94 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), _PCD_TOKEN_##TokenName)
95 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), _PCD_TOKEN_##TokenName)
96 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), _PCD_TOKEN_##TokenName)
97 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), _PCD_TOKEN_##TokenName)
98 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)
103 #define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), _PCD_TOKEN_##TokenName, (Value))
104 #define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), _PCD_TOKEN_##TokenName, (Value))
105 #define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), _PCD_TOKEN_##TokenName, (Value))
106 #define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), _PCD_TOKEN_##TokenName, (Value))
107 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
108 LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))
109 #define PcdSetExBool(Guid, TokenName, Value) \
110 LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))
114 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
116 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
117 set values associated with a PCD token.
119 @retval SKU_ID Return the SKU ID that just be set.
130 Returns the 8-bit value for the token specified by TokenNumber.
132 @param[in] The PCD token number to retrieve a current value for.
134 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
145 Returns the 16-bit value for the token specified by TokenNumber.
147 @param[in] The PCD token number to retrieve a current value for.
149 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
160 Returns the 32-bit value for the token specified by TokenNumber.
162 @param[in] TokenNumber The PCD token number to retrieve a current value for.
164 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
175 Returns the 64-bit value for the token specified by TokenNumber.
177 @param[in] TokenNumber The PCD token number to retrieve a current value for.
179 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
190 Returns the pointer to the buffer of the token specified by TokenNumber.
192 @param[in] TokenNumber The PCD token number to retrieve a current value for.
194 @retval VOID* Returns the pointer to the token specified by TokenNumber.
205 Returns the Boolean value of the token specified by TokenNumber.
207 @param[in] TokenNumber The PCD token number to retrieve a current value for.
209 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
220 Returns the size of the token specified by TokenNumber.
222 @param[in] TokenNumber The PCD token number to retrieve a current value for.
224 @retval UINTN Returns the size of the token specified by TokenNumber.
235 Returns the 8-bit value for the token specified by TokenNumber and Guid.
236 If Guid is NULL, then ASSERT().
238 @param[in] Guid Pointer to a 128-bit unique value that designates
239 which namespace to retrieve a value from.
240 @param[in] TokenNumber The PCD token number to retrieve a current value for.
242 @retval UINT8 Return the UINT8.
254 Returns the 16-bit value for the token specified by TokenNumber and Guid.
255 If Guid is NULL, then ASSERT().
257 @param[in] Guid Pointer to a 128-bit unique value that designates
258 which namespace to retrieve a value from.
259 @param[in] TokenNumber The PCD token number to retrieve a current value for.
261 @retval UINT16 Return the UINT16.
273 Returns the 32-bit value for the token specified by TokenNumber and Guid.
274 If Guid is NULL, then ASSERT().
276 @param[in] Guid Pointer to a 128-bit unique value that designates
277 which namespace to retrieve a value from.
278 @param[in] TokenNumber The PCD token number to retrieve a current value for.
280 @retval UINT32 Return the UINT32.
292 Returns the 64-bit value for the token specified by TokenNumber and Guid.
293 If Guid is NULL, then ASSERT().
295 @param[in] Guid Pointer to a 128-bit unique value that designates
296 which namespace to retrieve a value from.
297 @param[in] TokenNumber The PCD token number to retrieve a current value for.
299 @retval UINT64 Return the UINT64.
311 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
312 If Guid is NULL, then ASSERT().
314 @param[in] Guid Pointer to a 128-bit unique value that designates
315 which namespace to retrieve a value from.
316 @param[in] TokenNumber The PCD token number to retrieve a current value for.
318 @retval VOID* Return the VOID* pointer.
330 Returns the Boolean value of the token specified by TokenNumber and Guid.
331 If Guid is NULL, then ASSERT().
333 @param[in] Guid Pointer to a 128-bit unique value that designates
334 which namespace to retrieve a value from.
335 @param[in] TokenNumber The PCD token number to retrieve a current value for.
337 @retval BOOLEAN Return the BOOLEAN.
349 Returns the size of the token specified by TokenNumber and Guid.
350 If Guid is NULL, then ASSERT().
352 @param[in] Guid Pointer to a 128-bit unique value that designates
353 which namespace to retrieve a value from.
354 @param[in] TokenNumber The PCD token number to retrieve a current value for.
356 @retval UINTN Return the size.
368 Sets the 8-bit value for the token specified by TokenNumber
369 to the value specified by Value. Value is returned.
371 @param[in] TokenNumber The PCD token number to set a current value for.
372 @param[in] Value The 8-bit value to set.
374 @retval UINT8 Return the value been set.
380 IN UINTN TokenNumber
,
386 Sets the 16-bit value for the token specified by TokenNumber
387 to the value specified by Value. Value is returned.
389 @param[in] TokenNumber The PCD token number to set a current value for.
390 @param[in] Value The 16-bit value to set.
392 @retval UINT16 Return the value been set.
398 IN UINTN TokenNumber
,
404 Sets the 32-bit value for the token specified by TokenNumber
405 to the value specified by Value. Value is returned.
407 @param[in] TokenNumber The PCD token number to set a current value for.
408 @param[in] Value The 32-bit value to set.
410 @retval UINT32 Return the value been set.
416 IN UINTN TokenNumber
,
422 Sets the 64-bit value for the token specified by TokenNumber
423 to the value specified by Value. Value is returned.
425 @param[in] TokenNumber The PCD token number to set a current value for.
426 @param[in] Value The 64-bit value to set.
428 @retval UINT64 Return the value been set.
434 IN UINTN TokenNumber
,
440 Sets a buffer for the token specified by TokenNumber to the value
441 specified by Buffer and SizeOfValue. Buffer is returned.
442 If SizeOfValue is greater than the maximum size support by TokenNumber,
443 then set SizeOfValue to the maximum size supported by TokenNumber and
444 return NULL to indicate that the set operation was not actually performed.
446 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to the
447 maximum size supported by TokenName and NULL must be returned.
449 If SizeOfValue is NULL, then ASSERT().
450 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
452 @param[in] TokenNumber The PCD token number to set a current value for.
453 @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
454 @param[in] Value A pointer to the buffer to set.
456 @retval VOID* Return the pointer for the buffer been set.
462 IN UINTN TokenNumber
,
463 IN OUT UINTN
*SizeOfBuffer
,
469 Sets the Boolean value for the token specified by TokenNumber
470 to the value specified by Value. Value is returned.
472 @param[in] TokenNumber The PCD token number to set a current value for.
473 @param[in] Value The boolean value to set.
475 @retval BOOLEAN Return the value been set.
481 IN UINTN TokenNumber
,
487 Sets the 8-bit value for the token specified by TokenNumber and
488 Guid to the value specified by Value. Value is returned.
489 If Guid is NULL, then ASSERT().
491 @param[in] Guid Pointer to a 128-bit unique value that
492 designates which namespace to set a value from.
493 @param[in] TokenNumber The PCD token number to set a current value for.
494 @param[in] Value The 8-bit value to set.
496 @retval UINT8 Return the value been set.
503 IN UINTN TokenNumber
,
509 Sets the 16-bit value for the token specified by TokenNumber and
510 Guid to the value specified by Value. Value is returned.
511 If Guid is NULL, then ASSERT().
513 @param[in] Guid Pointer to a 128-bit unique value that
514 designates which namespace to set a value from.
515 @param[in] TokenNumber The PCD token number to set a current value for.
516 @param[in] Value The 16-bit value to set.
518 @retval UINT8 Return the value been set.
525 IN UINTN TokenNumber
,
531 Sets the 32-bit value for the token specified by TokenNumber and
532 Guid to the value specified by Value. Value is returned.
533 If Guid is NULL, then ASSERT().
535 @param[in] Guid Pointer to a 128-bit unique value that
536 designates which namespace to set a value from.
537 @param[in] TokenNumber The PCD token number to set a current value for.
538 @param[in] Value The 32-bit value to set.
540 @retval UINT32 Return the value been set.
547 IN UINTN TokenNumber
,
553 Sets the 64-bit value for the token specified by TokenNumber and
554 Guid to the value specified by Value. Value is returned.
555 If Guid is NULL, then ASSERT().
557 @param[in] Guid Pointer to a 128-bit unique value that
558 designates which namespace to set a value from.
559 @param[in] TokenNumber The PCD token number to set a current value for.
560 @param[in] Value The 64-bit value to set.
562 @retval UINT64 Return the value been set.
569 IN UINTN TokenNumber
,
575 Sets a buffer for the token specified by TokenNumber to the value specified by
576 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
577 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
578 supported by TokenNumber and return NULL to indicate that the set operation
579 was not actually performed.
581 If Guid is NULL, then ASSERT().
582 If SizeOfValue is NULL, then ASSERT().
583 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
585 @param[in] Guid Pointer to a 128-bit unique value that
586 designates which namespace to set a value from.
587 @param[in] TokenNumber The PCD token number to set a current value for.
588 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
589 @param[in] Buffer A pointer to the buffer to set.
591 @retval VOID * Return the pinter to the buffer been set.
598 IN UINTN TokenNumber
,
599 IN OUT UINTN
*SizeOfBuffer
,
605 Sets the Boolean value for the token specified by TokenNumber and
606 Guid to the value specified by Value. Value is returned.
607 If Guid is NULL, then ASSERT().
609 @param[in] Guid Pointer to a 128-bit unique value that
610 designates which namespace to set a value from.
611 @param[in] TokenNumber The PCD token number to set a current value for.
612 @param[in] Value The Boolean value to set.
614 @retval Boolean Return the value been set.
621 IN UINTN TokenNumber
,
627 When the token specified by TokenNumber and Guid is set,
628 then notification function specified by NotificationFunction is called.
629 If Guid is NULL, then the default token space is used.
630 If NotificationFunction is NULL, then ASSERT().
632 This notification function serves two purposes. Firstly, it notifies the module which
633 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
635 the set operation and override the value been set if necessary. After the invocation
636 of the callback function, TokenData will be used by PCD service PEIM or driver to
637 modify the internal data in PCD database.
640 @param[in] CallBackGuid The PCD token GUID being set.
641 @param[in] CallBackToken The PCD token number being set.
642 @param[in, out] TokenData A pointer to the token data being set.
643 @param[in] TokenDataSize The size, in bytes, of the data being set.
650 (EFIAPI
*PCD_CALLBACK
) (
651 IN CONST GUID
*CallBackGuid
, OPTIONAL
652 IN UINTN CallBackToken
,
653 IN OUT VOID
*TokenData
,
654 IN UINTN TokenDataSize
659 When the token specified by TokenNumber and Guid is set,
660 then notification function specified by NotificationFunction is called.
661 If Guid is NULL, then the default token space is used.
662 If NotificationFunction is NULL, then ASSERT().
664 @param[in] Guid Pointer to a 128-bit unique value that designates which
665 namespace to set a value from. If NULL, then the default
667 @param[in] TokenNumber The PCD token number to monitor.
668 @param[in] NotificationFunction The function to call when the token
669 specified by Guid and TokenNumber is set.
676 LibPcdCallbackOnSet (
677 IN CONST GUID
*Guid
, OPTIONAL
678 IN UINTN TokenNumber
,
679 IN PCD_CALLBACK NotificationFunction
684 Disable a notification function that was established with LibPcdCallbackonSet().
686 @param[in] Guid Specify the GUID token space.
687 @param[in] TokenNumber Specify the token number.
688 @param[in] NotificationFunction The callback function to be unregistered.
695 LibPcdCancelCallback (
696 IN CONST GUID
*Guid
, OPTIONAL
697 IN UINTN TokenNumber
,
698 IN PCD_CALLBACK NotificationFunction
703 Retrieves the next PCD token number from the token space specified by Guid.
704 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
705 then the first token number is returned. Otherwise, the token number that
706 follows TokenNumber in the token space is returned. If TokenNumber is the last
707 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
708 is not in the token space specified by Guid, then ASSERT().
710 @param[in] Pointer to a 128-bit unique value that designates which namespace
711 to set a value from. If NULL, then the default token space is used.
712 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
715 @retval UINTN The next valid token number.
721 IN CONST GUID
*Guid
, OPTIONAL
728 Retrieves the next PCD token space from a token space specified by Guid.
729 Guid of NULL is reserved to mark the default local token namespace on the current
730 platform. If Guid is NULL, then the GUID of the first non-local token space of the
731 current platform is returned. If Guid is the last non-local token space,
732 then NULL is returned.
734 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
738 @param[in] Guid Pointer to a 128-bit unique value that designates from which namespace
741 @retval CONST GUID * The next valid token namespace.
746 LibPcdGetNextTokenSpace (
752 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
753 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
754 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
755 NULL to indicate that the set operation was not actually performed.
756 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
757 MaximumDatumSize and NULL must be returned.
759 If PatchVariable is NULL, then ASSERT().
760 If SizeOfValue is NULL, then ASSERT().
761 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
763 @param[in] PatchVariable A pointer to the global variable in a module that is
764 the target of the set operation.
765 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
766 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
767 @param[in] Buffer A pointer to the buffer to used to set the target variable.
773 IN VOID
*PatchVariable
,
774 IN UINTN MaximumDatumSize
,
775 IN OUT UINTN
*SizeOfBuffer
,
776 IN CONST VOID
*Buffer