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) -1)
23 #define PcdToken(TokenName) _PCD_TOKEN_##TokenName
27 // Feature Flag is in the form of a global constant
29 #define FeaturePcdGet(TokenName) _gPcd_FixedAtBuild_##TokenName
33 // Fixed is fixed at build time
35 #define FixedPcdGet8(TokenName) _gPcd_FixedAtBuild_##TokenName
36 #define FixedPcdGet16(TokenName) _gPcd_FixedAtBuild_##TokenName
37 #define FixedPcdGet32(TokenName) _gPcd_FixedAtBuild_##TokenName
38 #define FixedPcdGet64(TokenName) _gPcd_FixedAtBuild_##TokenName
39 #define FixedPcdGetBool(TokenName) _gPcd_FixedAtBuild_##TokenName
43 // BugBug: This works for strings, but not constants.
45 #define FixedPcdGetPtr(TokenName) ((VOID *)_gPcd_FixedAtBuild_##TokenName)
49 // (Binary) Patch is in the form of a global variable
51 #define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
52 #define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
53 #define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
54 #define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
55 #define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
56 #define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
58 #define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
59 #define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
60 #define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
61 #define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
62 #define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = Value)
63 #define PatchPcdSetPtr(TokenName, Value, Size) CopyMem (_gPcd_BinaryPatch_##TokenName, Value, Size)
66 // Dynamic is via the protocol with only the TokenNumber as argument
67 // It can also be Patch or Fixed type based on a build option
69 #define PcdGet8(TokenName) _PCD_MODE_8_##TokenName
70 #define PcdGet16(TokenName) _PCD_MODE_16_##TokenName
71 #define PcdGet32(TokenName) _PCD_MODE_32_##TokenName
72 #define PcdGet64(TokenName) _PCD_MODE_64_##TokenName
73 #define PcdGetPtr(TokenName) _PCD_MODE_PTR_##TokenName
74 #define PcdGetBool(TokenName) _PCD_MODE_BOOL_##TokenName
78 // Dynamic Ex is to support binary distribution
80 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName)
81 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName)
82 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName)
83 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName)
84 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName)
85 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool (Guid, _PCD_TOKEN_##TokenName)
91 #define PcdSet8(TokenName, Value) LibPcdSet8 (_PCD_TOKEN_##TokenName, Value)
92 #define PcdSet16(TokenName, Value) LibPcdSet16 (_PCD_TOKEN_##TokenName, Value)
93 #define PcdSet32(TokenName, Value) LibPcdSet32 (_PCD_TOKEN_##TokenName, Value)
94 #define PcdSet64(TokenName, Value) LibPcdSet64 (_PCD_TOKEN_##TokenName, Value)
95 #define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) LibPcdSetPtr (_PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
96 #define PcdSetBool(TokenName, Value) LibPcdSetBool(_PCD_TOKEN_##TokenName, Value)
102 #define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 (Guid, _PCD_TOKEN_##TokenName, Value)
103 #define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 (Guid, _PCD_TOKEN_##TokenName, Value)
104 #define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 (Guid, _PCD_TOKEN_##TokenName, Value)
105 #define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 (Guid, _PCD_TOKEN_##TokenName, Value)
106 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
107 #define PcdSetExBool(Guid, TokenName, Value) LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value)
111 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
113 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
114 set values associated with a PCD token.
116 @retval SKU_ID Return the SKU ID that just be set.
127 Returns the 8-bit value for the token specified by TokenNumber.
129 @param[in] The PCD token number to retrieve a current value for.
131 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
142 Returns the 16-bit value for the token specified by TokenNumber.
144 @param[in] The PCD token number to retrieve a current value for.
146 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
157 Returns the 32-bit value for the token specified by TokenNumber.
159 @param[in] TokenNumber The PCD token number to retrieve a current value for.
161 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
172 Returns the 64-bit value for the token specified by TokenNumber.
174 @param[in] TokenNumber The PCD token number to retrieve a current value for.
176 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
187 Returns the pointer to the buffer of the token specified by TokenNumber.
189 @param[in] TokenNumber The PCD token number to retrieve a current value for.
191 @retval VOID* Returns the pointer to the token specified by TokenNumber.
202 Returns the Boolean value of the token specified by TokenNumber.
204 @param[in] TokenNumber The PCD token number to retrieve a current value for.
206 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
217 Returns the size of the token specified by TokenNumber.
219 @param[in] TokenNumber The PCD token number to retrieve a current value for.
221 @retval UINTN Returns the size of the token specified by TokenNumber.
232 Returns the 8-bit value for the token specified by TokenNumber and Guid.
233 If Guid is NULL, then ASSERT().
235 @param[in] Guid Pointer to a 128-bit unique value that designates
236 which namespace to retrieve a value from.
237 @param[in] TokenNumber The PCD token number to retrieve a current value for.
239 @retval UINT8 Return the UINT8.
251 Returns the 16-bit value for the token specified by TokenNumber and Guid.
252 If Guid is NULL, then ASSERT().
254 @param[in] Guid Pointer to a 128-bit unique value that designates
255 which namespace to retrieve a value from.
256 @param[in] TokenNumber The PCD token number to retrieve a current value for.
258 @retval UINT16 Return the UINT16.
270 Returns the 32-bit value for the token specified by TokenNumber and Guid.
271 If Guid is NULL, then ASSERT().
273 @param[in] Guid Pointer to a 128-bit unique value that designates
274 which namespace to retrieve a value from.
275 @param[in] TokenNumber The PCD token number to retrieve a current value for.
277 @retval UINT32 Return the UINT32.
289 Returns the 64-bit value for the token specified by TokenNumber and Guid.
290 If Guid is NULL, then ASSERT().
292 @param[in] Guid Pointer to a 128-bit unique value that designates
293 which namespace to retrieve a value from.
294 @param[in] TokenNumber The PCD token number to retrieve a current value for.
296 @retval UINT64 Return the UINT64.
308 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
309 If Guid is NULL, then ASSERT().
311 @param[in] Guid Pointer to a 128-bit unique value that designates
312 which namespace to retrieve a value from.
313 @param[in] TokenNumber The PCD token number to retrieve a current value for.
315 @retval VOID* Return the VOID* pointer.
327 Returns the Boolean value of the token specified by TokenNumber and Guid.
328 If Guid is NULL, then ASSERT().
330 @param[in] Guid Pointer to a 128-bit unique value that designates
331 which namespace to retrieve a value from.
332 @param[in] TokenNumber The PCD token number to retrieve a current value for.
334 @retval BOOLEAN Return the BOOLEAN.
346 Returns the size of the token specified by TokenNumber and Guid.
347 If Guid is NULL, then ASSERT().
349 @param[in] Guid Pointer to a 128-bit unique value that designates
350 which namespace to retrieve a value from.
351 @param[in] TokenNumber The PCD token number to retrieve a current value for.
353 @retval UINTN Return the size.
365 Sets the 8-bit value for the token specified by TokenNumber
366 to the value specified by Value. Value is returned.
368 @param[in] TokenNumber The PCD token number to set a current value for.
369 @param[in] Value The 8-bit value to set.
371 @retval UINT8 Return the value been set.
377 IN UINTN TokenNumber
,
383 Sets the 16-bit value for the token specified by TokenNumber
384 to the value specified by Value. Value is returned.
386 @param[in] TokenNumber The PCD token number to set a current value for.
387 @param[in] Value The 16-bit value to set.
389 @retval UINT16 Return the value been set.
395 IN UINTN TokenNumber
,
401 Sets the 32-bit value for the token specified by TokenNumber
402 to the value specified by Value. Value is returned.
404 @param[in] TokenNumber The PCD token number to set a current value for.
405 @param[in] Value The 32-bit value to set.
407 @retval UINT32 Return the value been set.
413 IN UINTN TokenNumber
,
419 Sets the 64-bit value for the token specified by TokenNumber
420 to the value specified by Value. Value is returned.
422 @param[in] TokenNumber The PCD token number to set a current value for.
423 @param[in] Value The 64-bit value to set.
425 @retval UINT64 Return the value been set.
431 IN UINTN TokenNumber
,
437 Sets a buffer for the token specified by TokenNumber to
438 the value specified by Value. Value is returned.
439 If Value is NULL, then ASSERT().
441 @param[in] TokenNumber The PCD token number to set a current value for.
442 @param[in] Value A pointer to the buffer to set.
444 @retval VOID* Return the pointer for the buffer been set.
450 IN UINTN TokenNumber
,
451 IN UINTN SizeOfBuffer
,
457 Sets the Boolean value for the token specified by TokenNumber
458 to the value specified by Value. Value is returned.
460 @param[in] TokenNumber The PCD token number to set a current value for.
461 @param[in] Value The boolean value to set.
463 @retval BOOLEAN Return the value been set.
469 IN UINTN TokenNumber
,
475 Sets the 8-bit value for the token specified by TokenNumber and
476 Guid to the value specified by Value. Value is returned.
477 If Guid is NULL, then ASSERT().
479 @param[in] Guid Pointer to a 128-bit unique value that
480 designates which namespace to set a value from.
481 @param[in] TokenNumber The PCD token number to set a current value for.
482 @param[in] Value The 8-bit value to set.
484 @retval UINT8 Return the value been set.
491 IN UINTN TokenNumber
,
497 Sets the 16-bit value for the token specified by TokenNumber and
498 Guid to the value specified by Value. Value is returned.
499 If Guid is NULL, then ASSERT().
501 @param[in] Guid Pointer to a 128-bit unique value that
502 designates which namespace to set a value from.
503 @param[in] TokenNumber The PCD token number to set a current value for.
504 @param[in] Value The 16-bit value to set.
506 @retval UINT8 Return the value been set.
513 IN UINTN TokenNumber
,
519 Sets the 32-bit value for the token specified by TokenNumber and
520 Guid to the value specified by Value. Value is returned.
521 If Guid is NULL, then ASSERT().
523 @param[in] Guid Pointer to a 128-bit unique value that
524 designates which namespace to set a value from.
525 @param[in] TokenNumber The PCD token number to set a current value for.
526 @param[in] Value The 32-bit value to set.
528 @retval UINT32 Return the value been set.
535 IN UINTN TokenNumber
,
541 Sets the 64-bit value for the token specified by TokenNumber and
542 Guid to the value specified by Value. Value is returned.
543 If Guid is NULL, then ASSERT().
545 @param[in] Guid Pointer to a 128-bit unique value that
546 designates which namespace to set a value from.
547 @param[in] TokenNumber The PCD token number to set a current value for.
548 @param[in] Value The 64-bit value to set.
550 @retval UINT64 Return the value been set.
557 IN UINTN TokenNumber
,
563 Sets a buffer for the token specified by TokenNumber and
564 Guid to the value specified by Value. Value is returned.
565 If Guid is NULL, then ASSERT().
566 If Value is NULL, then ASSERT().
568 @param[in] Guid Pointer to a 128-bit unique value that
569 designates which namespace to set a value from.
570 @param[in] TokenNumber The PCD token number to set a current value for.
571 @param[in] Value The 8-bit value to set.
573 @retval VOID * Return the value been set.
580 IN UINTN TokenNumber
,
581 IN UINTN SizeOfBuffer
,
587 Sets the Boolean value for the token specified by TokenNumber and
588 Guid to the value specified by Value. Value is returned.
589 If Guid is NULL, then ASSERT().
591 @param[in] Guid Pointer to a 128-bit unique value that
592 designates which namespace to set a value from.
593 @param[in] TokenNumber The PCD token number to set a current value for.
594 @param[in] Value The Boolean value to set.
596 @retval Boolean Return the value been set.
603 IN UINTN TokenNumber
,
609 When the token specified by TokenNumber and Guid is set,
610 then notification function specified by NotificationFunction is called.
611 If Guid is NULL, then the default token space is used.
612 If NotificationFunction is NULL, then ASSERT().
614 @param[in] CallBackGuid The PCD token GUID being set.
615 @param[in] CallBackToken The PCD token number being set.
616 @param[in] TokenData A pointer to the token data being set.
617 @param[in] TokenDataSize The size, in bytes, of the data being set.
624 (EFIAPI
*PCD_CALLBACK
) (
625 IN CONST GUID
*CallBackGuid
, OPTIONAL
626 IN UINTN CallBackToken
,
627 IN OUT VOID
*TokenData
,
628 IN UINTN TokenDataSize
633 When the token specified by TokenNumber and Guid is set,
634 then notification function specified by NotificationFunction is called.
635 If Guid is NULL, then the default token space is used.
636 If NotificationFunction is NULL, then ASSERT().
638 @param[in] Guid Pointer to a 128-bit unique value that designates which
639 namespace to set a value from. If NULL, then the default
641 @param[in] TokenNumber The PCD token number to monitor.
642 @param[in] NotificationFunction The function to call when the token
643 specified by Guid and TokenNumber is set.
650 LibPcdCallbackOnSet (
651 IN CONST GUID
*Guid
, OPTIONAL
652 IN UINTN TokenNumber
,
653 IN PCD_CALLBACK NotificationFunction
658 Disable a notification function that was established with LibPcdCallbackonSet().
660 @param[in] Guid Specify the GUID token space.
661 @param[in] TokenNumber Specify the token number.
662 @param[in] NotificationFunction The callback function to be unregistered.
669 LibPcdCancelCallback (
670 IN CONST GUID
*Guid
, OPTIONAL
671 IN UINTN TokenNumber
,
672 IN PCD_CALLBACK NotificationFunction
677 Retrieves the next PCD token number from the token space specified by Guid.
678 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
679 then the first token number is returned. Otherwise, the token number that
680 follows TokenNumber in the token space is returned. If TokenNumber is the last
681 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
682 is not in the token space specified by Guid, then ASSERT().
684 @param[in] Pointer to a 128-bit unique value that designates which namespace
685 to set a value from. If NULL, then the default token space is used.
686 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
689 @retval UINTN The next valid token number.
695 IN CONST GUID
*Guid
, OPTIONAL