• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Guid for Pcd DataBase Signature.
3 
4 Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT 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 
21 extern EFI_GUID gPcdDataBaseSignatureGuid;
22 
23 //
24 // Common definitions
25 //
26 typedef UINT64 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 
58 typedef 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 
64 typedef struct {
65   UINT32  SkuDataStartOffset;   // Offset(with DATUM TYPE info) from the PCD_DB.
66   UINT32  SkuIdTableOffset;     // Offset from the PCD_DB.
67 } SKU_HEAD;
68 
69 typedef 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   UINT32  Attributes;           // Variable attributes.
75   UINT16  Property;             // Variable property.
76   UINT16  Reserved;
77 } VARIABLE_HEAD;
78 
79 typedef struct {
80   UINT32  Offset;
81 } VPD_HEAD;
82 
83 typedef UINT32 STRING_HEAD;
84 
85 typedef UINT16 SIZE_INFO;
86 
87 typedef struct {
88   UINT32  TokenSpaceCNameIndex; // Offset in String Table in units of UINT8.
89   UINT32  PcdCNameIndex;        // Offset in String Table in units of UINT8.
90 } PCD_NAME_INDEX;
91 
92 typedef UINT32 TABLE_OFFSET;
93 
94 typedef struct {
95     GUID                  Signature;            // PcdDataBaseGuid.
96     UINT32                BuildVersion;
97     UINT32                Length;
98     SKU_ID                SystemSkuId;          // Current SkuId value.
99     UINT32                UninitDataBaseSize;   // Total size for PCD those default value with 0.
100     TABLE_OFFSET          LocalTokenNumberTableOffset;
101     TABLE_OFFSET          ExMapTableOffset;
102     TABLE_OFFSET          GuidTableOffset;
103     TABLE_OFFSET          StringTableOffset;
104     TABLE_OFFSET          SizeTableOffset;
105     TABLE_OFFSET          SkuIdTableOffset;
106     TABLE_OFFSET          PcdNameTableOffset;
107     UINT16                LocalTokenCount;      // LOCAL_TOKEN_NUMBER for all.
108     UINT16                ExTokenCount;         // EX_TOKEN_NUMBER for DynamicEx.
109     UINT16                GuidTableCount;       // The Number of Guid in GuidTable.
110     UINT8                 Pad[2];               // Pad bytes to satisfy the alignment.
111 
112     //
113     // Default initialized external PCD database binary structure
114     //
115     // Padding is needed to keep necessary alignment
116     //
117     //SKU_ID                         SkuIdTable[];            // SkuIds system supports.
118     //SKU_ID                         SkuIndexTable[];         // SkuIds for each PCD with SKU enable.
119     //UINT64                         ValueUint64[];
120     //UINT32                         ValueUint32[];
121     //VPD_HEAD                       VpdHead[];               // VPD Offset
122     //DYNAMICEX_MAPPING              ExMapTable[];            // DynamicEx PCD mapped to LocalIndex in LocalTokenNumberTable. It can be accessed by the ExMapTableOffset.
123     //UINT32                         LocalTokenNumberTable[]; // Offset | DataType | PCD Type. It can be accessed by LocalTokenNumberTableOffset.
124     //GUID                           GuidTable[];             // GUID for DynamicEx and HII PCD variable Guid. It can be accessed by the GuidTableOffset.
125     //STRING_HEAD                    StringHead[];            // String PCD
126     //PCD_NAME_INDEX                 PcdNameTable[];          // PCD name index info. It can be accessed by the PcdNameTableOffset.
127     //VARIABLE_HEAD                  VariableHead[];          // HII PCD
128     //SKU_HEAD                       SkuHead[];               // Store SKU info for each PCD with SKU enable.
129     //UINT8                          StringTable[];           // String for String PCD value and HII PCD Variable Name. It can be accessed by StringTableOffset.
130     //SIZE_INFO                      SizeTable[];             // MaxSize and CurSize for String PCD. It can be accessed by SizeTableOffset.
131     //UINT16                         ValueUint16[];
132     //UINT8                          ValueUint8[];
133     //BOOLEAN                        ValueBoolean[];
134 
135 } PCD_DATABASE_INIT;
136 
137 //
138 // PEI and DXE Pcd driver use the same PCD database
139 //
140 typedef PCD_DATABASE_INIT  PEI_PCD_DATABASE;
141 typedef PCD_DATABASE_INIT  DXE_PCD_DATABASE;
142 
143 
144 typedef struct {
145   PEI_PCD_DATABASE  *PeiDb;
146   DXE_PCD_DATABASE  *DxeDb;
147 } PCD_DATABASE;
148 
149 
150 #endif
151