2 Implementation of PcdLib class library for PEI phase.
4 Copyright (c) 2006 - 2015, 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.
127 If SkuId >= PCD_MAX_SKU_ID, then ASSERT().
129 @param SkuId The SKU value that will be used when the PCD service retrieves
130 and sets values associated with a PCD token.
132 @return Return the SKU ID that just be set.
142 ASSERT (SkuId
< PCD_MAX_SKU_ID
);
144 GetPiPcdPpiPointer()->SetSku (SkuId
);
152 This function provides a means by which to retrieve a value for a given PCD token.
154 Returns the 8-bit value for the token specified by TokenNumber.
156 @param[in] TokenNumber The PCD token number to retrieve a current value for.
158 @return Returns the 8-bit value for the token specified by TokenNumber.
167 return (GetPcdPpiPointer ())->Get8 (TokenNumber
);
173 This function provides a means by which to retrieve a value for a given PCD token.
175 Returns the 16-bit value for the token specified by TokenNumber.
177 @param[in] TokenNumber The PCD token number to retrieve a current value for.
179 @return Returns the 16-bit value for the token specified by TokenNumber.
188 return (GetPcdPpiPointer ())->Get16 (TokenNumber
);
194 This function provides a means by which to retrieve a value for a given PCD token.
196 Returns the 32-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 32-bit value for the token specified by TokenNumber.
209 return (GetPcdPpiPointer ())->Get32 (TokenNumber
);
215 This function provides a means by which to retrieve a value for a given PCD token.
217 Returns the 64-bit value for the token specified by TokenNumber.
219 @param[in] TokenNumber The PCD token number to retrieve a current value for.
221 @return Returns the 64-bit value for the token specified by TokenNumber.
230 return (GetPcdPpiPointer ())->Get64 (TokenNumber
);
236 This function provides a means by which to retrieve a value for a given PCD token.
238 Returns the pointer to the buffer of the token specified by TokenNumber.
240 @param[in] TokenNumber The PCD token number to retrieve a current value for.
242 @return Returns the pointer to the token specified by TokenNumber.
251 return (GetPcdPpiPointer ())->GetPtr (TokenNumber
);
257 This function provides a means by which to retrieve a value for a given PCD token.
259 Returns the Boolean value of the token specified by TokenNumber.
261 @param[in] TokenNumber The PCD token number to retrieve a current value for.
263 @return Returns the Boolean value of the token specified by TokenNumber.
272 return (GetPcdPpiPointer ())->GetBool (TokenNumber
);
278 This function provides a means by which to retrieve the size of a given PCD token.
280 @param[in] TokenNumber The PCD token number to retrieve a current value for.
282 @return Returns the size of the token specified by TokenNumber.
291 return (GetPcdPpiPointer ())->GetSize (TokenNumber
);
297 This function provides a means by which to retrieve a value for a given PCD token.
299 Returns the 8-bit value for the token specified by TokenNumber and Guid.
301 If Guid is NULL, then ASSERT().
303 @param[in] Guid The pointer to a 128-bit unique value that designates
304 which namespace to retrieve a value from.
305 @param[in] TokenNumber The PCD token number to retrieve a current value for.
307 @return Return the UINT8.
317 ASSERT (Guid
!= NULL
);
319 return (GetPiPcdPpiPointer ())->Get8 (Guid
, TokenNumber
);
325 This function provides a means by which to retrieve a value for a given PCD token.
327 Returns the 16-bit value for the token specified by TokenNumber and Guid.
329 If Guid is NULL, then ASSERT().
331 @param[in] Guid The pointer to a 128-bit unique value that designates
332 which namespace to retrieve a value from.
333 @param[in] TokenNumber The PCD token number to retrieve a current value for.
335 @return Return the UINT16.
346 ASSERT (Guid
!= NULL
);
348 return (GetPiPcdPpiPointer ())->Get16 (Guid
, TokenNumber
);
354 Returns the 32-bit value for the token specified by TokenNumber and Guid.
355 If Guid is NULL, then ASSERT().
357 @param[in] Guid The pointer to a 128-bit unique value that designates
358 which namespace to retrieve a value from.
359 @param[in] TokenNumber The PCD token number to retrieve a current value for.
361 @return Return the UINT32.
371 ASSERT (Guid
!= NULL
);
373 return (GetPiPcdPpiPointer ())->Get32 (Guid
, TokenNumber
);
380 This function provides a means by which to retrieve a value for a given PCD token.
382 Returns the 64-bit value for the token specified by TokenNumber and Guid.
384 If Guid is NULL, then ASSERT().
386 @param[in] Guid The pointer to a 128-bit unique value that designates
387 which namespace to retrieve a value from.
388 @param[in] TokenNumber The PCD token number to retrieve a current value for.
390 @return Return the UINT64.
400 ASSERT (Guid
!= NULL
);
401 return (GetPiPcdPpiPointer ())->Get64 (Guid
, TokenNumber
);
407 This function provides a means by which to retrieve a value for a given PCD token.
409 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
411 If Guid is NULL, then ASSERT().
413 @param[in] Guid The pointer to a 128-bit unique value that designates
414 which namespace to retrieve a value from.
415 @param[in] TokenNumber The PCD token number to retrieve a current value for.
417 @return Return the VOID* pointer.
427 ASSERT (Guid
!= NULL
);
429 return (GetPiPcdPpiPointer ())->GetPtr (Guid
, TokenNumber
);
435 This function provides a means by which to retrieve a value for a given PCD token.
437 Returns the Boolean value of the token specified by TokenNumber and Guid.
439 If Guid is NULL, then ASSERT().
441 @param[in] Guid The pointer to a 128-bit unique value that designates
442 which namespace to retrieve a value from.
443 @param[in] TokenNumber The PCD token number to retrieve a current value for.
445 @return Return the BOOLEAN.
455 ASSERT (Guid
!= NULL
);
456 return (GetPiPcdPpiPointer ())->GetBool (Guid
, TokenNumber
);
462 This function provides a means by which to retrieve the size of a given PCD token.
464 Returns the size of the token specified by TokenNumber and Guid.
466 If Guid is NULL, then ASSERT().
468 @param[in] Guid The pointer to a 128-bit unique value that designates
469 which namespace to retrieve a value from.
470 @param[in] TokenNumber The PCD token number to retrieve a current value for.
472 @return Return the size.
482 ASSERT (Guid
!= NULL
);
483 return (GetPiPcdPpiPointer ())->GetSize (Guid
, TokenNumber
);
488 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
490 This function provides a means by which to set a value for a given PCD token.
492 Sets the 8-bit value for the token specified by TokenNumber
493 to the value specified by Value. Value is returned.
495 @param[in] TokenNumber The PCD token number to set a current value for.
496 @param[in] Value The 8-bit value to set.
498 @return Return the value that was set.
504 IN UINTN TokenNumber
,
508 (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
516 This function provides a means by which to set a value for a given PCD token.
518 Sets the 16-bit value for the token specified by TokenNumber
519 to the value specified by Value. Value is returned.
521 @param[in] TokenNumber The PCD token number to set a current value for.
522 @param[in] Value The 16-bit value to set.
524 @return Return the value that was set.
530 IN UINTN TokenNumber
,
534 (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
542 This function provides a means by which to set a value for a given PCD token.
544 Sets the 32-bit value for the token specified by TokenNumber
545 to the value specified by Value. Value is returned.
547 @param[in] TokenNumber The PCD token number to set a current value for.
548 @param[in] Value The 32-bit value to set.
550 @return Return the value that was set.
556 IN UINTN TokenNumber
,
560 (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
568 This function provides a means by which to set a value for a given PCD token.
570 Sets the 64-bit value for the token specified by TokenNumber
571 to the value specified by Value. Value is returned.
573 @param[in] TokenNumber The PCD token number to set a current value for.
574 @param[in] Value The 64-bit value to set.
576 @return Return the value that was set.
582 IN UINTN TokenNumber
,
586 (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
594 This function provides a means by which to set a value for a given PCD token.
596 Sets a buffer for the token specified by TokenNumber to the value
597 specified by Buffer and SizeOfBuffer. Buffer is returned.
598 If SizeOfBuffer is greater than the maximum size support by TokenNumber,
599 then set SizeOfBuffer to the maximum size supported by TokenNumber and
600 return NULL to indicate that the set operation was not actually performed.
602 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
603 maximum size supported by TokenName and NULL must be returned.
605 If SizeOfBuffer is NULL, then ASSERT().
606 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
608 @param[in] TokenNumber The PCD token number to set a current value for.
609 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
610 @param[in] Buffer A pointer to the buffer to set.
612 @return Return the pointer for the buffer been set.
618 IN UINTN TokenNumber
,
619 IN OUT UINTN
*SizeOfBuffer
,
620 IN CONST VOID
*Buffer
624 UINTN InputSizeOfBuffer
;
626 ASSERT (SizeOfBuffer
!= NULL
);
628 if (*SizeOfBuffer
> 0) {
629 ASSERT (Buffer
!= NULL
);
632 InputSizeOfBuffer
= *SizeOfBuffer
;
633 Status
= (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
634 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
638 return (VOID
*) Buffer
;
644 This function provides a means by which to set a value for a given PCD token.
646 Sets the Boolean value for the token specified by TokenNumber
647 to the value specified by Value. Value is returned.
649 @param[in] TokenNumber The PCD token number to set a current value for.
650 @param[in] Value The boolean value to set.
652 @return Return the value that was set.
658 IN UINTN TokenNumber
,
662 (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
670 This function provides a means by which to set a value for a given PCD token.
672 Sets the 8-bit value for the token specified by TokenNumber and
673 Guid to the value specified by Value. Value is returned.
675 If Guid is NULL, then ASSERT().
677 @param[in] Guid The pointer to a 128-bit unique value that
678 designates which namespace to set a value from.
679 @param[in] TokenNumber The PCD token number to set a current value for.
680 @param[in] Value The 8-bit value to set.
682 @return Return the value that was set.
689 IN UINTN TokenNumber
,
693 ASSERT (Guid
!= NULL
);
695 (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
703 This function provides a means by which to set a value for a given PCD token.
705 Sets the 16-bit value for the token specified by TokenNumber and
706 Guid to the value specified by Value. Value is returned.
708 If Guid is NULL, then ASSERT().
710 @param[in] Guid The pointer to a 128-bit unique value that
711 designates which namespace to set a value from.
712 @param[in] TokenNumber The PCD token number to set a current value for.
713 @param[in] Value The 16-bit value to set.
715 @return Return the value that was set.
722 IN UINTN TokenNumber
,
726 ASSERT (Guid
!= NULL
);
728 (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
736 This function provides a means by which to set a value for a given PCD token.
738 Sets the 32-bit value for the token specified by TokenNumber and
739 Guid to the value specified by Value. Value is returned.
741 If Guid is NULL, then ASSERT().
743 @param[in] Guid The pointer to a 128-bit unique value that
744 designates which namespace to set a value from.
745 @param[in] TokenNumber The PCD token number to set a current value for.
746 @param[in] Value The 32-bit value to set.
748 @return Return the value that was set.
755 IN UINTN TokenNumber
,
759 ASSERT (Guid
!= NULL
);
761 (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
769 This function provides a means by which to set a value for a given PCD token.
771 Sets the 64-bit value for the token specified by TokenNumber and
772 Guid to the value specified by Value. Value is returned.
774 If Guid is NULL, then ASSERT().
776 @param[in] Guid The pointer to a 128-bit unique value that
777 designates which namespace to set a value from.
778 @param[in] TokenNumber The PCD token number to set a current value for.
779 @param[in] Value The 64-bit value to set.
781 @return Return the value that was set.
788 IN UINTN TokenNumber
,
792 ASSERT (Guid
!= NULL
);
794 (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
802 This function provides a means by which to set a value for a given PCD token.
804 Sets a buffer for the token specified by TokenNumber to the value specified by
805 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
806 the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
807 supported by TokenNumber and return NULL to indicate that the set operation
808 was not actually performed.
810 If Guid is NULL, then ASSERT().
811 If SizeOfBuffer is NULL, then ASSERT().
812 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
814 @param[in] Guid The pointer to a 128-bit unique value that
815 designates which namespace to set a value from.
816 @param[in] TokenNumber The PCD token number to set a current value for.
817 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
818 @param[in] Buffer A pointer to the buffer to set.
820 @return Return the pinter to the buffer been set.
827 IN UINTN TokenNumber
,
828 IN OUT UINTN
*SizeOfBuffer
,
833 UINTN InputSizeOfBuffer
;
835 ASSERT (SizeOfBuffer
!= NULL
);
836 if (*SizeOfBuffer
> 0) {
837 ASSERT (Buffer
!= NULL
);
839 ASSERT (Guid
!= NULL
);
841 InputSizeOfBuffer
= *SizeOfBuffer
;
842 Status
= (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
843 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
853 This function provides a means by which to set a value for a given PCD token.
855 Sets the Boolean value for the token specified by TokenNumber and
856 Guid to the value specified by Value. Value is returned.
858 If Guid is NULL, then ASSERT().
860 @param[in] Guid The pointer to a 128-bit unique value that
861 designates which namespace to set a value from.
862 @param[in] TokenNumber The PCD token number to set a current value for.
863 @param[in] Value The Boolean value to set.
865 @return Return the value that was set.
872 IN UINTN TokenNumber
,
876 ASSERT (Guid
!= NULL
);
878 (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
885 This function provides a means by which to set a value for a given PCD token.
887 Sets the 8-bit value for the token specified by TokenNumber
888 to the value specified by Value.
890 @param[in] TokenNumber The PCD token number to set a current value for.
891 @param[in] Value The 8-bit value to set.
893 @return The status of the set operation.
899 IN UINTN TokenNumber
,
903 return (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
907 This function provides a means by which to set a value for a given PCD token.
909 Sets the 16-bit value for the token specified by TokenNumber
910 to the value specified by Value.
912 @param[in] TokenNumber The PCD token number to set a current value for.
913 @param[in] Value The 16-bit value to set.
915 @return The status of the set operation.
921 IN UINTN TokenNumber
,
925 return (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
929 This function provides a means by which to set a value for a given PCD token.
931 Sets the 32-bit value for the token specified by TokenNumber
932 to the value specified by Value.
934 @param[in] TokenNumber The PCD token number to set a current value for.
935 @param[in] Value The 32-bit value to set.
937 @return The status of the set operation.
943 IN UINTN TokenNumber
,
947 return (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
951 This function provides a means by which to set a value for a given PCD token.
953 Sets the 64-bit value for the token specified by TokenNumber
954 to the value specified by Value.
956 @param[in] TokenNumber The PCD token number to set a current value for.
957 @param[in] Value The 64-bit value to set.
959 @return The status of the set operation.
965 IN UINTN TokenNumber
,
969 return (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
973 This function provides a means by which to set a value for a given PCD token.
975 Sets a buffer for the token specified by TokenNumber to the value specified
976 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
977 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
978 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
979 was not actually performed.
981 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
982 maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.
984 If SizeOfBuffer is NULL, then ASSERT().
985 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
987 @param[in] TokenNumber The PCD token number to set a current value for.
988 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
989 @param[in] Buffer A pointer to the buffer to set.
991 @return The status of the set operation.
997 IN UINTN TokenNumber
,
998 IN OUT UINTN
*SizeOfBuffer
,
999 IN CONST VOID
*Buffer
1002 ASSERT (SizeOfBuffer
!= NULL
);
1004 if (*SizeOfBuffer
> 0) {
1005 ASSERT (Buffer
!= NULL
);
1008 return (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
1012 This function provides a means by which to set a value for a given PCD token.
1014 Sets the boolean value for the token specified by TokenNumber
1015 to the value specified by Value.
1017 @param[in] TokenNumber The PCD token number to set a current value for.
1018 @param[in] Value The boolean value to set.
1020 @return The status of the set operation.
1026 IN UINTN TokenNumber
,
1030 return (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
1034 This function provides a means by which to set a value for a given PCD token.
1036 Sets the 8-bit value for the token specified by TokenNumber
1037 to the value specified by Value.
1039 If Guid is NULL, then ASSERT().
1041 @param[in] Guid The pointer to a 128-bit unique value that
1042 designates which namespace to set a value from.
1043 @param[in] TokenNumber The PCD token number to set a current value for.
1044 @param[in] Value The 8-bit value to set.
1046 @return The status of the set operation.
1052 IN CONST GUID
*Guid
,
1053 IN UINTN TokenNumber
,
1057 ASSERT (Guid
!= NULL
);
1059 return (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
1063 This function provides a means by which to set a value for a given PCD token.
1065 Sets the 16-bit value for the token specified by TokenNumber
1066 to the value specified by Value.
1068 If Guid is NULL, then ASSERT().
1070 @param[in] Guid The pointer to a 128-bit unique value that
1071 designates which namespace to set a value from.
1072 @param[in] TokenNumber The PCD token number to set a current value for.
1073 @param[in] Value The 16-bit value to set.
1075 @return The status of the set operation.
1081 IN CONST GUID
*Guid
,
1082 IN UINTN TokenNumber
,
1086 ASSERT (Guid
!= NULL
);
1088 return (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
1092 This function provides a means by which to set a value for a given PCD token.
1094 Sets the 32-bit value for the token specified by TokenNumber
1095 to the value specified by Value.
1097 If Guid is NULL, then ASSERT().
1099 @param[in] Guid The pointer to a 128-bit unique value that
1100 designates which namespace to set a value from.
1101 @param[in] TokenNumber The PCD token number to set a current value for.
1102 @param[in] Value The 32-bit value to set.
1104 @return The status of the set operation.
1110 IN CONST GUID
*Guid
,
1111 IN UINTN TokenNumber
,
1115 ASSERT (Guid
!= NULL
);
1117 return (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
1121 This function provides a means by which to set a value for a given PCD token.
1123 Sets the 64-bit value for the token specified by TokenNumber
1124 to the value specified by Value.
1126 If Guid is NULL, then ASSERT().
1128 @param[in] Guid The pointer to a 128-bit unique value that
1129 designates which namespace to set a value from.
1130 @param[in] TokenNumber The PCD token number to set a current value for.
1131 @param[in] Value The 64-bit value to set.
1133 @return The status of the set operation.
1139 IN CONST GUID
*Guid
,
1140 IN UINTN TokenNumber
,
1144 ASSERT (Guid
!= NULL
);
1146 return (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
1150 This function provides a means by which to set a value for a given PCD token.
1152 Sets a buffer for the token specified by TokenNumber to the value specified by
1153 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1154 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1155 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
1156 was not actually performed.
1158 If Guid is NULL, then ASSERT().
1159 If SizeOfBuffer is NULL, then ASSERT().
1160 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1162 @param[in] Guid Pointer to a 128-bit unique value that
1163 designates which namespace to set a value from.
1164 @param[in] TokenNumber The PCD token number to set a current value for.
1165 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1166 @param[in] Buffer A pointer to the buffer to set.
1168 @return The status of the set operation.
1174 IN CONST GUID
*Guid
,
1175 IN UINTN TokenNumber
,
1176 IN OUT UINTN
*SizeOfBuffer
,
1180 ASSERT (Guid
!= NULL
);
1182 ASSERT (SizeOfBuffer
!= NULL
);
1184 if (*SizeOfBuffer
> 0) {
1185 ASSERT (Buffer
!= NULL
);
1188 return (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
1192 This function provides a means by which to set a value for a given PCD token.
1194 Sets the boolean value for the token specified by TokenNumber
1195 to the value specified by Value.
1197 If Guid is NULL, then ASSERT().
1199 @param[in] Guid The pointer to a 128-bit unique value that
1200 designates which namespace to set a value from.
1201 @param[in] TokenNumber The PCD token number to set a current value for.
1202 @param[in] Value The boolean value to set.
1204 @return The status of the set operation.
1210 IN CONST GUID
*Guid
,
1211 IN UINTN TokenNumber
,
1215 ASSERT (Guid
!= NULL
);
1217 return (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
1221 Set up a notification function that is called when a specified token is set.
1223 When the token specified by TokenNumber and Guid is set,
1224 then notification function specified by NotificationFunction is called.
1225 If Guid is NULL, then the default token space is used.
1226 If NotificationFunction is NULL, then ASSERT().
1228 @param[in] Guid The pointer to a 128-bit unique value that
1229 designates which namespace to set a value from.
1230 If NULL, then the default token space is used.
1231 @param[in] TokenNumber The PCD token number to monitor.
1232 @param[in] NotificationFunction The function to call when the token
1233 specified by Guid and TokenNumber is set.
1238 LibPcdCallbackOnSet (
1239 IN CONST GUID
*Guid
, OPTIONAL
1240 IN UINTN TokenNumber
,
1241 IN PCD_CALLBACK NotificationFunction
1246 ASSERT (NotificationFunction
!= NULL
);
1248 Status
= (GetPiPcdPpiPointer ())->CallbackOnSet (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
1250 ASSERT_EFI_ERROR (Status
);
1258 Disable a notification function that was established with LibPcdCallbackonSet().
1260 Disable a notification function that was previously established with LibPcdCallbackOnSet().
1261 If NotificationFunction is NULL, then ASSERT().
1262 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1263 and NotificationFunction, then ASSERT().
1265 @param[in] Guid Specify the GUID token space.
1266 @param[in] TokenNumber Specify the token number.
1267 @param[in] NotificationFunction The callback function to be unregistered.
1272 LibPcdCancelCallback (
1273 IN CONST GUID
*Guid
, OPTIONAL
1274 IN UINTN TokenNumber
,
1275 IN PCD_CALLBACK NotificationFunction
1280 ASSERT (NotificationFunction
!= NULL
);
1282 Status
= (GetPiPcdPpiPointer ())->CancelCallback (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
1284 ASSERT_EFI_ERROR (Status
);
1292 Retrieves the next token in a token space.
1294 Retrieves the next PCD token number from the token space specified by Guid.
1295 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
1296 then the first token number is returned. Otherwise, the token number that
1297 follows TokenNumber in the token space is returned. If TokenNumber is the last
1298 token number in the token space, then 0 is returned.
1300 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1302 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
1303 to set a value from. If NULL, then the default token space is used.
1304 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
1307 @return The next valid token number.
1312 LibPcdGetNextToken (
1313 IN CONST GUID
*Guid
, OPTIONAL
1314 IN UINTN TokenNumber
1319 Status
= (GetPiPcdPpiPointer ())->GetNextToken (Guid
, &TokenNumber
);
1320 ASSERT (!EFI_ERROR (Status
) || TokenNumber
== 0);
1327 Used to retrieve the list of available PCD token space GUIDs.
1329 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1331 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1332 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1334 @param TokenSpaceGuid The pointer to the a PCD token space GUID
1336 @return The next valid token namespace.
1341 LibPcdGetNextTokenSpace (
1342 IN CONST GUID
*TokenSpaceGuid
1345 (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid
);
1347 return (GUID
*) TokenSpaceGuid
;
1353 Sets a value of a patchable PCD entry that is type pointer.
1355 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1356 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1357 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1358 NULL to indicate that the set operation was not actually performed.
1359 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1360 MaximumDatumSize and NULL must be returned.
1362 If PatchVariable is NULL, then ASSERT().
1363 If SizeOfBuffer is NULL, then ASSERT().
1364 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1366 @param[out] PatchVariable A pointer to the global variable in a module that is
1367 the target of the set operation.
1368 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1369 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1370 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1372 @return Return the pointer to the buffer been set.
1378 OUT VOID
*PatchVariable
,
1379 IN UINTN MaximumDatumSize
,
1380 IN OUT UINTN
*SizeOfBuffer
,
1381 IN CONST VOID
*Buffer
1384 ASSERT (PatchVariable
!= NULL
);
1385 ASSERT (SizeOfBuffer
!= NULL
);
1387 if (*SizeOfBuffer
> 0) {
1388 ASSERT (Buffer
!= NULL
);
1391 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1392 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1393 *SizeOfBuffer
= MaximumDatumSize
;
1397 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1399 return (VOID
*) Buffer
;
1403 Sets a value of a patchable PCD entry that is type pointer.
1405 Sets the PCD entry specified by PatchVariable to the value specified
1406 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1407 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1408 to indicate that the set operation was not actually performed.
1409 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1410 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1412 If PatchVariable is NULL, then ASSERT().
1413 If SizeOfBuffer is NULL, then ASSERT().
1414 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1416 @param[out] PatchVariable A pointer to the global variable in a module that is
1417 the target of the set operation.
1418 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1419 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1420 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1422 @return The status of the set operation.
1427 LibPatchPcdSetPtrS (
1428 OUT VOID
*PatchVariable
,
1429 IN UINTN MaximumDatumSize
,
1430 IN OUT UINTN
*SizeOfBuffer
,
1431 IN CONST VOID
*Buffer
1434 ASSERT (PatchVariable
!= NULL
);
1435 ASSERT (SizeOfBuffer
!= NULL
);
1437 if (*SizeOfBuffer
> 0) {
1438 ASSERT (Buffer
!= NULL
);
1441 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1442 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1443 *SizeOfBuffer
= MaximumDatumSize
;
1444 return RETURN_INVALID_PARAMETER
;
1447 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1449 return RETURN_SUCCESS
;
1454 Sets a value and size of a patchable PCD entry that is type pointer.
1456 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1457 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1458 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1459 NULL to indicate that the set operation was not actually performed.
1460 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1461 MaximumDatumSize and NULL must be returned.
1463 If PatchVariable is NULL, then ASSERT().
1464 If SizeOfPatchVariable is NULL, then ASSERT().
1465 If SizeOfBuffer is NULL, then ASSERT().
1466 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1468 @param[out] PatchVariable A pointer to the global variable in a module that is
1469 the target of the set operation.
1470 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1471 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1472 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1473 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1475 @return Return the pointer to the buffer been set.
1480 LibPatchPcdSetPtrAndSize (
1481 OUT VOID
*PatchVariable
,
1482 OUT UINTN
*SizeOfPatchVariable
,
1483 IN UINTN MaximumDatumSize
,
1484 IN OUT UINTN
*SizeOfBuffer
,
1485 IN CONST VOID
*Buffer
1488 ASSERT (PatchVariable
!= NULL
);
1489 ASSERT (SizeOfPatchVariable
!= NULL
);
1490 ASSERT (SizeOfBuffer
!= NULL
);
1492 if (*SizeOfBuffer
> 0) {
1493 ASSERT (Buffer
!= NULL
);
1496 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1497 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1498 *SizeOfBuffer
= MaximumDatumSize
;
1502 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1503 *SizeOfPatchVariable
= *SizeOfBuffer
;
1505 return (VOID
*) Buffer
;
1509 Sets a value and size of a patchable PCD entry that is type pointer.
1511 Sets the PCD entry specified by PatchVariable to the value specified
1512 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1513 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1514 to indicate that the set operation was not actually performed.
1515 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1516 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1518 If PatchVariable is NULL, then ASSERT().
1519 If SizeOfPatchVariable is NULL, then ASSERT().
1520 If SizeOfBuffer is NULL, then ASSERT().
1521 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1523 @param[out] PatchVariable A pointer to the global variable in a module that is
1524 the target of the set operation.
1525 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1526 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1527 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1528 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1530 @return The status of the set operation.
1535 LibPatchPcdSetPtrAndSizeS (
1536 OUT VOID
*PatchVariable
,
1537 OUT UINTN
*SizeOfPatchVariable
,
1538 IN UINTN MaximumDatumSize
,
1539 IN OUT UINTN
*SizeOfBuffer
,
1540 IN CONST VOID
*Buffer
1543 ASSERT (PatchVariable
!= NULL
);
1544 ASSERT (SizeOfPatchVariable
!= NULL
);
1545 ASSERT (SizeOfBuffer
!= NULL
);
1547 if (*SizeOfBuffer
> 0) {
1548 ASSERT (Buffer
!= NULL
);
1551 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1552 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1553 *SizeOfBuffer
= MaximumDatumSize
;
1554 return RETURN_INVALID_PARAMETER
;
1557 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1558 *SizeOfPatchVariable
= *SizeOfBuffer
;
1560 return RETURN_SUCCESS
;
1564 Retrieve additional information associated with a PCD token.
1566 This includes information such as the type of value the TokenNumber is associated with as well as possible
1567 human readable name that is associated with the token.
1569 If TokenNumber is not in the default token space specified, then ASSERT().
1571 @param[in] TokenNumber The PCD token number.
1572 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1573 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1578 IN UINTN TokenNumber
,
1579 OUT PCD_INFO
*PcdInfo
1584 Status
= GetPcdInfoPpiPointer()->GetInfo (TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1585 ASSERT_EFI_ERROR (Status
);
1589 Retrieve additional information associated with a PCD token.
1591 This includes information such as the type of value the TokenNumber is associated with as well as possible
1592 human readable name that is associated with the token.
1594 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1596 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1597 @param[in] TokenNumber The PCD token number.
1598 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1599 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1604 IN CONST GUID
*Guid
,
1605 IN UINTN TokenNumber
,
1606 OUT PCD_INFO
*PcdInfo
1611 Status
= GetPiPcdInfoPpiPointer()->GetInfo (Guid
, TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1612 ASSERT_EFI_ERROR (Status
);
1616 Retrieve the currently set SKU Id.
1618 If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
1620 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1621 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1632 SkuId
= GetPiPcdInfoPpiPointer()->GetSku ();
1633 ASSERT (SkuId
< PCD_MAX_SKU_ID
);