]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiTcgPlatform.h
Add TPM related definitions.
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiTcgPlatform.h
CommitLineData
267669ba
LG
1/* @file\r
2 TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final\r
3\r
4 Copyright (c) 2006 - 2007, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
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
16#define __UEFI_TCG_PLATFOMR_H__\r
17\r
18#include <IndustryStandard/Tpm12.h>\r
19#include <Uefi.h>\r
20//\r
21// Standard event types\r
22//\r
23#define EV_POST_CODE ((TCG_EVENTTYPE) 0x00000001)\r
24#define EV_SEPARATOR ((TCG_EVENTTYPE) 0x00000004)\r
25#define EV_S_CRTM_CONTENTS ((TCG_EVENTTYPE) 0x00000007)\r
26#define EV_S_CRTM_VERSION ((TCG_EVENTTYPE) 0x00000008)\r
27\r
28//\r
29// EFI specific event types\r
30//\r
31#define EV_EFI_EVENT_BASE ((TCG_EVENTTYPE) 0x80000000)\r
32#define EV_EFI_VARIABLE_DRIVER_CONFIG (EV_EFI_EVENT_BASE + 1)\r
33#define EV_EFI_VARIABLE_BOOT (EV_EFI_EVENT_BASE + 2)\r
34#define EV_EFI_BOOT_SERVICES_APPLICATION (EV_EFI_EVENT_BASE + 3)\r
35#define EV_EFI_BOOT_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 4)\r
36#define EV_EFI_RUNTIME_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 5)\r
37#define EV_EFI_GPT_EVENT (EV_EFI_EVENT_BASE + 6)\r
38#define EV_EFI_ACTION (EV_EFI_EVENT_BASE + 7)\r
39#define EV_EFI_PLATFORM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 8)\r
40#define EV_EFI_HANDOFF_TABLES (EV_EFI_EVENT_BASE + 9)\r
41\r
42#define TSS_EVENT_DATA_MAX_SIZE 256\r
43\r
44#define EFI_CALLING_EFI_APPLICATION \\r
45 "Calling EFI Application from Boot Option"\r
46#define EFI_RETURNING_FROM_EFI_APPLICATOIN \\r
47 "Returning from EFI Application from Boot Option"\r
48#define EFI_EXIT_BOOT_SERVICES_INVOCATION \\r
49 "Exit Boot Services Invocation"\r
50#define EFI_EXIT_BOOT_SERVICES_FAILED \\r
51 "Exit Boot Services Returned with Failure"\r
52#define EFI_EXIT_BOOT_SERVICES_SUCCEEDED \\r
53 "Exit Boot Services Returned with Success"\r
54\r
55//\r
56// Set structure alignment to 1-byte\r
57//\r
58#pragma pack (push, 1)\r
59\r
60typedef UINT32 TCG_EVENTTYPE;\r
61\r
62#define TCG_DIGEST TPM_DIGEST\r
63#define TCG_PCRINDEX TPM_PCRINDEX\r
64\r
65//\r
66// TCG_PCR_EVENT\r
67//\r
68typedef struct tdTCG_PCR_EVENT {\r
69 TCG_PCRINDEX PCRIndex; // PCRIndex event extended to\r
70 TCG_EVENTTYPE EventType; // TCG EFI event type\r
71 TCG_DIGEST Digest; // Value extended into PCRIndex\r
72 UINT32 EventSize; // Size of the event data\r
73 UINT8 Event[1]; // The event data\r
74} TCG_PCR_EVENT;\r
75\r
76//\r
77// TCG_PCR_EVENT_HDR\r
78//\r
79typedef struct tdTCG_PCR_EVENT_HDR {\r
80 TCG_PCRINDEX PCRIndex;\r
81 TCG_EVENTTYPE EventType;\r
82 TCG_DIGEST Digest;\r
83 UINT32 EventSize;\r
84} TCG_PCR_EVENT_HDR;\r
85\r
86//\r
87// EFI_PLATFORM_FIRMWARE_BLOB\r
88//\r
89// BlobLength should be of type UINTN but we use UINT64 here\r
90// because PEI is 32-bit while DXE is 64-bit on x64 platforms\r
91//\r
92typedef struct tdEFI_PLATFORM_FIRMWARE_BLOB {\r
93 EFI_PHYSICAL_ADDRESS BlobBase;\r
94 UINT64 BlobLength;\r
95} EFI_PLATFORM_FIRMWARE_BLOB;\r
96\r
97//\r
98// EFI_IMAGE_LOAD_EVENT\r
99//\r
100// This structure is used in EV_EFI_BOOT_SERVICES_APPLICATION,\r
101// EV_EFI_BOOT_SERVICES_DRIVER and EV_EFI_RUNTIME_SERVICES_DRIVER\r
102//\r
103typedef struct tdEFI_IMAGE_LOAD_EVENT {\r
104 EFI_PHYSICAL_ADDRESS ImageLocationInMemory;\r
105 UINTN ImageLengthInMemory;\r
106 UINTN ImageLinkTimeAddress;\r
107 UINTN LengthOfDevicePath;\r
108 EFI_DEVICE_PATH_PROTOCOL DevicePath[1];\r
109} EFI_IMAGE_LOAD_EVENT;\r
110\r
111//\r
112// EFI_HANDOFF_TABLE_POINTERS\r
113//\r
114// This structure is used in EV_EFI_HANDOFF_TABLES event to facilitate\r
115// the measurement of given configuration tables.\r
116//\r
117typedef struct tdEFI_HANDOFF_TABLE_POINTERS {\r
118 UINTN NumberOfTables;\r
119 EFI_CONFIGURATION_TABLE TableEntry[1];\r
120} EFI_HANDOFF_TABLE_POINTERS;\r
121\r
122//\r
123// EFI_VARIABLE_DATA\r
124//\r
125// This structure serves as the header for measuring variables. The name of the\r
126// variable (in Unicode format) should immediately follow, then the variable\r
127// data.\r
128//\r
129typedef struct tdEFI_VARIABLE_DATA {\r
130 EFI_GUID VariableName;\r
131 UINTN UnicodeNameLength;\r
132 UINTN VariableDataLength;\r
133 CHAR16 UnicodeName[1];\r
134 INT8 VariableData[1]; // Driver or platform-specific data\r
135} EFI_VARIABLE_DATA;\r
136\r
137typedef struct tdEFI_GPT_DATA {\r
138 EFI_PARTITION_TABLE_HEADER EfiPartitionHeader;\r
139 UINTN NumberOfPartitions; \r
140 EFI_PARTITION_ENTRY Partitions[1];\r
141} EFI_GPT_DATA;\r
142\r
143//\r
144// Restore original structure alignment\r
145//\r
146#pragma pack (pop)\r
147\r
148#endif\r
149\r
150\r