]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
MdePkg/IndustryStandard: Introduce a correctly spelled macro
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / UefiTcgPlatform.h
CommitLineData
c311f86b 1/** @file\r
267669ba
LG
2 TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final\r
3\r
9095d37b 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9df063a0 5 This program and the accompanying materials\r
267669ba
LG
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __UEFI_TCG_PLATFORM_H__\r
22a25d24 16#define __UEFI_TCG_PLATFORM_H__\r
267669ba
LG
17\r
18#include <IndustryStandard/Tpm12.h>\r
59b226d6 19#include <IndustryStandard/Tpm20.h>\r
a979fca9 20#include <Uefi.h>\r
1fd83dd2 21\r
267669ba
LG
22//\r
23// Standard event types\r
24//\r
4187f79c 25#define EV_PREBOOT_CERT ((TCG_EVENTTYPE) 0x00000000)\r
267669ba 26#define EV_POST_CODE ((TCG_EVENTTYPE) 0x00000001)\r
59b226d6 27#define EV_NO_ACTION ((TCG_EVENTTYPE) 0x00000003)\r
267669ba 28#define EV_SEPARATOR ((TCG_EVENTTYPE) 0x00000004)\r
4187f79c 29#define EV_ACTION ((TCG_EVENTTYPE) 0x00000005)\r
267669ba
LG
30#define EV_S_CRTM_CONTENTS ((TCG_EVENTTYPE) 0x00000007)\r
31#define EV_S_CRTM_VERSION ((TCG_EVENTTYPE) 0x00000008)\r
04a89420 32#define EV_CPU_MICROCODE ((TCG_EVENTTYPE) 0x00000009)\r
4187f79c 33#define EV_PLATFORM_CONFIG_FLAGS ((TCG_EVENTTYPE) 0x0000000A)\r
f5a859d6 34#define EV_TABLE_OF_DEVICES ((TCG_EVENTTYPE) 0x0000000B)\r
4187f79c
ZC
35#define EV_COMPACT_HASH ((TCG_EVENTTYPE) 0x0000000C)\r
36#define EV_NONHOST_CODE ((TCG_EVENTTYPE) 0x0000000F)\r
37#define EV_NONHOST_CONFIG ((TCG_EVENTTYPE) 0x00000010)\r
38#define EV_NONHOST_INFO ((TCG_EVENTTYPE) 0x00000011)\r
39#define EV_OMIT_BOOT_DEVICE_EVENTS ((TCG_EVENTTYPE) 0x00000012)\r
267669ba
LG
40\r
41//\r
42// EFI specific event types\r
43//\r
44#define EV_EFI_EVENT_BASE ((TCG_EVENTTYPE) 0x80000000)\r
45#define EV_EFI_VARIABLE_DRIVER_CONFIG (EV_EFI_EVENT_BASE + 1)\r
46#define EV_EFI_VARIABLE_BOOT (EV_EFI_EVENT_BASE + 2)\r
47#define EV_EFI_BOOT_SERVICES_APPLICATION (EV_EFI_EVENT_BASE + 3)\r
48#define EV_EFI_BOOT_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 4)\r
49#define EV_EFI_RUNTIME_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 5)\r
50#define EV_EFI_GPT_EVENT (EV_EFI_EVENT_BASE + 6)\r
51#define EV_EFI_ACTION (EV_EFI_EVENT_BASE + 7)\r
52#define EV_EFI_PLATFORM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 8)\r
53#define EV_EFI_HANDOFF_TABLES (EV_EFI_EVENT_BASE + 9)\r
4187f79c 54#define EV_EFI_HCRTM_EVENT (EV_EFI_EVENT_BASE + 0x10)\r
59b226d6 55#define EV_EFI_VARIABLE_AUTHORITY (EV_EFI_EVENT_BASE + 0xE0)\r
267669ba 56\r
267669ba
LG
57#define EFI_CALLING_EFI_APPLICATION \\r
58 "Calling EFI Application from Boot Option"\r
59#define EFI_RETURNING_FROM_EFI_APPLICATOIN \\r
60 "Returning from EFI Application from Boot Option"\r
341d442c
BB
61#define EFI_RETURNING_FROM_EFI_APPLICATION \\r
62 "Returning from EFI Application from Boot Option"\r
267669ba
LG
63#define EFI_EXIT_BOOT_SERVICES_INVOCATION \\r
64 "Exit Boot Services Invocation"\r
65#define EFI_EXIT_BOOT_SERVICES_FAILED \\r
66 "Exit Boot Services Returned with Failure"\r
67#define EFI_EXIT_BOOT_SERVICES_SUCCEEDED \\r
68 "Exit Boot Services Returned with Success"\r
69\r
2096185d 70\r
71#define EV_POSTCODE_INFO_POST_CODE "POST CODE"\r
72#define POST_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)\r
73\r
74#define EV_POSTCODE_INFO_SMM_CODE "SMM CODE"\r
75#define SMM_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)\r
76\r
77#define EV_POSTCODE_INFO_ACPI_DATA "ACPI DATA"\r
78#define ACPI_DATA_LEN (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)\r
79\r
80#define EV_POSTCODE_INFO_BIS_CODE "BIS CODE"\r
81#define BIS_CODE_LEN (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)\r
82\r
83#define EV_POSTCODE_INFO_UEFI_PI "UEFI PI"\r
84#define UEFI_PI_LEN (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)\r
85\r
86#define EV_POSTCODE_INFO_OPROM "Embedded Option ROM"\r
87#define OPROM_LEN (sizeof(EV_POSTCODE_INFO_OPROM) - 1)\r
88\r
59b226d6
JY
89#define FIRMWARE_DEBUGGER_EVENT_STRING "UEFI Debug Mode"\r
90#define FIRMWARE_DEBUGGER_EVENT_STRING_LEN (sizeof(FIRMWARE_DEBUGGER_EVENT_STRING) - 1)\r
91\r
267669ba
LG
92//\r
93// Set structure alignment to 1-byte\r
94//\r
a04ad3f0 95#pragma pack (1)\r
267669ba
LG
96\r
97typedef UINT32 TCG_EVENTTYPE;\r
992f22b9
LG
98typedef TPM_PCRINDEX TCG_PCRINDEX;\r
99typedef TPM_DIGEST TCG_DIGEST;\r
fb5148a0 100///\r
3ed785e9 101/// Event Log Entry Structure Definition\r
fb5148a0 102///\r
267669ba 103typedef struct tdTCG_PCR_EVENT {\r
3ed785e9 104 TCG_PCRINDEX PCRIndex; ///< PCRIndex event extended to\r
105 TCG_EVENTTYPE EventType; ///< TCG EFI event type\r
106 TCG_DIGEST Digest; ///< Value extended into PCRIndex\r
107 UINT32 EventSize; ///< Size of the event data\r
108 UINT8 Event[1]; ///< The event data\r
267669ba
LG
109} TCG_PCR_EVENT;\r
110\r
3ed785e9 111#define TSS_EVENT_DATA_MAX_SIZE 256\r
112\r
fb5148a0 113///\r
114/// TCG_PCR_EVENT_HDR\r
115///\r
267669ba
LG
116typedef struct tdTCG_PCR_EVENT_HDR {\r
117 TCG_PCRINDEX PCRIndex;\r
118 TCG_EVENTTYPE EventType;\r
119 TCG_DIGEST Digest;\r
120 UINT32 EventSize;\r
121} TCG_PCR_EVENT_HDR;\r
122\r
fb5148a0 123///\r
124/// EFI_PLATFORM_FIRMWARE_BLOB\r
125///\r
126/// BlobLength should be of type UINTN but we use UINT64 here\r
127/// because PEI is 32-bit while DXE is 64-bit on x64 platforms\r
128///\r
267669ba
LG
129typedef struct tdEFI_PLATFORM_FIRMWARE_BLOB {\r
130 EFI_PHYSICAL_ADDRESS BlobBase;\r
131 UINT64 BlobLength;\r
132} EFI_PLATFORM_FIRMWARE_BLOB;\r
133\r
fb5148a0 134///\r
135/// EFI_IMAGE_LOAD_EVENT\r
136///\r
137/// This structure is used in EV_EFI_BOOT_SERVICES_APPLICATION,\r
138/// EV_EFI_BOOT_SERVICES_DRIVER and EV_EFI_RUNTIME_SERVICES_DRIVER\r
139///\r
267669ba
LG
140typedef struct tdEFI_IMAGE_LOAD_EVENT {\r
141 EFI_PHYSICAL_ADDRESS ImageLocationInMemory;\r
142 UINTN ImageLengthInMemory;\r
143 UINTN ImageLinkTimeAddress;\r
144 UINTN LengthOfDevicePath;\r
145 EFI_DEVICE_PATH_PROTOCOL DevicePath[1];\r
146} EFI_IMAGE_LOAD_EVENT;\r
147\r
fb5148a0 148///\r
149/// EFI_HANDOFF_TABLE_POINTERS\r
150///\r
151/// This structure is used in EV_EFI_HANDOFF_TABLES event to facilitate\r
152/// the measurement of given configuration tables.\r
153///\r
267669ba 154typedef struct tdEFI_HANDOFF_TABLE_POINTERS {\r
3ed785e9 155 UINTN NumberOfTables;\r
267669ba
LG
156 EFI_CONFIGURATION_TABLE TableEntry[1];\r
157} EFI_HANDOFF_TABLE_POINTERS;\r
158\r
fb5148a0 159///\r
160/// EFI_VARIABLE_DATA\r
161///\r
162/// This structure serves as the header for measuring variables. The name of the\r
163/// variable (in Unicode format) should immediately follow, then the variable\r
164/// data.\r
49945882 165/// This is defined in TCG EFI Platform Spec for TPM1.1 or 1.2 V1.22\r
fb5148a0 166///\r
267669ba
LG
167typedef struct tdEFI_VARIABLE_DATA {\r
168 EFI_GUID VariableName;\r
169 UINTN UnicodeNameLength;\r
170 UINTN VariableDataLength;\r
171 CHAR16 UnicodeName[1];\r
3ed785e9 172 INT8 VariableData[1]; ///< Driver or platform-specific data\r
267669ba
LG
173} EFI_VARIABLE_DATA;\r
174\r
49945882
ZC
175///\r
176/// UEFI_VARIABLE_DATA\r
177///\r
178/// This structure serves as the header for measuring variables. The name of the\r
179/// variable (in Unicode format) should immediately follow, then the variable\r
180/// data.\r
181/// This is defined in TCG PC Client Firmware Profile Spec 00.21\r
182///\r
183typedef struct tdUEFI_VARIABLE_DATA {\r
184 EFI_GUID VariableName;\r
185 UINT64 UnicodeNameLength;\r
186 UINT64 VariableDataLength;\r
187 CHAR16 UnicodeName[1];\r
188 INT8 VariableData[1]; ///< Driver or platform-specific data\r
189} UEFI_VARIABLE_DATA;\r
190\r
59b226d6
JY
191//\r
192// For TrEE1.0 compatibility\r
193//\r
194typedef struct {\r
195 EFI_GUID VariableName;\r
196 UINT64 UnicodeNameLength; // The TCG Definition used UINTN\r
197 UINT64 VariableDataLength; // The TCG Definition used UINTN\r
198 CHAR16 UnicodeName[1];\r
199 INT8 VariableData[1];\r
200} EFI_VARIABLE_DATA_TREE;\r
201\r
267669ba
LG
202typedef struct tdEFI_GPT_DATA {\r
203 EFI_PARTITION_TABLE_HEADER EfiPartitionHeader;\r
9095d37b 204 UINTN NumberOfPartitions;\r
267669ba
LG
205 EFI_PARTITION_ENTRY Partitions[1];\r
206} EFI_GPT_DATA;\r
207\r
59b226d6
JY
208//\r
209// Crypto Agile Log Entry Format\r
210//\r
211typedef struct tdTCG_PCR_EVENT2 {\r
212 TCG_PCRINDEX PCRIndex;\r
213 TCG_EVENTTYPE EventType;\r
214 TPML_DIGEST_VALUES Digest;\r
215 UINT32 EventSize;\r
216 UINT8 Event[1];\r
217} TCG_PCR_EVENT2;\r
218\r
c5647c6c
ZC
219//\r
220// TCG PCR Event2 Header\r
221// Follow TCG EFI Protocol Spec 5.2 Crypto Agile Log Entry Format\r
222//\r
223typedef struct tdTCG_PCR_EVENT2_HDR{\r
224 TCG_PCRINDEX PCRIndex;\r
225 TCG_EVENTTYPE EventType;\r
226 TPML_DIGEST_VALUES Digests;\r
227 UINT32 EventSize;\r
228} TCG_PCR_EVENT2_HDR;\r
229\r
59b226d6
JY
230//\r
231// Log Header Entry Data\r
232//\r
233typedef struct {\r
234 //\r
235 // TCG defined hashing algorithm ID.\r
236 //\r
237 UINT16 algorithmId;\r
238 //\r
239 // The size of the digest for the respective hashing algorithm.\r
240 //\r
241 UINT16 digestSize;\r
242} TCG_EfiSpecIdEventAlgorithmSize;\r
243\r
244#define TCG_EfiSpecIDEventStruct_SIGNATURE_02 "Spec ID Event02"\r
245#define TCG_EfiSpecIDEventStruct_SIGNATURE_03 "Spec ID Event03"\r
246\r
247#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM12 1\r
248#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM12 2\r
249#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM12 2\r
250\r
251#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2 2\r
252#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2 0\r
253#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2 0\r
254\r
255typedef struct {\r
256 UINT8 signature[16];\r
257 //\r
258 // The value for the Platform Class.\r
259 // The enumeration is defined in the TCG ACPI Specification Client Common Header.\r
260 //\r
261 UINT32 platformClass;\r
262 //\r
263 // The TCG EFI Platform Specification minor version number this BIOS supports.\r
264 // Any BIOS supporting version (1.22) MUST set this value to 02h.\r
265 // Any BIOS supporting version (2.0) SHALL set this value to 0x00.\r
266 //\r
267 UINT8 specVersionMinor;\r
268 //\r
269 // The TCG EFI Platform Specification major version number this BIOS supports.\r
270 // Any BIOS supporting version (1.22) MUST set this value to 01h.\r
271 // Any BIOS supporting version (2.0) SHALL set this value to 0x02.\r
272 //\r
273 UINT8 specVersionMajor;\r
274 //\r
275 // The TCG EFI Platform Specification errata for this specification this BIOS supports.\r
276 // Any BIOS supporting version and errata (1.22) MUST set this value to 02h.\r
277 // Any BIOS supporting version and errata (2.0) SHALL set this value to 0x00.\r
278 //\r
279 UINT8 specErrata;\r
280 //\r
281 // Specifies the size of the UINTN fields used in various data structures used in this specification.\r
282 // 0x01 indicates UINT32 and 0x02 indicates UINT64.\r
283 //\r
284 UINT8 uintnSize;\r
285 //\r
286 // This field is added in "Spec ID Event03".\r
287 // The number of hashing algorithms used in this event log (except the first event).\r
288 // All events in this event log use all hashing algorithms defined here.\r
289 //\r
290//UINT32 numberOfAlgorithms;\r
291 //\r
292 // This field is added in "Spec ID Event03".\r
293 // An array of size numberOfAlgorithms of value pairs.\r
294 //\r
295//TCG_EfiSpecIdEventAlgorithmSize digestSize[numberOfAlgorithms];\r
296 //\r
297 // Size in bytes of the VendorInfo field.\r
298 // Maximum value SHALL be FFh bytes.\r
299 //\r
300//UINT8 vendorInfoSize;\r
301 //\r
302 // Provided for use by the BIOS implementer.\r
303 // The value might be used, for example, to provide more detailed information about the specific BIOS such as BIOS revision numbers, etc.\r
304 // The values within this field are not standardized and are implementer-specific.\r
305 // Platform-specific or -unique information SHALL NOT be provided in this field.\r
306 //\r
307//UINT8 vendorInfo[vendorInfoSize];\r
308} TCG_EfiSpecIDEventStruct;\r
309\r
6671cd74
ZC
310\r
311\r
312#define TCG_EfiStartupLocalityEvent_SIGNATURE "StartupLocality"\r
313\r
314\r
315//\r
316// PC Client PTP spec Table 8 Relationship between Locality and Locality Attribute\r
317//\r
318#define LOCALITY_0_INDICATOR 0x01\r
319#define LOCALITY_1_INDICATOR 0x02\r
320#define LOCALITY_2_INDICATOR 0x03\r
321#define LOCALITY_3_INDICATOR 0x04\r
322#define LOCALITY_4_INDICATOR 0x05\r
323\r
324\r
325//\r
326// Startup Locality Event\r
327//\r
328typedef struct tdTCG_EfiStartupLocalityEvent{\r
329 UINT8 Signature[16];\r
330 //\r
331 // The Locality Indicator which sent the TPM2_Startup command\r
332 //\r
333 UINT8 StartupLocality;\r
334} TCG_EfiStartupLocalityEvent;\r
335\r
336\r
267669ba
LG
337//\r
338// Restore original structure alignment\r
339//\r
a04ad3f0 340#pragma pack ()\r
267669ba
LG
341\r
342#endif\r
343\r
344\r