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.
15 #ifndef _PCD_DXE_SERVICE_H_
16 #define _PCD_DXE_SERVICE_H_
19 #include <Guid/PcdDataBaseHobGuid.h>
20 #include <Protocol/Pcd.h>
21 #include <Library/BaseLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/UefiLib.h>
24 #include <Library/UefiDriverEntryPoint.h>
25 #include <Library/PcdLib.h>
26 #include <Library/HobLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/UefiRuntimeServicesTableLib.h>
33 // Protocol Interface function declaration.
36 Sets the SKU value for subsequent calls to set or get PCD token values.
38 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
39 SetSku() is normally called only once by the system.
41 For each item (token), the database can hold a single value that applies to all SKUs,
42 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
43 SKU-specific values are called SKU enabled.
45 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
46 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
47 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
48 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
49 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
50 set for that Id, the results are unpredictable.
52 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
53 set values associated with a PCD token.
63 Retrieves an 8-bit value for a given PCD token.
65 Retrieves the current byte-sized value for a PCD token number.
66 If the TokenNumber is invalid, the results are unpredictable.
68 @param[in] TokenNumber The PCD token number.
70 @return The UINT8 value.
80 Retrieves an 16-bit value for a given PCD token.
82 Retrieves the current 16-bits value for a PCD token number.
83 If the TokenNumber is invalid, the results are unpredictable.
85 @param[in] TokenNumber The PCD token number.
87 @return The UINT16 value.
97 Retrieves an 32-bit value for a given PCD token.
99 Retrieves the current 32-bits value for a PCD token number.
100 If the TokenNumber is invalid, the results are unpredictable.
102 @param[in] TokenNumber The PCD token number.
104 @return The UINT32 value.
114 Retrieves an 64-bit value for a given PCD token.
116 Retrieves the current 64-bits value for a PCD token number.
117 If the TokenNumber is invalid, the results are unpredictable.
119 @param[in] TokenNumber The PCD token number.
121 @return The UINT64 value.
131 Retrieves a pointer to a value for a given PCD token.
133 Retrieves the current pointer to the buffer for a PCD token number.
134 Do not make any assumptions about the alignment of the pointer that
135 is returned by this function call. If the TokenNumber is invalid,
136 the results are unpredictable.
138 @param[in] TokenNumber The PCD token number.
140 @return The pointer to the buffer to be retrieved.
150 Retrieves a Boolean value for a given PCD token.
152 Retrieves the current boolean value for a PCD token number.
153 Do not make any assumptions about the alignment of the pointer that
154 is returned by this function call. If the TokenNumber is invalid,
155 the results are unpredictable.
157 @param[in] TokenNumber The PCD token number.
159 @return The Boolean value.
169 Retrieves the size of the value for a given PCD token.
171 Retrieves the current size of a particular PCD token.
172 If the TokenNumber is invalid, the results are unpredictable.
174 @param[in] TokenNumber The PCD token number.
176 @return The size of the value for the PCD token.
186 Retrieves an 8-bit value for a given PCD token.
188 Retrieves the 8-bit value of a particular PCD token.
189 If the TokenNumber is invalid or the token space
190 specified by Guid does not exist, the results are
193 @param[in] Guid The token space for the token number.
194 @param[in] TokenNumber The PCD token number.
196 @return The size 8-bit value for the PCD token.
202 IN CONST EFI_GUID
*Guid
,
207 Retrieves an 16-bit value for a given PCD token.
209 Retrieves the 16-bit value of a particular PCD token.
210 If the TokenNumber is invalid or the token space
211 specified by Guid does not exist, the results are
214 @param[in] Guid The token space for the token number.
215 @param[in] TokenNumber The PCD token number.
217 @return The size 16-bit value for the PCD token.
223 IN CONST EFI_GUID
*Guid
,
228 Retrieves an 32-bit value for a given PCD token.
230 Retrieves the 32-bit value of a particular PCD token.
231 If the TokenNumber is invalid or the token space
232 specified by Guid does not exist, the results are
235 @param[in] Guid The token space for the token number.
236 @param[in] TokenNumber The PCD token number.
238 @return The size 32-bit value for the PCD token.
244 IN CONST EFI_GUID
*Guid
,
249 Retrieves an 64-bit value for a given PCD token.
251 Retrieves the 64-bit value of a particular PCD token.
252 If the TokenNumber is invalid or the token space
253 specified by Guid does not exist, the results are
256 @param[in] Guid The token space for the token number.
257 @param[in] TokenNumber The PCD token number.
259 @return The size 64-bit value for the PCD token.
265 IN CONST EFI_GUID
*Guid
,
270 Retrieves a pointer to a value for a given PCD token.
272 Retrieves the current pointer to the buffer for a PCD token number.
273 Do not make any assumptions about the alignment of the pointer that
274 is returned by this function call. If the TokenNumber is invalid,
275 the results are unpredictable.
277 @param[in] Guid The token space for the token number.
278 @param[in] TokenNumber The PCD token number.
280 @return The pointer to the buffer to be retrieved.
286 IN CONST EFI_GUID
*Guid
,
291 Retrieves an Boolean value for a given PCD token.
293 Retrieves the Boolean value of a particular PCD token.
294 If the TokenNumber is invalid or the token space
295 specified by Guid does not exist, the results are
298 @param[in] Guid The token space for the token number.
299 @param[in] TokenNumber The PCD token number.
301 @return The size Boolean value for the PCD token.
307 IN CONST EFI_GUID
*Guid
,
312 Retrieves the size of the value for a given PCD token.
314 Retrieves the current size of a particular PCD token.
315 If the TokenNumber is invalid, the results are unpredictable.
317 @param[in] Guid The token space for the token number.
318 @param[in] TokenNumber The PCD token number.
320 @return The size of the value for the PCD token.
326 IN CONST EFI_GUID
*Guid
,
331 Sets an 8-bit value for a given PCD token.
333 When the PCD service sets a value, it will check to ensure that the
334 size of the value being set is compatible with the Token's existing definition.
335 If it is not, an error will be returned.
337 @param[in] TokenNumber The PCD token number.
338 @param[in] Value The value to set for the PCD token.
340 @retval EFI_SUCCESS Procedure returned successfully.
341 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
342 being set was incompatible with a call to this function.
343 Use GetSize() to retrieve the size of the target data.
344 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
350 IN UINTN TokenNumber
,
355 Sets an 16-bit value for a given PCD token.
357 When the PCD service sets a value, it will check to ensure that the
358 size of the value being set is compatible with the Token's existing definition.
359 If it is not, an error will be returned.
361 @param[in] TokenNumber The PCD token number.
362 @param[in] Value The value to set for the PCD token.
364 @retval EFI_SUCCESS Procedure returned successfully.
365 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
366 being set was incompatible with a call to this function.
367 Use GetSize() to retrieve the size of the target data.
368 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
374 IN UINTN TokenNumber
,
379 Sets an 32-bit value for a given PCD token.
381 When the PCD service sets a value, it will check to ensure that the
382 size of the value being set is compatible with the Token's existing definition.
383 If it is not, an error will be returned.
385 @param[in] TokenNumber The PCD token number.
386 @param[in] Value The value to set for the PCD token.
388 @retval EFI_SUCCESS Procedure returned successfully.
389 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
390 being set was incompatible with a call to this function.
391 Use GetSize() to retrieve the size of the target data.
392 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
398 IN UINTN TokenNumber
,
403 Sets an 64-bit value for a given PCD token.
405 When the PCD service sets a value, it will check to ensure that the
406 size of the value being set is compatible with the Token's existing definition.
407 If it is not, an error will be returned.
409 @param[in] TokenNumber The PCD token number.
410 @param[in] Value The value to set for the PCD token.
412 @retval EFI_SUCCESS Procedure returned successfully.
413 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
414 being set was incompatible with a call to this function.
415 Use GetSize() to retrieve the size of the target data.
416 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
422 IN UINTN TokenNumber
,
428 Sets a value of a specified size 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, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
436 On input, if the SizeOfValue is greater than the maximum size supported
437 for this TokenNumber then the output value of SizeOfValue will reflect
438 the maximum size supported for this TokenNumber.
439 @param[in] Buffer The buffer to set for the PCD token.
441 @retval EFI_SUCCESS Procedure returned successfully.
442 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
443 being set was incompatible with a call to this function.
444 Use GetSize() to retrieve the size of the target data.
445 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
451 IN UINTN TokenNumber
,
452 IN OUT UINTN
*SizeOfBuffer
,
457 Sets an Boolean value for a given PCD token.
459 When the PCD service sets a value, it will check to ensure that the
460 size of the value being set is compatible with the Token's existing definition.
461 If it is not, an error will be returned.
463 @param[in] TokenNumber The PCD token number.
464 @param[in] Value The value to set for the PCD token.
466 @retval EFI_SUCCESS Procedure returned successfully.
467 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
468 being set was incompatible with a call to this function.
469 Use GetSize() to retrieve the size of the target data.
470 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
476 IN UINTN TokenNumber
,
482 Sets an 8-bit value for a given PCD token.
484 When the PCD service sets a value, it will check to ensure that the
485 size of the value being set is compatible with the Token's existing definition.
486 If it is not, an error will be returned.
488 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
489 @param[in] TokenNumber The PCD token number.
490 @param[in] Value The value to set for the PCD token.
492 @retval EFI_SUCCESS Procedure returned successfully.
493 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
494 being set was incompatible with a call to this function.
495 Use GetSize() to retrieve the size of the target data.
496 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
502 IN CONST EFI_GUID
*Guid
,
503 IN UINTN TokenNumber
,
508 Sets an 16-bit value for a given PCD token.
510 When the PCD service sets a value, it will check to ensure that the
511 size of the value being set is compatible with the Token's existing definition.
512 If it is not, an error will be returned.
514 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
515 @param[in] TokenNumber The PCD token number.
516 @param[in] Value The value to set for the PCD token.
518 @retval EFI_SUCCESS Procedure returned successfully.
519 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
520 being set was incompatible with a call to this function.
521 Use GetSize() to retrieve the size of the target data.
522 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
528 IN CONST EFI_GUID
*Guid
,
529 IN UINTN TokenNumber
,
534 Sets an 32-bit value for a given PCD token.
536 When the PCD service sets a value, it will check to ensure that the
537 size of the value being set is compatible with the Token's existing definition.
538 If it is not, an error will be returned.
540 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
541 @param[in] TokenNumber The PCD token number.
542 @param[in] Value The value to set for the PCD token.
544 @retval EFI_SUCCESS Procedure returned successfully.
545 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
546 being set was incompatible with a call to this function.
547 Use GetSize() to retrieve the size of the target data.
548 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
554 IN CONST EFI_GUID
*Guid
,
555 IN UINTN TokenNumber
,
560 Sets an 64-bit value for a given PCD token.
562 When the PCD service sets a value, it will check to ensure that the
563 size of the value being set is compatible with the Token's existing definition.
564 If it is not, an error will be returned.
566 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
567 @param[in] TokenNumber The PCD token number.
568 @param[in] Value The value to set for the PCD token.
570 @retval EFI_SUCCESS Procedure returned successfully.
571 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
572 being set was incompatible with a call to this function.
573 Use GetSize() to retrieve the size of the target data.
574 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
580 IN CONST EFI_GUID
*Guid
,
581 IN UINTN TokenNumber
,
586 Sets a value of a specified size for a given PCD token.
588 When the PCD service sets a value, it will check to ensure that the
589 size of the value being set is compatible with the Token's existing definition.
590 If it is not, an error will be returned.
592 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
593 @param[in] TokenNumber The PCD token number.
594 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
595 On input, if the SizeOfValue is greater than the maximum size supported
596 for this TokenNumber then the output value of SizeOfValue will reflect
597 the maximum size supported for this TokenNumber.
598 @param[in] Buffer The buffer to set for the PCD token.
600 @retval EFI_SUCCESS Procedure returned successfully.
601 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
602 being set was incompatible with a call to this function.
603 Use GetSize() to retrieve the size of the target data.
604 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
610 IN CONST EFI_GUID
*Guid
,
611 IN UINTN TokenNumber
,
612 IN OUT UINTN
*SizeOfBuffer
,
617 Sets an Boolean value for a given PCD token.
619 When the PCD service sets a value, it will check to ensure that the
620 size of the value being set is compatible with the Token's existing definition.
621 If it is not, an error will be returned.
623 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
624 @param[in] TokenNumber The PCD token number.
625 @param[in] Value The value to set for the PCD token.
627 @retval EFI_SUCCESS Procedure returned successfully.
628 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
629 being set was incompatible with a call to this function.
630 Use GetSize() to retrieve the size of the target data.
631 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
637 IN CONST EFI_GUID
*Guid
,
638 IN UINTN TokenNumber
,
643 Specifies a function to be called anytime the value of a designated token is changed.
645 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
646 @param[in] TokenNumber The PCD token number.
647 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
649 @retval EFI_SUCCESS The PCD service has successfully established a call event
650 for the CallBackToken requested.
651 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
656 DxeRegisterCallBackOnSet (
657 IN CONST EFI_GUID
*Guid
, OPTIONAL
658 IN UINTN TokenNumber
,
659 IN PCD_PROTOCOL_CALLBACK CallBackFunction
663 Cancels a previously set callback function for a particular PCD token number.
665 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
666 @param[in] TokenNumber The PCD token number.
667 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
669 @retval EFI_SUCCESS The PCD service has successfully established a call event
670 for the CallBackToken requested.
671 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
676 DxeUnRegisterCallBackOnSet (
677 IN CONST EFI_GUID
*Guid
, OPTIONAL
678 IN UINTN TokenNumber
,
679 IN PCD_PROTOCOL_CALLBACK CallBackFunction
683 Retrieves the next valid PCD token for a given namespace.
685 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
686 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
687 If the input token namespace or token number does not exist on the platform,
688 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token,
689 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and
690 there is no valid token number for this token namespace, *TokenNumber will be assigned to
691 0 and the function return EFI_SUCCESS. If the token number is the last valid token number,
692 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.
694 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
695 is already the last valid token number in the PCD database.
696 In the later case, *TokenNumber is updated with the value of 0.
697 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
703 IN CONST EFI_GUID
*Guid
, OPTIONAL
704 IN OUT UINTN
*TokenNumber
708 Get next token space in PCD database according to given token space guid.
710 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
713 @param Guid Given token space guid. If NULL, then Guid will be set to
714 the first PCD token space in PCD database, If not NULL, then
715 Guid will be set to next PCD token space.
717 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
718 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
719 token space in PCD database.
720 @retval EFI_SUCCESS Success to get next token space guid.
724 DxePcdGetNextTokenSpace (
725 IN OUT CONST EFI_GUID
**Guid
730 PCD_PROTOCOL_CALLBACK CallbackFn
;
733 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
736 // Internal Functions
740 Wrapper function for setting non-pointer type value for a PCD entry.
742 @param TokenNumber Pcd token number autogenerated by build tools.
743 @param Data Value want to be set for PCD entry
744 @param Size Size of value.
746 @return status of SetWorker.
751 IN UINTN TokenNumber
,
757 Set value for an PCD entry
759 @param TokenNumber Pcd token number autogenerated by build tools.
760 @param Data Value want to be set for PCD entry
761 @param Size Size of value.
762 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
763 If False, the type of PCD entry's value is not Pointer.
765 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
766 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
767 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
768 range of UINT8, UINT16, UINT32, UINT64
769 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
773 IN UINTN TokenNumber
,
780 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
782 @param ExTokenNumber Token number for dynamic-ex PCD.
783 @param Guid Token space guid for dynamic-ex PCD.
784 @param Data Value want to be set.
785 @param SetSize The size of value.
787 @return status of ExSetWorker().
792 IN UINTN ExTokenNumber
,
793 IN CONST EFI_GUID
*Guid
,
799 Set value for a dynamic PCD entry.
801 This routine find the local token number according to dynamic-ex PCD's token
802 space guid and token number firstly, and invoke callback function if this PCD
803 entry registered callback function. Finally, invoken general SetWorker to set
806 @param ExTokenNumber Dynamic-ex PCD token number.
807 @param Guid Token space guid for dynamic-ex PCD.
808 @param Data PCD value want to be set
809 @param SetSize Size of value.
810 @param PtrType If TRUE, this PCD entry is pointer type.
811 If FALSE, this PCD entry is not pointer type.
813 @return status of SetWorker().
818 IN UINTN ExTokenNumber
,
819 IN CONST EFI_GUID
*Guid
,
826 Get the PCD entry pointer in PCD database.
828 This routine will visit PCD database to find the PCD entry according to given
829 token number. The given token number is autogened by build tools and it will be
830 translated to local token number. Local token number contains PCD's type and
831 offset of PCD entry in PCD database.
833 @param TokenNumber Token's number, it is autogened by build tools
834 @param GetSize The size of token's value
836 @return PCD entry pointer in PCD database
841 IN UINTN TokenNumber
,
846 Wrapper function for get PCD value for dynamic-ex PCD.
848 @param Guid Token space guid for dynamic-ex PCD.
849 @param ExTokenNumber Token number for dynamic-ex PCD.
850 @param GetSize The size of dynamic-ex PCD value.
852 @return PCD entry in PCD database.
857 IN CONST EFI_GUID
*Guid
,
858 IN UINTN ExTokenNumber
,
863 Find the local token number according to system SKU ID.
865 @param LocalTokenNumber PCD token number
866 @param Size The size of PCD entry.
867 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
868 If False, the PCD entry is initialized in DXE phase.
870 @return Token number according to system SKU ID.
874 GetSkuEnabledTokenNumber (
875 UINT32 LocalTokenNumber
,
881 Get Variable which contains HII type PCD entry.
883 @param VariableGuid Variable's guid
884 @param VariableName Variable's unicode name string
885 @param VariableData Variable's data pointer,
886 @param VariableSize Variable's size.
888 @return the status of gRT->GetVariable
892 IN EFI_GUID
*VariableGuid
,
893 IN UINT16
*VariableName
,
894 OUT UINT8
**VariableData
,
895 OUT UINTN
*VariableSize
899 Set value for HII-type PCD.
901 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
902 HII-type PCD is to visit this variable.
904 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
905 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
906 @param Data Value want to be set.
907 @param DataSize Size of value
908 @param Offset Value offset of HII-type PCD in variable.
910 @return status of GetVariable()/SetVariable().
915 IN EFI_GUID
*VariableGuid
,
916 IN UINT16
*VariableName
,
923 Register the callback function for a PCD entry.
925 This routine will register a callback function to a PCD entry by given token number
926 and token space guid.
928 @param TokenNumber PCD token's number, it is autogened by build tools.
929 @param Guid PCD token space's guid,
930 if not NULL, this PCD is dynamicEx type PCD.
931 @param CallBackFunction Callback function pointer
933 @return EFI_SUCCESS Always success for registering callback function.
937 DxeRegisterCallBackWorker (
938 IN UINTN TokenNumber
,
939 IN CONST EFI_GUID
*Guid
, OPTIONAL
940 IN PCD_PROTOCOL_CALLBACK CallBackFunction
944 UnRegister the callback function for a PCD entry.
946 This routine will unregister a callback function to a PCD entry by given token number
947 and token space guid.
949 @param TokenNumber PCD token's number, it is autogened by build tools.
950 @param Guid PCD token space's guid.
951 if not NULL, this PCD is dynamicEx type PCD.
952 @param CallBackFunction Callback function pointer
954 @retval EFI_SUCCESS Callback function is success to be unregister.
955 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
958 DxeUnRegisterCallBackWorker (
959 IN UINTN TokenNumber
,
960 IN CONST EFI_GUID
*Guid
, OPTIONAL
961 IN PCD_PROTOCOL_CALLBACK CallBackFunction
965 Initialize the PCD database in DXE phase.
967 PCD database in DXE phase also contains PCD database in PEI phase which is copied
972 BuildPcdDxeDataBase (
977 Get local token number according to dynamic-ex PCD's {token space guid:token number}
979 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
980 in DEC file. PCD database maintain a mapping table that translate pair of {token
981 space guid: token number} to local token number.
983 @param Guid Token space guid for dynamic-ex PCD entry.
984 @param ExTokenNumber Dynamic-ex PCD token number.
986 @return local token number for dynamic-ex PCD.
990 GetExPcdTokenNumber (
991 IN CONST EFI_GUID
*Guid
,
992 IN UINT32 ExTokenNumber
996 Get next token number in given token space.
998 This routine is used for dynamicEx type PCD. It will firstly scan token space
999 table to get token space according to given token space guid. Then scan given
1000 token number in found token space, if found, then return next token number in
1003 @param Guid Token space guid. Next token number will be scaned in
1005 @param TokenNumber Token number.
1006 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1008 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1009 in token space table.
1010 @param GuidTable Token space guid table. It will be used for scan token space
1011 by given token space guid.
1012 @param SizeOfGuidTable The size of guid table.
1013 @param ExMapTable DynamicEx token number mapping table.
1014 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1016 @retval EFI_NOT_FOUND Can not given token space or token number.
1017 @retval EFI_SUCCESS Success to get next token number.
1021 ExGetNextTokeNumber (
1022 IN CONST EFI_GUID
*Guid
,
1023 IN OUT UINTN
*TokenNumber
,
1024 IN EFI_GUID
*GuidTable
,
1025 IN UINTN SizeOfGuidTable
,
1026 IN DYNAMICEX_MAPPING
*ExMapTable
,
1027 IN UINTN SizeOfExMapTable
1031 Get size of POINTER type PCD value.
1033 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1034 @param MaxSize Maximum size of POINTER type PCD value.
1036 @return size of POINTER type PCD value.
1041 IN UINTN LocalTokenNumberTableIdx
,
1046 Set size of POINTER type PCD value. The size should not exceed the maximum size
1049 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1050 @param CurrentSize Size of POINTER type PCD value.
1052 @retval TRUE Success to set size of PCD value.
1053 @retval FALSE Fail to set size of PCD value.
1057 IN UINTN LocalTokenNumberTableIdx
,
1058 IN OUT UINTN
*CurrentSize
1061 extern PCD_DATABASE
* mPcdDatabase
;
1063 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1065 extern EFI_LOCK mPcdDatabaseLock
;