2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2007, Intel Corporation
5 All rights reserved. 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.
14 Module Name: Service.h
18 #ifndef _PCD_DXE_SERVICE_H_
19 #define _PCD_DXE_SERVICE_H_
22 #include <Protocol/Pcd.h>
23 #include <Library/BaseLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/UefiLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/PcdLib.h>
28 #include <Library/HobLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/UefiRuntimeServicesTableLib.h>
35 // Please make sure the PCD Serivce PEIM Version is consistent with
36 // the version of PCD Database generation tool
38 #define PCD_SERVICE_DXE_DRIVER_VERSION 2
41 // PCD_DXE_DATABASE_GENTOOL_VERSION is defined in Autogen.h
42 // and generated by PCD Database generation tool.
44 //#if (PCD_SERVICE_DXE_DRIVER_VERSION != PCD_DXE_SERVICE_DRIVER_AUTOGEN_VERSION)
45 // #error "Please make sure the version of PCD Service DXE Driver and PCD DXE Database Generation Tool matches"
49 // Protocol Interface function declaration.
52 Sets the SKU value for subsequent calls to set or get PCD token values.
54 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
55 SetSku() is normally called only once by the system.
57 For each item (token), the database can hold a single value that applies to all SKUs,
58 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
59 SKU-specific values are called SKU enabled.
61 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
62 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
63 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
64 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
65 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
66 set for that Id, the results are unpredictable.
68 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
69 set values associated with a PCD token.
81 Retrieves an 8-bit value for a given PCD token.
83 Retrieves the current byte-sized value for a PCD token number.
84 If the TokenNumber is invalid, the results are unpredictable.
86 @param[in] TokenNumber The PCD token number.
88 @return The UINT8 value.
98 Retrieves an 16-bit value for a given PCD token.
100 Retrieves the current 16-bits value for a PCD token number.
101 If the TokenNumber is invalid, the results are unpredictable.
103 @param[in] TokenNumber The PCD token number.
105 @return The UINT16 value.
115 Retrieves an 32-bit value for a given PCD token.
117 Retrieves the current 32-bits value for a PCD token number.
118 If the TokenNumber is invalid, the results are unpredictable.
120 @param[in] TokenNumber The PCD token number.
122 @return The UINT32 value.
132 Retrieves an 64-bit value for a given PCD token.
134 Retrieves the current 64-bits value for a PCD token number.
135 If the TokenNumber is invalid, the results are unpredictable.
137 @param[in] TokenNumber The PCD token number.
139 @return The UINT64 value.
149 Retrieves a pointer to a value for a given PCD token.
151 Retrieves the current pointer to the buffer for a PCD token number.
152 Do not make any assumptions about the alignment of the pointer that
153 is returned by this function call. If the TokenNumber is invalid,
154 the results are unpredictable.
156 @param[in] TokenNumber The PCD token number.
158 @return The pointer to the buffer to be retrived.
168 Retrieves a Boolean value for a given PCD token.
170 Retrieves the current boolean value for a PCD token number.
171 Do not make any assumptions about the alignment of the pointer that
172 is returned by this function call. If the TokenNumber is invalid,
173 the results are unpredictable.
175 @param[in] TokenNumber The PCD token number.
177 @return The Boolean value.
187 Retrieves the size of the value for a given PCD token.
189 Retrieves the current size of a particular PCD token.
190 If the TokenNumber is invalid, the results are unpredictable.
192 @param[in] TokenNumber The PCD token number.
194 @return The size of the value for the PCD token.
204 Retrieves an 8-bit value for a given PCD token.
206 Retrieves the 8-bit value of a particular PCD token.
207 If the TokenNumber is invalid or the token space
208 specified by Guid does not exist, the results are
211 @param[in] Guid The token space for the token number.
212 @param[in] TokenNumber The PCD token number.
214 @return The size 8-bit value for the PCD token.
220 IN CONST EFI_GUID
*Guid
,
225 Retrieves an 16-bit value for a given PCD token.
227 Retrieves the 16-bit value of a particular PCD token.
228 If the TokenNumber is invalid or the token space
229 specified by Guid does not exist, the results are
232 @param[in] Guid The token space for the token number.
233 @param[in] TokenNumber The PCD token number.
235 @return The size 16-bit value for the PCD token.
241 IN CONST EFI_GUID
*Guid
,
246 Retrieves an 32-bit value for a given PCD token.
248 Retrieves the 32-bit value of a particular PCD token.
249 If the TokenNumber is invalid or the token space
250 specified by Guid does not exist, the results are
253 @param[in] Guid The token space for the token number.
254 @param[in] TokenNumber The PCD token number.
256 @return The size 32-bit value for the PCD token.
262 IN CONST EFI_GUID
*Guid
,
267 Retrieves an 64-bit value for a given PCD token.
269 Retrieves the 64-bit value of a particular PCD token.
270 If the TokenNumber is invalid or the token space
271 specified by Guid does not exist, the results are
274 @param[in] Guid The token space for the token number.
275 @param[in] TokenNumber The PCD token number.
277 @return The size 64-bit value for the PCD token.
283 IN CONST EFI_GUID
*Guid
,
288 Retrieves a pointer to a value for a given PCD token.
290 Retrieves the current pointer to the buffer for a PCD token number.
291 Do not make any assumptions about the alignment of the pointer that
292 is returned by this function call. If the TokenNumber is invalid,
293 the results are unpredictable.
295 @param[in] Guid The token space for the token number.
296 @param[in] TokenNumber The PCD token number.
298 @return The pointer to the buffer to be retrived.
304 IN CONST EFI_GUID
*Guid
,
309 Retrieves an Boolean value for a given PCD token.
311 Retrieves the Boolean value of a particular PCD token.
312 If the TokenNumber is invalid or the token space
313 specified by Guid does not exist, the results are
316 @param[in] Guid The token space for the token number.
317 @param[in] TokenNumber The PCD token number.
319 @return The size Boolean value for the PCD token.
325 IN CONST EFI_GUID
*Guid
,
330 Retrieves the size of the value for a given PCD token.
332 Retrieves the current size of a particular PCD token.
333 If the TokenNumber is invalid, the results are unpredictable.
335 @param[in] Guid The token space for the token number.
336 @param[in] TokenNumber The PCD token number.
338 @return The size of the value for the PCD token.
344 IN CONST EFI_GUID
*Guid
,
349 Sets an 8-bit value for a given PCD token.
351 When the PCD service sets a value, it will check to ensure that the
352 size of the value being set is compatible with the Token's existing definition.
353 If it is not, an error will be returned.
355 @param[in] TokenNumber The PCD token number.
356 @param[in] Value The value to set for the PCD token.
358 @retval EFI_SUCCESS Procedure returned successfully.
359 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
360 being set was incompatible with a call to this function.
361 Use GetSize() to retrieve the size of the target data.
362 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
368 IN UINTN TokenNumber
,
373 Sets an 16-bit value for a given PCD token.
375 When the PCD service sets a value, it will check to ensure that the
376 size of the value being set is compatible with the Token's existing definition.
377 If it is not, an error will be returned.
379 @param[in] TokenNumber The PCD token number.
380 @param[in] Value The value to set for the PCD token.
382 @retval EFI_SUCCESS Procedure returned successfully.
383 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
384 being set was incompatible with a call to this function.
385 Use GetSize() to retrieve the size of the target data.
386 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
392 IN UINTN TokenNumber
,
397 Sets an 32-bit value for a given PCD token.
399 When the PCD service sets a value, it will check to ensure that the
400 size of the value being set is compatible with the Token's existing definition.
401 If it is not, an error will be returned.
403 @param[in] TokenNumber The PCD token number.
404 @param[in] Value The value to set for the PCD token.
406 @retval EFI_SUCCESS Procedure returned successfully.
407 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
408 being set was incompatible with a call to this function.
409 Use GetSize() to retrieve the size of the target data.
410 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
416 IN UINTN TokenNumber
,
421 Sets an 64-bit value for a given PCD token.
423 When the PCD service sets a value, it will check to ensure that the
424 size of the value being set is compatible with the Token's existing definition.
425 If it is not, an error will be returned.
427 @param[in] TokenNumber The PCD token number.
428 @param[in] Value The value to set for the PCD token.
430 @retval EFI_SUCCESS Procedure returned successfully.
431 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
432 being set was incompatible with a call to this function.
433 Use GetSize() to retrieve the size of the target data.
434 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
440 IN UINTN TokenNumber
,
446 Sets a value of a specified size for a given PCD token.
448 When the PCD service sets a value, it will check to ensure that the
449 size of the value being set is compatible with the Token's existing definition.
450 If it is not, an error will be returned.
452 @param[in] TokenNumber The PCD token number.
453 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
454 On input, if the SizeOfValue is greater than the maximum size supported
455 for this TokenNumber then the output value of SizeOfValue will reflect
456 the maximum size supported for this TokenNumber.
457 @param[in] Buffer The buffer to set for the PCD token.
459 @retval EFI_SUCCESS Procedure returned successfully.
460 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
461 being set was incompatible with a call to this function.
462 Use GetSize() to retrieve the size of the target data.
463 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
469 IN UINTN TokenNumber
,
470 IN OUT UINTN
*SizeOfBuffer
,
475 Sets an Boolean 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 an 8-bit value 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] Guid The 128-bit unique value that designates the namespace from which to extract the value.
507 @param[in] TokenNumber The PCD token number.
508 @param[in] Value The value to set for the PCD token.
510 @retval EFI_SUCCESS Procedure returned successfully.
511 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
512 being set was incompatible with a call to this function.
513 Use GetSize() to retrieve the size of the target data.
514 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
520 IN CONST EFI_GUID
*Guid
,
521 IN UINTN TokenNumber
,
526 Sets an 16-bit value for a given PCD token.
528 When the PCD service sets a value, it will check to ensure that the
529 size of the value being set is compatible with the Token's existing definition.
530 If it is not, an error will be returned.
532 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
533 @param[in] TokenNumber The PCD token number.
534 @param[in] Value The value to set for the PCD token.
536 @retval EFI_SUCCESS Procedure returned successfully.
537 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
538 being set was incompatible with a call to this function.
539 Use GetSize() to retrieve the size of the target data.
540 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
546 IN CONST EFI_GUID
*Guid
,
547 IN UINTN TokenNumber
,
552 Sets an 32-bit value for a given PCD token.
554 When the PCD service sets a value, it will check to ensure that the
555 size of the value being set is compatible with the Token's existing definition.
556 If it is not, an error will be returned.
558 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
559 @param[in] TokenNumber The PCD token number.
560 @param[in] Value The value to set for the PCD token.
562 @retval EFI_SUCCESS Procedure returned successfully.
563 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
564 being set was incompatible with a call to this function.
565 Use GetSize() to retrieve the size of the target data.
566 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
572 IN CONST EFI_GUID
*Guid
,
573 IN UINTN TokenNumber
,
578 Sets an 64-bit value for a given PCD token.
580 When the PCD service sets a value, it will check to ensure that the
581 size of the value being set is compatible with the Token's existing definition.
582 If it is not, an error will be returned.
584 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
585 @param[in] TokenNumber The PCD token number.
586 @param[in] Value The value to set for the PCD token.
588 @retval EFI_SUCCESS Procedure returned successfully.
589 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
590 being set was incompatible with a call to this function.
591 Use GetSize() to retrieve the size of the target data.
592 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
598 IN CONST EFI_GUID
*Guid
,
599 IN UINTN TokenNumber
,
604 Sets a value of a specified size for a given PCD token.
606 When the PCD service sets a value, it will check to ensure that the
607 size of the value being set is compatible with the Token's existing definition.
608 If it is not, an error will be returned.
610 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
611 @param[in] TokenNumber The PCD token number.
612 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
613 On input, if the SizeOfValue is greater than the maximum size supported
614 for this TokenNumber then the output value of SizeOfValue will reflect
615 the maximum size supported for this TokenNumber.
616 @param[in] Buffer The buffer 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
,
630 IN OUT UINTN
*SizeOfBuffer
,
635 Sets an Boolean value for a given PCD token.
637 When the PCD service sets a value, it will check to ensure that the
638 size of the value being set is compatible with the Token's existing definition.
639 If it is not, an error will be returned.
641 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
642 @param[in] TokenNumber The PCD token number.
643 @param[in] Value The value to set for the PCD token.
645 @retval EFI_SUCCESS Procedure returned successfully.
646 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
647 being set was incompatible with a call to this function.
648 Use GetSize() to retrieve the size of the target data.
649 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
655 IN CONST EFI_GUID
*Guid
,
656 IN UINTN TokenNumber
,
661 Specifies a function to be called anytime the value of a designated token is changed.
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] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
667 @retval EFI_SUCCESS The PCD service has successfully established a call event
668 for the CallBackToken requested.
669 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
674 DxeRegisterCallBackOnSet (
675 IN CONST EFI_GUID
*Guid
, OPTIONAL
676 IN UINTN TokenNumber
,
677 IN PCD_PROTOCOL_CALLBACK CallBackFunction
681 Cancels a previously set callback function for a particular PCD token number.
683 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
684 @param[in] TokenNumber The PCD token number.
685 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
687 @retval EFI_SUCCESS The PCD service has successfully established a call event
688 for the CallBackToken requested.
689 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
694 DxeUnRegisterCallBackOnSet (
695 IN CONST EFI_GUID
*Guid
, OPTIONAL
696 IN UINTN TokenNumber
,
697 IN PCD_PROTOCOL_CALLBACK CallBackFunction
701 Retrieves the next valid PCD token for a given namespace.
703 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
704 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
705 If the input token namespace or token number does not exist on the platform,
706 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token,
707 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and
708 there is no valid token number for this token namespace, *TokenNumber will be assigned to
709 0 and the function return EFI_SUCCESS. If the token number is the last valid token number,
710 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.
712 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
713 is already the last valid token number in the PCD database.
714 In the later case, *TokenNumber is updated with the value of 0.
715 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
721 IN CONST EFI_GUID
*Guid
, OPTIONAL
722 IN OUT UINTN
*TokenNumber
726 Get next token space in PCD database according to given token space guid.
728 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
731 @param Guid Given token space guid. If NULL, then Guid will be set to
732 the first PCD token space in PCD database, If not NULL, then
733 Guid will be set to next PCD token space.
735 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
736 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
737 token space in PCD database.
738 @retval EFI_SUCCESS Success to get next token space guid.
742 DxePcdGetNextTokenSpace (
743 IN OUT CONST EFI_GUID
**Guid
748 PCD_PROTOCOL_CALLBACK CallbackFn
;
751 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)
754 // Internal Functions
758 Wrapper function for setting non-pointer type value for a PCD entry.
760 @param TokenNumber Pcd token number autogenerated by build tools.
761 @param Data Value want to be set for PCD entry
762 @param Size Size of value.
764 @return status of SetWorker.
769 IN UINTN TokenNumber
,
775 Set value for an PCD entry
777 @param TokenNumber Pcd token number autogenerated by build tools.
778 @param Data Value want to be set for PCD entry
779 @param Size Size of value.
780 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
781 If False, the type of PCD entry's value is not Pointer.
783 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
784 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
785 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
786 range of UINT8, UINT16, UINT32, UINT64
787 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
791 IN UINTN TokenNumber
,
798 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
800 @param ExTokenNumber Token number for dynamic-ex PCD.
801 @param Guid Token space guid for dynamic-ex PCD.
802 @param Data Value want to be set.
803 @param SetSize The size of value.
805 @return status of ExSetWorker().
810 IN UINTN ExTokenNumber
,
811 IN CONST EFI_GUID
*Guid
,
817 Set value for a dynamic PCD entry.
819 This routine find the local token number according to dynamic-ex PCD's token
820 space guid and token number firstly, and invoke callback function if this PCD
821 entry registered callback function. Finally, invoken general SetWorker to set
824 @param ExTokenNumber Dynamic-ex PCD token number.
825 @param Guid Token space guid for dynamic-ex PCD.
826 @param Data PCD value want to be set
827 @param SetSize Size of value.
828 @param PtrType If TRUE, this PCD entry is pointer type.
829 If FALSE, this PCD entry is not pointer type.
831 @return status of SetWorker().
836 IN UINTN ExTokenNumber
,
837 IN CONST EFI_GUID
*Guid
,
844 Get the PCD entry pointer in PCD database.
846 This routine will visit PCD database to find the PCD entry according to given
847 token number. The given token number is autogened by build tools and it will be
848 translated to local token number. Local token number contains PCD's type and
849 offset of PCD entry in PCD database.
851 @param TokenNumber Token's number, it is autogened by build tools
852 @param GetSize The size of token's value
854 @return PCD entry pointer in PCD database
859 IN UINTN TokenNumber
,
864 Wrapper function for get PCD value for dynamic-ex PCD.
866 @param Guid Token space guid for dynamic-ex PCD.
867 @param ExTokenNumber Token number for dyanmic-ex PCD.
868 @param GetSize The size of dynamic-ex PCD value.
870 @return PCD entry in PCD database.
875 IN CONST EFI_GUID
*Guid
,
876 IN UINTN ExTokenNumber
,
881 Find the local token number according to system SKU ID.
883 @param LocalTokenNumber PCD token number
884 @param Size The size of PCD entry.
885 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
886 If False, the PCD entry is initialized in DXE phase.
888 @return Token number according to system SKU ID.
892 GetSkuEnabledTokenNumber (
893 UINT32 LocalTokenNumber
,
899 Get Variable which contains HII type PCD entry.
901 @param VariableGuid Variable's guid
902 @param VariableName Variable's unicode name string
903 @param VariableData Variable's data pointer,
904 @param VariableSize Variable's size.
906 @return the status of gRT->GetVariable
910 IN EFI_GUID
*VariableGuid
,
911 IN UINT16
*VariableName
,
912 OUT UINT8
**VariableData
,
913 OUT UINTN
*VariableSize
917 Set value for HII-type PCD.
919 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
920 HII-type PCD is to visit this variable.
922 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
923 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
924 @param Data Value want to be set.
925 @param DataSize Size of value
926 @param Offset Value offset of HII-type PCD in variable.
928 @return status of GetVariable()/SetVariable().
933 IN EFI_GUID
*VariableGuid
,
934 IN UINT16
*VariableName
,
941 Register the callback function for a PCD entry.
943 This routine will register a callback function to a PCD entry by given token number
944 and token space guid.
946 @param TokenNumber PCD token's number, it is autogened by build tools.
947 @param Guid PCD token space's guid,
948 if not NULL, this PCD is dynamicEx type PCD.
949 @param CallBackFunction Callback function pointer
951 @return EFI_SUCCESS Always success for registering callback function.
955 DxeRegisterCallBackWorker (
956 IN UINTN TokenNumber
,
957 IN CONST EFI_GUID
*Guid
, OPTIONAL
958 IN PCD_PROTOCOL_CALLBACK CallBackFunction
962 UnRegister the callback function for a PCD entry.
964 This routine will unregister a callback function to a PCD entry by given token number
965 and token space guid.
967 @param TokenNumber PCD token's number, it is autogened by build tools.
968 @param Guid PCD token space's guid.
969 if not NULL, this PCD is dynamicEx type PCD.
970 @param CallBackFunction Callback function pointer
972 @retval EFI_SUCCESS Callback function is success to be unregister.
973 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
976 DxeUnRegisterCallBackWorker (
977 IN UINTN TokenNumber
,
978 IN CONST EFI_GUID
*Guid
, OPTIONAL
979 IN PCD_PROTOCOL_CALLBACK CallBackFunction
983 Initialize the PCD database in DXE phase.
985 PCD database in DXE phase also contains PCD database in PEI phase which is copied
990 BuildPcdDxeDataBase (
995 Get local token number according to dynamic-ex PCD's {token space guid:token number}
997 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
998 in DEC file. PCD database maintain a mapping table that translate pair of {token
999 space guid: token number} to local token number.
1001 @param Guid Token space guid for dynamic-ex PCD entry.
1002 @param ExTokenNumber EDES_TODO: Add parameter description
1004 @return local token number for dynamic-ex PCD.
1008 GetExPcdTokenNumber (
1009 IN CONST EFI_GUID
*Guid
,
1010 IN UINT32 ExTokenNumber
1014 Get next token number in given token space.
1016 This routine is used for dynamicEx type PCD. It will firstly scan token space
1017 table to get token space according to given token space guid. Then scan given
1018 token number in found token space, if found, then return next token number in
1021 @param Guid Token space guid. Next token number will be scaned in
1023 @param TokenNumber Token number.
1024 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1026 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1027 in token space table.
1028 @param GuidTable Token space guid table. It will be used for scan token space
1029 by given token space guid.
1030 @param SizeOfGuidTable The size of guid table.
1031 @param ExMapTable DynamicEx token number mapping table.
1032 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1034 @retval EFI_NOT_FOUND Can not given token space or token number.
1035 @retval EFI_SUCCESS Success to get next token number.
1039 ExGetNextTokeNumber (
1040 IN CONST EFI_GUID
*Guid
,
1041 IN OUT UINTN
*TokenNumber
,
1042 IN EFI_GUID
*GuidTable
,
1043 IN UINTN SizeOfGuidTable
,
1044 IN DYNAMICEX_MAPPING
*ExMapTable
,
1045 IN UINTN SizeOfExMapTable
1049 Get size of POINTER type PCD value.
1051 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1052 @param MaxSize Maxmium size of POINTER type PCD value.
1054 @return size of POINTER type PCD value.
1059 IN UINTN LocalTokenNumberTableIdx
,
1064 Set size of POINTER type PCD value. The size should not exceed the maxmium size
1067 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1068 @param CurrentSize Size of POINTER type PCD value.
1070 @retval TRUE Success to set size of PCD value.
1071 @retval FALSE Fail to set size of PCD value.
1075 IN UINTN LocalTokenNumberTableIdx
,
1076 IN OUT UINTN
*CurrentSize
1079 extern EFI_GUID gPcdDataBaseHobGuid
;
1081 extern PCD_DATABASE
* mPcdDatabase
;
1083 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1085 extern EFI_LOCK mPcdDatabaseLock
;