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