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 if (*SizeOfBuffer
> 0) {
467 ASSERT (Buffer
!= NULL
);
476 Sets the Boolean value for the token specified by TokenNumber
477 to the value specified by Value. Value is returned.
479 @param[in] TokenNumber The PCD token number to set a current value for.
480 @param[in] Value The boolean value to set.
482 @retval BOOLEAN Return the value been set.
488 IN UINTN TokenNumber
,
498 Sets the 8-bit value for the token specified by TokenNumber and
499 Guid to the value specified by Value. Value is returned.
500 If Guid is NULL, then ASSERT().
502 @param[in] Guid Pointer to a 128-bit unique value that
503 designates which namespace to set a value from.
504 @param[in] TokenNumber The PCD token number to set a current value for.
505 @param[in] Value The 8-bit value to set.
507 @retval UINT8 Return the value been set.
514 IN UINTN TokenNumber
,
518 ASSERT (Guid
!= NULL
);
526 Sets the 16-bit value for the token specified by TokenNumber and
527 Guid to the value specified by Value. Value is returned.
528 If Guid is NULL, then ASSERT().
530 @param[in] Guid Pointer to a 128-bit unique value that
531 designates which namespace to set a value from.
532 @param[in] TokenNumber The PCD token number to set a current value for.
533 @param[in] Value The 16-bit value to set.
535 @retval UINT8 Return the value been set.
542 IN UINTN TokenNumber
,
546 ASSERT (Guid
!= NULL
);
554 Sets the 32-bit value for the token specified by TokenNumber and
555 Guid to the value specified by Value. Value is returned.
556 If Guid is NULL, then ASSERT().
558 @param[in] Guid Pointer to a 128-bit unique value that
559 designates which namespace to set a value from.
560 @param[in] TokenNumber The PCD token number to set a current value for.
561 @param[in] Value The 32-bit value to set.
563 @retval UINT32 Return the value been set.
570 IN UINTN TokenNumber
,
574 ASSERT (Guid
!= NULL
);
582 Sets the 64-bit value for the token specified by TokenNumber and
583 Guid to the value specified by Value. Value is returned.
584 If Guid is NULL, then ASSERT().
586 @param[in] Guid Pointer to a 128-bit unique value that
587 designates which namespace to set a value from.
588 @param[in] TokenNumber The PCD token number to set a current value for.
589 @param[in] Value The 64-bit value to set.
591 @retval UINT64 Return the value been set.
598 IN UINTN TokenNumber
,
602 ASSERT (Guid
!= NULL
);
610 Sets a buffer for the token specified by TokenNumber to the value specified by
611 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
612 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
613 supported by TokenNumber and return NULL to indicate that the set operation
614 was not actually performed.
616 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
618 @param[in] Guid Pointer to a 128-bit unique value that
619 designates which namespace to set a value from.
620 @param[in] TokenNumber The PCD token number to set a current value for.
621 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
622 @param[in] Buffer A pointer to the buffer to set.
624 @retval VOID * Return the pinter to the buffer been set.
631 IN UINTN TokenNumber
,
632 IN OUT UINTN
*SizeOfBuffer
,
636 ASSERT (Guid
!= NULL
);
638 ASSERT (SizeOfBuffer
!= NULL
);
640 if (*SizeOfBuffer
> 0) {
641 ASSERT (Buffer
!= NULL
);
650 Sets the Boolean value for the token specified by TokenNumber and
651 Guid to the value specified by Value. Value is returned.
652 If Guid is NULL, then ASSERT().
654 @param[in] Guid Pointer to a 128-bit unique value that
655 designates which namespace to set a value from.
656 @param[in] TokenNumber The PCD token number to set a current value for.
657 @param[in] Value The Boolean value to set.
659 @retval Boolean Return the value been set.
666 IN UINTN TokenNumber
,
670 ASSERT (Guid
!= NULL
);
678 When the token specified by TokenNumber and Guid is set,
679 then notification function specified by NotificationFunction is called.
680 If Guid is NULL, then the default token space is used.
681 If NotificationFunction is NULL, then ASSERT().
683 @param[in] Guid Pointer to a 128-bit unique value that designates which
684 namespace to set a value from. If NULL, then the default
686 @param[in] TokenNumber The PCD token number to monitor.
687 @param[in] NotificationFunction The function to call when the token
688 specified by Guid and TokenNumber is set.
695 LibPcdCallbackOnSet (
696 IN CONST GUID
*Guid
, OPTIONAL
697 IN UINTN TokenNumber
,
698 IN PCD_CALLBACK NotificationFunction
701 ASSERT (NotificationFunction
!= NULL
);
707 Disable a notification function that was established with LibPcdCallbackonSet().
708 If NotificationFunction is NULL, then ASSERT().
710 @param[in] Guid Specify the GUID token space.
711 @param[in] TokenNumber Specify the token number.
712 @param[in] NotificationFunction The callback function to be unregistered.
719 LibPcdCancelCallback (
720 IN CONST GUID
*Guid
, OPTIONAL
721 IN UINTN TokenNumber
,
722 IN PCD_CALLBACK NotificationFunction
725 ASSERT (NotificationFunction
!= NULL
);
731 Retrieves the next PCD token number from the token space specified by Guid.
732 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
733 then the first token number is returned. Otherwise, the token number that
734 follows TokenNumber in the token space is returned. If TokenNumber is the last
735 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
736 is not in the token space specified by Guid, then ASSERT().
738 @param[in] Pointer to a 128-bit unique value that designates which namespace
739 to set a value from. If NULL, then the default token space is used.
740 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
743 @retval UINTN The next valid token number.
749 IN CONST GUID
*Guid
, OPTIONAL
759 Retrieves the next PCD token space from a token space specified by Guid.
760 Guid of NULL is reserved to mark the default local token namespace on the current
761 platform. If Guid is NULL, then the GUID of the first non-local token space of the
762 current platform is returned. If Guid is the last non-local token space,
763 then NULL is returned.
765 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
769 @param[in] Pointer to a 128-bit unique value that designates from which namespace
772 @retval CONST GUID * The next valid token namespace.
777 LibPcdGetNextTokenSpace (
787 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
788 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
789 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
790 NULL to indicate that the set operation was not actually performed.
791 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
792 MaximumDatumSize and NULL must be returned.
794 If PatchVariable is NULL, then ASSERT().
795 If SizeOfValue is NULL, then ASSERT().
796 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
798 @param[in] PatchVariable A pointer to the global variable in a module that is
799 the target of the set operation.
800 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
801 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
802 @param[in] Buffer A pointer to the buffer to used to set the target variable.
808 IN VOID
*PatchVariable
,
809 IN UINTN MaximumDatumSize
,
810 IN OUT UINTN
*SizeOfBuffer
,
811 IN CONST VOID
*Buffer
814 ASSERT (PatchVariable
!= NULL
);
815 ASSERT (SizeOfBuffer
!= NULL
);
817 if (*SizeOfBuffer
> 0) {
818 ASSERT (Buffer
!= NULL
);
821 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
822 (*SizeOfBuffer
== MAX_ADDRESS
)) {
823 *SizeOfBuffer
= MaximumDatumSize
;
827 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
829 return (VOID
*) Buffer
;