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.
82 Retrieves an 8-bit value for a given PCD token.
84 Retrieves the current byte-sized value for a PCD token number.
85 If the TokenNumber is invalid, the results are unpredictable.
87 @param[in] TokenNumber The PCD token number.
89 @return The UINT8 value.
100 Retrieves an 16-bit value for a given PCD token.
102 Retrieves the current 16-bits value for a PCD token number.
103 If the TokenNumber is invalid, the results are unpredictable.
105 @param[in] TokenNumber The PCD token number.
107 @return The UINT16 value.
118 Retrieves an 32-bit value for a given PCD token.
120 Retrieves the current 32-bits value for a PCD token number.
121 If the TokenNumber is invalid, the results are unpredictable.
123 @param[in] TokenNumber The PCD token number.
125 @return The UINT32 value.
136 Retrieves an 64-bit value for a given PCD token.
138 Retrieves the current 64-bits 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 UINT64 value.
154 Retrieves a pointer to a value for a given PCD token.
156 Retrieves the current pointer to the buffer for a PCD token number.
157 Do not make any assumptions about the alignment of the pointer that
158 is returned by this function call. If the TokenNumber is invalid,
159 the results are unpredictable.
161 @param[in] TokenNumber The PCD token number.
163 @return The pointer to the buffer to be retrived.
174 Retrieves a Boolean value for a given PCD token.
176 Retrieves the current boolean value for a PCD token number.
177 Do not make any assumptions about the alignment of the pointer that
178 is returned by this function call. If the TokenNumber is invalid,
179 the results are unpredictable.
181 @param[in] TokenNumber The PCD token number.
183 @return The Boolean value.
194 Retrieves the size of the value for a given PCD token.
196 Retrieves the current size of a particular PCD token.
197 If the TokenNumber is invalid, the results are unpredictable.
199 @param[in] TokenNumber The PCD token number.
201 @return The size of the value for the PCD token.
212 Retrieves an 8-bit value for a given PCD token.
214 Retrieves the 8-bit value of a particular PCD token.
215 If the TokenNumber is invalid or the token space
216 specified by Guid does not exist, the results are
219 @param[in] Guid The token space for the token number.
220 @param[in] TokenNumber The PCD token number.
222 @return The size 8-bit value for the PCD token.
228 IN CONST EFI_GUID
*Guid
,
234 Retrieves an 16-bit value for a given PCD token.
236 Retrieves the 16-bit value of a particular PCD token.
237 If the TokenNumber is invalid or the token space
238 specified by Guid does not exist, the results are
241 @param[in] Guid The token space for the token number.
242 @param[in] TokenNumber The PCD token number.
244 @return The size 16-bit value for the PCD token.
250 IN CONST EFI_GUID
*Guid
,
256 Retrieves an 32-bit value for a given PCD token.
258 Retrieves the 32-bit value of a particular PCD token.
259 If the TokenNumber is invalid or the token space
260 specified by Guid does not exist, the results are
263 @param[in] Guid The token space for the token number.
264 @param[in] TokenNumber The PCD token number.
266 @return The size 32-bit value for the PCD token.
272 IN CONST EFI_GUID
*Guid
,
278 Retrieves an 64-bit value for a given PCD token.
280 Retrieves the 64-bit value of a particular PCD token.
281 If the TokenNumber is invalid or the token space
282 specified by Guid does not exist, the results are
285 @param[in] Guid The token space for the token number.
286 @param[in] TokenNumber The PCD token number.
288 @return The size 64-bit value for the PCD token.
294 IN CONST EFI_GUID
*Guid
,
300 Retrieves a pointer to a value for a given PCD token.
302 Retrieves the current pointer to the buffer for a PCD token number.
303 Do not make any assumptions about the alignment of the pointer that
304 is returned by this function call. If the TokenNumber is invalid,
305 the results are unpredictable.
307 @param[in] Guid The token space for the token number.
308 @param[in] TokenNumber The PCD token number.
310 @return The pointer to the buffer to be retrived.
316 IN CONST EFI_GUID
*Guid
,
322 Retrieves an Boolean value for a given PCD token.
324 Retrieves the Boolean 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 Boolean value for the PCD token.
338 IN CONST EFI_GUID
*Guid
,
344 Retrieves the size of the value for a given PCD token.
346 Retrieves the current size of a particular PCD token.
347 If the TokenNumber is invalid, 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 size of the value for the PCD token.
358 IN CONST EFI_GUID
*Guid
,
364 Sets an 8-bit value for a given PCD token.
366 When the PCD service sets a value, it will check to ensure that the
367 size of the value being set is compatible with the Token's existing definition.
368 If it is not, an error will be returned.
370 @param[in] TokenNumber The PCD token number.
371 @param[in] Value The value to set for the PCD token.
373 @retval EFI_SUCCESS Procedure returned successfully.
374 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
375 being set was incompatible with a call to this function.
376 Use GetSize() to retrieve the size of the target data.
377 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
383 IN UINTN TokenNumber
,
389 Sets an 16-bit value for a given PCD token.
391 When the PCD service sets a value, it will check to ensure that the
392 size of the value being set is compatible with the Token's existing definition.
393 If it is not, an error will be returned.
395 @param[in] TokenNumber The PCD token number.
396 @param[in] Value The value to set for the PCD token.
398 @retval EFI_SUCCESS Procedure returned successfully.
399 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
400 being set was incompatible with a call to this function.
401 Use GetSize() to retrieve the size of the target data.
402 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
408 IN UINTN TokenNumber
,
414 Sets an 32-bit value for a given PCD token.
416 When the PCD service sets a value, it will check to ensure that the
417 size of the value being set is compatible with the Token's existing definition.
418 If it is not, an error will be returned.
420 @param[in] TokenNumber The PCD token number.
421 @param[in] Value The value to set for the PCD token.
423 @retval EFI_SUCCESS Procedure returned successfully.
424 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
425 being set was incompatible with a call to this function.
426 Use GetSize() to retrieve the size of the target data.
427 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
433 IN UINTN TokenNumber
,
439 Sets an 64-bit value for a given PCD token.
441 When the PCD service sets a value, it will check to ensure that the
442 size of the value being set is compatible with the Token's existing definition.
443 If it is not, an error will be returned.
445 @param[in] TokenNumber The PCD token number.
446 @param[in] Value The value to set for the PCD token.
448 @retval EFI_SUCCESS Procedure returned successfully.
449 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
450 being set was incompatible with a call to this function.
451 Use GetSize() to retrieve the size of the target data.
452 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
458 IN UINTN TokenNumber
,
465 Sets a value of a specified size for a given PCD token.
467 When the PCD service sets a value, it will check to ensure that the
468 size of the value being set is compatible with the Token's existing definition.
469 If it is not, an error will be returned.
471 @param[in] TokenNumber The PCD token number.
472 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
473 On input, if the SizeOfValue is greater than the maximum size supported
474 for this TokenNumber then the output value of SizeOfValue will reflect
475 the maximum size supported for this TokenNumber.
476 @param[in] Buffer The buffer to set for the PCD token.
478 @retval EFI_SUCCESS Procedure returned successfully.
479 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
480 being set was incompatible with a call to this function.
481 Use GetSize() to retrieve the size of the target data.
482 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
488 IN UINTN TokenNumber
,
489 IN OUT UINTN
*SizeOfBuffer
,
495 Sets an Boolean value for a given PCD token.
497 When the PCD service sets a value, it will check to ensure that the
498 size of the value being set is compatible with the Token's existing definition.
499 If it is not, an error will be returned.
501 @param[in] TokenNumber The PCD token number.
502 @param[in] Value The value to set for the PCD token.
504 @retval EFI_SUCCESS Procedure returned successfully.
505 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
506 being set was incompatible with a call to this function.
507 Use GetSize() to retrieve the size of the target data.
508 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
514 IN UINTN TokenNumber
,
521 Sets an 8-bit value for a given PCD token.
523 When the PCD service sets a value, it will check to ensure that the
524 size of the value being set is compatible with the Token's existing definition.
525 If it is not, an error will be returned.
527 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
528 @param[in] TokenNumber The PCD token number.
529 @param[in] Value The value to set for the PCD token.
531 @retval EFI_SUCCESS Procedure returned successfully.
532 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
533 being set was incompatible with a call to this function.
534 Use GetSize() to retrieve the size of the target data.
535 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
541 IN CONST EFI_GUID
*Guid
,
542 IN UINTN TokenNumber
,
548 Sets an 16-bit value for a given PCD token.
550 When the PCD service sets a value, it will check to ensure that the
551 size of the value being set is compatible with the Token's existing definition.
552 If it is not, an error will be returned.
554 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
555 @param[in] TokenNumber The PCD token number.
556 @param[in] Value The value to set for the PCD token.
558 @retval EFI_SUCCESS Procedure returned successfully.
559 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
560 being set was incompatible with a call to this function.
561 Use GetSize() to retrieve the size of the target data.
562 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
568 IN CONST EFI_GUID
*Guid
,
569 IN UINTN TokenNumber
,
575 Sets an 32-bit value for a given PCD token.
577 When the PCD service sets a value, it will check to ensure that the
578 size of the value being set is compatible with the Token's existing definition.
579 If it is not, an error will be returned.
581 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
582 @param[in] TokenNumber The PCD token number.
583 @param[in] Value The value to set for the PCD token.
585 @retval EFI_SUCCESS Procedure returned successfully.
586 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
587 being set was incompatible with a call to this function.
588 Use GetSize() to retrieve the size of the target data.
589 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
595 IN CONST EFI_GUID
*Guid
,
596 IN UINTN TokenNumber
,
602 Sets an 64-bit value for a given PCD token.
604 When the PCD service sets a value, it will check to ensure that the
605 size of the value being set is compatible with the Token's existing definition.
606 If it is not, an error will be returned.
608 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
609 @param[in] TokenNumber The PCD token number.
610 @param[in] Value The value to set for the PCD token.
612 @retval EFI_SUCCESS Procedure returned successfully.
613 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
614 being set was incompatible with a call to this function.
615 Use GetSize() to retrieve the size of the target data.
616 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
622 IN CONST EFI_GUID
*Guid
,
623 IN UINTN TokenNumber
,
629 Sets a value of a specified size for a given PCD token.
631 When the PCD service sets a value, it will check to ensure that the
632 size of the value being set is compatible with the Token's existing definition.
633 If it is not, an error will be returned.
635 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
636 @param[in] TokenNumber The PCD token number.
637 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
638 On input, if the SizeOfValue is greater than the maximum size supported
639 for this TokenNumber then the output value of SizeOfValue will reflect
640 the maximum size supported for this TokenNumber.
641 @param[in] Buffer The buffer to set for the PCD token.
643 @retval EFI_SUCCESS Procedure returned successfully.
644 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
645 being set was incompatible with a call to this function.
646 Use GetSize() to retrieve the size of the target data.
647 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
653 IN CONST EFI_GUID
*Guid
,
654 IN UINTN TokenNumber
,
655 IN OUT UINTN
*SizeOfBuffer
,
661 Sets an Boolean value for a given PCD token.
663 When the PCD service sets a value, it will check to ensure that the
664 size of the value being set is compatible with the Token's existing definition.
665 If it is not, an error will be returned.
667 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
668 @param[in] TokenNumber The PCD token number.
669 @param[in] Value The value 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
,
688 Specifies a function to be called anytime the value of a designated token is changed.
690 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
691 @param[in] TokenNumber The PCD token number.
692 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
694 @retval EFI_SUCCESS The PCD service has successfully established a call event
695 for the CallBackToken requested.
696 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
701 DxeRegisterCallBackOnSet (
702 IN CONST EFI_GUID
*Guid
, OPTIONAL
703 IN UINTN TokenNumber
,
704 IN PCD_PROTOCOL_CALLBACK CallBackFunction
709 Cancels a previously set callback function for a particular PCD token number.
711 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
712 @param[in] TokenNumber The PCD token number.
713 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
715 @retval EFI_SUCCESS The PCD service has successfully established a call event
716 for the CallBackToken requested.
717 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
722 DxeUnRegisterCallBackOnSet (
723 IN CONST EFI_GUID
*Guid
, OPTIONAL
724 IN UINTN TokenNumber
,
725 IN PCD_PROTOCOL_CALLBACK CallBackFunction
730 Retrieves the next valid PCD token for a given namespace.
732 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
733 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
734 If the input token namespace or token number does not exist on the platform,
735 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token,
736 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and
737 there is no valid token number for this token namespace, *TokenNumber will be assigned to
738 0 and the function return EFI_SUCCESS. If the token number is the last valid token number,
739 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.
741 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
742 is already the last valid token number in the PCD database.
743 In the later case, *TokenNumber is updated with the value of 0.
744 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
750 IN CONST EFI_GUID
*Guid
, OPTIONAL
751 IN OUT UINTN
*TokenNumber
756 Get next token space in PCD database according to given token space guid.
758 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
761 @param Guid Given token space guid. If NULL, then Guid will be set to
762 the first PCD token space in PCD database, If not NULL, then
763 Guid will be set to next PCD token space.
765 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
766 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
767 token space in PCD database.
768 @retval EFI_SUCCESS Success to get next token space guid.
772 DxePcdGetNextTokenSpace (
773 IN OUT CONST EFI_GUID
**Guid
779 PCD_PROTOCOL_CALLBACK CallbackFn
;
782 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)
785 // Internal Functions
789 Wrapper function for setting non-pointer type value for a PCD entry.
791 @param TokenNumber Pcd token number autogenerated by build tools.
792 @param Data Value want to be set for PCD entry
793 @param Size Size of value.
795 @return status of SetWorker.
800 IN UINTN TokenNumber
,
807 Set value for an PCD entry
809 @param TokenNumber Pcd token number autogenerated by build tools.
810 @param Data Value want to be set for PCD entry
811 @param Size Size of value.
812 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
813 If False, the type of PCD entry's value is not Pointer.
815 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
816 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
817 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
818 range of UINT8, UINT16, UINT32, UINT64
819 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
823 IN UINTN TokenNumber
,
831 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
833 @param ExTokenNumber Token number for dynamic-ex PCD.
834 @param Guid Token space guid for dynamic-ex PCD.
835 @param Data Value want to be set.
836 @param SetSize The size of value.
838 @return status of ExSetWorker().
843 IN UINTN ExTokenNumber
,
844 IN CONST EFI_GUID
*Guid
,
851 Set value for a dynamic PCD entry.
853 This routine find the local token number according to dynamic-ex PCD's token
854 space guid and token number firstly, and invoke callback function if this PCD
855 entry registered callback function. Finally, invoken general SetWorker to set
858 @param ExTokenNumber Dynamic-ex PCD token number.
859 @param Guid Token space guid for dynamic-ex PCD.
860 @param Data PCD value want to be set
861 @param SetSize Size of value.
862 @param PtrType If TRUE, this PCD entry is pointer type.
863 If FALSE, this PCD entry is not pointer type.
865 @return status of SetWorker().
870 IN UINTN ExTokenNumber
,
871 IN CONST EFI_GUID
*Guid
,
879 Get the PCD entry pointer in PCD database.
881 This routine will visit PCD database to find the PCD entry according to given
882 token number. The given token number is autogened by build tools and it will be
883 translated to local token number. Local token number contains PCD's type and
884 offset of PCD entry in PCD database.
886 @param TokenNumber Token's number, it is autogened by build tools
887 @param GetSize The size of token's value
889 @return PCD entry pointer in PCD database
894 IN UINTN TokenNumber
,
900 Wrapper function for get PCD value for dynamic-ex PCD.
902 @param Guid Token space guid for dynamic-ex PCD.
903 @param ExTokenNumber Token number for dyanmic-ex PCD.
904 @param GetSize The size of dynamic-ex PCD value.
906 @return PCD entry in PCD database.
911 IN CONST EFI_GUID
*Guid
,
912 IN UINTN ExTokenNumber
,
918 Find the local token number according to system SKU ID.
920 @param LocalTokenNumber PCD token number
921 @param Size The size of PCD entry.
922 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
923 If False, the PCD entry is initialized in DXE phase.
925 @return Token number according to system SKU ID.
929 GetSkuEnabledTokenNumber (
930 UINT32 LocalTokenNumber
,
937 Get Variable which contains HII type PCD entry.
939 @param VariableGuid Variable's guid
940 @param VariableName Variable's unicode name string
941 @param VariableData Variable's data pointer,
942 @param VariableSize Variable's size.
944 @return the status of gRT->GetVariable
948 IN EFI_GUID
*VariableGuid
,
949 IN UINT16
*VariableName
,
950 OUT UINT8
**VariableData
,
951 OUT UINTN
*VariableSize
956 Set value for HII-type PCD.
958 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
959 HII-type PCD is to visit this variable.
961 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
962 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
963 @param Data Value want to be set.
964 @param DataSize Size of value
965 @param Offset Value offset of HII-type PCD in variable.
967 @return status of GetVariable()/SetVariable().
972 IN EFI_GUID
*VariableGuid
,
973 IN UINT16
*VariableName
,
981 Register the callback function for a PCD entry.
983 This routine will register a callback function to a PCD entry by given token number
984 and token space guid.
986 @param TokenNumber PCD token's number, it is autogened by build tools.
987 @param Guid PCD token space's guid,
988 if not NULL, this PCD is dynamicEx type PCD.
989 @param CallBackFunction Callback function pointer
991 @return EFI_SUCCESS Always success for registering callback function.
995 DxeRegisterCallBackWorker (
996 IN UINTN TokenNumber
,
997 IN CONST EFI_GUID
*Guid
, OPTIONAL
998 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1003 UnRegister the callback function for a PCD entry.
1005 This routine will unregister a callback function to a PCD entry by given token number
1006 and token space guid.
1008 @param TokenNumber PCD token's number, it is autogened by build tools.
1009 @param Guid PCD token space's guid.
1010 if not NULL, this PCD is dynamicEx type PCD.
1011 @param CallBackFunction Callback function pointer
1013 @retval EFI_SUCCESS Callback function is success to be unregister.
1014 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
1017 DxeUnRegisterCallBackWorker (
1018 IN UINTN TokenNumber
,
1019 IN CONST EFI_GUID
*Guid
, OPTIONAL
1020 IN PCD_PROTOCOL_CALLBACK CallBackFunction
1025 Initialize the PCD database in DXE phase.
1027 PCD database in DXE phase also contains PCD database in PEI phase which is copied
1032 BuildPcdDxeDataBase (
1038 Get local token number according to dynamic-ex PCD's {token space guid:token number}
1040 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1041 in DEC file. PCD database maintain a mapping table that translate pair of {token
1042 space guid: token number} to local token number.
1044 @param Guid Token space guid for dynamic-ex PCD entry.
1045 @param ExTokenNumber EDES_TODO: Add parameter description
1047 @return local token number for dynamic-ex PCD.
1051 GetExPcdTokenNumber (
1052 IN CONST EFI_GUID
*Guid
,
1053 IN UINT32 ExTokenNumber
1058 Get next token number in given token space.
1060 This routine is used for dynamicEx type PCD. It will firstly scan token space
1061 table to get token space according to given token space guid. Then scan given
1062 token number in found token space, if found, then return next token number in
1065 @param Guid Token space guid. Next token number will be scaned in
1067 @param TokenNumber Token number.
1068 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1070 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1071 in token space table.
1072 @param GuidTable Token space guid table. It will be used for scan token space
1073 by given token space guid.
1074 @param SizeOfGuidTable The size of guid table.
1075 @param ExMapTable DynamicEx token number mapping table.
1076 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1078 @retval EFI_NOT_FOUND Can not given token space or token number.
1079 @retval EFI_SUCCESS Success to get next token number.
1083 ExGetNextTokeNumber (
1084 IN CONST EFI_GUID
*Guid
,
1085 IN OUT UINTN
*TokenNumber
,
1086 IN EFI_GUID
*GuidTable
,
1087 IN UINTN SizeOfGuidTable
,
1088 IN DYNAMICEX_MAPPING
*ExMapTable
,
1089 IN UINTN SizeOfExMapTable
1094 Get size of POINTER type PCD value.
1096 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1097 @param MaxSize Maxmium size of POINTER type PCD value.
1099 @return size of POINTER type PCD value.
1104 IN UINTN LocalTokenNumberTableIdx
,
1110 Set size of POINTER type PCD value. The size should not exceed the maxmium size
1113 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1114 @param CurrentSize Size of POINTER type PCD value.
1116 @retval TRUE Success to set size of PCD value.
1117 @retval FALSE Fail to set size of PCD value.
1121 IN UINTN LocalTokenNumberTableIdx
,
1122 IN OUT UINTN
*CurrentSize
1126 extern EFI_GUID gPcdDataBaseHobGuid
;
1128 extern PCD_DATABASE
* mPcdDatabase
;
1130 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1132 extern EFI_LOCK mPcdDatabaseLock
;