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