hw.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /*
  2. *
  3. * Intel Management Engine Interface (Intel MEI) Linux driver
  4. * Copyright (c) 2003-2012, Intel Corporation.
  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. #ifndef _MEI_HW_TYPES_H_
  17. #define _MEI_HW_TYPES_H_
  18. #include <linux/uuid.h>
  19. /*
  20. * Timeouts in Seconds
  21. */
  22. #define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */
  23. #define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */
  24. #define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
  25. #define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */
  26. #define MEI_IAMTHIF_STALL_TIMER 12 /* HPS */
  27. #define MEI_IAMTHIF_READ_TIMER 10 /* HPS */
  28. #define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */
  29. #define MEI_D0I3_TIMEOUT 5 /* D0i3 set/unset max response time */
  30. #define MEI_HBM_TIMEOUT 1 /* 1 second */
  31. /*
  32. * MEI Version
  33. */
  34. #define HBM_MINOR_VERSION 0
  35. #define HBM_MAJOR_VERSION 2
  36. /*
  37. * MEI version with PGI support
  38. */
  39. #define HBM_MINOR_VERSION_PGI 1
  40. #define HBM_MAJOR_VERSION_PGI 1
  41. /*
  42. * MEI version with Dynamic clients support
  43. */
  44. #define HBM_MINOR_VERSION_DC 0
  45. #define HBM_MAJOR_VERSION_DC 2
  46. /*
  47. * MEI version with disconnect on connection timeout support
  48. */
  49. #define HBM_MINOR_VERSION_DOT 0
  50. #define HBM_MAJOR_VERSION_DOT 2
  51. /*
  52. * MEI version with notifcation support
  53. */
  54. #define HBM_MINOR_VERSION_EV 0
  55. #define HBM_MAJOR_VERSION_EV 2
  56. /* Host bus message command opcode */
  57. #define MEI_HBM_CMD_OP_MSK 0x7f
  58. /* Host bus message command RESPONSE */
  59. #define MEI_HBM_CMD_RES_MSK 0x80
  60. /*
  61. * MEI Bus Message Command IDs
  62. */
  63. #define HOST_START_REQ_CMD 0x01
  64. #define HOST_START_RES_CMD 0x81
  65. #define HOST_STOP_REQ_CMD 0x02
  66. #define HOST_STOP_RES_CMD 0x82
  67. #define ME_STOP_REQ_CMD 0x03
  68. #define HOST_ENUM_REQ_CMD 0x04
  69. #define HOST_ENUM_RES_CMD 0x84
  70. #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
  71. #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
  72. #define CLIENT_CONNECT_REQ_CMD 0x06
  73. #define CLIENT_CONNECT_RES_CMD 0x86
  74. #define CLIENT_DISCONNECT_REQ_CMD 0x07
  75. #define CLIENT_DISCONNECT_RES_CMD 0x87
  76. #define MEI_FLOW_CONTROL_CMD 0x08
  77. #define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
  78. #define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
  79. #define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
  80. #define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
  81. #define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
  82. #define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
  83. #define MEI_HBM_NOTIFY_REQ_CMD 0x10
  84. #define MEI_HBM_NOTIFY_RES_CMD 0x90
  85. #define MEI_HBM_NOTIFICATION_CMD 0x11
  86. /*
  87. * MEI Stop Reason
  88. * used by hbm_host_stop_request.reason
  89. */
  90. enum mei_stop_reason_types {
  91. DRIVER_STOP_REQUEST = 0x00,
  92. DEVICE_D1_ENTRY = 0x01,
  93. DEVICE_D2_ENTRY = 0x02,
  94. DEVICE_D3_ENTRY = 0x03,
  95. SYSTEM_S1_ENTRY = 0x04,
  96. SYSTEM_S2_ENTRY = 0x05,
  97. SYSTEM_S3_ENTRY = 0x06,
  98. SYSTEM_S4_ENTRY = 0x07,
  99. SYSTEM_S5_ENTRY = 0x08
  100. };
  101. /**
  102. * enum mei_hbm_status - mei host bus messages return values
  103. *
  104. * @MEI_HBMS_SUCCESS : status success
  105. * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
  106. * @MEI_HBMS_ALREADY_EXISTS : connection already established
  107. * @MEI_HBMS_REJECTED : connection is rejected
  108. * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
  109. * @MEI_HBMS_NOT_ALLOWED : operation not allowed
  110. * @MEI_HBMS_ALREADY_STARTED : system is already started
  111. * @MEI_HBMS_NOT_STARTED : system not started
  112. *
  113. * @MEI_HBMS_MAX : sentinel
  114. */
  115. enum mei_hbm_status {
  116. MEI_HBMS_SUCCESS = 0,
  117. MEI_HBMS_CLIENT_NOT_FOUND = 1,
  118. MEI_HBMS_ALREADY_EXISTS = 2,
  119. MEI_HBMS_REJECTED = 3,
  120. MEI_HBMS_INVALID_PARAMETER = 4,
  121. MEI_HBMS_NOT_ALLOWED = 5,
  122. MEI_HBMS_ALREADY_STARTED = 6,
  123. MEI_HBMS_NOT_STARTED = 7,
  124. MEI_HBMS_MAX
  125. };
  126. /*
  127. * Client Connect Status
  128. * used by hbm_client_connect_response.status
  129. */
  130. enum mei_cl_connect_status {
  131. MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
  132. MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
  133. MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
  134. MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
  135. MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
  136. MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED,
  137. };
  138. /*
  139. * Client Disconnect Status
  140. */
  141. enum mei_cl_disconnect_status {
  142. MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
  143. };
  144. /*
  145. * MEI BUS Interface Section
  146. */
  147. struct mei_msg_hdr {
  148. u32 me_addr:8;
  149. u32 host_addr:8;
  150. u32 length:9;
  151. u32 reserved:5;
  152. u32 internal:1;
  153. u32 msg_complete:1;
  154. } __packed;
  155. struct mei_bus_message {
  156. u8 hbm_cmd;
  157. u8 data[0];
  158. } __packed;
  159. /**
  160. * struct hbm_cl_cmd - client specific host bus command
  161. * CONNECT, DISCONNECT, and FlOW CONTROL
  162. *
  163. * @hbm_cmd: bus message command header
  164. * @me_addr: address of the client in ME
  165. * @host_addr: address of the client in the driver
  166. * @data: generic data
  167. */
  168. struct mei_hbm_cl_cmd {
  169. u8 hbm_cmd;
  170. u8 me_addr;
  171. u8 host_addr;
  172. u8 data;
  173. };
  174. struct hbm_version {
  175. u8 minor_version;
  176. u8 major_version;
  177. } __packed;
  178. struct hbm_host_version_request {
  179. u8 hbm_cmd;
  180. u8 reserved;
  181. struct hbm_version host_version;
  182. } __packed;
  183. struct hbm_host_version_response {
  184. u8 hbm_cmd;
  185. u8 host_version_supported;
  186. struct hbm_version me_max_version;
  187. } __packed;
  188. struct hbm_host_stop_request {
  189. u8 hbm_cmd;
  190. u8 reason;
  191. u8 reserved[2];
  192. } __packed;
  193. struct hbm_host_stop_response {
  194. u8 hbm_cmd;
  195. u8 reserved[3];
  196. } __packed;
  197. struct hbm_me_stop_request {
  198. u8 hbm_cmd;
  199. u8 reason;
  200. u8 reserved[2];
  201. } __packed;
  202. /**
  203. * struct hbm_host_enum_request - enumeration request from host to fw
  204. *
  205. * @hbm_cmd: bus message command header
  206. * @allow_add: allow dynamic clients add HBM version >= 2.0
  207. * @reserved: reserved
  208. */
  209. struct hbm_host_enum_request {
  210. u8 hbm_cmd;
  211. u8 allow_add;
  212. u8 reserved[2];
  213. } __packed;
  214. struct hbm_host_enum_response {
  215. u8 hbm_cmd;
  216. u8 reserved[3];
  217. u8 valid_addresses[32];
  218. } __packed;
  219. struct mei_client_properties {
  220. uuid_le protocol_name;
  221. u8 protocol_version;
  222. u8 max_number_of_connections;
  223. u8 fixed_address;
  224. u8 single_recv_buf;
  225. u32 max_msg_length;
  226. } __packed;
  227. struct hbm_props_request {
  228. u8 hbm_cmd;
  229. u8 me_addr;
  230. u8 reserved[2];
  231. } __packed;
  232. struct hbm_props_response {
  233. u8 hbm_cmd;
  234. u8 me_addr;
  235. u8 status;
  236. u8 reserved[1];
  237. struct mei_client_properties client_properties;
  238. } __packed;
  239. /**
  240. * struct hbm_add_client_request - request to add a client
  241. * might be sent by fw after enumeration has already completed
  242. *
  243. * @hbm_cmd: bus message command header
  244. * @me_addr: address of the client in ME
  245. * @reserved: reserved
  246. * @client_properties: client properties
  247. */
  248. struct hbm_add_client_request {
  249. u8 hbm_cmd;
  250. u8 me_addr;
  251. u8 reserved[2];
  252. struct mei_client_properties client_properties;
  253. } __packed;
  254. /**
  255. * struct hbm_add_client_response - response to add a client
  256. * sent by the host to report client addition status to fw
  257. *
  258. * @hbm_cmd: bus message command header
  259. * @me_addr: address of the client in ME
  260. * @status: if HBMS_SUCCESS then the client can now accept connections.
  261. * @reserved: reserved
  262. */
  263. struct hbm_add_client_response {
  264. u8 hbm_cmd;
  265. u8 me_addr;
  266. u8 status;
  267. u8 reserved[1];
  268. } __packed;
  269. /**
  270. * struct hbm_power_gate - power gate request/response
  271. *
  272. * @hbm_cmd: bus message command header
  273. * @reserved: reserved
  274. */
  275. struct hbm_power_gate {
  276. u8 hbm_cmd;
  277. u8 reserved[3];
  278. } __packed;
  279. /**
  280. * struct hbm_client_connect_request - connect/disconnect request
  281. *
  282. * @hbm_cmd: bus message command header
  283. * @me_addr: address of the client in ME
  284. * @host_addr: address of the client in the driver
  285. * @reserved: reserved
  286. */
  287. struct hbm_client_connect_request {
  288. u8 hbm_cmd;
  289. u8 me_addr;
  290. u8 host_addr;
  291. u8 reserved;
  292. } __packed;
  293. /**
  294. * struct hbm_client_connect_response - connect/disconnect response
  295. *
  296. * @hbm_cmd: bus message command header
  297. * @me_addr: address of the client in ME
  298. * @host_addr: address of the client in the driver
  299. * @status: status of the request
  300. */
  301. struct hbm_client_connect_response {
  302. u8 hbm_cmd;
  303. u8 me_addr;
  304. u8 host_addr;
  305. u8 status;
  306. } __packed;
  307. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  308. struct hbm_flow_control {
  309. u8 hbm_cmd;
  310. u8 me_addr;
  311. u8 host_addr;
  312. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  313. } __packed;
  314. #define MEI_HBM_NOTIFICATION_START 1
  315. #define MEI_HBM_NOTIFICATION_STOP 0
  316. /**
  317. * struct hbm_notification_request - start/stop notification request
  318. *
  319. * @hbm_cmd: bus message command header
  320. * @me_addr: address of the client in ME
  321. * @host_addr: address of the client in the driver
  322. * @start: start = 1 or stop = 0 asynchronous notifications
  323. */
  324. struct hbm_notification_request {
  325. u8 hbm_cmd;
  326. u8 me_addr;
  327. u8 host_addr;
  328. u8 start;
  329. } __packed;
  330. /**
  331. * struct hbm_notification_response - start/stop notification response
  332. *
  333. * @hbm_cmd: bus message command header
  334. * @me_addr: address of the client in ME
  335. * @host_addr: - address of the client in the driver
  336. * @status: (mei_hbm_status) response status for the request
  337. * - MEI_HBMS_SUCCESS: successful stop/start
  338. * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
  339. * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
  340. * started notification.
  341. * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
  342. * asynchronous notifications are currently disabled.
  343. *
  344. * @start: start = 1 or stop = 0 asynchronous notifications
  345. * @reserved: reserved
  346. */
  347. struct hbm_notification_response {
  348. u8 hbm_cmd;
  349. u8 me_addr;
  350. u8 host_addr;
  351. u8 status;
  352. u8 start;
  353. u8 reserved[3];
  354. } __packed;
  355. /**
  356. * struct hbm_notification - notification event
  357. *
  358. * @hbm_cmd: bus message command header
  359. * @me_addr: address of the client in ME
  360. * @host_addr: address of the client in the driver
  361. * @reserved: reserved for alignment
  362. */
  363. struct hbm_notification {
  364. u8 hbm_cmd;
  365. u8 me_addr;
  366. u8 host_addr;
  367. u8 reserved[1];
  368. } __packed;
  369. #endif