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 #include <Common/Pcd.h>
24 #define PcdToken(TokenName) _PCD_TOKEN_##TokenName
28 // Feature Flag is in the form of a global constant
30 #define FeaturePcdGet(TokenName) _gPcd_FixedAtBuild_##TokenName
34 // Fixed is fixed at build time
36 #define FixedPcdGet8(TokenName) _gPcd_FixedAtBuild_##TokenName
37 #define FixedPcdGet16(TokenName) _gPcd_FixedAtBuild_##TokenName
38 #define FixedPcdGet32(TokenName) _gPcd_FixedAtBuild_##TokenName
39 #define FixedPcdGet64(TokenName) _gPcd_FixedAtBuild_##TokenName
40 #define FixedPcdGetBool(TokenName) _gPcd_FixedAtBuild_##TokenName
44 // BugBug: This works for strings, but not constants.
46 #define FixedPcdGetPtr(TokenName) ((VOID *)_gPcd_FixedAtBuild_##TokenName)
50 // (Binary) Patch is in the form of a global variable
52 #define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
53 #define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
54 #define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
55 #define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
56 #define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
57 #define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
59 #define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
60 #define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
61 #define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
62 #define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
63 #define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
64 #define PatchPcdSetPtr(TokenName, Value, Size) CopyMem (_gPcd_BinaryPatch_##TokenName, Value, Size)
67 // Dynamic is via the protocol with only the TokenNumber as argument
68 // It can also be Patch or Fixed type based on a build option
70 #define PcdGet8(TokenName) _PCD_MODE_8_##TokenName
71 #define PcdGet16(TokenName) _PCD_MODE_16_##TokenName
72 #define PcdGet32(TokenName) _PCD_MODE_32_##TokenName
73 #define PcdGet64(TokenName) _PCD_MODE_64_##TokenName
74 #define PcdGetPtr(TokenName) _PCD_MODE_PTR_##TokenName
75 #define PcdGetBool(TokenName) _PCD_MODE_BOOL_##TokenName
79 // Dynamic Ex is to support binary distribution
81 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName)
82 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName)
83 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName)
84 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName)
85 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName)
86 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool (Guid, _PCD_TOKEN_##TokenName)
92 #define PcdSet8(TokenName, Value) LibPcdSet8 (_PCD_TOKEN_##TokenName, Value)
93 #define PcdSet16(TokenName, Value) LibPcdSet16 (_PCD_TOKEN_##TokenName, Value)
94 #define PcdSet32(TokenName, Value) LibPcdSet32 (_PCD_TOKEN_##TokenName, Value)
95 #define PcdSet64(TokenName, Value) LibPcdSet64 (_PCD_TOKEN_##TokenName, Value)
96 #define PcdSetPtr(TokenName, Value) LibPcdSetPtr (_PCD_TOKEN_##TokenName, Value)
97 #define PcdSetBool(TokenName, Value) LibPcdSetBool(_PCD_TOKEN_##TokenName, Value)
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, Value) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, Value)
108 #define PcdSetExBool(Guid, TokenName, Value) LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value)
112 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
114 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
115 set values associated with a PCD token.
117 @retval SKU_ID Return the SKU ID that just be set.
128 Returns the 8-bit value for the token specified by TokenNumber.
130 @param[in] The PCD token number to retrieve a current value for.
132 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
138 IN PCD_TOKEN_NUMBER TokenNumber
143 Returns the 16-bit value for the token specified by TokenNumber.
145 @param[in] The PCD token number to retrieve a current value for.
147 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
153 IN PCD_TOKEN_NUMBER TokenNumber
158 Returns the 32-bit value for the token specified by TokenNumber.
160 @param[in] TokenNumber The PCD token number to retrieve a current value for.
162 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
168 IN PCD_TOKEN_NUMBER TokenNumber
173 Returns the 64-bit value for the token specified by TokenNumber.
175 @param[in] TokenNumber The PCD token number to retrieve a current value for.
177 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
183 IN PCD_TOKEN_NUMBER TokenNumber
188 Returns the pointer to the buffer of the token specified by TokenNumber.
190 @param[in] TokenNumber The PCD token number to retrieve a current value for.
192 @retval VOID* Returns the pointer to the token specified by TokenNumber.
198 IN PCD_TOKEN_NUMBER TokenNumber
203 Returns the Boolean value of the token specified by TokenNumber.
205 @param[in] TokenNumber The PCD token number to retrieve a current value for.
207 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
213 IN PCD_TOKEN_NUMBER TokenNumber
218 Returns the size of the token specified by TokenNumber.
220 @param[in] TokenNumber The PCD token number to retrieve a current value for.
222 @retval UINTN Returns the size of the token specified by TokenNumber.
228 IN PCD_TOKEN_NUMBER TokenNumber
233 Returns the 8-bit value for the token specified by TokenNumber and Guid.
234 If Guid is NULL, then ASSERT().
236 @param[in] Guid Pointer to a 128-bit unique value that designates
237 which namespace to retrieve a value from.
238 @param[in] TokenNumber The PCD token number to retrieve a current value for.
240 @retval UINT8 Return the UINT8.
247 IN PCD_TOKEN_NUMBER TokenNumber
252 Returns the 16-bit value for the token specified by TokenNumber and Guid.
253 If Guid is NULL, then ASSERT().
255 @param[in] Guid Pointer to a 128-bit unique value that designates
256 which namespace to retrieve a value from.
257 @param[in] TokenNumber The PCD token number to retrieve a current value for.
259 @retval UINT16 Return the UINT16.
266 IN PCD_TOKEN_NUMBER TokenNumber
271 Returns the 32-bit value for the token specified by TokenNumber and Guid.
272 If Guid is NULL, then ASSERT().
274 @param[in] Guid Pointer to a 128-bit unique value that designates
275 which namespace to retrieve a value from.
276 @param[in] TokenNumber The PCD token number to retrieve a current value for.
278 @retval UINT32 Return the UINT32.
285 IN PCD_TOKEN_NUMBER TokenNumber
290 Returns the 64-bit value for the token specified by TokenNumber and Guid.
291 If Guid is NULL, then ASSERT().
293 @param[in] Guid Pointer to a 128-bit unique value that designates
294 which namespace to retrieve a value from.
295 @param[in] TokenNumber The PCD token number to retrieve a current value for.
297 @retval UINT64 Return the UINT64.
304 IN PCD_TOKEN_NUMBER TokenNumber
309 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
310 If Guid is NULL, then ASSERT().
312 @param[in] Guid Pointer to a 128-bit unique value that designates
313 which namespace to retrieve a value from.
314 @param[in] TokenNumber The PCD token number to retrieve a current value for.
316 @retval VOID* Return the VOID* pointer.
323 IN PCD_TOKEN_NUMBER TokenNumber
328 Returns the Boolean value of the token specified by TokenNumber and Guid.
329 If Guid is NULL, then ASSERT().
331 @param[in] Guid Pointer to a 128-bit unique value that designates
332 which namespace to retrieve a value from.
333 @param[in] TokenNumber The PCD token number to retrieve a current value for.
335 @retval BOOLEAN Return the BOOLEAN.
342 IN PCD_TOKEN_NUMBER TokenNumber
347 Returns the size of the token specified by TokenNumber and Guid.
348 If Guid is NULL, then ASSERT().
350 @param[in] Guid Pointer to a 128-bit unique value that designates
351 which namespace to retrieve a value from.
352 @param[in] TokenNumber The PCD token number to retrieve a current value for.
354 @retval UINTN Return the size.
361 IN PCD_TOKEN_NUMBER TokenNumber
366 Sets the 8-bit value for the token specified by TokenNumber
367 to the value specified by Value. Value is returned.
369 @param[in] TokenNumber The PCD token number to set a current value for.
370 @param[in] Value The 8-bit value to set.
372 @retval UINT8 Return the value been set.
378 IN PCD_TOKEN_NUMBER TokenNumber
,
384 Sets the 16-bit value for the token specified by TokenNumber
385 to the value specified by Value. Value is returned.
387 @param[in] TokenNumber The PCD token number to set a current value for.
388 @param[in] Value The 16-bit value to set.
390 @retval UINT16 Return the value been set.
396 IN PCD_TOKEN_NUMBER TokenNumber
,
402 Sets the 32-bit value for the token specified by TokenNumber
403 to the value specified by Value. Value is returned.
405 @param[in] TokenNumber The PCD token number to set a current value for.
406 @param[in] Value The 32-bit value to set.
408 @retval UINT32 Return the value been set.
414 IN PCD_TOKEN_NUMBER TokenNumber
,
420 Sets the 64-bit value for the token specified by TokenNumber
421 to the value specified by Value. Value is returned.
423 @param[in] TokenNumber The PCD token number to set a current value for.
424 @param[in] Value The 64-bit value to set.
426 @retval UINT64 Return the value been set.
432 IN PCD_TOKEN_NUMBER TokenNumber
,
438 Sets a buffer for the token specified by TokenNumber to
439 the value specified by Value. Value is returned.
440 If Value is NULL, then ASSERT().
442 @param[in] TokenNumber The PCD token number to set a current value for.
443 @param[in] Value A pointer to the buffer to set.
445 @retval VOID* Return the pointer for the buffer been set.
451 IN PCD_TOKEN_NUMBER TokenNumber
,
452 IN UINTN SizeOfBuffer
,
458 Sets the Boolean value for the token specified by TokenNumber
459 to the value specified by Value. Value is returned.
461 @param[in] TokenNumber The PCD token number to set a current value for.
462 @param[in] Value The boolean value to set.
464 @retval BOOLEAN Return the value been set.
470 IN PCD_TOKEN_NUMBER TokenNumber
,
476 Sets the 8-bit value for the token specified by TokenNumber and
477 Guid to the value specified by Value. Value is returned.
478 If Guid is NULL, then ASSERT().
480 @param[in] Guid Pointer to a 128-bit unique value that
481 designates which namespace to set a value from.
482 @param[in] TokenNumber The PCD token number to set a current value for.
483 @param[in] Value The 8-bit value to set.
485 @retval UINT8 Return the value been set.
492 IN PCD_TOKEN_NUMBER TokenNumber
,
498 Sets the 16-bit value for the token specified by TokenNumber and
499 Guid to the value specified by Value. Value is returned.
500 If Guid is NULL, then ASSERT().
502 @param[in] Guid Pointer to a 128-bit unique value that
503 designates which namespace to set a value from.
504 @param[in] TokenNumber The PCD token number to set a current value for.
505 @param[in] Value The 16-bit value to set.
507 @retval UINT8 Return the value been set.
514 IN PCD_TOKEN_NUMBER TokenNumber
,
520 Sets the 32-bit value for the token specified by TokenNumber and
521 Guid to the value specified by Value. Value is returned.
522 If Guid is NULL, then ASSERT().
524 @param[in] Guid Pointer to a 128-bit unique value that
525 designates which namespace to set a value from.
526 @param[in] TokenNumber The PCD token number to set a current value for.
527 @param[in] Value The 32-bit value to set.
529 @retval UINT32 Return the value been set.
536 IN PCD_TOKEN_NUMBER TokenNumber
,
542 Sets the 64-bit value for the token specified by TokenNumber and
543 Guid to the value specified by Value. Value is returned.
544 If Guid is NULL, then ASSERT().
546 @param[in] Guid Pointer to a 128-bit unique value that
547 designates which namespace to set a value from.
548 @param[in] TokenNumber The PCD token number to set a current value for.
549 @param[in] Value The 64-bit value to set.
551 @retval UINT64 Return the value been set.
558 IN PCD_TOKEN_NUMBER TokenNumber
,
564 Sets a buffer for the token specified by TokenNumber and
565 Guid to the value specified by Value. Value is returned.
566 If Guid is NULL, then ASSERT().
567 If Value is NULL, then ASSERT().
569 @param[in] Guid Pointer to a 128-bit unique value that
570 designates which namespace to set a value from.
571 @param[in] TokenNumber The PCD token number to set a current value for.
572 @param[in] Value The 8-bit value to set.
574 @retval VOID * Return the value been set.
581 IN PCD_TOKEN_NUMBER TokenNumber
,
582 IN UINTN SizeOfBuffer
,
588 Sets the Boolean value for the token specified by TokenNumber and
589 Guid to the value specified by Value. Value is returned.
590 If Guid is NULL, then ASSERT().
592 @param[in] Guid Pointer to a 128-bit unique value that
593 designates which namespace to set a value from.
594 @param[in] TokenNumber The PCD token number to set a current value for.
595 @param[in] Value The Boolean value to set.
597 @retval Boolean Return the value been set.
604 IN PCD_TOKEN_NUMBER TokenNumber
,
610 When the token specified by TokenNumber and Guid is set,
611 then notification function specified by NotificationFunction is called.
612 If Guid is NULL, then the default token space is used.
613 If NotificationFunction is NULL, then ASSERT().
615 @param[in] CallBackGuid The PCD token GUID being set.
616 @param[in] CallBackToken The PCD token number being set.
617 @param[in] TokenData A pointer to the token data being set.
618 @param[in] TokenDataSize The size, in bytes, of the data being set.
625 (EFIAPI
*PCD_CALLBACK
) (
626 IN CONST GUID
*CallBackGuid
, OPTIONAL
627 IN PCD_TOKEN_NUMBER CallBackToken
,
628 IN OUT VOID
*TokenData
,
629 IN UINTN TokenDataSize
634 When the token specified by TokenNumber and Guid is set,
635 then notification function specified by NotificationFunction is called.
636 If Guid is NULL, then the default token space is used.
637 If NotificationFunction is NULL, then ASSERT().
639 @param[in] Guid Pointer to a 128-bit unique value that designates which
640 namespace to set a value from. If NULL, then the default
642 @param[in] TokenNumber The PCD token number to monitor.
643 @param[in] NotificationFunction The function to call when the token
644 specified by Guid and TokenNumber is set.
651 LibPcdCallbackOnSet (
652 IN CONST GUID
*Guid
, OPTIONAL
653 IN PCD_TOKEN_NUMBER TokenNumber
,
654 IN PCD_CALLBACK NotificationFunction
659 Disable a notification function that was established with LibPcdCallbackonSet().
661 @param[in] Guid Specify the GUID token space.
662 @param[in] TokenNumber Specify the token number.
663 @param[in] NotificationFunction The callback function to be unregistered.
670 LibPcdCancelCallback (
671 IN CONST GUID
*Guid
, OPTIONAL
672 IN PCD_TOKEN_NUMBER TokenNumber
,
673 IN PCD_CALLBACK NotificationFunction
678 Retrieves the next PCD token number from the token space specified by Guid.
679 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
680 then the first token number is returned. Otherwise, the token number that
681 follows TokenNumber in the token space is returned. If TokenNumber is the last
682 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
683 is not in the token space specified by Guid, then ASSERT().
685 @param[in] Pointer to a 128-bit unique value that designates which namespace
686 to set a value from. If NULL, then the default token space is used.
687 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
690 @retval PCD_TOKEN_NUMBER The next valid token number.
696 IN CONST GUID
*Guid
, OPTIONAL
697 IN PCD_TOKEN_NUMBER TokenNumber