2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2010, 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 <Protocol/PiPcd.h>
22 #include <Library/BaseLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/UefiLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/PcdLib.h>
27 #include <Library/HobLib.h>
28 #include <Library/MemoryAllocationLib.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/UefiRuntimeServicesTableLib.h>
34 // Protocol Interface function declaration.
37 Sets the SKU value for subsequent calls to set or get PCD token values.
39 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
40 SetSku() is normally called only once by the system.
42 For each item (token), the database can hold a single value that applies to all SKUs,
43 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
44 SKU-specific values are called SKU enabled.
46 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
47 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
48 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
49 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
50 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
51 set for that Id, the results are unpredictable.
53 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
54 set values associated with a PCD token.
64 Retrieves an 8-bit value for a given PCD token.
66 Retrieves the current byte-sized value for a PCD token number.
67 If the TokenNumber is invalid, the results are unpredictable.
69 @param[in] TokenNumber The PCD token number.
71 @return The UINT8 value.
81 Retrieves an 16-bit value for a given PCD token.
83 Retrieves the current 16-bits value for a PCD token number.
84 If the TokenNumber is invalid, the results are unpredictable.
86 @param[in] TokenNumber The PCD token number.
88 @return The UINT16 value.
98 Retrieves an 32-bit value for a given PCD token.
100 Retrieves the current 32-bits value for a PCD token number.
101 If the TokenNumber is invalid, the results are unpredictable.
103 @param[in] TokenNumber The PCD token number.
105 @return The UINT32 value.
115 Retrieves an 64-bit value for a given PCD token.
117 Retrieves the current 64-bits value for a PCD token number.
118 If the TokenNumber is invalid, the results are unpredictable.
120 @param[in] TokenNumber The PCD token number.
122 @return The UINT64 value.
132 Retrieves a pointer to a value for a given PCD token.
134 Retrieves the current pointer to the buffer for a PCD token number.
135 Do not make any assumptions about the alignment of the pointer that
136 is returned by this function call. If the TokenNumber is invalid,
137 the results are unpredictable.
139 @param[in] TokenNumber The PCD token number.
141 @return The pointer to the buffer to be retrieved.
151 Retrieves a Boolean value for a given PCD token.
153 Retrieves the current boolean value for a PCD token number.
154 Do not make any assumptions about the alignment of the pointer that
155 is returned by this function call. If the TokenNumber is invalid,
156 the results are unpredictable.
158 @param[in] TokenNumber The PCD token number.
160 @return The Boolean value.
170 Retrieves the size of the value for a given PCD token.
172 Retrieves the current size of a particular PCD token.
173 If the TokenNumber is invalid, the results are unpredictable.
175 @param[in] TokenNumber The PCD token number.
177 @return The size of the value for the PCD token.
187 Retrieves an 8-bit value for a given PCD token.
189 Retrieves the 8-bit value of a particular PCD token.
190 If the TokenNumber is invalid or the token space
191 specified by Guid does not exist, the results are
194 @param[in] Guid The token space for the token number.
195 @param[in] TokenNumber The PCD token number.
197 @return The size 8-bit value for the PCD token.
203 IN CONST EFI_GUID
*Guid
,
208 Retrieves an 16-bit value for a given PCD token.
210 Retrieves the 16-bit value of a particular PCD token.
211 If the TokenNumber is invalid or the token space
212 specified by Guid does not exist, the results are
215 @param[in] Guid The token space for the token number.
216 @param[in] TokenNumber The PCD token number.
218 @return The size 16-bit value for the PCD token.
224 IN CONST EFI_GUID
*Guid
,
229 Retrieves an 32-bit value for a given PCD token.
231 Retrieves the 32-bit value of a particular PCD token.
232 If the TokenNumber is invalid or the token space
233 specified by Guid does not exist, the results are
236 @param[in] Guid The token space for the token number.
237 @param[in] TokenNumber The PCD token number.
239 @return The size 32-bit value for the PCD token.
245 IN CONST EFI_GUID
*Guid
,
250 Retrieves an 64-bit value for a given PCD token.
252 Retrieves the 64-bit value of a particular PCD token.
253 If the TokenNumber is invalid or the token space
254 specified by Guid does not exist, the results are
257 @param[in] Guid The token space for the token number.
258 @param[in] TokenNumber The PCD token number.
260 @return The size 64-bit value for the PCD token.
266 IN CONST EFI_GUID
*Guid
,
271 Retrieves a pointer to a value for a given PCD token.
273 Retrieves the current pointer to the buffer for a PCD token number.
274 Do not make any assumptions about the alignment of the pointer that
275 is returned by this function call. If the TokenNumber is invalid,
276 the results are unpredictable.
278 @param[in] Guid The token space for the token number.
279 @param[in] TokenNumber The PCD token number.
281 @return The pointer to the buffer to be retrieved.
287 IN CONST EFI_GUID
*Guid
,
292 Retrieves an Boolean value for a given PCD token.
294 Retrieves the Boolean value of a particular PCD token.
295 If the TokenNumber is invalid or the token space
296 specified by Guid does not exist, the results are
299 @param[in] Guid The token space for the token number.
300 @param[in] TokenNumber The PCD token number.
302 @return The size Boolean value for the PCD token.
308 IN CONST EFI_GUID
*Guid
,
313 Retrieves the size of the value for a given PCD token.
315 Retrieves the current size of a particular PCD token.
316 If the TokenNumber is invalid, the results are unpredictable.
318 @param[in] Guid The token space for the token number.
319 @param[in] TokenNumber The PCD token number.
321 @return The size of the value for the PCD token.
327 IN CONST EFI_GUID
*Guid
,
332 Sets an 8-bit value for a given PCD token.
334 When the PCD service sets a value, it will check to ensure that the
335 size of the value being set is compatible with the Token's existing definition.
336 If it is not, an error will be returned.
338 @param[in] TokenNumber The PCD token number.
339 @param[in] Value The value to set for the PCD token.
341 @retval EFI_SUCCESS Procedure returned successfully.
342 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
343 being set was incompatible with a call to this function.
344 Use GetSize() to retrieve the size of the target data.
345 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
351 IN UINTN TokenNumber
,
356 Sets an 16-bit value for a given PCD token.
358 When the PCD service sets a value, it will check to ensure that the
359 size of the value being set is compatible with the Token's existing definition.
360 If it is not, an error will be returned.
362 @param[in] TokenNumber The PCD token number.
363 @param[in] Value The value to set for the PCD token.
365 @retval EFI_SUCCESS Procedure returned successfully.
366 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
367 being set was incompatible with a call to this function.
368 Use GetSize() to retrieve the size of the target data.
369 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
375 IN UINTN TokenNumber
,
380 Sets an 32-bit value for a given PCD token.
382 When the PCD service sets a value, it will check to ensure that the
383 size of the value being set is compatible with the Token's existing definition.
384 If it is not, an error will be returned.
386 @param[in] TokenNumber The PCD token number.
387 @param[in] Value The value to set for the PCD token.
389 @retval EFI_SUCCESS Procedure returned successfully.
390 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
391 being set was incompatible with a call to this function.
392 Use GetSize() to retrieve the size of the target data.
393 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
399 IN UINTN TokenNumber
,
404 Sets an 64-bit value for a given PCD token.
406 When the PCD service sets a value, it will check to ensure that the
407 size of the value being set is compatible with the Token's existing definition.
408 If it is not, an error will be returned.
410 @param[in] TokenNumber The PCD token number.
411 @param[in] Value The value to set for the PCD token.
413 @retval EFI_SUCCESS Procedure returned successfully.
414 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
415 being set was incompatible with a call to this function.
416 Use GetSize() to retrieve the size of the target data.
417 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
423 IN UINTN TokenNumber
,
429 Sets a value of a specified size for a given PCD token.
431 When the PCD service sets a value, it will check to ensure that the
432 size of the value being set is compatible with the Token's existing definition.
433 If it is not, an error will be returned.
435 @param[in] TokenNumber The PCD token number.
436 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
437 On input, if the SizeOfValue is greater than the maximum size supported
438 for this TokenNumber then the output value of SizeOfValue will reflect
439 the maximum size supported for this TokenNumber.
440 @param[in] Buffer The buffer to set for the PCD token.
442 @retval EFI_SUCCESS Procedure returned successfully.
443 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
444 being set was incompatible with a call to this function.
445 Use GetSize() to retrieve the size of the target data.
446 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
452 IN UINTN TokenNumber
,
453 IN OUT UINTN
*SizeOfBuffer
,
458 Sets an Boolean value for a given PCD token.
460 When the PCD service sets a value, it will check to ensure that the
461 size of the value being set is compatible with the Token's existing definition.
462 If it is not, an error will be returned.
464 @param[in] TokenNumber The PCD token number.
465 @param[in] Value The value to set for the PCD token.
467 @retval EFI_SUCCESS Procedure returned successfully.
468 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
469 being set was incompatible with a call to this function.
470 Use GetSize() to retrieve the size of the target data.
471 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
477 IN UINTN TokenNumber
,
483 Sets an 8-bit value for a given PCD token.
485 When the PCD service sets a value, it will check to ensure that the
486 size of the value being set is compatible with the Token's existing definition.
487 If it is not, an error will be returned.
489 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
490 @param[in] TokenNumber The PCD token number.
491 @param[in] Value The value to set for the PCD token.
493 @retval EFI_SUCCESS Procedure returned successfully.
494 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
495 being set was incompatible with a call to this function.
496 Use GetSize() to retrieve the size of the target data.
497 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
503 IN CONST EFI_GUID
*Guid
,
504 IN UINTN TokenNumber
,
509 Sets an 16-bit value for a given PCD token.
511 When the PCD service sets a value, it will check to ensure that the
512 size of the value being set is compatible with the Token's existing definition.
513 If it is not, an error will be returned.
515 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
516 @param[in] TokenNumber The PCD token number.
517 @param[in] Value The value to set for the PCD token.
519 @retval EFI_SUCCESS Procedure returned successfully.
520 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
521 being set was incompatible with a call to this function.
522 Use GetSize() to retrieve the size of the target data.
523 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
529 IN CONST EFI_GUID
*Guid
,
530 IN UINTN TokenNumber
,
535 Sets an 32-bit value for a given PCD token.
537 When the PCD service sets a value, it will check to ensure that the
538 size of the value being set is compatible with the Token's existing definition.
539 If it is not, an error will be returned.
541 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
542 @param[in] TokenNumber The PCD token number.
543 @param[in] Value The value to set for the PCD token.
545 @retval EFI_SUCCESS Procedure returned successfully.
546 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
547 being set was incompatible with a call to this function.
548 Use GetSize() to retrieve the size of the target data.
549 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
555 IN CONST EFI_GUID
*Guid
,
556 IN UINTN TokenNumber
,
561 Sets an 64-bit value for a given PCD token.
563 When the PCD service sets a value, it will check to ensure that the
564 size of the value being set is compatible with the Token's existing definition.
565 If it is not, an error will be returned.
567 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
568 @param[in] TokenNumber The PCD token number.
569 @param[in] Value The value to set for the PCD token.
571 @retval EFI_SUCCESS Procedure returned successfully.
572 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
573 being set was incompatible with a call to this function.
574 Use GetSize() to retrieve the size of the target data.
575 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
581 IN CONST EFI_GUID
*Guid
,
582 IN UINTN TokenNumber
,
587 Sets a value of a specified size for a given PCD token.
589 When the PCD service sets a value, it will check to ensure that the
590 size of the value being set is compatible with the Token's existing definition.
591 If it is not, an error will be returned.
593 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
594 @param[in] TokenNumber The PCD token number.
595 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
596 On input, if the SizeOfValue is greater than the maximum size supported
597 for this TokenNumber then the output value of SizeOfValue will reflect
598 the maximum size supported for this TokenNumber.
599 @param[in] Buffer The buffer to set for the PCD token.
601 @retval EFI_SUCCESS Procedure returned successfully.
602 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
603 being set was incompatible with a call to this function.
604 Use GetSize() to retrieve the size of the target data.
605 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
611 IN CONST EFI_GUID
*Guid
,
612 IN UINTN TokenNumber
,
613 IN OUT UINTN
*SizeOfBuffer
,
618 Sets an Boolean value for a given PCD token.
620 When the PCD service sets a value, it will check to ensure that the
621 size of the value being set is compatible with the Token's existing definition.
622 If it is not, an error will be returned.
624 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
625 @param[in] TokenNumber The PCD token number.
626 @param[in] Value The value to set for the PCD token.
628 @retval EFI_SUCCESS Procedure returned successfully.
629 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
630 being set was incompatible with a call to this function.
631 Use GetSize() to retrieve the size of the target data.
632 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
638 IN CONST EFI_GUID
*Guid
,
639 IN UINTN TokenNumber
,
644 Specifies a function to be called anytime the value of a designated token is changed.
646 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
647 @param[in] TokenNumber The PCD token number.
648 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
650 @retval EFI_SUCCESS The PCD service has successfully established a call event
651 for the CallBackToken requested.
652 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
657 DxeRegisterCallBackOnSet (
658 IN CONST EFI_GUID
*Guid
, OPTIONAL
659 IN UINTN TokenNumber
,
660 IN PCD_PROTOCOL_CALLBACK CallBackFunction
664 Cancels a previously set callback function for a particular PCD token number.
666 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
667 @param[in] TokenNumber The PCD token number.
668 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
670 @retval EFI_SUCCESS The PCD service has successfully established a call event
671 for the CallBackToken requested.
672 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
677 DxeUnRegisterCallBackOnSet (
678 IN CONST EFI_GUID
*Guid
, OPTIONAL
679 IN UINTN TokenNumber
,
680 IN PCD_PROTOCOL_CALLBACK CallBackFunction
684 Retrieves the next valid token number in a given namespace.
686 This is useful since the PCD infrastructure contains a sparse list of token numbers,
687 and one cannot a priori know what token numbers are valid in the database.
689 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
690 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
691 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
692 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
693 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
694 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
695 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
696 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
699 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
700 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
701 being made to retrieve tokens from the default token space.
702 @param[in,out] TokenNumber
703 A pointer to the PCD token number to use to find the subsequent token number.
705 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
706 is already the last valid token number in the PCD database.
707 In the later case, *TokenNumber is updated with the value of 0.
708 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
714 IN CONST EFI_GUID
*Guid
, OPTIONAL
715 IN OUT UINTN
*TokenNumber
719 Get next token space in PCD database according to given token space guid.
721 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled
724 @param Guid Given token space guid. If NULL, then Guid will be set to
725 the first PCD token space in PCD database, If not NULL, then
726 Guid will be set to next PCD token space.
728 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.
729 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
730 token space in PCD database.
731 @retval EFI_SUCCESS Success to get next token space guid.
735 DxePcdGetNextTokenSpace (
736 IN OUT CONST EFI_GUID
**Guid
741 PCD_PROTOCOL_CALLBACK CallbackFn
;
744 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
747 // Internal Functions
751 Wrapper function for setting non-pointer type value for a PCD entry.
753 @param TokenNumber Pcd token number autogenerated by build tools.
754 @param Data Value want to be set for PCD entry
755 @param Size Size of value.
757 @return status of SetWorker.
762 IN UINTN TokenNumber
,
768 Set value for an PCD entry
770 @param TokenNumber Pcd token number autogenerated by build tools.
771 @param Data Value want to be set for PCD entry
772 @param Size Size of value.
773 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
774 If False, the type of PCD entry's value is not Pointer.
776 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
777 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
778 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
779 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
780 range of UINT8, UINT16, UINT32, UINT64
781 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
785 IN UINTN TokenNumber
,
792 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
794 @param ExTokenNumber Token number for dynamic-ex PCD.
795 @param Guid Token space guid for dynamic-ex PCD.
796 @param Data Value want to be set.
797 @param SetSize The size of value.
799 @return status of ExSetWorker().
804 IN UINTN ExTokenNumber
,
805 IN CONST EFI_GUID
*Guid
,
811 Set value for a dynamic PCD entry.
813 This routine find the local token number according to dynamic-ex PCD's token
814 space guid and token number firstly, and invoke callback function if this PCD
815 entry registered callback function. Finally, invoken general SetWorker to set
818 @param ExTokenNumber Dynamic-ex PCD token number.
819 @param Guid Token space guid for dynamic-ex PCD.
820 @param Data PCD value want to be set
821 @param SetSize Size of value.
822 @param PtrType If TRUE, this PCD entry is pointer type.
823 If FALSE, this PCD entry is not pointer type.
825 @return status of SetWorker().
830 IN UINTN ExTokenNumber
,
831 IN CONST EFI_GUID
*Guid
,
838 Get the PCD entry pointer in PCD database.
840 This routine will visit PCD database to find the PCD entry according to given
841 token number. The given token number is autogened by build tools and it will be
842 translated to local token number. Local token number contains PCD's type and
843 offset of PCD entry in PCD database.
845 @param TokenNumber Token's number, it is autogened by build tools
846 @param GetSize The size of token's value
848 @return PCD entry pointer in PCD database
853 IN UINTN TokenNumber
,
858 Wrapper function for get PCD value for dynamic-ex PCD.
860 @param Guid Token space guid for dynamic-ex PCD.
861 @param ExTokenNumber Token number for dynamic-ex PCD.
862 @param GetSize The size of dynamic-ex PCD value.
864 @return PCD entry in PCD database.
869 IN CONST EFI_GUID
*Guid
,
870 IN UINTN ExTokenNumber
,
875 Find the local token number according to system SKU ID.
877 @param LocalTokenNumber PCD token number
878 @param Size The size of PCD entry.
879 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
880 If False, the PCD entry is initialized in DXE phase.
882 @return Token number according to system SKU ID.
886 GetSkuEnabledTokenNumber (
887 UINT32 LocalTokenNumber
,
893 Get Variable which contains HII type PCD entry.
895 @param VariableGuid Variable's guid
896 @param VariableName Variable's unicode name string
897 @param VariableData Variable's data pointer,
898 @param VariableSize Variable's size.
900 @return the status of gRT->GetVariable
904 IN EFI_GUID
*VariableGuid
,
905 IN UINT16
*VariableName
,
906 OUT UINT8
**VariableData
,
907 OUT UINTN
*VariableSize
911 Set value for HII-type PCD.
913 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
914 HII-type PCD is to visit this variable.
916 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
917 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
918 @param Data Value want to be set.
919 @param DataSize Size of value
920 @param Offset Value offset of HII-type PCD in variable.
922 @return status of GetVariable()/SetVariable().
927 IN EFI_GUID
*VariableGuid
,
928 IN UINT16
*VariableName
,
935 Register the callback function for a PCD entry.
937 This routine will register a callback function to a PCD entry by given token number
938 and token space guid.
940 @param TokenNumber PCD token's number, it is autogened by build tools.
941 @param Guid PCD token space's guid,
942 if not NULL, this PCD is dynamicEx type PCD.
943 @param CallBackFunction Callback function pointer
945 @return EFI_SUCCESS Always success for registering callback function.
949 DxeRegisterCallBackWorker (
950 IN UINTN TokenNumber
,
951 IN CONST EFI_GUID
*Guid
, OPTIONAL
952 IN PCD_PROTOCOL_CALLBACK CallBackFunction
956 UnRegister the callback function for a PCD entry.
958 This routine will unregister a callback function to a PCD entry by given token number
959 and token space guid.
961 @param TokenNumber PCD token's number, it is autogened by build tools.
962 @param Guid PCD token space's guid.
963 if not NULL, this PCD is dynamicEx type PCD.
964 @param CallBackFunction Callback function pointer
966 @retval EFI_SUCCESS Callback function is success to be unregister.
967 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
970 DxeUnRegisterCallBackWorker (
971 IN UINTN TokenNumber
,
972 IN CONST EFI_GUID
*Guid
, OPTIONAL
973 IN PCD_PROTOCOL_CALLBACK CallBackFunction
977 Initialize the PCD database in DXE phase.
979 PCD database in DXE phase also contains PCD database in PEI phase which is copied
984 BuildPcdDxeDataBase (
989 Get local token number according to dynamic-ex PCD's {token space guid:token number}
991 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
992 in DEC file. PCD database maintain a mapping table that translate pair of {token
993 space guid: token number} to local token number.
995 @param Guid Token space guid for dynamic-ex PCD entry.
996 @param ExTokenNumber Dynamic-ex PCD token number.
998 @return local token number for dynamic-ex PCD.
1002 GetExPcdTokenNumber (
1003 IN CONST EFI_GUID
*Guid
,
1004 IN UINT32 ExTokenNumber
1008 Get next token number in given token space.
1010 This routine is used for dynamicEx type PCD. It will firstly scan token space
1011 table to get token space according to given token space guid. Then scan given
1012 token number in found token space, if found, then return next token number in
1015 @param Guid Token space guid. Next token number will be scaned in
1017 @param TokenNumber Token number.
1018 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1020 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1021 in token space table.
1022 @param GuidTable Token space guid table. It will be used for scan token space
1023 by given token space guid.
1024 @param SizeOfGuidTable The size of guid table.
1025 @param ExMapTable DynamicEx token number mapping table.
1026 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1028 @retval EFI_NOT_FOUND Can not given token space or token number.
1029 @retval EFI_SUCCESS Success to get next token number.
1033 ExGetNextTokeNumber (
1034 IN CONST EFI_GUID
*Guid
,
1035 IN OUT UINTN
*TokenNumber
,
1036 IN EFI_GUID
*GuidTable
,
1037 IN UINTN SizeOfGuidTable
,
1038 IN DYNAMICEX_MAPPING
*ExMapTable
,
1039 IN UINTN SizeOfExMapTable
1043 Get size of POINTER type PCD value.
1045 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1046 @param MaxSize Maximum size of POINTER type PCD value.
1048 @return size of POINTER type PCD value.
1053 IN UINTN LocalTokenNumberTableIdx
,
1058 Set size of POINTER type PCD value. The size should not exceed the maximum size
1061 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1062 @param CurrentSize Size of POINTER type PCD value.
1064 @retval TRUE Success to set size of PCD value.
1065 @retval FALSE Fail to set size of PCD value.
1069 IN UINTN LocalTokenNumberTableIdx
,
1070 IN OUT UINTN
*CurrentSize
1073 extern PCD_DATABASE
* mPcdDatabase
;
1075 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1077 extern EFI_LOCK mPcdDatabaseLock
;