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
16 #include <Ppi/PiPcd.h>
17 #include <Ppi/PcdInfo.h>
18 #include <Ppi/PiPcdInfo.h>
20 #include <Library/PeiServicesLib.h>
21 #include <Library/PcdLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/BaseMemoryLib.h>
26 Retrieve the PCD_PPI pointer.
28 This function is to locate PCD_PPI PPI via PeiService.
29 If fail to locate PCD_PPI, then ASSERT_EFI_ERROR().
31 @retval PCD_PPI * The pointer to the PCD_PPI.
42 Status
= PeiServicesLocatePpi (&gPcdPpiGuid
, 0, NULL
, (VOID
**)&PcdPpi
);
43 ASSERT_EFI_ERROR (Status
);
49 Retrieve the pointer of EFI_PEI_PCD_PPI defined in PI 1.2 Vol 3.
51 This function is to locate EFI_PEI_PCD_PPI PPI via PeiService.
52 If fail to locate EFI_PEI_PCD_PPI, then ASSERT_EFI_ERROR().
54 @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI.
63 EFI_PEI_PCD_PPI
*PiPcdPpi
;
65 Status
= PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid
, 0, NULL
, (VOID
**)&PiPcdPpi
);
66 ASSERT_EFI_ERROR (Status
);
72 Retrieve the GET_PCD_INFO_PPI pointer.
74 This function is to locate GET_PCD_INFO_PPI PPI via PeiService.
75 If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
77 @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.
81 GetPcdInfoPpiPointer (
86 GET_PCD_INFO_PPI
*PcdInfoPpi
;
88 Status
= PeiServicesLocatePpi (&gGetPcdInfoPpiGuid
, 0, NULL
, (VOID
**)&PcdInfoPpi
);
89 ASSERT_EFI_ERROR (Status
);
95 Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.
97 This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService.
98 If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
100 @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.
103 EFI_GET_PCD_INFO_PPI
*
104 GetPiPcdInfoPpiPointer (
109 EFI_GET_PCD_INFO_PPI
*PiPcdInfoPpi
;
111 Status
= PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid
, 0, NULL
, (VOID
**)&PiPcdInfoPpi
);
112 ASSERT_EFI_ERROR (Status
);
118 This function provides a means by which SKU support can be established in the PCD infrastructure.
120 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
122 @param SkuId The SKU value that will be used when the PCD service retrieves
123 and sets values associated with a PCD token.
125 @return Return the SKU ID that just be set.
134 GetPiPcdPpiPointer()->SetSku (SkuId
);
142 This function provides a means by which to retrieve a value for a given PCD token.
144 Returns the 8-bit value for the token specified by TokenNumber.
146 @param[in] TokenNumber The PCD token number to retrieve a current value for.
148 @return Returns the 8-bit value for the token specified by TokenNumber.
157 return (GetPcdPpiPointer ())->Get8 (TokenNumber
);
163 This function provides a means by which to retrieve a value for a given PCD token.
165 Returns the 16-bit value for the token specified by TokenNumber.
167 @param[in] TokenNumber The PCD token number to retrieve a current value for.
169 @return Returns the 16-bit value for the token specified by TokenNumber.
178 return (GetPcdPpiPointer ())->Get16 (TokenNumber
);
184 This function provides a means by which to retrieve a value for a given PCD token.
186 Returns the 32-bit value for the token specified by TokenNumber.
188 @param[in] TokenNumber The PCD token number to retrieve a current value for.
190 @return Returns the 32-bit value for the token specified by TokenNumber.
199 return (GetPcdPpiPointer ())->Get32 (TokenNumber
);
205 This function provides a means by which to retrieve a value for a given PCD token.
207 Returns the 64-bit value for the token specified by TokenNumber.
209 @param[in] TokenNumber The PCD token number to retrieve a current value for.
211 @return Returns the 64-bit value for the token specified by TokenNumber.
220 return (GetPcdPpiPointer ())->Get64 (TokenNumber
);
226 This function provides a means by which to retrieve a value for a given PCD token.
228 Returns the pointer to the buffer of the token specified by TokenNumber.
230 @param[in] TokenNumber The PCD token number to retrieve a current value for.
232 @return Returns the pointer to the token specified by TokenNumber.
241 return (GetPcdPpiPointer ())->GetPtr (TokenNumber
);
247 This function provides a means by which to retrieve a value for a given PCD token.
249 Returns the Boolean value of the token specified by TokenNumber.
251 @param[in] TokenNumber The PCD token number to retrieve a current value for.
253 @return Returns the Boolean value of the token specified by TokenNumber.
262 return (GetPcdPpiPointer ())->GetBool (TokenNumber
);
268 This function provides a means by which to retrieve the size of a given PCD token.
270 @param[in] TokenNumber The PCD token number to retrieve a current value for.
272 @return Returns the size of the token specified by TokenNumber.
281 return (GetPcdPpiPointer ())->GetSize (TokenNumber
);
287 This function provides a means by which to retrieve a value for a given PCD token.
289 Returns the 8-bit value for the token specified by TokenNumber and Guid.
291 If Guid is NULL, then ASSERT().
293 @param[in] Guid The pointer to a 128-bit unique value that designates
294 which namespace to retrieve a value from.
295 @param[in] TokenNumber The PCD token number to retrieve a current value for.
297 @return Return the UINT8.
307 ASSERT (Guid
!= NULL
);
309 return (GetPiPcdPpiPointer ())->Get8 (Guid
, TokenNumber
);
315 This function provides a means by which to retrieve a value for a given PCD token.
317 Returns the 16-bit value for the token specified by TokenNumber and Guid.
319 If Guid is NULL, then ASSERT().
321 @param[in] Guid The pointer to a 128-bit unique value that designates
322 which namespace to retrieve a value from.
323 @param[in] TokenNumber The PCD token number to retrieve a current value for.
325 @return Return the UINT16.
336 ASSERT (Guid
!= NULL
);
338 return (GetPiPcdPpiPointer ())->Get16 (Guid
, TokenNumber
);
344 Returns the 32-bit value for the token specified by TokenNumber and Guid.
345 If Guid is NULL, then ASSERT().
347 @param[in] Guid The pointer to a 128-bit unique value that designates
348 which namespace to retrieve a value from.
349 @param[in] TokenNumber The PCD token number to retrieve a current value for.
351 @return Return the UINT32.
361 ASSERT (Guid
!= NULL
);
363 return (GetPiPcdPpiPointer ())->Get32 (Guid
, TokenNumber
);
370 This function provides a means by which to retrieve a value for a given PCD token.
372 Returns the 64-bit value for the token specified by TokenNumber and Guid.
374 If Guid is NULL, then ASSERT().
376 @param[in] Guid The pointer to a 128-bit unique value that designates
377 which namespace to retrieve a value from.
378 @param[in] TokenNumber The PCD token number to retrieve a current value for.
380 @return Return the UINT64.
390 ASSERT (Guid
!= NULL
);
391 return (GetPiPcdPpiPointer ())->Get64 (Guid
, TokenNumber
);
397 This function provides a means by which to retrieve a value for a given PCD token.
399 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
401 If Guid is NULL, then ASSERT().
403 @param[in] Guid The pointer to a 128-bit unique value that designates
404 which namespace to retrieve a value from.
405 @param[in] TokenNumber The PCD token number to retrieve a current value for.
407 @return Return the VOID* pointer.
417 ASSERT (Guid
!= NULL
);
419 return (GetPiPcdPpiPointer ())->GetPtr (Guid
, TokenNumber
);
425 This function provides a means by which to retrieve a value for a given PCD token.
427 Returns the Boolean value of the token specified by TokenNumber and Guid.
429 If Guid is NULL, then ASSERT().
431 @param[in] Guid The pointer to a 128-bit unique value that designates
432 which namespace to retrieve a value from.
433 @param[in] TokenNumber The PCD token number to retrieve a current value for.
435 @return Return the BOOLEAN.
445 ASSERT (Guid
!= NULL
);
446 return (GetPiPcdPpiPointer ())->GetBool (Guid
, TokenNumber
);
452 This function provides a means by which to retrieve the size of a given PCD token.
454 Returns the size of the token specified by TokenNumber and Guid.
456 If Guid is NULL, then ASSERT().
458 @param[in] Guid The pointer to a 128-bit unique value that designates
459 which namespace to retrieve a value from.
460 @param[in] TokenNumber The PCD token number to retrieve a current value for.
462 @return Return the size.
472 ASSERT (Guid
!= NULL
);
473 return (GetPiPcdPpiPointer ())->GetSize (Guid
, TokenNumber
);
478 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
480 This function provides a means by which to set a value for a given PCD token.
482 Sets the 8-bit value for the token specified by TokenNumber
483 to the value specified by Value. Value is returned.
485 @param[in] TokenNumber The PCD token number to set a current value for.
486 @param[in] Value The 8-bit value to set.
488 @return Return the value that was set.
494 IN UINTN TokenNumber
,
498 (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
506 This function provides a means by which to set a value for a given PCD token.
508 Sets the 16-bit value for the token specified by TokenNumber
509 to the value specified by Value. Value is returned.
511 @param[in] TokenNumber The PCD token number to set a current value for.
512 @param[in] Value The 16-bit value to set.
514 @return Return the value that was set.
520 IN UINTN TokenNumber
,
524 (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
532 This function provides a means by which to set a value for a given PCD token.
534 Sets the 32-bit value for the token specified by TokenNumber
535 to the value specified by Value. Value is returned.
537 @param[in] TokenNumber The PCD token number to set a current value for.
538 @param[in] Value The 32-bit value to set.
540 @return Return the value that was set.
546 IN UINTN TokenNumber
,
550 (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
558 This function provides a means by which to set a value for a given PCD token.
560 Sets the 64-bit value for the token specified by TokenNumber
561 to the value specified by Value. Value is returned.
563 @param[in] TokenNumber The PCD token number to set a current value for.
564 @param[in] Value The 64-bit value to set.
566 @return Return the value that was set.
572 IN UINTN TokenNumber
,
576 (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
584 This function provides a means by which to set a value for a given PCD token.
586 Sets a buffer for the token specified by TokenNumber to the value
587 specified by Buffer and SizeOfBuffer. Buffer is returned.
588 If SizeOfBuffer is greater than the maximum size support by TokenNumber,
589 then set SizeOfBuffer to the maximum size supported by TokenNumber and
590 return NULL to indicate that the set operation was not actually performed.
592 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
593 maximum size supported by TokenName and NULL must be returned.
595 If SizeOfBuffer is NULL, then ASSERT().
596 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
598 @param[in] TokenNumber The PCD token number to set a current value for.
599 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
600 @param[in] Buffer A pointer to the buffer to set.
602 @return Return the pointer for the buffer been set.
608 IN UINTN TokenNumber
,
609 IN OUT UINTN
*SizeOfBuffer
,
610 IN CONST VOID
*Buffer
614 UINTN InputSizeOfBuffer
;
616 ASSERT (SizeOfBuffer
!= NULL
);
618 if (*SizeOfBuffer
> 0) {
619 ASSERT (Buffer
!= NULL
);
622 InputSizeOfBuffer
= *SizeOfBuffer
;
623 Status
= (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
624 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
628 return (VOID
*) Buffer
;
634 This function provides a means by which to set a value for a given PCD token.
636 Sets the Boolean value for the token specified by TokenNumber
637 to the value specified by Value. Value is returned.
639 @param[in] TokenNumber The PCD token number to set a current value for.
640 @param[in] Value The boolean value to set.
642 @return Return the value that was set.
648 IN UINTN TokenNumber
,
652 (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
660 This function provides a means by which to set a value for a given PCD token.
662 Sets the 8-bit value for the token specified by TokenNumber and
663 Guid to the value specified by Value. Value is returned.
665 If Guid is NULL, then ASSERT().
667 @param[in] Guid The pointer to a 128-bit unique value that
668 designates which namespace to set a value from.
669 @param[in] TokenNumber The PCD token number to set a current value for.
670 @param[in] Value The 8-bit value to set.
672 @return Return the value that was set.
679 IN UINTN TokenNumber
,
683 ASSERT (Guid
!= NULL
);
685 (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
693 This function provides a means by which to set a value for a given PCD token.
695 Sets the 16-bit value for the token specified by TokenNumber and
696 Guid to the value specified by Value. Value is returned.
698 If Guid is NULL, then ASSERT().
700 @param[in] Guid The pointer to a 128-bit unique value that
701 designates which namespace to set a value from.
702 @param[in] TokenNumber The PCD token number to set a current value for.
703 @param[in] Value The 16-bit value to set.
705 @return Return the value that was set.
712 IN UINTN TokenNumber
,
716 ASSERT (Guid
!= NULL
);
718 (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
726 This function provides a means by which to set a value for a given PCD token.
728 Sets the 32-bit value for the token specified by TokenNumber and
729 Guid to the value specified by Value. Value is returned.
731 If Guid is NULL, then ASSERT().
733 @param[in] Guid The pointer to a 128-bit unique value that
734 designates which namespace to set a value from.
735 @param[in] TokenNumber The PCD token number to set a current value for.
736 @param[in] Value The 32-bit value to set.
738 @return Return the value that was set.
745 IN UINTN TokenNumber
,
749 ASSERT (Guid
!= NULL
);
751 (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
759 This function provides a means by which to set a value for a given PCD token.
761 Sets the 64-bit value for the token specified by TokenNumber and
762 Guid to the value specified by Value. Value is returned.
764 If Guid is NULL, then ASSERT().
766 @param[in] Guid The pointer to a 128-bit unique value that
767 designates which namespace to set a value from.
768 @param[in] TokenNumber The PCD token number to set a current value for.
769 @param[in] Value The 64-bit value to set.
771 @return Return the value that was set.
778 IN UINTN TokenNumber
,
782 ASSERT (Guid
!= NULL
);
784 (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
792 This function provides a means by which to set a value for a given PCD token.
794 Sets a buffer for the token specified by TokenNumber to the value specified by
795 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
796 the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
797 supported by TokenNumber and return NULL to indicate that the set operation
798 was not actually performed.
800 If Guid is NULL, then ASSERT().
801 If SizeOfBuffer is NULL, then ASSERT().
802 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
804 @param[in] Guid The pointer to a 128-bit unique value that
805 designates which namespace to set a value from.
806 @param[in] TokenNumber The PCD token number to set a current value for.
807 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
808 @param[in] Buffer A pointer to the buffer to set.
810 @return Return the pinter to the buffer been set.
817 IN UINTN TokenNumber
,
818 IN OUT UINTN
*SizeOfBuffer
,
823 UINTN InputSizeOfBuffer
;
825 ASSERT (SizeOfBuffer
!= NULL
);
826 if (*SizeOfBuffer
> 0) {
827 ASSERT (Buffer
!= NULL
);
829 ASSERT (Guid
!= NULL
);
831 InputSizeOfBuffer
= *SizeOfBuffer
;
832 Status
= (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
833 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
843 This function provides a means by which to set a value for a given PCD token.
845 Sets the Boolean value for the token specified by TokenNumber and
846 Guid to the value specified by Value. Value is returned.
848 If Guid is NULL, then ASSERT().
850 @param[in] Guid The pointer to a 128-bit unique value that
851 designates which namespace to set a value from.
852 @param[in] TokenNumber The PCD token number to set a current value for.
853 @param[in] Value The Boolean value to set.
855 @return Return the value that was set.
862 IN UINTN TokenNumber
,
866 ASSERT (Guid
!= NULL
);
868 (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
875 This function provides a means by which to set a value for a given PCD token.
877 Sets the 8-bit value for the token specified by TokenNumber
878 to the value specified by Value.
880 @param[in] TokenNumber The PCD token number to set a current value for.
881 @param[in] Value The 8-bit value to set.
883 @return The status of the set operation.
889 IN UINTN TokenNumber
,
893 return (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
897 This function provides a means by which to set a value for a given PCD token.
899 Sets the 16-bit value for the token specified by TokenNumber
900 to the value specified by Value.
902 @param[in] TokenNumber The PCD token number to set a current value for.
903 @param[in] Value The 16-bit value to set.
905 @return The status of the set operation.
911 IN UINTN TokenNumber
,
915 return (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
919 This function provides a means by which to set a value for a given PCD token.
921 Sets the 32-bit value for the token specified by TokenNumber
922 to the value specified by Value.
924 @param[in] TokenNumber The PCD token number to set a current value for.
925 @param[in] Value The 32-bit value to set.
927 @return The status of the set operation.
933 IN UINTN TokenNumber
,
937 return (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
941 This function provides a means by which to set a value for a given PCD token.
943 Sets the 64-bit value for the token specified by TokenNumber
944 to the value specified by Value.
946 @param[in] TokenNumber The PCD token number to set a current value for.
947 @param[in] Value The 64-bit value to set.
949 @return The status of the set operation.
955 IN UINTN TokenNumber
,
959 return (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
963 This function provides a means by which to set a value for a given PCD token.
965 Sets a buffer for the token specified by TokenNumber to the value specified
966 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
967 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
968 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
969 was not actually performed.
971 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
972 maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.
974 If SizeOfBuffer is NULL, then ASSERT().
975 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
977 @param[in] TokenNumber The PCD token number to set a current value for.
978 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
979 @param[in] Buffer A pointer to the buffer to set.
981 @return The status of the set operation.
987 IN UINTN TokenNumber
,
988 IN OUT UINTN
*SizeOfBuffer
,
989 IN CONST VOID
*Buffer
992 ASSERT (SizeOfBuffer
!= NULL
);
994 if (*SizeOfBuffer
> 0) {
995 ASSERT (Buffer
!= NULL
);
998 return (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
1002 This function provides a means by which to set a value for a given PCD token.
1004 Sets the boolean value for the token specified by TokenNumber
1005 to the value specified by Value.
1007 @param[in] TokenNumber The PCD token number to set a current value for.
1008 @param[in] Value The boolean value to set.
1010 @return The status of the set operation.
1016 IN UINTN TokenNumber
,
1020 return (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
1024 This function provides a means by which to set a value for a given PCD token.
1026 Sets the 8-bit value for the token specified by TokenNumber
1027 to the value specified by Value.
1029 If Guid is NULL, then ASSERT().
1031 @param[in] Guid The pointer to a 128-bit unique value that
1032 designates which namespace to set a value from.
1033 @param[in] TokenNumber The PCD token number to set a current value for.
1034 @param[in] Value The 8-bit value to set.
1036 @return The status of the set operation.
1042 IN CONST GUID
*Guid
,
1043 IN UINTN TokenNumber
,
1047 ASSERT (Guid
!= NULL
);
1049 return (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
1053 This function provides a means by which to set a value for a given PCD token.
1055 Sets the 16-bit value for the token specified by TokenNumber
1056 to the value specified by Value.
1058 If Guid is NULL, then ASSERT().
1060 @param[in] Guid The pointer to a 128-bit unique value that
1061 designates which namespace to set a value from.
1062 @param[in] TokenNumber The PCD token number to set a current value for.
1063 @param[in] Value The 16-bit value to set.
1065 @return The status of the set operation.
1071 IN CONST GUID
*Guid
,
1072 IN UINTN TokenNumber
,
1076 ASSERT (Guid
!= NULL
);
1078 return (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
1082 This function provides a means by which to set a value for a given PCD token.
1084 Sets the 32-bit value for the token specified by TokenNumber
1085 to the value specified by Value.
1087 If Guid is NULL, then ASSERT().
1089 @param[in] Guid The pointer to a 128-bit unique value that
1090 designates which namespace to set a value from.
1091 @param[in] TokenNumber The PCD token number to set a current value for.
1092 @param[in] Value The 32-bit value to set.
1094 @return The status of the set operation.
1100 IN CONST GUID
*Guid
,
1101 IN UINTN TokenNumber
,
1105 ASSERT (Guid
!= NULL
);
1107 return (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
1111 This function provides a means by which to set a value for a given PCD token.
1113 Sets the 64-bit value for the token specified by TokenNumber
1114 to the value specified by Value.
1116 If Guid is NULL, then ASSERT().
1118 @param[in] Guid The pointer to a 128-bit unique value that
1119 designates which namespace to set a value from.
1120 @param[in] TokenNumber The PCD token number to set a current value for.
1121 @param[in] Value The 64-bit value to set.
1123 @return The status of the set operation.
1129 IN CONST GUID
*Guid
,
1130 IN UINTN TokenNumber
,
1134 ASSERT (Guid
!= NULL
);
1136 return (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
1140 This function provides a means by which to set a value for a given PCD token.
1142 Sets a buffer for the token specified by TokenNumber to the value specified by
1143 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1144 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1145 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
1146 was not actually performed.
1148 If Guid is NULL, then ASSERT().
1149 If SizeOfBuffer is NULL, then ASSERT().
1150 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1152 @param[in] Guid Pointer to a 128-bit unique value that
1153 designates which namespace to set a value from.
1154 @param[in] TokenNumber The PCD token number to set a current value for.
1155 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1156 @param[in] Buffer A pointer to the buffer to set.
1158 @return The status of the set operation.
1164 IN CONST GUID
*Guid
,
1165 IN UINTN TokenNumber
,
1166 IN OUT UINTN
*SizeOfBuffer
,
1170 ASSERT (Guid
!= NULL
);
1172 ASSERT (SizeOfBuffer
!= NULL
);
1174 if (*SizeOfBuffer
> 0) {
1175 ASSERT (Buffer
!= NULL
);
1178 return (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
1182 This function provides a means by which to set a value for a given PCD token.
1184 Sets the boolean value for the token specified by TokenNumber
1185 to the value specified by Value.
1187 If Guid is NULL, then ASSERT().
1189 @param[in] Guid The pointer to a 128-bit unique value that
1190 designates which namespace to set a value from.
1191 @param[in] TokenNumber The PCD token number to set a current value for.
1192 @param[in] Value The boolean value to set.
1194 @return The status of the set operation.
1200 IN CONST GUID
*Guid
,
1201 IN UINTN TokenNumber
,
1205 ASSERT (Guid
!= NULL
);
1207 return (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
1211 Set up a notification function that is called when a specified token is set.
1213 When the token specified by TokenNumber and Guid is set,
1214 then notification function specified by NotificationFunction is called.
1215 If Guid is NULL, then the default token space is used.
1216 If NotificationFunction is NULL, then ASSERT().
1218 @param[in] Guid The pointer to a 128-bit unique value that
1219 designates which namespace to set a value from.
1220 If NULL, then the default token space is used.
1221 @param[in] TokenNumber The PCD token number to monitor.
1222 @param[in] NotificationFunction The function to call when the token
1223 specified by Guid and TokenNumber is set.
1228 LibPcdCallbackOnSet (
1229 IN CONST GUID
*Guid
, OPTIONAL
1230 IN UINTN TokenNumber
,
1231 IN PCD_CALLBACK NotificationFunction
1236 ASSERT (NotificationFunction
!= NULL
);
1238 Status
= (GetPiPcdPpiPointer ())->CallbackOnSet (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
1240 ASSERT_EFI_ERROR (Status
);
1248 Disable a notification function that was established with LibPcdCallbackonSet().
1250 Disable a notification function that was previously established with LibPcdCallbackOnSet().
1251 If NotificationFunction is NULL, then ASSERT().
1252 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1253 and NotificationFunction, then ASSERT().
1255 @param[in] Guid Specify the GUID token space.
1256 @param[in] TokenNumber Specify the token number.
1257 @param[in] NotificationFunction The callback function to be unregistered.
1262 LibPcdCancelCallback (
1263 IN CONST GUID
*Guid
, OPTIONAL
1264 IN UINTN TokenNumber
,
1265 IN PCD_CALLBACK NotificationFunction
1270 ASSERT (NotificationFunction
!= NULL
);
1272 Status
= (GetPiPcdPpiPointer ())->CancelCallback (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
1274 ASSERT_EFI_ERROR (Status
);
1282 Retrieves the next token in a token space.
1284 Retrieves the next PCD token number from the token space specified by Guid.
1285 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
1286 then the first token number is returned. Otherwise, the token number that
1287 follows TokenNumber in the token space is returned. If TokenNumber is the last
1288 token number in the token space, then 0 is returned.
1290 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1292 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
1293 to set a value from. If NULL, then the default token space is used.
1294 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
1297 @return The next valid token number.
1302 LibPcdGetNextToken (
1303 IN CONST GUID
*Guid
, OPTIONAL
1304 IN UINTN TokenNumber
1309 Status
= (GetPiPcdPpiPointer ())->GetNextToken (Guid
, &TokenNumber
);
1310 ASSERT (!EFI_ERROR (Status
) || TokenNumber
== 0);
1317 Used to retrieve the list of available PCD token space GUIDs.
1319 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1321 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1322 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1324 @param TokenSpaceGuid The pointer to the a PCD token space GUID
1326 @return The next valid token namespace.
1331 LibPcdGetNextTokenSpace (
1332 IN CONST GUID
*TokenSpaceGuid
1335 (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid
);
1337 return (GUID
*) TokenSpaceGuid
;
1343 Sets a value of a patchable PCD entry that is type pointer.
1345 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1346 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1347 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1348 NULL to indicate that the set operation was not actually performed.
1349 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1350 MaximumDatumSize and NULL must be returned.
1352 If PatchVariable is NULL, then ASSERT().
1353 If SizeOfBuffer is NULL, then ASSERT().
1354 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1356 @param[out] PatchVariable A pointer to the global variable in a module that is
1357 the target of the set operation.
1358 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1359 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1360 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1362 @return Return the pointer to the buffer been set.
1368 OUT VOID
*PatchVariable
,
1369 IN UINTN MaximumDatumSize
,
1370 IN OUT UINTN
*SizeOfBuffer
,
1371 IN CONST VOID
*Buffer
1374 ASSERT (PatchVariable
!= NULL
);
1375 ASSERT (SizeOfBuffer
!= NULL
);
1377 if (*SizeOfBuffer
> 0) {
1378 ASSERT (Buffer
!= NULL
);
1381 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1382 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1383 *SizeOfBuffer
= MaximumDatumSize
;
1387 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1389 return (VOID
*) Buffer
;
1393 Sets a value of a patchable PCD entry that is type pointer.
1395 Sets the PCD entry specified by PatchVariable to the value specified
1396 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1397 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1398 to indicate that the set operation was not actually performed.
1399 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1400 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1402 If PatchVariable is NULL, then ASSERT().
1403 If SizeOfBuffer is NULL, then ASSERT().
1404 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1406 @param[out] PatchVariable A pointer to the global variable in a module that is
1407 the target of the set operation.
1408 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1409 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1410 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1412 @return The status of the set operation.
1417 LibPatchPcdSetPtrS (
1418 OUT VOID
*PatchVariable
,
1419 IN UINTN MaximumDatumSize
,
1420 IN OUT UINTN
*SizeOfBuffer
,
1421 IN CONST VOID
*Buffer
1424 ASSERT (PatchVariable
!= NULL
);
1425 ASSERT (SizeOfBuffer
!= NULL
);
1427 if (*SizeOfBuffer
> 0) {
1428 ASSERT (Buffer
!= NULL
);
1431 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1432 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1433 *SizeOfBuffer
= MaximumDatumSize
;
1434 return RETURN_INVALID_PARAMETER
;
1437 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1439 return RETURN_SUCCESS
;
1444 Sets a value and size of a patchable PCD entry that is type pointer.
1446 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1447 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1448 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1449 NULL to indicate that the set operation was not actually performed.
1450 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1451 MaximumDatumSize and NULL must be returned.
1453 If PatchVariable is NULL, then ASSERT().
1454 If SizeOfPatchVariable is NULL, then ASSERT().
1455 If SizeOfBuffer is NULL, then ASSERT().
1456 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1458 @param[out] PatchVariable A pointer to the global variable in a module that is
1459 the target of the set operation.
1460 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1461 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1462 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1463 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1465 @return Return the pointer to the buffer been set.
1470 LibPatchPcdSetPtrAndSize (
1471 OUT VOID
*PatchVariable
,
1472 OUT UINTN
*SizeOfPatchVariable
,
1473 IN UINTN MaximumDatumSize
,
1474 IN OUT UINTN
*SizeOfBuffer
,
1475 IN CONST VOID
*Buffer
1478 ASSERT (PatchVariable
!= NULL
);
1479 ASSERT (SizeOfPatchVariable
!= NULL
);
1480 ASSERT (SizeOfBuffer
!= NULL
);
1482 if (*SizeOfBuffer
> 0) {
1483 ASSERT (Buffer
!= NULL
);
1486 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1487 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1488 *SizeOfBuffer
= MaximumDatumSize
;
1492 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1493 *SizeOfPatchVariable
= *SizeOfBuffer
;
1495 return (VOID
*) Buffer
;
1499 Sets a value and size of a patchable PCD entry that is type pointer.
1501 Sets the PCD entry specified by PatchVariable to the value specified
1502 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1503 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1504 to indicate that the set operation was not actually performed.
1505 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1506 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1508 If PatchVariable is NULL, then ASSERT().
1509 If SizeOfPatchVariable is NULL, then ASSERT().
1510 If SizeOfBuffer is NULL, then ASSERT().
1511 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1513 @param[out] PatchVariable A pointer to the global variable in a module that is
1514 the target of the set operation.
1515 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1516 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1517 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1518 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1520 @return The status of the set operation.
1525 LibPatchPcdSetPtrAndSizeS (
1526 OUT VOID
*PatchVariable
,
1527 OUT UINTN
*SizeOfPatchVariable
,
1528 IN UINTN MaximumDatumSize
,
1529 IN OUT UINTN
*SizeOfBuffer
,
1530 IN CONST VOID
*Buffer
1533 ASSERT (PatchVariable
!= NULL
);
1534 ASSERT (SizeOfPatchVariable
!= NULL
);
1535 ASSERT (SizeOfBuffer
!= NULL
);
1537 if (*SizeOfBuffer
> 0) {
1538 ASSERT (Buffer
!= NULL
);
1541 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1542 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1543 *SizeOfBuffer
= MaximumDatumSize
;
1544 return RETURN_INVALID_PARAMETER
;
1547 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1548 *SizeOfPatchVariable
= *SizeOfBuffer
;
1550 return RETURN_SUCCESS
;
1554 Retrieve additional information associated with a PCD token.
1556 This includes information such as the type of value the TokenNumber is associated with as well as possible
1557 human readable name that is associated with the token.
1559 If TokenNumber is not in the default token space specified, then ASSERT().
1561 @param[in] TokenNumber The PCD token number.
1562 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1563 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1568 IN UINTN TokenNumber
,
1569 OUT PCD_INFO
*PcdInfo
1574 Status
= GetPcdInfoPpiPointer()->GetInfo (TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1575 ASSERT_EFI_ERROR (Status
);
1579 Retrieve additional information associated with a PCD token.
1581 This includes information such as the type of value the TokenNumber is associated with as well as possible
1582 human readable name that is associated with the token.
1584 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1586 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
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 CONST GUID
*Guid
,
1595 IN UINTN TokenNumber
,
1596 OUT PCD_INFO
*PcdInfo
1601 Status
= GetPiPcdInfoPpiPointer()->GetInfo (Guid
, TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1602 ASSERT_EFI_ERROR (Status
);
1606 Retrieve the currently set SKU Id.
1608 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1609 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1618 return GetPiPcdInfoPpiPointer()->GetSku ();