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 <Protocol/Pcd.h>
20 #include <Library/BaseLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/UefiLib.h>
23 #include <Library/UefiDriverEntryPoint.h>
24 #include <Library/PcdLib.h>
25 #include <Library/HobLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/UefiRuntimeServicesTableLib.h>
32 // Protocol Interface function declaration.
35 Sets the SKU value for subsequent calls to set or get PCD token values.
37 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
38 SetSku() is normally called only once by the system.
40 For each item (token), the database can hold a single value that applies to all SKUs,
41 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
42 SKU-specific values are called SKU enabled.
44 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
45 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
46 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
47 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
48 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
49 set for that Id, the results are unpredictable.
51 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
52 set values associated with a PCD token.
62 Retrieves an 8-bit value for a given PCD token.
64 Retrieves the current byte-sized value for a PCD token number.
65 If the TokenNumber is invalid, the results are unpredictable.
67 @param[in] TokenNumber The PCD token number.
69 @return The UINT8 value.
79 Retrieves an 16-bit value for a given PCD token.
81 Retrieves the current 16-bits 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 UINT16 value.
96 Retrieves an 32-bit value for a given PCD token.
98 Retrieves the current 32-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 UINT32 value.
113 Retrieves an 64-bit value for a given PCD token.
115 Retrieves the current 64-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 UINT64 value.
130 Retrieves a pointer to a value for a given PCD token.
132 Retrieves the current pointer to the buffer for a PCD token number.
133 Do not make any assumptions about the alignment of the pointer that
134 is returned by this function call. If the TokenNumber is invalid,
135 the results are unpredictable.
137 @param[in] TokenNumber The PCD token number.
139 @return The pointer to the buffer to be retrieved.
149 Retrieves a Boolean value for a given PCD token.
151 Retrieves the current boolean value for a PCD token number.
152 Do not make any assumptions about the alignment of the pointer that
153 is returned by this function call. If the TokenNumber is invalid,
154 the results are unpredictable.
156 @param[in] TokenNumber The PCD token number.
158 @return The Boolean value.
168 Retrieves the size of the value for a given PCD token.
170 Retrieves the current size of a particular PCD token.
171 If the TokenNumber is invalid, the results are unpredictable.
173 @param[in] TokenNumber The PCD token number.
175 @return The size of the value for the PCD token.
185 Retrieves an 8-bit value for a given PCD token.
187 Retrieves the 8-bit value of a particular PCD token.
188 If the TokenNumber is invalid or the token space
189 specified by Guid does not exist, the results are
192 @param[in] Guid The token space for the token number.
193 @param[in] TokenNumber The PCD token number.
195 @return The size 8-bit value for the PCD token.
201 IN CONST EFI_GUID
*Guid
,
206 Retrieves an 16-bit value for a given PCD token.
208 Retrieves the 16-bit value of a particular PCD token.
209 If the TokenNumber is invalid or the token space
210 specified by Guid does not exist, the results are
213 @param[in] Guid The token space for the token number.
214 @param[in] TokenNumber The PCD token number.
216 @return The size 16-bit value for the PCD token.
222 IN CONST EFI_GUID
*Guid
,
227 Retrieves an 32-bit value for a given PCD token.
229 Retrieves the 32-bit value of a particular PCD token.
230 If the TokenNumber is invalid or the token space
231 specified by Guid does not exist, the results are
234 @param[in] Guid The token space for the token number.
235 @param[in] TokenNumber The PCD token number.
237 @return The size 32-bit value for the PCD token.
243 IN CONST EFI_GUID
*Guid
,
248 Retrieves an 64-bit value for a given PCD token.
250 Retrieves the 64-bit value of a particular PCD token.
251 If the TokenNumber is invalid or the token space
252 specified by Guid does not exist, the results are
255 @param[in] Guid The token space for the token number.
256 @param[in] TokenNumber The PCD token number.
258 @return The size 64-bit value for the PCD token.
264 IN CONST EFI_GUID
*Guid
,
269 Retrieves a pointer to a value for a given PCD token.
271 Retrieves the current pointer to the buffer for a PCD token number.
272 Do not make any assumptions about the alignment of the pointer that
273 is returned by this function call. If the TokenNumber is invalid,
274 the results are unpredictable.
276 @param[in] Guid The token space for the token number.
277 @param[in] TokenNumber The PCD token number.
279 @return The pointer to the buffer to be retrieved.
285 IN CONST EFI_GUID
*Guid
,
290 Retrieves an Boolean value for a given PCD token.
292 Retrieves the Boolean value of a particular PCD token.
293 If the TokenNumber is invalid or the token space
294 specified by Guid does not exist, the results are
297 @param[in] Guid The token space for the token number.
298 @param[in] TokenNumber The PCD token number.
300 @return The size Boolean value for the PCD token.
306 IN CONST EFI_GUID
*Guid
,
311 Retrieves the size of the value for a given PCD token.
313 Retrieves the current size of a particular PCD token.
314 If the TokenNumber is invalid, the results are unpredictable.
316 @param[in] Guid The token space for the token number.
317 @param[in] TokenNumber The PCD token number.
319 @return The size of the value for the PCD token.
325 IN CONST EFI_GUID
*Guid
,
330 Sets an 8-bit value for a given PCD token.
332 When the PCD service sets a value, it will check to ensure that the
333 size of the value being set is compatible with the Token's existing definition.
334 If it is not, an error will be returned.
336 @param[in] TokenNumber The PCD token number.
337 @param[in] Value The value to set for the PCD token.
339 @retval EFI_SUCCESS Procedure returned successfully.
340 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
341 being set was incompatible with a call to this function.
342 Use GetSize() to retrieve the size of the target data.
343 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
349 IN UINTN TokenNumber
,
354 Sets an 16-bit value for a given PCD token.
356 When the PCD service sets a value, it will check to ensure that the
357 size of the value being set is compatible with the Token's existing definition.
358 If it is not, an error will be returned.
360 @param[in] TokenNumber The PCD token number.
361 @param[in] Value The value to set for the PCD token.
363 @retval EFI_SUCCESS Procedure returned successfully.
364 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
365 being set was incompatible with a call to this function.
366 Use GetSize() to retrieve the size of the target data.
367 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
373 IN UINTN TokenNumber
,
378 Sets an 32-bit value for a given PCD token.
380 When the PCD service sets a value, it will check to ensure that the
381 size of the value being set is compatible with the Token's existing definition.
382 If it is not, an error will be returned.
384 @param[in] TokenNumber The PCD token number.
385 @param[in] Value The value to set for the PCD token.
387 @retval EFI_SUCCESS Procedure returned successfully.
388 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
389 being set was incompatible with a call to this function.
390 Use GetSize() to retrieve the size of the target data.
391 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
397 IN UINTN TokenNumber
,
402 Sets an 64-bit value for a given PCD token.
404 When the PCD service sets a value, it will check to ensure that the
405 size of the value being set is compatible with the Token's existing definition.
406 If it is not, an error will be returned.
408 @param[in] TokenNumber The PCD token number.
409 @param[in] Value The value to set for the PCD token.
411 @retval EFI_SUCCESS Procedure returned successfully.
412 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
413 being set was incompatible with a call to this function.
414 Use GetSize() to retrieve the size of the target data.
415 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
421 IN UINTN TokenNumber
,
427 Sets a value of a specified size for a given PCD token.
429 When the PCD service sets a value, it will check to ensure that the
430 size of the value being set is compatible with the Token's existing definition.
431 If it is not, an error will be returned.
433 @param[in] TokenNumber The PCD token number.
434 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
435 On input, if the SizeOfValue is greater than the maximum size supported
436 for this TokenNumber then the output value of SizeOfValue will reflect
437 the maximum size supported for this TokenNumber.
438 @param[in] Buffer The buffer to set for the PCD token.
440 @retval EFI_SUCCESS Procedure returned successfully.
441 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
442 being set was incompatible with a call to this function.
443 Use GetSize() to retrieve the size of the target data.
444 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
450 IN UINTN TokenNumber
,
451 IN OUT UINTN
*SizeOfBuffer
,
456 Sets an Boolean value for a given PCD token.
458 When the PCD service sets a value, it will check to ensure that the
459 size of the value being set is compatible with the Token's existing definition.
460 If it is not, an error will be returned.
462 @param[in] TokenNumber The PCD token number.
463 @param[in] Value The value to set for the PCD token.
465 @retval EFI_SUCCESS Procedure returned successfully.
466 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
467 being set was incompatible with a call to this function.
468 Use GetSize() to retrieve the size of the target data.
469 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
475 IN UINTN TokenNumber
,
481 Sets an 8-bit value for a given PCD token.
483 When the PCD service sets a value, it will check to ensure that the
484 size of the value being set is compatible with the Token's existing definition.
485 If it is not, an error will be returned.
487 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
488 @param[in] TokenNumber The PCD token number.
489 @param[in] Value The value to set for the PCD token.
491 @retval EFI_SUCCESS Procedure returned successfully.
492 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
493 being set was incompatible with a call to this function.
494 Use GetSize() to retrieve the size of the target data.
495 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
501 IN CONST EFI_GUID
*Guid
,
502 IN UINTN TokenNumber
,
507 Sets an 16-bit value for a given PCD token.
509 When the PCD service sets a value, it will check to ensure that the
510 size of the value being set is compatible with the Token's existing definition.
511 If it is not, an error will be returned.
513 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
514 @param[in] TokenNumber The PCD token number.
515 @param[in] Value The value to set for the PCD token.
517 @retval EFI_SUCCESS Procedure returned successfully.
518 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
519 being set was incompatible with a call to this function.
520 Use GetSize() to retrieve the size of the target data.
521 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
527 IN CONST EFI_GUID
*Guid
,
528 IN UINTN TokenNumber
,
533 Sets an 32-bit value for a given PCD token.
535 When the PCD service sets a value, it will check to ensure that the
536 size of the value being set is compatible with the Token's existing definition.
537 If it is not, an error will be returned.
539 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
540 @param[in] TokenNumber The PCD token number.
541 @param[in] Value The value to set for the PCD token.
543 @retval EFI_SUCCESS Procedure returned successfully.
544 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
545 being set was incompatible with a call to this function.
546 Use GetSize() to retrieve the size of the target data.
547 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
553 IN CONST EFI_GUID
*Guid
,
554 IN UINTN TokenNumber
,
559 Sets an 64-bit value for a given PCD token.
561 When the PCD service sets a value, it will check to ensure that the
562 size of the value being set is compatible with the Token's existing definition.
563 If it is not, an error will be returned.
565 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
566 @param[in] TokenNumber The PCD token number.
567 @param[in] Value The value to set for the PCD token.
569 @retval EFI_SUCCESS Procedure returned successfully.
570 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
571 being set was incompatible with a call to this function.
572 Use GetSize() to retrieve the size of the target data.
573 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
579 IN CONST EFI_GUID
*Guid
,
580 IN UINTN TokenNumber
,
585 Sets a value of a specified size for a given PCD token.
587 When the PCD service sets a value, it will check to ensure that the
588 size of the value being set is compatible with the Token's existing definition.
589 If it is not, an error will be returned.
591 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
592 @param[in] TokenNumber The PCD token number.
593 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
594 On input, if the SizeOfValue is greater than the maximum size supported
595 for this TokenNumber then the output value of SizeOfValue will reflect
596 the maximum size supported for this TokenNumber.
597 @param[in] Buffer The buffer to set for the PCD token.
599 @retval EFI_SUCCESS Procedure returned successfully.
600 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
601 being set was incompatible with a call to this function.
602 Use GetSize() to retrieve the size of the target data.
603 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
609 IN CONST EFI_GUID
*Guid
,
610 IN UINTN TokenNumber
,
611 IN OUT UINTN
*SizeOfBuffer
,
616 Sets an Boolean value for a given PCD token.
618 When the PCD service sets a value, it will check to ensure that the
619 size of the value being set is compatible with the Token's existing definition.
620 If it is not, an error will be returned.
622 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
623 @param[in] TokenNumber The PCD token number.
624 @param[in] Value The value to set for the PCD token.
626 @retval EFI_SUCCESS Procedure returned successfully.
627 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
628 being set was incompatible with a call to this function.
629 Use GetSize() to retrieve the size of the target data.
630 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
636 IN CONST EFI_GUID
*Guid
,
637 IN UINTN TokenNumber
,
642 Specifies a function to be called anytime the value of a designated token is changed.
644 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
645 @param[in] TokenNumber The PCD token number.
646 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
648 @retval EFI_SUCCESS The PCD service has successfully established a call event
649 for the CallBackToken requested.
650 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
655 DxeRegisterCallBackOnSet (
656 IN CONST EFI_GUID
*Guid
, OPTIONAL
657 IN UINTN TokenNumber
,
658 IN PCD_PROTOCOL_CALLBACK CallBackFunction
662 Cancels a previously set callback function for a particular PCD token number.
664 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
665 @param[in] TokenNumber The PCD token number.
666 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
668 @retval EFI_SUCCESS The PCD service has successfully established a call event
669 for the CallBackToken requested.
670 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
675 DxeUnRegisterCallBackOnSet (
676 IN CONST EFI_GUID
*Guid
, OPTIONAL
677 IN UINTN TokenNumber
,
678 IN PCD_PROTOCOL_CALLBACK CallBackFunction
682 Retrieves the next valid PCD token for a given namespace.
684 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
685 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
686 If the input token namespace or token number does not exist on the platform,
687 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token,
688 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and
689 there is no valid token number for this token namespace, *TokenNumber will be assigned to
690 0 and the function return EFI_SUCCESS. If the token number is the last valid token number,
691 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.
693 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
694 is already the last valid token number in the PCD database.
695 In the later case, *TokenNumber is updated with the value of 0.
696 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
702 IN CONST EFI_GUID
*Guid
, OPTIONAL
703 IN OUT UINTN
*TokenNumber
707 Get next token space in PCD database according to given token space guid.
709 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
712 @param Guid Given token space guid. If NULL, then Guid will be set to
713 the first PCD token space in PCD database, If not NULL, then
714 Guid will be set to next PCD token space.
716 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
717 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
718 token space in PCD database.
719 @retval EFI_SUCCESS Success to get next token space guid.
723 DxePcdGetNextTokenSpace (
724 IN OUT CONST EFI_GUID
**Guid
729 PCD_PROTOCOL_CALLBACK CallbackFn
;
732 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
735 // Internal Functions
739 Wrapper function for setting non-pointer type value for a PCD entry.
741 @param TokenNumber Pcd token number autogenerated by build tools.
742 @param Data Value want to be set for PCD entry
743 @param Size Size of value.
745 @return status of SetWorker.
750 IN UINTN TokenNumber
,
756 Set value for an 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.
761 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
762 If False, the type of PCD entry's value is not Pointer.
764 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
765 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
766 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
767 range of UINT8, UINT16, UINT32, UINT64
768 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
772 IN UINTN TokenNumber
,
779 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
781 @param ExTokenNumber Token number for dynamic-ex PCD.
782 @param Guid Token space guid for dynamic-ex PCD.
783 @param Data Value want to be set.
784 @param SetSize The size of value.
786 @return status of ExSetWorker().
791 IN UINTN ExTokenNumber
,
792 IN CONST EFI_GUID
*Guid
,
798 Set value for a dynamic PCD entry.
800 This routine find the local token number according to dynamic-ex PCD's token
801 space guid and token number firstly, and invoke callback function if this PCD
802 entry registered callback function. Finally, invoken general SetWorker to set
805 @param ExTokenNumber Dynamic-ex PCD token number.
806 @param Guid Token space guid for dynamic-ex PCD.
807 @param Data PCD value want to be set
808 @param SetSize Size of value.
809 @param PtrType If TRUE, this PCD entry is pointer type.
810 If FALSE, this PCD entry is not pointer type.
812 @return status of SetWorker().
817 IN UINTN ExTokenNumber
,
818 IN CONST EFI_GUID
*Guid
,
825 Get the PCD entry pointer in PCD database.
827 This routine will visit PCD database to find the PCD entry according to given
828 token number. The given token number is autogened by build tools and it will be
829 translated to local token number. Local token number contains PCD's type and
830 offset of PCD entry in PCD database.
832 @param TokenNumber Token's number, it is autogened by build tools
833 @param GetSize The size of token's value
835 @return PCD entry pointer in PCD database
840 IN UINTN TokenNumber
,
845 Wrapper function for get PCD value for dynamic-ex PCD.
847 @param Guid Token space guid for dynamic-ex PCD.
848 @param ExTokenNumber Token number for dynamic-ex PCD.
849 @param GetSize The size of dynamic-ex PCD value.
851 @return PCD entry in PCD database.
856 IN CONST EFI_GUID
*Guid
,
857 IN UINTN ExTokenNumber
,
862 Find the local token number according to system SKU ID.
864 @param LocalTokenNumber PCD token number
865 @param Size The size of PCD entry.
866 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
867 If False, the PCD entry is initialized in DXE phase.
869 @return Token number according to system SKU ID.
873 GetSkuEnabledTokenNumber (
874 UINT32 LocalTokenNumber
,
880 Get Variable which contains HII type PCD entry.
882 @param VariableGuid Variable's guid
883 @param VariableName Variable's unicode name string
884 @param VariableData Variable's data pointer,
885 @param VariableSize Variable's size.
887 @return the status of gRT->GetVariable
891 IN EFI_GUID
*VariableGuid
,
892 IN UINT16
*VariableName
,
893 OUT UINT8
**VariableData
,
894 OUT UINTN
*VariableSize
898 Set value for HII-type PCD.
900 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
901 HII-type PCD is to visit this variable.
903 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
904 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
905 @param Data Value want to be set.
906 @param DataSize Size of value
907 @param Offset Value offset of HII-type PCD in variable.
909 @return status of GetVariable()/SetVariable().
914 IN EFI_GUID
*VariableGuid
,
915 IN UINT16
*VariableName
,
922 Register the callback function for a PCD entry.
924 This routine will register a callback function to a PCD entry by given token number
925 and token space guid.
927 @param TokenNumber PCD token's number, it is autogened by build tools.
928 @param Guid PCD token space's guid,
929 if not NULL, this PCD is dynamicEx type PCD.
930 @param CallBackFunction Callback function pointer
932 @return EFI_SUCCESS Always success for registering callback function.
936 DxeRegisterCallBackWorker (
937 IN UINTN TokenNumber
,
938 IN CONST EFI_GUID
*Guid
, OPTIONAL
939 IN PCD_PROTOCOL_CALLBACK CallBackFunction
943 UnRegister the callback function for a PCD entry.
945 This routine will unregister a callback function to a PCD entry by given token number
946 and token space guid.
948 @param TokenNumber PCD token's number, it is autogened by build tools.
949 @param Guid PCD token space's guid.
950 if not NULL, this PCD is dynamicEx type PCD.
951 @param CallBackFunction Callback function pointer
953 @retval EFI_SUCCESS Callback function is success to be unregister.
954 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
957 DxeUnRegisterCallBackWorker (
958 IN UINTN TokenNumber
,
959 IN CONST EFI_GUID
*Guid
, OPTIONAL
960 IN PCD_PROTOCOL_CALLBACK CallBackFunction
964 Initialize the PCD database in DXE phase.
966 PCD database in DXE phase also contains PCD database in PEI phase which is copied
971 BuildPcdDxeDataBase (
976 Get local token number according to dynamic-ex PCD's {token space guid:token number}
978 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
979 in DEC file. PCD database maintain a mapping table that translate pair of {token
980 space guid: token number} to local token number.
982 @param Guid Token space guid for dynamic-ex PCD entry.
983 @param ExTokenNumber Dynamic-ex PCD token number.
985 @return local token number for dynamic-ex PCD.
989 GetExPcdTokenNumber (
990 IN CONST EFI_GUID
*Guid
,
991 IN UINT32 ExTokenNumber
995 Get next token number in given token space.
997 This routine is used for dynamicEx type PCD. It will firstly scan token space
998 table to get token space according to given token space guid. Then scan given
999 token number in found token space, if found, then return next token number in
1002 @param Guid Token space guid. Next token number will be scaned in
1004 @param TokenNumber Token number.
1005 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1007 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1008 in token space table.
1009 @param GuidTable Token space guid table. It will be used for scan token space
1010 by given token space guid.
1011 @param SizeOfGuidTable The size of guid table.
1012 @param ExMapTable DynamicEx token number mapping table.
1013 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1015 @retval EFI_NOT_FOUND Can not given token space or token number.
1016 @retval EFI_SUCCESS Success to get next token number.
1020 ExGetNextTokeNumber (
1021 IN CONST EFI_GUID
*Guid
,
1022 IN OUT UINTN
*TokenNumber
,
1023 IN EFI_GUID
*GuidTable
,
1024 IN UINTN SizeOfGuidTable
,
1025 IN DYNAMICEX_MAPPING
*ExMapTable
,
1026 IN UINTN SizeOfExMapTable
1030 Get size of POINTER type PCD value.
1032 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1033 @param MaxSize Maximum size of POINTER type PCD value.
1035 @return size of POINTER type PCD value.
1040 IN UINTN LocalTokenNumberTableIdx
,
1045 Set size of POINTER type PCD value. The size should not exceed the maximum size
1048 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1049 @param CurrentSize Size of POINTER type PCD value.
1051 @retval TRUE Success to set size of PCD value.
1052 @retval FALSE Fail to set size of PCD value.
1056 IN UINTN LocalTokenNumberTableIdx
,
1057 IN OUT UINTN
*CurrentSize
1060 extern EFI_GUID gPcdDataBaseHobGuid
;
1062 extern PCD_DATABASE
* mPcdDatabase
;
1064 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1066 extern EFI_LOCK mPcdDatabaseLock
;