]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/PCD/Pei/Pcd.inf
075e16aeb4deb12b5ff555593b17569aab354352
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Pei / Pcd.inf
1 #/** @file
2 # PCD PEIM produces PCD database to manage all dynamic PCD in PEI phase and install Pcd Ppi service.
3 #
4 # ////////////////////////////////////////////////////////////////////////////////
5 # // //
6 # // Introduction of PCD database //
7 # // //
8 # ////////////////////////////////////////////////////////////////////////////////
9 #
10 # 1, Introduction
11 # PCD database hold all dynamic type PCD information. The structure of PEI PCD
12 # database is generated by build tools according to dynamic PCD usage for
13 # specified platform.
14 #
15 # 2, Dynamic Type PCD
16 # Dynamic type PCD is used for the configuration/setting which value is determined
17 # dynamic. In contrast, the value of static type PCD (FeatureFlag, FixedPcd,
18 # PatchablePcd) is fixed in final generated FD image in build time.
19 #
20 # 2.1 The "dynamic" determination means one of below cases:
21 # a) The PCD setting value is produced by someone driver and consumed by
22 # other driver in execution time.
23 # b) The PCD setting value is set/get by user from FrontPage.
24 # c) The PCD setting value is produced by platform OEM vendor in specified area.
25 #
26 # 2.2 According to module distribution way, dynamic PCD could be classfied as:
27 # a) Dynamic:
28 # If module is released in source code and will be built with platform
29 # DSC, the dynamic PCD used by this module can be accessed as:
30 # PcdGetxx(PcdSampleDynamicPcd);
31 # In building platform, build tools will translate PcdSampleDynamicPcd to
32 # pair of {Token Space Guid: Token Number} for this PCD.
33 # b) DynamicEx:
34 # If module is release as binary and will not pariticpate platform building,
35 # the dynamic PCD used by this module need be accessed as:
36 # PcdGetxxEx(gEfiMyTokenspaceGuid, PcdSampleDynamicPcd)
37 # Developer need explicity gives {Token Space Guid:Token Number} as parameter
38 # in writting source code.
39 #
40 # 2.3 According to PCD value's storage method, dynamic PCD could be classfied as:
41 # a) Default Storage:
42 # - The PCD value is stored in PCD database maintained by PCD driver in boot
43 # time memory.
44 # - This type is used for communication between PEIM/DXE driver, DXE/DXE
45 # driver. But all set/get value will be losted after boot-time memory
46 # is turn off.
47 # - [PcdsDynamicDefault] is used as section name for this type PCD in
48 # platform DSC file. [PcdsDynamicExDefault] is used for dynamicEx type PCD.
49 #
50 # b) Variable Storage:
51 # - The PCD value is stored in variable area.
52 # - As default storage type, this type PCD could be used for PEI/DXE driver
53 # communication. But beside it, this type PCD could alsp be used to store
54 # the value associate with a HII setting via variable interface.
55 # - In PEI phase, the PCD value could only be got but can not be set due
56 # to variable area is readonly.
57 # - [PcdsDynamicHii] is used as section name for this type PCD in platform
58 # DSC file. [PcdsDynamicExHii] is for dynamicEx type PCD.
59 #
60 # c) OEM specificed storage area:
61 # - The PCD value is stored in OEM specified area which base address is
62 # specified by a FixedAtBuild PCD setting - PcdVpdBaseAddress.
63 # - The area is read only for PEI and DXE phase.
64 # - [PcdsDynamicVpd] is used as section name for this type PCD in platform
65 # DSC file. [PcdsDynamicExVpd] is for dynamicex type PCD.
66 #
67 # 2.4 When and how to use dynamic PCD
68 # Module developer do not care the used PCD is dynamic or static when writting
69 # source code/INF. Dynamic PCD and dynamic type is pointed by platform integrator
70 # in platform DSC file. Please ref section 2.3 to get matching between dynamic
71 # PCD type and section name in DSC file.
72 #
73 # 3, PCD database:
74 # Although dynamic PCD could be in different storage type as above description,
75 # but the basic information and default value for all dynamic PCD is hold
76 # by PCD database maintained by PEI/DXE driver.
77 #
78 # As the whole EFI BIOS boot path is divided into PEI/DXE phase, the PCD database
79 # also is divided into Pei/Dxe database maintaied by PcdPeim/PcdDxe driver separatly.
80 # To make PcdPeim's driver image smaller, PEI PCD database only hold all dynamic
81 # PCD information used in PEI phase or use in both PEI/DXE phase. And DXE PCD
82 # database contains all PCDs used in PEI/DXE phase in memory.
83 #
84 # Build tool will generate PCD database into some C structure and variable for
85 # PEI/DXE PCD driver according to dynamic PCD section in platform DSC file.
86 #
87 # 3.1 PcdPeim and PcdDxe
88 # PEI PCD database is maintained by PcdPeim driver run from flash. PcdPeim driver
89 # build guid hob in temporary memory and copy auto-generated C structure
90 # to temporary memory for PEI PCD database.
91 # DXE PCD database is maintained by PcdDxe driver.At entry point of PcdDxe driver,
92 # a new PCD database is allocated in boot-time memory which including all
93 # PEI PCD and DXE PCD entry.
94 #
95 # Pcd driver should run as early as possible before any other driver access
96 # dynamic PCD's value. PEI/DXE "Apriori File" mechanism make it possible by
97 # making PcdPeim/PcdDxe as first dispatching driver in PEI/DXE phase.
98 #
99 # 3.2 Token space Guid/Token number, Platform token, Local token number
100 # Dynamic PCD
101 # +-----------+ +---------+
102 # |TokenSpace | |Platform |
103 # | Guid | build tool | Token |
104 # | + +-------------->| Number |
105 # | Token | +---------+`._
106 # | Number | `.
107 # +-----------+ `. +------+
108 # `-|Local |
109 # |Token |
110 # DynamicEx PCD ,-|Number|
111 # +-----------+ ,-' +------+
112 # |TokenSpace | ,-'
113 # | Guid | _,-'
114 # | + +.'
115 # | Token |
116 # | Number |
117 # +-----------+
118 #
119 #
120 # 3.2.1 Pair of Token space guid + Token number
121 # Any type PCD is identified by pair of "TokenSpaceGuid + TokeNumber". But it
122 # is not easy maintained by PCD driver, and hashed token number will make
123 # searching slowly.
124 #
125 # 3.2.2 Platform Token Number
126 # "Platform token number" concept is introduced for mapping to a pair of
127 # "TokenSpaceGuid + TokenNumber". The platform token number is generated by
128 # build tool in autogen.h and all of them are continual in a platform scope
129 # started from 1.(0 meaning invalid internal token number)
130 # With auto-generated "platform token number", PcdGet(PcdSampleDynamicPcd)
131 # in source code is translated to LibPcdGet(_PCD_TOKEN_PcdSampleDynamicPcd)
132 # in autogen.h.
133 # Notes: The mapping between pair of "tokenspace guid + token number" and
134 # "internal token number" need build tool establish, so "platform token number"
135 # mechanism is not suitable for binary module which use DynamicEx type PCD.
136 # To access a dynamicEx type PCD, pair of "token space guid/token number" all need
137 # to be specificed for PcdSet/PcdGet accessing macro.
138 #
139 # Platform Token Number is started from 1, and inceased continuous. From whole
140 # platform scope, there are two zones: PEI Zone and DXE Zone
141 # | Platform Token Number
142 # ----------|----------------------------------------------------------------
143 # PEI Zone: | 1 ~ PEI_LOCAL_TOKEN_NUMBER
144 # DXE Zone: | (PEI_LOCAL_TOKEN_NUMBER + 1) ~ (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER)
145 #
146 # 3.2.3 Local Token Number
147 # To fast searching a PCD entry in PCD database, PCD driver translate
148 # platform token number to local token number via a mapping table.
149 # For binary DynamicEx type PCD, there is a another mapping table to translate
150 # "token space guid + token number" to local token number directly.
151 # Local token number is identifier for all internal interface in PCD PEI/DXE
152 # driver.
153 #
154 # A local token number is a 32-bit value in following meaning:
155 # 32 ------------- 28 ---------- 24 -------- 0
156 # | PCD type mask | Datum Type | Offset |
157 # +-----------------------------------------+
158 # where:
159 # PCd type mask: indicate Pcd type from following macro:
160 # PCD_TYPE_DATA
161 # PCD_TYPE_HII
162 # PCD_TYPE_VPD
163 # PCD_TYPE_SKU_ENABLED
164 # PCD_TYPE_STRING
165 # Datum Type : indicate PCD vaue type from following macro:
166 # PCD_DATUM_TYPE_POINTER
167 # PCD_DATUM_TYPE_UINT8
168 # PCD_DATUM_TYPE_UINT16
169 # PCD_DATUM_TYPE_UINT32
170 # PCD_DATUM_TYPE_UINT64
171 # Offset : indicate the related offset of PCD value in PCD database array.
172 # Based on local token number, PCD driver could fast determine PCD type, value
173 # type and get PCD entry from PCD database.
174 #
175 # 3.3 PCD Database C structure.
176 # PCD Database C structure is generated by build tools in PCD driver's autogen.h/
177 # autogen.c file. In generated C structure, following information is stored:
178 # - ExMapTable: This table is used translate a binary dynamicex type PCD's
179 # "tokenguid + token" to local token number.
180 # - LocalTokenNumberTable:
181 # This table stores all local token number in array, use "Internal
182 # token number" as array index to get PCD entry's offset fastly.
183 # - SizeTable: This table stores the size information for all PCD entry.
184 # - GuidTable: This table stores guid value for DynamicEx's token space,
185 # HII type PCD's variable.
186 # - SkuIdTable: TBD
187 # - SystemSkuId: TBD
188 # - PCD value structure:
189 # Every PCD has a value record in PCD database. For different
190 # datum type PCD has different record structure which will be
191 # introduced in 3.3.1
192 #
193 # In a PCD database structure, there are two major area: Init and UnInit.
194 # Init area is use stored above PCD internal structure such as ExMapTable,
195 # LocalTokenNumberTable etc and the (default) value of PCD which has default
196 # value specified in platform DSC file.
197 # Unint area is used stored the value of PCD which has no default value in
198 # platform DSC file, the value of NULL, 0 specified in platform DSC file can
199 # be seemed as "no default value".
200 #
201 # 3.3.1 Simple Sample PCD Database C Structure
202 # A general sample of PCD database structue is as follows:
203 # typedef struct _PCD_DATABASE {
204 # typedef struct _PCD_DATABASE_INIT {
205 # //===== Following is PCD database internal maintain structures
206 # DYNAMICEX_MAPPING ExMapTable[PEI_EXMAPPING_TABLE_SIZE];
207 # UINT32 LocalTokenNumberTable[PEI_LOCAL_TOKEN_NUMBER_TABLE_SIZE];
208 # GUID GuidTable[PEI_GUID_TABLE_SIZE];
209 # SIZE_INFO SizeTable[PEI_SIZE_TABLE_SIZE];
210 # UINT8 SkuIdTable[PEI_SKUID_TABLE_SIZE];
211 # SKU_ID SystemSkuId;
212 #
213 # //===== Following is value structure for PCD with default value
214 # ....
215 # ....
216 # ....
217 # } Init;
218 # typedef struct _PCD_DATABSE_UNINIT {
219 # //==== Following is value structure for PCD without default value
220 # ....
221 # ....
222 # } UnInit;
223 # }
224 #
225 # 3.3.2 PCD value structure in PCD database C structure
226 # The value's structure is generated by build tool in PCD database C structure.
227 # The PCDs in different datum type has different value structure.
228 #
229 # 3.3.2.1 UINT8/UINT16/UINT32/UINT64 datum type PCD
230 # The C structure for these datum type PCD is just a UINT8/UINT16/UINT32/UINT64
231 # data member in PCD database, For example:
232 # UINT16 PcdHardwareErrorRecordLevel_d3705011_bc19_4af7_be16_f68030378c15_VariableDefault_0;
233 # Above structure is generated by build tool, the member name is "PcdCName_Guidvalue"
234 # Member type is UINT16 according to PcdHardwareErrorRecordLevel declaration
235 # in DEC file.
236 #
237 # 3.3.2.2 VOID* datum type PCD
238 # The value of VOID* datum type PCD is a UINT8/UINT16 array in PCD database.
239 #
240 # 3.3.2.2.1 VOID* - string type
241 # If the default value for VOID* datum type PCD like L"xxx", the PCD is
242 # used for unicode string, and C structure of this datum type PCD is
243 # UINT16 string array in PCD database, for example:
244 # UINT16 StringTable[29];
245 # The number of 29 in above sample is max size of a unicode string.
246 #
247 # If the default value for VOID* datum type PCD like "xxx", the PCD is
248 # used for ascii string, and C structure of this datum type PCD is
249 # UINT8 string array in PCD database, for example:
250 # UINT8 StringTable[20];
251 # The number of 20 in above sample is max size of a ascii string.
252 #
253 # 3.3.2.2.2 VOID* - byte array
254 # If the default value of VOID* datum type PCD like {'0x29', '0x01', '0xf2'}
255 # the PCD is used for byte array. The generated structrue is same as
256 # above ascii string table,
257 # UINT8 StringTable[13];
258 # The number of 13 in above sample is max size of byte array.
259 #
260 # 3.3.3 Some utility structures in PCD Database
261 # 3.3.3.1 GuidTable
262 # GuidTable array is used to store all related GUID value in PCD database:
263 # - Variable GUID for HII type PCD
264 # - Token space GUID for dynamicex type PCD
265 #
266 # Copyright (c) 2006 - 2009, Intel Corporation
267 #
268 # All rights reserved. This program and the accompanying materials
269 # are licensed and made available under the terms and conditions of the BSD License
270 # which accompanies this distribution. The full text of the license may be found at
271 # http://opensource.org/licenses/bsd-license.php
272 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
273 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
274 #
275 #
276 #**/
277
278 [Defines]
279 INF_VERSION = 0x00010005
280 BASE_NAME = PcdPeim
281 FILE_GUID = 9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50
282 MODULE_TYPE = PEIM
283 VERSION_STRING = 1.0
284 PCD_IS_DRIVER = PEI_PCD_DRIVER
285 ENTRY_POINT = PcdPeimInit
286
287 #
288 # The following information is for reference only and not required by the build tools.
289 #
290 # VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
291 #
292
293 [Sources.common]
294 Service.c
295 Service.h
296 Pcd.c
297
298 [Packages]
299 MdePkg/MdePkg.dec
300 MdeModulePkg/MdeModulePkg.dec
301
302 [LibraryClasses]
303 BaseMemoryLib
304 PcdLib
305 PeiServicesLib
306 HobLib
307 BaseLib
308 PeimEntryPoint
309 DebugLib
310
311 [Guids]
312 gPcdDataBaseHobGuid ## PRODUCES ## Hob
313 gPcdDataBaseHobGuid ## CONSUMES ## Hob
314
315 [Ppis]
316 gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES
317 gPcdPpiGuid ## PRODUCES
318 gEfiPeiPcdPpiGuid ## PRODUCES
319
320 [FeaturePcd]
321 gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable
322
323 [FixedPcd]
324 gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress
325 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry || PcdPeiFullPcdDatabaseEnable
326
327 [Depex]
328 TRUE
329