Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Intel Management Engine Interface (Intel MEI) Linux driver |
Tomas Winkler | 733ba91 | 2012-02-09 19:25:53 +0200 | [diff] [blame] | 4 | * Copyright (c) 2003-2012, Intel Corporation. |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms and conditions of the GNU General Public License, |
| 8 | * version 2, as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | * more details. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #ifndef _MEI_HW_TYPES_H_ |
| 18 | #define _MEI_HW_TYPES_H_ |
| 19 | |
| 20 | #include <linux/uuid.h> |
| 21 | |
| 22 | /* |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 23 | * Timeouts in Seconds |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 24 | */ |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 25 | #define MEI_INTEROP_TIMEOUT 7 /* Timeout on ready message */ |
| 26 | #define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */ |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 27 | |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 28 | #define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */ |
| 29 | #define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */ |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 30 | |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 31 | #define MEI_IAMTHIF_STALL_TIMER 12 /* HPS */ |
| 32 | #define MEI_IAMTHIF_READ_TIMER 10 /* HPS */ |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 33 | |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 34 | |
| 35 | /* |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 36 | * MEI Version |
| 37 | */ |
| 38 | #define HBM_MINOR_VERSION 0 |
| 39 | #define HBM_MAJOR_VERSION 1 |
| 40 | #define HBM_TIMEOUT 1 /* 1 second */ |
| 41 | |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 42 | /* Host bus message command opcode */ |
| 43 | #define MEI_HBM_CMD_OP_MSK 0x7f |
| 44 | /* Host bus message command RESPONSE */ |
| 45 | #define MEI_HBM_CMD_RES_MSK 0x80 |
| 46 | |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 47 | /* |
| 48 | * MEI Bus Message Command IDs |
| 49 | */ |
| 50 | #define HOST_START_REQ_CMD 0x01 |
| 51 | #define HOST_START_RES_CMD 0x81 |
| 52 | |
| 53 | #define HOST_STOP_REQ_CMD 0x02 |
| 54 | #define HOST_STOP_RES_CMD 0x82 |
| 55 | |
| 56 | #define ME_STOP_REQ_CMD 0x03 |
| 57 | |
| 58 | #define HOST_ENUM_REQ_CMD 0x04 |
| 59 | #define HOST_ENUM_RES_CMD 0x84 |
| 60 | |
| 61 | #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05 |
| 62 | #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85 |
| 63 | |
| 64 | #define CLIENT_CONNECT_REQ_CMD 0x06 |
| 65 | #define CLIENT_CONNECT_RES_CMD 0x86 |
| 66 | |
| 67 | #define CLIENT_DISCONNECT_REQ_CMD 0x07 |
| 68 | #define CLIENT_DISCONNECT_RES_CMD 0x87 |
| 69 | |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 70 | #define MEI_FLOW_CONTROL_CMD 0x08 |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 71 | |
| 72 | /* |
| 73 | * MEI Stop Reason |
| 74 | * used by hbm_host_stop_request.reason |
| 75 | */ |
| 76 | enum mei_stop_reason_types { |
| 77 | DRIVER_STOP_REQUEST = 0x00, |
| 78 | DEVICE_D1_ENTRY = 0x01, |
| 79 | DEVICE_D2_ENTRY = 0x02, |
| 80 | DEVICE_D3_ENTRY = 0x03, |
| 81 | SYSTEM_S1_ENTRY = 0x04, |
| 82 | SYSTEM_S2_ENTRY = 0x05, |
| 83 | SYSTEM_S3_ENTRY = 0x06, |
| 84 | SYSTEM_S4_ENTRY = 0x07, |
| 85 | SYSTEM_S5_ENTRY = 0x08 |
| 86 | }; |
| 87 | |
| 88 | /* |
| 89 | * Client Connect Status |
| 90 | * used by hbm_client_connect_response.status |
| 91 | */ |
| 92 | enum client_connect_status_types { |
| 93 | CCS_SUCCESS = 0x00, |
| 94 | CCS_NOT_FOUND = 0x01, |
| 95 | CCS_ALREADY_STARTED = 0x02, |
| 96 | CCS_OUT_OF_RESOURCES = 0x03, |
| 97 | CCS_MESSAGE_SMALL = 0x04 |
| 98 | }; |
| 99 | |
| 100 | /* |
| 101 | * Client Disconnect Status |
| 102 | */ |
| 103 | enum client_disconnect_status_types { |
| 104 | CDS_SUCCESS = 0x00 |
| 105 | }; |
| 106 | |
| 107 | /* |
| 108 | * MEI BUS Interface Section |
| 109 | */ |
| 110 | struct mei_msg_hdr { |
| 111 | u32 me_addr:8; |
| 112 | u32 host_addr:8; |
| 113 | u32 length:9; |
Tomas Winkler | 479327f | 2013-12-17 15:56:56 +0200 | [diff] [blame] | 114 | u32 reserved:5; |
| 115 | u32 internal:1; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 116 | u32 msg_complete:1; |
| 117 | } __packed; |
| 118 | |
| 119 | |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 120 | struct mei_bus_message { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 121 | u8 hbm_cmd; |
| 122 | u8 data[0]; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 123 | } __packed; |
| 124 | |
Tomas Winkler | cd51ed6 | 2012-12-25 19:06:09 +0200 | [diff] [blame] | 125 | /** |
| 126 | * struct hbm_cl_cmd - client specific host bus command |
| 127 | * CONNECT, DISCONNECT, and FlOW CONTROL |
| 128 | * |
| 129 | * @hbm_cmd - bus message command header |
| 130 | * @me_addr - address of the client in ME |
| 131 | * @host_addr - address of the client in the driver |
| 132 | * @data |
| 133 | */ |
| 134 | struct mei_hbm_cl_cmd { |
| 135 | u8 hbm_cmd; |
| 136 | u8 me_addr; |
| 137 | u8 host_addr; |
| 138 | u8 data; |
| 139 | }; |
| 140 | |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 141 | struct hbm_version { |
| 142 | u8 minor_version; |
| 143 | u8 major_version; |
| 144 | } __packed; |
| 145 | |
| 146 | struct hbm_host_version_request { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 147 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 148 | u8 reserved; |
| 149 | struct hbm_version host_version; |
| 150 | } __packed; |
| 151 | |
| 152 | struct hbm_host_version_response { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 153 | u8 hbm_cmd; |
Tomas Winkler | 4b00706 | 2012-02-23 21:52:55 +0200 | [diff] [blame] | 154 | u8 host_version_supported; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 155 | struct hbm_version me_max_version; |
| 156 | } __packed; |
| 157 | |
| 158 | struct hbm_host_stop_request { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 159 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 160 | u8 reason; |
| 161 | u8 reserved[2]; |
| 162 | } __packed; |
| 163 | |
| 164 | struct hbm_host_stop_response { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 165 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 166 | u8 reserved[3]; |
| 167 | } __packed; |
| 168 | |
| 169 | struct hbm_me_stop_request { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 170 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 171 | u8 reason; |
| 172 | u8 reserved[2]; |
| 173 | } __packed; |
| 174 | |
| 175 | struct hbm_host_enum_request { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 176 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 177 | u8 reserved[3]; |
| 178 | } __packed; |
| 179 | |
| 180 | struct hbm_host_enum_response { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 181 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 182 | u8 reserved[3]; |
| 183 | u8 valid_addresses[32]; |
| 184 | } __packed; |
| 185 | |
| 186 | struct mei_client_properties { |
| 187 | uuid_le protocol_name; |
| 188 | u8 protocol_version; |
| 189 | u8 max_number_of_connections; |
| 190 | u8 fixed_address; |
| 191 | u8 single_recv_buf; |
| 192 | u32 max_msg_length; |
| 193 | } __packed; |
| 194 | |
| 195 | struct hbm_props_request { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 196 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 197 | u8 address; |
| 198 | u8 reserved[2]; |
| 199 | } __packed; |
| 200 | |
| 201 | |
| 202 | struct hbm_props_response { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 203 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 204 | u8 address; |
| 205 | u8 status; |
| 206 | u8 reserved[1]; |
| 207 | struct mei_client_properties client_properties; |
| 208 | } __packed; |
| 209 | |
Tomas Winkler | aeba4a0 | 2012-11-11 17:38:04 +0200 | [diff] [blame] | 210 | /** |
| 211 | * struct hbm_client_connect_request - connect/disconnect request |
| 212 | * |
| 213 | * @hbm_cmd - bus message command header |
| 214 | * @me_addr - address of the client in ME |
| 215 | * @host_addr - address of the client in the driver |
| 216 | * @reserved |
| 217 | */ |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 218 | struct hbm_client_connect_request { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 219 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 220 | u8 me_addr; |
| 221 | u8 host_addr; |
| 222 | u8 reserved; |
| 223 | } __packed; |
| 224 | |
Tomas Winkler | aeba4a0 | 2012-11-11 17:38:04 +0200 | [diff] [blame] | 225 | /** |
| 226 | * struct hbm_client_connect_response - connect/disconnect response |
| 227 | * |
| 228 | * @hbm_cmd - bus message command header |
| 229 | * @me_addr - address of the client in ME |
| 230 | * @host_addr - address of the client in the driver |
| 231 | * @status - status of the request |
| 232 | */ |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 233 | struct hbm_client_connect_response { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 234 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 235 | u8 me_addr; |
| 236 | u8 host_addr; |
| 237 | u8 status; |
| 238 | } __packed; |
| 239 | |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 240 | |
| 241 | #define MEI_FC_MESSAGE_RESERVED_LENGTH 5 |
| 242 | |
| 243 | struct hbm_flow_control { |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 244 | u8 hbm_cmd; |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 245 | u8 me_addr; |
| 246 | u8 host_addr; |
| 247 | u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH]; |
| 248 | } __packed; |
| 249 | |
Oren Weil | 5a6003f | 2011-05-15 13:43:45 +0300 | [diff] [blame] | 250 | |
| 251 | #endif |