1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef _LINUX_TBOOT_H
24#define _LINUX_TBOOT_H
25
26
27enum {
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
37#include <linux/acpi.h>
38
39
40#define TB_KEY_SIZE 64
41
42#define MAX_TB_MAC_REGIONS 32
43
44struct tboot_mac_region {
45 u64 start;
46 u32 size;
47} __packed;
48
49
50struct 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
60
61
62struct 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
76
77struct tboot {
78
79
80
81
82
83 u8 uuid[16];
84
85
86 u32 version;
87
88
89 u32 log_addr;
90
91
92
93
94
95 u32 shutdown_entry;
96 u32 shutdown_type;
97
98
99 struct tboot_acpi_sleep_info acpi_sinfo;
100
101
102 u32 tboot_base;
103 u32 tboot_size;
104
105
106 u8 num_mac_regions;
107 struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS];
108
109
110
111
112
113
114
115 u8 s3_key[TB_KEY_SIZE];
116
117
118
119
120
121
122
123 u8 reserved_align[3];
124
125
126 u32 num_in_wfs;
127} __packed;
128
129
130
131
132
133
134#define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\
135 0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8}
136
137extern struct tboot *tboot;
138
139static inline int tboot_enabled(void)
140{
141 return tboot != NULL;
142}
143
144extern void tboot_probe(void);
145extern void tboot_shutdown(u32 shutdown_type);
146extern struct acpi_table_header *tboot_get_dmar_table(
147 struct acpi_table_header *dmar_tbl);
148extern int tboot_force_iommu(void);
149
150#else
151
152#define tboot_enabled() 0
153#define tboot_probe() do { } while (0)
154#define tboot_shutdown(shutdown_type) do { } while (0)
155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
156 do { } while (0)
157#define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
158#define tboot_force_iommu() 0
159
160#endif
161
162#endif
163