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 token number in a given namespace.
685 This is useful since the PCD infrastructure contains a sparse list of token numbers,
686 and one cannot a priori know what token numbers are valid in the database.
688 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
689 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
690 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
691 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
692 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
693 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
694 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
695 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
698 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
699 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
700 being made to retrieve tokens from the default token space.
701 @param[in,out] TokenNumber
702 A pointer to the PCD token number to use to find the subsequent token number.
704 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
705 is already the last valid token number in the PCD database.
706 In the later case, *TokenNumber is updated with the value of 0.
707 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
713 IN CONST EFI_GUID
*Guid
, OPTIONAL
714 IN OUT UINTN
*TokenNumber
718 Get next token space in PCD database according to given token space guid.
720 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
723 @param Guid Given token space guid. If NULL, then Guid will be set to
724 the first PCD token space in PCD database, If not NULL, then
725 Guid will be set to next PCD token space.
727 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
728 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
729 token space in PCD database.
730 @retval EFI_SUCCESS Success to get next token space guid.
734 DxePcdGetNextTokenSpace (
735 IN OUT CONST EFI_GUID
**Guid
740 PCD_PROTOCOL_CALLBACK CallbackFn
;
743 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
746 // Internal Functions
750 Wrapper function for setting non-pointer type value for a PCD entry.
752 @param TokenNumber Pcd token number autogenerated by build tools.
753 @param Data Value want to be set for PCD entry
754 @param Size Size of value.
756 @return status of SetWorker.
761 IN UINTN TokenNumber
,
767 Set value for an PCD entry
769 @param TokenNumber Pcd token number autogenerated by build tools.
770 @param Data Value want to be set for PCD entry
771 @param Size Size of value.
772 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
773 If False, the type of PCD entry's value is not Pointer.
775 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
776 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
777 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
778 range of UINT8, UINT16, UINT32, UINT64
779 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
783 IN UINTN TokenNumber
,
790 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
792 @param ExTokenNumber Token number for dynamic-ex PCD.
793 @param Guid Token space guid for dynamic-ex PCD.
794 @param Data Value want to be set.
795 @param SetSize The size of value.
797 @return status of ExSetWorker().
802 IN UINTN ExTokenNumber
,
803 IN CONST EFI_GUID
*Guid
,
809 Set value for a dynamic PCD entry.
811 This routine find the local token number according to dynamic-ex PCD's token
812 space guid and token number firstly, and invoke callback function if this PCD
813 entry registered callback function. Finally, invoken general SetWorker to set
816 @param ExTokenNumber Dynamic-ex PCD token number.
817 @param Guid Token space guid for dynamic-ex PCD.
818 @param Data PCD value want to be set
819 @param SetSize Size of value.
820 @param PtrType If TRUE, this PCD entry is pointer type.
821 If FALSE, this PCD entry is not pointer type.
823 @return status of SetWorker().
828 IN UINTN ExTokenNumber
,
829 IN CONST EFI_GUID
*Guid
,
836 Get the PCD entry pointer in PCD database.
838 This routine will visit PCD database to find the PCD entry according to given
839 token number. The given token number is autogened by build tools and it will be
840 translated to local token number. Local token number contains PCD's type and
841 offset of PCD entry in PCD database.
843 @param TokenNumber Token's number, it is autogened by build tools
844 @param GetSize The size of token's value
846 @return PCD entry pointer in PCD database
851 IN UINTN TokenNumber
,
856 Wrapper function for get PCD value for dynamic-ex PCD.
858 @param Guid Token space guid for dynamic-ex PCD.
859 @param ExTokenNumber Token number for dynamic-ex PCD.
860 @param GetSize The size of dynamic-ex PCD value.
862 @return PCD entry in PCD database.
867 IN CONST EFI_GUID
*Guid
,
868 IN UINTN ExTokenNumber
,
873 Find the local token number according to system SKU ID.
875 @param LocalTokenNumber PCD token number
876 @param Size The size of PCD entry.
877 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
878 If False, the PCD entry is initialized in DXE phase.
880 @return Token number according to system SKU ID.
884 GetSkuEnabledTokenNumber (
885 UINT32 LocalTokenNumber
,
891 Get Variable which contains HII type PCD entry.
893 @param VariableGuid Variable's guid
894 @param VariableName Variable's unicode name string
895 @param VariableData Variable's data pointer,
896 @param VariableSize Variable's size.
898 @return the status of gRT->GetVariable
902 IN EFI_GUID
*VariableGuid
,
903 IN UINT16
*VariableName
,
904 OUT UINT8
**VariableData
,
905 OUT UINTN
*VariableSize
909 Set value for HII-type PCD.
911 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
912 HII-type PCD is to visit this variable.
914 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
915 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
916 @param Data Value want to be set.
917 @param DataSize Size of value
918 @param Offset Value offset of HII-type PCD in variable.
920 @return status of GetVariable()/SetVariable().
925 IN EFI_GUID
*VariableGuid
,
926 IN UINT16
*VariableName
,
933 Register the callback function for a PCD entry.
935 This routine will register a callback function to a PCD entry by given token number
936 and token space guid.
938 @param TokenNumber PCD token's number, it is autogened by build tools.
939 @param Guid PCD token space's guid,
940 if not NULL, this PCD is dynamicEx type PCD.
941 @param CallBackFunction Callback function pointer
943 @return EFI_SUCCESS Always success for registering callback function.
947 DxeRegisterCallBackWorker (
948 IN UINTN TokenNumber
,
949 IN CONST EFI_GUID
*Guid
, OPTIONAL
950 IN PCD_PROTOCOL_CALLBACK CallBackFunction
954 UnRegister the callback function for a PCD entry.
956 This routine will unregister a callback function to a PCD entry by given token number
957 and token space guid.
959 @param TokenNumber PCD token's number, it is autogened by build tools.
960 @param Guid PCD token space's guid.
961 if not NULL, this PCD is dynamicEx type PCD.
962 @param CallBackFunction Callback function pointer
964 @retval EFI_SUCCESS Callback function is success to be unregister.
965 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
968 DxeUnRegisterCallBackWorker (
969 IN UINTN TokenNumber
,
970 IN CONST EFI_GUID
*Guid
, OPTIONAL
971 IN PCD_PROTOCOL_CALLBACK CallBackFunction
975 Initialize the PCD database in DXE phase.
977 PCD database in DXE phase also contains PCD database in PEI phase which is copied
982 BuildPcdDxeDataBase (
987 Get local token number according to dynamic-ex PCD's {token space guid:token number}
989 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
990 in DEC file. PCD database maintain a mapping table that translate pair of {token
991 space guid: token number} to local token number.
993 @param Guid Token space guid for dynamic-ex PCD entry.
994 @param ExTokenNumber Dynamic-ex PCD token number.
996 @return local token number for dynamic-ex PCD.
1000 GetExPcdTokenNumber (
1001 IN CONST EFI_GUID
*Guid
,
1002 IN UINT32 ExTokenNumber
1006 Get next token number in given token space.
1008 This routine is used for dynamicEx type PCD. It will firstly scan token space
1009 table to get token space according to given token space guid. Then scan given
1010 token number in found token space, if found, then return next token number in
1013 @param Guid Token space guid. Next token number will be scaned in
1015 @param TokenNumber Token number.
1016 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1018 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1019 in token space table.
1020 @param GuidTable Token space guid table. It will be used for scan token space
1021 by given token space guid.
1022 @param SizeOfGuidTable The size of guid table.
1023 @param ExMapTable DynamicEx token number mapping table.
1024 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1026 @retval EFI_NOT_FOUND Can not given token space or token number.
1027 @retval EFI_SUCCESS Success to get next token number.
1031 ExGetNextTokeNumber (
1032 IN CONST EFI_GUID
*Guid
,
1033 IN OUT UINTN
*TokenNumber
,
1034 IN EFI_GUID
*GuidTable
,
1035 IN UINTN SizeOfGuidTable
,
1036 IN DYNAMICEX_MAPPING
*ExMapTable
,
1037 IN UINTN SizeOfExMapTable
1041 Get size of POINTER type PCD value.
1043 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1044 @param MaxSize Maximum size of POINTER type PCD value.
1046 @return size of POINTER type PCD value.
1051 IN UINTN LocalTokenNumberTableIdx
,
1056 Set size of POINTER type PCD value. The size should not exceed the maximum size
1059 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1060 @param CurrentSize Size of POINTER type PCD value.
1062 @retval TRUE Success to set size of PCD value.
1063 @retval FALSE Fail to set size of PCD value.
1067 IN UINTN LocalTokenNumberTableIdx
,
1068 IN OUT UINTN
*CurrentSize
1071 extern PCD_DATABASE
* mPcdDatabase
;
1073 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1075 extern EFI_LOCK mPcdDatabaseLock
;