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) \
61 CopyMem (_gPcd_BinaryPatch_##TokenName, (Buffer), (Size))
64 // Dynamic is via the protocol with only the TokenNumber as argument
65 // It can also be Patch or Fixed type based on a build option
67 #define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName
68 #define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName
69 #define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
70 #define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName
71 #define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName
72 #define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName
77 #define PcdSet8(TokenName, Value) _PCD_SET_MODE_8_##TokenName ((Value))
78 #define PcdSet16(TokenName, Value) _PCD_SET_MODE_16_##TokenName ((Value))
79 #define PcdSet32(TokenName, Value) _PCD_SET_MODE_32_##TokenName ((Value))
80 #define PcdSet64(TokenName, Value) _PCD_SET_MODE_64_##TokenName ((Value))
81 #define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \
82 _PCD_SET_MODE_PTR_##TokenName ((SizeOfBuffer), (Buffer))
83 #define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))
86 // Dynamic Ex is to support binary distribution
88 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), _PCD_TOKEN_##TokenName)
89 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), _PCD_TOKEN_##TokenName)
90 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), _PCD_TOKEN_##TokenName)
91 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), _PCD_TOKEN_##TokenName)
92 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), _PCD_TOKEN_##TokenName)
93 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)
98 #define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), _PCD_TOKEN_##TokenName, (Value))
99 #define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), _PCD_TOKEN_##TokenName, (Value))
100 #define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), _PCD_TOKEN_##TokenName, (Value))
101 #define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), _PCD_TOKEN_##TokenName, (Value))
102 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
103 LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))
104 #define PcdSetExBool(Guid, TokenName, Value) \
105 LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))
109 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
111 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
112 set values associated with a PCD token.
114 @retval SKU_ID Return the SKU ID that just be set.
125 Returns the 8-bit value for the token specified by TokenNumber.
127 @param[in] The PCD token number to retrieve a current value for.
129 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
140 Returns the 16-bit value for the token specified by TokenNumber.
142 @param[in] The PCD token number to retrieve a current value for.
144 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
155 Returns the 32-bit value for the token specified by TokenNumber.
157 @param[in] TokenNumber The PCD token number to retrieve a current value for.
159 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
170 Returns the 64-bit value for the token specified by TokenNumber.
172 @param[in] TokenNumber The PCD token number to retrieve a current value for.
174 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
185 Returns the pointer to the buffer of the token specified by TokenNumber.
187 @param[in] TokenNumber The PCD token number to retrieve a current value for.
189 @retval VOID* Returns the pointer to the token specified by TokenNumber.
200 Returns the Boolean value of the token specified by TokenNumber.
202 @param[in] TokenNumber The PCD token number to retrieve a current value for.
204 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
215 Returns the size of the token specified by TokenNumber.
217 @param[in] TokenNumber The PCD token number to retrieve a current value for.
219 @retval UINTN Returns the size of the token specified by TokenNumber.
230 Returns the 8-bit value for the token specified by TokenNumber and Guid.
231 If Guid is NULL, then ASSERT().
233 @param[in] Guid Pointer to a 128-bit unique value that designates
234 which namespace to retrieve a value from.
235 @param[in] TokenNumber The PCD token number to retrieve a current value for.
237 @retval UINT8 Return the UINT8.
249 Returns the 16-bit value for the token specified by TokenNumber and Guid.
250 If Guid is NULL, then ASSERT().
252 @param[in] Guid Pointer to a 128-bit unique value that designates
253 which namespace to retrieve a value from.
254 @param[in] TokenNumber The PCD token number to retrieve a current value for.
256 @retval UINT16 Return the UINT16.
268 Returns the 32-bit value for the token specified by TokenNumber and Guid.
269 If Guid is NULL, then ASSERT().
271 @param[in] Guid Pointer to a 128-bit unique value that designates
272 which namespace to retrieve a value from.
273 @param[in] TokenNumber The PCD token number to retrieve a current value for.
275 @retval UINT32 Return the UINT32.
287 Returns the 64-bit value for the token specified by TokenNumber and Guid.
288 If Guid is NULL, then ASSERT().
290 @param[in] Guid Pointer to a 128-bit unique value that designates
291 which namespace to retrieve a value from.
292 @param[in] TokenNumber The PCD token number to retrieve a current value for.
294 @retval UINT64 Return the UINT64.
306 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
307 If Guid is NULL, then ASSERT().
309 @param[in] Guid Pointer to a 128-bit unique value that designates
310 which namespace to retrieve a value from.
311 @param[in] TokenNumber The PCD token number to retrieve a current value for.
313 @retval VOID* Return the VOID* pointer.
325 Returns the Boolean value of the token specified by TokenNumber and Guid.
326 If Guid is NULL, then ASSERT().
328 @param[in] Guid Pointer to a 128-bit unique value that designates
329 which namespace to retrieve a value from.
330 @param[in] TokenNumber The PCD token number to retrieve a current value for.
332 @retval BOOLEAN Return the BOOLEAN.
344 Returns the size of the token specified by TokenNumber and Guid.
345 If Guid is NULL, then ASSERT().
347 @param[in] Guid Pointer to a 128-bit unique value that designates
348 which namespace to retrieve a value from.
349 @param[in] TokenNumber The PCD token number to retrieve a current value for.
351 @retval UINTN Return the size.
363 Sets the 8-bit value for the token specified by TokenNumber
364 to the value specified by Value. Value is returned.
366 @param[in] TokenNumber The PCD token number to set a current value for.
367 @param[in] Value The 8-bit value to set.
369 @retval UINT8 Return the value been set.
375 IN UINTN TokenNumber
,
381 Sets the 16-bit value for the token specified by TokenNumber
382 to the value specified by Value. Value is returned.
384 @param[in] TokenNumber The PCD token number to set a current value for.
385 @param[in] Value The 16-bit value to set.
387 @retval UINT16 Return the value been set.
393 IN UINTN TokenNumber
,
399 Sets the 32-bit value for the token specified by TokenNumber
400 to the value specified by Value. Value is returned.
402 @param[in] TokenNumber The PCD token number to set a current value for.
403 @param[in] Value The 32-bit value to set.
405 @retval UINT32 Return the value been set.
411 IN UINTN TokenNumber
,
417 Sets the 64-bit value for the token specified by TokenNumber
418 to the value specified by Value. Value is returned.
420 @param[in] TokenNumber The PCD token number to set a current value for.
421 @param[in] Value The 64-bit value to set.
423 @retval UINT64 Return the value been set.
429 IN UINTN TokenNumber
,
435 Sets a buffer for the token specified by TokenNumber to the value
436 specified by Buffer and SizeOfValue. Buffer is returned.
437 If SizeOfValue is greater than the maximum size support by TokenNumber,
438 then set SizeOfValue to the maximum size supported by TokenNumber and
439 return NULL to indicate that the set operation was not actually performed.
441 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to the
442 maximum size supported by TokenName and NULL must be returned.
444 If SizeOfValue is NULL, then ASSERT().
445 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
447 @param[in] TokenNumber The PCD token number to set a current value for.
448 @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
449 @param[in] Value A pointer to the buffer to set.
451 @retval VOID* Return the pointer for the buffer been set.
457 IN UINTN TokenNumber
,
458 IN OUT UINTN
*SizeOfBuffer
,
464 Sets the Boolean value for the token specified by TokenNumber
465 to the value specified by Value. Value is returned.
467 @param[in] TokenNumber The PCD token number to set a current value for.
468 @param[in] Value The boolean value to set.
470 @retval BOOLEAN Return the value been set.
476 IN UINTN TokenNumber
,
482 Sets the 8-bit value for the token specified by TokenNumber and
483 Guid to the value specified by Value. Value is returned.
484 If Guid is NULL, then ASSERT().
486 @param[in] Guid Pointer to a 128-bit unique value that
487 designates which namespace to set a value from.
488 @param[in] TokenNumber The PCD token number to set a current value for.
489 @param[in] Value The 8-bit value to set.
491 @retval UINT8 Return the value been set.
498 IN UINTN TokenNumber
,
504 Sets the 16-bit value for the token specified by TokenNumber and
505 Guid to the value specified by Value. Value is returned.
506 If Guid is NULL, then ASSERT().
508 @param[in] Guid Pointer to a 128-bit unique value that
509 designates which namespace to set a value from.
510 @param[in] TokenNumber The PCD token number to set a current value for.
511 @param[in] Value The 16-bit value to set.
513 @retval UINT8 Return the value been set.
520 IN UINTN TokenNumber
,
526 Sets the 32-bit value for the token specified by TokenNumber and
527 Guid to the value specified by Value. Value is returned.
528 If Guid is NULL, then ASSERT().
530 @param[in] Guid Pointer to a 128-bit unique value that
531 designates which namespace to set a value from.
532 @param[in] TokenNumber The PCD token number to set a current value for.
533 @param[in] Value The 32-bit value to set.
535 @retval UINT32 Return the value been set.
542 IN UINTN TokenNumber
,
548 Sets the 64-bit value for the token specified by TokenNumber and
549 Guid to the value specified by Value. Value is returned.
550 If Guid is NULL, then ASSERT().
552 @param[in] Guid Pointer to a 128-bit unique value that
553 designates which namespace to set a value from.
554 @param[in] TokenNumber The PCD token number to set a current value for.
555 @param[in] Value The 64-bit value to set.
557 @retval UINT64 Return the value been set.
564 IN UINTN TokenNumber
,
570 Sets a buffer for the token specified by TokenNumber to the value specified by
571 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
572 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
573 supported by TokenNumber and return NULL to indicate that the set operation
574 was not actually performed.
576 If Guid is NULL, then ASSERT().
577 If SizeOfValue is NULL, then ASSERT().
578 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
580 @param[in] Guid Pointer to a 128-bit unique value that
581 designates which namespace to set a value from.
582 @param[in] TokenNumber The PCD token number to set a current value for.
583 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
584 @param[in] Buffer A pointer to the buffer to set.
586 @retval VOID * Return the pinter to the buffer been set.
593 IN UINTN TokenNumber
,
594 IN OUT UINTN
*SizeOfBuffer
,
600 Sets the Boolean value for the token specified by TokenNumber and
601 Guid to the value specified by Value. Value is returned.
602 If Guid is NULL, then ASSERT().
604 @param[in] Guid Pointer to a 128-bit unique value that
605 designates which namespace to set a value from.
606 @param[in] TokenNumber The PCD token number to set a current value for.
607 @param[in] Value The Boolean value to set.
609 @retval Boolean Return the value been set.
616 IN UINTN TokenNumber
,
622 When the token specified by TokenNumber and Guid is set,
623 then notification function specified by NotificationFunction is called.
624 If Guid is NULL, then the default token space is used.
625 If NotificationFunction is NULL, then ASSERT().
627 This notification function serves two purposes. Firstly, it notifies the module which
628 did the registration that the value of this PCD token has been set. Secondly,
629 it provides a mechanism for the module which did the registration to intercept
630 the set operation and override the value been set if necessary. After the invocation
631 of the callback function, TokenData will be used by PCD service PEIM or driver to
632 modify the internal data in PCD database.
635 @param[in] CallBackGuid The PCD token GUID being set.
636 @param[in] CallBackToken The PCD token number being set.
637 @param[in, out] TokenData A pointer to the token data being set.
638 @param[in] TokenDataSize The size, in bytes, of the data being set.
645 (EFIAPI
*PCD_CALLBACK
) (
646 IN CONST GUID
*CallBackGuid
, OPTIONAL
647 IN UINTN CallBackToken
,
648 IN OUT VOID
*TokenData
,
649 IN UINTN TokenDataSize
654 When the token specified by TokenNumber and Guid is set,
655 then notification function specified by NotificationFunction is called.
656 If Guid is NULL, then the default token space is used.
657 If NotificationFunction is NULL, then ASSERT().
659 @param[in] Guid Pointer to a 128-bit unique value that designates which
660 namespace to set a value from. If NULL, then the default
662 @param[in] TokenNumber The PCD token number to monitor.
663 @param[in] NotificationFunction The function to call when the token
664 specified by Guid and TokenNumber is set.
671 LibPcdCallbackOnSet (
672 IN CONST GUID
*Guid
, OPTIONAL
673 IN UINTN TokenNumber
,
674 IN PCD_CALLBACK NotificationFunction
679 Disable a notification function that was established with LibPcdCallbackonSet().
681 @param[in] Guid Specify the GUID token space.
682 @param[in] TokenNumber Specify the token number.
683 @param[in] NotificationFunction The callback function to be unregistered.
690 LibPcdCancelCallback (
691 IN CONST GUID
*Guid
, OPTIONAL
692 IN UINTN TokenNumber
,
693 IN PCD_CALLBACK NotificationFunction
698 Retrieves the next PCD token number from the token space specified by Guid.
699 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
700 then the first token number is returned. Otherwise, the token number that
701 follows TokenNumber in the token space is returned. If TokenNumber is the last
702 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
703 is not in the token space specified by Guid, then ASSERT().
705 @param[in] Pointer to a 128-bit unique value that designates which namespace
706 to set a value from. If NULL, then the default token space is used.
707 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
710 @retval UINTN The next valid token number.
716 IN CONST GUID
*Guid
, OPTIONAL
723 Retrieves the next PCD token space from a token space specified by Guid.
724 Guid of NULL is reserved to mark the default local token namespace on the current
725 platform. If Guid is NULL, then the GUID of the first non-local token space of the
726 current platform is returned. If Guid is the last non-local token space,
727 then NULL is returned.
729 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
733 @param[in] Guid Pointer to a 128-bit unique value that designates from which namespace
736 @retval CONST GUID * The next valid token namespace.
741 LibPcdGetNextTokenSpace (
747 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
748 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
749 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
750 NULL to indicate that the set operation was not actually performed.
751 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
752 MaximumDatumSize and NULL must be returned.
754 If PatchVariable is NULL, then ASSERT().
755 If SizeOfValue is NULL, then ASSERT().
756 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
758 @param[in] PatchVariable A pointer to the global variable in a module that is
759 the target of the set operation.
760 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
761 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
762 @param[in] Buffer A pointer to the buffer to used to set the target variable.
768 IN VOID
*PatchVariable
,
769 IN UINTN MaximumDatumSize
,
770 IN OUT UINTN
*SizeOfBuffer
,
771 IN CONST VOID
*Buffer