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 This function provides a means by which to set a value for a given PCD token.
480 Sets the 8-bit value for the token specified by TokenNumber
481 to the value specified by Value.
483 @param[in] TokenNumber The PCD token number to set a current value for.
484 @param[in] Value The 8-bit value to set.
486 @return The status of the set operation.
492 IN UINTN TokenNumber
,
496 return (GetPcdPpiPointer ())->Set8 (TokenNumber
, Value
);
500 This function provides a means by which to set a value for a given PCD token.
502 Sets the 16-bit value for the token specified by TokenNumber
503 to the value specified by Value.
505 @param[in] TokenNumber The PCD token number to set a current value for.
506 @param[in] Value The 16-bit value to set.
508 @return The status of the set operation.
514 IN UINTN TokenNumber
,
518 return (GetPcdPpiPointer ())->Set16 (TokenNumber
, Value
);
522 This function provides a means by which to set a value for a given PCD token.
524 Sets the 32-bit value for the token specified by TokenNumber
525 to the value specified by Value.
527 @param[in] TokenNumber The PCD token number to set a current value for.
528 @param[in] Value The 32-bit value to set.
530 @return The status of the set operation.
536 IN UINTN TokenNumber
,
540 return (GetPcdPpiPointer ())->Set32 (TokenNumber
, Value
);
544 This function provides a means by which to set a value for a given PCD token.
546 Sets the 64-bit value for the token specified by TokenNumber
547 to the value specified by Value.
549 @param[in] TokenNumber The PCD token number to set a current value for.
550 @param[in] Value The 64-bit value to set.
552 @return The status of the set operation.
558 IN UINTN TokenNumber
,
562 return (GetPcdPpiPointer ())->Set64 (TokenNumber
, Value
);
566 This function provides a means by which to set a value for a given PCD token.
568 Sets a buffer for the token specified by TokenNumber to the value specified
569 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
570 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
571 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
572 was not actually performed.
574 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
575 maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.
577 If SizeOfBuffer is NULL, then ASSERT().
578 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
580 @param[in] TokenNumber The PCD token number to set a current value for.
581 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
582 @param[in] Buffer A pointer to the buffer to set.
584 @return The status of the set operation.
590 IN UINTN TokenNumber
,
591 IN OUT UINTN
*SizeOfBuffer
,
592 IN CONST VOID
*Buffer
595 ASSERT (SizeOfBuffer
!= NULL
);
597 if (*SizeOfBuffer
> 0) {
598 ASSERT (Buffer
!= NULL
);
601 return (GetPcdPpiPointer ())->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
605 This function provides a means by which to set a value for a given PCD token.
607 Sets the boolean value for the token specified by TokenNumber
608 to the value specified by Value.
610 @param[in] TokenNumber The PCD token number to set a current value for.
611 @param[in] Value The boolean value to set.
613 @return The status of the set operation.
619 IN UINTN TokenNumber
,
623 return (GetPcdPpiPointer ())->SetBool (TokenNumber
, Value
);
627 This function provides a means by which to set a value for a given PCD token.
629 Sets the 8-bit value for the token specified by TokenNumber
630 to the value specified by Value.
632 If Guid is NULL, then ASSERT().
634 @param[in] Guid The pointer to a 128-bit unique value that
635 designates which namespace to set a value from.
636 @param[in] TokenNumber The PCD token number to set a current value for.
637 @param[in] Value The 8-bit value to set.
639 @return The status of the set operation.
646 IN UINTN TokenNumber
,
650 ASSERT (Guid
!= NULL
);
652 return (GetPiPcdPpiPointer ())->Set8 (Guid
, TokenNumber
, Value
);
656 This function provides a means by which to set a value for a given PCD token.
658 Sets the 16-bit value for the token specified by TokenNumber
659 to the value specified by Value.
661 If Guid is NULL, then ASSERT().
663 @param[in] Guid The pointer to a 128-bit unique value that
664 designates which namespace to set a value from.
665 @param[in] TokenNumber The PCD token number to set a current value for.
666 @param[in] Value The 16-bit value to set.
668 @return The status of the set operation.
675 IN UINTN TokenNumber
,
679 ASSERT (Guid
!= NULL
);
681 return (GetPiPcdPpiPointer ())->Set16 (Guid
, TokenNumber
, Value
);
685 This function provides a means by which to set a value for a given PCD token.
687 Sets the 32-bit value for the token specified by TokenNumber
688 to the value specified by Value.
690 If Guid is NULL, then ASSERT().
692 @param[in] Guid The pointer to a 128-bit unique value that
693 designates which namespace to set a value from.
694 @param[in] TokenNumber The PCD token number to set a current value for.
695 @param[in] Value The 32-bit value to set.
697 @return The status of the set operation.
704 IN UINTN TokenNumber
,
708 ASSERT (Guid
!= NULL
);
710 return (GetPiPcdPpiPointer ())->Set32 (Guid
, TokenNumber
, Value
);
714 This function provides a means by which to set a value for a given PCD token.
716 Sets the 64-bit value for the token specified by TokenNumber
717 to the value specified by Value.
719 If Guid is NULL, then ASSERT().
721 @param[in] Guid The pointer to a 128-bit unique value that
722 designates which namespace to set a value from.
723 @param[in] TokenNumber The PCD token number to set a current value for.
724 @param[in] Value The 64-bit value to set.
726 @return The status of the set operation.
733 IN UINTN TokenNumber
,
737 ASSERT (Guid
!= NULL
);
739 return (GetPiPcdPpiPointer ())->Set64 (Guid
, TokenNumber
, Value
);
743 This function provides a means by which to set a value for a given PCD token.
745 Sets a buffer for the token specified by TokenNumber to the value specified by
746 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
747 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
748 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
749 was not actually performed.
751 If Guid is NULL, then ASSERT().
752 If SizeOfBuffer is NULL, then ASSERT().
753 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
755 @param[in] Guid Pointer to a 128-bit unique value that
756 designates which namespace to set a value from.
757 @param[in] TokenNumber The PCD token number to set a current value for.
758 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
759 @param[in] Buffer A pointer to the buffer to set.
761 @return The status of the set operation.
768 IN UINTN TokenNumber
,
769 IN OUT UINTN
*SizeOfBuffer
,
773 ASSERT (Guid
!= NULL
);
775 ASSERT (SizeOfBuffer
!= NULL
);
777 if (*SizeOfBuffer
> 0) {
778 ASSERT (Buffer
!= NULL
);
781 return (GetPiPcdPpiPointer ())->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
785 This function provides a means by which to set a value for a given PCD token.
787 Sets the boolean value for the token specified by TokenNumber
788 to the value specified by Value.
790 If Guid is NULL, then ASSERT().
792 @param[in] Guid The pointer to a 128-bit unique value that
793 designates which namespace to set a value from.
794 @param[in] TokenNumber The PCD token number to set a current value for.
795 @param[in] Value The boolean value to set.
797 @return The status of the set operation.
804 IN UINTN TokenNumber
,
808 ASSERT (Guid
!= NULL
);
810 return (GetPiPcdPpiPointer ())->SetBool (Guid
, TokenNumber
, Value
);
814 Set up a notification function that is called when a specified token is set.
816 When the token specified by TokenNumber and Guid is set,
817 then notification function specified by NotificationFunction is called.
818 If Guid is NULL, then the default token space is used.
819 If NotificationFunction is NULL, then ASSERT().
821 @param[in] Guid The pointer to a 128-bit unique value that
822 designates which namespace to set a value from.
823 If NULL, then the default token space is used.
824 @param[in] TokenNumber The PCD token number to monitor.
825 @param[in] NotificationFunction The function to call when the token
826 specified by Guid and TokenNumber is set.
831 LibPcdCallbackOnSet (
832 IN CONST GUID
*Guid OPTIONAL
,
833 IN UINTN TokenNumber
,
834 IN PCD_CALLBACK NotificationFunction
839 ASSERT (NotificationFunction
!= NULL
);
841 Status
= (GetPiPcdPpiPointer ())->CallbackOnSet (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
843 ASSERT_EFI_ERROR (Status
);
851 Disable a notification function that was established with LibPcdCallbackonSet().
853 Disable a notification function that was previously established with LibPcdCallbackOnSet().
854 If NotificationFunction is NULL, then ASSERT().
855 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
856 and NotificationFunction, then ASSERT().
858 @param[in] Guid Specify the GUID token space.
859 @param[in] TokenNumber Specify the token number.
860 @param[in] NotificationFunction The callback function to be unregistered.
865 LibPcdCancelCallback (
866 IN CONST GUID
*Guid OPTIONAL
,
867 IN UINTN TokenNumber
,
868 IN PCD_CALLBACK NotificationFunction
873 ASSERT (NotificationFunction
!= NULL
);
875 Status
= (GetPiPcdPpiPointer ())->CancelCallback (Guid
, TokenNumber
, (EFI_PEI_PCD_PPI_CALLBACK
) NotificationFunction
);
877 ASSERT_EFI_ERROR (Status
);
885 Retrieves the next token in a token space.
887 Retrieves the next PCD token number from the token space specified by Guid.
888 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
889 then the first token number is returned. Otherwise, the token number that
890 follows TokenNumber in the token space is returned. If TokenNumber is the last
891 token number in the token space, then 0 is returned.
893 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
895 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
896 to set a value from. If NULL, then the default token space is used.
897 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
900 @return The next valid token number.
906 IN CONST GUID
*Guid OPTIONAL
,
912 Status
= (GetPiPcdPpiPointer ())->GetNextToken (Guid
, &TokenNumber
);
913 ASSERT (!EFI_ERROR (Status
) || TokenNumber
== 0);
920 Used to retrieve the list of available PCD token space GUIDs.
922 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
924 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
925 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
927 @param TokenSpaceGuid The pointer to the a PCD token space GUID
929 @return The next valid token namespace.
934 LibPcdGetNextTokenSpace (
935 IN CONST GUID
*TokenSpaceGuid
938 (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid
);
940 return (GUID
*) TokenSpaceGuid
;
946 Sets a value of a patchable PCD entry that is type pointer.
948 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
949 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
950 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
951 NULL to indicate that the set operation was not actually performed.
952 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
953 MaximumDatumSize and NULL must be returned.
955 If PatchVariable is NULL, then ASSERT().
956 If SizeOfBuffer is NULL, then ASSERT().
957 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
959 @param[out] PatchVariable A pointer to the global variable in a module that is
960 the target of the set operation.
961 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
962 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
963 @param[in] Buffer A pointer to the buffer to used to set the target variable.
965 @return Return the pointer to the buffer been set.
971 OUT VOID
*PatchVariable
,
972 IN UINTN MaximumDatumSize
,
973 IN OUT UINTN
*SizeOfBuffer
,
974 IN CONST VOID
*Buffer
977 ASSERT (PatchVariable
!= NULL
);
978 ASSERT (SizeOfBuffer
!= NULL
);
980 if (*SizeOfBuffer
> 0) {
981 ASSERT (Buffer
!= NULL
);
984 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
985 (*SizeOfBuffer
== MAX_ADDRESS
)) {
986 *SizeOfBuffer
= MaximumDatumSize
;
990 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
992 return (VOID
*) Buffer
;
996 Sets a value of a patchable PCD entry that is type pointer.
998 Sets the PCD entry specified by PatchVariable to the value specified
999 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1000 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1001 to indicate that the set operation was not actually performed.
1002 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1003 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1005 If PatchVariable is NULL, then ASSERT().
1006 If SizeOfBuffer is NULL, then ASSERT().
1007 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1009 @param[out] PatchVariable A pointer to the global variable in a module that is
1010 the target of the set operation.
1011 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1012 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1013 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1015 @return The status of the set operation.
1020 LibPatchPcdSetPtrS (
1021 OUT VOID
*PatchVariable
,
1022 IN UINTN MaximumDatumSize
,
1023 IN OUT UINTN
*SizeOfBuffer
,
1024 IN CONST VOID
*Buffer
1027 ASSERT (PatchVariable
!= NULL
);
1028 ASSERT (SizeOfBuffer
!= NULL
);
1030 if (*SizeOfBuffer
> 0) {
1031 ASSERT (Buffer
!= NULL
);
1034 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1035 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1036 *SizeOfBuffer
= MaximumDatumSize
;
1037 return RETURN_INVALID_PARAMETER
;
1040 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1042 return RETURN_SUCCESS
;
1047 Sets a value and size of a patchable PCD entry that is type pointer.
1049 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1050 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1051 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1052 NULL to indicate that the set operation was not actually performed.
1053 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1054 MaximumDatumSize and NULL must be returned.
1056 If PatchVariable is NULL, then ASSERT().
1057 If SizeOfPatchVariable is NULL, then ASSERT().
1058 If SizeOfBuffer is NULL, then ASSERT().
1059 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1061 @param[out] PatchVariable A pointer to the global variable in a module that is
1062 the target of the set operation.
1063 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1064 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1065 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1066 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1068 @return Return the pointer to the buffer been set.
1073 LibPatchPcdSetPtrAndSize (
1074 OUT VOID
*PatchVariable
,
1075 OUT UINTN
*SizeOfPatchVariable
,
1076 IN UINTN MaximumDatumSize
,
1077 IN OUT UINTN
*SizeOfBuffer
,
1078 IN CONST VOID
*Buffer
1081 ASSERT (PatchVariable
!= NULL
);
1082 ASSERT (SizeOfPatchVariable
!= NULL
);
1083 ASSERT (SizeOfBuffer
!= NULL
);
1085 if (*SizeOfBuffer
> 0) {
1086 ASSERT (Buffer
!= NULL
);
1089 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1090 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1091 *SizeOfBuffer
= MaximumDatumSize
;
1095 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1096 *SizeOfPatchVariable
= *SizeOfBuffer
;
1098 return (VOID
*) Buffer
;
1102 Sets a value and size of a patchable PCD entry that is type pointer.
1104 Sets the PCD entry specified by PatchVariable to the value specified
1105 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1106 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1107 to indicate that the set operation was not actually performed.
1108 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1109 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1111 If PatchVariable is NULL, then ASSERT().
1112 If SizeOfPatchVariable is NULL, then ASSERT().
1113 If SizeOfBuffer is NULL, then ASSERT().
1114 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1116 @param[out] PatchVariable A pointer to the global variable in a module that is
1117 the target of the set operation.
1118 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1119 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1120 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1121 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1123 @return The status of the set operation.
1128 LibPatchPcdSetPtrAndSizeS (
1129 OUT VOID
*PatchVariable
,
1130 OUT UINTN
*SizeOfPatchVariable
,
1131 IN UINTN MaximumDatumSize
,
1132 IN OUT UINTN
*SizeOfBuffer
,
1133 IN CONST VOID
*Buffer
1136 ASSERT (PatchVariable
!= NULL
);
1137 ASSERT (SizeOfPatchVariable
!= NULL
);
1138 ASSERT (SizeOfBuffer
!= NULL
);
1140 if (*SizeOfBuffer
> 0) {
1141 ASSERT (Buffer
!= NULL
);
1144 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1145 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1146 *SizeOfBuffer
= MaximumDatumSize
;
1147 return RETURN_INVALID_PARAMETER
;
1150 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1151 *SizeOfPatchVariable
= *SizeOfBuffer
;
1153 return RETURN_SUCCESS
;
1157 Retrieve additional information associated with a PCD token.
1159 This includes information such as the type of value the TokenNumber is associated with as well as possible
1160 human readable name that is associated with the token.
1162 If TokenNumber is not in the default token space specified, then ASSERT().
1164 @param[in] TokenNumber The PCD token number.
1165 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1166 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1171 IN UINTN TokenNumber
,
1172 OUT PCD_INFO
*PcdInfo
1177 Status
= GetPcdInfoPpiPointer()->GetInfo (TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1178 ASSERT_EFI_ERROR (Status
);
1182 Retrieve additional information associated with a PCD token.
1184 This includes information such as the type of value the TokenNumber is associated with as well as possible
1185 human readable name that is associated with the token.
1187 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1189 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1190 @param[in] TokenNumber The PCD token number.
1191 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1192 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1197 IN CONST GUID
*Guid
,
1198 IN UINTN TokenNumber
,
1199 OUT PCD_INFO
*PcdInfo
1204 Status
= GetPiPcdInfoPpiPointer()->GetInfo (Guid
, TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1205 ASSERT_EFI_ERROR (Status
);
1209 Retrieve the currently set SKU Id.
1211 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1212 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1221 return GetPiPcdInfoPpiPointer()->GetSku ();