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