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.
22 #define PcdToken(TokenName) _PCD_TOKEN_##TokenName
26 // Feature Flag is in the form of a global constant
28 #define FeaturePcdGet(TokenName) _gPcd_FixedAtBuild_##TokenName
32 // Fixed is fixed at build time
34 #define FixedPcdGet8(TokenName) _gPcd_FixedAtBuild_##TokenName
35 #define FixedPcdGet16(TokenName) _gPcd_FixedAtBuild_##TokenName
36 #define FixedPcdGet32(TokenName) _gPcd_FixedAtBuild_##TokenName
37 #define FixedPcdGet64(TokenName) _gPcd_FixedAtBuild_##TokenName
38 #define FixedPcdGetBool(TokenName) _gPcd_FixedAtBuild_##TokenName
42 // BugBug: This works for strings, but not constants.
44 #define FixedPcdGetPtr(TokenName) ((VOID *)_gPcd_FixedAtBuild_##TokenName)
48 // (Binary) Patch is in the form of a global variable
50 #define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
51 #define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
52 #define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
53 #define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
54 #define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
55 #define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
59 // Dynamic is via the protocol with only the TokenNumber as argument
60 // It can also be Patch or Fixed type based on a build option
62 #define PcdGet8(TokenName) _PCD_MODE_8_##TokenName
63 #define PcdGet16(TokenName) _PCD_MODE_16_##TokenName
64 #define PcdGet32(TokenName) _PCD_MODE_32_##TokenName
65 #define PcdGet64(TokenName) _PCD_MODE_64_##TokenName
66 #define PcdGetPtr(TokenName) _PCD_MODE_PTR_##TokenName
67 #define PcdGetBool(TokenName) _PCD_MODE_BOOL_##TokenName
71 // Dynamic Ex is to support binary distribution
73 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName)
74 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName)
75 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName)
76 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName)
77 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName)
78 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool (Guid, _PCD_TOKEN_##TokenName)
84 #define PcdSet8(TokenName, Value) LibPcdSet8 (_PCD_TOKEN_##TokenName, Value)
85 #define PcdSet16(TokenName, Value) LibPcdSet16 (_PCD_TOKEN_##TokenName, Value)
86 #define PcdSet32(TokenName, Value) LibPcdSet32 (_PCD_TOKEN_##TokenName, Value)
87 #define PcdSet64(TokenName, Value) LibPcdSet64 (_PCD_TOKEN_##TokenName, Value)
88 #define PcdSetPtr(TokenName, Value) LibPcdSetPtr (_PCD_TOKEN_##TokenName, Value)
89 #define PcdSetBool(TokenName, Value) LibPcdSetBool(_PCD_TOKEN_##TokenName, Value)
95 #define PcdSetEx8 (Guid, TokenName, Value) LibPcdSetEx8 (Guid, _PCD_TOKEN_##TokenName, Value)
96 #define PcdSetEx16 (Guid, TokenName, Value) LibPcdSetEx16 (Guid, _PCD_TOKEN_##TokenName, Value)
97 #define PcdSetEx32 (Guid, TokenName, Value) LibPcdSetEx32 (Guid, _PCD_TOKEN_##TokenName, Value)
98 #define PcdSetEx64 (Guid, TokenName, Value) LibPcdSetEx64 (Guid, _PCD_TOKEN_##TokenName, Value)
99 #define PcdSetExPtr (Guid, TokenName, Value) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, Value)
100 #define PcdSetExBool(Guid, TokenName, Value) LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value)
104 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
106 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
107 set values associated with a PCD token.
109 @retval UINTN Return the SKU ID that just be set.
120 Returns the 8-bit value for the token specified by TokenNumber.
122 @param[in] The PCD token number to retrieve a current value for.
124 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
135 Returns the 16-bit value for the token specified by TokenNumber.
137 @param[in] The PCD token number to retrieve a current value for.
139 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
150 Returns the 32-bit value for the token specified by TokenNumber.
152 @param[in] TokenNumber The PCD token number to retrieve a current value for.
154 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
165 Returns the 64-bit value for the token specified by TokenNumber.
167 @param[in] TokenNumber The PCD token number to retrieve a current value for.
169 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
180 Returns the pointer to the buffer of the token specified by TokenNumber.
182 @param[in] TokenNumber The PCD token number to retrieve a current value for.
184 @retval VOID* Returns the pointer to the token specified by TokenNumber.
195 Returns the Boolean value of the token specified by TokenNumber.
197 @param[in] TokenNumber The PCD token number to retrieve a current value for.
199 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
210 Returns the size of the token specified by TokenNumber.
212 @param[in] TokenNumber The PCD token number to retrieve a current value for.
214 @retval UINTN Returns the size of the token specified by TokenNumber.
225 Returns the 8-bit value for the token specified by TokenNumber and Guid.
226 If Guid is NULL, then ASSERT().
228 @param[in] Guid Pointer to a 128-bit unique value that designates
229 which namespace to retrieve a value from.
230 @param[in] TokenNumber The PCD token number to retrieve a current value for.
232 @retval UINT8 Return the UINT8.
244 Returns the 16-bit value for the token specified by TokenNumber and Guid.
245 If Guid is NULL, then ASSERT().
247 @param[in] Guid Pointer to a 128-bit unique value that designates
248 which namespace to retrieve a value from.
249 @param[in] TokenNumber The PCD token number to retrieve a current value for.
251 @retval UINT16 Return the UINT16.
263 Returns the 32-bit value for the token specified by TokenNumber and Guid.
264 If Guid is NULL, then ASSERT().
266 @param[in] Guid Pointer to a 128-bit unique value that designates
267 which namespace to retrieve a value from.
268 @param[in] TokenNumber The PCD token number to retrieve a current value for.
270 @retval UINT32 Return the UINT32.
282 Returns the 64-bit value for the token specified by TokenNumber and Guid.
283 If Guid is NULL, then ASSERT().
285 @param[in] Guid Pointer to a 128-bit unique value that designates
286 which namespace to retrieve a value from.
287 @param[in] TokenNumber The PCD token number to retrieve a current value for.
289 @retval UINT64 Return the UINT64.
301 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
302 If Guid is NULL, then ASSERT().
304 @param[in] Guid Pointer to a 128-bit unique value that designates
305 which namespace to retrieve a value from.
306 @param[in] TokenNumber The PCD token number to retrieve a current value for.
308 @retval VOID* Return the VOID* pointer.
320 Returns the Boolean value of the token specified by TokenNumber and Guid.
321 If Guid is NULL, then ASSERT().
323 @param[in] Guid Pointer to a 128-bit unique value that designates
324 which namespace to retrieve a value from.
325 @param[in] TokenNumber The PCD token number to retrieve a current value for.
327 @retval BOOLEAN Return the BOOLEAN.
339 Returns the size of the token specified by TokenNumber and Guid.
340 If Guid is NULL, then ASSERT().
342 @param[in] Guid Pointer to a 128-bit unique value that designates
343 which namespace to retrieve a value from.
344 @param[in] TokenNumber The PCD token number to retrieve a current value for.
346 @retval UINTN Return the size.
358 Sets the 8-bit value for the token specified by TokenNumber
359 to the value specified by Value. Value is returned.
361 @param[in] TokenNumber The PCD token number to set a current value for.
362 @param[in] Value The 8-bit value to set.
364 @retval UINT8 Return the value been set.
370 IN UINTN TokenNumber
,
376 Sets the 16-bit value for the token specified by TokenNumber
377 to the value specified by Value. Value is returned.
379 @param[in] TokenNumber The PCD token number to set a current value for.
380 @param[in] Value The 16-bit value to set.
382 @retval UINT16 Return the value been set.
388 IN UINTN TokenNumber
,
394 Sets the 32-bit value for the token specified by TokenNumber
395 to the value specified by Value. Value is returned.
397 @param[in] TokenNumber The PCD token number to set a current value for.
398 @param[in] Value The 32-bit value to set.
400 @retval UINT32 Return the value been set.
406 IN UINTN TokenNumber
,
412 Sets the 64-bit value for the token specified by TokenNumber
413 to the value specified by Value. Value is returned.
415 @param[in] TokenNumber The PCD token number to set a current value for.
416 @param[in] Value The 64-bit value to set.
418 @retval UINT64 Return the value been set.
424 IN UINTN TokenNumber
,
430 Sets a buffer for the token specified by TokenNumber to
431 the value specified by Value. Value is returned.
432 If Value is NULL, then ASSERT().
434 @param[in] TokenNumber The PCD token number to set a current value for.
435 @param[in] Value A pointer to the buffer to set.
437 @retval VOID* Return the pointer for the buffer been set.
443 IN UINTN TokenNumber
,
449 Sets the Boolean value for the token specified by TokenNumber
450 to the value specified by Value. Value is returned.
452 @param[in] TokenNumber The PCD token number to set a current value for.
453 @param[in] Value The boolean value to set.
455 @retval BOOLEAN Return the value been set.
461 IN UINTN TokenNumber
,
467 Sets the 8-bit value for the token specified by TokenNumber and
468 Guid to the value specified by Value. Value is returned.
469 If Guid is NULL, then ASSERT().
471 @param[in] Guid Pointer to a 128-bit unique value that
472 designates which namespace to set a value from.
473 @param[in] TokenNumber The PCD token number to set a current value for.
474 @param[in] Value The 8-bit value to set.
476 @retval UINT8 Return the value been set.
483 IN UINTN TokenNumber
,
489 Sets the 16-bit value for the token specified by TokenNumber and
490 Guid to the value specified by Value. Value is returned.
491 If Guid is NULL, then ASSERT().
493 @param[in] Guid Pointer to a 128-bit unique value that
494 designates which namespace to set a value from.
495 @param[in] TokenNumber The PCD token number to set a current value for.
496 @param[in] Value The 16-bit value to set.
498 @retval UINT8 Return the value been set.
505 IN UINTN TokenNumber
,
511 Sets the 32-bit value for the token specified by TokenNumber and
512 Guid to the value specified by Value. Value is returned.
513 If Guid is NULL, then ASSERT().
515 @param[in] Guid Pointer to a 128-bit unique value that
516 designates which namespace to set a value from.
517 @param[in] TokenNumber The PCD token number to set a current value for.
518 @param[in] Value The 32-bit value to set.
520 @retval UINT32 Return the value been set.
527 IN UINTN TokenNumber
,
533 Sets the 64-bit value for the token specified by TokenNumber and
534 Guid to the value specified by Value. Value is returned.
535 If Guid is NULL, then ASSERT().
537 @param[in] Guid Pointer to a 128-bit unique value that
538 designates which namespace to set a value from.
539 @param[in] TokenNumber The PCD token number to set a current value for.
540 @param[in] Value The 64-bit value to set.
542 @retval UINT64 Return the value been set.
549 IN UINTN TokenNumber
,
555 Sets a buffer for the token specified by TokenNumber and
556 Guid to the value specified by Value. Value is returned.
557 If Guid is NULL, then ASSERT().
558 If Value is NULL, then ASSERT().
560 @param[in] Guid Pointer to a 128-bit unique value that
561 designates which namespace to set a value from.
562 @param[in] TokenNumber The PCD token number to set a current value for.
563 @param[in] Value The 8-bit value to set.
565 @retval VOID * Return the value been set.
572 IN UINTN TokenNumber
,
578 Sets the Boolean value for the token specified by TokenNumber and
579 Guid to the value specified by Value. Value is returned.
580 If Guid is NULL, then ASSERT().
582 @param[in] Guid Pointer to a 128-bit unique value that
583 designates which namespace to set a value from.
584 @param[in] TokenNumber The PCD token number to set a current value for.
585 @param[in] Value The Boolean value to set.
587 @retval Boolean Return the value been set.
594 IN UINTN TokenNumber
,
600 When the token specified by TokenNumber and Guid is set,
601 then notification function specified by NotificationFunction is called.
602 If Guid is NULL, then the default token space is used.
603 If NotificationFunction is NULL, then ASSERT().
605 @param[in] CallBackGuid The PCD token GUID being set.
606 @param[in] CallBackToken The PCD token number being set.
607 @param[in] TokenData A pointer to the token data being set.
608 @param[in] TokenDataSize The size, in bytes, of the data being set.
615 (EFIAPI
*PCD_CALLBACK
) (
616 IN CONST GUID
*CallBackGuid
, OPTIONAL
617 IN UINTN CallBackToken
,
619 IN UINTN TokenDataSize
624 When the token specified by TokenNumber and Guid is set,
625 then notification function specified by NotificationFunction is called.
626 If Guid is NULL, then the default token space is used.
627 If NotificationFunction is NULL, then ASSERT().
629 @param[in] Guid Pointer to a 128-bit unique value that designates which
630 namespace to set a value from. If NULL, then the default
632 @param[in] TokenNumber The PCD token number to monitor.
633 @param[in] NotificationFunction The function to call when the token
634 specified by Guid and TokenNumber is set.
641 LibPcdCallbackOnSet (
642 IN CONST GUID
*Guid
, OPTIONAL
643 IN UINTN TokenNumber
,
644 IN PCD_CALLBACK NotificationFunction
649 Disable a notification function that was established with LibPcdCallbackonSet().
651 @param[in] Guid Specify the GUID token space.
652 @param[in] TokenNumber Specify the token number.
653 @param[in] NotificationFunction The callback function to be unregistered.
660 LibPcdCancelCallback (
661 IN CONST GUID
*Guid
, OPTIONAL
662 IN UINTN TokenNumber
,
663 IN PCD_CALLBACK NotificationFunction
668 Retrieves the next PCD token number from the token space specified by Guid.
669 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
670 then the first token number is returned. Otherwise, the token number that
671 follows TokenNumber in the token space is returned. If TokenNumber is the last
672 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
673 is not in the token space specified by Guid, then ASSERT().
675 @param[in] Pointer to a 128-bit unique value that designates which namespace
676 to set a value from. If NULL, then the default token space is used.
677 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
680 @retval UINTN The next valid token number.
686 IN CONST GUID
*Guid
, OPTIONAL
687 IN UINTN
*TokenNumber