2 Implementation of PcdLib class library for PEI phase.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Ppi/PiPcd.h>
14 #include <Ppi/PcdInfo.h>
15 #include <Ppi/PiPcdInfo.h>
17 #include <Library/PeiServicesLib.h>
18 #include <Library/PcdLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/BaseMemoryLib.h>
23 Retrieve the PCD_PPI pointer.
25 This function is to locate PCD_PPI PPI via PeiService.
26 If fail to locate PCD_PPI, then ASSERT_EFI_ERROR().
28 @retval PCD_PPI * The pointer to the PCD_PPI.
39 Status
= PeiServicesLocatePpi (&gPcdPpiGuid
, 0, NULL
, (VOID
**)&PcdPpi
);
40 ASSERT_EFI_ERROR (Status
);
46 Retrieve the pointer of EFI_PEI_PCD_PPI defined in PI 1.2 Vol 3.
48 This function is to locate EFI_PEI_PCD_PPI PPI via PeiService.
49 If fail to locate EFI_PEI_PCD_PPI, then ASSERT_EFI_ERROR().
51 @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI.
60 EFI_PEI_PCD_PPI
*PiPcdPpi
;
62 Status
= PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid
, 0, NULL
, (VOID
**)&PiPcdPpi
);
63 ASSERT_EFI_ERROR (Status
);
69 Retrieve the GET_PCD_INFO_PPI pointer.
71 This function is to locate GET_PCD_INFO_PPI PPI via PeiService.
72 If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
74 @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.
78 GetPcdInfoPpiPointer (
83 GET_PCD_INFO_PPI
*PcdInfoPpi
;
85 Status
= PeiServicesLocatePpi (&gGetPcdInfoPpiGuid
, 0, NULL
, (VOID
**)&PcdInfoPpi
);
86 ASSERT_EFI_ERROR (Status
);
92 Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.
94 This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService.
95 If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
97 @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.
100 EFI_GET_PCD_INFO_PPI
*
101 GetPiPcdInfoPpiPointer (
106 EFI_GET_PCD_INFO_PPI
*PiPcdInfoPpi
;
108 Status
= PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid
, 0, NULL
, (VOID
**)&PiPcdInfoPpi
);
109 ASSERT_EFI_ERROR (Status
);
115 This function provides a means by which SKU support can be established in the PCD infrastructure.
117 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
119 @param SkuId The SKU value that will be used when the PCD service retrieves
120 and sets values associated with a PCD token.
122 @return Return the SKU ID that just be set.
131 GetPiPcdPpiPointer ()->SetSku (SkuId
);
137 This function provides a means by which to retrieve a value for a given PCD token.
139 Returns the 8-bit value for the token specified by TokenNumber.
141 @param[in] TokenNumber The PCD token number to retrieve a current value for.
143 @return Returns the 8-bit value for the token specified by TokenNumber.
152 return (GetPcdPpiPointer ())->Get8 (TokenNumber
);
156 This function provides a means by which to retrieve a value for a given PCD token.
158 Returns the 16-bit value for the token specified by TokenNumber.
160 @param[in] TokenNumber The PCD token number to retrieve a current value for.
162 @return Returns the 16-bit value for the token specified by TokenNumber.
171 return (GetPcdPpiPointer ())->Get16 (TokenNumber
);
175 This function provides a means by which to retrieve a value for a given PCD token.
177 Returns the 32-bit value for the token specified by TokenNumber.
179 @param[in] TokenNumber The PCD token number to retrieve a current value for.
181 @return Returns the 32-bit value for the token specified by TokenNumber.
190 return (GetPcdPpiPointer ())->Get32 (TokenNumber
);
194 This function provides a means by which to retrieve a value for a given PCD token.
196 Returns the 64-bit value for the token specified by TokenNumber.
198 @param[in] TokenNumber The PCD token number to retrieve a current value for.
200 @return Returns the 64-bit value for the token specified by TokenNumber.
209 return (GetPcdPpiPointer ())->Get64 (TokenNumber
);
213 This function provides a means by which to retrieve a value for a given PCD token.
215 Returns the pointer to the buffer of the token specified by TokenNumber.
217 @param[in] TokenNumber The PCD token number to retrieve a current value for.
219 @return Returns the pointer to the token specified by TokenNumber.
228 return (GetPcdPpiPointer ())->GetPtr (TokenNumber
);
232 This function provides a means by which to retrieve a value for a given PCD token.
234 Returns the Boolean value of the token specified by TokenNumber.
236 @param[in] TokenNumber The PCD token number to retrieve a current value for.
238 @return Returns the Boolean value of the token specified by TokenNumber.
247 return (GetPcdPpiPointer ())->GetBool (TokenNumber
);
251 This function provides a means by which to retrieve the size of a given PCD token.
253 @param[in] TokenNumber The PCD token number to retrieve a current value for.
255 @return Returns the size of the token specified by TokenNumber.
264 return (GetPcdPpiPointer ())->GetSize (TokenNumber
);
268 This function provides a means by which to retrieve a value for a given PCD token.
270 Returns the 8-bit value for the token specified by TokenNumber and Guid.
272 If Guid is NULL, then ASSERT().
274 @param[in] Guid The pointer to a 128-bit unique value that designates
275 which namespace to retrieve a value from.
276 @param[in] TokenNumber The PCD token number to retrieve a current value for.
278 @return Return the UINT8.
288 ASSERT (Guid
!= NULL
);
290 return (GetPiPcdPpiPointer ())->Get8 (Guid
, TokenNumber
);
294 This function provides a means by which to retrieve a value for a given PCD token.
296 Returns the 16-bit value for the token specified by TokenNumber and Guid.
298 If Guid is NULL, then ASSERT().
300 @param[in] Guid The pointer to a 128-bit unique value that designates
301 which namespace to retrieve a value from.
302 @param[in] TokenNumber The PCD token number to retrieve a current value for.
304 @return Return the UINT16.
314 ASSERT (Guid
!= NULL
);
316 return (GetPiPcdPpiPointer ())->Get16 (Guid
, TokenNumber
);
320 Returns the 32-bit value for the token specified by TokenNumber and Guid.
321 If Guid is NULL, then ASSERT().
323 @param[in] Guid The pointer to a 128-bit unique value that designates
324 which namespace to retrieve a value from.
325 @param[in] TokenNumber The PCD token number to retrieve a current value for.
327 @return Return the UINT32.
337 ASSERT (Guid
!= NULL
);
339 return (GetPiPcdPpiPointer ())->Get32 (Guid
, TokenNumber
);
343 This function provides a means by which to retrieve a value for a given PCD token.
345 Returns the 64-bit value for the token specified by TokenNumber and Guid.
347 If Guid is NULL, then ASSERT().
349 @param[in] Guid The pointer to a 128-bit unique value that designates
350 which namespace to retrieve a value from.
351 @param[in] TokenNumber The PCD token number to retrieve a current value for.
353 @return Return the UINT64.
363 ASSERT (Guid
!= NULL
);
364 return (GetPiPcdPpiPointer ())->Get64 (Guid
, TokenNumber
);
368 This function provides a means by which to retrieve a value for a given PCD token.
370 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
372 If Guid is NULL, then ASSERT().
374 @param[in] Guid The pointer to a 128-bit unique value that designates
375 which namespace to retrieve a value from.
376 @param[in] TokenNumber The PCD token number to retrieve a current value for.
378 @return Return the VOID* pointer.
388 ASSERT (Guid
!= NULL
);
390 return (GetPiPcdPpiPointer ())->GetPtr (Guid
, TokenNumber
);
394 This function provides a means by which to retrieve a value for a given PCD token.
396 Returns the Boolean value of the token specified by TokenNumber and Guid.
398 If Guid is NULL, then ASSERT().
400 @param[in] Guid The pointer to a 128-bit unique value that designates
401 which namespace to retrieve a value from.
402 @param[in] TokenNumber The PCD token number to retrieve a current value for.
404 @return Return the BOOLEAN.
414 ASSERT (Guid
!= NULL
);
415 return (GetPiPcdPpiPointer ())->GetBool (Guid
, TokenNumber
);
419 This function provides a means by which to retrieve the size of a given PCD token.
421 Returns the size of the token specified by TokenNumber and Guid.
423 If Guid is NULL, then ASSERT().
425 @param[in] Guid The pointer to a 128-bit unique value that designates
426 which namespace to retrieve a value from.
427 @param[in] TokenNumber The PCD token number to retrieve a current value for.
429 @return Return the size.
439 ASSERT (Guid
!= NULL
);
440 return (GetPiPcdPpiPointer ())->GetSize (Guid
, TokenNumber
);
444 This function provides a means by which to set a value for a given PCD token.
446 Sets the 8-bit value for the token specified by TokenNumber
447 to the value specified by Value.
449 @param[in] TokenNumber The PCD token number to set a current value for.
450 @param[in] Value The 8-bit value to set.
452 @return The status of the set operation.
458 IN UINTN TokenNumber
,
462 return (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
466 This function provides a means by which to set a value for a given PCD token.
468 Sets the 16-bit value for the token specified by TokenNumber
469 to the value specified by Value.
471 @param[in] TokenNumber The PCD token number to set a current value for.
472 @param[in] Value The 16-bit value to set.
474 @return The status of the set operation.
480 IN UINTN TokenNumber
,
484 return (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
488 This function provides a means by which to set a value for a given PCD token.
490 Sets the 32-bit value for the token specified by TokenNumber
491 to the value specified by Value.
493 @param[in] TokenNumber The PCD token number to set a current value for.
494 @param[in] Value The 32-bit value to set.
496 @return The status of the set operation.
502 IN UINTN TokenNumber
,
506 return (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
510 This function provides a means by which to set a value for a given PCD token.
512 Sets the 64-bit value for the token specified by TokenNumber
513 to the value specified by Value.
515 @param[in] TokenNumber The PCD token number to set a current value for.
516 @param[in] Value The 64-bit value to set.
518 @return The status of the set operation.
524 IN UINTN TokenNumber
,
528 return (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
532 This function provides a means by which to set a value for a given PCD token.
534 Sets a buffer for the token specified by TokenNumber to the value specified
535 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
536 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
537 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
538 was not actually performed.
540 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
541 maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.
543 If SizeOfBuffer is NULL, then ASSERT().
544 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
546 @param[in] TokenNumber The PCD token number to set a current value for.
547 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
548 @param[in] Buffer A pointer to the buffer to set.
550 @return The status of the set operation.
556 IN UINTN TokenNumber
,
557 IN OUT UINTN
*SizeOfBuffer
,
558 IN CONST VOID
*Buffer
561 ASSERT (SizeOfBuffer
!= NULL
);
563 if (*SizeOfBuffer
> 0) {
564 ASSERT (Buffer
!= NULL
);
567 return (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*)Buffer
);
571 This function provides a means by which to set a value for a given PCD token.
573 Sets the boolean value for the token specified by TokenNumber
574 to the value specified by Value.
576 @param[in] TokenNumber The PCD token number to set a current value for.
577 @param[in] Value The boolean value to set.
579 @return The status of the set operation.
585 IN UINTN TokenNumber
,
589 return (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
593 This function provides a means by which to set a value for a given PCD token.
595 Sets the 8-bit value for the token specified by TokenNumber
596 to the value specified by Value.
598 If Guid is NULL, then ASSERT().
600 @param[in] Guid The pointer to a 128-bit unique value that
601 designates which namespace to set a value from.
602 @param[in] TokenNumber The PCD token number to set a current value for.
603 @param[in] Value The 8-bit value to set.
605 @return The status of the set operation.
612 IN UINTN TokenNumber
,
616 ASSERT (Guid
!= NULL
);
618 return (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
622 This function provides a means by which to set a value for a given PCD token.
624 Sets the 16-bit value for the token specified by TokenNumber
625 to the value specified by Value.
627 If Guid is NULL, then ASSERT().
629 @param[in] Guid The pointer to a 128-bit unique value that
630 designates which namespace to set a value from.
631 @param[in] TokenNumber The PCD token number to set a current value for.
632 @param[in] Value The 16-bit value to set.
634 @return The status of the set operation.
641 IN UINTN TokenNumber
,
645 ASSERT (Guid
!= NULL
);
647 return (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
651 This function provides a means by which to set a value for a given PCD token.
653 Sets the 32-bit value for the token specified by TokenNumber
654 to the value specified by Value.
656 If Guid is NULL, then ASSERT().
658 @param[in] Guid The pointer to a 128-bit unique value that
659 designates which namespace to set a value from.
660 @param[in] TokenNumber The PCD token number to set a current value for.
661 @param[in] Value The 32-bit value to set.
663 @return The status of the set operation.
670 IN UINTN TokenNumber
,
674 ASSERT (Guid
!= NULL
);
676 return (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
680 This function provides a means by which to set a value for a given PCD token.
682 Sets the 64-bit value for the token specified by TokenNumber
683 to the value specified by Value.
685 If Guid is NULL, then ASSERT().
687 @param[in] Guid The pointer to a 128-bit unique value that
688 designates which namespace to set a value from.
689 @param[in] TokenNumber The PCD token number to set a current value for.
690 @param[in] Value The 64-bit value to set.
692 @return The status of the set operation.
699 IN UINTN TokenNumber
,
703 ASSERT (Guid
!= NULL
);
705 return (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
709 This function provides a means by which to set a value for a given PCD token.
711 Sets a buffer for the token specified by TokenNumber to the value specified by
712 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
713 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
714 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
715 was not actually performed.
717 If Guid is NULL, then ASSERT().
718 If SizeOfBuffer is NULL, then ASSERT().
719 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
721 @param[in] Guid Pointer to a 128-bit unique value that
722 designates which namespace to set a value from.
723 @param[in] TokenNumber The PCD token number to set a current value for.
724 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
725 @param[in] Buffer A pointer to the buffer to set.
727 @return The status of the set operation.
734 IN UINTN TokenNumber
,
735 IN OUT UINTN
*SizeOfBuffer
,
739 ASSERT (Guid
!= NULL
);
741 ASSERT (SizeOfBuffer
!= NULL
);
743 if (*SizeOfBuffer
> 0) {
744 ASSERT (Buffer
!= NULL
);
747 return (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
751 This function provides a means by which to set a value for a given PCD token.
753 Sets the boolean value for the token specified by TokenNumber
754 to the value specified by Value.
756 If Guid is NULL, then ASSERT().
758 @param[in] Guid The pointer to a 128-bit unique value that
759 designates which namespace to set a value from.
760 @param[in] TokenNumber The PCD token number to set a current value for.
761 @param[in] Value The boolean value to set.
763 @return The status of the set operation.
770 IN UINTN TokenNumber
,
774 ASSERT (Guid
!= NULL
);
776 return (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
780 Set up a notification function that is called when a specified token is set.
782 When the token specified by TokenNumber and Guid is set,
783 then notification function specified by NotificationFunction is called.
784 If Guid is NULL, then the default token space is used.
785 If NotificationFunction is NULL, then ASSERT().
787 @param[in] Guid The pointer to a 128-bit unique value that
788 designates which namespace to set a value from.
789 If NULL, then the default token space is used.
790 @param[in] TokenNumber The PCD token number to monitor.
791 @param[in] NotificationFunction The function to call when the token
792 specified by Guid and TokenNumber is set.
797 LibPcdCallbackOnSet (
798 IN CONST GUID
*Guid OPTIONAL
,
799 IN UINTN TokenNumber
,
800 IN PCD_CALLBACK NotificationFunction
805 ASSERT (NotificationFunction
!= NULL
);
807 Status
= (GetPiPcdPpiPointer ())->CallbackOnSet (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
)NotificationFunction
);
809 ASSERT_EFI_ERROR (Status
);
815 Disable a notification function that was established with LibPcdCallbackonSet().
817 Disable a notification function that was previously established with LibPcdCallbackOnSet().
818 If NotificationFunction is NULL, then ASSERT().
819 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
820 and NotificationFunction, then ASSERT().
822 @param[in] Guid Specify the GUID token space.
823 @param[in] TokenNumber Specify the token number.
824 @param[in] NotificationFunction The callback function to be unregistered.
829 LibPcdCancelCallback (
830 IN CONST GUID
*Guid OPTIONAL
,
831 IN UINTN TokenNumber
,
832 IN PCD_CALLBACK NotificationFunction
837 ASSERT (NotificationFunction
!= NULL
);
839 Status
= (GetPiPcdPpiPointer ())->CancelCallback (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
)NotificationFunction
);
841 ASSERT_EFI_ERROR (Status
);
847 Retrieves the next token in a token space.
849 Retrieves the next PCD token number from the token space specified by Guid.
850 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
851 then the first token number is returned. Otherwise, the token number that
852 follows TokenNumber in the token space is returned. If TokenNumber is the last
853 token number in the token space, then 0 is returned.
855 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
857 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
858 to set a value from. If NULL, then the default token space is used.
859 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
862 @return The next valid token number.
868 IN CONST GUID
*Guid OPTIONAL
,
874 Status
= (GetPiPcdPpiPointer ())->GetNextToken (Guid
, &TokenNumber
);
875 ASSERT (!EFI_ERROR (Status
) || TokenNumber
== 0);
881 Used to retrieve the list of available PCD token space GUIDs.
883 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
885 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
886 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
888 @param TokenSpaceGuid The pointer to the a PCD token space GUID
890 @return The next valid token namespace.
895 LibPcdGetNextTokenSpace (
896 IN CONST GUID
*TokenSpaceGuid
899 (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid
);
901 return (GUID
*)TokenSpaceGuid
;
905 Sets a value of a patchable PCD entry that is type pointer.
907 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
908 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
909 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
910 NULL to indicate that the set operation was not actually performed.
911 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
912 MaximumDatumSize and NULL must be returned.
914 If PatchVariable is NULL, then ASSERT().
915 If SizeOfBuffer is NULL, then ASSERT().
916 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
918 @param[out] PatchVariable A pointer to the global variable in a module that is
919 the target of the set operation.
920 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
921 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
922 @param[in] Buffer A pointer to the buffer to used to set the target variable.
924 @return Return the pointer to the buffer been set.
930 OUT VOID
*PatchVariable
,
931 IN UINTN MaximumDatumSize
,
932 IN OUT UINTN
*SizeOfBuffer
,
933 IN CONST VOID
*Buffer
936 ASSERT (PatchVariable
!= NULL
);
937 ASSERT (SizeOfBuffer
!= NULL
);
939 if (*SizeOfBuffer
> 0) {
940 ASSERT (Buffer
!= NULL
);
943 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
944 (*SizeOfBuffer
== MAX_ADDRESS
))
946 *SizeOfBuffer
= MaximumDatumSize
;
950 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
952 return (VOID
*)Buffer
;
956 Sets a value of a patchable PCD entry that is type pointer.
958 Sets the PCD entry specified by PatchVariable to the value specified
959 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
960 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
961 to indicate that the set operation was not actually performed.
962 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
963 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
965 If PatchVariable is NULL, then ASSERT().
966 If SizeOfBuffer is NULL, then ASSERT().
967 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
969 @param[out] PatchVariable A pointer to the global variable in a module that is
970 the target of the set operation.
971 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
972 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
973 @param[in] Buffer A pointer to the buffer to used to set the target variable.
975 @return The status of the set operation.
981 OUT VOID
*PatchVariable
,
982 IN UINTN MaximumDatumSize
,
983 IN OUT UINTN
*SizeOfBuffer
,
984 IN CONST VOID
*Buffer
987 ASSERT (PatchVariable
!= NULL
);
988 ASSERT (SizeOfBuffer
!= NULL
);
990 if (*SizeOfBuffer
> 0) {
991 ASSERT (Buffer
!= NULL
);
994 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
995 (*SizeOfBuffer
== MAX_ADDRESS
))
997 *SizeOfBuffer
= MaximumDatumSize
;
998 return RETURN_INVALID_PARAMETER
;
1001 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1003 return RETURN_SUCCESS
;
1007 Sets a value and size of a patchable PCD entry that is type pointer.
1009 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1010 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1011 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1012 NULL to indicate that the set operation was not actually performed.
1013 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1014 MaximumDatumSize and NULL must be returned.
1016 If PatchVariable is NULL, then ASSERT().
1017 If SizeOfPatchVariable is NULL, then ASSERT().
1018 If SizeOfBuffer is NULL, then ASSERT().
1019 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1021 @param[out] PatchVariable A pointer to the global variable in a module that is
1022 the target of the set operation.
1023 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1024 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1025 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1026 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1028 @return Return the pointer to the buffer been set.
1033 LibPatchPcdSetPtrAndSize (
1034 OUT VOID
*PatchVariable
,
1035 OUT UINTN
*SizeOfPatchVariable
,
1036 IN UINTN MaximumDatumSize
,
1037 IN OUT UINTN
*SizeOfBuffer
,
1038 IN CONST VOID
*Buffer
1041 ASSERT (PatchVariable
!= NULL
);
1042 ASSERT (SizeOfPatchVariable
!= NULL
);
1043 ASSERT (SizeOfBuffer
!= NULL
);
1045 if (*SizeOfBuffer
> 0) {
1046 ASSERT (Buffer
!= NULL
);
1049 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1050 (*SizeOfBuffer
== MAX_ADDRESS
))
1052 *SizeOfBuffer
= MaximumDatumSize
;
1056 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1057 *SizeOfPatchVariable
= *SizeOfBuffer
;
1059 return (VOID
*)Buffer
;
1063 Sets a value and size of a patchable PCD entry that is type pointer.
1065 Sets the PCD entry specified by PatchVariable to the value specified
1066 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1067 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1068 to indicate that the set operation was not actually performed.
1069 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1070 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1072 If PatchVariable is NULL, then ASSERT().
1073 If SizeOfPatchVariable is NULL, then ASSERT().
1074 If SizeOfBuffer is NULL, then ASSERT().
1075 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1077 @param[out] PatchVariable A pointer to the global variable in a module that is
1078 the target of the set operation.
1079 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1080 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1081 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1082 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1084 @return The status of the set operation.
1089 LibPatchPcdSetPtrAndSizeS (
1090 OUT VOID
*PatchVariable
,
1091 OUT UINTN
*SizeOfPatchVariable
,
1092 IN UINTN MaximumDatumSize
,
1093 IN OUT UINTN
*SizeOfBuffer
,
1094 IN CONST VOID
*Buffer
1097 ASSERT (PatchVariable
!= NULL
);
1098 ASSERT (SizeOfPatchVariable
!= NULL
);
1099 ASSERT (SizeOfBuffer
!= NULL
);
1101 if (*SizeOfBuffer
> 0) {
1102 ASSERT (Buffer
!= NULL
);
1105 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1106 (*SizeOfBuffer
== MAX_ADDRESS
))
1108 *SizeOfBuffer
= MaximumDatumSize
;
1109 return RETURN_INVALID_PARAMETER
;
1112 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1113 *SizeOfPatchVariable
= *SizeOfBuffer
;
1115 return RETURN_SUCCESS
;
1119 Retrieve additional information associated with a PCD token.
1121 This includes information such as the type of value the TokenNumber is associated with as well as possible
1122 human readable name that is associated with the token.
1124 If TokenNumber is not in the default token space specified, then ASSERT().
1126 @param[in] TokenNumber The PCD token number.
1127 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1128 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1133 IN UINTN TokenNumber
,
1134 OUT PCD_INFO
*PcdInfo
1139 Status
= GetPcdInfoPpiPointer ()->GetInfo (TokenNumber
, (EFI_PCD_INFO
*)PcdInfo
);
1140 ASSERT_EFI_ERROR (Status
);
1144 Retrieve additional information associated with a PCD token.
1146 This includes information such as the type of value the TokenNumber is associated with as well as possible
1147 human readable name that is associated with the token.
1149 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1151 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1152 @param[in] TokenNumber The PCD token number.
1153 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1154 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1159 IN CONST GUID
*Guid
,
1160 IN UINTN TokenNumber
,
1161 OUT PCD_INFO
*PcdInfo
1166 Status
= GetPiPcdInfoPpiPointer ()->GetInfo (Guid
, TokenNumber
, (EFI_PCD_INFO
*)PcdInfo
);
1167 ASSERT_EFI_ERROR (Status
);
1171 Retrieve the currently set SKU Id.
1173 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1174 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1183 return GetPiPcdInfoPpiPointer ()->GetSku ();