2 Provides library services to get and set Platform Configuration Database entries.
4 PCD Library Class provides a PCD usage macro interface for all PCD types.
5 It should be included in any module that uses PCD. If a module uses dynamic/dynamicex
6 PCD, module should be linked to a PEIM/DXE library instance to access that PCD.
7 If a module uses PatchableInModule type PCD, it also needs the library instance to produce
8 LibPatchPcdSetPtr() interface. For FeatureFlag/Fixed PCD, the macro interface is
9 translated to a variable or macro that is auto-generated by build tool in
10 module's autogen.h/autogen.c.
11 The PcdGetXX(), PcdSetXX(), PcdToken(), and PcdGetNextTokenSpace() operations are
12 only available prior to ExitBootServices(). If access to PCD values are required
13 at runtime, then their values must be collected prior to ExitBootServices().
14 There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
15 PatchPcdGetXX(), and PatchPcdSetXX().
17 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
18 This program and the accompanying materials
19 are licensed and made available under the terms and conditions of the BSD License
20 which accompanies this distribution. The full text of the license may be found at
21 http://opensource.org/licenses/bsd-license.php
23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
24 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
31 #define PCD_MAX_SKU_ID 0x100
35 Retrieves a token number based on a token name.
37 Returns the token number associated with the PCD token specified by TokenName.
38 If TokenName is not a valid token in the token space, then the module will not build.
39 If TokenName is not a feature flag, then the module will not build.
41 @param TokenName The name of the PCD token to retrieve the token number for.
43 @return The token number associated with the PCD.
46 #define PcdToken(TokenName) _PCD_TOKEN_##TokenName
50 Retrieves a Boolean PCD feature flag based on a token name.
52 Returns the Boolean value for the PCD feature flag specified by TokenName.
53 If TokenName is not a valid token in the token space, then the module will not build.
54 If TokenName is not a feature flag, then the module will not build.
56 @param TokenName The name of the PCD token to retrieve a current value for.
58 @return Boolean value for the PCD feature flag.
61 #define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName
65 Retrieves an 8-bit fixed PCD token value based on a token name.
67 Returns the 8-bit value for the token specified by TokenName.
68 If TokenName is not a valid token in the token space, then the module will not build.
69 If TokenName is not a feature flag, then the module will not build.
71 @param TokenName The name of the PCD token to retrieve a current value for.
73 @return 8-bit value for the token specified by TokenName.
76 #define FixedPcdGet8(TokenName) _PCD_VALUE_##TokenName
80 Retrieves a 16-bit fixed PCD token value based on a token name.
82 Returns the 16-bit value for the token specified by TokenName.
83 If TokenName is not a valid token in the token space, then the module will not build.
84 If TokenName is not a feature flag, then the module will not build.
86 @param TokenName The name of the PCD token to retrieve a current value for.
88 @return 16-bit value for the token specified by TokenName.
91 #define FixedPcdGet16(TokenName) _PCD_VALUE_##TokenName
95 Retrieves a 32-bit fixed PCD token value based on a token name.
97 Returns the 32-bit value for the token specified by TokenName.
98 If TokenName is not a valid token in the token space, then the module will not build.
99 If TokenName is not a feature flag, then the module will not build.
101 @param TokenName The name of the PCD token to retrieve a current value for.
103 @return 32-bit value for the token specified by TokenName.
106 #define FixedPcdGet32(TokenName) _PCD_VALUE_##TokenName
110 Retrieves a 64-bit fixed PCD token value based on a token name.
112 Returns the 64-bit value for the token specified by TokenName.
113 If TokenName is not a valid token in the token space, then the module will not build.
114 If TokenName is not a feature flag, then the module will not build.
116 @param TokenName The name of the PCD token to retrieve a current value for.
118 @return 64-bit value for the token specified by TokenName.
121 #define FixedPcdGet64(TokenName) _PCD_VALUE_##TokenName
125 Retrieves a Boolean fixed PCD token value based on a token name.
127 Returns the Boolean value for the token specified by TokenName.
128 If TokenName is not a valid token in the token space, then the module will not build.
129 If TokenName is not a feature flag, then the module will not build.
131 @param TokenName The name of the PCD token to retrieve a current value for.
133 @return The Boolean value for the token.
136 #define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName
140 Retrieves a pointer to a fixed PCD token buffer based on a token name.
142 Returns a pointer to the buffer for the token specified by TokenName.
143 If TokenName is not a valid token in the token space, then the module will not build.
144 If TokenName is not a feature flag, then the module will not build.
146 @param TokenName The name of the PCD token to retrieve a current value for.
148 @return A pointer to the buffer.
151 #define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName)
155 Retrieves an 8-bit binary patchable PCD token value based on a token name.
157 Returns the 8-bit value for the token specified by TokenName.
158 If TokenName is not a valid token in the token space, then the module will not build.
159 If TokenName is not a feature flag, then the module will not build.
161 @param TokenName The name of the PCD token to retrieve a current value for.
163 @return An 8-bit binary patchable PCD token value.
166 #define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
169 Retrieves a 16-bit binary patchable PCD token value based on a token name.
171 Returns the 16-bit value for the token specified by TokenName.
172 If TokenName is not a valid token in the token space, then the module will not build.
173 If TokenName is not a feature flag, then the module will not build.
175 @param TokenName The name of the PCD token to retrieve a current value for.
177 @return A 16-bit binary patchable PCD token value.
180 #define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
184 Retrieves a 32-bit binary patchable PCD token value based on a token name.
186 Returns the 32-bit value for the token specified by TokenName.
187 If TokenName is not a valid token in the token space, then the module will not build.
188 If TokenName is not a feature flag, then the module will not build.
190 @param TokenName The name of the PCD token to retrieve a current value for.
192 @return A 32-bit binary patchable PCD token value.
195 #define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
199 Retrieves a 64-bit binary patchable PCD token value based on a token name.
201 Returns the 64-bit value for the token specified by TokenName.
202 If TokenName is not a valid token in the token space, then the module will not build.
203 If TokenName is not a feature flag, then the module will not build.
205 @param TokenName The name of the PCD token to retrieve a current value for.
207 @return A 64-bit binary patchable PCD token value.
210 #define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
214 Retrieves a Boolean binary patchable PCD token value based on a token name.
216 Returns the Boolean value for the token specified by TokenName.
217 If TokenName is not a valid token in the token space, then the module will not build.
218 If TokenName is not a feature flag, then the module will not build.
220 @param TokenName The name of the PCD token to retrieve a current value for.
222 @return The Boolean value for the token.
225 #define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
229 Retrieves a pointer to a binary patchable PCD token buffer based on a token name.
231 Returns a pointer to the buffer for the token specified by TokenName.
232 If TokenName is not a valid token in the token space, then the module will not build.
233 If TokenName is not a feature flag, then the module will not build.
235 @param TokenName The name of the PCD token to retrieve a current value for.
237 @return A pointer to the buffer for the token.
240 #define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
244 Sets an 8-bit binary patchable PCD token value based on a token name.
246 Sets the 8-bit value for the token specified by TokenName. Value is returned.
247 If TokenName is not a valid token in the token space, then the module will not build.
248 If TokenName is not a feature flag, then the module will not build.
250 @param TokenName The name of the binary patchable PCD token to set the current value for.
251 @param Value The 8-bit value to set.
253 @return Return the Value that was set.
256 #define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
260 Sets a 16-bit binary patchable PCD token value based on a token name.
262 Sets the 16-bit value for the token specified by TokenName. Value is returned.
263 If TokenName is not a valid token in the token space, then the module will not build.
264 If TokenName is not a feature flag, then the module will not build.
266 @param TokenName The name of the binary patchable PCD token to set the current value for.
267 @param Value The 16-bit value to set.
269 @return Return the Value that was set.
272 #define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
276 Sets a 32-bit binary patchable PCD token value based on a token name.
278 Sets the 32-bit value for the token specified by TokenName. Value is returned.
279 If TokenName is not a valid token in the token space, then the module will not build.
280 If TokenName is not a feature flag, then the module will not build.
282 @param TokenName The name of the binary patchable PCD token to set the current value for.
283 @param Value The 32-bit value to set.
285 @return Return the Value that was set.
288 #define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
292 Sets a 64-bit binary patchable PCD token value based on a token name.
294 Sets the 64-bit value for the token specified by TokenName. Value is returned.
295 If TokenName is not a valid token in the token space, then the module will not build.
296 If TokenName is not a feature flag, then the module will not build.
298 @param TokenName The name of the binary patchable PCD token to set the current value for.
299 @param Value The 64-bit value to set.
301 @return Return the Value that was set.
304 #define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
308 Sets a Boolean binary patchable PCD token value based on a token name.
310 Sets the Boolean value for the token specified by TokenName. Value is returned.
311 If TokenName is not a valid token in the token space, then the module will not build.
312 If TokenName is not a feature flag, then the module will not build.
314 @param TokenName The name of the binary patchable PCD token to set the current value for.
315 @param Value The boolean value to set.
317 @return Return the Value that was set.
320 #define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
324 Sets a pointer to a binary patchable PCD token buffer based on a token name.
326 Sets the buffer for the token specified by TokenName. Buffer is returned.
327 If SizeOfBuffer is greater than the maximum size supported by TokenName, then set SizeOfBuffer
328 to the maximum size supported by TokenName and return NULL to indicate that the set operation
329 was not actually performed. If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be
330 set to the maximum size supported by TokenName and NULL must be returned.
331 If TokenName is not a valid token in the token space, then the module will not build.
332 If TokenName is not a feature flag, then the module will not build.
334 If SizeOfBuffer is NULL, then ASSERT().
335 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
337 @param TokenName The name of the binary patchable PCD token to set the current value for.
338 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.
339 @param Buffer Pointer to the value to set.
341 @return Return the pointer to the Buffer that was set.
344 #define PatchPcdSetPtr(TokenName, Size, Buffer) \
345 LibPatchPcdSetPtr ( \
346 _gPcd_BinaryPatch_##TokenName, \
347 (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
353 Retrieves an 8-bit PCD token value based on a token name.
355 Returns the 8-bit value for the token specified by TokenName.
356 If TokenName is not a valid token in the token space, then the module will not build.
358 @param TokenName The name of the PCD token to retrieve a current value for.
360 @return 8-bit value for the token specified by TokenName.
363 #define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName
367 Retrieves a 16-bit PCD token value based on a token name.
369 Returns the 16-bit value for the token specified by TokenName.
370 If TokenName is not a valid token in the token space, then the module will not build.
372 @param TokenName The name of the PCD token to retrieve a current value for.
374 @return 16-bit value for the token specified by TokenName.
377 #define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName
381 Retrieves a 32-bit PCD token value based on a token name.
383 Returns the 32-bit value for the token specified by TokenName.
384 If TokenName is not a valid token in the token space, then the module will not build.
386 @param TokenName The name of the PCD token to retrieve a current value for.
388 @return 32-bit value for the token specified by TokenName.
391 #define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
395 Retrieves a 64-bit PCD token value based on a token name.
397 Returns the 64-bit value for the token specified by TokenName.
398 If TokenName is not a valid token in the token space, then the module will not build.
400 @param TokenName The name of the PCD token to retrieve a current value for.
402 @return 64-bit value for the token specified by TokenName.
405 #define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName
409 Retrieves a pointer to a PCD token buffer based on a token name.
411 Returns a pointer to the buffer for the token specified by TokenName.
412 If TokenName is not a valid token in the token space, then the module will not build.
414 @param TokenName The name of the PCD token to retrieve a current value for.
416 @return A pointer to the buffer.
419 #define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName
423 Retrieves a Boolean PCD token value based on a token name.
425 Returns the Boolean value for the token specified by TokenName.
426 If TokenName is not a valid token in the token space, then the module will not build.
428 @param TokenName The name of the PCD token to retrieve a current value for.
430 @return A Boolean PCD token value.
433 #define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName
437 Sets an 8-bit PCD token value based on a token name.
439 Sets the 8-bit value for the token specified by TokenName. Value is returned.
440 If TokenName is not a valid token in the token space, then the module will not build.
442 If the set operation was not correctly performed, then ASSERT().
444 @param TokenName The name of the PCD token to retrieve a current value for.
445 @param Value The 8-bit value to set.
447 @return Return the Value that was set.
450 #define PcdSet8(TokenName, Value) _PCD_SET_MODE_8_##TokenName ((Value))
454 Sets a 16-bit PCD token value based on a token name.
456 Sets the 16-bit value for the token specified by TokenName. Value is returned.
457 If TokenName is not a valid token in the token space, then the module will not build.
459 If the set operation was not correctly performed, then ASSERT().
461 @param TokenName The name of the PCD token to retrieve a current value for.
462 @param Value The 16-bit value to set.
464 @return Return the Value that was set.
467 #define PcdSet16(TokenName, Value) _PCD_SET_MODE_16_##TokenName ((Value))
471 Sets a 32-bit PCD token value based on a token name.
473 Sets the 32-bit value for the token specified by TokenName. Value is returned.
474 If TokenName is not a valid token in the token space, then the module will not build.
476 If the set operation was not correctly performed, then ASSERT().
478 @param TokenName The name of the PCD token to retrieve a current value for.
479 @param Value The 32-bit value to set.
481 @return Return the Value that was set.
484 #define PcdSet32(TokenName, Value) _PCD_SET_MODE_32_##TokenName ((Value))
488 Sets a 64-bit PCD token value based on a token name.
490 Sets the 64-bit value for the token specified by TokenName. Value is returned.
491 If TokenName is not a valid token in the token space, then the module will not build.
493 @param TokenName The name of the PCD token to retrieve a current value for.
494 @param Value The 64-bit value to set.
496 @return Return the Value that was set.
499 #define PcdSet64(TokenName, Value) _PCD_SET_MODE_64_##TokenName ((Value))
503 Sets a pointer to a PCD token buffer based on a token name.
505 Sets the buffer for the token specified by TokenName. Buffer is returned.
506 If SizeOfBuffer is greater than the maximum size supported by TokenName,
507 then set SizeOfBuffer to the maximum size supported by TokenName and return NULL
508 to indicate that the set operation was not actually performed. If SizeOfBuffer
509 is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported
510 by TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.
511 If TokenName is not a valid token in the token space, then the module will not build.
513 If SizeOfBuffer is NULL, then ASSERT().
514 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
516 @param TokenName The name of the PCD token to set the current value for.
517 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.
518 @param Buffer A pointer to the buffer to set.
520 @return Return the pointer to the Buffer that was set.
523 #define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \
524 _PCD_SET_MODE_PTR_##TokenName ((SizeOfBuffer), (Buffer))
527 Sets a Boolean PCD token value based on a token name.
529 Sets the Boolean value for the token specified by TokenName. Value is returned.
530 If TokenName is not a valid token in the token space, then the module will not build.
532 If the set operation was not correctly performed, then ASSERT().
534 @param TokenName The name of the PCD token to set the current value for.
535 @param Buffer The Boolean value to set.
537 @return Return the Value that was set.
540 #define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))
544 Retrieves a token number based on a GUID and a token name.
546 Returns the token number for the token specified by Guid and TokenName.
548 @param Guid Pointer to a 128-bit unique value that designates
549 which namespace to retrieve a value from.
550 @param TokenName The name of the PCD token to retrieve a current value for.
552 @return Return the token number.
555 #define PcdTokenEx(Guid,TokenName) _PCD_TOKEN_EX_##TokenName(Guid)
558 Retrieves an 8-bit PCD token value based on a GUID and a token name.
560 Returns the 8-bit value for the token specified by Guid and TokenName.
561 If TokenName is not a valid token in the token space specified by Guid,
562 then the module will not build.
564 If Guid is NULL, then ASSERT().
566 @param Guid Pointer to a 128-bit unique value that designates
567 which namespace to retrieve a value from.
568 @param TokenName The name of the PCD token to retrieve a current value for.
570 @return An 8-bit PCD token value.
573 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
576 Retrieves a 16-bit PCD token value based on a GUID and a token name.
578 Returns the 16-bit value for the token specified by Guid and TokenName.
579 If TokenName is not a valid token in the token space specified by Guid,
580 then the module will not build.
582 If Guid is NULL, then ASSERT().
584 @param Guid Pointer to a 128-bit unique value that designates
585 which namespace to retrieve a value from.
586 @param TokenName The name of the PCD token to retrieve a current value for.
588 @return A 16-bit PCD token value.
591 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
595 Retrieves a 32-bit PCD token value based on a GUID and a token name.
597 Returns the 32-bit value for the token specified by Guid and TokenName.
598 If TokenName is not a valid token in the token space specified by Guid,
599 then the module will not build.
601 If Guid is NULL, then ASSERT().
603 @param Guid Pointer to a 128-bit unique value that designates
604 which namespace to retrieve a value from.
605 @param TokenName The name of the PCD token to retrieve a current value for.
607 @return A 32-bit PCD token value.
610 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
614 Retrieves a 64-bit PCD token value based on a GUID and a token name.
616 Returns the 64-bit value for the token specified by Guid and TokenName.
617 If TokenName is not a valid token in the token space specified by Guid,
618 then the module will not build.
620 If Guid is NULL, then ASSERT().
622 @param Guid Pointer to a 128-bit unique value that designates
623 which namespace to retrieve a value from.
624 @param TokenName The name of the PCD token to retrieve a current value for.
626 @return A 64-bit PCD token value.
629 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
633 Retrieves a pointer to a PCD token buffer based on a GUID and a token name.
635 Returns a pointer to the buffer for the token specified by Guid and TokenName.
636 If TokenName is not a valid token in the token space specified by Guid,
637 then the module will not build.
639 If Guid is NULL, then ASSERT().
641 @param Guid Pointer to a 128-bit unique value that designates
642 which namespace to retrieve a value from.
643 @param TokenName The name of the PCD token to retrieve a current value for.
645 @return A pointer to a PCD token buffer.
648 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
652 Retrieves a Boolean PCD token value based on a GUID and a token name.
654 Returns the Boolean value for the token specified by Guid and TokenName.
655 If TokenName is not a valid token in the token space specified by Guid,
656 then the module will not build.
658 If Guid is NULL, then ASSERT().
660 @param Guid Pointer to a 128-bit unique value that designates
661 which namespace to retrieve a value from.
662 @param TokenName The name of the PCD token to retrieve a current value for.
664 @return A Boolean PCD token value.
667 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), PcdTokenEx(Guid,TokenName))
671 Sets an 8-bit PCD token value based on a GUID and a token name.
673 Sets the 8-bit value for the token specified by Guid and TokenName. Value is returned.
674 If TokenName is not a valid token in the token space specified by Guid,
675 then the module will not build.
677 If Guid is NULL, then ASSERT().
678 If the set operation was not correctly performed, then ASSERT().
680 @param Guid Pointer to a 128-bit unique value that designates
681 which namespace to retrieve a value from.
682 @param TokenName The name of the PCD token to set the current value for.
683 @param Value The 8-bit value to set.
685 @return Return the Value that was set.
688 #define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
692 Sets a 16-bit PCD token value based on a GUID and a token name.
694 Sets the 16-bit value for the token specified by Guid and TokenName. Value is returned.
695 If TokenName is not a valid token in the token space specified by Guid,
696 then the module will not build.
698 If Guid is NULL, then ASSERT().
699 If the set operation was not correctly performed, then ASSERT().
701 @param Guid Pointer to a 128-bit unique value that designates
702 which namespace to retrieve a value from.
703 @param TokenName The name of the PCD token to set the current value for.
704 @param Value The 16-bit value to set.
706 @return Return the Value that was set.
709 #define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
713 Sets a 32-bit PCD token value based on a GUID and a token name.
715 Sets the 32-bit value for the token specified by Guid and TokenName. Value is returned.
716 If TokenName is not a valid token in the token space specified by Guid,
717 then the module will not build.
719 If Guid is NULL, then ASSERT().
720 If the set operation was not correctly performed, then ASSERT().
722 @param Guid Pointer to a 128-bit unique value that designates
723 which namespace to retrieve a value from.
724 @param TokenName The name of the PCD token to set the current value for.
725 @param Value The 32-bit value to set.
727 @return Return the Value that was set.
730 #define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
734 Sets a 64-bit PCD token value based on a GUID and a token name.
736 Sets the 64-bit value for the token specified by Guid and TokenName. Value is returned.
737 If TokenName is not a valid token in the token space specified by Guid,
738 then the module will not build.
740 If Guid is NULL, then ASSERT().
741 If the set operation was not correctly performed, then ASSERT().
743 @param Guid Pointer to a 128-bit unique value that designates
744 which namespace to retrieve a value from.
745 @param TokenName The name of the PCD token to set the current value for.
746 @param Value The 64-bit value to set.
748 @return Return the Value that was set.
751 #define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
755 Sets a pointer to a PCD token buffer based on a GUID and a token name.
757 Sets the buffer for the token specified by Guid and TokenName. Buffer is returned.
758 If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName,
759 then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return
760 NULL to indicate that the set operation was not actually performed. If SizeOfBuffer
761 is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported by
762 Guid and TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.
763 If TokenName is not a valid token in the token space specified by Guid,
764 then the module will not build.
766 If Guid is NULL, then ASSERT().
767 If SizeOfBuffer is NULL, then ASSERT().
768 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
770 @param Guid Pointer to a 128-bit unique value that designates
771 which namespace to retrieve a value from.
772 @param TokenName The name of the PCD token to set the current value for.
773 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.
774 @param Buffer Pointer to the buffer to set.
776 @return Return the pointer to the Buffer that was set.
779 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
780 LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
784 Sets a Boolean PCD token value based on a GUID and a token name.
786 Sets the Boolean value for the token specified by Guid and TokenName. Value is returned.
787 If TokenName is not a valid token in the token space specified by Guid,
788 then the module will not build.
790 If Guid is NULL, then ASSERT().
791 If the set operation was not correctly performed, then ASSERT().
793 @param Guid Pointer to a 128-bit unique value that designates
794 which namespace to retrieve a value from.
795 @param TokenName The name of the PCD token to set the current value for.
796 @param Value The Boolean value to set.
798 @return Return the Value that was set.
801 #define PcdSetExBool(Guid, TokenName, Value) \
802 LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))
806 This function provides a means by which SKU support can be established in the PCD infrastructure.
808 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
809 If SkuId >= PCD_MAX_SKU_ID, then ASSERT().
811 @param SkuId The SKU value that will be used when the PCD service retrieves and sets values
812 associated with a PCD token.
814 @return Return the SKU ID that was set.
825 This function provides a means by which to retrieve a value for a given PCD token.
827 Returns the 8-bit value for the token specified by TokenNumber.
829 @param[in] TokenNumber The PCD token number to retrieve a current value for.
831 @return Returns the 8-bit value for the token specified by TokenNumber.
842 This function provides a means by which to retrieve a value for a given PCD token.
844 Returns the 16-bit value for the token specified by TokenNumber.
846 @param[in] TokenNumber The PCD token number to retrieve a current value for.
848 @return Returns the 16-bit value for the token specified by TokenNumber.
859 This function provides a means by which to retrieve a value for a given PCD token.
861 Returns the 32-bit value for the token specified by TokenNumber.
863 @param[in] TokenNumber The PCD token number to retrieve a current value for.
865 @return Returns the 32-bit value for the token specified by TokenNumber.
876 This function provides a means by which to retrieve a value for a given PCD token.
878 Returns the 64-bit value for the token specified by TokenNumber.
880 @param[in] TokenNumber The PCD token number to retrieve a current value for.
882 @return Returns the 64-bit value for the token specified by TokenNumber.
893 This function provides a means by which to retrieve a value for a given PCD token.
895 Returns the pointer to the buffer of the token specified by TokenNumber.
897 @param[in] TokenNumber The PCD token number to retrieve a current value for.
899 @return Returns the pointer to the token specified by TokenNumber.
910 This function provides a means by which to retrieve a value for a given PCD token.
912 Returns the Boolean value of the token specified by TokenNumber.
914 @param[in] TokenNumber The PCD token number to retrieve a current value for.
916 @return Returns the Boolean value of the token specified by TokenNumber.
927 This function provides a means by which to retrieve the size of a given PCD token.
929 @param[in] TokenNumber The PCD token number to retrieve a current value for.
931 @return Returns the size of the token specified by TokenNumber.
942 This function provides a means by which to retrieve a value for a given PCD token.
944 Returns the 8-bit value for the token specified by TokenNumber and Guid.
946 If Guid is NULL, then ASSERT().
948 @param[in] Guid Pointer to a 128-bit unique value that designates
949 which namespace to retrieve a value from.
950 @param[in] TokenNumber The PCD token number to retrieve a current value for.
952 @return Return the UINT8.
964 This function provides a means by which to retrieve a value for a given PCD token.
966 Returns the 16-bit value for the token specified by TokenNumber and Guid.
968 If Guid is NULL, then ASSERT().
970 @param[in] Guid Pointer to a 128-bit unique value that designates
971 which namespace to retrieve a value from.
972 @param[in] TokenNumber The PCD token number to retrieve a current value for.
974 @return Return the UINT16.
986 Returns the 32-bit value for the token specified by TokenNumber and Guid.
987 If Guid is NULL, then ASSERT().
989 @param[in] Guid Pointer to a 128-bit unique value that designates
990 which namespace to retrieve a value from.
991 @param[in] TokenNumber The PCD token number to retrieve a current value for.
993 @return Return the UINT32.
1000 IN UINTN TokenNumber
1005 This function provides a means by which to retrieve a value for a given PCD token.
1007 Returns the 64-bit value for the token specified by TokenNumber and Guid.
1009 If Guid is NULL, then ASSERT().
1011 @param[in] Guid Pointer to a 128-bit unique value that designates
1012 which namespace to retrieve a value from.
1013 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1015 @return Return the UINT64.
1021 IN CONST GUID
*Guid
,
1022 IN UINTN TokenNumber
1027 This function provides a means by which to retrieve a value for a given PCD token.
1029 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
1031 If Guid is NULL, then ASSERT().
1033 @param[in] Guid Pointer to a 128-bit unique value that designates
1034 which namespace to retrieve a value from.
1035 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1037 @return Return the VOID* pointer.
1043 IN CONST GUID
*Guid
,
1044 IN UINTN TokenNumber
1049 This function provides a means by which to retrieve a value for a given PCD token.
1051 Returns the Boolean value of the token specified by TokenNumber and Guid.
1053 If Guid is NULL, then ASSERT().
1055 @param[in] Guid Pointer to a 128-bit unique value that designates
1056 which namespace to retrieve a value from.
1057 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1059 @return Return the BOOLEAN.
1065 IN CONST GUID
*Guid
,
1066 IN UINTN TokenNumber
1071 This function provides a means by which to retrieve the size of a given PCD token.
1073 Returns the size of the token specified by TokenNumber and Guid.
1075 If Guid is NULL, then ASSERT().
1077 @param[in] Guid Pointer to a 128-bit unique value that designates
1078 which namespace to retrieve a value from.
1079 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1081 @return Return the size.
1087 IN CONST GUID
*Guid
,
1088 IN UINTN TokenNumber
1093 This function provides a means by which to set a value for a given PCD token.
1095 Sets the 8-bit value for the token specified by TokenNumber
1096 to the value specified by Value. Value is returned.
1098 If the set operation was not correctly performed, then ASSERT().
1100 @param[in] TokenNumber The PCD token number to set a current value for.
1101 @param[in] Value The 8-bit value to set.
1103 @return Return the Value that was set.
1109 IN UINTN TokenNumber
,
1115 This function provides a means by which to set a value for a given PCD token.
1117 Sets the 16-bit value for the token specified by TokenNumber
1118 to the value specified by Value. Value is returned.
1120 If the set operation was not correctly performed, then ASSERT().
1122 @param[in] TokenNumber The PCD token number to set a current value for.
1123 @param[in] Value The 16-bit value to set.
1125 @return Return the Value that was set.
1131 IN UINTN TokenNumber
,
1137 This function provides a means by which to set a value for a given PCD token.
1139 Sets the 32-bit value for the token specified by TokenNumber
1140 to the value specified by Value. Value is returned.
1142 If the set operation was not correctly performed, then ASSERT().
1144 @param[in] TokenNumber The PCD token number to set a current value for.
1145 @param[in] Value The 32-bit value to set.
1147 @return Return the Value that was set.
1153 IN UINTN TokenNumber
,
1159 This function provides a means by which to set a value for a given PCD token.
1161 Sets the 64-bit value for the token specified by TokenNumber
1162 to the value specified by Value. Value is returned.
1164 If the set operation was not correctly performed, then ASSERT().
1166 @param[in] TokenNumber The PCD token number to set a current value for.
1167 @param[in] Value The 64-bit value to set.
1169 @return Return the Value that was set.
1175 IN UINTN TokenNumber
,
1181 This function provides a means by which to set a value for a given PCD token.
1183 Sets a buffer for the token specified by TokenNumber to the value
1184 specified by Buffer and SizeOfBuffer. Buffer is returned.
1185 If SizeOfBuffer is greater than the maximum size support by TokenNumber,
1186 then set SizeOfBuffer to the maximum size supported by TokenNumber and
1187 return NULL to indicate that the set operation was not actually performed,
1188 or ASSERT() if the set operation was not corretly performed.
1190 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
1191 maximum size supported by TokenName and NULL must be returned.
1193 If SizeOfBuffer is NULL, then ASSERT().
1194 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1196 @param[in] TokenNumber The PCD token number to set a current value for.
1197 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1198 @param[in] Buffer A pointer to the buffer to set.
1200 @return Return the pointer for the Buffer that was set.
1206 IN UINTN TokenNumber
,
1207 IN OUT UINTN
*SizeOfBuffer
,
1208 IN CONST VOID
*Buffer
1213 This function provides a means by which to set a value for a given PCD token.
1215 Sets the Boolean value for the token specified by TokenNumber
1216 to the value specified by Value. Value is returned.
1218 If the set operation was not correctly performed, then ASSERT().
1220 @param[in] TokenNumber The PCD token number to set a current value for.
1221 @param[in] Value The boolean value to set.
1223 @return Return the Value that was set.
1229 IN UINTN TokenNumber
,
1235 This function provides a means by which to set a value for a given PCD token.
1237 Sets the 8-bit value for the token specified by TokenNumber and
1238 Guid to the value specified by Value. Value is returned.
1240 If Guid is NULL, then ASSERT().
1241 If the set operation was not correctly performed, then ASSERT().
1243 @param[in] Guid Pointer to a 128-bit unique value that
1244 designates which namespace to set a value from.
1245 @param[in] TokenNumber The PCD token number to set a current value for.
1246 @param[in] Value The 8-bit value to set.
1248 @return Return the Value that was set.
1254 IN CONST GUID
*Guid
,
1255 IN UINTN TokenNumber
,
1261 This function provides a means by which to set a value for a given PCD token.
1263 Sets the 16-bit value for the token specified by TokenNumber and
1264 Guid to the value specified by Value. Value is returned.
1266 If Guid is NULL, then ASSERT().
1267 If the set operation was not correctly performed, then ASSERT().
1269 @param[in] Guid Pointer to a 128-bit unique value that
1270 designates which namespace to set a value from.
1271 @param[in] TokenNumber The PCD token number to set a current value for.
1272 @param[in] Value The 16-bit value to set.
1274 @return Return the Value that was set.
1280 IN CONST GUID
*Guid
,
1281 IN UINTN TokenNumber
,
1287 This function provides a means by which to set a value for a given PCD token.
1289 Sets the 32-bit value for the token specified by TokenNumber and
1290 Guid to the value specified by Value. Value is returned.
1292 If Guid is NULL, then ASSERT().
1293 If the set operation was not correctly performed, then ASSERT().
1295 @param[in] Guid Pointer to a 128-bit unique value that
1296 designates which namespace to set a value from.
1297 @param[in] TokenNumber The PCD token number to set a current value for.
1298 @param[in] Value The 32-bit value to set.
1300 @return Return the Value that was set.
1306 IN CONST GUID
*Guid
,
1307 IN UINTN TokenNumber
,
1313 This function provides a means by which to set a value for a given PCD token.
1315 Sets the 64-bit value for the token specified by TokenNumber and
1316 Guid to the value specified by Value. Value is returned.
1318 If Guid is NULL, then ASSERT().
1319 If the set operation was not correctly performed, then ASSERT().
1321 @param[in] Guid Pointer to a 128-bit unique value that
1322 designates which namespace to set a value from.
1323 @param[in] TokenNumber The PCD token number to set a current value for.
1324 @param[in] Value The 64-bit value to set.
1326 @return Return the Value that was set.
1332 IN CONST GUID
*Guid
,
1333 IN UINTN TokenNumber
,
1339 This function provides a means by which to set a value for a given PCD token.
1341 Sets a buffer for the token specified by TokenNumber to the value specified by
1342 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1343 the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
1344 supported by TokenNumber and return NULL to indicate that the set operation
1345 was not actually performed, or ASSERT() if the set operation was not corretly performed.
1347 If Guid is NULL, then ASSERT().
1348 If SizeOfBuffer is NULL, then ASSERT().
1349 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1351 @param[in] Guid Pointer to a 128-bit unique value that
1352 designates which namespace to set a value from.
1353 @param[in] TokenNumber The PCD token number to set a current value for.
1354 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1355 @param[in] Buffer A pointer to the buffer to set.
1357 @return Return the pointer to the Buffer that was set.
1363 IN CONST GUID
*Guid
,
1364 IN UINTN TokenNumber
,
1365 IN OUT UINTN
*SizeOfBuffer
,
1371 This function provides a means by which to set a value for a given PCD token.
1373 Sets the Boolean value for the token specified by TokenNumber and
1374 Guid to the value specified by Value. Value is returned.
1376 If Guid is NULL, then ASSERT().
1377 If the set operation was not correctly performed, then ASSERT().
1379 @param[in] Guid Pointer to a 128-bit unique value that
1380 designates which namespace to set a value from.
1381 @param[in] TokenNumber The PCD token number to set a current value for.
1382 @param[in] Value The Boolean value to set.
1384 @return Return the Value that was set.
1390 IN CONST GUID
*Guid
,
1391 IN UINTN TokenNumber
,
1397 This notification function serves two purposes.
1399 Firstly, it notifies the module that did the registration that the value of this
1400 PCD token has been set.
1401 Secondly, it provides a mechanism for the module that did the registration to intercept
1402 the set operation and override the value been set if necessary. After the invocation of
1403 the callback function, TokenData will be used by PCD service PEIM or driver to modify th
1404 internal data in PCD database.
1406 @param[in] CallBackGuid The PCD token GUID being set.
1407 @param[in] CallBackToken The PCD token number being set.
1408 @param[in, out] TokenData A pointer to the token data being set.
1409 @param[in] TokenDataSize The size, in bytes, of the data being set.
1414 (EFIAPI
*PCD_CALLBACK
)(
1415 IN CONST GUID
*CallBackGuid
, OPTIONAL
1416 IN UINTN CallBackToken
,
1417 IN OUT VOID
*TokenData
,
1418 IN UINTN TokenDataSize
1423 Set up a notification function that is called when a specified token is set.
1425 When the token specified by TokenNumber and Guid is set,
1426 then notification function specified by NotificationFunction is called.
1427 If Guid is NULL, then the default token space is used.
1428 If NotificationFunction is NULL, then ASSERT().
1430 @param[in] Guid Pointer to a 128-bit unique value that designates which
1431 namespace to set a value from. If NULL, then the default
1432 token space is used.
1433 @param[in] TokenNumber The PCD token number to monitor.
1434 @param[in] NotificationFunction The function to call when the token
1435 specified by Guid and TokenNumber is set.
1440 LibPcdCallbackOnSet (
1441 IN CONST GUID
*Guid
, OPTIONAL
1442 IN UINTN TokenNumber
,
1443 IN PCD_CALLBACK NotificationFunction
1448 Disable a notification function that was established with LibPcdCallbackonSet().
1450 Disable a notification function that was previously established with LibPcdCallbackOnSet().
1451 If NotificationFunction is NULL, then ASSERT().
1452 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1453 and NotificationFunction, then ASSERT().
1455 @param[in] Guid Specify the GUID token space.
1456 @param[in] TokenNumber Specify the token number.
1457 @param[in] NotificationFunction The callback function to be unregistered.
1462 LibPcdCancelCallback (
1463 IN CONST GUID
*Guid
, OPTIONAL
1464 IN UINTN TokenNumber
,
1465 IN PCD_CALLBACK NotificationFunction
1470 Retrieves the next token in a token space.
1472 Retrieves the next PCD token number from the token space specified by Guid.
1473 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
1474 then the first token number is returned. Otherwise, the token number that
1475 follows TokenNumber in the token space is returned. If TokenNumber is the last
1476 token number in the token space, then 0 is returned.
1478 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1480 @param[in] Guid Pointer to a 128-bit unique value that designates which namespace
1481 to set a value from. If NULL, then the default token space is used.
1482 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
1485 @return The next valid token number.
1490 LibPcdGetNextToken (
1491 IN CONST GUID
*Guid
, OPTIONAL
1492 IN UINTN TokenNumber
1498 Used to retrieve the list of available PCD token space GUIDs.
1500 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1502 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1503 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1505 @param TokenSpaceGuid Pointer to the a PCD token space GUID
1507 @return The next valid token namespace.
1512 LibPcdGetNextTokenSpace (
1513 IN CONST GUID
*TokenSpaceGuid
1518 Sets a value of a patchable PCD entry that is type pointer.
1520 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1521 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1522 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1523 NULL to indicate that the set operation was not actually performed.
1524 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1525 MaximumDatumSize and NULL must be returned.
1527 If PatchVariable is NULL, then ASSERT().
1528 If SizeOfBuffer is NULL, then ASSERT().
1529 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1531 @param[in] PatchVariable A pointer to the global variable in a module that is
1532 the target of the set operation.
1533 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1534 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1535 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1537 @return Return the pointer to the Buffer that was set.
1543 IN VOID
*PatchVariable
,
1544 IN UINTN MaximumDatumSize
,
1545 IN OUT UINTN
*SizeOfBuffer
,
1546 IN CONST VOID
*Buffer
1560 /// The returned information associated with the requested TokenNumber. If
1561 /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.
1565 /// The size of the data in bytes associated with the TokenNumber specified. If
1566 /// TokenNumber is 0, then PcdSize is set 0.
1570 /// The null-terminated ASCII string associated with a given token. If the
1571 /// TokenNumber specified was 0, then this field corresponds to the null-terminated
1572 /// ASCII string associated with the token's namespace Guid. If NULL, there is no
1573 /// name associated with this request.
1580 Retrieve additional information associated with a PCD token.
1582 This includes information such as the type of value the TokenNumber is associated with as well as possible
1583 human readable name that is associated with the token.
1585 If TokenNumber is not in the default token space specified, then ASSERT().
1587 @param[in] TokenNumber The PCD token number.
1588 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1589 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1594 IN UINTN TokenNumber
,
1595 OUT PCD_INFO
*PcdInfo
1599 Retrieve additional information associated with a PCD token.
1601 This includes information such as the type of value the TokenNumber is associated with as well as possible
1602 human readable name that is associated with the token.
1604 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1606 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1607 @param[in] TokenNumber The PCD token number.
1608 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1609 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1614 IN CONST GUID
*Guid
,
1615 IN UINTN TokenNumber
,
1616 OUT PCD_INFO
*PcdInfo
1620 Retrieve the currently set SKU Id.
1622 If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
1624 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1625 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU