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.
79 Retrieves an 8-bit value for a given PCD token.
81 Retrieves the current byte-sized value for a PCD token number.
82 If the TokenNumber is invalid, the results are unpredictable.
84 @param[in] TokenNumber The PCD token number.
86 @return The UINT8 value.
96 Retrieves an 16-bit value for a given PCD token.
98 Retrieves the current 16-bits value for a PCD token number.
99 If the TokenNumber is invalid, the results are unpredictable.
101 @param[in] TokenNumber The PCD token number.
103 @return The UINT16 value.
113 Retrieves an 32-bit value for a given PCD token.
115 Retrieves the current 32-bits value for a PCD token number.
116 If the TokenNumber is invalid, the results are unpredictable.
118 @param[in] TokenNumber The PCD token number.
120 @return The UINT32 value.
130 Retrieves an 64-bit value for a given PCD token.
132 Retrieves the current 64-bits value for a PCD token number.
133 If the TokenNumber is invalid, the results are unpredictable.
135 @param[in] TokenNumber The PCD token number.
137 @return The UINT64 value.
147 Retrieves a pointer to a value for a given PCD token.
149 Retrieves the current pointer to the buffer for a PCD token number.
150 Do not make any assumptions about the alignment of the pointer that
151 is returned by this function call. If the TokenNumber is invalid,
152 the results are unpredictable.
154 @param[in] TokenNumber The PCD token number.
156 @return The pointer to the buffer to be retrived.
166 Retrieves a Boolean value for a given PCD token.
168 Retrieves the current boolean value for a PCD token number.
169 Do not make any assumptions about the alignment of the pointer that
170 is returned by this function call. If the TokenNumber is invalid,
171 the results are unpredictable.
173 @param[in] TokenNumber The PCD token number.
175 @return The Boolean value.
185 Retrieves the size of the value for a given PCD token.
187 Retrieves the current size of a particular PCD token.
188 If the TokenNumber is invalid, the results are unpredictable.
190 @param[in] TokenNumber The PCD token number.
192 @return The size of the value for the PCD token.
202 Retrieves an 8-bit value for a given PCD token.
204 Retrieves the 8-bit value of a particular PCD token.
205 If the TokenNumber is invalid or the token space
206 specified by Guid does not exist, the results are
209 @param[in] Guid The token space for the token number.
210 @param[in] TokenNumber The PCD token number.
212 @return The size 8-bit value for the PCD token.
218 IN CONST EFI_GUID
*Guid
,
223 Retrieves an 16-bit value for a given PCD token.
225 Retrieves the 16-bit value of a particular PCD token.
226 If the TokenNumber is invalid or the token space
227 specified by Guid does not exist, the results are
230 @param[in] Guid The token space for the token number.
231 @param[in] TokenNumber The PCD token number.
233 @return The size 16-bit value for the PCD token.
239 IN CONST EFI_GUID
*Guid
,
244 Retrieves an 32-bit value for a given PCD token.
246 Retrieves the 32-bit value of a particular PCD token.
247 If the TokenNumber is invalid or the token space
248 specified by Guid does not exist, the results are
251 @param[in] Guid The token space for the token number.
252 @param[in] TokenNumber The PCD token number.
254 @return The size 32-bit value for the PCD token.
260 IN CONST EFI_GUID
*Guid
,
265 Retrieves an 64-bit value for a given PCD token.
267 Retrieves the 64-bit value of a particular PCD token.
268 If the TokenNumber is invalid or the token space
269 specified by Guid does not exist, the results are
272 @param[in] Guid The token space for the token number.
273 @param[in] TokenNumber The PCD token number.
275 @return The size 64-bit value for the PCD token.
281 IN CONST EFI_GUID
*Guid
,
286 Retrieves a pointer to a value for a given PCD token.
288 Retrieves the current pointer to the buffer for a PCD token number.
289 Do not make any assumptions about the alignment of the pointer that
290 is returned by this function call. If the TokenNumber is invalid,
291 the results are unpredictable.
293 @param[in] Guid The token space for the token number.
294 @param[in] TokenNumber The PCD token number.
296 @return The pointer to the buffer to be retrived.
302 IN CONST EFI_GUID
*Guid
,
307 Retrieves an Boolean value for a given PCD token.
309 Retrieves the Boolean value of a particular PCD token.
310 If the TokenNumber is invalid or the token space
311 specified by Guid does not exist, the results are
314 @param[in] Guid The token space for the token number.
315 @param[in] TokenNumber The PCD token number.
317 @return The size Boolean value for the PCD token.
323 IN CONST EFI_GUID
*Guid
,
328 Retrieves the size of the value for a given PCD token.
330 Retrieves the current size of a particular PCD token.
331 If the TokenNumber is invalid, the results are unpredictable.
333 @param[in] Guid The token space for the token number.
334 @param[in] TokenNumber The PCD token number.
336 @return The size of the value for the PCD token.
342 IN CONST EFI_GUID
*Guid
,
347 Sets an 8-bit value for a given PCD token.
349 When the PCD service sets a value, it will check to ensure that the
350 size of the value being set is compatible with the Token's existing definition.
351 If it is not, an error will be returned.
353 @param[in] TokenNumber The PCD token number.
354 @param[in] Value The value to set for the PCD token.
356 @retval EFI_SUCCESS Procedure returned successfully.
357 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
358 being set was incompatible with a call to this function.
359 Use GetSize() to retrieve the size of the target data.
360 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
366 IN UINTN TokenNumber
,
371 Sets an 16-bit value for a given PCD token.
373 When the PCD service sets a value, it will check to ensure that the
374 size of the value being set is compatible with the Token's existing definition.
375 If it is not, an error will be returned.
377 @param[in] TokenNumber The PCD token number.
378 @param[in] Value The value to set for the PCD token.
380 @retval EFI_SUCCESS Procedure returned successfully.
381 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
382 being set was incompatible with a call to this function.
383 Use GetSize() to retrieve the size of the target data.
384 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
390 IN UINTN TokenNumber
,
395 Sets an 32-bit value for a given PCD token.
397 When the PCD service sets a value, it will check to ensure that the
398 size of the value being set is compatible with the Token's existing definition.
399 If it is not, an error will be returned.
401 @param[in] TokenNumber The PCD token number.
402 @param[in] Value The value to set for the PCD token.
404 @retval EFI_SUCCESS Procedure returned successfully.
405 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
406 being set was incompatible with a call to this function.
407 Use GetSize() to retrieve the size of the target data.
408 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
414 IN UINTN TokenNumber
,
419 Sets an 64-bit value for a given PCD token.
421 When the PCD service sets a value, it will check to ensure that the
422 size of the value being set is compatible with the Token's existing definition.
423 If it is not, an error will be returned.
425 @param[in] TokenNumber The PCD token number.
426 @param[in] Value The value to set for the PCD token.
428 @retval EFI_SUCCESS Procedure returned successfully.
429 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
430 being set was incompatible with a call to this function.
431 Use GetSize() to retrieve the size of the target data.
432 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
438 IN UINTN TokenNumber
,
444 Sets a value of a specified size for a given PCD token.
446 When the PCD service sets a value, it will check to ensure that the
447 size of the value being set is compatible with the Token's existing definition.
448 If it is not, an error will be returned.
450 @param[in] TokenNumber The PCD token number.
451 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
452 On input, if the SizeOfValue is greater than the maximum size supported
453 for this TokenNumber then the output value of SizeOfValue will reflect
454 the maximum size supported for this TokenNumber.
455 @param[in] Buffer The buffer to set for the PCD token.
457 @retval EFI_SUCCESS Procedure returned successfully.
458 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
459 being set was incompatible with a call to this function.
460 Use GetSize() to retrieve the size of the target data.
461 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
467 IN UINTN TokenNumber
,
468 IN OUT UINTN
*SizeOfBuffer
,
473 Sets an Boolean value for a given PCD token.
475 When the PCD service sets a value, it will check to ensure that the
476 size of the value being set is compatible with the Token's existing definition.
477 If it is not, an error will be returned.
479 @param[in] TokenNumber The PCD token number.
480 @param[in] Value The value to set for the PCD token.
482 @retval EFI_SUCCESS Procedure returned successfully.
483 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
484 being set was incompatible with a call to this function.
485 Use GetSize() to retrieve the size of the target data.
486 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
492 IN UINTN TokenNumber
,
498 Sets an 8-bit value for a given PCD token.
500 When the PCD service sets a value, it will check to ensure that the
501 size of the value being set is compatible with the Token's existing definition.
502 If it is not, an error will be returned.
504 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
505 @param[in] TokenNumber The PCD token number.
506 @param[in] Value The value to set for the PCD token.
508 @retval EFI_SUCCESS Procedure returned successfully.
509 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
510 being set was incompatible with a call to this function.
511 Use GetSize() to retrieve the size of the target data.
512 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
518 IN CONST EFI_GUID
*Guid
,
519 IN UINTN TokenNumber
,
524 Sets an 16-bit value for a given PCD token.
526 When the PCD service sets a value, it will check to ensure that the
527 size of the value being set is compatible with the Token's existing definition.
528 If it is not, an error will be returned.
530 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
531 @param[in] TokenNumber The PCD token number.
532 @param[in] Value The value to set for the PCD token.
534 @retval EFI_SUCCESS Procedure returned successfully.
535 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
536 being set was incompatible with a call to this function.
537 Use GetSize() to retrieve the size of the target data.
538 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
544 IN CONST EFI_GUID
*Guid
,
545 IN UINTN TokenNumber
,
550 Sets an 32-bit value for a given PCD token.
552 When the PCD service sets a value, it will check to ensure that the
553 size of the value being set is compatible with the Token's existing definition.
554 If it is not, an error will be returned.
556 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
557 @param[in] TokenNumber The PCD token number.
558 @param[in] Value The value to set for the PCD token.
560 @retval EFI_SUCCESS Procedure returned successfully.
561 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
562 being set was incompatible with a call to this function.
563 Use GetSize() to retrieve the size of the target data.
564 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
570 IN CONST EFI_GUID
*Guid
,
571 IN UINTN TokenNumber
,
576 Sets an 64-bit value for a given PCD token.
578 When the PCD service sets a value, it will check to ensure that the
579 size of the value being set is compatible with the Token's existing definition.
580 If it is not, an error will be returned.
582 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
583 @param[in] TokenNumber The PCD token number.
584 @param[in] Value The value to set for the PCD token.
586 @retval EFI_SUCCESS Procedure returned successfully.
587 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
588 being set was incompatible with a call to this function.
589 Use GetSize() to retrieve the size of the target data.
590 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
596 IN CONST EFI_GUID
*Guid
,
597 IN UINTN TokenNumber
,
602 Sets a value of a specified size 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, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
611 On input, if the SizeOfValue is greater than the maximum size supported
612 for this TokenNumber then the output value of SizeOfValue will reflect
613 the maximum size supported for this TokenNumber.
614 @param[in] Buffer The buffer 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
,
628 IN OUT UINTN
*SizeOfBuffer
,
633 Sets an Boolean value for a given PCD token.
635 When the PCD service sets a value, it will check to ensure that the
636 size of the value being set is compatible with the Token's existing definition.
637 If it is not, an error will be returned.
639 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
640 @param[in] TokenNumber The PCD token number.
641 @param[in] Value The value 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
,
659 Specifies a function to be called anytime the value of a designated token is changed.
661 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
662 @param[in] TokenNumber The PCD token number.
663 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
665 @retval EFI_SUCCESS The PCD service has successfully established a call event
666 for the CallBackToken requested.
667 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
672 DxeRegisterCallBackOnSet (
673 IN CONST EFI_GUID
*Guid
, OPTIONAL
674 IN UINTN TokenNumber
,
675 IN PCD_PROTOCOL_CALLBACK CallBackFunction
679 Cancels a previously set callback function for a particular PCD token number.
681 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
682 @param[in] TokenNumber The PCD token number.
683 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
685 @retval EFI_SUCCESS The PCD service has successfully established a call event
686 for the CallBackToken requested.
687 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
692 DxeUnRegisterCallBackOnSet (
693 IN CONST EFI_GUID
*Guid
, OPTIONAL
694 IN UINTN TokenNumber
,
695 IN PCD_PROTOCOL_CALLBACK CallBackFunction
699 Retrieves the next valid PCD token for a given namespace.
701 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
702 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
703 If the input token namespace or token number does not exist on the platform,
704 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token,
705 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and
706 there is no valid token number for this token namespace, *TokenNumber will be assigned to
707 0 and the function return EFI_SUCCESS. If the token number is the last valid token number,
708 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.
710 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
711 is already the last valid token number in the PCD database.
712 In the later case, *TokenNumber is updated with the value of 0.
713 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
719 IN CONST EFI_GUID
*Guid
, OPTIONAL
720 IN OUT UINTN
*TokenNumber
724 Get next token space in PCD database according to given token space guid.
726 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
729 @param Guid Given token space guid. If NULL, then Guid will be set to
730 the first PCD token space in PCD database, If not NULL, then
731 Guid will be set to next PCD token space.
733 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
734 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
735 token space in PCD database.
736 @retval EFI_SUCCESS Success to get next token space guid.
740 DxePcdGetNextTokenSpace (
741 IN OUT CONST EFI_GUID
**Guid
746 PCD_PROTOCOL_CALLBACK CallbackFn
;
749 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)
752 // Internal Functions
756 Wrapper function for setting non-pointer type value for a PCD entry.
758 @param TokenNumber Pcd token number autogenerated by build tools.
759 @param Data Value want to be set for PCD entry
760 @param Size Size of value.
762 @return status of SetWorker.
767 IN UINTN TokenNumber
,
773 Set value for an PCD entry
775 @param TokenNumber Pcd token number autogenerated by build tools.
776 @param Data Value want to be set for PCD entry
777 @param Size Size of value.
778 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
779 If False, the type of PCD entry's value is not Pointer.
781 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
782 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
783 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
784 range of UINT8, UINT16, UINT32, UINT64
785 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
789 IN UINTN TokenNumber
,
796 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
798 @param ExTokenNumber Token number for dynamic-ex PCD.
799 @param Guid Token space guid for dynamic-ex PCD.
800 @param Data Value want to be set.
801 @param SetSize The size of value.
803 @return status of ExSetWorker().
808 IN UINTN ExTokenNumber
,
809 IN CONST EFI_GUID
*Guid
,
815 Set value for a dynamic PCD entry.
817 This routine find the local token number according to dynamic-ex PCD's token
818 space guid and token number firstly, and invoke callback function if this PCD
819 entry registered callback function. Finally, invoken general SetWorker to set
822 @param ExTokenNumber Dynamic-ex PCD token number.
823 @param Guid Token space guid for dynamic-ex PCD.
824 @param Data PCD value want to be set
825 @param SetSize Size of value.
826 @param PtrType If TRUE, this PCD entry is pointer type.
827 If FALSE, this PCD entry is not pointer type.
829 @return status of SetWorker().
834 IN UINTN ExTokenNumber
,
835 IN CONST EFI_GUID
*Guid
,
842 Get the PCD entry pointer in PCD database.
844 This routine will visit PCD database to find the PCD entry according to given
845 token number. The given token number is autogened by build tools and it will be
846 translated to local token number. Local token number contains PCD's type and
847 offset of PCD entry in PCD database.
849 @param TokenNumber Token's number, it is autogened by build tools
850 @param GetSize The size of token's value
852 @return PCD entry pointer in PCD database
857 IN UINTN TokenNumber
,
862 Wrapper function for get PCD value for dynamic-ex PCD.
864 @param Guid Token space guid for dynamic-ex PCD.
865 @param ExTokenNumber Token number for dyanmic-ex PCD.
866 @param GetSize The size of dynamic-ex PCD value.
868 @return PCD entry in PCD database.
873 IN CONST EFI_GUID
*Guid
,
874 IN UINTN ExTokenNumber
,
879 Find the local token number according to system SKU ID.
881 @param LocalTokenNumber PCD token number
882 @param Size The size of PCD entry.
883 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
884 If False, the PCD entry is initialized in DXE phase.
886 @return Token number according to system SKU ID.
890 GetSkuEnabledTokenNumber (
891 UINT32 LocalTokenNumber
,
897 Get Variable which contains HII type PCD entry.
899 @param VariableGuid Variable's guid
900 @param VariableName Variable's unicode name string
901 @param VariableData Variable's data pointer,
902 @param VariableSize Variable's size.
904 @return the status of gRT->GetVariable
908 IN EFI_GUID
*VariableGuid
,
909 IN UINT16
*VariableName
,
910 OUT UINT8
**VariableData
,
911 OUT UINTN
*VariableSize
915 Set value for HII-type PCD.
917 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
918 HII-type PCD is to visit this variable.
920 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
921 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
922 @param Data Value want to be set.
923 @param DataSize Size of value
924 @param Offset Value offset of HII-type PCD in variable.
926 @return status of GetVariable()/SetVariable().
931 IN EFI_GUID
*VariableGuid
,
932 IN UINT16
*VariableName
,
939 Register the callback function for a PCD entry.
941 This routine will register a callback function to a PCD entry by given token number
942 and token space guid.
944 @param TokenNumber PCD token's number, it is autogened by build tools.
945 @param Guid PCD token space's guid,
946 if not NULL, this PCD is dynamicEx type PCD.
947 @param CallBackFunction Callback function pointer
949 @return EFI_SUCCESS Always success for registering callback function.
953 DxeRegisterCallBackWorker (
954 IN UINTN TokenNumber
,
955 IN CONST EFI_GUID
*Guid
, OPTIONAL
956 IN PCD_PROTOCOL_CALLBACK CallBackFunction
960 UnRegister the callback function for a PCD entry.
962 This routine will unregister a callback function to a PCD entry by given token number
963 and token space guid.
965 @param TokenNumber PCD token's number, it is autogened by build tools.
966 @param Guid PCD token space's guid.
967 if not NULL, this PCD is dynamicEx type PCD.
968 @param CallBackFunction Callback function pointer
970 @retval EFI_SUCCESS Callback function is success to be unregister.
971 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
974 DxeUnRegisterCallBackWorker (
975 IN UINTN TokenNumber
,
976 IN CONST EFI_GUID
*Guid
, OPTIONAL
977 IN PCD_PROTOCOL_CALLBACK CallBackFunction
981 Initialize the PCD database in DXE phase.
983 PCD database in DXE phase also contains PCD database in PEI phase which is copied
988 BuildPcdDxeDataBase (
993 Get local token number according to dynamic-ex PCD's {token space guid:token number}
995 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
996 in DEC file. PCD database maintain a mapping table that translate pair of {token
997 space guid: token number} to local token number.
999 @param Guid Token space guid for dynamic-ex PCD entry.
1000 @param ExTokenNumber EDES_TODO: Add parameter description
1002 @return local token number for dynamic-ex PCD.
1006 GetExPcdTokenNumber (
1007 IN CONST EFI_GUID
*Guid
,
1008 IN UINT32 ExTokenNumber
1012 Get next token number in given token space.
1014 This routine is used for dynamicEx type PCD. It will firstly scan token space
1015 table to get token space according to given token space guid. Then scan given
1016 token number in found token space, if found, then return next token number in
1019 @param Guid Token space guid. Next token number will be scaned in
1021 @param TokenNumber Token number.
1022 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1024 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1025 in token space table.
1026 @param GuidTable Token space guid table. It will be used for scan token space
1027 by given token space guid.
1028 @param SizeOfGuidTable The size of guid table.
1029 @param ExMapTable DynamicEx token number mapping table.
1030 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1032 @retval EFI_NOT_FOUND Can not given token space or token number.
1033 @retval EFI_SUCCESS Success to get next token number.
1037 ExGetNextTokeNumber (
1038 IN CONST EFI_GUID
*Guid
,
1039 IN OUT UINTN
*TokenNumber
,
1040 IN EFI_GUID
*GuidTable
,
1041 IN UINTN SizeOfGuidTable
,
1042 IN DYNAMICEX_MAPPING
*ExMapTable
,
1043 IN UINTN SizeOfExMapTable
1047 Get size of POINTER type PCD value.
1049 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1050 @param MaxSize Maxmium size of POINTER type PCD value.
1052 @return size of POINTER type PCD value.
1057 IN UINTN LocalTokenNumberTableIdx
,
1062 Set size of POINTER type PCD value. The size should not exceed the maxmium size
1065 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1066 @param CurrentSize Size of POINTER type PCD value.
1068 @retval TRUE Success to set size of PCD value.
1069 @retval FALSE Fail to set size of PCD value.
1073 IN UINTN LocalTokenNumberTableIdx
,
1074 IN OUT UINTN
*CurrentSize
1077 extern EFI_GUID gPcdDataBaseHobGuid
;
1079 extern PCD_DATABASE
* mPcdDatabase
;
1081 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1083 extern EFI_LOCK mPcdDatabaseLock
;