hw.h 11 KB

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