2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _PCD_DXE_SERVICE_H_
10 #define _PCD_DXE_SERVICE_H_
13 #include <Guid/PcdDataBaseHobGuid.h>
14 #include <Guid/PcdDataBaseSignatureGuid.h>
15 #include <Protocol/Pcd.h>
16 #include <Protocol/PiPcd.h>
17 #include <Protocol/PcdInfo.h>
18 #include <Protocol/PiPcdInfo.h>
19 #include <Protocol/VarCheck.h>
20 #include <Protocol/VariableLock.h>
21 #include <Library/BaseLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/UefiLib.h>
24 #include <Library/UefiDriverEntryPoint.h>
25 #include <Library/PcdLib.h>
26 #include <Library/HobLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/UefiRuntimeServicesTableLib.h>
33 // Please make sure the PCD Serivce DXE Version is consistent with
34 // the version of the generated DXE PCD Database by build tool.
36 #define PCD_SERVICE_DXE_VERSION 7
39 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
41 #if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)
42 #error "Please make sure the version of PCD DXE Service and the generated PCD DXE Database match."
45 extern UINTN mVpdBaseAddress
;
48 Retrieve additional information associated with a PCD token in the default token space.
50 This includes information such as the type of value the TokenNumber is associated with as well as possible
51 human readable name that is associated with the token.
53 @param[in] TokenNumber The PCD token number.
54 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
55 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
57 @retval EFI_SUCCESS The PCD information was returned successfully.
58 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
62 DxeGetPcdInfoGetInfo (
64 OUT EFI_PCD_INFO
*PcdInfo
68 Retrieve additional information associated with a PCD token.
70 This includes information such as the type of value the TokenNumber is associated with as well as possible
71 human readable name that is associated with the token.
73 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
74 @param[in] TokenNumber The PCD token number.
75 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
76 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
78 @retval EFI_SUCCESS The PCD information was returned successfully.
79 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
83 DxeGetPcdInfoGetInfoEx (
84 IN CONST EFI_GUID
*Guid
,
86 OUT EFI_PCD_INFO
*PcdInfo
90 Retrieve the currently set SKU Id.
92 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
93 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
103 // Protocol Interface function declaration.
106 Sets the SKU value for subsequent calls to set or get PCD token values.
108 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
109 SetSku() is normally called only once by the system.
111 For each item (token), the database can hold a single value that applies to all SKUs,
112 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
113 SKU-specific values are called SKU enabled.
115 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
116 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
117 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
118 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
119 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
120 set for that Id, the results are unpredictable.
122 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
123 set values associated with a PCD token.
133 Retrieves an 8-bit value for a given PCD token.
135 Retrieves the current byte-sized value for a PCD token number.
136 If the TokenNumber is invalid, the results are unpredictable.
138 @param[in] TokenNumber The PCD token number.
140 @return The UINT8 value.
150 Retrieves an 16-bit value for a given PCD token.
152 Retrieves the current 16-bits value for a PCD token number.
153 If the TokenNumber is invalid, the results are unpredictable.
155 @param[in] TokenNumber The PCD token number.
157 @return The UINT16 value.
167 Retrieves an 32-bit value for a given PCD token.
169 Retrieves the current 32-bits value for a PCD token number.
170 If the TokenNumber is invalid, the results are unpredictable.
172 @param[in] TokenNumber The PCD token number.
174 @return The UINT32 value.
184 Retrieves an 64-bit value for a given PCD token.
186 Retrieves the current 64-bits value for a PCD token number.
187 If the TokenNumber is invalid, the results are unpredictable.
189 @param[in] TokenNumber The PCD token number.
191 @return The UINT64 value.
201 Retrieves a pointer to a value for a given PCD token.
203 Retrieves the current pointer to the buffer for a PCD token number.
204 Do not make any assumptions about the alignment of the pointer that
205 is returned by this function call. If the TokenNumber is invalid,
206 the results are unpredictable.
208 @param[in] TokenNumber The PCD token number.
210 @return The pointer to the buffer to be retrieved.
220 Retrieves a Boolean value for a given PCD token.
222 Retrieves the current boolean value for a PCD token number.
223 Do not make any assumptions about the alignment of the pointer that
224 is returned by this function call. If the TokenNumber is invalid,
225 the results are unpredictable.
227 @param[in] TokenNumber The PCD token number.
229 @return The Boolean value.
239 Retrieves the size of the value for a given PCD token.
241 Retrieves the current size of a particular PCD token.
242 If the TokenNumber is invalid, the results are unpredictable.
244 @param[in] TokenNumber The PCD token number.
246 @return The size of the value for the PCD token.
256 Retrieves an 8-bit value for a given PCD token.
258 Retrieves the 8-bit value of a particular PCD token.
259 If the TokenNumber is invalid or the token space
260 specified by Guid does not exist, the results are
263 @param[in] Guid The token space for the token number.
264 @param[in] TokenNumber The PCD token number.
266 @return The size 8-bit value for the PCD token.
272 IN CONST EFI_GUID
*Guid
,
277 Retrieves an 16-bit value for a given PCD token.
279 Retrieves the 16-bit value of a particular PCD token.
280 If the TokenNumber is invalid or the token space
281 specified by Guid does not exist, the results are
284 @param[in] Guid The token space for the token number.
285 @param[in] TokenNumber The PCD token number.
287 @return The size 16-bit value for the PCD token.
293 IN CONST EFI_GUID
*Guid
,
298 Retrieves an 32-bit value for a given PCD token.
300 Retrieves the 32-bit value of a particular PCD token.
301 If the TokenNumber is invalid or the token space
302 specified by Guid does not exist, the results are
305 @param[in] Guid The token space for the token number.
306 @param[in] TokenNumber The PCD token number.
308 @return The size 32-bit value for the PCD token.
314 IN CONST EFI_GUID
*Guid
,
319 Retrieves an 64-bit value for a given PCD token.
321 Retrieves the 64-bit value of a particular PCD token.
322 If the TokenNumber is invalid or the token space
323 specified by Guid does not exist, the results are
326 @param[in] Guid The token space for the token number.
327 @param[in] TokenNumber The PCD token number.
329 @return The size 64-bit value for the PCD token.
335 IN CONST EFI_GUID
*Guid
,
340 Retrieves a pointer to a value for a given PCD token.
342 Retrieves the current pointer to the buffer for a PCD token number.
343 Do not make any assumptions about the alignment of the pointer that
344 is returned by this function call. If the TokenNumber is invalid,
345 the results are unpredictable.
347 @param[in] Guid The token space for the token number.
348 @param[in] TokenNumber The PCD token number.
350 @return The pointer to the buffer to be retrieved.
356 IN CONST EFI_GUID
*Guid
,
361 Retrieves an Boolean value for a given PCD token.
363 Retrieves the Boolean value of a particular PCD token.
364 If the TokenNumber is invalid or the token space
365 specified by Guid does not exist, the results are
368 @param[in] Guid The token space for the token number.
369 @param[in] TokenNumber The PCD token number.
371 @return The size Boolean value for the PCD token.
377 IN CONST EFI_GUID
*Guid
,
382 Retrieves the size of the value for a given PCD token.
384 Retrieves the current size of a particular PCD token.
385 If the TokenNumber is invalid, the results are unpredictable.
387 @param[in] Guid The token space for the token number.
388 @param[in] TokenNumber The PCD token number.
390 @return The size of the value for the PCD token.
396 IN CONST EFI_GUID
*Guid
,
401 Sets an 8-bit value for a given PCD token.
403 When the PCD service sets a value, it will check to ensure that the
404 size of the value being set is compatible with the Token's existing definition.
405 If it is not, an error will be returned.
407 @param[in] TokenNumber The PCD token number.
408 @param[in] Value The value to set for the PCD token.
410 @retval EFI_SUCCESS Procedure returned successfully.
411 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
412 being set was incompatible with a call to this function.
413 Use GetSize() to retrieve the size of the target data.
414 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
420 IN UINTN TokenNumber
,
425 Sets an 16-bit value for a given PCD token.
427 When the PCD service sets a value, it will check to ensure that the
428 size of the value being set is compatible with the Token's existing definition.
429 If it is not, an error will be returned.
431 @param[in] TokenNumber The PCD token number.
432 @param[in] Value The value to set for the PCD token.
434 @retval EFI_SUCCESS Procedure returned successfully.
435 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
436 being set was incompatible with a call to this function.
437 Use GetSize() to retrieve the size of the target data.
438 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
444 IN UINTN TokenNumber
,
449 Sets an 32-bit value for a given PCD token.
451 When the PCD service sets a value, it will check to ensure that the
452 size of the value being set is compatible with the Token's existing definition.
453 If it is not, an error will be returned.
455 @param[in] TokenNumber The PCD token number.
456 @param[in] Value The value to set for the PCD token.
458 @retval EFI_SUCCESS Procedure returned successfully.
459 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
460 being set was incompatible with a call to this function.
461 Use GetSize() to retrieve the size of the target data.
462 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
468 IN UINTN TokenNumber
,
473 Sets an 64-bit value for a given PCD token.
475 When the PCD service sets a value, it will check to ensure that the
476 size of the value being set is compatible with the Token's existing definition.
477 If it is not, an error will be returned.
479 @param[in] TokenNumber The PCD token number.
480 @param[in] Value The value to set for the PCD token.
482 @retval EFI_SUCCESS Procedure returned successfully.
483 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
484 being set was incompatible with a call to this function.
485 Use GetSize() to retrieve the size of the target data.
486 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
492 IN UINTN TokenNumber
,
498 Sets a value of a specified size for a given PCD token.
500 When the PCD service sets a value, it will check to ensure that the
501 size of the value being set is compatible with the Token's existing definition.
502 If it is not, an error will be returned.
504 @param[in] TokenNumber The PCD token number.
505 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
506 On input, if the SizeOfValue is greater than the maximum size supported
507 for this TokenNumber then the output value of SizeOfValue will reflect
508 the maximum size supported for this TokenNumber.
509 @param[in] Buffer The buffer to set for the PCD token.
511 @retval EFI_SUCCESS Procedure returned successfully.
512 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
513 being set was incompatible with a call to this function.
514 Use GetSize() to retrieve the size of the target data.
515 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
521 IN UINTN TokenNumber
,
522 IN OUT UINTN
*SizeOfBuffer
,
527 Sets an Boolean value for a given PCD token.
529 When the PCD service sets a value, it will check to ensure that the
530 size of the value being set is compatible with the Token's existing definition.
531 If it is not, an error will be returned.
533 @param[in] TokenNumber The PCD token number.
534 @param[in] Value The value to set for the PCD token.
536 @retval EFI_SUCCESS Procedure returned successfully.
537 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
538 being set was incompatible with a call to this function.
539 Use GetSize() to retrieve the size of the target data.
540 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
546 IN UINTN TokenNumber
,
552 Sets an 8-bit value for a given PCD token.
554 When the PCD service sets a value, it will check to ensure that the
555 size of the value being set is compatible with the Token's existing definition.
556 If it is not, an error will be returned.
558 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
559 @param[in] TokenNumber The PCD token number.
560 @param[in] Value The value to set for the PCD token.
562 @retval EFI_SUCCESS Procedure returned successfully.
563 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
564 being set was incompatible with a call to this function.
565 Use GetSize() to retrieve the size of the target data.
566 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
572 IN CONST EFI_GUID
*Guid
,
573 IN UINTN TokenNumber
,
578 Sets an 16-bit value for a given PCD token.
580 When the PCD service sets a value, it will check to ensure that the
581 size of the value being set is compatible with the Token's existing definition.
582 If it is not, an error will be returned.
584 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
585 @param[in] TokenNumber The PCD token number.
586 @param[in] Value The value to set for the PCD token.
588 @retval EFI_SUCCESS Procedure returned successfully.
589 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
590 being set was incompatible with a call to this function.
591 Use GetSize() to retrieve the size of the target data.
592 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
598 IN CONST EFI_GUID
*Guid
,
599 IN UINTN TokenNumber
,
604 Sets an 32-bit value for a given PCD token.
606 When the PCD service sets a value, it will check to ensure that the
607 size of the value being set is compatible with the Token's existing definition.
608 If it is not, an error will be returned.
610 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
611 @param[in] TokenNumber The PCD token number.
612 @param[in] Value The value to set for the PCD token.
614 @retval EFI_SUCCESS Procedure returned successfully.
615 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
616 being set was incompatible with a call to this function.
617 Use GetSize() to retrieve the size of the target data.
618 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
624 IN CONST EFI_GUID
*Guid
,
625 IN UINTN TokenNumber
,
630 Sets an 64-bit value for a given PCD token.
632 When the PCD service sets a value, it will check to ensure that the
633 size of the value being set is compatible with the Token's existing definition.
634 If it is not, an error will be returned.
636 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
637 @param[in] TokenNumber The PCD token number.
638 @param[in] Value The value to set for the PCD token.
640 @retval EFI_SUCCESS Procedure returned successfully.
641 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
642 being set was incompatible with a call to this function.
643 Use GetSize() to retrieve the size of the target data.
644 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
650 IN CONST EFI_GUID
*Guid
,
651 IN UINTN TokenNumber
,
656 Sets a value of a specified size for a given PCD token.
658 When the PCD service sets a value, it will check to ensure that the
659 size of the value being set is compatible with the Token's existing definition.
660 If it is not, an error will be returned.
662 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
663 @param[in] TokenNumber The PCD token number.
664 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
665 On input, if the SizeOfValue is greater than the maximum size supported
666 for this TokenNumber then the output value of SizeOfValue will reflect
667 the maximum size supported for this TokenNumber.
668 @param[in] Buffer The buffer to set for the PCD token.
670 @retval EFI_SUCCESS Procedure returned successfully.
671 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
672 being set was incompatible with a call to this function.
673 Use GetSize() to retrieve the size of the target data.
674 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
680 IN CONST EFI_GUID
*Guid
,
681 IN UINTN TokenNumber
,
682 IN OUT UINTN
*SizeOfBuffer
,
687 Sets an Boolean value for a given PCD token.
689 When the PCD service sets a value, it will check to ensure that the
690 size of the value being set is compatible with the Token's existing definition.
691 If it is not, an error will be returned.
693 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
694 @param[in] TokenNumber The PCD token number.
695 @param[in] Value The value to set for the PCD token.
697 @retval EFI_SUCCESS Procedure returned successfully.
698 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
699 being set was incompatible with a call to this function.
700 Use GetSize() to retrieve the size of the target data.
701 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
707 IN CONST EFI_GUID
*Guid
,
708 IN UINTN TokenNumber
,
713 Specifies a function to be called anytime the value of a designated token is changed.
715 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
716 @param[in] TokenNumber The PCD token number.
717 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
719 @retval EFI_SUCCESS The PCD service has successfully established a call event
720 for the CallBackToken requested.
721 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
726 DxeRegisterCallBackOnSet (
727 IN CONST EFI_GUID
*Guid
, OPTIONAL
728 IN UINTN TokenNumber
,
729 IN PCD_PROTOCOL_CALLBACK CallBackFunction
733 Cancels a previously set callback function for a particular PCD token number.
735 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
736 @param[in] TokenNumber The PCD token number.
737 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
739 @retval EFI_SUCCESS The PCD service has successfully established a call event
740 for the CallBackToken requested.
741 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
746 DxeUnRegisterCallBackOnSet (
747 IN CONST EFI_GUID
*Guid
, OPTIONAL
748 IN UINTN TokenNumber
,
749 IN PCD_PROTOCOL_CALLBACK CallBackFunction
753 Retrieves the next valid token number in a given namespace.
755 This is useful since the PCD infrastructure contains a sparse list of token numbers,
756 and one cannot a priori know what token numbers are valid in the database.
758 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
759 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
760 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
761 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
762 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
763 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
764 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
765 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
768 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
769 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
770 being made to retrieve tokens from the default token space.
771 @param[in, out] TokenNumber
772 A pointer to the PCD token number to use to find the subsequent token number.
774 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
775 is already the last valid token number in the PCD database.
776 In the later case, *TokenNumber is updated with the value of 0.
777 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
783 IN CONST EFI_GUID
*Guid
, OPTIONAL
784 IN OUT UINTN
*TokenNumber
788 Get next token space in PCD database according to given token space guid.
790 @param Guid Given token space guid. If NULL, then Guid will be set to
791 the first PCD token space in PCD database, If not NULL, then
792 Guid will be set to next PCD token space.
794 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
795 token space in PCD database.
796 @retval EFI_SUCCESS Success to get next token space guid.
800 DxePcdGetNextTokenSpace (
801 IN OUT CONST EFI_GUID
**Guid
806 PCD_PROTOCOL_CALLBACK CallbackFn
;
809 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
812 // Internal Functions
816 Retrieve additional information associated with a PCD token.
818 This includes information such as the type of value the TokenNumber is associated with as well as possible
819 human readable name that is associated with the token.
821 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
822 @param[in] TokenNumber The PCD token number.
823 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
824 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
826 @retval EFI_SUCCESS The PCD information was returned successfully
827 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
831 IN CONST EFI_GUID
*Guid
,
832 IN UINTN TokenNumber
,
833 OUT EFI_PCD_INFO
*PcdInfo
837 Wrapper function for setting non-pointer type value for a PCD entry.
839 @param TokenNumber Pcd token number autogenerated by build tools.
840 @param Data Value want to be set for PCD entry
841 @param Size Size of value.
843 @return status of SetWorker.
848 IN UINTN TokenNumber
,
854 Set value for an PCD entry
856 @param TokenNumber Pcd token number autogenerated by build tools.
857 @param Data Value want to be set for PCD entry
858 @param Size Size of value.
859 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
860 If False, the type of PCD entry's value is not Pointer.
862 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
863 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
864 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
865 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
866 range of UINT8, UINT16, UINT32, UINT64
867 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
871 IN UINTN TokenNumber
,
878 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
880 @param ExTokenNumber Token number for dynamic-ex PCD.
881 @param Guid Token space guid for dynamic-ex PCD.
882 @param Data Value want to be set.
883 @param SetSize The size of value.
885 @return status of ExSetWorker().
890 IN UINTN ExTokenNumber
,
891 IN CONST EFI_GUID
*Guid
,
897 Set value for a dynamic PCD entry.
899 This routine find the local token number according to dynamic-ex PCD's token
900 space guid and token number firstly, and invoke callback function if this PCD
901 entry registered callback function. Finally, invoken general SetWorker to set
904 @param ExTokenNumber Dynamic-ex PCD token number.
905 @param Guid Token space guid for dynamic-ex PCD.
906 @param Data PCD value want to be set
907 @param SetSize Size of value.
908 @param PtrType If TRUE, this PCD entry is pointer type.
909 If FALSE, this PCD entry is not pointer type.
911 @return status of SetWorker().
916 IN UINTN ExTokenNumber
,
917 IN CONST EFI_GUID
*Guid
,
924 Get the PCD entry pointer in PCD database.
926 This routine will visit PCD database to find the PCD entry according to given
927 token number. The given token number is autogened by build tools and it will be
928 translated to local token number. Local token number contains PCD's type and
929 offset of PCD entry in PCD database.
931 @param TokenNumber Token's number, it is autogened by build tools
932 @param GetSize The size of token's value
934 @return PCD entry pointer in PCD database
939 IN UINTN TokenNumber
,
944 Wrapper function for get PCD value for dynamic-ex PCD.
946 @param Guid Token space guid for dynamic-ex PCD.
947 @param ExTokenNumber Token number for dynamic-ex PCD.
948 @param GetSize The size of dynamic-ex PCD value.
950 @return PCD entry in PCD database.
955 IN CONST EFI_GUID
*Guid
,
956 IN UINTN ExTokenNumber
,
961 Get Variable which contains HII type PCD entry.
963 @param VariableGuid Variable's guid
964 @param VariableName Variable's unicode name string
965 @param VariableData Variable's data pointer,
966 @param VariableSize Variable's size.
968 @return the status of gRT->GetVariable
972 IN EFI_GUID
*VariableGuid
,
973 IN UINT16
*VariableName
,
974 OUT UINT8
**VariableData
,
975 OUT UINTN
*VariableSize
979 Set value for HII-type PCD.
981 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
982 HII-type PCD is to visit this variable.
984 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
985 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
986 @param SetAttributes Attributes bitmask to set for the variable.
987 @param Data Value want to be set.
988 @param DataSize Size of value
989 @param Offset Value offset of HII-type PCD in variable.
991 @return status of GetVariable()/SetVariable().
996 IN EFI_GUID
*VariableGuid
,
997 IN UINT16
*VariableName
,
998 IN UINT32 SetAttributes
,
1005 Register the callback function for a PCD entry.
1007 This routine will register a callback function to a PCD entry by given token number
1008 and token space guid.
1010 @param TokenNumber PCD token's number, it is autogened by build tools.
1011 @param Guid PCD token space's guid,
1012 if not NULL, this PCD is dynamicEx type PCD.
1013 @param CallBackFunction Callback function pointer
1015 @return EFI_SUCCESS Always success for registering callback function.
1019 DxeRegisterCallBackWorker (
1020 IN UINTN TokenNumber
,
1021 IN CONST EFI_GUID
*Guid
, OPTIONAL
1022 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1026 UnRegister the callback function for a PCD entry.
1028 This routine will unregister a callback function to a PCD entry by given token number
1029 and token space guid.
1031 @param TokenNumber PCD token's number, it is autogened by build tools.
1032 @param Guid PCD token space's guid.
1033 if not NULL, this PCD is dynamicEx type PCD.
1034 @param CallBackFunction Callback function pointer
1036 @retval EFI_SUCCESS Callback function is success to be unregister.
1037 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
1040 DxeUnRegisterCallBackWorker (
1041 IN UINTN TokenNumber
,
1042 IN CONST EFI_GUID
*Guid
, OPTIONAL
1043 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1047 Initialize the PCD database in DXE phase.
1049 PCD database in DXE phase also contains PCD database in PEI phase which is copied
1054 BuildPcdDxeDataBase (
1059 Get Token Number according to dynamic-ex PCD's {token space guid:token number}
1061 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1062 in DEC file. PCD database maintain a mapping table that translate pair of {token
1063 space guid: token number} to Token Number.
1065 @param Guid Token space guid for dynamic-ex PCD entry.
1066 @param ExTokenNumber Dynamic-ex PCD token number.
1068 @return Token Number for dynamic-ex PCD.
1072 GetExPcdTokenNumber (
1073 IN CONST EFI_GUID
*Guid
,
1074 IN UINT32 ExTokenNumber
1078 Get next token number in given token space.
1080 This routine is used for dynamicEx type PCD. It will firstly scan token space
1081 table to get token space according to given token space guid. Then scan given
1082 token number in found token space, if found, then return next token number in
1085 @param Guid Token space guid. Next token number will be scaned in
1087 @param TokenNumber Token number.
1088 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1090 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1091 in token space table.
1092 @param GuidTable Token space guid table. It will be used for scan token space
1093 by given token space guid.
1094 @param SizeOfGuidTable The size of guid table.
1095 @param ExMapTable DynamicEx token number mapping table.
1096 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1098 @retval EFI_NOT_FOUND Can not given token space or token number.
1099 @retval EFI_SUCCESS Success to get next token number.
1103 ExGetNextTokeNumber (
1104 IN CONST EFI_GUID
*Guid
,
1105 IN OUT UINTN
*TokenNumber
,
1106 IN EFI_GUID
*GuidTable
,
1107 IN UINTN SizeOfGuidTable
,
1108 IN DYNAMICEX_MAPPING
*ExMapTable
,
1109 IN UINTN SizeOfExMapTable
1113 Get size of POINTER type PCD value.
1115 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1116 @param MaxSize Maximum size of POINTER type PCD value.
1118 @return size of POINTER type PCD value.
1123 IN UINTN LocalTokenNumberTableIdx
,
1128 Set size of POINTER type PCD value. The size should not exceed the maximum size
1131 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1132 @param CurrentSize Size of POINTER type PCD value.
1134 @retval TRUE Success to set size of PCD value.
1135 @retval FALSE Fail to set size of PCD value.
1139 IN UINTN LocalTokenNumberTableIdx
,
1140 IN OUT UINTN
*CurrentSize
1144 VariableLockProtocol callback
1145 to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.
1147 @param[in] Event Event whose notification function is being invoked.
1148 @param[in] Context Pointer to the notification function's context.
1153 VariableLockCallBack (
1159 Update PCD database base on current SkuId
1161 @param SkuId Current SkuId
1162 @param IsPeiDb Whether to update PEI PCD database.
1164 @retval EFI_SUCCESS Update PCD database successfully.
1165 @retval EFI_NOT_FOUND Not found PCD database for current SkuId.
1173 extern PCD_DATABASE mPcdDatabase
;
1175 extern UINT32 mPcdTotalTokenCount
;
1176 extern UINT32 mPeiLocalTokenCount
;
1177 extern UINT32 mDxeLocalTokenCount
;
1178 extern UINT32 mPeiNexTokenCount
;
1179 extern UINT32 mDxeNexTokenCount
;
1180 extern UINT32 mPeiExMapppingTableSize
;
1181 extern UINT32 mDxeExMapppingTableSize
;
1182 extern UINT32 mPeiGuidTableSize
;
1183 extern UINT32 mDxeGuidTableSize
;
1185 extern BOOLEAN mPeiExMapTableEmpty
;
1186 extern BOOLEAN mDxeExMapTableEmpty
;
1187 extern BOOLEAN mPeiDatabaseEmpty
;
1189 extern EFI_GUID
**TmpTokenSpaceBuffer
;
1190 extern UINTN TmpTokenSpaceBufferCount
;
1192 extern EFI_LOCK mPcdDatabaseLock
;