2 A emptry template implementation of PCD Library.
\r
4 Copyright (c) 2006, Intel Corporation
\r
5 All rights reserved. This program and the accompanying materials
\r
6 are licensed and made available under the terms and conditions of the BSD License
\r
7 which accompanies this distribution. The full text of the license may be found at
\r
8 http://opensource.org/licenses/bsd-license.php
\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
\r
16 #include <Library/DebugLib.h>
\r
17 #include <Library/PcdLib.h>
\r
18 #include <Library/BaseMemoryLib.h>
\r
22 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
\r
24 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
\r
25 set values associated with a PCD token.
\r
27 @retval SKU_ID Return the SKU ID that just be set.
\r
36 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
44 Returns the 8-bit value for the token specified by TokenNumber.
\r
46 @param[in] The PCD token number to retrieve a current value for.
\r
48 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
\r
54 IN UINTN TokenNumber
\r
57 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
65 Returns the 16-bit value for the token specified by TokenNumber.
\r
67 @param[in] The PCD token number to retrieve a current value for.
\r
69 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
\r
75 IN UINTN TokenNumber
\r
78 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
86 Returns the 32-bit value for the token specified by TokenNumber.
\r
88 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
90 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
\r
96 IN UINTN TokenNumber
\r
99 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
107 Returns the 64-bit value for the token specified by TokenNumber.
\r
109 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
111 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
\r
117 IN UINTN TokenNumber
\r
120 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
128 Returns the pointer to the buffer of the token specified by TokenNumber.
\r
130 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
132 @retval VOID* Returns the pointer to the token specified by TokenNumber.
\r
138 IN UINTN TokenNumber
\r
141 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
149 Returns the Boolean value of the token specified by TokenNumber.
\r
151 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
153 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
\r
159 IN UINTN TokenNumber
\r
162 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
170 Returns the size of the token specified by TokenNumber.
\r
172 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
174 @retval UINTN Returns the size of the token specified by TokenNumber.
\r
180 IN UINTN TokenNumber
\r
183 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
191 Returns the 8-bit value for the token specified by TokenNumber and Guid.
\r
192 If Guid is NULL, then ASSERT().
\r
194 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
195 which namespace to retrieve a value from.
\r
196 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
198 @retval UINT8 Return the UINT8.
\r
204 IN CONST GUID *Guid,
\r
205 IN UINTN TokenNumber
\r
208 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
216 Returns the 16-bit value for the token specified by TokenNumber and Guid.
\r
217 If Guid is NULL, then ASSERT().
\r
219 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
220 which namespace to retrieve a value from.
\r
221 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
223 @retval UINT16 Return the UINT16.
\r
229 IN CONST GUID *Guid,
\r
230 IN UINTN TokenNumber
\r
233 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
241 Returns the 32-bit value for the token specified by TokenNumber and Guid.
\r
242 If Guid is NULL, then ASSERT().
\r
244 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
245 which namespace to retrieve a value from.
\r
246 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
248 @retval UINT32 Return the UINT32.
\r
254 IN CONST GUID *Guid,
\r
255 IN UINTN TokenNumber
\r
258 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
266 Returns the 64-bit value for the token specified by TokenNumber and Guid.
\r
267 If Guid is NULL, then ASSERT().
\r
269 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
270 which namespace to retrieve a value from.
\r
271 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
273 @retval UINT64 Return the UINT64.
\r
279 IN CONST GUID *Guid,
\r
280 IN UINTN TokenNumber
\r
283 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
291 Returns the pointer to the buffer of the token specified by TokenNumber and Guid.
\r
292 If Guid is NULL, then ASSERT().
\r
294 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
295 which namespace to retrieve a value from.
\r
296 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
298 @retval VOID* Return the VOID* pointer.
\r
304 IN CONST GUID *Guid,
\r
305 IN UINTN TokenNumber
\r
308 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
316 Returns the Boolean value of the token specified by TokenNumber and Guid.
\r
317 If Guid is NULL, then ASSERT().
\r
319 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
320 which namespace to retrieve a value from.
\r
321 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
323 @retval BOOLEAN Return the BOOLEAN.
\r
329 IN CONST GUID *Guid,
\r
330 IN UINTN TokenNumber
\r
333 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
341 Returns the size of the token specified by TokenNumber and Guid.
\r
342 If Guid is NULL, then ASSERT().
\r
344 @param[in] Guid Pointer to a 128-bit unique value that designates
\r
345 which namespace to retrieve a value from.
\r
346 @param[in] TokenNumber The PCD token number to retrieve a current value for.
\r
348 @retval UINTN Return the size.
\r
354 IN CONST GUID *Guid,
\r
355 IN UINTN TokenNumber
\r
358 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
366 Sets the 8-bit value for the token specified by TokenNumber
\r
367 to the value specified by Value. Value is returned.
\r
369 @param[in] TokenNumber The PCD token number to set a current value for.
\r
370 @param[in] Value The 8-bit value to set.
\r
372 @retval UINT8 Return the value been set.
\r
378 IN UINTN TokenNumber,
\r
382 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
390 Sets the 16-bit value for the token specified by TokenNumber
\r
391 to the value specified by Value. Value is returned.
\r
393 @param[in] TokenNumber The PCD token number to set a current value for.
\r
394 @param[in] Value The 16-bit value to set.
\r
396 @retval UINT16 Return the value been set.
\r
402 IN UINTN TokenNumber,
\r
406 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
414 Sets the 32-bit value for the token specified by TokenNumber
\r
415 to the value specified by Value. Value is returned.
\r
417 @param[in] TokenNumber The PCD token number to set a current value for.
\r
418 @param[in] Value The 32-bit value to set.
\r
420 @retval UINT32 Return the value been set.
\r
426 IN UINTN TokenNumber,
\r
430 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
438 Sets the 64-bit value for the token specified by TokenNumber
\r
439 to the value specified by Value. Value is returned.
\r
441 @param[in] TokenNumber The PCD token number to set a current value for.
\r
442 @param[in] Value The 64-bit value to set.
\r
444 @retval UINT64 Return the value been set.
\r
450 IN UINTN TokenNumber,
\r
454 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
462 Sets a buffer for the token specified by TokenNumber to
\r
463 the value specified by Buffer and SizeOfValue. Buffer to
\r
464 be set is returned. The content of the buffer could be
\r
465 overwritten if a Callback on SET is registered with this
\r
468 If SizeOfValue is greater than the maximum
\r
469 size support by TokenNumber, then set SizeOfValue to the
\r
470 maximum size supported by TokenNumber and return NULL to
\r
471 indicate that the set operation was not actually performed.
\r
473 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
\r
475 @param[in] TokenNumber The PCD token number to set a current value for.
\r
476 @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
\r
477 @param[in] Value A pointer to the buffer to set.
\r
479 @retval VOID* Return the pointer for the buffer been set.
\r
485 IN UINTN TokenNumber,
\r
486 IN OUT UINTN *SizeOfBuffer,
\r
490 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
498 Sets the Boolean value for the token specified by TokenNumber
\r
499 to the value specified by Value. Value is returned.
\r
501 @param[in] TokenNumber The PCD token number to set a current value for.
\r
502 @param[in] Value The boolean value to set.
\r
504 @retval BOOLEAN Return the value been set.
\r
510 IN UINTN TokenNumber,
\r
514 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
522 Sets the 8-bit value for the token specified by TokenNumber and
\r
523 Guid to the value specified by Value. Value is returned.
\r
524 If Guid is NULL, then ASSERT().
\r
526 @param[in] Guid Pointer to a 128-bit unique value that
\r
527 designates which namespace to set a value from.
\r
528 @param[in] TokenNumber The PCD token number to set a current value for.
\r
529 @param[in] Value The 8-bit value to set.
\r
531 @retval UINT8 Return the value been set.
\r
537 IN CONST GUID *Guid,
\r
538 IN UINTN TokenNumber,
\r
542 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
550 Sets the 16-bit value for the token specified by TokenNumber and
\r
551 Guid to the value specified by Value. Value is returned.
\r
552 If Guid is NULL, then ASSERT().
\r
554 @param[in] Guid Pointer to a 128-bit unique value that
\r
555 designates which namespace to set a value from.
\r
556 @param[in] TokenNumber The PCD token number to set a current value for.
\r
557 @param[in] Value The 16-bit value to set.
\r
559 @retval UINT8 Return the value been set.
\r
565 IN CONST GUID *Guid,
\r
566 IN UINTN TokenNumber,
\r
570 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
578 Sets the 32-bit value for the token specified by TokenNumber and
\r
579 Guid to the value specified by Value. Value is returned.
\r
580 If Guid is NULL, then ASSERT().
\r
582 @param[in] Guid Pointer to a 128-bit unique value that
\r
583 designates which namespace to set a value from.
\r
584 @param[in] TokenNumber The PCD token number to set a current value for.
\r
585 @param[in] Value The 32-bit value to set.
\r
587 @retval UINT32 Return the value been set.
\r
593 IN CONST GUID *Guid,
\r
594 IN UINTN TokenNumber,
\r
598 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
606 Sets the 64-bit value for the token specified by TokenNumber and
\r
607 Guid to the value specified by Value. Value is returned.
\r
608 If Guid is NULL, then ASSERT().
\r
610 @param[in] Guid Pointer to a 128-bit unique value that
\r
611 designates which namespace to set a value from.
\r
612 @param[in] TokenNumber The PCD token number to set a current value for.
\r
613 @param[in] Value The 64-bit value to set.
\r
615 @retval UINT64 Return the value been set.
\r
621 IN CONST GUID *Guid,
\r
622 IN UINTN TokenNumber,
\r
626 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
634 Sets a buffer for the token specified by TokenNumber to the value specified by
\r
635 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
\r
636 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
\r
637 supported by TokenNumber and return NULL to indicate that the set operation
\r
638 was not actually performed.
\r
640 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
\r
642 @param[in] Guid Pointer to a 128-bit unique value that
\r
643 designates which namespace to set a value from.
\r
644 @param[in] TokenNumber The PCD token number to set a current value for.
\r
645 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
\r
646 @param[in] Buffer A pointer to the buffer to set.
\r
648 @retval VOID * Return the pinter to the buffer been set.
\r
654 IN CONST GUID *Guid,
\r
655 IN UINTN TokenNumber,
\r
656 IN OUT UINTN *SizeOfBuffer,
\r
660 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
668 Sets the Boolean value for the token specified by TokenNumber and
\r
669 Guid to the value specified by Value. Value is returned.
\r
670 If Guid is NULL, then ASSERT().
\r
672 @param[in] Guid Pointer to a 128-bit unique value that
\r
673 designates which namespace to set a value from.
\r
674 @param[in] TokenNumber The PCD token number to set a current value for.
\r
675 @param[in] Value The Boolean value to set.
\r
677 @retval Boolean Return the value been set.
\r
683 IN CONST GUID *Guid,
\r
684 IN UINTN TokenNumber,
\r
688 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
696 When the token specified by TokenNumber and Guid is set,
\r
697 then notification function specified by NotificationFunction is called.
\r
698 If Guid is NULL, then the default token space is used.
\r
699 If NotificationFunction is NULL, then ASSERT().
\r
701 @param[in] Guid Pointer to a 128-bit unique value that designates which
\r
702 namespace to set a value from. If NULL, then the default
\r
703 token space is used.
\r
704 @param[in] TokenNumber The PCD token number to monitor.
\r
705 @param[in] NotificationFunction The function to call when the token
\r
706 specified by Guid and TokenNumber is set.
\r
713 LibPcdCallbackOnSet (
\r
714 IN CONST GUID *Guid, OPTIONAL
\r
715 IN UINTN TokenNumber,
\r
716 IN PCD_CALLBACK NotificationFunction
\r
719 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
725 Disable a notification function that was established with LibPcdCallbackonSet().
\r
726 If NotificationFunction is NULL, then ASSERT().
\r
728 @param[in] Guid Specify the GUID token space.
\r
729 @param[in] TokenNumber Specify the token number.
\r
730 @param[in] NotificationFunction The callback function to be unregistered.
\r
737 LibPcdCancelCallback (
\r
738 IN CONST GUID *Guid, OPTIONAL
\r
739 IN UINTN TokenNumber,
\r
740 IN PCD_CALLBACK NotificationFunction
\r
743 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
749 Retrieves the next PCD token number from the token space specified by Guid.
\r
750 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
\r
751 then the first token number is returned. Otherwise, the token number that
\r
752 follows TokenNumber in the token space is returned. If TokenNumber is the last
\r
753 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
\r
754 is not in the token space specified by Guid, then ASSERT().
\r
756 @param[in] Pointer to a 128-bit unique value that designates which namespace
\r
757 to set a value from. If NULL, then the default token space is used.
\r
758 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
\r
761 @retval UINTN The next valid token number.
\r
766 LibPcdGetNextToken (
\r
767 IN CONST GUID *Guid, OPTIONAL
\r
768 IN UINTN TokenNumber
\r
771 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
779 Retrieves the next PCD token space from a token space specified by Guid.
\r
780 Guid of NULL is reserved to mark the default local token namespace on the current
\r
781 platform. If Guid is NULL, then the GUID of the first non-local token space of the
\r
782 current platform is returned. If Guid is the last non-local token space,
\r
783 then NULL is returned.
\r
785 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
\r
789 @param[in] Pointer to a 128-bit unique value that designates from which namespace
\r
790 to start the search.
\r
792 @retval CONST GUID * The next valid token namespace.
\r
797 LibPcdGetNextTokenSpace (
\r
798 IN CONST GUID *Guid
\r
801 ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
\r
809 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
\r
810 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
\r
811 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
\r
812 NULL to indicate that the set operation was not actually performed.
\r
813 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
\r
814 MaximumDatumSize and NULL must be returned.
\r
816 If PatchVariable is NULL, then ASSERT().
\r
817 If SizeOfValue is NULL, then ASSERT().
\r
818 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
\r
820 @param[in] PatchVariable A pointer to the global variable in a module that is
\r
821 the target of the set operation.
\r
822 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
\r
823 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
\r
824 @param[in] Buffer A pointer to the buffer to used to set the target variable.
\r
829 LibPatchPcdSetPtr (
\r
830 IN VOID *PatchVariable,
\r
831 IN UINTN MaximumDatumSize,
\r
832 IN OUT UINTN *SizeOfBuffer,
\r
833 IN CONST VOID *Buffer
\r
836 ASSERT (PatchVariable != NULL);
\r
837 ASSERT (SizeOfBuffer != NULL);
\r
839 if (*SizeOfBuffer > 0) {
\r
840 ASSERT (Buffer != NULL);
\r
843 if ((*SizeOfBuffer > MaximumDatumSize) ||
\r
844 (*SizeOfBuffer == MAX_ADDRESS)) {
\r
845 *SizeOfBuffer = MaximumDatumSize;
\r
849 CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
\r
851 return (VOID *) Buffer;
\r