]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
1.Measure ACPI table data comes from flash event type EV_POST_CODE ACPI DATA to PCR[0]
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / UefiTcgPlatform.h
1 /** @file
2 TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final
3
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 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_PLATFORM_H__
17
18 #include <IndustryStandard/Tpm12.h>
19 #include <Uefi.h>
20
21 //
22 // Standard event types
23 //
24 #define EV_POST_CODE ((TCG_EVENTTYPE) 0x00000001)
25 #define EV_SEPARATOR ((TCG_EVENTTYPE) 0x00000004)
26 #define EV_S_CRTM_CONTENTS ((TCG_EVENTTYPE) 0x00000007)
27 #define EV_S_CRTM_VERSION ((TCG_EVENTTYPE) 0x00000008)
28 #define EV_CPU_MICROCODE ((TCG_EVENTTYPE) 0x00000009)
29
30 //
31 // EFI specific event types
32 //
33 #define EV_EFI_EVENT_BASE ((TCG_EVENTTYPE) 0x80000000)
34 #define EV_EFI_VARIABLE_DRIVER_CONFIG (EV_EFI_EVENT_BASE + 1)
35 #define EV_EFI_VARIABLE_BOOT (EV_EFI_EVENT_BASE + 2)
36 #define EV_EFI_BOOT_SERVICES_APPLICATION (EV_EFI_EVENT_BASE + 3)
37 #define EV_EFI_BOOT_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 4)
38 #define EV_EFI_RUNTIME_SERVICES_DRIVER (EV_EFI_EVENT_BASE + 5)
39 #define EV_EFI_GPT_EVENT (EV_EFI_EVENT_BASE + 6)
40 #define EV_EFI_ACTION (EV_EFI_EVENT_BASE + 7)
41 #define EV_EFI_PLATFORM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 8)
42 #define EV_EFI_HANDOFF_TABLES (EV_EFI_EVENT_BASE + 9)
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 #define EV_POSTCODE_INFO_POST_CODE "POST CODE"
57 #define POST_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)
58
59 #define EV_POSTCODE_INFO_SMM_CODE "SMM CODE"
60 #define SMM_CODE_STR_LEN (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)
61
62 #define EV_POSTCODE_INFO_ACPI_DATA "ACPI DATA"
63 #define ACPI_DATA_LEN (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)
64
65 #define EV_POSTCODE_INFO_BIS_CODE "BIS CODE"
66 #define BIS_CODE_LEN (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)
67
68 #define EV_POSTCODE_INFO_UEFI_PI "UEFI PI"
69 #define UEFI_PI_LEN (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)
70
71 #define EV_POSTCODE_INFO_OPROM "Embedded Option ROM"
72 #define OPROM_LEN (sizeof(EV_POSTCODE_INFO_OPROM) - 1)
73
74 //
75 // Set structure alignment to 1-byte
76 //
77 #pragma pack (1)
78
79 typedef UINT32 TCG_EVENTTYPE;
80 typedef TPM_PCRINDEX TCG_PCRINDEX;
81 typedef TPM_DIGEST TCG_DIGEST;
82 ///
83 /// Event Log Entry Structure Definition
84 ///
85 typedef struct tdTCG_PCR_EVENT {
86 TCG_PCRINDEX PCRIndex; ///< PCRIndex event extended to
87 TCG_EVENTTYPE EventType; ///< TCG EFI event type
88 TCG_DIGEST Digest; ///< Value extended into PCRIndex
89 UINT32 EventSize; ///< Size of the event data
90 UINT8 Event[1]; ///< The event data
91 } TCG_PCR_EVENT;
92
93 #define TSS_EVENT_DATA_MAX_SIZE 256
94
95 ///
96 /// TCG_PCR_EVENT_HDR
97 ///
98 typedef struct tdTCG_PCR_EVENT_HDR {
99 TCG_PCRINDEX PCRIndex;
100 TCG_EVENTTYPE EventType;
101 TCG_DIGEST Digest;
102 UINT32 EventSize;
103 } TCG_PCR_EVENT_HDR;
104
105 ///
106 /// EFI_PLATFORM_FIRMWARE_BLOB
107 ///
108 /// BlobLength should be of type UINTN but we use UINT64 here
109 /// because PEI is 32-bit while DXE is 64-bit on x64 platforms
110 ///
111 typedef struct tdEFI_PLATFORM_FIRMWARE_BLOB {
112 EFI_PHYSICAL_ADDRESS BlobBase;
113 UINT64 BlobLength;
114 } EFI_PLATFORM_FIRMWARE_BLOB;
115
116 ///
117 /// EFI_IMAGE_LOAD_EVENT
118 ///
119 /// This structure is used in EV_EFI_BOOT_SERVICES_APPLICATION,
120 /// EV_EFI_BOOT_SERVICES_DRIVER and EV_EFI_RUNTIME_SERVICES_DRIVER
121 ///
122 typedef struct tdEFI_IMAGE_LOAD_EVENT {
123 EFI_PHYSICAL_ADDRESS ImageLocationInMemory;
124 UINTN ImageLengthInMemory;
125 UINTN ImageLinkTimeAddress;
126 UINTN LengthOfDevicePath;
127 EFI_DEVICE_PATH_PROTOCOL DevicePath[1];
128 } EFI_IMAGE_LOAD_EVENT;
129
130 ///
131 /// EFI_HANDOFF_TABLE_POINTERS
132 ///
133 /// This structure is used in EV_EFI_HANDOFF_TABLES event to facilitate
134 /// the measurement of given configuration tables.
135 ///
136 typedef struct tdEFI_HANDOFF_TABLE_POINTERS {
137 UINTN NumberOfTables;
138 EFI_CONFIGURATION_TABLE TableEntry[1];
139 } EFI_HANDOFF_TABLE_POINTERS;
140
141 ///
142 /// EFI_VARIABLE_DATA
143 ///
144 /// This structure serves as the header for measuring variables. The name of the
145 /// variable (in Unicode format) should immediately follow, then the variable
146 /// data.
147 ///
148 typedef struct tdEFI_VARIABLE_DATA {
149 EFI_GUID VariableName;
150 UINTN UnicodeNameLength;
151 UINTN VariableDataLength;
152 CHAR16 UnicodeName[1];
153 INT8 VariableData[1]; ///< Driver or platform-specific data
154 } EFI_VARIABLE_DATA;
155
156 typedef struct tdEFI_GPT_DATA {
157 EFI_PARTITION_TABLE_HEADER EfiPartitionHeader;
158 UINTN NumberOfPartitions;
159 EFI_PARTITION_ENTRY Partitions[1];
160 } EFI_GPT_DATA;
161
162 //
163 // Restore original structure alignment
164 //
165 #pragma pack ()
166
167 #endif
168
169