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