hw.h 11 KB

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