2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2013, 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 <Library/BaseLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/UefiLib.h>
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/PcdLib.h>
30 #include <Library/HobLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/BaseMemoryLib.h>
34 #include <Library/UefiRuntimeServicesTableLib.h>
37 // Please make sure the PCD Serivce DXE Version is consistent with
38 // the version of the generated DXE PCD Database by build tool.
40 #define PCD_SERVICE_DXE_VERSION 4
43 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
45 #if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)
46 #error "Please make sure the version of PCD DXE Service and the generated PCD DXE Database match."
50 Retrieve additional information associated with a PCD token in the default token space.
52 This includes information such as the type of value the TokenNumber is associated with as well as possible
53 human readable name that is associated with the token.
55 @param[in] TokenNumber The PCD token number.
56 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
57 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
59 @retval EFI_SUCCESS The PCD information was returned successfully.
60 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
64 DxeGetPcdInfoGetInfo (
66 OUT EFI_PCD_INFO
*PcdInfo
70 Retrieve additional information associated with a PCD token.
72 This includes information such as the type of value the TokenNumber is associated with as well as possible
73 human readable name that is associated with the token.
75 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
76 @param[in] TokenNumber The PCD token number.
77 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
78 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
80 @retval EFI_SUCCESS The PCD information was returned successfully.
81 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
85 DxeGetPcdInfoGetInfoEx (
86 IN CONST EFI_GUID
*Guid
,
88 OUT EFI_PCD_INFO
*PcdInfo
92 Retrieve the currently set SKU Id.
94 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
95 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
100 DxeGetPcdInfoGetSku (
105 // Protocol Interface function declaration.
108 Sets the SKU value for subsequent calls to set or get PCD token values.
110 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
111 SetSku() is normally called only once by the system.
113 For each item (token), the database can hold a single value that applies to all SKUs,
114 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
115 SKU-specific values are called SKU enabled.
117 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
118 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
119 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
120 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
121 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
122 set for that Id, the results are unpredictable.
124 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
125 set values associated with a PCD token.
135 Retrieves an 8-bit value for a given PCD token.
137 Retrieves the current byte-sized value for a PCD token number.
138 If the TokenNumber is invalid, the results are unpredictable.
140 @param[in] TokenNumber The PCD token number.
142 @return The UINT8 value.
152 Retrieves an 16-bit value for a given PCD token.
154 Retrieves the current 16-bits value for a PCD token number.
155 If the TokenNumber is invalid, the results are unpredictable.
157 @param[in] TokenNumber The PCD token number.
159 @return The UINT16 value.
169 Retrieves an 32-bit value for a given PCD token.
171 Retrieves the current 32-bits value for a PCD token number.
172 If the TokenNumber is invalid, the results are unpredictable.
174 @param[in] TokenNumber The PCD token number.
176 @return The UINT32 value.
186 Retrieves an 64-bit value for a given PCD token.
188 Retrieves the current 64-bits value for a PCD token number.
189 If the TokenNumber is invalid, the results are unpredictable.
191 @param[in] TokenNumber The PCD token number.
193 @return The UINT64 value.
203 Retrieves a pointer to a value for a given PCD token.
205 Retrieves the current pointer to the buffer for a PCD token number.
206 Do not make any assumptions about the alignment of the pointer that
207 is returned by this function call. If the TokenNumber is invalid,
208 the results are unpredictable.
210 @param[in] TokenNumber The PCD token number.
212 @return The pointer to the buffer to be retrieved.
222 Retrieves a Boolean value for a given PCD token.
224 Retrieves the current boolean value for a PCD token number.
225 Do not make any assumptions about the alignment of the pointer that
226 is returned by this function call. If the TokenNumber is invalid,
227 the results are unpredictable.
229 @param[in] TokenNumber The PCD token number.
231 @return The Boolean value.
241 Retrieves the size of the value for a given PCD token.
243 Retrieves the current size of a particular PCD token.
244 If the TokenNumber is invalid, the results are unpredictable.
246 @param[in] TokenNumber The PCD token number.
248 @return The size of the value for the PCD token.
258 Retrieves an 8-bit value for a given PCD token.
260 Retrieves the 8-bit value of a particular PCD token.
261 If the TokenNumber is invalid or the token space
262 specified by Guid does not exist, the results are
265 @param[in] Guid The token space for the token number.
266 @param[in] TokenNumber The PCD token number.
268 @return The size 8-bit value for the PCD token.
274 IN CONST EFI_GUID
*Guid
,
279 Retrieves an 16-bit value for a given PCD token.
281 Retrieves the 16-bit value of a particular PCD token.
282 If the TokenNumber is invalid or the token space
283 specified by Guid does not exist, the results are
286 @param[in] Guid The token space for the token number.
287 @param[in] TokenNumber The PCD token number.
289 @return The size 16-bit value for the PCD token.
295 IN CONST EFI_GUID
*Guid
,
300 Retrieves an 32-bit value for a given PCD token.
302 Retrieves the 32-bit value of a particular PCD token.
303 If the TokenNumber is invalid or the token space
304 specified by Guid does not exist, the results are
307 @param[in] Guid The token space for the token number.
308 @param[in] TokenNumber The PCD token number.
310 @return The size 32-bit value for the PCD token.
316 IN CONST EFI_GUID
*Guid
,
321 Retrieves an 64-bit value for a given PCD token.
323 Retrieves the 64-bit value of a particular PCD token.
324 If the TokenNumber is invalid or the token space
325 specified by Guid does not exist, the results are
328 @param[in] Guid The token space for the token number.
329 @param[in] TokenNumber The PCD token number.
331 @return The size 64-bit value for the PCD token.
337 IN CONST EFI_GUID
*Guid
,
342 Retrieves a pointer to a value for a given PCD token.
344 Retrieves the current pointer to the buffer for a PCD token number.
345 Do not make any assumptions about the alignment of the pointer that
346 is returned by this function call. If the TokenNumber is invalid,
347 the results are unpredictable.
349 @param[in] Guid The token space for the token number.
350 @param[in] TokenNumber The PCD token number.
352 @return The pointer to the buffer to be retrieved.
358 IN CONST EFI_GUID
*Guid
,
363 Retrieves an Boolean value for a given PCD token.
365 Retrieves the Boolean value of a particular PCD token.
366 If the TokenNumber is invalid or the token space
367 specified by Guid does not exist, the results are
370 @param[in] Guid The token space for the token number.
371 @param[in] TokenNumber The PCD token number.
373 @return The size Boolean value for the PCD token.
379 IN CONST EFI_GUID
*Guid
,
384 Retrieves the size of the value for a given PCD token.
386 Retrieves the current size of a particular PCD token.
387 If the TokenNumber is invalid, the results are unpredictable.
389 @param[in] Guid The token space for the token number.
390 @param[in] TokenNumber The PCD token number.
392 @return The size of the value for the PCD token.
398 IN CONST EFI_GUID
*Guid
,
403 Sets an 8-bit value for a given PCD token.
405 When the PCD service sets a value, it will check to ensure that the
406 size of the value being set is compatible with the Token's existing definition.
407 If it is not, an error will be returned.
409 @param[in] TokenNumber The PCD token number.
410 @param[in] Value The value to set for the PCD token.
412 @retval EFI_SUCCESS Procedure returned successfully.
413 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
414 being set was incompatible with a call to this function.
415 Use GetSize() to retrieve the size of the target data.
416 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
422 IN UINTN TokenNumber
,
427 Sets an 16-bit value for a given PCD token.
429 When the PCD service sets a value, it will check to ensure that the
430 size of the value being set is compatible with the Token's existing definition.
431 If it is not, an error will be returned.
433 @param[in] TokenNumber The PCD token number.
434 @param[in] Value The value to set for the PCD token.
436 @retval EFI_SUCCESS Procedure returned successfully.
437 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
438 being set was incompatible with a call to this function.
439 Use GetSize() to retrieve the size of the target data.
440 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
446 IN UINTN TokenNumber
,
451 Sets an 32-bit value for a given PCD token.
453 When the PCD service sets a value, it will check to ensure that the
454 size of the value being set is compatible with the Token's existing definition.
455 If it is not, an error will be returned.
457 @param[in] TokenNumber The PCD token number.
458 @param[in] Value The value to set for the PCD token.
460 @retval EFI_SUCCESS Procedure returned successfully.
461 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
462 being set was incompatible with a call to this function.
463 Use GetSize() to retrieve the size of the target data.
464 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
470 IN UINTN TokenNumber
,
475 Sets an 64-bit value for a given PCD token.
477 When the PCD service sets a value, it will check to ensure that the
478 size of the value being set is compatible with the Token's existing definition.
479 If it is not, an error will be returned.
481 @param[in] TokenNumber The PCD token number.
482 @param[in] Value The value to set for the PCD token.
484 @retval EFI_SUCCESS Procedure returned successfully.
485 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
486 being set was incompatible with a call to this function.
487 Use GetSize() to retrieve the size of the target data.
488 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
494 IN UINTN TokenNumber
,
500 Sets a value of a specified size for a given PCD token.
502 When the PCD service sets a value, it will check to ensure that the
503 size of the value being set is compatible with the Token's existing definition.
504 If it is not, an error will be returned.
506 @param[in] TokenNumber The PCD token number.
507 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
508 On input, if the SizeOfValue is greater than the maximum size supported
509 for this TokenNumber then the output value of SizeOfValue will reflect
510 the maximum size supported for this TokenNumber.
511 @param[in] Buffer The buffer to set for the PCD token.
513 @retval EFI_SUCCESS Procedure returned successfully.
514 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
515 being set was incompatible with a call to this function.
516 Use GetSize() to retrieve the size of the target data.
517 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
523 IN UINTN TokenNumber
,
524 IN OUT UINTN
*SizeOfBuffer
,
529 Sets an Boolean value for a given PCD token.
531 When the PCD service sets a value, it will check to ensure that the
532 size of the value being set is compatible with the Token's existing definition.
533 If it is not, an error will be returned.
535 @param[in] TokenNumber The PCD token number.
536 @param[in] Value The value to set for the PCD token.
538 @retval EFI_SUCCESS Procedure returned successfully.
539 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
540 being set was incompatible with a call to this function.
541 Use GetSize() to retrieve the size of the target data.
542 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
548 IN UINTN TokenNumber
,
554 Sets an 8-bit value for a given PCD token.
556 When the PCD service sets a value, it will check to ensure that the
557 size of the value being set is compatible with the Token's existing definition.
558 If it is not, an error will be returned.
560 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
561 @param[in] TokenNumber The PCD token number.
562 @param[in] Value The value to set for the PCD token.
564 @retval EFI_SUCCESS Procedure returned successfully.
565 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
566 being set was incompatible with a call to this function.
567 Use GetSize() to retrieve the size of the target data.
568 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
574 IN CONST EFI_GUID
*Guid
,
575 IN UINTN TokenNumber
,
580 Sets an 16-bit value for a given PCD token.
582 When the PCD service sets a value, it will check to ensure that the
583 size of the value being set is compatible with the Token's existing definition.
584 If it is not, an error will be returned.
586 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
587 @param[in] TokenNumber The PCD token number.
588 @param[in] Value The value to set for the PCD token.
590 @retval EFI_SUCCESS Procedure returned successfully.
591 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
592 being set was incompatible with a call to this function.
593 Use GetSize() to retrieve the size of the target data.
594 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
600 IN CONST EFI_GUID
*Guid
,
601 IN UINTN TokenNumber
,
606 Sets an 32-bit value for a given PCD token.
608 When the PCD service sets a value, it will check to ensure that the
609 size of the value being set is compatible with the Token's existing definition.
610 If it is not, an error will be returned.
612 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
613 @param[in] TokenNumber The PCD token number.
614 @param[in] Value The value to set for the PCD token.
616 @retval EFI_SUCCESS Procedure returned successfully.
617 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
618 being set was incompatible with a call to this function.
619 Use GetSize() to retrieve the size of the target data.
620 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
626 IN CONST EFI_GUID
*Guid
,
627 IN UINTN TokenNumber
,
632 Sets an 64-bit value for a given PCD token.
634 When the PCD service sets a value, it will check to ensure that the
635 size of the value being set is compatible with the Token's existing definition.
636 If it is not, an error will be returned.
638 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
639 @param[in] TokenNumber The PCD token number.
640 @param[in] Value The value to set for the PCD token.
642 @retval EFI_SUCCESS Procedure returned successfully.
643 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
644 being set was incompatible with a call to this function.
645 Use GetSize() to retrieve the size of the target data.
646 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
652 IN CONST EFI_GUID
*Guid
,
653 IN UINTN TokenNumber
,
658 Sets a value of a specified size for a given PCD token.
660 When the PCD service sets a value, it will check to ensure that the
661 size of the value being set is compatible with the Token's existing definition.
662 If it is not, an error will be returned.
664 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
665 @param[in] TokenNumber The PCD token number.
666 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
667 On input, if the SizeOfValue is greater than the maximum size supported
668 for this TokenNumber then the output value of SizeOfValue will reflect
669 the maximum size supported for this TokenNumber.
670 @param[in] Buffer The buffer to set for the PCD token.
672 @retval EFI_SUCCESS Procedure returned successfully.
673 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
674 being set was incompatible with a call to this function.
675 Use GetSize() to retrieve the size of the target data.
676 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
682 IN CONST EFI_GUID
*Guid
,
683 IN UINTN TokenNumber
,
684 IN OUT UINTN
*SizeOfBuffer
,
689 Sets an Boolean value for a given PCD token.
691 When the PCD service sets a value, it will check to ensure that the
692 size of the value being set is compatible with the Token's existing definition.
693 If it is not, an error will be returned.
695 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
696 @param[in] TokenNumber The PCD token number.
697 @param[in] Value The value to set for the PCD token.
699 @retval EFI_SUCCESS Procedure returned successfully.
700 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
701 being set was incompatible with a call to this function.
702 Use GetSize() to retrieve the size of the target data.
703 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
709 IN CONST EFI_GUID
*Guid
,
710 IN UINTN TokenNumber
,
715 Specifies a function to be called anytime the value of a designated token is changed.
717 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
718 @param[in] TokenNumber The PCD token number.
719 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
721 @retval EFI_SUCCESS The PCD service has successfully established a call event
722 for the CallBackToken requested.
723 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
728 DxeRegisterCallBackOnSet (
729 IN CONST EFI_GUID
*Guid
, OPTIONAL
730 IN UINTN TokenNumber
,
731 IN PCD_PROTOCOL_CALLBACK CallBackFunction
735 Cancels a previously set callback function for a particular PCD token number.
737 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
738 @param[in] TokenNumber The PCD token number.
739 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
741 @retval EFI_SUCCESS The PCD service has successfully established a call event
742 for the CallBackToken requested.
743 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
748 DxeUnRegisterCallBackOnSet (
749 IN CONST EFI_GUID
*Guid
, OPTIONAL
750 IN UINTN TokenNumber
,
751 IN PCD_PROTOCOL_CALLBACK CallBackFunction
755 Retrieves the next valid token number in a given namespace.
757 This is useful since the PCD infrastructure contains a sparse list of token numbers,
758 and one cannot a priori know what token numbers are valid in the database.
760 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
761 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
762 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
763 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
764 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
765 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
766 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
767 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
770 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
771 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
772 being made to retrieve tokens from the default token space.
773 @param[in, out] TokenNumber
774 A pointer to the PCD token number to use to find the subsequent token number.
776 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
777 is already the last valid token number in the PCD database.
778 In the later case, *TokenNumber is updated with the value of 0.
779 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
785 IN CONST EFI_GUID
*Guid
, OPTIONAL
786 IN OUT UINTN
*TokenNumber
790 Get next token space in PCD database according to given token space guid.
792 @param Guid Given token space guid. If NULL, then Guid will be set to
793 the first PCD token space in PCD database, If not NULL, then
794 Guid will be set to next PCD token space.
796 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
797 token space in PCD database.
798 @retval EFI_SUCCESS Success to get next token space guid.
802 DxePcdGetNextTokenSpace (
803 IN OUT CONST EFI_GUID
**Guid
808 PCD_PROTOCOL_CALLBACK CallbackFn
;
811 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
814 // Internal Functions
818 Retrieve additional information associated with a PCD token.
820 This includes information such as the type of value the TokenNumber is associated with as well as possible
821 human readable name that is associated with the token.
823 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
824 @param[in] TokenNumber The PCD token number.
825 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
826 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
828 @retval EFI_SUCCESS The PCD information was returned successfully
829 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
833 IN CONST EFI_GUID
*Guid
,
834 IN UINTN TokenNumber
,
835 OUT EFI_PCD_INFO
*PcdInfo
839 Wrapper function for setting non-pointer type value for a PCD entry.
841 @param TokenNumber Pcd token number autogenerated by build tools.
842 @param Data Value want to be set for PCD entry
843 @param Size Size of value.
845 @return status of SetWorker.
850 IN UINTN TokenNumber
,
856 Set value for an PCD entry
858 @param TokenNumber Pcd token number autogenerated by build tools.
859 @param Data Value want to be set for PCD entry
860 @param Size Size of value.
861 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
862 If False, the type of PCD entry's value is not Pointer.
864 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
865 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
866 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
867 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
868 range of UINT8, UINT16, UINT32, UINT64
869 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
873 IN UINTN TokenNumber
,
880 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
882 @param ExTokenNumber Token number for dynamic-ex PCD.
883 @param Guid Token space guid for dynamic-ex PCD.
884 @param Data Value want to be set.
885 @param SetSize The size of value.
887 @return status of ExSetWorker().
892 IN UINTN ExTokenNumber
,
893 IN CONST EFI_GUID
*Guid
,
899 Set value for a dynamic PCD entry.
901 This routine find the local token number according to dynamic-ex PCD's token
902 space guid and token number firstly, and invoke callback function if this PCD
903 entry registered callback function. Finally, invoken general SetWorker to set
906 @param ExTokenNumber Dynamic-ex PCD token number.
907 @param Guid Token space guid for dynamic-ex PCD.
908 @param Data PCD value want to be set
909 @param SetSize Size of value.
910 @param PtrType If TRUE, this PCD entry is pointer type.
911 If FALSE, this PCD entry is not pointer type.
913 @return status of SetWorker().
918 IN UINTN ExTokenNumber
,
919 IN CONST EFI_GUID
*Guid
,
926 Get the PCD entry pointer in PCD database.
928 This routine will visit PCD database to find the PCD entry according to given
929 token number. The given token number is autogened by build tools and it will be
930 translated to local token number. Local token number contains PCD's type and
931 offset of PCD entry in PCD database.
933 @param TokenNumber Token's number, it is autogened by build tools
934 @param GetSize The size of token's value
936 @return PCD entry pointer in PCD database
941 IN UINTN TokenNumber
,
946 Wrapper function for get PCD value for dynamic-ex PCD.
948 @param Guid Token space guid for dynamic-ex PCD.
949 @param ExTokenNumber Token number for dynamic-ex PCD.
950 @param GetSize The size of dynamic-ex PCD value.
952 @return PCD entry in PCD database.
957 IN CONST EFI_GUID
*Guid
,
958 IN UINTN ExTokenNumber
,
963 Find the local token number according to system SKU ID.
965 @param LocalTokenNumber PCD token number
966 @param Size The size of PCD entry.
967 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
968 If False, the PCD entry is initialized in DXE phase.
970 @return Token number according to system SKU ID.
974 GetSkuEnabledTokenNumber (
975 UINT32 LocalTokenNumber
,
981 Get Variable which contains HII type PCD entry.
983 @param VariableGuid Variable's guid
984 @param VariableName Variable's unicode name string
985 @param VariableData Variable's data pointer,
986 @param VariableSize Variable's size.
988 @return the status of gRT->GetVariable
992 IN EFI_GUID
*VariableGuid
,
993 IN UINT16
*VariableName
,
994 OUT UINT8
**VariableData
,
995 OUT UINTN
*VariableSize
999 Set value for HII-type PCD.
1001 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
1002 HII-type PCD is to visit this variable.
1004 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
1005 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
1006 @param Data Value want to be set.
1007 @param DataSize Size of value
1008 @param Offset Value offset of HII-type PCD in variable.
1010 @return status of GetVariable()/SetVariable().
1015 IN EFI_GUID
*VariableGuid
,
1016 IN UINT16
*VariableName
,
1017 IN CONST VOID
*Data
,
1023 Register the callback function for a PCD entry.
1025 This routine will register a callback function to a PCD entry by given token number
1026 and token space guid.
1028 @param TokenNumber PCD token's number, it is autogened by build tools.
1029 @param Guid PCD token space's guid,
1030 if not NULL, this PCD is dynamicEx type PCD.
1031 @param CallBackFunction Callback function pointer
1033 @return EFI_SUCCESS Always success for registering callback function.
1037 DxeRegisterCallBackWorker (
1038 IN UINTN TokenNumber
,
1039 IN CONST EFI_GUID
*Guid
, OPTIONAL
1040 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1044 UnRegister the callback function for a PCD entry.
1046 This routine will unregister a callback function to a PCD entry by given token number
1047 and token space guid.
1049 @param TokenNumber PCD token's number, it is autogened by build tools.
1050 @param Guid PCD token space's guid.
1051 if not NULL, this PCD is dynamicEx type PCD.
1052 @param CallBackFunction Callback function pointer
1054 @retval EFI_SUCCESS Callback function is success to be unregister.
1055 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
1058 DxeUnRegisterCallBackWorker (
1059 IN UINTN TokenNumber
,
1060 IN CONST EFI_GUID
*Guid
, OPTIONAL
1061 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1065 Initialize the PCD database in DXE phase.
1067 PCD database in DXE phase also contains PCD database in PEI phase which is copied
1072 BuildPcdDxeDataBase (
1077 Get Token Number according to dynamic-ex PCD's {token space guid:token number}
1079 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1080 in DEC file. PCD database maintain a mapping table that translate pair of {token
1081 space guid: token number} to Token Number.
1083 @param Guid Token space guid for dynamic-ex PCD entry.
1084 @param ExTokenNumber Dynamic-ex PCD token number.
1086 @return Token Number for dynamic-ex PCD.
1090 GetExPcdTokenNumber (
1091 IN CONST EFI_GUID
*Guid
,
1092 IN UINT32 ExTokenNumber
1096 Get next token number in given token space.
1098 This routine is used for dynamicEx type PCD. It will firstly scan token space
1099 table to get token space according to given token space guid. Then scan given
1100 token number in found token space, if found, then return next token number in
1103 @param Guid Token space guid. Next token number will be scaned in
1105 @param TokenNumber Token number.
1106 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1108 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1109 in token space table.
1110 @param GuidTable Token space guid table. It will be used for scan token space
1111 by given token space guid.
1112 @param SizeOfGuidTable The size of guid table.
1113 @param ExMapTable DynamicEx token number mapping table.
1114 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1116 @retval EFI_NOT_FOUND Can not given token space or token number.
1117 @retval EFI_SUCCESS Success to get next token number.
1121 ExGetNextTokeNumber (
1122 IN CONST EFI_GUID
*Guid
,
1123 IN OUT UINTN
*TokenNumber
,
1124 IN EFI_GUID
*GuidTable
,
1125 IN UINTN SizeOfGuidTable
,
1126 IN DYNAMICEX_MAPPING
*ExMapTable
,
1127 IN UINTN SizeOfExMapTable
1131 Get size of POINTER type PCD value.
1133 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1134 @param MaxSize Maximum size of POINTER type PCD value.
1136 @return size of POINTER type PCD value.
1141 IN UINTN LocalTokenNumberTableIdx
,
1146 Set size of POINTER type PCD value. The size should not exceed the maximum size
1149 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1150 @param CurrentSize Size of POINTER type PCD value.
1152 @retval TRUE Success to set size of PCD value.
1153 @retval FALSE Fail to set size of PCD value.
1157 IN UINTN LocalTokenNumberTableIdx
,
1158 IN OUT UINTN
*CurrentSize
1161 extern PCD_DATABASE mPcdDatabase
;
1163 extern UINT32 mPcdTotalTokenCount
;
1164 extern UINT32 mPeiLocalTokenCount
;
1165 extern UINT32 mDxeLocalTokenCount
;
1166 extern UINT32 mPeiNexTokenCount
;
1167 extern UINT32 mDxeNexTokenCount
;
1168 extern UINT32 mPeiExMapppingTableSize
;
1169 extern UINT32 mDxeExMapppingTableSize
;
1170 extern UINT32 mPeiGuidTableSize
;
1171 extern UINT32 mDxeGuidTableSize
;
1173 extern BOOLEAN mPeiExMapTableEmpty
;
1174 extern BOOLEAN mDxeExMapTableEmpty
;
1175 extern BOOLEAN mPeiDatabaseEmpty
;
1177 extern EFI_GUID
**TmpTokenSpaceBuffer
;
1178 extern UINTN TmpTokenSpaceBufferCount
;
1180 extern EFI_LOCK mPcdDatabaseLock
;