0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_TBOOT_H
0011 #define _LINUX_TBOOT_H
0012
0013
0014 enum {
0015 TB_SHUTDOWN_REBOOT = 0,
0016 TB_SHUTDOWN_S5,
0017 TB_SHUTDOWN_S4,
0018 TB_SHUTDOWN_S3,
0019 TB_SHUTDOWN_HALT,
0020 TB_SHUTDOWN_WFS
0021 };
0022
0023 #ifdef CONFIG_INTEL_TXT
0024 #include <linux/acpi.h>
0025
0026
0027 #define TB_KEY_SIZE 64
0028
0029 #define MAX_TB_MAC_REGIONS 32
0030
0031 struct tboot_mac_region {
0032 u64 start;
0033 u32 size;
0034 } __packed;
0035
0036
0037 struct tboot_acpi_generic_address {
0038 u8 space_id;
0039 u8 bit_width;
0040 u8 bit_offset;
0041 u8 access_width;
0042 u64 address;
0043 } __packed;
0044
0045
0046
0047
0048
0049 struct tboot_acpi_sleep_info {
0050 struct tboot_acpi_generic_address pm1a_cnt_blk;
0051 struct tboot_acpi_generic_address pm1b_cnt_blk;
0052 struct tboot_acpi_generic_address pm1a_evt_blk;
0053 struct tboot_acpi_generic_address pm1b_evt_blk;
0054 u16 pm1a_cnt_val;
0055 u16 pm1b_cnt_val;
0056 u64 wakeup_vector;
0057 u32 vector_width;
0058 u64 kernel_s3_resume_vector;
0059 } __packed;
0060
0061
0062
0063
0064 struct tboot {
0065
0066
0067
0068
0069
0070 u8 uuid[16];
0071
0072
0073 u32 version;
0074
0075
0076 u32 log_addr;
0077
0078
0079
0080
0081
0082 u32 shutdown_entry;
0083 u32 shutdown_type;
0084
0085
0086 struct tboot_acpi_sleep_info acpi_sinfo;
0087
0088
0089 u32 tboot_base;
0090 u32 tboot_size;
0091
0092
0093 u8 num_mac_regions;
0094 struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS];
0095
0096
0097
0098
0099
0100
0101
0102 u8 s3_key[TB_KEY_SIZE];
0103
0104
0105
0106
0107
0108
0109
0110 u8 reserved_align[3];
0111
0112
0113 u32 num_in_wfs;
0114 } __packed;
0115
0116
0117
0118
0119
0120
0121 #define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\
0122 0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8}
0123
0124 bool tboot_enabled(void);
0125 extern void tboot_probe(void);
0126 extern void tboot_shutdown(u32 shutdown_type);
0127 extern struct acpi_table_header *tboot_get_dmar_table(
0128 struct acpi_table_header *dmar_tbl);
0129
0130 #else
0131
0132 #define tboot_enabled() 0
0133 #define tboot_probe() do { } while (0)
0134 #define tboot_shutdown(shutdown_type) do { } while (0)
0135 #define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
0136 do { } while (0)
0137 #define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
0138
0139 #endif
0140
0141 #endif