2 Implementation of PcdLib class library for PEI phase.
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 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.
22 #include <Ppi/PiPcd.h>
23 #include <Ppi/PcdInfo.h>
24 #include <Ppi/PiPcdInfo.h>
26 #include <Library/PeiServicesLib.h>
27 #include <Library/PcdLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/BaseMemoryLib.h>
32 Retrieve the PCD_PPI pointer.
34 This function is to locate PCD_PPI PPI via PeiService.
35 If fail to locate PCD_PPI, then ASSERT_EFI_ERROR().
37 @retval PCD_PPI * The pointer to the PCD_PPI.
48 Status
= PeiServicesLocatePpi (&gPcdPpiGuid
, 0, NULL
, (VOID
**)&PcdPpi
);
49 ASSERT_EFI_ERROR (Status
);
55 Retrieve the pointer of EFI_PEI_PCD_PPI defined in PI 1.2 Vol 3.
57 This function is to locate EFI_PEI_PCD_PPI PPI via PeiService.
58 If fail to locate EFI_PEI_PCD_PPI, then ASSERT_EFI_ERROR().
60 @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI.
69 EFI_PEI_PCD_PPI
*PiPcdPpi
;
71 Status
= PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid
, 0, NULL
, (VOID
**)&PiPcdPpi
);
72 ASSERT_EFI_ERROR (Status
);
78 Retrieve the GET_PCD_INFO_PPI pointer.
80 This function is to locate GET_PCD_INFO_PPI PPI via PeiService.
81 If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
83 @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.
87 GetPcdInfoPpiPointer (
92 GET_PCD_INFO_PPI
*PcdInfoPpi
;
94 Status
= PeiServicesLocatePpi (&gGetPcdInfoPpiGuid
, 0, NULL
, (VOID
**)&PcdInfoPpi
);
95 ASSERT_EFI_ERROR (Status
);
101 Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.
103 This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService.
104 If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
106 @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.
109 EFI_GET_PCD_INFO_PPI
*
110 GetPiPcdInfoPpiPointer (
115 EFI_GET_PCD_INFO_PPI
*PiPcdInfoPpi
;
117 Status
= PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid
, 0, NULL
, (VOID
**)&PiPcdInfoPpi
);
118 ASSERT_EFI_ERROR (Status
);
124 This function provides a means by which SKU support can be established in the PCD infrastructure.
126 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
128 @param SkuId The SKU value that will be used when the PCD service retrieves
129 and sets values associated with a PCD token.
131 @return Return the SKU ID that just be set.
140 GetPiPcdPpiPointer()->SetSku (SkuId
);
148 This function provides a means by which to retrieve a value for a given PCD token.
150 Returns the 8-bit value for the token specified by TokenNumber.
152 @param[in] TokenNumber The PCD token number to retrieve a current value for.
154 @return Returns the 8-bit value for the token specified by TokenNumber.
163 return (GetPcdPpiPointer ())->Get8 (TokenNumber
);
169 This function provides a means by which to retrieve a value for a given PCD token.
171 Returns the 16-bit value for the token specified by TokenNumber.
173 @param[in] TokenNumber The PCD token number to retrieve a current value for.
175 @return Returns the 16-bit value for the token specified by TokenNumber.
184 return (GetPcdPpiPointer ())->Get16 (TokenNumber
);
190 This function provides a means by which to retrieve a value for a given PCD token.
192 Returns the 32-bit value for the token specified by TokenNumber.
194 @param[in] TokenNumber The PCD token number to retrieve a current value for.
196 @return Returns the 32-bit value for the token specified by TokenNumber.
205 return (GetPcdPpiPointer ())->Get32 (TokenNumber
);
211 This function provides a means by which to retrieve a value for a given PCD token.
213 Returns the 64-bit value for the token specified by TokenNumber.
215 @param[in] TokenNumber The PCD token number to retrieve a current value for.
217 @return Returns the 64-bit value for the token specified by TokenNumber.
226 return (GetPcdPpiPointer ())->Get64 (TokenNumber
);
232 This function provides a means by which to retrieve a value for a given PCD token.
234 Returns the pointer to the buffer of the token specified by TokenNumber.
236 @param[in] TokenNumber The PCD token number to retrieve a current value for.
238 @return Returns the pointer to the token specified by TokenNumber.
247 return (GetPcdPpiPointer ())->GetPtr (TokenNumber
);
253 This function provides a means by which to retrieve a value for a given PCD token.
255 Returns the Boolean value of the token specified by TokenNumber.
257 @param[in] TokenNumber The PCD token number to retrieve a current value for.
259 @return Returns the Boolean value of the token specified by TokenNumber.
268 return (GetPcdPpiPointer ())->GetBool (TokenNumber
);
274 This function provides a means by which to retrieve the size of a given PCD token.
276 @param[in] TokenNumber The PCD token number to retrieve a current value for.
278 @return Returns the size of the token specified by TokenNumber.
287 return (GetPcdPpiPointer ())->GetSize (TokenNumber
);
293 This function provides a means by which to retrieve a value for a given PCD token.
295 Returns the 8-bit value for the token specified by TokenNumber and Guid.
297 If Guid is NULL, then ASSERT().
299 @param[in] Guid The pointer to a 128-bit unique value that designates
300 which namespace to retrieve a value from.
301 @param[in] TokenNumber The PCD token number to retrieve a current value for.
303 @return Return the UINT8.
313 ASSERT (Guid
!= NULL
);
315 return (GetPiPcdPpiPointer ())->Get8 (Guid
, TokenNumber
);
321 This function provides a means by which to retrieve a value for a given PCD token.
323 Returns the 16-bit value for the token specified by TokenNumber and Guid.
325 If Guid is NULL, then ASSERT().
327 @param[in] Guid The pointer to a 128-bit unique value that designates
328 which namespace to retrieve a value from.
329 @param[in] TokenNumber The PCD token number to retrieve a current value for.
331 @return Return the UINT16.
342 ASSERT (Guid
!= NULL
);
344 return (GetPiPcdPpiPointer ())->Get16 (Guid
, TokenNumber
);
350 Returns the 32-bit value for the token specified by TokenNumber and Guid.
351 If Guid is NULL, then ASSERT().
353 @param[in] Guid The pointer to a 128-bit unique value that designates
354 which namespace to retrieve a value from.
355 @param[in] TokenNumber The PCD token number to retrieve a current value for.
357 @return Return the UINT32.
367 ASSERT (Guid
!= NULL
);
369 return (GetPiPcdPpiPointer ())->Get32 (Guid
, TokenNumber
);
376 This function provides a means by which to retrieve a value for a given PCD token.
378 Returns the 64-bit value for the token specified by TokenNumber and Guid.
380 If Guid is NULL, then ASSERT().
382 @param[in] Guid The pointer to a 128-bit unique value that designates
383 which namespace to retrieve a value from.
384 @param[in] TokenNumber The PCD token number to retrieve a current value for.
386 @return Return the UINT64.
396 ASSERT (Guid
!= NULL
);
397 return (GetPiPcdPpiPointer ())->Get64 (Guid
, TokenNumber
);
403 This function provides a means by which to retrieve a value for a given PCD token.
405 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
407 If Guid is NULL, then ASSERT().
409 @param[in] Guid The pointer to a 128-bit unique value that designates
410 which namespace to retrieve a value from.
411 @param[in] TokenNumber The PCD token number to retrieve a current value for.
413 @return Return the VOID* pointer.
423 ASSERT (Guid
!= NULL
);
425 return (GetPiPcdPpiPointer ())->GetPtr (Guid
, TokenNumber
);
431 This function provides a means by which to retrieve a value for a given PCD token.
433 Returns the Boolean value of the token specified by TokenNumber and Guid.
435 If Guid is NULL, then ASSERT().
437 @param[in] Guid The pointer to a 128-bit unique value that designates
438 which namespace to retrieve a value from.
439 @param[in] TokenNumber The PCD token number to retrieve a current value for.
441 @return Return the BOOLEAN.
451 ASSERT (Guid
!= NULL
);
452 return (GetPiPcdPpiPointer ())->GetBool (Guid
, TokenNumber
);
458 This function provides a means by which to retrieve the size of a given PCD token.
460 Returns the size of the token specified by TokenNumber and Guid.
462 If Guid is NULL, then ASSERT().
464 @param[in] Guid The pointer to a 128-bit unique value that designates
465 which namespace to retrieve a value from.
466 @param[in] TokenNumber The PCD token number to retrieve a current value for.
468 @return Return the size.
478 ASSERT (Guid
!= NULL
);
479 return (GetPiPcdPpiPointer ())->GetSize (Guid
, TokenNumber
);
484 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
486 This function provides a means by which to set a value for a given PCD token.
488 Sets the 8-bit value for the token specified by TokenNumber
489 to the value specified by Value. Value is returned.
491 @param[in] TokenNumber The PCD token number to set a current value for.
492 @param[in] Value The 8-bit value to set.
494 @return Return the value that was set.
500 IN UINTN TokenNumber
,
504 (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
512 This function provides a means by which to set a value for a given PCD token.
514 Sets the 16-bit value for the token specified by TokenNumber
515 to the value specified by Value. Value is returned.
517 @param[in] TokenNumber The PCD token number to set a current value for.
518 @param[in] Value The 16-bit value to set.
520 @return Return the value that was set.
526 IN UINTN TokenNumber
,
530 (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
538 This function provides a means by which to set a value for a given PCD token.
540 Sets the 32-bit value for the token specified by TokenNumber
541 to the value specified by Value. Value is returned.
543 @param[in] TokenNumber The PCD token number to set a current value for.
544 @param[in] Value The 32-bit value to set.
546 @return Return the value that was set.
552 IN UINTN TokenNumber
,
556 (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
564 This function provides a means by which to set a value for a given PCD token.
566 Sets the 64-bit value for the token specified by TokenNumber
567 to the value specified by Value. Value is returned.
569 @param[in] TokenNumber The PCD token number to set a current value for.
570 @param[in] Value The 64-bit value to set.
572 @return Return the value that was set.
578 IN UINTN TokenNumber
,
582 (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
590 This function provides a means by which to set a value for a given PCD token.
592 Sets a buffer for the token specified by TokenNumber to the value
593 specified by Buffer and SizeOfBuffer. Buffer is returned.
594 If SizeOfBuffer is greater than the maximum size support by TokenNumber,
595 then set SizeOfBuffer to the maximum size supported by TokenNumber and
596 return NULL to indicate that the set operation was not actually performed.
598 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
599 maximum size supported by TokenName and NULL must be returned.
601 If SizeOfBuffer is NULL, then ASSERT().
602 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
604 @param[in] TokenNumber The PCD token number to set a current value for.
605 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
606 @param[in] Buffer A pointer to the buffer to set.
608 @return Return the pointer for the buffer been set.
614 IN UINTN TokenNumber
,
615 IN OUT UINTN
*SizeOfBuffer
,
616 IN CONST VOID
*Buffer
620 UINTN InputSizeOfBuffer
;
622 ASSERT (SizeOfBuffer
!= NULL
);
624 if (*SizeOfBuffer
> 0) {
625 ASSERT (Buffer
!= NULL
);
628 InputSizeOfBuffer
= *SizeOfBuffer
;
629 Status
= (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
630 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
634 return (VOID
*) Buffer
;
640 This function provides a means by which to set a value for a given PCD token.
642 Sets the Boolean value for the token specified by TokenNumber
643 to the value specified by Value. Value is returned.
645 @param[in] TokenNumber The PCD token number to set a current value for.
646 @param[in] Value The boolean value to set.
648 @return Return the value that was set.
654 IN UINTN TokenNumber
,
658 (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
666 This function provides a means by which to set a value for a given PCD token.
668 Sets the 8-bit value for the token specified by TokenNumber and
669 Guid to the value specified by Value. Value is returned.
671 If Guid is NULL, then ASSERT().
673 @param[in] Guid The pointer to a 128-bit unique value that
674 designates which namespace to set a value from.
675 @param[in] TokenNumber The PCD token number to set a current value for.
676 @param[in] Value The 8-bit value to set.
678 @return Return the value that was set.
685 IN UINTN TokenNumber
,
689 ASSERT (Guid
!= NULL
);
691 (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
699 This function provides a means by which to set a value for a given PCD token.
701 Sets the 16-bit value for the token specified by TokenNumber and
702 Guid to the value specified by Value. Value is returned.
704 If Guid is NULL, then ASSERT().
706 @param[in] Guid The pointer to a 128-bit unique value that
707 designates which namespace to set a value from.
708 @param[in] TokenNumber The PCD token number to set a current value for.
709 @param[in] Value The 16-bit value to set.
711 @return Return the value that was set.
718 IN UINTN TokenNumber
,
722 ASSERT (Guid
!= NULL
);
724 (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
732 This function provides a means by which to set a value for a given PCD token.
734 Sets the 32-bit value for the token specified by TokenNumber and
735 Guid to the value specified by Value. Value is returned.
737 If Guid is NULL, then ASSERT().
739 @param[in] Guid The pointer to a 128-bit unique value that
740 designates which namespace to set a value from.
741 @param[in] TokenNumber The PCD token number to set a current value for.
742 @param[in] Value The 32-bit value to set.
744 @return Return the value that was set.
751 IN UINTN TokenNumber
,
755 ASSERT (Guid
!= NULL
);
757 (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
765 This function provides a means by which to set a value for a given PCD token.
767 Sets the 64-bit value for the token specified by TokenNumber and
768 Guid to the value specified by Value. Value is returned.
770 If Guid is NULL, then ASSERT().
772 @param[in] Guid The pointer to a 128-bit unique value that
773 designates which namespace to set a value from.
774 @param[in] TokenNumber The PCD token number to set a current value for.
775 @param[in] Value The 64-bit value to set.
777 @return Return the value that was set.
784 IN UINTN TokenNumber
,
788 ASSERT (Guid
!= NULL
);
790 (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
798 This function provides a means by which to set a value for a given PCD token.
800 Sets a buffer for the token specified by TokenNumber to the value specified by
801 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
802 the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
803 supported by TokenNumber and return NULL to indicate that the set operation
804 was not actually performed.
806 If Guid is NULL, then ASSERT().
807 If SizeOfBuffer is NULL, then ASSERT().
808 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
810 @param[in] Guid The pointer to a 128-bit unique value that
811 designates which namespace to set a value from.
812 @param[in] TokenNumber The PCD token number to set a current value for.
813 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
814 @param[in] Buffer A pointer to the buffer to set.
816 @return Return the pinter to the buffer been set.
823 IN UINTN TokenNumber
,
824 IN OUT UINTN
*SizeOfBuffer
,
829 UINTN InputSizeOfBuffer
;
831 ASSERT (SizeOfBuffer
!= NULL
);
832 if (*SizeOfBuffer
> 0) {
833 ASSERT (Buffer
!= NULL
);
835 ASSERT (Guid
!= NULL
);
837 InputSizeOfBuffer
= *SizeOfBuffer
;
838 Status
= (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
839 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
849 This function provides a means by which to set a value for a given PCD token.
851 Sets the Boolean value for the token specified by TokenNumber and
852 Guid to the value specified by Value. Value is returned.
854 If Guid is NULL, then ASSERT().
856 @param[in] Guid The pointer to a 128-bit unique value that
857 designates which namespace to set a value from.
858 @param[in] TokenNumber The PCD token number to set a current value for.
859 @param[in] Value The Boolean value to set.
861 @return Return the value that was set.
868 IN UINTN TokenNumber
,
872 ASSERT (Guid
!= NULL
);
874 (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
881 This function provides a means by which to set a value for a given PCD token.
883 Sets the 8-bit value for the token specified by TokenNumber
884 to the value specified by Value.
886 @param[in] TokenNumber The PCD token number to set a current value for.
887 @param[in] Value The 8-bit value to set.
889 @return The status of the set operation.
895 IN UINTN TokenNumber
,
899 return (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
903 This function provides a means by which to set a value for a given PCD token.
905 Sets the 16-bit value for the token specified by TokenNumber
906 to the value specified by Value.
908 @param[in] TokenNumber The PCD token number to set a current value for.
909 @param[in] Value The 16-bit value to set.
911 @return The status of the set operation.
917 IN UINTN TokenNumber
,
921 return (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
925 This function provides a means by which to set a value for a given PCD token.
927 Sets the 32-bit value for the token specified by TokenNumber
928 to the value specified by Value.
930 @param[in] TokenNumber The PCD token number to set a current value for.
931 @param[in] Value The 32-bit value to set.
933 @return The status of the set operation.
939 IN UINTN TokenNumber
,
943 return (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
947 This function provides a means by which to set a value for a given PCD token.
949 Sets the 64-bit value for the token specified by TokenNumber
950 to the value specified by Value.
952 @param[in] TokenNumber The PCD token number to set a current value for.
953 @param[in] Value The 64-bit value to set.
955 @return The status of the set operation.
961 IN UINTN TokenNumber
,
965 return (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
969 This function provides a means by which to set a value for a given PCD token.
971 Sets a buffer for the token specified by TokenNumber to the value specified
972 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
973 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
974 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
975 was not actually performed.
977 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
978 maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.
980 If SizeOfBuffer is NULL, then ASSERT().
981 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
983 @param[in] TokenNumber The PCD token number to set a current value for.
984 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
985 @param[in] Buffer A pointer to the buffer to set.
987 @return The status of the set operation.
993 IN UINTN TokenNumber
,
994 IN OUT UINTN
*SizeOfBuffer
,
995 IN CONST VOID
*Buffer
998 ASSERT (SizeOfBuffer
!= NULL
);
1000 if (*SizeOfBuffer
> 0) {
1001 ASSERT (Buffer
!= NULL
);
1004 return (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
1008 This function provides a means by which to set a value for a given PCD token.
1010 Sets the boolean value for the token specified by TokenNumber
1011 to the value specified by Value.
1013 @param[in] TokenNumber The PCD token number to set a current value for.
1014 @param[in] Value The boolean value to set.
1016 @return The status of the set operation.
1022 IN UINTN TokenNumber
,
1026 return (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
1030 This function provides a means by which to set a value for a given PCD token.
1032 Sets the 8-bit value for the token specified by TokenNumber
1033 to the value specified by Value.
1035 If Guid is NULL, then ASSERT().
1037 @param[in] Guid The pointer to a 128-bit unique value that
1038 designates which namespace to set a value from.
1039 @param[in] TokenNumber The PCD token number to set a current value for.
1040 @param[in] Value The 8-bit value to set.
1042 @return The status of the set operation.
1048 IN CONST GUID
*Guid
,
1049 IN UINTN TokenNumber
,
1053 ASSERT (Guid
!= NULL
);
1055 return (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
1059 This function provides a means by which to set a value for a given PCD token.
1061 Sets the 16-bit value for the token specified by TokenNumber
1062 to the value specified by Value.
1064 If Guid is NULL, then ASSERT().
1066 @param[in] Guid The pointer to a 128-bit unique value that
1067 designates which namespace to set a value from.
1068 @param[in] TokenNumber The PCD token number to set a current value for.
1069 @param[in] Value The 16-bit value to set.
1071 @return The status of the set operation.
1077 IN CONST GUID
*Guid
,
1078 IN UINTN TokenNumber
,
1082 ASSERT (Guid
!= NULL
);
1084 return (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
1088 This function provides a means by which to set a value for a given PCD token.
1090 Sets the 32-bit value for the token specified by TokenNumber
1091 to the value specified by Value.
1093 If Guid is NULL, then ASSERT().
1095 @param[in] Guid The pointer to a 128-bit unique value that
1096 designates which namespace to set a value from.
1097 @param[in] TokenNumber The PCD token number to set a current value for.
1098 @param[in] Value The 32-bit value to set.
1100 @return The status of the set operation.
1106 IN CONST GUID
*Guid
,
1107 IN UINTN TokenNumber
,
1111 ASSERT (Guid
!= NULL
);
1113 return (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
1117 This function provides a means by which to set a value for a given PCD token.
1119 Sets the 64-bit value for the token specified by TokenNumber
1120 to the value specified by Value.
1122 If Guid is NULL, then ASSERT().
1124 @param[in] Guid The pointer to a 128-bit unique value that
1125 designates which namespace to set a value from.
1126 @param[in] TokenNumber The PCD token number to set a current value for.
1127 @param[in] Value The 64-bit value to set.
1129 @return The status of the set operation.
1135 IN CONST GUID
*Guid
,
1136 IN UINTN TokenNumber
,
1140 ASSERT (Guid
!= NULL
);
1142 return (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
1146 This function provides a means by which to set a value for a given PCD token.
1148 Sets a buffer for the token specified by TokenNumber to the value specified by
1149 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1150 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1151 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
1152 was not actually performed.
1154 If Guid is NULL, then ASSERT().
1155 If SizeOfBuffer is NULL, then ASSERT().
1156 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1158 @param[in] Guid Pointer to a 128-bit unique value that
1159 designates which namespace to set a value from.
1160 @param[in] TokenNumber The PCD token number to set a current value for.
1161 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1162 @param[in] Buffer A pointer to the buffer to set.
1164 @return The status of the set operation.
1170 IN CONST GUID
*Guid
,
1171 IN UINTN TokenNumber
,
1172 IN OUT UINTN
*SizeOfBuffer
,
1176 ASSERT (Guid
!= NULL
);
1178 ASSERT (SizeOfBuffer
!= NULL
);
1180 if (*SizeOfBuffer
> 0) {
1181 ASSERT (Buffer
!= NULL
);
1184 return (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
1188 This function provides a means by which to set a value for a given PCD token.
1190 Sets the boolean value for the token specified by TokenNumber
1191 to the value specified by Value.
1193 If Guid is NULL, then ASSERT().
1195 @param[in] Guid The pointer to a 128-bit unique value that
1196 designates which namespace to set a value from.
1197 @param[in] TokenNumber The PCD token number to set a current value for.
1198 @param[in] Value The boolean value to set.
1200 @return The status of the set operation.
1206 IN CONST GUID
*Guid
,
1207 IN UINTN TokenNumber
,
1211 ASSERT (Guid
!= NULL
);
1213 return (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
1217 Set up a notification function that is called when a specified token is set.
1219 When the token specified by TokenNumber and Guid is set,
1220 then notification function specified by NotificationFunction is called.
1221 If Guid is NULL, then the default token space is used.
1222 If NotificationFunction is NULL, then ASSERT().
1224 @param[in] Guid The pointer to a 128-bit unique value that
1225 designates which namespace to set a value from.
1226 If NULL, then the default token space is used.
1227 @param[in] TokenNumber The PCD token number to monitor.
1228 @param[in] NotificationFunction The function to call when the token
1229 specified by Guid and TokenNumber is set.
1234 LibPcdCallbackOnSet (
1235 IN CONST GUID
*Guid
, OPTIONAL
1236 IN UINTN TokenNumber
,
1237 IN PCD_CALLBACK NotificationFunction
1242 ASSERT (NotificationFunction
!= NULL
);
1244 Status
= (GetPiPcdPpiPointer ())->CallbackOnSet (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
1246 ASSERT_EFI_ERROR (Status
);
1254 Disable a notification function that was established with LibPcdCallbackonSet().
1256 Disable a notification function that was previously established with LibPcdCallbackOnSet().
1257 If NotificationFunction is NULL, then ASSERT().
1258 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1259 and NotificationFunction, then ASSERT().
1261 @param[in] Guid Specify the GUID token space.
1262 @param[in] TokenNumber Specify the token number.
1263 @param[in] NotificationFunction The callback function to be unregistered.
1268 LibPcdCancelCallback (
1269 IN CONST GUID
*Guid
, OPTIONAL
1270 IN UINTN TokenNumber
,
1271 IN PCD_CALLBACK NotificationFunction
1276 ASSERT (NotificationFunction
!= NULL
);
1278 Status
= (GetPiPcdPpiPointer ())->CancelCallback (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
1280 ASSERT_EFI_ERROR (Status
);
1288 Retrieves the next token in a token space.
1290 Retrieves the next PCD token number from the token space specified by Guid.
1291 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
1292 then the first token number is returned. Otherwise, the token number that
1293 follows TokenNumber in the token space is returned. If TokenNumber is the last
1294 token number in the token space, then 0 is returned.
1296 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1298 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
1299 to set a value from. If NULL, then the default token space is used.
1300 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
1303 @return The next valid token number.
1308 LibPcdGetNextToken (
1309 IN CONST GUID
*Guid
, OPTIONAL
1310 IN UINTN TokenNumber
1315 Status
= (GetPiPcdPpiPointer ())->GetNextToken (Guid
, &TokenNumber
);
1316 ASSERT (!EFI_ERROR (Status
) || TokenNumber
== 0);
1323 Used to retrieve the list of available PCD token space GUIDs.
1325 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1327 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1328 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1330 @param TokenSpaceGuid The pointer to the a PCD token space GUID
1332 @return The next valid token namespace.
1337 LibPcdGetNextTokenSpace (
1338 IN CONST GUID
*TokenSpaceGuid
1341 (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid
);
1343 return (GUID
*) TokenSpaceGuid
;
1349 Sets a value of a patchable PCD entry that is type pointer.
1351 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1352 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1353 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1354 NULL to indicate that the set operation was not actually performed.
1355 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1356 MaximumDatumSize and NULL must be returned.
1358 If PatchVariable is NULL, then ASSERT().
1359 If SizeOfBuffer is NULL, then ASSERT().
1360 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1362 @param[out] PatchVariable A pointer to the global variable in a module that is
1363 the target of the set operation.
1364 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1365 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1366 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1368 @return Return the pointer to the buffer been set.
1374 OUT VOID
*PatchVariable
,
1375 IN UINTN MaximumDatumSize
,
1376 IN OUT UINTN
*SizeOfBuffer
,
1377 IN CONST VOID
*Buffer
1380 ASSERT (PatchVariable
!= NULL
);
1381 ASSERT (SizeOfBuffer
!= NULL
);
1383 if (*SizeOfBuffer
> 0) {
1384 ASSERT (Buffer
!= NULL
);
1387 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1388 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1389 *SizeOfBuffer
= MaximumDatumSize
;
1393 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1395 return (VOID
*) Buffer
;
1399 Sets a value of a patchable PCD entry that is type pointer.
1401 Sets the PCD entry specified by PatchVariable to the value specified
1402 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1403 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1404 to indicate that the set operation was not actually performed.
1405 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1406 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1408 If PatchVariable is NULL, then ASSERT().
1409 If SizeOfBuffer is NULL, then ASSERT().
1410 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1412 @param[out] PatchVariable A pointer to the global variable in a module that is
1413 the target of the set operation.
1414 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1415 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1416 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1418 @return The status of the set operation.
1423 LibPatchPcdSetPtrS (
1424 OUT VOID
*PatchVariable
,
1425 IN UINTN MaximumDatumSize
,
1426 IN OUT UINTN
*SizeOfBuffer
,
1427 IN CONST VOID
*Buffer
1430 ASSERT (PatchVariable
!= NULL
);
1431 ASSERT (SizeOfBuffer
!= NULL
);
1433 if (*SizeOfBuffer
> 0) {
1434 ASSERT (Buffer
!= NULL
);
1437 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1438 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1439 *SizeOfBuffer
= MaximumDatumSize
;
1440 return RETURN_INVALID_PARAMETER
;
1443 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1445 return RETURN_SUCCESS
;
1450 Sets a value and size of a patchable PCD entry that is type pointer.
1452 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1453 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1454 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1455 NULL to indicate that the set operation was not actually performed.
1456 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1457 MaximumDatumSize and NULL must be returned.
1459 If PatchVariable is NULL, then ASSERT().
1460 If SizeOfPatchVariable is NULL, then ASSERT().
1461 If SizeOfBuffer is NULL, then ASSERT().
1462 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1464 @param[out] PatchVariable A pointer to the global variable in a module that is
1465 the target of the set operation.
1466 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1467 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1468 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1469 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1471 @return Return the pointer to the buffer been set.
1476 LibPatchPcdSetPtrAndSize (
1477 OUT VOID
*PatchVariable
,
1478 OUT UINTN
*SizeOfPatchVariable
,
1479 IN UINTN MaximumDatumSize
,
1480 IN OUT UINTN
*SizeOfBuffer
,
1481 IN CONST VOID
*Buffer
1484 ASSERT (PatchVariable
!= NULL
);
1485 ASSERT (SizeOfPatchVariable
!= NULL
);
1486 ASSERT (SizeOfBuffer
!= NULL
);
1488 if (*SizeOfBuffer
> 0) {
1489 ASSERT (Buffer
!= NULL
);
1492 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1493 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1494 *SizeOfBuffer
= MaximumDatumSize
;
1498 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1499 *SizeOfPatchVariable
= *SizeOfBuffer
;
1501 return (VOID
*) Buffer
;
1505 Sets a value and size of a patchable PCD entry that is type pointer.
1507 Sets the PCD entry specified by PatchVariable to the value specified
1508 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1509 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1510 to indicate that the set operation was not actually performed.
1511 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1512 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1514 If PatchVariable is NULL, then ASSERT().
1515 If SizeOfPatchVariable is NULL, then ASSERT().
1516 If SizeOfBuffer is NULL, then ASSERT().
1517 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1519 @param[out] PatchVariable A pointer to the global variable in a module that is
1520 the target of the set operation.
1521 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1522 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1523 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1524 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1526 @return The status of the set operation.
1531 LibPatchPcdSetPtrAndSizeS (
1532 OUT VOID
*PatchVariable
,
1533 OUT UINTN
*SizeOfPatchVariable
,
1534 IN UINTN MaximumDatumSize
,
1535 IN OUT UINTN
*SizeOfBuffer
,
1536 IN CONST VOID
*Buffer
1539 ASSERT (PatchVariable
!= NULL
);
1540 ASSERT (SizeOfPatchVariable
!= NULL
);
1541 ASSERT (SizeOfBuffer
!= NULL
);
1543 if (*SizeOfBuffer
> 0) {
1544 ASSERT (Buffer
!= NULL
);
1547 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1548 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1549 *SizeOfBuffer
= MaximumDatumSize
;
1550 return RETURN_INVALID_PARAMETER
;
1553 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1554 *SizeOfPatchVariable
= *SizeOfBuffer
;
1556 return RETURN_SUCCESS
;
1560 Retrieve additional information associated with a PCD token.
1562 This includes information such as the type of value the TokenNumber is associated with as well as possible
1563 human readable name that is associated with the token.
1565 If TokenNumber is not in the default token space specified, then ASSERT().
1567 @param[in] TokenNumber The PCD token number.
1568 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1569 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1574 IN UINTN TokenNumber
,
1575 OUT PCD_INFO
*PcdInfo
1580 Status
= GetPcdInfoPpiPointer()->GetInfo (TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1581 ASSERT_EFI_ERROR (Status
);
1585 Retrieve additional information associated with a PCD token.
1587 This includes information such as the type of value the TokenNumber is associated with as well as possible
1588 human readable name that is associated with the token.
1590 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1592 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1593 @param[in] TokenNumber The PCD token number.
1594 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1595 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1600 IN CONST GUID
*Guid
,
1601 IN UINTN TokenNumber
,
1602 OUT PCD_INFO
*PcdInfo
1607 Status
= GetPiPcdInfoPpiPointer()->GetInfo (Guid
, TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1608 ASSERT_EFI_ERROR (Status
);
1612 Retrieve the currently set SKU Id.
1614 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1615 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1624 return GetPiPcdInfoPpiPointer()->GetSku ();