2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2018, 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.
15 #ifndef _PCD_DXE_SERVICE_H_
16 #define _PCD_DXE_SERVICE_H_
19 #include <Guid/PcdDataBaseHobGuid.h>
20 #include <Guid/PcdDataBaseSignatureGuid.h>
21 #include <Protocol/Pcd.h>
22 #include <Protocol/PiPcd.h>
23 #include <Protocol/PcdInfo.h>
24 #include <Protocol/PiPcdInfo.h>
25 #include <Protocol/VarCheck.h>
26 #include <Protocol/VariableLock.h>
27 #include <Library/BaseLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/PcdLib.h>
32 #include <Library/HobLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/UefiRuntimeServicesTableLib.h>
39 // Please make sure the PCD Serivce DXE Version is consistent with
40 // the version of the generated DXE PCD Database by build tool.
42 #define PCD_SERVICE_DXE_VERSION 7
45 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
47 #if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)
48 #error "Please make sure the version of PCD DXE Service and the generated PCD DXE Database match."
51 extern UINTN mVpdBaseAddress
;
54 Retrieve additional information associated with a PCD token in the default token space.
56 This includes information such as the type of value the TokenNumber is associated with as well as possible
57 human readable name that is associated with the token.
59 @param[in] TokenNumber The PCD token number.
60 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
61 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
63 @retval EFI_SUCCESS The PCD information was returned successfully.
64 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
68 DxeGetPcdInfoGetInfo (
70 OUT EFI_PCD_INFO
*PcdInfo
74 Retrieve additional information associated with a PCD token.
76 This includes information such as the type of value the TokenNumber is associated with as well as possible
77 human readable name that is associated with the token.
79 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
80 @param[in] TokenNumber The PCD token number.
81 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
82 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
84 @retval EFI_SUCCESS The PCD information was returned successfully.
85 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
89 DxeGetPcdInfoGetInfoEx (
90 IN CONST EFI_GUID
*Guid
,
92 OUT EFI_PCD_INFO
*PcdInfo
96 Retrieve the currently set SKU Id.
98 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
99 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
104 DxeGetPcdInfoGetSku (
109 // Protocol Interface function declaration.
112 Sets the SKU value for subsequent calls to set or get PCD token values.
114 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
115 SetSku() is normally called only once by the system.
117 For each item (token), the database can hold a single value that applies to all SKUs,
118 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
119 SKU-specific values are called SKU enabled.
121 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
122 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
123 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
124 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
125 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
126 set for that Id, the results are unpredictable.
128 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
129 set values associated with a PCD token.
139 Retrieves an 8-bit value for a given PCD token.
141 Retrieves the current byte-sized value for a PCD token number.
142 If the TokenNumber is invalid, the results are unpredictable.
144 @param[in] TokenNumber The PCD token number.
146 @return The UINT8 value.
156 Retrieves an 16-bit value for a given PCD token.
158 Retrieves the current 16-bits value for a PCD token number.
159 If the TokenNumber is invalid, the results are unpredictable.
161 @param[in] TokenNumber The PCD token number.
163 @return The UINT16 value.
173 Retrieves an 32-bit value for a given PCD token.
175 Retrieves the current 32-bits value for a PCD token number.
176 If the TokenNumber is invalid, the results are unpredictable.
178 @param[in] TokenNumber The PCD token number.
180 @return The UINT32 value.
190 Retrieves an 64-bit value for a given PCD token.
192 Retrieves the current 64-bits value for a PCD token number.
193 If the TokenNumber is invalid, the results are unpredictable.
195 @param[in] TokenNumber The PCD token number.
197 @return The UINT64 value.
207 Retrieves a pointer to a value for a given PCD token.
209 Retrieves the current pointer to the buffer for a PCD token number.
210 Do not make any assumptions about the alignment of the pointer that
211 is returned by this function call. If the TokenNumber is invalid,
212 the results are unpredictable.
214 @param[in] TokenNumber The PCD token number.
216 @return The pointer to the buffer to be retrieved.
226 Retrieves a Boolean value for a given PCD token.
228 Retrieves the current boolean value for a PCD token number.
229 Do not make any assumptions about the alignment of the pointer that
230 is returned by this function call. If the TokenNumber is invalid,
231 the results are unpredictable.
233 @param[in] TokenNumber The PCD token number.
235 @return The Boolean value.
245 Retrieves the size of the value for a given PCD token.
247 Retrieves the current size of a particular PCD token.
248 If the TokenNumber is invalid, the results are unpredictable.
250 @param[in] TokenNumber The PCD token number.
252 @return The size of the value for the PCD token.
262 Retrieves an 8-bit value for a given PCD token.
264 Retrieves the 8-bit value of a particular PCD token.
265 If the TokenNumber is invalid or the token space
266 specified by Guid does not exist, the results are
269 @param[in] Guid The token space for the token number.
270 @param[in] TokenNumber The PCD token number.
272 @return The size 8-bit value for the PCD token.
278 IN CONST EFI_GUID
*Guid
,
283 Retrieves an 16-bit value for a given PCD token.
285 Retrieves the 16-bit value of a particular PCD token.
286 If the TokenNumber is invalid or the token space
287 specified by Guid does not exist, the results are
290 @param[in] Guid The token space for the token number.
291 @param[in] TokenNumber The PCD token number.
293 @return The size 16-bit value for the PCD token.
299 IN CONST EFI_GUID
*Guid
,
304 Retrieves an 32-bit value for a given PCD token.
306 Retrieves the 32-bit value of a particular PCD token.
307 If the TokenNumber is invalid or the token space
308 specified by Guid does not exist, the results are
311 @param[in] Guid The token space for the token number.
312 @param[in] TokenNumber The PCD token number.
314 @return The size 32-bit value for the PCD token.
320 IN CONST EFI_GUID
*Guid
,
325 Retrieves an 64-bit value for a given PCD token.
327 Retrieves the 64-bit value of a particular PCD token.
328 If the TokenNumber is invalid or the token space
329 specified by Guid does not exist, the results are
332 @param[in] Guid The token space for the token number.
333 @param[in] TokenNumber The PCD token number.
335 @return The size 64-bit value for the PCD token.
341 IN CONST EFI_GUID
*Guid
,
346 Retrieves a pointer to a value for a given PCD token.
348 Retrieves the current pointer to the buffer for a PCD token number.
349 Do not make any assumptions about the alignment of the pointer that
350 is returned by this function call. If the TokenNumber is invalid,
351 the results are unpredictable.
353 @param[in] Guid The token space for the token number.
354 @param[in] TokenNumber The PCD token number.
356 @return The pointer to the buffer to be retrieved.
362 IN CONST EFI_GUID
*Guid
,
367 Retrieves an Boolean value for a given PCD token.
369 Retrieves the Boolean value of a particular PCD token.
370 If the TokenNumber is invalid or the token space
371 specified by Guid does not exist, the results are
374 @param[in] Guid The token space for the token number.
375 @param[in] TokenNumber The PCD token number.
377 @return The size Boolean value for the PCD token.
383 IN CONST EFI_GUID
*Guid
,
388 Retrieves the size of the value for a given PCD token.
390 Retrieves the current size of a particular PCD token.
391 If the TokenNumber is invalid, the results are unpredictable.
393 @param[in] Guid The token space for the token number.
394 @param[in] TokenNumber The PCD token number.
396 @return The size of the value for the PCD token.
402 IN CONST EFI_GUID
*Guid
,
407 Sets an 8-bit value for a given PCD token.
409 When the PCD service sets a value, it will check to ensure that the
410 size of the value being set is compatible with the Token's existing definition.
411 If it is not, an error will be returned.
413 @param[in] TokenNumber The PCD token number.
414 @param[in] Value The value to set for the PCD token.
416 @retval EFI_SUCCESS Procedure returned successfully.
417 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
418 being set was incompatible with a call to this function.
419 Use GetSize() to retrieve the size of the target data.
420 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
426 IN UINTN TokenNumber
,
431 Sets an 16-bit value for a given PCD token.
433 When the PCD service sets a value, it will check to ensure that the
434 size of the value being set is compatible with the Token's existing definition.
435 If it is not, an error will be returned.
437 @param[in] TokenNumber The PCD token number.
438 @param[in] Value The value to set for the PCD token.
440 @retval EFI_SUCCESS Procedure returned successfully.
441 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
442 being set was incompatible with a call to this function.
443 Use GetSize() to retrieve the size of the target data.
444 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
450 IN UINTN TokenNumber
,
455 Sets an 32-bit value for a given PCD token.
457 When the PCD service sets a value, it will check to ensure that the
458 size of the value being set is compatible with the Token's existing definition.
459 If it is not, an error will be returned.
461 @param[in] TokenNumber The PCD token number.
462 @param[in] Value The value to set for the PCD token.
464 @retval EFI_SUCCESS Procedure returned successfully.
465 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
466 being set was incompatible with a call to this function.
467 Use GetSize() to retrieve the size of the target data.
468 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
474 IN UINTN TokenNumber
,
479 Sets an 64-bit value for a given PCD token.
481 When the PCD service sets a value, it will check to ensure that the
482 size of the value being set is compatible with the Token's existing definition.
483 If it is not, an error will be returned.
485 @param[in] TokenNumber The PCD token number.
486 @param[in] Value The value to set for the PCD token.
488 @retval EFI_SUCCESS Procedure returned successfully.
489 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
490 being set was incompatible with a call to this function.
491 Use GetSize() to retrieve the size of the target data.
492 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
498 IN UINTN TokenNumber
,
504 Sets a value of a specified size for a given PCD token.
506 When the PCD service sets a value, it will check to ensure that the
507 size of the value being set is compatible with the Token's existing definition.
508 If it is not, an error will be returned.
510 @param[in] TokenNumber The PCD token number.
511 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
512 On input, if the SizeOfValue is greater than the maximum size supported
513 for this TokenNumber then the output value of SizeOfValue will reflect
514 the maximum size supported for this TokenNumber.
515 @param[in] Buffer The buffer to set for the PCD token.
517 @retval EFI_SUCCESS Procedure returned successfully.
518 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
519 being set was incompatible with a call to this function.
520 Use GetSize() to retrieve the size of the target data.
521 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
527 IN UINTN TokenNumber
,
528 IN OUT UINTN
*SizeOfBuffer
,
533 Sets an Boolean value for a given PCD token.
535 When the PCD service sets a value, it will check to ensure that the
536 size of the value being set is compatible with the Token's existing definition.
537 If it is not, an error will be returned.
539 @param[in] TokenNumber The PCD token number.
540 @param[in] Value The value to set for the PCD token.
542 @retval EFI_SUCCESS Procedure returned successfully.
543 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
544 being set was incompatible with a call to this function.
545 Use GetSize() to retrieve the size of the target data.
546 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
552 IN UINTN TokenNumber
,
558 Sets an 8-bit value for a given PCD token.
560 When the PCD service sets a value, it will check to ensure that the
561 size of the value being set is compatible with the Token's existing definition.
562 If it is not, an error will be returned.
564 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
565 @param[in] TokenNumber The PCD token number.
566 @param[in] Value The value to set for the PCD token.
568 @retval EFI_SUCCESS Procedure returned successfully.
569 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
570 being set was incompatible with a call to this function.
571 Use GetSize() to retrieve the size of the target data.
572 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
578 IN CONST EFI_GUID
*Guid
,
579 IN UINTN TokenNumber
,
584 Sets an 16-bit value for a given PCD token.
586 When the PCD service sets a value, it will check to ensure that the
587 size of the value being set is compatible with the Token's existing definition.
588 If it is not, an error will be returned.
590 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
591 @param[in] TokenNumber The PCD token number.
592 @param[in] Value The value to set for the PCD token.
594 @retval EFI_SUCCESS Procedure returned successfully.
595 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
596 being set was incompatible with a call to this function.
597 Use GetSize() to retrieve the size of the target data.
598 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
604 IN CONST EFI_GUID
*Guid
,
605 IN UINTN TokenNumber
,
610 Sets an 32-bit value for a given PCD token.
612 When the PCD service sets a value, it will check to ensure that the
613 size of the value being set is compatible with the Token's existing definition.
614 If it is not, an error will be returned.
616 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
617 @param[in] TokenNumber The PCD token number.
618 @param[in] Value The value to set for the PCD token.
620 @retval EFI_SUCCESS Procedure returned successfully.
621 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
622 being set was incompatible with a call to this function.
623 Use GetSize() to retrieve the size of the target data.
624 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
630 IN CONST EFI_GUID
*Guid
,
631 IN UINTN TokenNumber
,
636 Sets an 64-bit value for a given PCD token.
638 When the PCD service sets a value, it will check to ensure that the
639 size of the value being set is compatible with the Token's existing definition.
640 If it is not, an error will be returned.
642 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
643 @param[in] TokenNumber The PCD token number.
644 @param[in] Value The value to set for the PCD token.
646 @retval EFI_SUCCESS Procedure returned successfully.
647 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
648 being set was incompatible with a call to this function.
649 Use GetSize() to retrieve the size of the target data.
650 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
656 IN CONST EFI_GUID
*Guid
,
657 IN UINTN TokenNumber
,
662 Sets a value of a specified size for a given PCD token.
664 When the PCD service sets a value, it will check to ensure that the
665 size of the value being set is compatible with the Token's existing definition.
666 If it is not, an error will be returned.
668 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
669 @param[in] TokenNumber The PCD token number.
670 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
671 On input, if the SizeOfValue is greater than the maximum size supported
672 for this TokenNumber then the output value of SizeOfValue will reflect
673 the maximum size supported for this TokenNumber.
674 @param[in] Buffer The buffer to set for the PCD token.
676 @retval EFI_SUCCESS Procedure returned successfully.
677 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
678 being set was incompatible with a call to this function.
679 Use GetSize() to retrieve the size of the target data.
680 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
686 IN CONST EFI_GUID
*Guid
,
687 IN UINTN TokenNumber
,
688 IN OUT UINTN
*SizeOfBuffer
,
693 Sets an Boolean value for a given PCD token.
695 When the PCD service sets a value, it will check to ensure that the
696 size of the value being set is compatible with the Token's existing definition.
697 If it is not, an error will be returned.
699 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
700 @param[in] TokenNumber The PCD token number.
701 @param[in] Value The value to set for the PCD token.
703 @retval EFI_SUCCESS Procedure returned successfully.
704 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
705 being set was incompatible with a call to this function.
706 Use GetSize() to retrieve the size of the target data.
707 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
713 IN CONST EFI_GUID
*Guid
,
714 IN UINTN TokenNumber
,
719 Specifies a function to be called anytime the value of a designated token is changed.
721 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
722 @param[in] TokenNumber The PCD token number.
723 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
725 @retval EFI_SUCCESS The PCD service has successfully established a call event
726 for the CallBackToken requested.
727 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
732 DxeRegisterCallBackOnSet (
733 IN CONST EFI_GUID
*Guid
, OPTIONAL
734 IN UINTN TokenNumber
,
735 IN PCD_PROTOCOL_CALLBACK CallBackFunction
739 Cancels a previously set callback function for a particular PCD token number.
741 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
742 @param[in] TokenNumber The PCD token number.
743 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
745 @retval EFI_SUCCESS The PCD service has successfully established a call event
746 for the CallBackToken requested.
747 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
752 DxeUnRegisterCallBackOnSet (
753 IN CONST EFI_GUID
*Guid
, OPTIONAL
754 IN UINTN TokenNumber
,
755 IN PCD_PROTOCOL_CALLBACK CallBackFunction
759 Retrieves the next valid token number in a given namespace.
761 This is useful since the PCD infrastructure contains a sparse list of token numbers,
762 and one cannot a priori know what token numbers are valid in the database.
764 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
765 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
766 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
767 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
768 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
769 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
770 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
771 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
774 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
775 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
776 being made to retrieve tokens from the default token space.
777 @param[in, out] TokenNumber
778 A pointer to the PCD token number to use to find the subsequent token number.
780 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
781 is already the last valid token number in the PCD database.
782 In the later case, *TokenNumber is updated with the value of 0.
783 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
789 IN CONST EFI_GUID
*Guid
, OPTIONAL
790 IN OUT UINTN
*TokenNumber
794 Get next token space in PCD database according to given token space guid.
796 @param Guid Given token space guid. If NULL, then Guid will be set to
797 the first PCD token space in PCD database, If not NULL, then
798 Guid will be set to next PCD token space.
800 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
801 token space in PCD database.
802 @retval EFI_SUCCESS Success to get next token space guid.
806 DxePcdGetNextTokenSpace (
807 IN OUT CONST EFI_GUID
**Guid
812 PCD_PROTOCOL_CALLBACK CallbackFn
;
815 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
818 // Internal Functions
822 Retrieve additional information associated with a PCD token.
824 This includes information such as the type of value the TokenNumber is associated with as well as possible
825 human readable name that is associated with the token.
827 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
828 @param[in] TokenNumber The PCD token number.
829 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
830 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
832 @retval EFI_SUCCESS The PCD information was returned successfully
833 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
837 IN CONST EFI_GUID
*Guid
,
838 IN UINTN TokenNumber
,
839 OUT EFI_PCD_INFO
*PcdInfo
843 Wrapper function for setting non-pointer type value for a PCD entry.
845 @param TokenNumber Pcd token number autogenerated by build tools.
846 @param Data Value want to be set for PCD entry
847 @param Size Size of value.
849 @return status of SetWorker.
854 IN UINTN TokenNumber
,
860 Set value for an PCD entry
862 @param TokenNumber Pcd token number autogenerated by build tools.
863 @param Data Value want to be set for PCD entry
864 @param Size Size of value.
865 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
866 If False, the type of PCD entry's value is not Pointer.
868 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
869 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
870 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
871 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
872 range of UINT8, UINT16, UINT32, UINT64
873 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
877 IN UINTN TokenNumber
,
884 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
886 @param ExTokenNumber Token number for dynamic-ex PCD.
887 @param Guid Token space guid for dynamic-ex PCD.
888 @param Data Value want to be set.
889 @param SetSize The size of value.
891 @return status of ExSetWorker().
896 IN UINTN ExTokenNumber
,
897 IN CONST EFI_GUID
*Guid
,
903 Set value for a dynamic PCD entry.
905 This routine find the local token number according to dynamic-ex PCD's token
906 space guid and token number firstly, and invoke callback function if this PCD
907 entry registered callback function. Finally, invoken general SetWorker to set
910 @param ExTokenNumber Dynamic-ex PCD token number.
911 @param Guid Token space guid for dynamic-ex PCD.
912 @param Data PCD value want to be set
913 @param SetSize Size of value.
914 @param PtrType If TRUE, this PCD entry is pointer type.
915 If FALSE, this PCD entry is not pointer type.
917 @return status of SetWorker().
922 IN UINTN ExTokenNumber
,
923 IN CONST EFI_GUID
*Guid
,
930 Get the PCD entry pointer in PCD database.
932 This routine will visit PCD database to find the PCD entry according to given
933 token number. The given token number is autogened by build tools and it will be
934 translated to local token number. Local token number contains PCD's type and
935 offset of PCD entry in PCD database.
937 @param TokenNumber Token's number, it is autogened by build tools
938 @param GetSize The size of token's value
940 @return PCD entry pointer in PCD database
945 IN UINTN TokenNumber
,
950 Wrapper function for get PCD value for dynamic-ex PCD.
952 @param Guid Token space guid for dynamic-ex PCD.
953 @param ExTokenNumber Token number for dynamic-ex PCD.
954 @param GetSize The size of dynamic-ex PCD value.
956 @return PCD entry in PCD database.
961 IN CONST EFI_GUID
*Guid
,
962 IN UINTN ExTokenNumber
,
967 Get Variable which contains HII type PCD entry.
969 @param VariableGuid Variable's guid
970 @param VariableName Variable's unicode name string
971 @param VariableData Variable's data pointer,
972 @param VariableSize Variable's size.
974 @return the status of gRT->GetVariable
978 IN EFI_GUID
*VariableGuid
,
979 IN UINT16
*VariableName
,
980 OUT UINT8
**VariableData
,
981 OUT UINTN
*VariableSize
985 Set value for HII-type PCD.
987 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
988 HII-type PCD is to visit this variable.
990 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
991 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
992 @param SetAttributes Attributes bitmask to set for the variable.
993 @param Data Value want to be set.
994 @param DataSize Size of value
995 @param Offset Value offset of HII-type PCD in variable.
997 @return status of GetVariable()/SetVariable().
1002 IN EFI_GUID
*VariableGuid
,
1003 IN UINT16
*VariableName
,
1004 IN UINT32 SetAttributes
,
1005 IN CONST VOID
*Data
,
1011 Register the callback function for a PCD entry.
1013 This routine will register a callback function to a PCD entry by given token number
1014 and token space guid.
1016 @param TokenNumber PCD token's number, it is autogened by build tools.
1017 @param Guid PCD token space's guid,
1018 if not NULL, this PCD is dynamicEx type PCD.
1019 @param CallBackFunction Callback function pointer
1021 @return EFI_SUCCESS Always success for registering callback function.
1025 DxeRegisterCallBackWorker (
1026 IN UINTN TokenNumber
,
1027 IN CONST EFI_GUID
*Guid
, OPTIONAL
1028 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1032 UnRegister the callback function for a PCD entry.
1034 This routine will unregister a callback function to a PCD entry by given token number
1035 and token space guid.
1037 @param TokenNumber PCD token's number, it is autogened by build tools.
1038 @param Guid PCD token space's guid.
1039 if not NULL, this PCD is dynamicEx type PCD.
1040 @param CallBackFunction Callback function pointer
1042 @retval EFI_SUCCESS Callback function is success to be unregister.
1043 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
1046 DxeUnRegisterCallBackWorker (
1047 IN UINTN TokenNumber
,
1048 IN CONST EFI_GUID
*Guid
, OPTIONAL
1049 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1053 Initialize the PCD database in DXE phase.
1055 PCD database in DXE phase also contains PCD database in PEI phase which is copied
1060 BuildPcdDxeDataBase (
1065 Get Token Number according to dynamic-ex PCD's {token space guid:token number}
1067 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1068 in DEC file. PCD database maintain a mapping table that translate pair of {token
1069 space guid: token number} to Token Number.
1071 @param Guid Token space guid for dynamic-ex PCD entry.
1072 @param ExTokenNumber Dynamic-ex PCD token number.
1074 @return Token Number for dynamic-ex PCD.
1078 GetExPcdTokenNumber (
1079 IN CONST EFI_GUID
*Guid
,
1080 IN UINT32 ExTokenNumber
1084 Get next token number in given token space.
1086 This routine is used for dynamicEx type PCD. It will firstly scan token space
1087 table to get token space according to given token space guid. Then scan given
1088 token number in found token space, if found, then return next token number in
1091 @param Guid Token space guid. Next token number will be scaned in
1093 @param TokenNumber Token number.
1094 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1096 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1097 in token space table.
1098 @param GuidTable Token space guid table. It will be used for scan token space
1099 by given token space guid.
1100 @param SizeOfGuidTable The size of guid table.
1101 @param ExMapTable DynamicEx token number mapping table.
1102 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1104 @retval EFI_NOT_FOUND Can not given token space or token number.
1105 @retval EFI_SUCCESS Success to get next token number.
1109 ExGetNextTokeNumber (
1110 IN CONST EFI_GUID
*Guid
,
1111 IN OUT UINTN
*TokenNumber
,
1112 IN EFI_GUID
*GuidTable
,
1113 IN UINTN SizeOfGuidTable
,
1114 IN DYNAMICEX_MAPPING
*ExMapTable
,
1115 IN UINTN SizeOfExMapTable
1119 Get size of POINTER type PCD value.
1121 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1122 @param MaxSize Maximum size of POINTER type PCD value.
1124 @return size of POINTER type PCD value.
1129 IN UINTN LocalTokenNumberTableIdx
,
1134 Set size of POINTER type PCD value. The size should not exceed the maximum size
1137 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1138 @param CurrentSize Size of POINTER type PCD value.
1140 @retval TRUE Success to set size of PCD value.
1141 @retval FALSE Fail to set size of PCD value.
1145 IN UINTN LocalTokenNumberTableIdx
,
1146 IN OUT UINTN
*CurrentSize
1150 VariableLockProtocol callback
1151 to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.
1153 @param[in] Event Event whose notification function is being invoked.
1154 @param[in] Context Pointer to the notification function's context.
1159 VariableLockCallBack (
1165 Update PCD database base on current SkuId
1167 @param SkuId Current SkuId
1168 @param IsPeiDb Whether to update PEI PCD database.
1170 @retval EFI_SUCCESS Update PCD database successfully.
1171 @retval EFI_NOT_FOUND Not found PCD database for current SkuId.
1179 extern PCD_DATABASE mPcdDatabase
;
1181 extern UINT32 mPcdTotalTokenCount
;
1182 extern UINT32 mPeiLocalTokenCount
;
1183 extern UINT32 mDxeLocalTokenCount
;
1184 extern UINT32 mPeiNexTokenCount
;
1185 extern UINT32 mDxeNexTokenCount
;
1186 extern UINT32 mPeiExMapppingTableSize
;
1187 extern UINT32 mDxeExMapppingTableSize
;
1188 extern UINT32 mPeiGuidTableSize
;
1189 extern UINT32 mDxeGuidTableSize
;
1191 extern BOOLEAN mPeiExMapTableEmpty
;
1192 extern BOOLEAN mDxeExMapTableEmpty
;
1193 extern BOOLEAN mPeiDatabaseEmpty
;
1195 extern EFI_GUID
**TmpTokenSpaceBuffer
;
1196 extern UINTN TmpTokenSpaceBufferCount
;
1198 extern EFI_LOCK mPcdDatabaseLock
;