2 Implementation of PcdLib class library for DXE phase.
4 Copyright (c) 2006 - 2014, 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.
19 #include <Protocol/Pcd.h>
20 #include <Protocol/PiPcd.h>
21 #include <Protocol/PcdInfo.h>
22 #include <Protocol/PiPcdInfo.h>
24 #include <Library/PcdLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/UefiBootServicesTableLib.h>
27 #include <Library/BaseMemoryLib.h>
29 PCD_PROTOCOL
*mPcd
= NULL
;
30 EFI_PCD_PROTOCOL
*mPiPcd
= NULL
;
31 GET_PCD_INFO_PROTOCOL
*mPcdInfo
= NULL
;
32 EFI_GET_PCD_INFO_PROTOCOL
*mPiPcdInfo
= NULL
;
35 Retrieves the PI PCD protocol from the handle database.
37 @retval EFI_PCD_PROTOCOL * The pointer to the EFI_PCD_PROTOCOL.
49 // PI Pcd protocol defined in PI 1.2 vol3 should be installed before the module
50 // access DynamicEx type PCD.
52 Status
= gBS
->LocateProtocol (&gEfiPcdProtocolGuid
, NULL
, (VOID
**) &mPiPcd
);
53 ASSERT_EFI_ERROR (Status
);
54 ASSERT (mPiPcd
!= NULL
);
60 Retrieves the PCD protocol from the handle database.
62 @retval PCD_PROTOCOL * The pointer to the PCD_PROTOCOL.
74 // PCD protocol need to be installed before the module access Dynamic type PCD.
75 // But dynamic type PCD is not required in PI 1.2 specification.
77 Status
= gBS
->LocateProtocol (&gPcdProtocolGuid
, NULL
, (VOID
**)&mPcd
);
78 ASSERT_EFI_ERROR (Status
);
79 ASSERT (mPcd
!= NULL
);
85 Retrieves the PI PCD info protocol from the handle database.
87 @retval EFI_GET_PCD_INFO_PROTOCOL * The pointer to the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 Vol 3.
89 EFI_GET_PCD_INFO_PROTOCOL
*
90 GetPiPcdInfoProtocolPointer (
96 if (mPiPcdInfo
== NULL
) {
97 Status
= gBS
->LocateProtocol (&gEfiGetPcdInfoProtocolGuid
, NULL
, (VOID
**)&mPiPcdInfo
);
98 ASSERT_EFI_ERROR (Status
);
99 ASSERT (mPiPcdInfo
!= NULL
);
105 Retrieves the PCD info protocol from the handle database.
107 @retval GET_PCD_INFO_PROTOCOL * The pointer to the GET_PCD_INFO_PROTOCOL.
109 GET_PCD_INFO_PROTOCOL
*
110 GetPcdInfoProtocolPointer (
116 if (mPcdInfo
== NULL
) {
117 Status
= gBS
->LocateProtocol (&gGetPcdInfoProtocolGuid
, NULL
, (VOID
**)&mPcdInfo
);
118 ASSERT_EFI_ERROR (Status
);
119 ASSERT (mPcdInfo
!= NULL
);
125 This function provides a means by which SKU support can be established in the PCD infrastructure.
127 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
128 If SkuId >= PCD_MAX_SKU_ID, then ASSERT().
130 @param SkuId The SKU value that will be used when the PCD service retrieves and sets values
131 associated with a PCD token.
133 @return Return the SKU ID that just be set.
142 ASSERT (SkuId
< PCD_MAX_SKU_ID
);
144 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPcdProtocol()->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 GetPiPcdProtocol()->Get8 (Guid
, TokenNumber
);
324 This function provides a means by which to retrieve a value for a given PCD token.
326 Returns the 16-bit value for the token specified by TokenNumber and Guid.
328 If Guid is NULL, then ASSERT().
330 @param[in] Guid The pointer to a 128-bit unique value that designates
331 which namespace to retrieve a value from.
332 @param[in] TokenNumber The PCD token number to retrieve a current value for.
334 @return Return the UINT16.
344 ASSERT (Guid
!= NULL
);
346 return GetPiPcdProtocol()->Get16 (Guid
, TokenNumber
);
351 Returns the 32-bit value for the token specified by TokenNumber and Guid.
352 If Guid is NULL, then ASSERT().
354 @param[in] Guid The pointer to a 128-bit unique value that designates
355 which namespace to retrieve a value from.
356 @param[in] TokenNumber The PCD token number to retrieve a current value for.
358 @return Return the UINT32.
368 ASSERT (Guid
!= NULL
);
370 return GetPiPcdProtocol()->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
);
398 return GetPiPcdProtocol()->Get64 (Guid
, TokenNumber
);
404 This function provides a means by which to retrieve a value for a given PCD token.
406 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
408 If Guid is NULL, then ASSERT().
410 @param[in] Guid The pointer to a 128-bit unique value that designates
411 which namespace to retrieve a value from.
412 @param[in] TokenNumber The PCD token number to retrieve a current value for.
414 @return Return the VOID* pointer.
424 ASSERT (Guid
!= NULL
);
426 return GetPiPcdProtocol()->GetPtr (Guid
, TokenNumber
);
432 This function provides a means by which to retrieve a value for a given PCD token.
434 Returns the Boolean value of the token specified by TokenNumber and Guid.
436 If Guid is NULL, then ASSERT().
438 @param[in] Guid The pointer to a 128-bit unique value that designates
439 which namespace to retrieve a value from.
440 @param[in] TokenNumber The PCD token number to retrieve a current value for.
442 @return Return the BOOLEAN.
452 ASSERT (Guid
!= NULL
);
454 return GetPiPcdProtocol()->GetBool (Guid
, TokenNumber
);
460 This function provides a means by which to retrieve the size of a given PCD token.
462 Returns the size of the token specified by TokenNumber and Guid.
464 If Guid is NULL, then ASSERT().
466 @param[in] Guid The pointer to a 128-bit unique value that designates
467 which namespace to retrieve a value from.
468 @param[in] TokenNumber The PCD token number to retrieve a current value for.
470 @return Return the size.
480 ASSERT (Guid
!= NULL
);
482 return GetPiPcdProtocol()->GetSize (Guid
, TokenNumber
);
488 This function provides a means by which to set a value for a given PCD token.
490 Sets the 8-bit value for the token specified by TokenNumber
491 to the value specified by Value. Value is returned.
493 If the set operation was not correctly performed, then ASSERT().
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
,
510 Status
= GetPcdProtocol()->Set8 (TokenNumber
, Value
);
511 ASSERT_EFI_ERROR (Status
);
519 This function provides a means by which to set a value for a given PCD token.
521 Sets the 16-bit value for the token specified by TokenNumber
522 to the value specified by Value. Value is returned.
524 If the set operation was not correctly performed, then ASSERT().
526 @param[in] TokenNumber The PCD token number to set a current value for.
527 @param[in] Value The 16-bit value to set.
529 @return Return the value that was set.
535 IN UINTN TokenNumber
,
541 Status
= GetPcdProtocol()->Set16 (TokenNumber
, Value
);
542 ASSERT_EFI_ERROR (Status
);
550 This function provides a means by which to set a value for a given PCD token.
552 Sets the 32-bit value for the token specified by TokenNumber
553 to the value specified by Value. Value is returned.
555 If the set operation was not correctly performed, then ASSERT().
557 @param[in] TokenNumber The PCD token number to set a current value for.
558 @param[in] Value The 32-bit value to set.
560 @return Return the value that was set.
566 IN UINTN TokenNumber
,
572 Status
= GetPcdProtocol()->Set32 (TokenNumber
, Value
);
573 ASSERT_EFI_ERROR (Status
);
581 This function provides a means by which to set a value for a given PCD token.
583 Sets the 64-bit value for the token specified by TokenNumber
584 to the value specified by Value. Value is returned.
586 If the set operation was not correctly performed, then ASSERT().
588 @param[in] TokenNumber The PCD token number to set a current value for.
589 @param[in] Value The 64-bit value to set.
591 @return Return the value that was set.
597 IN UINTN TokenNumber
,
603 Status
= GetPcdProtocol()->Set64 (TokenNumber
, Value
);
604 ASSERT_EFI_ERROR (Status
);
612 This function provides a means by which to set a value for a given PCD token.
614 Sets a buffer for the token specified by TokenNumber to the value
615 specified by Buffer and SizeOfBuffer. Buffer is returned.
616 If SizeOfBuffer is greater than the maximum size support by TokenNumber,
617 then set SizeOfBuffer to the maximum size supported by TokenNumber and
618 return NULL to indicate that the set operation was not actually performed,
619 or ASSERT() if the set operation was not correctly performed.
621 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
622 maximum size supported by TokenName and NULL must be returned.
624 If SizeOfBuffer is NULL, then ASSERT().
625 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
627 @param[in] TokenNumber The PCD token number to set a current value for.
628 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
629 @param[in] Buffer A pointer to the buffer to set.
631 @return Return the pointer for the buffer been set.
637 IN UINTN TokenNumber
,
638 IN OUT UINTN
*SizeOfBuffer
,
639 IN CONST VOID
*Buffer
643 UINTN InputSizeOfBuffer
;
645 ASSERT (SizeOfBuffer
!= NULL
);
647 if (*SizeOfBuffer
> 0) {
648 ASSERT (Buffer
!= NULL
);
651 InputSizeOfBuffer
= *SizeOfBuffer
;
652 Status
= GetPcdProtocol()->SetPtr (TokenNumber
, SizeOfBuffer
, (VOID
*) Buffer
);
653 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
656 ASSERT_EFI_ERROR (Status
);
658 return (VOID
*)Buffer
;
664 This function provides a means by which to set a value for a given PCD token.
666 Sets the Boolean value for the token specified by TokenNumber
667 to the value specified by Value. Value is returned.
669 If the set operation was not correctly performed, then ASSERT().
671 @param[in] TokenNumber The PCD token number to set a current value for.
672 @param[in] Value The boolean value to set.
674 @return Return the value that was set.
680 IN UINTN TokenNumber
,
686 Status
= GetPcdProtocol()->SetBool (TokenNumber
, Value
);
687 ASSERT_EFI_ERROR (Status
);
695 This function provides a means by which to set a value for a given PCD token.
697 Sets the 8-bit value for the token specified by TokenNumber and
698 Guid to the value specified by Value. Value is returned.
700 If Guid is NULL, then ASSERT().
701 If the set operation was not correctly performed, then ASSERT().
703 @param[in] Guid The pointer to a 128-bit unique value that
704 designates which namespace to set a value from.
705 @param[in] TokenNumber The PCD token number to set a current value for.
706 @param[in] Value The 8-bit value to set.
708 @return Return the value that was set.
715 IN UINTN TokenNumber
,
721 ASSERT (Guid
!= NULL
);
723 Status
= GetPiPcdProtocol()->Set8 (Guid
, TokenNumber
, Value
);
724 ASSERT_EFI_ERROR (Status
);
732 This function provides a means by which to set a value for a given PCD token.
734 Sets the 16-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().
738 If the set operation was not correctly performed, then ASSERT().
740 @param[in] Guid The pointer to a 128-bit unique value that
741 designates which namespace to set a value from.
742 @param[in] TokenNumber The PCD token number to set a current value for.
743 @param[in] Value The 16-bit value to set.
745 @return Return the value that was set.
752 IN UINTN TokenNumber
,
758 ASSERT (Guid
!= NULL
);
760 Status
= GetPiPcdProtocol()->Set16 (Guid
, TokenNumber
, Value
);
761 ASSERT_EFI_ERROR (Status
);
769 This function provides a means by which to set a value for a given PCD token.
771 Sets the 32-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().
775 If the set operation was not correctly performed, then ASSERT().
777 @param[in] Guid The pointer to a 128-bit unique value that
778 designates which namespace to set a value from.
779 @param[in] TokenNumber The PCD token number to set a current value for.
780 @param[in] Value The 32-bit value to set.
782 @return Return the value that was set.
789 IN UINTN TokenNumber
,
795 ASSERT (Guid
!= NULL
);
797 Status
= GetPiPcdProtocol()->Set32 (Guid
, TokenNumber
, Value
);
798 ASSERT_EFI_ERROR (Status
);
806 This function provides a means by which to set a value for a given PCD token.
808 Sets the 64-bit value for the token specified by TokenNumber and
809 Guid to the value specified by Value. Value is returned.
811 If Guid is NULL, then ASSERT().
812 If the set operation was not correctly performed, 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] Value The 64-bit value to set.
819 @return Return the value that was set.
826 IN UINTN TokenNumber
,
832 ASSERT (Guid
!= NULL
);
834 Status
= GetPiPcdProtocol()->Set64 (Guid
, TokenNumber
, Value
);
835 ASSERT_EFI_ERROR (Status
);
843 This function provides a means by which to set a value for a given PCD token.
845 Sets a buffer for the token specified by TokenNumber to the value specified by
846 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
847 the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
848 supported by TokenNumber and return NULL to indicate that the set operation
849 was not actually performed, or ASSERT() if the set operation was not corretly performed.
851 If Guid is NULL, then ASSERT().
852 If SizeOfBuffer is NULL, then ASSERT().
853 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
855 @param[in] Guid The pointer to a 128-bit unique value that
856 designates which namespace to set a value from.
857 @param[in] TokenNumber The PCD token number to set a current value for.
858 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
859 @param[in] Buffer A pointer to the buffer to set.
861 @return Return the pointer to the buffer been set.
868 IN UINTN TokenNumber
,
869 IN OUT UINTN
*SizeOfBuffer
,
874 UINTN InputSizeOfBuffer
;
876 ASSERT (Guid
!= NULL
);
878 ASSERT (SizeOfBuffer
!= NULL
);
880 if (*SizeOfBuffer
> 0) {
881 ASSERT (Buffer
!= NULL
);
884 InputSizeOfBuffer
= *SizeOfBuffer
;
885 Status
= GetPiPcdProtocol()->SetPtr (Guid
, TokenNumber
, SizeOfBuffer
, Buffer
);
886 if (EFI_ERROR (Status
) && (*SizeOfBuffer
< InputSizeOfBuffer
)) {
889 ASSERT_EFI_ERROR (Status
);
897 This function provides a means by which to set a value for a given PCD token.
899 Sets the Boolean value for the token specified by TokenNumber and
900 Guid to the value specified by Value. Value is returned.
902 If Guid is NULL, then ASSERT().
903 If the set operation was not correctly performed, then ASSERT().
905 @param[in] Guid The pointer to a 128-bit unique value that
906 designates which namespace to set a value from.
907 @param[in] TokenNumber The PCD token number to set a current value for.
908 @param[in] Value The Boolean value to set.
910 @return Return the value that was set.
917 IN UINTN TokenNumber
,
923 ASSERT (Guid
!= NULL
);
925 Status
= GetPiPcdProtocol()->SetBool (Guid
, TokenNumber
, Value
);
926 ASSERT_EFI_ERROR (Status
);
934 Set up a notification function that is called when a specified token is set.
936 When the token specified by TokenNumber and Guid is set,
937 then notification function specified by NotificationFunction is called.
938 If Guid is NULL, then the default token space is used.
939 If NotificationFunction is NULL, then ASSERT().
941 @param[in] Guid The pointer to a 128-bit unique value that designates which
942 namespace to set a value from. If NULL, then the default
944 @param[in] TokenNumber The PCD token number to monitor.
945 @param[in] NotificationFunction The function to call when the token
946 specified by Guid and TokenNumber is set.
951 LibPcdCallbackOnSet (
952 IN CONST GUID
*Guid
, OPTIONAL
953 IN UINTN TokenNumber
,
954 IN PCD_CALLBACK NotificationFunction
959 ASSERT (NotificationFunction
!= NULL
);
961 Status
= GetPiPcdProtocol()->CallbackOnSet (Guid
, TokenNumber
, (EFI_PCD_PROTOCOL_CALLBACK
) NotificationFunction
);
962 ASSERT_EFI_ERROR (Status
);
970 Disable a notification function that was established with LibPcdCallbackonSet().
972 Disable a notification function that was previously established with LibPcdCallbackOnSet().
973 If NotificationFunction is NULL, then ASSERT().
974 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
975 and NotificationFunction, then ASSERT().
977 @param[in] Guid Specify the GUID token space.
978 @param[in] TokenNumber Specify the token number.
979 @param[in] NotificationFunction The callback function to be unregistered.
984 LibPcdCancelCallback (
985 IN CONST GUID
*Guid
, OPTIONAL
986 IN UINTN TokenNumber
,
987 IN PCD_CALLBACK NotificationFunction
992 ASSERT (NotificationFunction
!= NULL
);
994 Status
= GetPiPcdProtocol()->CancelCallback (Guid
, TokenNumber
, (EFI_PCD_PROTOCOL_CALLBACK
) NotificationFunction
);
995 ASSERT_EFI_ERROR (Status
);
1003 Retrieves the next token in a token space.
1005 Retrieves the next PCD token number from the token space specified by Guid.
1006 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
1007 then the first token number is returned. Otherwise, the token number that
1008 follows TokenNumber in the token space is returned. If TokenNumber is the last
1009 token number in the token space, then 0 is returned.
1011 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1013 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
1014 to set a value from. If NULL, then the default token space is used.
1015 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
1018 @return The next valid token number.
1023 LibPcdGetNextToken (
1024 IN CONST GUID
*Guid
, OPTIONAL
1025 IN UINTN TokenNumber
1030 Status
= GetPiPcdProtocol()->GetNextToken (Guid
, &TokenNumber
);
1031 ASSERT (!EFI_ERROR (Status
) || TokenNumber
== 0);
1039 Used to retrieve the list of available PCD token space GUIDs.
1041 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1043 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1044 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1046 @param TokenSpaceGuid The pointer to the a PCD token space GUID.
1048 @return The next valid token namespace.
1053 LibPcdGetNextTokenSpace (
1054 IN CONST GUID
*TokenSpaceGuid
1057 GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid
);
1059 return (GUID
*)TokenSpaceGuid
;
1064 Sets a value of a patchable PCD entry that is type pointer.
1066 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1067 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1068 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1069 NULL to indicate that the set operation was not actually performed.
1070 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1071 MaximumDatumSize and NULL must be returned.
1073 If PatchVariable is NULL, then ASSERT().
1074 If SizeOfBuffer is NULL, then ASSERT().
1075 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1077 @param[in] PatchVariable A pointer to the global variable in a module that is
1078 the target of the set operation.
1079 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1080 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1081 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1083 @return Return the pointer to the buffer been set.
1089 IN VOID
*PatchVariable
,
1090 IN UINTN MaximumDatumSize
,
1091 IN OUT UINTN
*SizeOfBuffer
,
1092 IN CONST VOID
*Buffer
1095 ASSERT (PatchVariable
!= NULL
);
1096 ASSERT (SizeOfBuffer
!= NULL
);
1098 if (*SizeOfBuffer
> 0) {
1099 ASSERT (Buffer
!= NULL
);
1102 if ((*SizeOfBuffer
> MaximumDatumSize
) ||
1103 (*SizeOfBuffer
== MAX_ADDRESS
)) {
1104 *SizeOfBuffer
= MaximumDatumSize
;
1108 CopyMem (PatchVariable
, Buffer
, *SizeOfBuffer
);
1110 return (VOID
*) Buffer
;
1114 Retrieve additional information associated with a PCD token.
1116 This includes information such as the type of value the TokenNumber is associated with as well as possible
1117 human readable name that is associated with the token.
1119 If TokenNumber is not in the default token space specified, then ASSERT().
1121 @param[in] TokenNumber The PCD token number.
1122 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1123 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1128 IN UINTN TokenNumber
,
1129 OUT PCD_INFO
*PcdInfo
1134 Status
= GetPcdInfoProtocolPointer()->GetInfo (TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1135 ASSERT_EFI_ERROR (Status
);
1139 Retrieve additional information associated with a PCD token.
1141 This includes information such as the type of value the TokenNumber is associated with as well as possible
1142 human readable name that is associated with the token.
1144 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1146 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1147 @param[in] TokenNumber The PCD token number.
1148 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1149 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1154 IN CONST GUID
*Guid
,
1155 IN UINTN TokenNumber
,
1156 OUT PCD_INFO
*PcdInfo
1161 Status
= GetPiPcdInfoProtocolPointer()->GetInfo (Guid
, TokenNumber
, (EFI_PCD_INFO
*) PcdInfo
);
1162 ASSERT_EFI_ERROR (Status
);
1166 Retrieve the currently set SKU Id.
1168 If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
1170 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1171 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1182 SkuId
= GetPiPcdInfoProtocolPointer()->GetSku ();
1183 ASSERT (SkuId
< PCD_MAX_SKU_ID
);