]>
Commit | Line | Data |
---|---|---|
31625340 JC |
1 | /* |
2 | * tboot.h: shared data structure with tboot and kernel and functions | |
3 | * used by kernel for runtime support of Intel(R) Trusted | |
4 | * Execution Technology | |
5 | * | |
6 | * Copyright (c) 2006-2009, Intel Corporation | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify it | |
9 | * under the terms and conditions of the GNU General Public License, | |
10 | * version 2, as published by the Free Software Foundation. | |
11 | * | |
12 | * This program is distributed in the hope it will be useful, but WITHOUT | |
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
15 | * more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License along with | |
18 | * this program; if not, write to the Free Software Foundation, Inc., | |
19 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
20 | * | |
21 | */ | |
22 | ||
69575d38 SW |
23 | #ifndef _LINUX_TBOOT_H |
24 | #define _LINUX_TBOOT_H | |
31625340 JC |
25 | |
26 | /* these must have the values from 0-5 in this order */ | |
27 | enum { | |
28 | TB_SHUTDOWN_REBOOT = 0, | |
29 | TB_SHUTDOWN_S5, | |
30 | TB_SHUTDOWN_S4, | |
31 | TB_SHUTDOWN_S3, | |
32 | TB_SHUTDOWN_HALT, | |
33 | TB_SHUTDOWN_WFS | |
34 | }; | |
35 | ||
36 | #ifdef CONFIG_INTEL_TXT | |
69575d38 | 37 | #include <acpi/acpi.h> |
31625340 JC |
38 | /* used to communicate between tboot and the launched kernel */ |
39 | ||
40 | #define TB_KEY_SIZE 64 /* 512 bits */ | |
41 | ||
42 | #define MAX_TB_MAC_REGIONS 32 | |
43 | ||
44 | struct tboot_mac_region { | |
45 | u64 start; /* must be 64 byte -aligned */ | |
46 | u32 size; /* must be 64 byte -granular */ | |
47 | } __packed; | |
48 | ||
49 | /* GAS - Generic Address Structure (ACPI 2.0+) */ | |
50 | struct tboot_acpi_generic_address { | |
51 | u8 space_id; | |
52 | u8 bit_width; | |
53 | u8 bit_offset; | |
54 | u8 access_width; | |
55 | u64 address; | |
56 | } __packed; | |
57 | ||
58 | /* | |
59 | * combines Sx info from FADT and FACS tables per ACPI 2.0+ spec | |
60 | * (http://www.acpi.info/) | |
61 | */ | |
62 | struct tboot_acpi_sleep_info { | |
63 | struct tboot_acpi_generic_address pm1a_cnt_blk; | |
64 | struct tboot_acpi_generic_address pm1b_cnt_blk; | |
65 | struct tboot_acpi_generic_address pm1a_evt_blk; | |
66 | struct tboot_acpi_generic_address pm1b_evt_blk; | |
67 | u16 pm1a_cnt_val; | |
68 | u16 pm1b_cnt_val; | |
69 | u64 wakeup_vector; | |
70 | u32 vector_width; | |
71 | u64 kernel_s3_resume_vector; | |
72 | } __packed; | |
73 | ||
74 | /* | |
75 | * shared memory page used for communication between tboot and kernel | |
76 | */ | |
77 | struct tboot { | |
78 | /* | |
79 | * version 3+ fields: | |
80 | */ | |
81 | ||
82 | /* TBOOT_UUID */ | |
83 | u8 uuid[16]; | |
84 | ||
85 | /* version number: 5 is current */ | |
86 | u32 version; | |
87 | ||
88 | /* physical addr of tb_log_t log */ | |
89 | u32 log_addr; | |
90 | ||
91 | /* | |
92 | * physical addr of entry point for tboot shutdown and | |
93 | * type of shutdown (TB_SHUTDOWN_*) being requested | |
94 | */ | |
95 | u32 shutdown_entry; | |
96 | u32 shutdown_type; | |
97 | ||
98 | /* kernel-specified ACPI info for Sx shutdown */ | |
99 | struct tboot_acpi_sleep_info acpi_sinfo; | |
100 | ||
101 | /* tboot location in memory (physical) */ | |
102 | u32 tboot_base; | |
103 | u32 tboot_size; | |
104 | ||
105 | /* memory regions (phys addrs) for tboot to MAC on S3 */ | |
106 | u8 num_mac_regions; | |
107 | struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS]; | |
108 | ||
109 | ||
110 | /* | |
111 | * version 4+ fields: | |
112 | */ | |
113 | ||
114 | /* symmetric key for use by kernel; will be encrypted on S3 */ | |
115 | u8 s3_key[TB_KEY_SIZE]; | |
116 | ||
117 | ||
118 | /* | |
119 | * version 5+ fields: | |
120 | */ | |
121 | ||
122 | /* used to 4byte-align num_in_wfs */ | |
123 | u8 reserved_align[3]; | |
124 | ||
125 | /* number of processors in wait-for-SIPI */ | |
126 | u32 num_in_wfs; | |
127 | } __packed; | |
128 | ||
129 | /* | |
130 | * UUID for tboot data struct to facilitate matching | |
131 | * defined as {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} by tboot, which is | |
132 | * represented as {} in the char array used here | |
133 | */ | |
134 | #define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\ | |
135 | 0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8} | |
136 | ||
137 | extern struct tboot *tboot; | |
138 | ||
139 | static inline int tboot_enabled(void) | |
140 | { | |
141 | return tboot != NULL; | |
142 | } | |
143 | ||
144 | extern void tboot_probe(void); | |
31625340 JC |
145 | extern void tboot_shutdown(u32 shutdown_type); |
146 | extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control); | |
31625340 JC |
147 | extern struct acpi_table_header *tboot_get_dmar_table( |
148 | struct acpi_table_header *dmar_tbl); | |
149 | extern int tboot_force_iommu(void); | |
150 | ||
69575d38 | 151 | #else |
31625340 | 152 | |
cafd6659 | 153 | #define tboot_enabled() 0 |
69575d38 SW |
154 | #define tboot_probe() do { } while (0) |
155 | #define tboot_shutdown(shutdown_type) do { } while (0) | |
156 | #define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \ | |
157 | do { } while (0) | |
158 | #define tboot_get_dmar_table(dmar_tbl) (dmar_tbl) | |
159 | #define tboot_force_iommu() 0 | |
31625340 JC |
160 | |
161 | #endif /* !CONFIG_INTEL_TXT */ | |
162 | ||
69575d38 | 163 | #endif /* _LINUX_TBOOT_H */ |