1
2
3
4
5
6
7
8
9
10#ifndef _LINUX_TBOOT_H
11#define _LINUX_TBOOT_H
12
13
14enum {
15 TB_SHUTDOWN_REBOOT = 0,
16 TB_SHUTDOWN_S5,
17 TB_SHUTDOWN_S4,
18 TB_SHUTDOWN_S3,
19 TB_SHUTDOWN_HALT,
20 TB_SHUTDOWN_WFS
21};
22
23#ifdef CONFIG_INTEL_TXT
24#include <linux/acpi.h>
25
26
27#define TB_KEY_SIZE 64
28
29#define MAX_TB_MAC_REGIONS 32
30
31struct tboot_mac_region {
32 u64 start;
33 u32 size;
34} __packed;
35
36
37struct tboot_acpi_generic_address {
38 u8 space_id;
39 u8 bit_width;
40 u8 bit_offset;
41 u8 access_width;
42 u64 address;
43} __packed;
44
45
46
47
48
49struct tboot_acpi_sleep_info {
50 struct tboot_acpi_generic_address pm1a_cnt_blk;
51 struct tboot_acpi_generic_address pm1b_cnt_blk;
52 struct tboot_acpi_generic_address pm1a_evt_blk;
53 struct tboot_acpi_generic_address pm1b_evt_blk;
54 u16 pm1a_cnt_val;
55 u16 pm1b_cnt_val;
56 u64 wakeup_vector;
57 u32 vector_width;
58 u64 kernel_s3_resume_vector;
59} __packed;
60
61
62
63
64struct tboot {
65
66
67
68
69
70 u8 uuid[16];
71
72
73 u32 version;
74
75
76 u32 log_addr;
77
78
79
80
81
82 u32 shutdown_entry;
83 u32 shutdown_type;
84
85
86 struct tboot_acpi_sleep_info acpi_sinfo;
87
88
89 u32 tboot_base;
90 u32 tboot_size;
91
92
93 u8 num_mac_regions;
94 struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS];
95
96
97
98
99
100
101
102 u8 s3_key[TB_KEY_SIZE];
103
104
105
106
107
108
109
110 u8 reserved_align[3];
111
112
113 u32 num_in_wfs;
114} __packed;
115
116
117
118
119
120
121#define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\
122 0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8}
123
124extern struct tboot *tboot;
125
126static inline int tboot_enabled(void)
127{
128 return tboot != NULL;
129}
130
131extern void tboot_probe(void);
132extern void tboot_shutdown(u32 shutdown_type);
133extern struct acpi_table_header *tboot_get_dmar_table(
134 struct acpi_table_header *dmar_tbl);
135extern int tboot_force_iommu(void);
136
137#else
138
139#define tboot_enabled() 0
140#define tboot_probe() do { } while (0)
141#define tboot_shutdown(shutdown_type) do { } while (0)
142#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
143 do { } while (0)
144#define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
145#define tboot_force_iommu() 0
146
147#endif
148
149#endif
150