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