2 Private functions used by PCD DXE driver.
4 Copyright (c) 2006 - 2013, 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 <Guid/PcdDataBaseSignatureGuid.h>
21 #include <Protocol/Pcd.h>
22 #include <Protocol/PiPcd.h>
23 #include <Library/BaseLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/UefiLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/PcdLib.h>
28 #include <Library/HobLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/UefiRuntimeServicesTableLib.h>
35 // Please make sure the PCD Serivce DXE Version is consistent with
36 // the version of the generated DXE PCD Database by build tool.
38 #define PCD_SERVICE_DXE_VERSION 4
41 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
43 #if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)
44 #error "Please make sure the version of PCD DXE Service and the generated PCD DXE Database match."
48 // Protocol Interface function declaration.
51 Sets the SKU value for subsequent calls to set or get PCD token values.
53 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
54 SetSku() is normally called only once by the system.
56 For each item (token), the database can hold a single value that applies to all SKUs,
57 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
58 SKU-specific values are called SKU enabled.
60 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
61 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
62 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
63 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
64 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
65 set for that Id, the results are unpredictable.
67 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
68 set values associated with a PCD token.
78 Retrieves an 8-bit value for a given PCD token.
80 Retrieves the current byte-sized value for a PCD token number.
81 If the TokenNumber is invalid, the results are unpredictable.
83 @param[in] TokenNumber The PCD token number.
85 @return The UINT8 value.
95 Retrieves an 16-bit value for a given PCD token.
97 Retrieves the current 16-bits value for a PCD token number.
98 If the TokenNumber is invalid, the results are unpredictable.
100 @param[in] TokenNumber The PCD token number.
102 @return The UINT16 value.
112 Retrieves an 32-bit value for a given PCD token.
114 Retrieves the current 32-bits value for a PCD token number.
115 If the TokenNumber is invalid, the results are unpredictable.
117 @param[in] TokenNumber The PCD token number.
119 @return The UINT32 value.
129 Retrieves an 64-bit value for a given PCD token.
131 Retrieves the current 64-bits value for a PCD token number.
132 If the TokenNumber is invalid, the results are unpredictable.
134 @param[in] TokenNumber The PCD token number.
136 @return The UINT64 value.
146 Retrieves a pointer to a value for a given PCD token.
148 Retrieves the current pointer to the buffer for a PCD token number.
149 Do not make any assumptions about the alignment of the pointer that
150 is returned by this function call. If the TokenNumber is invalid,
151 the results are unpredictable.
153 @param[in] TokenNumber The PCD token number.
155 @return The pointer to the buffer to be retrieved.
165 Retrieves a Boolean value for a given PCD token.
167 Retrieves the current boolean value for a PCD token number.
168 Do not make any assumptions about the alignment of the pointer that
169 is returned by this function call. If the TokenNumber is invalid,
170 the results are unpredictable.
172 @param[in] TokenNumber The PCD token number.
174 @return The Boolean value.
184 Retrieves the size of the value for a given PCD token.
186 Retrieves the current size of a particular PCD token.
187 If the TokenNumber is invalid, the results are unpredictable.
189 @param[in] TokenNumber The PCD token number.
191 @return The size of the value for the PCD token.
201 Retrieves an 8-bit value for a given PCD token.
203 Retrieves the 8-bit value of a particular PCD token.
204 If the TokenNumber is invalid or the token space
205 specified by Guid does not exist, the results are
208 @param[in] Guid The token space for the token number.
209 @param[in] TokenNumber The PCD token number.
211 @return The size 8-bit value for the PCD token.
217 IN CONST EFI_GUID
*Guid
,
222 Retrieves an 16-bit value for a given PCD token.
224 Retrieves the 16-bit value of a particular PCD token.
225 If the TokenNumber is invalid or the token space
226 specified by Guid does not exist, the results are
229 @param[in] Guid The token space for the token number.
230 @param[in] TokenNumber The PCD token number.
232 @return The size 16-bit value for the PCD token.
238 IN CONST EFI_GUID
*Guid
,
243 Retrieves an 32-bit value for a given PCD token.
245 Retrieves the 32-bit value of a particular PCD token.
246 If the TokenNumber is invalid or the token space
247 specified by Guid does not exist, the results are
250 @param[in] Guid The token space for the token number.
251 @param[in] TokenNumber The PCD token number.
253 @return The size 32-bit value for the PCD token.
259 IN CONST EFI_GUID
*Guid
,
264 Retrieves an 64-bit value for a given PCD token.
266 Retrieves the 64-bit value of a particular PCD token.
267 If the TokenNumber is invalid or the token space
268 specified by Guid does not exist, the results are
271 @param[in] Guid The token space for the token number.
272 @param[in] TokenNumber The PCD token number.
274 @return The size 64-bit value for the PCD token.
280 IN CONST EFI_GUID
*Guid
,
285 Retrieves a pointer to a value for a given PCD token.
287 Retrieves the current pointer to the buffer for a PCD token number.
288 Do not make any assumptions about the alignment of the pointer that
289 is returned by this function call. If the TokenNumber is invalid,
290 the results are unpredictable.
292 @param[in] Guid The token space for the token number.
293 @param[in] TokenNumber The PCD token number.
295 @return The pointer to the buffer to be retrieved.
301 IN CONST EFI_GUID
*Guid
,
306 Retrieves an Boolean value for a given PCD token.
308 Retrieves the Boolean value of a particular PCD token.
309 If the TokenNumber is invalid or the token space
310 specified by Guid does not exist, the results are
313 @param[in] Guid The token space for the token number.
314 @param[in] TokenNumber The PCD token number.
316 @return The size Boolean value for the PCD token.
322 IN CONST EFI_GUID
*Guid
,
327 Retrieves the size of the value for a given PCD token.
329 Retrieves the current size of a particular PCD token.
330 If the TokenNumber is invalid, the results are unpredictable.
332 @param[in] Guid The token space for the token number.
333 @param[in] TokenNumber The PCD token number.
335 @return The size of the value for the PCD token.
341 IN CONST EFI_GUID
*Guid
,
346 Sets an 8-bit value for a given PCD token.
348 When the PCD service sets a value, it will check to ensure that the
349 size of the value being set is compatible with the Token's existing definition.
350 If it is not, an error will be returned.
352 @param[in] TokenNumber The PCD token number.
353 @param[in] Value The value to set for the PCD token.
355 @retval EFI_SUCCESS Procedure returned successfully.
356 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
357 being set was incompatible with a call to this function.
358 Use GetSize() to retrieve the size of the target data.
359 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
365 IN UINTN TokenNumber
,
370 Sets an 16-bit value for a given PCD token.
372 When the PCD service sets a value, it will check to ensure that the
373 size of the value being set is compatible with the Token's existing definition.
374 If it is not, an error will be returned.
376 @param[in] TokenNumber The PCD token number.
377 @param[in] Value The value to set for the PCD token.
379 @retval EFI_SUCCESS Procedure returned successfully.
380 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
381 being set was incompatible with a call to this function.
382 Use GetSize() to retrieve the size of the target data.
383 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
389 IN UINTN TokenNumber
,
394 Sets an 32-bit value for a given PCD token.
396 When the PCD service sets a value, it will check to ensure that the
397 size of the value being set is compatible with the Token's existing definition.
398 If it is not, an error will be returned.
400 @param[in] TokenNumber The PCD token number.
401 @param[in] Value The value to set for the PCD token.
403 @retval EFI_SUCCESS Procedure returned successfully.
404 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
405 being set was incompatible with a call to this function.
406 Use GetSize() to retrieve the size of the target data.
407 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
413 IN UINTN TokenNumber
,
418 Sets an 64-bit value for a given PCD token.
420 When the PCD service sets a value, it will check to ensure that the
421 size of the value being set is compatible with the Token's existing definition.
422 If it is not, an error will be returned.
424 @param[in] TokenNumber The PCD token number.
425 @param[in] Value The value to set for the PCD token.
427 @retval EFI_SUCCESS Procedure returned successfully.
428 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
429 being set was incompatible with a call to this function.
430 Use GetSize() to retrieve the size of the target data.
431 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
437 IN UINTN TokenNumber
,
443 Sets a value of a specified size for a given PCD token.
445 When the PCD service sets a value, it will check to ensure that the
446 size of the value being set is compatible with the Token's existing definition.
447 If it is not, an error will be returned.
449 @param[in] TokenNumber The PCD token number.
450 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
451 On input, if the SizeOfValue is greater than the maximum size supported
452 for this TokenNumber then the output value of SizeOfValue will reflect
453 the maximum size supported for this TokenNumber.
454 @param[in] Buffer The buffer to set for the PCD token.
456 @retval EFI_SUCCESS Procedure returned successfully.
457 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
458 being set was incompatible with a call to this function.
459 Use GetSize() to retrieve the size of the target data.
460 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
466 IN UINTN TokenNumber
,
467 IN OUT UINTN
*SizeOfBuffer
,
472 Sets an Boolean value for a given PCD token.
474 When the PCD service sets a value, it will check to ensure that the
475 size of the value being set is compatible with the Token's existing definition.
476 If it is not, an error will be returned.
478 @param[in] TokenNumber The PCD token number.
479 @param[in] Value The value to set for the PCD token.
481 @retval EFI_SUCCESS Procedure returned successfully.
482 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
483 being set was incompatible with a call to this function.
484 Use GetSize() to retrieve the size of the target data.
485 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
491 IN UINTN TokenNumber
,
497 Sets an 8-bit value for a given PCD token.
499 When the PCD service sets a value, it will check to ensure that the
500 size of the value being set is compatible with the Token's existing definition.
501 If it is not, an error will be returned.
503 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
504 @param[in] TokenNumber The PCD token number.
505 @param[in] Value The value to set for the PCD token.
507 @retval EFI_SUCCESS Procedure returned successfully.
508 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
509 being set was incompatible with a call to this function.
510 Use GetSize() to retrieve the size of the target data.
511 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
517 IN CONST EFI_GUID
*Guid
,
518 IN UINTN TokenNumber
,
523 Sets an 16-bit value for a given PCD token.
525 When the PCD service sets a value, it will check to ensure that the
526 size of the value being set is compatible with the Token's existing definition.
527 If it is not, an error will be returned.
529 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
530 @param[in] TokenNumber The PCD token number.
531 @param[in] Value The value to set for the PCD token.
533 @retval EFI_SUCCESS Procedure returned successfully.
534 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
535 being set was incompatible with a call to this function.
536 Use GetSize() to retrieve the size of the target data.
537 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
543 IN CONST EFI_GUID
*Guid
,
544 IN UINTN TokenNumber
,
549 Sets an 32-bit value for a given PCD token.
551 When the PCD service sets a value, it will check to ensure that the
552 size of the value being set is compatible with the Token's existing definition.
553 If it is not, an error will be returned.
555 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
556 @param[in] TokenNumber The PCD token number.
557 @param[in] Value The value to set for the PCD token.
559 @retval EFI_SUCCESS Procedure returned successfully.
560 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
561 being set was incompatible with a call to this function.
562 Use GetSize() to retrieve the size of the target data.
563 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
569 IN CONST EFI_GUID
*Guid
,
570 IN UINTN TokenNumber
,
575 Sets an 64-bit value for a given PCD token.
577 When the PCD service sets a value, it will check to ensure that the
578 size of the value being set is compatible with the Token's existing definition.
579 If it is not, an error will be returned.
581 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
582 @param[in] TokenNumber The PCD token number.
583 @param[in] Value The value to set for the PCD token.
585 @retval EFI_SUCCESS Procedure returned successfully.
586 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
587 being set was incompatible with a call to this function.
588 Use GetSize() to retrieve the size of the target data.
589 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
595 IN CONST EFI_GUID
*Guid
,
596 IN UINTN TokenNumber
,
601 Sets a value of a specified size for a given PCD token.
603 When the PCD service sets a value, it will check to ensure that the
604 size of the value being set is compatible with the Token's existing definition.
605 If it is not, an error will be returned.
607 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
608 @param[in] TokenNumber The PCD token number.
609 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
610 On input, if the SizeOfValue is greater than the maximum size supported
611 for this TokenNumber then the output value of SizeOfValue will reflect
612 the maximum size supported for this TokenNumber.
613 @param[in] Buffer The buffer to set for the PCD token.
615 @retval EFI_SUCCESS Procedure returned successfully.
616 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
617 being set was incompatible with a call to this function.
618 Use GetSize() to retrieve the size of the target data.
619 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
625 IN CONST EFI_GUID
*Guid
,
626 IN UINTN TokenNumber
,
627 IN OUT UINTN
*SizeOfBuffer
,
632 Sets an Boolean value for a given PCD token.
634 When the PCD service sets a value, it will check to ensure that the
635 size of the value being set is compatible with the Token's existing definition.
636 If it is not, an error will be returned.
638 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
639 @param[in] TokenNumber The PCD token number.
640 @param[in] Value The value to set for the PCD token.
642 @retval EFI_SUCCESS Procedure returned successfully.
643 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
644 being set was incompatible with a call to this function.
645 Use GetSize() to retrieve the size of the target data.
646 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
652 IN CONST EFI_GUID
*Guid
,
653 IN UINTN TokenNumber
,
658 Specifies a function to be called anytime the value of a designated token is changed.
660 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
661 @param[in] TokenNumber The PCD token number.
662 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
664 @retval EFI_SUCCESS The PCD service has successfully established a call event
665 for the CallBackToken requested.
666 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
671 DxeRegisterCallBackOnSet (
672 IN CONST EFI_GUID
*Guid
, OPTIONAL
673 IN UINTN TokenNumber
,
674 IN PCD_PROTOCOL_CALLBACK CallBackFunction
678 Cancels a previously set callback function for a particular PCD token number.
680 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
681 @param[in] TokenNumber The PCD token number.
682 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
684 @retval EFI_SUCCESS The PCD service has successfully established a call event
685 for the CallBackToken requested.
686 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
691 DxeUnRegisterCallBackOnSet (
692 IN CONST EFI_GUID
*Guid
, OPTIONAL
693 IN UINTN TokenNumber
,
694 IN PCD_PROTOCOL_CALLBACK CallBackFunction
698 Retrieves the next valid token number in a given namespace.
700 This is useful since the PCD infrastructure contains a sparse list of token numbers,
701 and one cannot a priori know what token numbers are valid in the database.
703 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
704 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
705 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
706 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
707 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
708 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
709 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
710 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
713 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
714 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
715 being made to retrieve tokens from the default token space.
716 @param[in, out] TokenNumber
717 A pointer to the PCD token number to use to find the subsequent token number.
719 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
720 is already the last valid token number in the PCD database.
721 In the later case, *TokenNumber is updated with the value of 0.
722 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
728 IN CONST EFI_GUID
*Guid
, OPTIONAL
729 IN OUT UINTN
*TokenNumber
733 Get next token space in PCD database according to given token space guid.
735 @param Guid Given token space guid. If NULL, then Guid will be set to
736 the first PCD token space in PCD database, If not NULL, then
737 Guid will be set to next PCD token space.
739 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
740 token space in PCD database.
741 @retval EFI_SUCCESS Success to get next token space guid.
745 DxePcdGetNextTokenSpace (
746 IN OUT CONST EFI_GUID
**Guid
751 PCD_PROTOCOL_CALLBACK CallbackFn
;
754 #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)
757 // Internal Functions
761 Wrapper function for setting non-pointer type value for a PCD entry.
763 @param TokenNumber Pcd token number autogenerated by build tools.
764 @param Data Value want to be set for PCD entry
765 @param Size Size of value.
767 @return status of SetWorker.
772 IN UINTN TokenNumber
,
778 Set value for an PCD entry
780 @param TokenNumber Pcd token number autogenerated by build tools.
781 @param Data Value want to be set for PCD entry
782 @param Size Size of value.
783 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
784 If False, the type of PCD entry's value is not Pointer.
786 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
787 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
788 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
789 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
790 range of UINT8, UINT16, UINT32, UINT64
791 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
795 IN UINTN TokenNumber
,
802 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
804 @param ExTokenNumber Token number for dynamic-ex PCD.
805 @param Guid Token space guid for dynamic-ex PCD.
806 @param Data Value want to be set.
807 @param SetSize The size of value.
809 @return status of ExSetWorker().
814 IN UINTN ExTokenNumber
,
815 IN CONST EFI_GUID
*Guid
,
821 Set value for a dynamic PCD entry.
823 This routine find the local token number according to dynamic-ex PCD's token
824 space guid and token number firstly, and invoke callback function if this PCD
825 entry registered callback function. Finally, invoken general SetWorker to set
828 @param ExTokenNumber Dynamic-ex PCD token number.
829 @param Guid Token space guid for dynamic-ex PCD.
830 @param Data PCD value want to be set
831 @param SetSize Size of value.
832 @param PtrType If TRUE, this PCD entry is pointer type.
833 If FALSE, this PCD entry is not pointer type.
835 @return status of SetWorker().
840 IN UINTN ExTokenNumber
,
841 IN CONST EFI_GUID
*Guid
,
848 Get the PCD entry pointer in PCD database.
850 This routine will visit PCD database to find the PCD entry according to given
851 token number. The given token number is autogened by build tools and it will be
852 translated to local token number. Local token number contains PCD's type and
853 offset of PCD entry in PCD database.
855 @param TokenNumber Token's number, it is autogened by build tools
856 @param GetSize The size of token's value
858 @return PCD entry pointer in PCD database
863 IN UINTN TokenNumber
,
868 Wrapper function for get PCD value for dynamic-ex PCD.
870 @param Guid Token space guid for dynamic-ex PCD.
871 @param ExTokenNumber Token number for dynamic-ex PCD.
872 @param GetSize The size of dynamic-ex PCD value.
874 @return PCD entry in PCD database.
879 IN CONST EFI_GUID
*Guid
,
880 IN UINTN ExTokenNumber
,
885 Find the local token number according to system SKU ID.
887 @param LocalTokenNumber PCD token number
888 @param Size The size of PCD entry.
889 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.
890 If False, the PCD entry is initialized in DXE phase.
892 @return Token number according to system SKU ID.
896 GetSkuEnabledTokenNumber (
897 UINT32 LocalTokenNumber
,
903 Get Variable which contains HII type PCD entry.
905 @param VariableGuid Variable's guid
906 @param VariableName Variable's unicode name string
907 @param VariableData Variable's data pointer,
908 @param VariableSize Variable's size.
910 @return the status of gRT->GetVariable
914 IN EFI_GUID
*VariableGuid
,
915 IN UINT16
*VariableName
,
916 OUT UINT8
**VariableData
,
917 OUT UINTN
*VariableSize
921 Set value for HII-type PCD.
923 A HII-type PCD's value is stored in a variable. Setting/Getting the value of
924 HII-type PCD is to visit this variable.
926 @param VariableGuid Guid of variable which stored value of a HII-type PCD.
927 @param VariableName Unicode name of variable which stored value of a HII-type PCD.
928 @param Data Value want to be set.
929 @param DataSize Size of value
930 @param Offset Value offset of HII-type PCD in variable.
932 @return status of GetVariable()/SetVariable().
937 IN EFI_GUID
*VariableGuid
,
938 IN UINT16
*VariableName
,
945 Register the callback function for a PCD entry.
947 This routine will register a callback function to a PCD entry by given token number
948 and token space guid.
950 @param TokenNumber PCD token's number, it is autogened by build tools.
951 @param Guid PCD token space's guid,
952 if not NULL, this PCD is dynamicEx type PCD.
953 @param CallBackFunction Callback function pointer
955 @return EFI_SUCCESS Always success for registering callback function.
959 DxeRegisterCallBackWorker (
960 IN UINTN TokenNumber
,
961 IN CONST EFI_GUID
*Guid
, OPTIONAL
962 IN PCD_PROTOCOL_CALLBACK CallBackFunction
966 UnRegister the callback function for a PCD entry.
968 This routine will unregister a callback function to a PCD entry by given token number
969 and token space guid.
971 @param TokenNumber PCD token's number, it is autogened by build tools.
972 @param Guid PCD token space's guid.
973 if not NULL, this PCD is dynamicEx type PCD.
974 @param CallBackFunction Callback function pointer
976 @retval EFI_SUCCESS Callback function is success to be unregister.
977 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.
980 DxeUnRegisterCallBackWorker (
981 IN UINTN TokenNumber
,
982 IN CONST EFI_GUID
*Guid
, OPTIONAL
983 IN PCD_PROTOCOL_CALLBACK CallBackFunction
987 Initialize the PCD database in DXE phase.
989 PCD database in DXE phase also contains PCD database in PEI phase which is copied
994 BuildPcdDxeDataBase (
999 Get Token Number according to dynamic-ex PCD's {token space guid:token number}
1001 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
1002 in DEC file. PCD database maintain a mapping table that translate pair of {token
1003 space guid: token number} to Token Number.
1005 @param Guid Token space guid for dynamic-ex PCD entry.
1006 @param ExTokenNumber Dynamic-ex PCD token number.
1008 @return Token Number for dynamic-ex PCD.
1012 GetExPcdTokenNumber (
1013 IN CONST EFI_GUID
*Guid
,
1014 IN UINT32 ExTokenNumber
1018 Get next token number in given token space.
1020 This routine is used for dynamicEx type PCD. It will firstly scan token space
1021 table to get token space according to given token space guid. Then scan given
1022 token number in found token space, if found, then return next token number in
1025 @param Guid Token space guid. Next token number will be scaned in
1027 @param TokenNumber Token number.
1028 If PCD_INVALID_TOKEN_NUMBER, return first token number in
1030 If not PCD_INVALID_TOKEN_NUMBER, return next token number
1031 in token space table.
1032 @param GuidTable Token space guid table. It will be used for scan token space
1033 by given token space guid.
1034 @param SizeOfGuidTable The size of guid table.
1035 @param ExMapTable DynamicEx token number mapping table.
1036 @param SizeOfExMapTable The size of dynamicEx token number mapping table.
1038 @retval EFI_NOT_FOUND Can not given token space or token number.
1039 @retval EFI_SUCCESS Success to get next token number.
1043 ExGetNextTokeNumber (
1044 IN CONST EFI_GUID
*Guid
,
1045 IN OUT UINTN
*TokenNumber
,
1046 IN EFI_GUID
*GuidTable
,
1047 IN UINTN SizeOfGuidTable
,
1048 IN DYNAMICEX_MAPPING
*ExMapTable
,
1049 IN UINTN SizeOfExMapTable
1053 Get size of POINTER type PCD value.
1055 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1056 @param MaxSize Maximum size of POINTER type PCD value.
1058 @return size of POINTER type PCD value.
1063 IN UINTN LocalTokenNumberTableIdx
,
1068 Set size of POINTER type PCD value. The size should not exceed the maximum size
1071 @param LocalTokenNumberTableIdx Index of local token number in local token number table.
1072 @param CurrentSize Size of POINTER type PCD value.
1074 @retval TRUE Success to set size of PCD value.
1075 @retval FALSE Fail to set size of PCD value.
1079 IN UINTN LocalTokenNumberTableIdx
,
1080 IN OUT UINTN
*CurrentSize
1083 extern PCD_DATABASE mPcdDatabase
;
1085 extern UINT32 mPcdTotalTokenCount
;
1086 extern UINT32 mPeiLocalTokenCount
;
1087 extern UINT32 mDxeLocalTokenCount
;
1088 extern UINT32 mPeiNexTokenCount
;
1089 extern UINT32 mDxeNexTokenCount
;
1090 extern UINT32 mPeiExMapppingTableSize
;
1091 extern UINT32 mDxeExMapppingTableSize
;
1092 extern UINT32 mPeiGuidTableSize
;
1093 extern UINT32 mDxeGuidTableSize
;
1095 extern BOOLEAN mPeiExMapTableEmpty
;
1096 extern BOOLEAN mDxeExMapTableEmpty
;
1097 extern BOOLEAN mPeiDatabaseEmpty
;
1099 extern EFI_GUID
**TmpTokenSpaceBuffer
;
1100 extern UINTN TmpTokenSpaceBufferCount
;
1102 extern EFI_LOCK mPcdDatabaseLock
;