2 A emptry template implementation of PCD Library.
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.
20 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
22 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
23 set values associated with a PCD token.
25 @retval SKU_ID Return the SKU ID that just be set.
34 ASSERT (SkuId
< 0x100);
42 Returns the 8-bit value for the token specified by TokenNumber.
44 @param[in] The PCD token number to retrieve a current value for.
46 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
61 Returns the 16-bit value for the token specified by TokenNumber.
63 @param[in] The PCD token number to retrieve a current value for.
65 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
80 Returns the 32-bit value for the token specified by TokenNumber.
82 @param[in] TokenNumber The PCD token number to retrieve a current value for.
84 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
99 Returns the 64-bit value for the token specified by TokenNumber.
101 @param[in] TokenNumber The PCD token number to retrieve a current value for.
103 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
118 Returns the pointer to the buffer of the token specified by TokenNumber.
120 @param[in] TokenNumber The PCD token number to retrieve a current value for.
122 @retval VOID* Returns the pointer to the token specified by TokenNumber.
137 Returns the Boolean value of the token specified by TokenNumber.
139 @param[in] TokenNumber The PCD token number to retrieve a current value for.
141 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
156 Returns the size of the token specified by TokenNumber.
158 @param[in] TokenNumber The PCD token number to retrieve a current value for.
160 @retval UINTN Returns the size of the token specified by TokenNumber.
175 Returns the 8-bit value for the token specified by TokenNumber and Guid.
176 If Guid is NULL, then ASSERT().
178 @param[in] Guid Pointer to a 128-bit unique value that designates
179 which namespace to retrieve a value from.
180 @param[in] TokenNumber The PCD token number to retrieve a current value for.
182 @retval UINT8 Return the UINT8.
192 ASSERT (Guid
!= NULL
);
200 Returns the 16-bit value for the token specified by TokenNumber and Guid.
201 If Guid is NULL, then ASSERT().
203 @param[in] Guid Pointer to a 128-bit unique value that designates
204 which namespace to retrieve a value from.
205 @param[in] TokenNumber The PCD token number to retrieve a current value for.
207 @retval UINT16 Return the UINT16.
217 ASSERT (Guid
!= NULL
);
225 Returns the 32-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 UINT32 Return the UINT32.
242 ASSERT (Guid
!= NULL
);
250 Returns the 64-bit value for the token specified by TokenNumber and Guid.
251 If Guid is NULL, then ASSERT().
253 @param[in] Guid Pointer to a 128-bit unique value that designates
254 which namespace to retrieve a value from.
255 @param[in] TokenNumber The PCD token number to retrieve a current value for.
257 @retval UINT64 Return the UINT64.
267 ASSERT (Guid
!= NULL
);
275 Returns the pointer to the buffer of the token specified by TokenNumber and Guid.
276 If Guid is NULL, then ASSERT().
278 @param[in] Guid Pointer to a 128-bit unique value that designates
279 which namespace to retrieve a value from.
280 @param[in] TokenNumber The PCD token number to retrieve a current value for.
282 @retval VOID* Return the VOID* pointer.
292 ASSERT (Guid
!= NULL
);
300 Returns the Boolean value of the token specified by TokenNumber and Guid.
301 If Guid is NULL, then ASSERT().
303 @param[in] Guid Pointer to a 128-bit unique value that designates
304 which namespace to retrieve a value from.
305 @param[in] TokenNumber The PCD token number to retrieve a current value for.
307 @retval BOOLEAN Return the BOOLEAN.
317 ASSERT (Guid
!= NULL
);
325 Returns the size of the token specified by TokenNumber and Guid.
326 If Guid is NULL, then ASSERT().
328 @param[in] Guid Pointer to a 128-bit unique value that designates
329 which namespace to retrieve a value from.
330 @param[in] TokenNumber The PCD token number to retrieve a current value for.
332 @retval UINTN Return the size.
342 ASSERT (Guid
!= NULL
);
350 Sets the 8-bit value for the token specified by TokenNumber
351 to the value specified by Value. Value is returned.
353 @param[in] TokenNumber The PCD token number to set a current value for.
354 @param[in] Value The 8-bit value to set.
356 @retval UINT8 Return the value been set.
362 IN UINTN TokenNumber
,
372 Sets the 16-bit value for the token specified by TokenNumber
373 to the value specified by Value. Value is returned.
375 @param[in] TokenNumber The PCD token number to set a current value for.
376 @param[in] Value The 16-bit value to set.
378 @retval UINT16 Return the value been set.
384 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
,
416 Sets the 64-bit value for the token specified by TokenNumber
417 to the value specified by Value. Value is returned.
419 @param[in] TokenNumber The PCD token number to set a current value for.
420 @param[in] Value The 64-bit value to set.
422 @retval UINT64 Return the value been set.
428 IN UINTN TokenNumber
,
438 Sets a buffer for the token specified by TokenNumber to
439 the value specified by Buffer and SizeOfValue. Buffer to
440 be set is returned. The content of the buffer could be
441 overwritten if a Callback on SET is registered with this
444 If SizeOfValue is greater than the maximum
445 size support by TokenNumber, then set SizeOfValue to the
446 maximum size supported by TokenNumber and return NULL to
447 indicate that the set operation was not actually performed.
449 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
451 @param[in] TokenNumber The PCD token number to set a current value for.
452 @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
453 @param[in] Value A pointer to the buffer to set.
455 @retval VOID* Return the pointer for the buffer been set.
461 IN UINTN TokenNumber
,
462 IN OUT UINTN
*SizeOfBuffer
,
466 ASSERT (SizeOfBuffer
!= NULL
);
468 if (*SizeOfBuffer
> 0) {
469 ASSERT (Buffer
!= NULL
);
478 Sets the Boolean value for the token specified by TokenNumber
479 to the value specified by Value. Value is returned.
481 @param[in] TokenNumber The PCD token number to set a current value for.
482 @param[in] Value The boolean value to set.
484 @retval BOOLEAN Return the value been set.
490 IN UINTN TokenNumber
,
500 Sets the 8-bit value for the token specified by TokenNumber and
501 Guid to the value specified by Value. Value is returned.
502 If Guid is NULL, then ASSERT().
504 @param[in] Guid Pointer to a 128-bit unique value that
505 designates which namespace to set a value from.
506 @param[in] TokenNumber The PCD token number to set a current value for.
507 @param[in] Value The 8-bit value to set.
509 @retval UINT8 Return the value been set.
516 IN UINTN TokenNumber
,
520 ASSERT (Guid
!= NULL
);
528 Sets the 16-bit value for the token specified by TokenNumber and
529 Guid to the value specified by Value. Value is returned.
530 If Guid is NULL, then ASSERT().
532 @param[in] Guid Pointer to a 128-bit unique value that
533 designates which namespace to set a value from.
534 @param[in] TokenNumber The PCD token number to set a current value for.
535 @param[in] Value The 16-bit value to set.
537 @retval UINT8 Return the value been set.
544 IN UINTN TokenNumber
,
548 ASSERT (Guid
!= NULL
);
556 Sets the 32-bit value for the token specified by TokenNumber and
557 Guid to the value specified by Value. Value is returned.
558 If Guid 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 32-bit value to set.
565 @retval UINT32 Return the value been set.
572 IN UINTN TokenNumber
,
576 ASSERT (Guid
!= NULL
);
584 Sets the 64-bit value for the token specified by TokenNumber and
585 Guid to the value specified by Value. Value is returned.
586 If Guid is NULL, then ASSERT().
588 @param[in] Guid Pointer to a 128-bit unique value that
589 designates which namespace to set a value from.
590 @param[in] TokenNumber The PCD token number to set a current value for.
591 @param[in] Value The 64-bit value to set.
593 @retval UINT64 Return the value been set.
600 IN UINTN TokenNumber
,
604 ASSERT (Guid
!= NULL
);
612 Sets a buffer for the token specified by TokenNumber to the value specified by
613 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
614 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
615 supported by TokenNumber and return NULL to indicate that the set operation
616 was not actually performed.
618 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
620 @param[in] Guid Pointer to a 128-bit unique value that
621 designates which namespace to set a value from.
622 @param[in] TokenNumber The PCD token number to set a current value for.
623 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
624 @param[in] Buffer A pointer to the buffer to set.
626 @retval VOID * Return the pinter to the buffer been set.
633 IN UINTN TokenNumber
,
634 IN OUT UINTN
*SizeOfBuffer
,
638 ASSERT (Guid
!= NULL
);
640 ASSERT (SizeOfBuffer
!= NULL
);
642 if (*SizeOfBuffer
> 0) {
643 ASSERT (Buffer
!= NULL
);
652 Sets the Boolean value for the token specified by TokenNumber and
653 Guid to the value specified by Value. Value is returned.
654 If Guid is NULL, then ASSERT().
656 @param[in] Guid Pointer to a 128-bit unique value that
657 designates which namespace to set a value from.
658 @param[in] TokenNumber The PCD token number to set a current value for.
659 @param[in] Value The Boolean value to set.
661 @retval Boolean Return the value been set.
668 IN UINTN TokenNumber
,
672 ASSERT (Guid
!= NULL
);
680 When the token specified by TokenNumber and Guid is set,
681 then notification function specified by NotificationFunction is called.
682 If Guid is NULL, then the default token space is used.
683 If NotificationFunction is NULL, then ASSERT().
685 @param[in] Guid Pointer to a 128-bit unique value that designates which
686 namespace to set a value from. If NULL, then the default
688 @param[in] TokenNumber The PCD token number to monitor.
689 @param[in] NotificationFunction The function to call when the token
690 specified by Guid and TokenNumber is set.
697 LibPcdCallbackOnSet (
698 IN CONST GUID
*Guid
, OPTIONAL
699 IN UINTN TokenNumber
,
700 IN PCD_CALLBACK NotificationFunction
703 ASSERT (NotificationFunction
!= NULL
);
709 Disable a notification function that was established with LibPcdCallbackonSet().
710 If NotificationFunction is NULL, then ASSERT().
712 @param[in] Guid Specify the GUID token space.
713 @param[in] TokenNumber Specify the token number.
714 @param[in] NotificationFunction The callback function to be unregistered.
721 LibPcdCancelCallback (
722 IN CONST GUID
*Guid
, OPTIONAL
723 IN UINTN TokenNumber
,
724 IN PCD_CALLBACK NotificationFunction
727 ASSERT (NotificationFunction
!= NULL
);
733 Retrieves the next PCD token number from the token space specified by Guid.
734 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
735 then the first token number is returned. Otherwise, the token number that
736 follows TokenNumber in the token space is returned. If TokenNumber is the last
737 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
738 is not in the token space specified by Guid, then ASSERT().
740 @param[in] Pointer to a 128-bit unique value that designates which namespace
741 to set a value from. If NULL, then the default token space is used.
742 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
745 @retval UINTN The next valid token number.
751 IN CONST GUID
*Guid
, OPTIONAL
761 Retrieves the next PCD token space from a token space specified by Guid.
762 Guid of NULL is reserved to mark the default local token namespace on the current
763 platform. If Guid is NULL, then the GUID of the first non-local token space of the
764 current platform is returned. If Guid is the last non-local token space,
765 then NULL is returned.
767 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
771 @param[in] Pointer to a 128-bit unique value that designates from which namespace
774 @retval CONST GUID * The next valid token namespace.
779 LibPcdGetNextTokenSpace (
789 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
790 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
791 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
792 NULL to indicate that the set operation was not actually performed.
793 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
794 MaximumDatumSize and NULL must be returned.
796 If PatchVariable is NULL, then ASSERT().
797 If SizeOfValue is NULL, then ASSERT().
798 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
800 @param[in] PatchVariable A pointer to the global variable in a module that is
801 the target of the set operation.
802 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
803 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
804 @param[in] Buffer A pointer to the buffer to used to set the target variable.
810 IN VOID
*PatchVariable
,
811 IN UINTN MaximumDatumSize
,
812 IN OUT UINTN
*SizeOfBuffer
,
813 IN CONST VOID
*Buffer
816 ASSERT (PatchVariable
!= NULL
);
817 ASSERT (SizeOfBuffer
!= NULL
);
819 if (*SizeOfBuffer
> 0) {
820 ASSERT (Buffer
!= NULL
);
823 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
824 (*SizeOfBuffer
== MAX_ADDRESS
)) {
825 *SizeOfBuffer
= MaximumDatumSize
;
829 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
831 return (VOID
*) Buffer
;