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."
52 Retrieve additional information associated with a PCD token in the default token space.
54 This includes information such as the type of value the TokenNumber is associated with as well as possible
55 human readable name that is associated with the token.
57 @param[in] TokenNumber The PCD token number.
58 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
59 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
61 @retval EFI_SUCCESS The PCD information was returned successfully.
62 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
66 DxeGetPcdInfoGetInfo (
68 OUT EFI_PCD_INFO
*PcdInfo
72 Retrieve additional information associated with a PCD token.
74 This includes information such as the type of value the TokenNumber is associated with as well as possible
75 human readable name that is associated with the token.
77 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
78 @param[in] TokenNumber The PCD token number.
79 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
80 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
82 @retval EFI_SUCCESS The PCD information was returned successfully.
83 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
87 DxeGetPcdInfoGetInfoEx (
88 IN CONST EFI_GUID
*Guid
,
90 OUT EFI_PCD_INFO
*PcdInfo
94 Retrieve the currently set SKU Id.
96 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
97 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
102 DxeGetPcdInfoGetSku (
107 // Protocol Interface function declaration.
110 Sets the SKU value for subsequent calls to set or get PCD token values.
112 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
113 SetSku() is normally called only once by the system.
115 For each item (token), the database can hold a single value that applies to all SKUs,
116 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
117 SKU-specific values are called SKU enabled.
119 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
120 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
121 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
122 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
123 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
124 set for that Id, the results are unpredictable.
126 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
127 set values associated with a PCD token.
137 Retrieves an 8-bit value for a given PCD token.
139 Retrieves the current byte-sized value for a PCD token number.
140 If the TokenNumber is invalid, the results are unpredictable.
142 @param[in] TokenNumber The PCD token number.
144 @return The UINT8 value.
154 Retrieves an 16-bit value for a given PCD token.
156 Retrieves the current 16-bits value for a PCD token number.
157 If the TokenNumber is invalid, the results are unpredictable.
159 @param[in] TokenNumber The PCD token number.
161 @return The UINT16 value.
171 Retrieves an 32-bit value for a given PCD token.
173 Retrieves the current 32-bits value for a PCD token number.
174 If the TokenNumber is invalid, the results are unpredictable.
176 @param[in] TokenNumber The PCD token number.
178 @return The UINT32 value.
188 Retrieves an 64-bit value for a given PCD token.
190 Retrieves the current 64-bits value for a PCD token number.
191 If the TokenNumber is invalid, the results are unpredictable.
193 @param[in] TokenNumber The PCD token number.
195 @return The UINT64 value.
205 Retrieves a pointer to a value for a given PCD token.
207 Retrieves the current pointer to the buffer for a PCD token number.
208 Do not make any assumptions about the alignment of the pointer that
209 is returned by this function call. If the TokenNumber is invalid,
210 the results are unpredictable.
212 @param[in] TokenNumber The PCD token number.
214 @return The pointer to the buffer to be retrieved.
224 Retrieves a Boolean value for a given PCD token.
226 Retrieves the current boolean value for a PCD token number.
227 Do not make any assumptions about the alignment of the pointer that
228 is returned by this function call. If the TokenNumber is invalid,
229 the results are unpredictable.
231 @param[in] TokenNumber The PCD token number.
233 @return The Boolean value.
243 Retrieves the size of the value for a given PCD token.
245 Retrieves the current size of a particular PCD token.
246 If the TokenNumber is invalid, the results are unpredictable.
248 @param[in] TokenNumber The PCD token number.
250 @return The size of the value for the PCD token.
260 Retrieves an 8-bit value for a given PCD token.
262 Retrieves the 8-bit value of a particular PCD token.
263 If the TokenNumber is invalid or the token space
264 specified by Guid does not exist, the results are
267 @param[in] Guid The token space for the token number.
268 @param[in] TokenNumber The PCD token number.
270 @return The size 8-bit value for the PCD token.
276 IN CONST EFI_GUID
*Guid
,
281 Retrieves an 16-bit value for a given PCD token.
283 Retrieves the 16-bit value of a particular PCD token.
284 If the TokenNumber is invalid or the token space
285 specified by Guid does not exist, the results are
288 @param[in] Guid The token space for the token number.
289 @param[in] TokenNumber The PCD token number.
291 @return The size 16-bit value for the PCD token.
297 IN CONST EFI_GUID
*Guid
,
302 Retrieves an 32-bit value for a given PCD token.
304 Retrieves the 32-bit value of a particular PCD token.
305 If the TokenNumber is invalid or the token space
306 specified by Guid does not exist, the results are
309 @param[in] Guid The token space for the token number.
310 @param[in] TokenNumber The PCD token number.
312 @return The size 32-bit value for the PCD token.
318 IN CONST EFI_GUID
*Guid
,
323 Retrieves an 64-bit value for a given PCD token.
325 Retrieves the 64-bit value of a particular PCD token.
326 If the TokenNumber is invalid or the token space
327 specified by Guid does not exist, the results are
330 @param[in] Guid The token space for the token number.
331 @param[in] TokenNumber The PCD token number.
333 @return The size 64-bit value for the PCD token.
339 IN CONST EFI_GUID
*Guid
,
344 Retrieves a pointer to a value for a given PCD token.
346 Retrieves the current pointer to the buffer for a PCD token number.
347 Do not make any assumptions about the alignment of the pointer that
348 is returned by this function call. If the TokenNumber is invalid,
349 the results are unpredictable.
351 @param[in] Guid The token space for the token number.
352 @param[in] TokenNumber The PCD token number.
354 @return The pointer to the buffer to be retrieved.
360 IN CONST EFI_GUID
*Guid
,
365 Retrieves an Boolean value for a given PCD token.
367 Retrieves the Boolean value of a particular PCD token.
368 If the TokenNumber is invalid or the token space
369 specified by Guid does not exist, the results are
372 @param[in] Guid The token space for the token number.
373 @param[in] TokenNumber The PCD token number.
375 @return The size Boolean value for the PCD token.
381 IN CONST EFI_GUID
*Guid
,
386 Retrieves the size of the value for a given PCD token.
388 Retrieves the current size of a particular PCD token.
389 If the TokenNumber is invalid, the results are unpredictable.
391 @param[in] Guid The token space for the token number.
392 @param[in] TokenNumber The PCD token number.
394 @return The size of the value for the PCD token.
400 IN CONST EFI_GUID
*Guid
,
405 Sets an 8-bit value for a given PCD token.
407 When the PCD service sets a value, it will check to ensure that the
408 size of the value being set is compatible with the Token's existing definition.
409 If it is not, an error will be returned.
411 @param[in] TokenNumber The PCD token number.
412 @param[in] Value The value to set for the PCD token.
414 @retval EFI_SUCCESS Procedure returned successfully.
415 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
416 being set was incompatible with a call to this function.
417 Use GetSize() to retrieve the size of the target data.
418 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
424 IN UINTN TokenNumber
,
429 Sets an 16-bit value for a given PCD token.
431 When the PCD service sets a value, it will check to ensure that the
432 size of the value being set is compatible with the Token's existing definition.
433 If it is not, an error will be returned.
435 @param[in] TokenNumber The PCD token number.
436 @param[in] Value The value to set for the PCD token.
438 @retval EFI_SUCCESS Procedure returned successfully.
439 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
440 being set was incompatible with a call to this function.
441 Use GetSize() to retrieve the size of the target data.
442 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
448 IN UINTN TokenNumber
,
453 Sets an 32-bit value for a given PCD token.
455 When the PCD service sets a value, it will check to ensure that the
456 size of the value being set is compatible with the Token's existing definition.
457 If it is not, an error will be returned.
459 @param[in] TokenNumber The PCD token number.
460 @param[in] Value The value to set for the PCD token.
462 @retval EFI_SUCCESS Procedure returned successfully.
463 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
464 being set was incompatible with a call to this function.
465 Use GetSize() to retrieve the size of the target data.
466 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
472 IN UINTN TokenNumber
,
477 Sets an 64-bit value for a given PCD token.
479 When the PCD service sets a value, it will check to ensure that the
480 size of the value being set is compatible with the Token's existing definition.
481 If it is not, an error will be returned.
483 @param[in] TokenNumber The PCD token number.
484 @param[in] Value The value to set for the PCD token.
486 @retval EFI_SUCCESS Procedure returned successfully.
487 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
488 being set was incompatible with a call to this function.
489 Use GetSize() to retrieve the size of the target data.
490 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
496 IN UINTN TokenNumber
,
502 Sets a value of a specified size for a given PCD token.
504 When the PCD service sets a value, it will check to ensure that the
505 size of the value being set is compatible with the Token's existing definition.
506 If it is not, an error will be returned.
508 @param[in] TokenNumber The PCD token number.
509 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
510 On input, if the SizeOfValue is greater than the maximum size supported
511 for this TokenNumber then the output value of SizeOfValue will reflect
512 the maximum size supported for this TokenNumber.
513 @param[in] Buffer The buffer to set for the PCD token.
515 @retval EFI_SUCCESS Procedure returned successfully.
516 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
517 being set was incompatible with a call to this function.
518 Use GetSize() to retrieve the size of the target data.
519 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
525 IN UINTN TokenNumber
,
526 IN OUT UINTN
*SizeOfBuffer
,
531 Sets an Boolean value for a given PCD token.
533 When the PCD service sets a value, it will check to ensure that the
534 size of the value being set is compatible with the Token's existing definition.
535 If it is not, an error will be returned.
537 @param[in] TokenNumber The PCD token number.
538 @param[in] Value The value to set for the PCD token.
540 @retval EFI_SUCCESS Procedure returned successfully.
541 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
542 being set was incompatible with a call to this function.
543 Use GetSize() to retrieve the size of the target data.
544 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
550 IN UINTN TokenNumber
,
556 Sets an 8-bit value for a given PCD token.
558 When the PCD service sets a value, it will check to ensure that the
559 size of the value being set is compatible with the Token's existing definition.
560 If it is not, an error will be returned.
562 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
563 @param[in] TokenNumber The PCD token number.
564 @param[in] Value The value to set for the PCD token.
566 @retval EFI_SUCCESS Procedure returned successfully.
567 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
568 being set was incompatible with a call to this function.
569 Use GetSize() to retrieve the size of the target data.
570 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
576 IN CONST EFI_GUID
*Guid
,
577 IN UINTN TokenNumber
,
582 Sets an 16-bit value for a given PCD token.
584 When the PCD service sets a value, it will check to ensure that the
585 size of the value being set is compatible with the Token's existing definition.
586 If it is not, an error will be returned.
588 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
589 @param[in] TokenNumber The PCD token number.
590 @param[in] Value The value to set for the PCD token.
592 @retval EFI_SUCCESS Procedure returned successfully.
593 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
594 being set was incompatible with a call to this function.
595 Use GetSize() to retrieve the size of the target data.
596 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
602 IN CONST EFI_GUID
*Guid
,
603 IN UINTN TokenNumber
,
608 Sets an 32-bit value for a given PCD token.
610 When the PCD service sets a value, it will check to ensure that the
611 size of the value being set is compatible with the Token's existing definition.
612 If it is not, an error will be returned.
614 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
615 @param[in] TokenNumber The PCD token number.
616 @param[in] Value The value to set for the PCD token.
618 @retval EFI_SUCCESS Procedure returned successfully.
619 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
620 being set was incompatible with a call to this function.
621 Use GetSize() to retrieve the size of the target data.
622 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
628 IN CONST EFI_GUID
*Guid
,
629 IN UINTN TokenNumber
,
634 Sets an 64-bit value for a given PCD token.
636 When the PCD service sets a value, it will check to ensure that the
637 size of the value being set is compatible with the Token's existing definition.
638 If it is not, an error will be returned.
640 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
641 @param[in] TokenNumber The PCD token number.
642 @param[in] Value The value to set for the PCD token.
644 @retval EFI_SUCCESS Procedure returned successfully.
645 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
646 being set was incompatible with a call to this function.
647 Use GetSize() to retrieve the size of the target data.
648 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
654 IN CONST EFI_GUID
*Guid
,
655 IN UINTN TokenNumber
,
660 Sets a value of a specified size for a given PCD token.
662 When the PCD service sets a value, it will check to ensure that the
663 size of the value being set is compatible with the Token's existing definition.
664 If it is not, an error will be returned.
666 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
667 @param[in] TokenNumber The PCD token number.
668 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
669 On input, if the SizeOfValue is greater than the maximum size supported
670 for this TokenNumber then the output value of SizeOfValue will reflect
671 the maximum size supported for this TokenNumber.
672 @param[in] Buffer The buffer to set for the PCD token.
674 @retval EFI_SUCCESS Procedure returned successfully.
675 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
676 being set was incompatible with a call to this function.
677 Use GetSize() to retrieve the size of the target data.
678 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
684 IN CONST EFI_GUID
*Guid
,
685 IN UINTN TokenNumber
,
686 IN OUT UINTN
*SizeOfBuffer
,
691 Sets an Boolean value for a given PCD token.
693 When the PCD service sets a value, it will check to ensure that the
694 size of the value being set is compatible with the Token's existing definition.
695 If it is not, an error will be returned.
697 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
698 @param[in] TokenNumber The PCD token number.
699 @param[in] Value The value to set for the PCD token.
701 @retval EFI_SUCCESS Procedure returned successfully.
702 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
703 being set was incompatible with a call to this function.
704 Use GetSize() to retrieve the size of the target data.
705 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
711 IN CONST EFI_GUID
*Guid
,
712 IN UINTN TokenNumber
,
717 Specifies a function to be called anytime the value of a designated token is changed.
719 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
720 @param[in] TokenNumber The PCD token number.
721 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
723 @retval EFI_SUCCESS The PCD service has successfully established a call event
724 for the CallBackToken requested.
725 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
730 DxeRegisterCallBackOnSet (
731 IN CONST EFI_GUID
*Guid
, OPTIONAL
732 IN UINTN TokenNumber
,
733 IN PCD_PROTOCOL_CALLBACK CallBackFunction
737 Cancels a previously set callback function for a particular PCD token number.
739 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
740 @param[in] TokenNumber The PCD token number.
741 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
743 @retval EFI_SUCCESS The PCD service has successfully established a call event
744 for the CallBackToken requested.
745 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
750 DxeUnRegisterCallBackOnSet (
751 IN CONST EFI_GUID
*Guid
, OPTIONAL
752 IN UINTN TokenNumber
,
753 IN PCD_PROTOCOL_CALLBACK CallBackFunction
757 Retrieves the next valid token number in a given namespace.
759 This is useful since the PCD infrastructure contains a sparse list of token numbers,
760 and one cannot a priori know what token numbers are valid in the database.
762 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
763 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
764 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
765 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
766 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
767 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
768 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
769 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
772 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
773 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
774 being made to retrieve tokens from the default token space.
775 @param[in, out] TokenNumber
776 A pointer to the PCD token number to use to find the subsequent token number.
778 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
779 is already the last valid token number in the PCD database.
780 In the later case, *TokenNumber is updated with the value of 0.
781 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
787 IN CONST EFI_GUID
*Guid
, OPTIONAL
788 IN OUT UINTN
*TokenNumber
792 Get next token space in PCD database according to given token space guid.
794 @param Guid Given token space guid. If NULL, then Guid will be set to
795 the first PCD token space in PCD database, If not NULL, then
796 Guid will be set to next PCD token space.
798 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
799 token space in PCD database.
800 @retval EFI_SUCCESS Success to get next token space guid.
804 DxePcdGetNextTokenSpace (
805 IN OUT CONST EFI_GUID
**Guid
810 PCD_PROTOCOL_CALLBACK CallbackFn
;
813 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
816 // Internal Functions
820 Retrieve additional information associated with a PCD token.
822 This includes information such as the type of value the TokenNumber is associated with as well as possible
823 human readable name that is associated with the token.
825 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
826 @param[in] TokenNumber The PCD token number.
827 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
828 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
830 @retval EFI_SUCCESS The PCD information was returned successfully
831 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
835 IN CONST EFI_GUID
*Guid
,
836 IN UINTN TokenNumber
,
837 OUT EFI_PCD_INFO
*PcdInfo
841 Wrapper function for setting non-pointer type value for a PCD entry.
843 @param TokenNumber Pcd token number autogenerated by build tools.
844 @param Data Value want to be set for PCD entry
845 @param Size Size of value.
847 @return status of SetWorker.
852 IN UINTN TokenNumber
,
858 Set value for an PCD entry
860 @param TokenNumber Pcd token number autogenerated by build tools.
861 @param Data Value want to be set for PCD entry
862 @param Size Size of value.
863 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
864 If False, the type of PCD entry's value is not Pointer.
866 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
867 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
868 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
869 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
870 range of UINT8, UINT16, UINT32, UINT64
871 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
875 IN UINTN TokenNumber
,
882 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
884 @param ExTokenNumber Token number for dynamic-ex PCD.
885 @param Guid Token space guid for dynamic-ex PCD.
886 @param Data Value want to be set.
887 @param SetSize The size of value.
889 @return status of ExSetWorker().
894 IN UINTN ExTokenNumber
,
895 IN CONST EFI_GUID
*Guid
,
901 Set value for a dynamic PCD entry.
903 This routine find the local token number according to dynamic-ex PCD's token
904 space guid and token number firstly, and invoke callback function if this PCD
905 entry registered callback function. Finally, invoken general SetWorker to set
908 @param ExTokenNumber Dynamic-ex PCD token number.
909 @param Guid Token space guid for dynamic-ex PCD.
910 @param Data PCD value want to be set
911 @param SetSize Size of value.
912 @param PtrType If TRUE, this PCD entry is pointer type.
913 If FALSE, this PCD entry is not pointer type.
915 @return status of SetWorker().
920 IN UINTN ExTokenNumber
,
921 IN CONST EFI_GUID
*Guid
,
928 Get the PCD entry pointer in PCD database.
930 This routine will visit PCD database to find the PCD entry according to given
931 token number. The given token number is autogened by build tools and it will be
932 translated to local token number. Local token number contains PCD's type and
933 offset of PCD entry in PCD database.
935 @param TokenNumber Token's number, it is autogened by build tools
936 @param GetSize The size of token's value
938 @return PCD entry pointer in PCD database
943 IN UINTN TokenNumber
,
948 Wrapper function for get PCD value for dynamic-ex PCD.
950 @param Guid Token space guid for dynamic-ex PCD.
951 @param ExTokenNumber Token number for dynamic-ex PCD.
952 @param GetSize The size of dynamic-ex PCD value.
954 @return PCD entry in PCD database.
959 IN CONST EFI_GUID
*Guid
,
960 IN UINTN ExTokenNumber
,
965 Get Variable which contains HII type PCD entry.
967 @param VariableGuid Variable's guid
968 @param VariableName Variable's unicode name string
969 @param VariableData Variable's data pointer,
970 @param VariableSize Variable's size.
972 @return the status of gRT->GetVariable
976 IN EFI_GUID
*VariableGuid
,
977 IN UINT16
*VariableName
,
978 OUT UINT8
**VariableData
,
979 OUT UINTN
*VariableSize
983 Set value for HII-type PCD.
985 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
986 HII-type PCD is to visit this variable.
988 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
989 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
990 @param SetAttributes Attributes bitmask to set for the variable.
991 @param Data Value want to be set.
992 @param DataSize Size of value
993 @param Offset Value offset of HII-type PCD in variable.
995 @return status of GetVariable()/SetVariable().
1000 IN EFI_GUID
*VariableGuid
,
1001 IN UINT16
*VariableName
,
1002 IN UINT32 SetAttributes
,
1003 IN CONST VOID
*Data
,
1009 Register the callback function for a PCD entry.
1011 This routine will register a callback function to a PCD entry by given token number
1012 and token space guid.
1014 @param TokenNumber PCD token's number, it is autogened by build tools.
1015 @param Guid PCD token space's guid,
1016 if not NULL, this PCD is dynamicEx type PCD.
1017 @param CallBackFunction Callback function pointer
1019 @return EFI_SUCCESS Always success for registering callback function.
1023 DxeRegisterCallBackWorker (
1024 IN UINTN TokenNumber
,
1025 IN CONST EFI_GUID
*Guid
, OPTIONAL
1026 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1030 UnRegister the callback function for a PCD entry.
1032 This routine will unregister a callback function to a PCD entry by given token number
1033 and token space guid.
1035 @param TokenNumber PCD token's number, it is autogened by build tools.
1036 @param Guid PCD token space's guid.
1037 if not NULL, this PCD is dynamicEx type PCD.
1038 @param CallBackFunction Callback function pointer
1040 @retval EFI_SUCCESS Callback function is success to be unregister.
1041 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
1044 DxeUnRegisterCallBackWorker (
1045 IN UINTN TokenNumber
,
1046 IN CONST EFI_GUID
*Guid
, OPTIONAL
1047 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1051 Initialize the PCD database in DXE phase.
1053 PCD database in DXE phase also contains PCD database in PEI phase which is copied
1058 BuildPcdDxeDataBase (
1063 Get Token Number according to dynamic-ex PCD's {token space guid:token number}
1065 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1066 in DEC file. PCD database maintain a mapping table that translate pair of {token
1067 space guid: token number} to Token Number.
1069 @param Guid Token space guid for dynamic-ex PCD entry.
1070 @param ExTokenNumber Dynamic-ex PCD token number.
1072 @return Token Number for dynamic-ex PCD.
1076 GetExPcdTokenNumber (
1077 IN CONST EFI_GUID
*Guid
,
1078 IN UINT32 ExTokenNumber
1082 Get next token number in given token space.
1084 This routine is used for dynamicEx type PCD. It will firstly scan token space
1085 table to get token space according to given token space guid. Then scan given
1086 token number in found token space, if found, then return next token number in
1089 @param Guid Token space guid. Next token number will be scaned in
1091 @param TokenNumber Token number.
1092 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1094 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1095 in token space table.
1096 @param GuidTable Token space guid table. It will be used for scan token space
1097 by given token space guid.
1098 @param SizeOfGuidTable The size of guid table.
1099 @param ExMapTable DynamicEx token number mapping table.
1100 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1102 @retval EFI_NOT_FOUND Can not given token space or token number.
1103 @retval EFI_SUCCESS Success to get next token number.
1107 ExGetNextTokeNumber (
1108 IN CONST EFI_GUID
*Guid
,
1109 IN OUT UINTN
*TokenNumber
,
1110 IN EFI_GUID
*GuidTable
,
1111 IN UINTN SizeOfGuidTable
,
1112 IN DYNAMICEX_MAPPING
*ExMapTable
,
1113 IN UINTN SizeOfExMapTable
1117 Get size of POINTER type PCD value.
1119 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1120 @param MaxSize Maximum size of POINTER type PCD value.
1122 @return size of POINTER type PCD value.
1127 IN UINTN LocalTokenNumberTableIdx
,
1132 Set size of POINTER type PCD value. The size should not exceed the maximum size
1135 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1136 @param CurrentSize Size of POINTER type PCD value.
1138 @retval TRUE Success to set size of PCD value.
1139 @retval FALSE Fail to set size of PCD value.
1143 IN UINTN LocalTokenNumberTableIdx
,
1144 IN OUT UINTN
*CurrentSize
1148 VariableLockProtocol callback
1149 to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.
1151 @param[in] Event Event whose notification function is being invoked.
1152 @param[in] Context Pointer to the notification function's context.
1157 VariableLockCallBack (
1163 Update PCD database base on current SkuId
1165 @param SkuId Current SkuId
1166 @param IsPeiDb Whether to update PEI PCD database.
1168 @retval EFI_SUCCESS Update PCD database successfully.
1169 @retval EFI_NOT_FOUND Not found PCD database for current SkuId.
1177 extern PCD_DATABASE mPcdDatabase
;
1179 extern UINT32 mPcdTotalTokenCount
;
1180 extern UINT32 mPeiLocalTokenCount
;
1181 extern UINT32 mDxeLocalTokenCount
;
1182 extern UINT32 mPeiNexTokenCount
;
1183 extern UINT32 mDxeNexTokenCount
;
1184 extern UINT32 mPeiExMapppingTableSize
;
1185 extern UINT32 mDxeExMapppingTableSize
;
1186 extern UINT32 mPeiGuidTableSize
;
1187 extern UINT32 mDxeGuidTableSize
;
1189 extern BOOLEAN mPeiExMapTableEmpty
;
1190 extern BOOLEAN mDxeExMapTableEmpty
;
1191 extern BOOLEAN mPeiDatabaseEmpty
;
1193 extern EFI_GUID
**TmpTokenSpaceBuffer
;
1194 extern UINTN TmpTokenSpaceBufferCount
;
1196 extern EFI_LOCK mPcdDatabaseLock
;