blob: 22c0d95f606a9b09eee028cc3642af310bb9e15a [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2 Guid for Pcd DataBase Signature.
3
4Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials are licensed and made available under
6the terms and conditions of the BSD License that accompanies this distribution.
7The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php.
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#ifndef _PCD_DATABASE_SIGNATURE_GUID_H_
16#define _PCD_DATABASE_SIGNATURE_GUID_H_
17
18#define PCD_DATA_BASE_SIGNATURE_GUID \
19{ 0x3c7d193c, 0x682c, 0x4c14, { 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e } }
20
21extern EFI_GUID gPcdDataBaseSignatureGuid;
22
23//
24// Common definitions
25//
26typedef UINT8 SKU_ID;
27
28#define PCD_TYPE_SHIFT 28
29
30#define PCD_TYPE_DATA (0x0U << PCD_TYPE_SHIFT)
31#define PCD_TYPE_HII (0x8U << PCD_TYPE_SHIFT)
32#define PCD_TYPE_VPD (0x4U << PCD_TYPE_SHIFT)
33#define PCD_TYPE_SKU_ENABLED (0x2U << PCD_TYPE_SHIFT)
34#define PCD_TYPE_STRING (0x1U << PCD_TYPE_SHIFT)
35
36#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)
37
38#define PCD_DATUM_TYPE_SHIFT 24
39
40#define PCD_DATUM_TYPE_POINTER (0x0U << PCD_DATUM_TYPE_SHIFT)
41#define PCD_DATUM_TYPE_UINT8 (0x1U << PCD_DATUM_TYPE_SHIFT)
42#define PCD_DATUM_TYPE_UINT16 (0x2U << PCD_DATUM_TYPE_SHIFT)
43#define PCD_DATUM_TYPE_UINT32 (0x4U << PCD_DATUM_TYPE_SHIFT)
44#define PCD_DATUM_TYPE_UINT64 (0x8U << PCD_DATUM_TYPE_SHIFT)
45
46#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \
47 PCD_DATUM_TYPE_UINT8 | \
48 PCD_DATUM_TYPE_UINT16 | \
49 PCD_DATUM_TYPE_UINT32 | \
50 PCD_DATUM_TYPE_UINT64)
51
52#define PCD_DATUM_TYPE_SHIFT2 20
53
54#define PCD_DATUM_TYPE_UINT8_BOOLEAN (0x1U << PCD_DATUM_TYPE_SHIFT2)
55
56#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET | PCD_DATUM_TYPE_UINT8_BOOLEAN))
57
58typedef struct {
59 UINT32 ExTokenNumber;
60 UINT16 TokenNumber; // Token Number for Dynamic-Ex PCD.
61 UINT16 ExGuidIndex; // Index of GuidTable in units of GUID.
62} DYNAMICEX_MAPPING;
63
64typedef struct {
65 UINT32 SkuDataStartOffset; // Offset(with TYPE info) from the PCD_DB.
66 UINT32 SkuIdTableOffset; // Offset from the PCD_DB.
67} SKU_HEAD;
68
69typedef struct {
70 UINT32 StringIndex; // Offset in String Table in units of UINT8.
71 UINT32 DefaultValueOffset; // Offset of the Default Value.
72 UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
73 UINT16 Offset; // Offset in Variable.
74} VARIABLE_HEAD;
75
76typedef struct {
77 UINT32 Offset;
78} VPD_HEAD;
79
80typedef UINT32 STRING_HEAD;
81
82typedef UINT16 SIZE_INFO;
83
84typedef struct {
85 UINT32 TokenSpaceCNameIndex; // Offset in String Table in units of UINT8.
86 UINT32 PcdCNameIndex; // Offset in String Table in units of UINT8.
87} PCD_NAME_INDEX;
88
89typedef UINT32 TABLE_OFFSET;
90
91typedef struct {
92 GUID Signature; // PcdDataBaseGuid.
93 UINT32 BuildVersion;
94 UINT32 Length;
95 UINT32 UninitDataBaseSize; // Total size for PCD those default value with 0.
96 TABLE_OFFSET LocalTokenNumberTableOffset;
97 TABLE_OFFSET ExMapTableOffset;
98 TABLE_OFFSET GuidTableOffset;
99 TABLE_OFFSET StringTableOffset;
100 TABLE_OFFSET SizeTableOffset;
101 TABLE_OFFSET SkuIdTableOffset;
102 TABLE_OFFSET PcdNameTableOffset;
103 UINT16 LocalTokenCount; // LOCAL_TOKEN_NUMBER for all.
104 UINT16 ExTokenCount; // EX_TOKEN_NUMBER for DynamicEx.
105 UINT16 GuidTableCount; // The Number of Guid in GuidTable.
106 SKU_ID SystemSkuId; // Current SkuId value.
107 UINT8 Pad; // Pad bytes to satisfy the alignment.
108
109 //
110 // Default initialized external PCD database binary structure
111 //
112 // Padding is needed to keep necessary alignment
113 //
114 //UINT64 ValueUint64[];
115 //UINT32 ValueUint32[];
116 //VPD_HEAD VpdHead[]; // VPD Offset
117 //DYNAMICEX_MAPPING ExMapTable[]; // DynamicEx PCD mapped to LocalIndex in LocalTokenNumberTable. It can be accessed by the ExMapTableOffset.
118 //UINT32 LocalTokenNumberTable[]; // Offset | DataType | PCD Type. It can be accessed by LocalTokenNumberTableOffset.
119 //GUID GuidTable[]; // GUID for DynamicEx and HII PCD variable Guid. It can be accessed by the GuidTableOffset.
120 //STRING_HEAD StringHead[]; // String PCD
121 //PCD_NAME_INDEX PcdNameTable[]; // PCD name index info. It can be accessed by the PcdNameTableOffset.
122 //VARIABLE_HEAD VariableHead[]; // HII PCD
123 //SKU_HEAD SkuHead[]; // Store SKU info for each PCD with SKU enable.
124 //UINT8 StringTable[]; // String for String PCD value and HII PCD Variable Name. It can be accessed by StringTableOffset.
125 //SIZE_INFO SizeTable[]; // MaxSize and CurSize for String PCD. It can be accessed by SizeTableOffset.
126 //UINT16 ValueUint16[];
127 //UINT8 ValueUint8[];
128 //BOOLEAN ValueBoolean[];
129 //UINT8 SkuIdTable[]; // SkuIds system supports.
130 //UINT8 SkuIndexTable[]; // SkuIds for each PCD with SKU enable.
131
132} PCD_DATABASE_INIT;
133
134//
135// PEI and DXE Pcd driver use the same PCD database
136//
137typedef PCD_DATABASE_INIT PEI_PCD_DATABASE;
138typedef PCD_DATABASE_INIT DXE_PCD_DATABASE;
139
140
141typedef struct {
142 PEI_PCD_DATABASE *PeiDb;
143 DXE_PCD_DATABASE *DxeDb;
144} PCD_DATABASE;
145
146
147#endif