2 The internal header file declares the private functions used by PeiPcd driver.
4 Copyright (c) 2006 - 2016, 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 _PEI_PCD_SERVICE_H_
16 #define _PEI_PCD_SERVICE_H_
19 #include <Ppi/ReadOnlyVariable2.h>
21 #include <Ppi/PiPcd.h>
22 #include <Ppi/PcdInfo.h>
23 #include <Ppi/PiPcdInfo.h>
24 #include <Guid/PcdDataBaseHobGuid.h>
25 #include <Guid/PcdDataBaseSignatureGuid.h>
26 #include <Guid/VariableFormat.h>
27 #include <Library/DebugLib.h>
28 #include <Library/PeimEntryPoint.h>
29 #include <Library/BaseLib.h>
30 #include <Library/HobLib.h>
31 #include <Library/PeiServicesLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/BaseMemoryLib.h>
34 #include <Library/MemoryAllocationLib.h>
37 // Please make sure the PCD Serivce PEIM Version is consistent with
38 // the version of the generated PEIM PCD Database by build tool.
40 #define PCD_SERVICE_PEIM_VERSION 7
43 // PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.
45 #if (PCD_SERVICE_PEIM_VERSION != PCD_PEI_SERVICE_DRIVER_VERSION)
46 #error "Please make sure the version of PCD PEIM Service and the generated PCD PEI 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 PeiGetPcdInfoGetInfo (
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 PeiGetPcdInfoGetInfoEx (
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 PeiGetPcdInfoGetSku (
105 // PPI Interface Implementation Declaration.
109 Sets the SKU value for subsequent calls to set or get PCD token values.
111 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
112 SetSku() is normally called only once by the system.
114 For each item (token), the database can hold a single value that applies to all SKUs,
115 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
116 SKU-specific values are called SKU enabled.
118 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
119 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
120 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
121 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
122 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
123 set for that Id, the results are unpredictable.
125 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
126 set values associated with a PCD token.
136 Retrieves an 8-bit value for a given PCD token.
138 Retrieves the current byte-sized value for a PCD token number.
139 If the TokenNumber is invalid, the results are unpredictable.
141 @param[in] TokenNumber The PCD token number.
143 @return The UINT8 value.
153 Retrieves an 16-bit value for a given PCD token.
155 Retrieves the current 16-bits value for a PCD token number.
156 If the TokenNumber is invalid, the results are unpredictable.
158 @param[in] TokenNumber The PCD token number.
160 @return The UINT16 value.
170 Retrieves an 32-bit value for a given PCD token.
172 Retrieves the current 32-bits value for a PCD token number.
173 If the TokenNumber is invalid, the results are unpredictable.
175 @param[in] TokenNumber The PCD token number.
177 @return The UINT32 value.
187 Retrieves an 64-bit value for a given PCD token.
189 Retrieves the current 64-bits value for a PCD token number.
190 If the TokenNumber is invalid, the results are unpredictable.
192 @param[in] TokenNumber The PCD token number.
194 @return The UINT64 value.
204 Retrieves a pointer to a value for a given PCD token.
206 Retrieves the current pointer to the buffer for a PCD token number.
207 Do not make any assumptions about the alignment of the pointer that
208 is returned by this function call. If the TokenNumber is invalid,
209 the results are unpredictable.
211 @param[in] TokenNumber The PCD token number.
213 @return The pointer to the buffer to be retrived.
223 Retrieves a Boolean value for a given PCD token.
225 Retrieves the current boolean value for a PCD token number.
226 Do not make any assumptions about the alignment of the pointer that
227 is returned by this function call. If the TokenNumber is invalid,
228 the results are unpredictable.
230 @param[in] TokenNumber The PCD token number.
232 @return The Boolean value.
242 Retrieves the size of the value for a given PCD token.
244 Retrieves the current size of a particular PCD token.
245 If the TokenNumber is invalid, the results are unpredictable.
247 @param[in] TokenNumber The PCD token number.
249 @return The size of the value for the PCD token.
259 Retrieves an 8-bit value for a given PCD token.
261 Retrieves the 8-bit value of a particular PCD token.
262 If the TokenNumber is invalid or the token space
263 specified by Guid does not exist, the results are
266 @param[in] Guid The token space for the token number.
267 @param[in] TokenNumber The PCD token number.
269 @return The size 8-bit value for the PCD token.
275 IN CONST EFI_GUID
*Guid
,
280 Retrieves an 16-bit value for a given PCD token.
282 Retrieves the 16-bit value of a particular PCD token.
283 If the TokenNumber is invalid or the token space
284 specified by Guid does not exist, the results are
287 @param[in] Guid The token space for the token number.
288 @param[in] TokenNumber The PCD token number.
290 @return The size 16-bit value for the PCD token.
296 IN CONST EFI_GUID
*Guid
,
301 Retrieves an 32-bit value for a given PCD token.
303 Retrieves the 32-bit value of a particular PCD token.
304 If the TokenNumber is invalid or the token space
305 specified by Guid does not exist, the results are
308 @param[in] Guid The token space for the token number.
309 @param[in] TokenNumber The PCD token number.
311 @return The size 32-bit value for the PCD token.
317 IN CONST EFI_GUID
*Guid
,
322 Retrieves an 64-bit value for a given PCD token.
324 Retrieves the 64-bit value of a particular PCD token.
325 If the TokenNumber is invalid or the token space
326 specified by Guid does not exist, the results are
329 @param[in] Guid The token space for the token number.
330 @param[in] TokenNumber The PCD token number.
332 @return The size 64-bit value for the PCD token.
338 IN CONST EFI_GUID
*Guid
,
343 Retrieves a pointer to a value for a given PCD token.
345 Retrieves the current pointer to the buffer for a PCD token number.
346 Do not make any assumptions about the alignment of the pointer that
347 is returned by this function call. If the TokenNumber is invalid,
348 the results are unpredictable.
350 @param[in] Guid The token space for the token number.
351 @param[in] TokenNumber The PCD token number.
353 @return The pointer to the buffer to be retrived.
359 IN CONST EFI_GUID
*Guid
,
364 Retrieves an Boolean value for a given PCD token.
366 Retrieves the Boolean value of a particular PCD token.
367 If the TokenNumber is invalid or the token space
368 specified by Guid does not exist, the results are
371 @param[in] Guid The token space for the token number.
372 @param[in] TokenNumber The PCD token number.
374 @return The size Boolean value for the PCD token.
380 IN CONST EFI_GUID
*Guid
,
385 Retrieves the size of the value for a given PCD token.
387 Retrieves the current size of a particular PCD token.
388 If the TokenNumber is invalid, the results are unpredictable.
390 @param[in] Guid The token space for the token number.
391 @param[in] TokenNumber The PCD token number.
393 @return The size of the value for the PCD token.
399 IN CONST EFI_GUID
*Guid
,
404 Sets an 8-bit value for a given PCD token.
406 When the PCD service sets a value, it will check to ensure that the
407 size of the value being set is compatible with the Token's existing definition.
408 If it is not, an error will be returned.
410 @param[in] TokenNumber The PCD token number.
411 @param[in] Value The value to set for the PCD token.
413 @retval EFI_SUCCESS Procedure returned successfully.
414 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
415 being set was incompatible with a call to this function.
416 Use GetSize() to retrieve the size of the target data.
417 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
423 IN UINTN TokenNumber
,
428 Sets an 16-bit value for a given PCD token.
430 When the PCD service sets a value, it will check to ensure that the
431 size of the value being set is compatible with the Token's existing definition.
432 If it is not, an error will be returned.
434 @param[in] TokenNumber The PCD token number.
435 @param[in] Value The value to set for the PCD token.
437 @retval EFI_SUCCESS Procedure returned successfully.
438 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
439 being set was incompatible with a call to this function.
440 Use GetSize() to retrieve the size of the target data.
441 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
447 IN UINTN TokenNumber
,
452 Sets an 32-bit value for a given PCD token.
454 When the PCD service sets a value, it will check to ensure that the
455 size of the value being set is compatible with the Token's existing definition.
456 If it is not, an error will be returned.
458 @param[in] TokenNumber The PCD token number.
459 @param[in] Value The value to set for the PCD token.
461 @retval EFI_SUCCESS Procedure returned successfully.
462 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
463 being set was incompatible with a call to this function.
464 Use GetSize() to retrieve the size of the target data.
465 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
471 IN UINTN TokenNumber
,
476 Sets an 64-bit value for a given PCD token.
478 When the PCD service sets a value, it will check to ensure that the
479 size of the value being set is compatible with the Token's existing definition.
480 If it is not, an error will be returned.
482 @param[in] TokenNumber The PCD token number.
483 @param[in] Value The value to set for the PCD token.
485 @retval EFI_SUCCESS Procedure returned successfully.
486 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
487 being set was incompatible with a call to this function.
488 Use GetSize() to retrieve the size of the target data.
489 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
495 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
,
553 Sets an 8-bit value for a given PCD token.
555 When the PCD service sets a value, it will check to ensure that the
556 size of the value being set is compatible with the Token's existing definition.
557 If it is not, an error will be returned.
559 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
560 @param[in] TokenNumber The PCD token number.
561 @param[in] Value The value to set for the PCD token.
563 @retval EFI_SUCCESS Procedure returned successfully.
564 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
565 being set was incompatible with a call to this function.
566 Use GetSize() to retrieve the size of the target data.
567 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
573 IN CONST EFI_GUID
*Guid
,
574 IN UINTN TokenNumber
,
579 Sets an 16-bit value for a given PCD token.
581 When the PCD service sets a value, it will check to ensure that the
582 size of the value being set is compatible with the Token's existing definition.
583 If it is not, an error will be returned.
585 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
586 @param[in] TokenNumber The PCD token number.
587 @param[in] Value The value to set for the PCD token.
589 @retval EFI_SUCCESS Procedure returned successfully.
590 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
591 being set was incompatible with a call to this function.
592 Use GetSize() to retrieve the size of the target data.
593 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
599 IN CONST EFI_GUID
*Guid
,
600 IN UINTN TokenNumber
,
605 Sets an 32-bit value for a given PCD token.
607 When the PCD service sets a value, it will check to ensure that the
608 size of the value being set is compatible with the Token's existing definition.
609 If it is not, an error will be returned.
611 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
612 @param[in] TokenNumber The PCD token number.
613 @param[in] Value The value to set for the PCD token.
615 @retval EFI_SUCCESS Procedure returned successfully.
616 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
617 being set was incompatible with a call to this function.
618 Use GetSize() to retrieve the size of the target data.
619 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
625 IN CONST EFI_GUID
*Guid
,
626 IN UINTN TokenNumber
,
631 Sets an 64-bit value for a given PCD token.
633 When the PCD service sets a value, it will check to ensure that the
634 size of the value being set is compatible with the Token's existing definition.
635 If it is not, an error will be returned.
637 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
638 @param[in] TokenNumber The PCD token number.
639 @param[in] Value The value to set for the PCD token.
641 @retval EFI_SUCCESS Procedure returned successfully.
642 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
643 being set was incompatible with a call to this function.
644 Use GetSize() to retrieve the size of the target data.
645 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
651 IN CONST EFI_GUID
*Guid
,
652 IN UINTN TokenNumber
,
657 Sets a value of a specified size for a given PCD token.
659 When the PCD service sets a value, it will check to ensure that the
660 size of the value being set is compatible with the Token's existing definition.
661 If it is not, an error will be returned.
663 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
664 @param[in] TokenNumber The PCD token number.
665 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
666 On input, if the SizeOfValue is greater than the maximum size supported
667 for this TokenNumber then the output value of SizeOfValue will reflect
668 the maximum size supported for this TokenNumber.
669 @param[in] Buffer The buffer to set for the PCD token.
671 @retval EFI_SUCCESS Procedure returned successfully.
672 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
673 being set was incompatible with a call to this function.
674 Use GetSize() to retrieve the size of the target data.
675 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
681 IN CONST EFI_GUID
*Guid
,
682 IN UINTN TokenNumber
,
683 IN OUT UINTN
*SizeOfBuffer
,
688 Sets an Boolean value for a given PCD token.
690 When the PCD service sets a value, it will check to ensure that the
691 size of the value being set is compatible with the Token's existing definition.
692 If it is not, an error will be returned.
694 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
695 @param[in] TokenNumber The PCD token number.
696 @param[in] Value The value to set for the PCD token.
698 @retval EFI_SUCCESS Procedure returned successfully.
699 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
700 being set was incompatible with a call to this function.
701 Use GetSize() to retrieve the size of the target data.
702 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
708 IN CONST EFI_GUID
*Guid
,
709 IN UINTN TokenNumber
,
714 Specifies a function to be called anytime the value of a designated token is changed.
716 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
717 @param[in] TokenNumber The PCD token number.
718 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
720 @retval EFI_SUCCESS The PCD service has successfully established a call event
721 for the CallBackToken requested.
722 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
727 PeiRegisterCallBackOnSet (
728 IN CONST EFI_GUID
*Guid
, OPTIONAL
729 IN UINTN TokenNumber
,
730 IN PCD_PPI_CALLBACK CallBackFunction
734 Cancels a previously set callback function for a particular PCD token number.
736 @param [in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
737 @param [in] TokenNumber The PCD token number.
738 @param [in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
740 @retval EFI_SUCCESS The PCD service has successfully established a call event
741 for the CallBackToken requested.
742 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
747 PcdUnRegisterCallBackOnSet (
748 IN CONST EFI_GUID
*Guid
, OPTIONAL
749 IN UINTN TokenNumber
,
750 IN PCD_PPI_CALLBACK CallBackFunction
754 Retrieves the next valid token number in a given namespace.
756 This is useful since the PCD infrastructure contains a sparse list of token numbers,
757 and one cannot a priori know what token numbers are valid in the database.
759 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
760 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
761 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
762 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
763 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
764 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
765 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
766 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
769 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
770 This is an optional parameter that may be NULL. If this parameter is NULL, then a request
771 is being made to retrieve tokens from the default token space.
772 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
774 @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
775 Or the input token number 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 Retrieves the next valid PCD token namespace for a given namespace.
790 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates
791 a known token namespace from which the search will start. On output,
792 it designates the next valid token namespace on the platform. If the input
793 token namespace does not exist on the platform, an error is returned and
794 the value of *Guid is undefined. If *Guid is NULL, then the GUID of the
795 first token space of the current platform is assigned to *Guid the function
796 return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in
797 the platform other than the default (NULL) tokennamespace, *Guid is unchanged
798 and the function return EFI_SUCCESS. If this input token namespace is the last
799 namespace on the platform, *Guid will be assigned to NULL and the function return
802 @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.
803 Or the input token space Guid is already the last valid token space Guid
804 in the PCD database. In the later case, *Guid is updated with the value of NULL.
805 @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
810 PeiPcdGetNextTokenSpace (
811 IN OUT CONST EFI_GUID
**Guid
815 Retrieve additional information associated with a PCD token.
817 This includes information such as the type of value the TokenNumber is associated with as well as possible
818 human readable name that is associated with the token.
820 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
821 @param[in] TokenNumber The PCD token number.
822 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
823 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
825 @retval EFI_SUCCESS The PCD information was returned successfully
826 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
830 IN CONST EFI_GUID
*Guid
,
831 IN UINTN TokenNumber
,
832 OUT EFI_PCD_INFO
*PcdInfo
835 /* Internal Function definitions */
837 Get PCD database from GUID HOB in PEI phase.
839 @return Pointer to PCD database.
848 Wrapper function for setting non-pointer type value for a PCD entry.
850 @param TokenNumber Pcd token number autogenerated by build tools.
851 @param Data Value want to be set for PCD entry
852 @param Size Size of value.
854 @return status of SetWorker.
859 IN UINTN TokenNumber
,
865 Set value for an PCD entry
867 @param TokenNumber Pcd token number autogenerated by build tools.
868 @param Data Value want to be set for PCD entry
869 @param Size Size of value.
870 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
871 If False, the type of PCD entry's value is not Pointer.
873 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
874 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
875 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
876 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
877 range of UINT8, UINT16, UINT32, UINT64
878 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
882 IN UINTN TokenNumber
,
889 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
891 @param ExTokenNumber Token number for dynamic-ex PCD.
892 @param Guid Token space guid for dynamic-ex PCD.
893 @param Data Value want to be set.
894 @param SetSize The size of value.
896 @return status of ExSetWorker().
901 IN UINTN ExTokenNumber
,
902 IN CONST EFI_GUID
*Guid
,
908 Set value for a dynamic PCD entry.
910 This routine find the local token number according to dynamic-ex PCD's token
911 space guid and token number firstly, and invoke callback function if this PCD
912 entry registered callback function. Finally, invoken general SetWorker to set
915 @param ExTokenNumber Dynamic-ex PCD token number.
916 @param Guid Token space guid for dynamic-ex PCD.
917 @param Data PCD value want to be set
918 @param SetSize Size of value.
919 @param PtrType If TRUE, this PCD entry is pointer type.
920 If FALSE, this PCD entry is not pointer type.
922 @return status of SetWorker().
927 IN UINTN ExTokenNumber
,
928 IN CONST EFI_GUID
*Guid
,
935 Get the PCD entry pointer in PCD database.
937 This routine will visit PCD database to find the PCD entry according to given
938 token number. The given token number is autogened by build tools and it will be
939 translated to local token number. Local token number contains PCD's type and
940 offset of PCD entry in PCD database.
942 @param TokenNumber Token's number, it is autogened by build tools
943 @param GetSize The size of token's value
945 @return PCD entry pointer in PCD database
950 IN UINTN TokenNumber
,
955 Wrapper function for get PCD value for dynamic-ex PCD.
957 @param Guid Token space guid for dynamic-ex PCD.
958 @param ExTokenNumber Token number for dyanmic-ex PCD.
959 @param GetSize The size of dynamic-ex PCD value.
961 @return PCD entry in PCD database.
966 IN CONST EFI_GUID
*Guid
,
967 IN UINTN ExTokenNumber
,
974 UINT32 LocalTokenNumberAlias
;
975 } EX_PCD_ENTRY_ATTRIBUTE
;
978 Get Token Number according to dynamic-ex PCD's {token space guid:token number}
980 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
981 in DEC file. PCD database maintain a mapping table that translate pair of {token
982 space guid: token number} to Token Number.
984 @param Guid Token space guid for dynamic-ex PCD entry.
985 @param ExTokenNumber Token number for dynamic-ex PCD.
987 @return Token Number for dynamic-ex PCD.
991 GetExPcdTokenNumber (
992 IN CONST EFI_GUID
*Guid
,
993 IN UINTN ExTokenNumber
997 The function registers the CallBackOnSet fucntion
998 according to TokenNumber and EFI_GUID space.
1000 @param TokenNumber The token number.
1001 @param Guid The GUID space.
1002 @param CallBackFunction The Callback function to be registered.
1003 @param Register To register or unregister the callback function.
1005 @retval EFI_SUCCESS If the Callback function is registered.
1006 @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.
1007 @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free
1008 slot left in the CallbackFnTable.
1011 PeiRegisterCallBackWorker (
1012 IN UINTN TokenNumber
,
1013 IN CONST EFI_GUID
*Guid
, OPTIONAL
1014 IN PCD_PPI_CALLBACK CallBackFunction
,
1019 The function builds the PCD database.
1021 @param FileHandle Handle of the file the external PCD database binary located.
1023 @return Pointer to PCD database.
1028 IN EFI_PEI_FILE_HANDLE FileHandle
1032 Get index of PCD entry in size table.
1034 @param LocalTokenNumberTableIdx Index of this PCD in local token number table.
1035 @param Database Pointer to PCD database.
1037 @return index of PCD entry in size table.
1042 IN UINTN LocalTokenNumberTableIdx
,
1043 IN PEI_PCD_DATABASE
*Database
1047 Get PCD value's size for POINTER type PCD.
1049 The POINTER type PCD's value will be stored into a buffer in specificed size.
1050 The max size of this PCD's value is described in PCD's definition in DEC file.
1052 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
1053 @param MaxSize Maxmium size of PCD's value
1054 @param Database Pcd database in PEI phase.
1056 @return PCD value's size for POINTER type PCD.
1061 IN UINTN LocalTokenNumberTableIdx
,
1063 IN PEI_PCD_DATABASE
*Database
1067 Set PCD value's size for POINTER type PCD.
1069 The POINTER type PCD's value will be stored into a buffer in specificed size.
1070 The max size of this PCD's value is described in PCD's definition in DEC file.
1072 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
1073 @param CurrentSize Maxmium size of PCD's value
1074 @param Database Pcd database in PEI phase.
1076 @retval TRUE Success to set PCD's value size, which is not exceed maxmium size
1077 @retval FALSE Fail to set PCD's value size, which maybe exceed maxmium size
1082 IN UINTN LocalTokenNumberTableIdx
,
1083 IN OUT UINTN
*CurrentSize
,
1084 IN PEI_PCD_DATABASE
*Database