2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 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 // Please make sure the PCD Serivce DXE Version is consistent with
35 // the version of the generated DXE PCD Database by build tool.
37 #define PCD_SERVICE_DXE_VERSION 2
40 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
42 #if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)
43 #error "Please make sure the version of PCD DXE Service and the generated PCD DXE Database match."
47 // Protocol Interface function declaration.
50 Sets the SKU value for subsequent calls to set or get PCD token values.
52 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
53 SetSku() is normally called only once by the system.
55 For each item (token), the database can hold a single value that applies to all SKUs,
56 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
57 SKU-specific values are called SKU enabled.
59 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
60 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
61 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
62 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
63 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
64 set for that Id, the results are unpredictable.
66 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
67 set values associated with a PCD token.
77 Retrieves an 8-bit value for a given PCD token.
79 Retrieves the current byte-sized value for a PCD token number.
80 If the TokenNumber is invalid, the results are unpredictable.
82 @param[in] TokenNumber The PCD token number.
84 @return The UINT8 value.
94 Retrieves an 16-bit value for a given PCD token.
96 Retrieves the current 16-bits value for a PCD token number.
97 If the TokenNumber is invalid, the results are unpredictable.
99 @param[in] TokenNumber The PCD token number.
101 @return The UINT16 value.
111 Retrieves an 32-bit value for a given PCD token.
113 Retrieves the current 32-bits value for a PCD token number.
114 If the TokenNumber is invalid, the results are unpredictable.
116 @param[in] TokenNumber The PCD token number.
118 @return The UINT32 value.
128 Retrieves an 64-bit value for a given PCD token.
130 Retrieves the current 64-bits value for a PCD token number.
131 If the TokenNumber is invalid, the results are unpredictable.
133 @param[in] TokenNumber The PCD token number.
135 @return The UINT64 value.
145 Retrieves a pointer to a value for a given PCD token.
147 Retrieves the current pointer to the buffer for a PCD token number.
148 Do not make any assumptions about the alignment of the pointer that
149 is returned by this function call. If the TokenNumber is invalid,
150 the results are unpredictable.
152 @param[in] TokenNumber The PCD token number.
154 @return The pointer to the buffer to be retrieved.
164 Retrieves a Boolean value for a given PCD token.
166 Retrieves the current boolean value for a PCD token number.
167 Do not make any assumptions about the alignment of the pointer that
168 is returned by this function call. If the TokenNumber is invalid,
169 the results are unpredictable.
171 @param[in] TokenNumber The PCD token number.
173 @return The Boolean value.
183 Retrieves the size of the value for a given PCD token.
185 Retrieves the current size of a particular PCD token.
186 If the TokenNumber is invalid, the results are unpredictable.
188 @param[in] TokenNumber The PCD token number.
190 @return The size of the value for the PCD token.
200 Retrieves an 8-bit value for a given PCD token.
202 Retrieves the 8-bit value of a particular PCD token.
203 If the TokenNumber is invalid or the token space
204 specified by Guid does not exist, the results are
207 @param[in] Guid The token space for the token number.
208 @param[in] TokenNumber The PCD token number.
210 @return The size 8-bit value for the PCD token.
216 IN CONST EFI_GUID
*Guid
,
221 Retrieves an 16-bit value for a given PCD token.
223 Retrieves the 16-bit value of a particular PCD token.
224 If the TokenNumber is invalid or the token space
225 specified by Guid does not exist, the results are
228 @param[in] Guid The token space for the token number.
229 @param[in] TokenNumber The PCD token number.
231 @return The size 16-bit value for the PCD token.
237 IN CONST EFI_GUID
*Guid
,
242 Retrieves an 32-bit value for a given PCD token.
244 Retrieves the 32-bit value of a particular PCD token.
245 If the TokenNumber is invalid or the token space
246 specified by Guid does not exist, the results are
249 @param[in] Guid The token space for the token number.
250 @param[in] TokenNumber The PCD token number.
252 @return The size 32-bit value for the PCD token.
258 IN CONST EFI_GUID
*Guid
,
263 Retrieves an 64-bit value for a given PCD token.
265 Retrieves the 64-bit value of a particular PCD token.
266 If the TokenNumber is invalid or the token space
267 specified by Guid does not exist, the results are
270 @param[in] Guid The token space for the token number.
271 @param[in] TokenNumber The PCD token number.
273 @return The size 64-bit value for the PCD token.
279 IN CONST EFI_GUID
*Guid
,
284 Retrieves a pointer to a value for a given PCD token.
286 Retrieves the current pointer to the buffer for a PCD token number.
287 Do not make any assumptions about the alignment of the pointer that
288 is returned by this function call. If the TokenNumber is invalid,
289 the results are unpredictable.
291 @param[in] Guid The token space for the token number.
292 @param[in] TokenNumber The PCD token number.
294 @return The pointer to the buffer to be retrieved.
300 IN CONST EFI_GUID
*Guid
,
305 Retrieves an Boolean value for a given PCD token.
307 Retrieves the Boolean value of a particular PCD token.
308 If the TokenNumber is invalid or the token space
309 specified by Guid does not exist, the results are
312 @param[in] Guid The token space for the token number.
313 @param[in] TokenNumber The PCD token number.
315 @return The size Boolean value for the PCD token.
321 IN CONST EFI_GUID
*Guid
,
326 Retrieves the size of the value for a given PCD token.
328 Retrieves the current size of a particular PCD token.
329 If the TokenNumber is invalid, the results are unpredictable.
331 @param[in] Guid The token space for the token number.
332 @param[in] TokenNumber The PCD token number.
334 @return The size of the value for the PCD token.
340 IN CONST EFI_GUID
*Guid
,
345 Sets an 8-bit value for a given PCD token.
347 When the PCD service sets a value, it will check to ensure that the
348 size of the value being set is compatible with the Token's existing definition.
349 If it is not, an error will be returned.
351 @param[in] TokenNumber The PCD token number.
352 @param[in] Value The value to set for the PCD token.
354 @retval EFI_SUCCESS Procedure returned successfully.
355 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
356 being set was incompatible with a call to this function.
357 Use GetSize() to retrieve the size of the target data.
358 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
364 IN UINTN TokenNumber
,
369 Sets an 16-bit value for a given PCD token.
371 When the PCD service sets a value, it will check to ensure that the
372 size of the value being set is compatible with the Token's existing definition.
373 If it is not, an error will be returned.
375 @param[in] TokenNumber The PCD token number.
376 @param[in] Value The value to set for the PCD token.
378 @retval EFI_SUCCESS Procedure returned successfully.
379 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
380 being set was incompatible with a call to this function.
381 Use GetSize() to retrieve the size of the target data.
382 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
388 IN UINTN TokenNumber
,
393 Sets an 32-bit value for a given PCD token.
395 When the PCD service sets a value, it will check to ensure that the
396 size of the value being set is compatible with the Token's existing definition.
397 If it is not, an error will be returned.
399 @param[in] TokenNumber The PCD token number.
400 @param[in] Value The value to set for the PCD token.
402 @retval EFI_SUCCESS Procedure returned successfully.
403 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
404 being set was incompatible with a call to this function.
405 Use GetSize() to retrieve the size of the target data.
406 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
412 IN UINTN TokenNumber
,
417 Sets an 64-bit value for a given PCD token.
419 When the PCD service sets a value, it will check to ensure that the
420 size of the value being set is compatible with the Token's existing definition.
421 If it is not, an error will be returned.
423 @param[in] TokenNumber The PCD token number.
424 @param[in] Value The value to set for the PCD token.
426 @retval EFI_SUCCESS Procedure returned successfully.
427 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
428 being set was incompatible with a call to this function.
429 Use GetSize() to retrieve the size of the target data.
430 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
436 IN UINTN TokenNumber
,
442 Sets a value of a specified size for a given PCD token.
444 When the PCD service sets a value, it will check to ensure that the
445 size of the value being set is compatible with the Token's existing definition.
446 If it is not, an error will be returned.
448 @param[in] TokenNumber The PCD token number.
449 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
450 On input, if the SizeOfValue is greater than the maximum size supported
451 for this TokenNumber then the output value of SizeOfValue will reflect
452 the maximum size supported for this TokenNumber.
453 @param[in] Buffer The buffer to set for the PCD token.
455 @retval EFI_SUCCESS Procedure returned successfully.
456 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
457 being set was incompatible with a call to this function.
458 Use GetSize() to retrieve the size of the target data.
459 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
465 IN UINTN TokenNumber
,
466 IN OUT UINTN
*SizeOfBuffer
,
471 Sets an Boolean value for a given PCD token.
473 When the PCD service sets a value, it will check to ensure that the
474 size of the value being set is compatible with the Token's existing definition.
475 If it is not, an error will be returned.
477 @param[in] TokenNumber The PCD token number.
478 @param[in] Value The value to set for the PCD token.
480 @retval EFI_SUCCESS Procedure returned successfully.
481 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
482 being set was incompatible with a call to this function.
483 Use GetSize() to retrieve the size of the target data.
484 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
490 IN UINTN TokenNumber
,
496 Sets an 8-bit value for a given PCD token.
498 When the PCD service sets a value, it will check to ensure that the
499 size of the value being set is compatible with the Token's existing definition.
500 If it is not, an error will be returned.
502 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
503 @param[in] TokenNumber The PCD token number.
504 @param[in] Value The value to set for the PCD token.
506 @retval EFI_SUCCESS Procedure returned successfully.
507 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
508 being set was incompatible with a call to this function.
509 Use GetSize() to retrieve the size of the target data.
510 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
516 IN CONST EFI_GUID
*Guid
,
517 IN UINTN TokenNumber
,
522 Sets an 16-bit value for a given PCD token.
524 When the PCD service sets a value, it will check to ensure that the
525 size of the value being set is compatible with the Token's existing definition.
526 If it is not, an error will be returned.
528 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
529 @param[in] TokenNumber The PCD token number.
530 @param[in] Value The value to set for the PCD token.
532 @retval EFI_SUCCESS Procedure returned successfully.
533 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
534 being set was incompatible with a call to this function.
535 Use GetSize() to retrieve the size of the target data.
536 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
542 IN CONST EFI_GUID
*Guid
,
543 IN UINTN TokenNumber
,
548 Sets an 32-bit value for a given PCD token.
550 When the PCD service sets a value, it will check to ensure that the
551 size of the value being set is compatible with the Token's existing definition.
552 If it is not, an error will be returned.
554 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
555 @param[in] TokenNumber The PCD token number.
556 @param[in] Value The value to set for the PCD token.
558 @retval EFI_SUCCESS Procedure returned successfully.
559 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
560 being set was incompatible with a call to this function.
561 Use GetSize() to retrieve the size of the target data.
562 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
568 IN CONST EFI_GUID
*Guid
,
569 IN UINTN TokenNumber
,
574 Sets an 64-bit value for a given PCD token.
576 When the PCD service sets a value, it will check to ensure that the
577 size of the value being set is compatible with the Token's existing definition.
578 If it is not, an error will be returned.
580 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
581 @param[in] TokenNumber The PCD token number.
582 @param[in] Value The value to set for the PCD token.
584 @retval EFI_SUCCESS Procedure returned successfully.
585 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
586 being set was incompatible with a call to this function.
587 Use GetSize() to retrieve the size of the target data.
588 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
594 IN CONST EFI_GUID
*Guid
,
595 IN UINTN TokenNumber
,
600 Sets a value of a specified size for a given PCD token.
602 When the PCD service sets a value, it will check to ensure that the
603 size of the value being set is compatible with the Token's existing definition.
604 If it is not, an error will be returned.
606 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
607 @param[in] TokenNumber The PCD token number.
608 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
609 On input, if the SizeOfValue is greater than the maximum size supported
610 for this TokenNumber then the output value of SizeOfValue will reflect
611 the maximum size supported for this TokenNumber.
612 @param[in] Buffer The buffer to set for the PCD token.
614 @retval EFI_SUCCESS Procedure returned successfully.
615 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
616 being set was incompatible with a call to this function.
617 Use GetSize() to retrieve the size of the target data.
618 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
624 IN CONST EFI_GUID
*Guid
,
625 IN UINTN TokenNumber
,
626 IN OUT UINTN
*SizeOfBuffer
,
631 Sets an Boolean value for a given PCD token.
633 When the PCD service sets a value, it will check to ensure that the
634 size of the value being set is compatible with the Token's existing definition.
635 If it is not, an error will be returned.
637 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
638 @param[in] TokenNumber The PCD token number.
639 @param[in] Value The value to set for the PCD token.
641 @retval EFI_SUCCESS Procedure returned successfully.
642 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
643 being set was incompatible with a call to this function.
644 Use GetSize() to retrieve the size of the target data.
645 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
651 IN CONST EFI_GUID
*Guid
,
652 IN UINTN TokenNumber
,
657 Specifies a function to be called anytime the value of a designated token is changed.
659 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
660 @param[in] TokenNumber The PCD token number.
661 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
663 @retval EFI_SUCCESS The PCD service has successfully established a call event
664 for the CallBackToken requested.
665 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
670 DxeRegisterCallBackOnSet (
671 IN CONST EFI_GUID
*Guid
, OPTIONAL
672 IN UINTN TokenNumber
,
673 IN PCD_PROTOCOL_CALLBACK CallBackFunction
677 Cancels a previously set callback function for a particular PCD token number.
679 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
680 @param[in] TokenNumber The PCD token number.
681 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
683 @retval EFI_SUCCESS The PCD service has successfully established a call event
684 for the CallBackToken requested.
685 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
690 DxeUnRegisterCallBackOnSet (
691 IN CONST EFI_GUID
*Guid
, OPTIONAL
692 IN UINTN TokenNumber
,
693 IN PCD_PROTOCOL_CALLBACK CallBackFunction
697 Retrieves the next valid token number in a given namespace.
699 This is useful since the PCD infrastructure contains a sparse list of token numbers,
700 and one cannot a priori know what token numbers are valid in the database.
702 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
703 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
704 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
705 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
706 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
707 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
708 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
709 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
712 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
713 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
714 being made to retrieve tokens from the default token space.
715 @param[in, out] TokenNumber
716 A pointer to the PCD token number to use to find the subsequent token number.
718 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
719 is already the last valid token number in the PCD database.
720 In the later case, *TokenNumber is updated with the value of 0.
721 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
727 IN CONST EFI_GUID
*Guid
, OPTIONAL
728 IN OUT UINTN
*TokenNumber
732 Get next token space in PCD database according to given token space guid.
734 @param Guid Given token space guid. If NULL, then Guid will be set to
735 the first PCD token space in PCD database, If not NULL, then
736 Guid will be set to next PCD token space.
738 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
739 token space in PCD database.
740 @retval EFI_SUCCESS Success to get next token space guid.
744 DxePcdGetNextTokenSpace (
745 IN OUT CONST EFI_GUID
**Guid
750 PCD_PROTOCOL_CALLBACK CallbackFn
;
753 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
756 // Internal Functions
760 Wrapper function for setting non-pointer type value for a PCD entry.
762 @param TokenNumber Pcd token number autogenerated by build tools.
763 @param Data Value want to be set for PCD entry
764 @param Size Size of value.
766 @return status of SetWorker.
771 IN UINTN TokenNumber
,
777 Set value for an PCD entry
779 @param TokenNumber Pcd token number autogenerated by build tools.
780 @param Data Value want to be set for PCD entry
781 @param Size Size of value.
782 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
783 If False, the type of PCD entry's value is not Pointer.
785 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
786 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
787 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
788 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
789 range of UINT8, UINT16, UINT32, UINT64
790 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
794 IN UINTN TokenNumber
,
801 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
803 @param ExTokenNumber Token number for dynamic-ex PCD.
804 @param Guid Token space guid for dynamic-ex PCD.
805 @param Data Value want to be set.
806 @param SetSize The size of value.
808 @return status of ExSetWorker().
813 IN UINTN ExTokenNumber
,
814 IN CONST EFI_GUID
*Guid
,
820 Set value for a dynamic PCD entry.
822 This routine find the local token number according to dynamic-ex PCD's token
823 space guid and token number firstly, and invoke callback function if this PCD
824 entry registered callback function. Finally, invoken general SetWorker to set
827 @param ExTokenNumber Dynamic-ex PCD token number.
828 @param Guid Token space guid for dynamic-ex PCD.
829 @param Data PCD value want to be set
830 @param SetSize Size of value.
831 @param PtrType If TRUE, this PCD entry is pointer type.
832 If FALSE, this PCD entry is not pointer type.
834 @return status of SetWorker().
839 IN UINTN ExTokenNumber
,
840 IN CONST EFI_GUID
*Guid
,
847 Get the PCD entry pointer in PCD database.
849 This routine will visit PCD database to find the PCD entry according to given
850 token number. The given token number is autogened by build tools and it will be
851 translated to local token number. Local token number contains PCD's type and
852 offset of PCD entry in PCD database.
854 @param TokenNumber Token's number, it is autogened by build tools
855 @param GetSize The size of token's value
857 @return PCD entry pointer in PCD database
862 IN UINTN TokenNumber
,
867 Wrapper function for get PCD value for dynamic-ex PCD.
869 @param Guid Token space guid for dynamic-ex PCD.
870 @param ExTokenNumber Token number for dynamic-ex PCD.
871 @param GetSize The size of dynamic-ex PCD value.
873 @return PCD entry in PCD database.
878 IN CONST EFI_GUID
*Guid
,
879 IN UINTN ExTokenNumber
,
884 Find the local token number according to system SKU ID.
886 @param LocalTokenNumber PCD token number
887 @param Size The size of PCD entry.
888 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
889 If False, the PCD entry is initialized in DXE phase.
891 @return Token number according to system SKU ID.
895 GetSkuEnabledTokenNumber (
896 UINT32 LocalTokenNumber
,
902 Get Variable which contains HII type PCD entry.
904 @param VariableGuid Variable's guid
905 @param VariableName Variable's unicode name string
906 @param VariableData Variable's data pointer,
907 @param VariableSize Variable's size.
909 @return the status of gRT->GetVariable
913 IN EFI_GUID
*VariableGuid
,
914 IN UINT16
*VariableName
,
915 OUT UINT8
**VariableData
,
916 OUT UINTN
*VariableSize
920 Set value for HII-type PCD.
922 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
923 HII-type PCD is to visit this variable.
925 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
926 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
927 @param Data Value want to be set.
928 @param DataSize Size of value
929 @param Offset Value offset of HII-type PCD in variable.
931 @return status of GetVariable()/SetVariable().
936 IN EFI_GUID
*VariableGuid
,
937 IN UINT16
*VariableName
,
944 Register the callback function for a PCD entry.
946 This routine will register 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 @return EFI_SUCCESS Always success for registering callback function.
958 DxeRegisterCallBackWorker (
959 IN UINTN TokenNumber
,
960 IN CONST EFI_GUID
*Guid
, OPTIONAL
961 IN PCD_PROTOCOL_CALLBACK CallBackFunction
965 UnRegister the callback function for a PCD entry.
967 This routine will unregister a callback function to a PCD entry by given token number
968 and token space guid.
970 @param TokenNumber PCD token's number, it is autogened by build tools.
971 @param Guid PCD token space's guid.
972 if not NULL, this PCD is dynamicEx type PCD.
973 @param CallBackFunction Callback function pointer
975 @retval EFI_SUCCESS Callback function is success to be unregister.
976 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
979 DxeUnRegisterCallBackWorker (
980 IN UINTN TokenNumber
,
981 IN CONST EFI_GUID
*Guid
, OPTIONAL
982 IN PCD_PROTOCOL_CALLBACK CallBackFunction
986 Initialize the PCD database in DXE phase.
988 PCD database in DXE phase also contains PCD database in PEI phase which is copied
993 BuildPcdDxeDataBase (
998 Get local token number according to dynamic-ex PCD's {token space guid:token number}
1000 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1001 in DEC file. PCD database maintain a mapping table that translate pair of {token
1002 space guid: token number} to local token number.
1004 @param Guid Token space guid for dynamic-ex PCD entry.
1005 @param ExTokenNumber Dynamic-ex PCD token number.
1007 @return local token number for dynamic-ex PCD.
1011 GetExPcdTokenNumber (
1012 IN CONST EFI_GUID
*Guid
,
1013 IN UINT32 ExTokenNumber
1017 Get next token number in given token space.
1019 This routine is used for dynamicEx type PCD. It will firstly scan token space
1020 table to get token space according to given token space guid. Then scan given
1021 token number in found token space, if found, then return next token number in
1024 @param Guid Token space guid. Next token number will be scaned in
1026 @param TokenNumber Token number.
1027 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1029 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1030 in token space table.
1031 @param GuidTable Token space guid table. It will be used for scan token space
1032 by given token space guid.
1033 @param SizeOfGuidTable The size of guid table.
1034 @param ExMapTable DynamicEx token number mapping table.
1035 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1037 @retval EFI_NOT_FOUND Can not given token space or token number.
1038 @retval EFI_SUCCESS Success to get next token number.
1042 ExGetNextTokeNumber (
1043 IN CONST EFI_GUID
*Guid
,
1044 IN OUT UINTN
*TokenNumber
,
1045 IN EFI_GUID
*GuidTable
,
1046 IN UINTN SizeOfGuidTable
,
1047 IN DYNAMICEX_MAPPING
*ExMapTable
,
1048 IN UINTN SizeOfExMapTable
1052 Get size of POINTER type PCD value.
1054 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1055 @param MaxSize Maximum size of POINTER type PCD value.
1057 @return size of POINTER type PCD value.
1062 IN UINTN LocalTokenNumberTableIdx
,
1067 Set size of POINTER type PCD value. The size should not exceed the maximum size
1070 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1071 @param CurrentSize Size of POINTER type PCD value.
1073 @retval TRUE Success to set size of PCD value.
1074 @retval FALSE Fail to set size of PCD value.
1078 IN UINTN LocalTokenNumberTableIdx
,
1079 IN OUT UINTN
*CurrentSize
1082 extern PCD_DATABASE
* mPcdDatabase
;
1084 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit
;
1086 extern EFI_LOCK mPcdDatabaseLock
;