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