16bfbb5f0e09c3fd70e0df5300dfed2e734c4a230lgao## @file 2419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# PCD DXE driver manage database contains all dynamic PCD entries and produce the implementation of PCD protocol. 36c74c5383a77e023030c343fd83d5b625e5b01d1klu# 4419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# This version PCD DXE depends on the external PCD database binary file, not built in PCD data base. 56c74c5383a77e023030c343fd83d5b625e5b01d1klu# There are two PCD Protocols as follows: 66c74c5383a77e023030c343fd83d5b625e5b01d1klu# 1) PCD_PROTOCOL 76c74c5383a77e023030c343fd83d5b625e5b01d1klu# It is EDKII implementation which support Dynamic/DynamicEx type Pcds. 8419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# 2) EFI_PCD_PROTOCOL 96c74c5383a77e023030c343fd83d5b625e5b01d1klu# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx 106c74c5383a77e023030c343fd83d5b625e5b01d1klu# type Pcd. 116c74c5383a77e023030c343fd83d5b625e5b01d1klu# 12419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# For dynamicEx type PCD, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL. 136c74c5383a77e023030c343fd83d5b625e5b01d1klu# PCD DXE driver will produce above two protocols at same time. 146c74c5383a77e023030c343fd83d5b625e5b01d1klu# 15419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# PCD database is generated as the separate binary image at build time. The binary image 16419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# will be intergrated into Firmware volume together with PCD driver. 1780408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 18b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# //////////////////////////////////////////////////////////////////////////////// 19b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# // // 20b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# // Introduction of PCD database // 21b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# // // 22b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# //////////////////////////////////////////////////////////////////////////////// 23b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 24b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 1, Introduction 25b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD database hold all dynamic type PCD information. The structure of PEI PCD 26b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# database is generated by build tools according to dynamic PCD usage for 27b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# specified platform. 28b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 29b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 2, Dynamic Type PCD 30b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Dynamic type PCD is used for the configuration/setting which value is determined 31b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# dynamic. In contrast, the value of static type PCD (FeatureFlag, FixedPcd, 32b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PatchablePcd) is fixed in final generated FD image in build time. 33b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 34b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 2.1 The "dynamic" determination means one of below cases: 35b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# a) The PCD setting value is produced by someone driver and consumed by 36b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# other driver in execution time. 37b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# b) The PCD setting value is set/get by user from FrontPage. 38b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# c) The PCD setting value is produced by platform OEM vendor in specified area. 39b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 40b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 2.2 According to module distribution way, dynamic PCD could be classfied as: 41b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# a) Dynamic: 42b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# If module is released in source code and will be built with platform 43b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DSC, the dynamic PCD used by this module can be accessed as: 44b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PcdGetxx(PcdSampleDynamicPcd); 45b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# In building platform, build tools will translate PcdSampleDynamicPcd to 46b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# pair of {Token Space Guid: Token Number} for this PCD. 47b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# b) DynamicEx: 48b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# If module is release as binary and will not pariticpate platform building, 49b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# the dynamic PCD used by this module need be accessed as: 50b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PcdGetxxEx(gEfiMyTokenspaceGuid, PcdSampleDynamicPcd) 51b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Developer need explicity gives {Token Space Guid:Token Number} as parameter 52b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# in writting source code. 53b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 54b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 2.3 According to PCD value's storage method, dynamic PCD could be classfied as: 55b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# a) Default Storage: 56b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - The PCD value is stored in PCD database maintained by PCD driver in boot 57b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# time memory. 58b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - This type is used for communication between PEIM/DXE driver, DXE/DXE 59b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# driver. But all set/get value will be losted after boot-time memory 60b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# is turn off. 61b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - [PcdsDynamicDefault] is used as section name for this type PCD in 62b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# platform DSC file. [PcdsDynamicExDefault] is used for dynamicEx type PCD. 63b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 64b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# b) Variable Storage: 65b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - The PCD value is stored in variable area. 66b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - As default storage type, this type PCD could be used for PEI/DXE driver 67419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# communication. But beside it, this type PCD could also be used to store 68b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# the value associate with a HII setting via variable interface. 69b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - In PEI phase, the PCD value could only be got but can not be set due 70b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# to variable area is readonly. 71b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - [PcdsDynamicHii] is used as section name for this type PCD in platform 72b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DSC file. [PcdsDynamicExHii] is for dynamicEx type PCD. 73b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 74b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# c) OEM specificed storage area: 75b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - The PCD value is stored in OEM specified area which base address is 76b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# specified by a FixedAtBuild PCD setting - PcdVpdBaseAddress. 77b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - The area is read only for PEI and DXE phase. 78b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - [PcdsDynamicVpd] is used as section name for this type PCD in platform 79b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DSC file. [PcdsDynamicExVpd] is for dynamicex type PCD. 80b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 81b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 2.4 When and how to use dynamic PCD 82b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Module developer do not care the used PCD is dynamic or static when writting 83b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# source code/INF. Dynamic PCD and dynamic type is pointed by platform integrator 84b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# in platform DSC file. Please ref section 2.3 to get matching between dynamic 85b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD type and section name in DSC file. 86b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 87b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3, PCD database: 88b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Although dynamic PCD could be in different storage type as above description, 89b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# but the basic information and default value for all dynamic PCD is hold 90b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# by PCD database maintained by PEI/DXE driver. 91b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 92b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# As the whole EFI BIOS boot path is divided into PEI/DXE phase, the PCD database 93b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# also is divided into Pei/Dxe database maintaied by PcdPeim/PcdDxe driver separatly. 94b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# To make PcdPeim's driver image smaller, PEI PCD database only hold all dynamic 95b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD information used in PEI phase or use in both PEI/DXE phase. And DXE PCD 96b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# database contains all PCDs used in PEI/DXE phase in memory. 97b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 98419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# Build tool will generate PCD database into the separate binary file for 99b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PEI/DXE PCD driver according to dynamic PCD section in platform DSC file. 100b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 101b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.1 PcdPeim and PcdDxe 102b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PEI PCD database is maintained by PcdPeim driver run from flash. PcdPeim driver 103419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# build guid hob in temporary memory and copy the binary data base from flash 104b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# to temporary memory for PEI PCD database. 105b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DXE PCD database is maintained by PcdDxe driver.At entry point of PcdDxe driver, 106b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# a new PCD database is allocated in boot-time memory which including all 107b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PEI PCD and DXE PCD entry. 108b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 109b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Pcd driver should run as early as possible before any other driver access 110b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# dynamic PCD's value. PEI/DXE "Apriori File" mechanism make it possible by 111b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# making PcdPeim/PcdDxe as first dispatching driver in PEI/DXE phase. 112b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 113b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.2 Token space Guid/Token number, Platform token, Local token number 114b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Dynamic PCD 115b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# +-----------+ +---------+ 116b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# |TokenSpace | |Platform | 117b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Guid | build tool | Token | 118b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | + +-------------->| Number | 119b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Token | +---------+`._ 120b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Number | `. 121b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# +-----------+ `. +------+ 122b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# `-|Local | 123b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# |Token | 124b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DynamicEx PCD ,-|Number| 125b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# +-----------+ ,-' +------+ 126b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# |TokenSpace | ,-' 127b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Guid | _,-' 128b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | + +.' 129b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Token | 130b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Number | 131b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# +-----------+ 132b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 133b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 134b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.2.1 Pair of Token space guid + Token number 135b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Any type PCD is identified by pair of "TokenSpaceGuid + TokeNumber". But it 136b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# is not easy maintained by PCD driver, and hashed token number will make 137b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# searching slowly. 138b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 139b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.2.2 Platform Token Number 140b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# "Platform token number" concept is introduced for mapping to a pair of 141b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# "TokenSpaceGuid + TokenNumber". The platform token number is generated by 142b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# build tool in autogen.h and all of them are continual in a platform scope 143b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# started from 1.(0 meaning invalid internal token number) 144b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# With auto-generated "platform token number", PcdGet(PcdSampleDynamicPcd) 145b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# in source code is translated to LibPcdGet(_PCD_TOKEN_PcdSampleDynamicPcd) 146b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# in autogen.h. 147b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Notes: The mapping between pair of "tokenspace guid + token number" and 148b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# "internal token number" need build tool establish, so "platform token number" 149b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# mechanism is not suitable for binary module which use DynamicEx type PCD. 150b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# To access a dynamicEx type PCD, pair of "token space guid/token number" all need 151b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# to be specificed for PcdSet/PcdGet accessing macro. 152b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 153b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Platform Token Number is started from 1, and inceased continuous. From whole 154b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# platform scope, there are two zones: PEI Zone and DXE Zone 155b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | Platform Token Number 156b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# ----------|---------------------------------------------------------------- 157b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PEI Zone: | 1 ~ PEI_LOCAL_TOKEN_NUMBER 158b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DXE Zone: | (PEI_LOCAL_TOKEN_NUMBER + 1) ~ (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER) 159b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 160b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.2.3 Local Token Number 161b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# To fast searching a PCD entry in PCD database, PCD driver translate 162b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# platform token number to local token number via a mapping table. 163b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# For binary DynamicEx type PCD, there is a another mapping table to translate 164b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# "token space guid + token number" to local token number directly. 165b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Local token number is identifier for all internal interface in PCD PEI/DXE 166b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# driver. 167b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 168b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# A local token number is a 32-bit value in following meaning: 169b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 32 ------------- 28 ---------- 24 -------- 0 170b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# | PCD type mask | Datum Type | Offset | 171b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# +-----------------------------------------+ 172b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# where: 173b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCd type mask: indicate Pcd type from following macro: 174b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_TYPE_DATA 175b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_TYPE_HII 176b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_TYPE_VPD 177b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_TYPE_SKU_ENABLED 178b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_TYPE_STRING 179b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Datum Type : indicate PCD vaue type from following macro: 180b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_DATUM_TYPE_POINTER 181b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_DATUM_TYPE_UINT8 182b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_DATUM_TYPE_UINT16 183b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_DATUM_TYPE_UINT32 184b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# PCD_DATUM_TYPE_UINT64 185b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Offset : indicate the related offset of PCD value in PCD database array. 186b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Based on local token number, PCD driver could fast determine PCD type, value 187b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# type and get PCD entry from PCD database. 188b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 189419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# 3.3 PCD Database binary file 190419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# PCD Database binary file will be created at build time as the standalone binary image. 191419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# To understand the binary image layout, PCD Database C structure is still generated 192419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# as comments by build tools in PCD driver's autogen.h/ 193b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# autogen.c file. In generated C structure, following information is stored: 194b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - ExMapTable: This table is used translate a binary dynamicex type PCD's 195b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# "tokenguid + token" to local token number. 196b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - LocalTokenNumberTable: 197b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# This table stores all local token number in array, use "Internal 198b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# token number" as array index to get PCD entry's offset fastly. 199b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - SizeTable: This table stores the size information for all PCD entry. 200b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - GuidTable: This table stores guid value for DynamicEx's token space, 201419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# HII type PCD's variable GUID. 202b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - SkuIdTable: TBD 203b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - SystemSkuId: TBD 204b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - PCD value structure: 205b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Every PCD has a value record in PCD database. For different 206b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# datum type PCD has different record structure which will be 207b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# introduced in 3.3.1 208b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 209b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# In a PCD database structure, there are two major area: Init and UnInit. 210b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Init area is use stored above PCD internal structure such as ExMapTable, 211b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# LocalTokenNumberTable etc and the (default) value of PCD which has default 212b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# value specified in platform DSC file. 213b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Unint area is used stored the value of PCD which has no default value in 214b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# platform DSC file, the value of NULL, 0 specified in platform DSC file can 215b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# be seemed as "no default value". 216b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 217b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.1 Simple Sample PCD Database C Structure 218b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# A general sample of PCD database structue is as follows: 219b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# typedef struct _PCD_DATABASE { 220b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# typedef struct _PCD_DATABASE_INIT { 221b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# //===== Following is PCD database internal maintain structures 222b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# DYNAMICEX_MAPPING ExMapTable[PEI_EXMAPPING_TABLE_SIZE]; 223b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT32 LocalTokenNumberTable[PEI_LOCAL_TOKEN_NUMBER_TABLE_SIZE]; 224b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# GUID GuidTable[PEI_GUID_TABLE_SIZE]; 225b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# SIZE_INFO SizeTable[PEI_SIZE_TABLE_SIZE]; 226b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT8 SkuIdTable[PEI_SKUID_TABLE_SIZE]; 227b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# SKU_ID SystemSkuId; 228b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 229b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# //===== Following is value structure for PCD with default value 230b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# .... 231b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# .... 232b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# .... 233b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# } Init; 234b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# typedef struct _PCD_DATABSE_UNINIT { 235b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# //==== Following is value structure for PCD without default value 236b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# .... 237b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# .... 238b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# } UnInit; 239b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# } 240b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 241b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.2 PCD value structure in PCD database C structure 242b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The value's structure is generated by build tool in PCD database C structure. 243b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The PCDs in different datum type has different value structure. 244b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 245b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.2.1 UINT8/UINT16/UINT32/UINT64 datum type PCD 246b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The C structure for these datum type PCD is just a UINT8/UINT16/UINT32/UINT64 247b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# data member in PCD database, For example: 248b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT16 PcdHardwareErrorRecordLevel_d3705011_bc19_4af7_be16_f68030378c15_VariableDefault_0; 249b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Above structure is generated by build tool, the member name is "PcdCName_Guidvalue" 250b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# Member type is UINT16 according to PcdHardwareErrorRecordLevel declaration 251b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# in DEC file. 252b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 253b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.2.2 VOID* datum type PCD 254b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The value of VOID* datum type PCD is a UINT8/UINT16 array in PCD database. 255b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 256b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.2.2.1 VOID* - string type 257b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# If the default value for VOID* datum type PCD like L"xxx", the PCD is 258b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# used for unicode string, and C structure of this datum type PCD is 259b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT16 string array in PCD database, for example: 260b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT16 StringTable[29]; 261b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The number of 29 in above sample is max size of a unicode string. 262b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 263b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# If the default value for VOID* datum type PCD like "xxx", the PCD is 264b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# used for ascii string, and C structure of this datum type PCD is 265b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT8 string array in PCD database, for example: 266b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT8 StringTable[20]; 267b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The number of 20 in above sample is max size of a ascii string. 268b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 269b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.2.2.2 VOID* - byte array 270b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# If the default value of VOID* datum type PCD like {'0x29', '0x01', '0xf2'} 271b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# the PCD is used for byte array. The generated structrue is same as 272b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# above ascii string table, 273b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# UINT8 StringTable[13]; 274b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# The number of 13 in above sample is max size of byte array. 275b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 276b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.3 Some utility structures in PCD Database 277b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# 3.3.3.1 GuidTable 278b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# GuidTable array is used to store all related GUID value in PCD database: 279b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - Variable GUID for HII type PCD 280b6b3dc4410d0abbda01c76674b18f9c19e8edd9dklu# - Token space GUID for dynamicex type PCD 281419db80bef66edff583a0a5f406e801d70f11344Bob C Feng# 28223f3e119c7b154f6c9386588b5b74c6037a1251cStar Zeng# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> 28380408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 284e5eed7d3641d71d7ea539e5379ea9c6a5cd97004hhtian# This program and the accompanying materials 28580408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# are licensed and made available under the terms and conditions of the BSD License 28680408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# which accompanies this distribution. The full text of the license may be found at 28780408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# http://opensource.org/licenses/bsd-license.php 28880408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 28980408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 29080408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 29180408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 2926bfbb5f0e09c3fd70e0df5300dfed2e734c4a230lgao## 29380408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 29480408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff[Defines] 29580408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff INF_VERSION = 0x00010005 29680408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff BASE_NAME = PcdDxe 2976036e94dc9402827130875258e99e486e82e7904Zeng, Star MODULE_UNI_FILE = PcdDxe.uni 29880408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff FILE_GUID = 80CF7257-87AB-47f9-A3FE-D50B76D89541 29980408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff MODULE_TYPE = DXE_DRIVER 300419db80bef66edff583a0a5f406e801d70f11344Bob C Feng VERSION_STRING = 4.0 301be82f9ff2bd9251b2092f86debc13983621562b0jwang PCD_IS_DRIVER = DXE_PCD_DRIVER 30280408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff ENTRY_POINT = PcdDxeInit 30380408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 30480408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 30580408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# The following information is for reference only and not required by the build tools. 30680408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 30780408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# VALID_ARCHITECTURES = IA32 X64 IPF EBC 30880408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff# 30980408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 310188e4e8444bdc69e2f6c65e90c35956eb01cd4b3mdkinney[Sources] 31180408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff Pcd.c 31280408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff Service.c 31380408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff Service.h 31480408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 31580408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff[Packages] 31680408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff MdePkg/MdePkg.dec 317e75fe0ebba8a3f9f658ba362707f820896f0fdc2jwang MdeModulePkg/MdeModulePkg.dec 31880408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 31980408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff[LibraryClasses] 32080408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff UefiRuntimeServicesTableLib 32180408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff BaseMemoryLib 32280408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff UefiBootServicesTableLib 32380408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff MemoryAllocationLib 32480408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff HobLib 32580408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff UefiDriverEntryPoint 32680408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff UefiLib 32780408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff DebugLib 32880408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff BaseLib 329cba9012a92bf97754d09acafb572fb9990f1b636klu PcdLib 330419db80bef66edff583a0a5f406e801d70f11344Bob C Feng DxeServicesLib 33180408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 33280408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff[Guids] 333419db80bef66edff583a0a5f406e801d70f11344Bob C Feng gPcdDataBaseHobGuid ## SOMETIMES_CONSUMES ## HOB 3346036e94dc9402827130875258e99e486e82e7904Zeng, Star gPcdDataBaseSignatureGuid ## CONSUMES ## GUID # PCD database signature GUID. 33580408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 33680408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff[Protocols] 337b99828832108937c999f72f6a0b78cd791df5cc9lgao gPcdProtocolGuid ## PRODUCES 338c896d682576a9159a58b1d8e3840019d0c835593klu gEfiPcdProtocolGuid ## PRODUCES 33996d6d004aaf9da42c5fd9cd07035886937d42a69Star Zeng gGetPcdInfoProtocolGuid ## SOMETIMES_PRODUCES 34096d6d004aaf9da42c5fd9cd07035886937d42a69Star Zeng gEfiGetPcdInfoProtocolGuid ## SOMETIMES_PRODUCES 34123f3e119c7b154f6c9386588b5b74c6037a1251cStar Zeng ## NOTIFY 34223f3e119c7b154f6c9386588b5b74c6037a1251cStar Zeng ## SOMETIMES_CONSUMES 34323f3e119c7b154f6c9386588b5b74c6037a1251cStar Zeng gEdkiiVariableLockProtocolGuid 34496d6d004aaf9da42c5fd9cd07035886937d42a69Star Zeng 345188e4e8444bdc69e2f6c65e90c35956eb01cd4b3mdkinney[Pcd] 346419db80bef66edff583a0a5f406e801d70f11344Bob C Feng gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress ## SOMETIMES_CONSUMES 34780408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 34880408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff[Depex] 34980408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff TRUE 35080408db0ca4e3d40b37c0f3a710ad4828e26f5f4vanjeff 3516036e94dc9402827130875258e99e486e82e7904Zeng, Star[UserExtensions.TianoCore."ExtraFiles"] 3526036e94dc9402827130875258e99e486e82e7904Zeng, Star PcdDxeExtra.uni 353