hw.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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_INTEROP_TIMEOUT 7 /* 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. /*
  29. * Internal Clients Number
  30. */
  31. #define MEI_WD_HOST_CLIENT_ID 1
  32. #define MEI_IAMTHIF_HOST_CLIENT_ID 2
  33. /*
  34. * MEI device IDs
  35. */
  36. #define MEI_DEV_ID_82946GZ 0x2974 /* 82946GZ/GL */
  37. #define MEI_DEV_ID_82G35 0x2984 /* 82G35 Express */
  38. #define MEI_DEV_ID_82Q965 0x2994 /* 82Q963/Q965 */
  39. #define MEI_DEV_ID_82G965 0x29A4 /* 82P965/G965 */
  40. #define MEI_DEV_ID_82GM965 0x2A04 /* Mobile PM965/GM965 */
  41. #define MEI_DEV_ID_82GME965 0x2A14 /* Mobile GME965/GLE960 */
  42. #define MEI_DEV_ID_ICH9_82Q35 0x29B4 /* 82Q35 Express */
  43. #define MEI_DEV_ID_ICH9_82G33 0x29C4 /* 82G33/G31/P35/P31 Express */
  44. #define MEI_DEV_ID_ICH9_82Q33 0x29D4 /* 82Q33 Express */
  45. #define MEI_DEV_ID_ICH9_82X38 0x29E4 /* 82X38/X48 Express */
  46. #define MEI_DEV_ID_ICH9_3200 0x29F4 /* 3200/3210 Server */
  47. #define MEI_DEV_ID_ICH9_6 0x28B4 /* Bearlake */
  48. #define MEI_DEV_ID_ICH9_7 0x28C4 /* Bearlake */
  49. #define MEI_DEV_ID_ICH9_8 0x28D4 /* Bearlake */
  50. #define MEI_DEV_ID_ICH9_9 0x28E4 /* Bearlake */
  51. #define MEI_DEV_ID_ICH9_10 0x28F4 /* Bearlake */
  52. #define MEI_DEV_ID_ICH9M_1 0x2A44 /* Cantiga */
  53. #define MEI_DEV_ID_ICH9M_2 0x2A54 /* Cantiga */
  54. #define MEI_DEV_ID_ICH9M_3 0x2A64 /* Cantiga */
  55. #define MEI_DEV_ID_ICH9M_4 0x2A74 /* Cantiga */
  56. #define MEI_DEV_ID_ICH10_1 0x2E04 /* Eaglelake */
  57. #define MEI_DEV_ID_ICH10_2 0x2E14 /* Eaglelake */
  58. #define MEI_DEV_ID_ICH10_3 0x2E24 /* Eaglelake */
  59. #define MEI_DEV_ID_ICH10_4 0x2E34 /* Eaglelake */
  60. #define MEI_DEV_ID_IBXPK_1 0x3B64 /* Calpella */
  61. #define MEI_DEV_ID_IBXPK_2 0x3B65 /* Calpella */
  62. #define MEI_DEV_ID_CPT_1 0x1C3A /* Couger Point */
  63. #define MEI_DEV_ID_PBG_1 0x1D3A /* C600/X79 Patsburg */
  64. #define MEI_DEV_ID_PPT_1 0x1E3A /* Panther Point */
  65. #define MEI_DEV_ID_PPT_2 0x1CBA /* Panther Point */
  66. #define MEI_DEV_ID_PPT_3 0x1DBA /* Panther Point */
  67. #define MEI_DEV_ID_LPT 0x8C3A /* Lynx Point */
  68. #define MEI_DEV_ID_LPT_LP 0x9C3A /* Lynx Point LP */
  69. /*
  70. * MEI HW Section
  71. */
  72. /* MEI registers */
  73. /* H_CB_WW - Host Circular Buffer (CB) Write Window register */
  74. #define H_CB_WW 0
  75. /* H_CSR - Host Control Status register */
  76. #define H_CSR 4
  77. /* ME_CB_RW - ME Circular Buffer Read Window register (read only) */
  78. #define ME_CB_RW 8
  79. /* ME_CSR_HA - ME Control Status Host Access register (read only) */
  80. #define ME_CSR_HA 0xC
  81. /* register bits of H_CSR (Host Control Status register) */
  82. /* Host Circular Buffer Depth - maximum number of 32-bit entries in CB */
  83. #define H_CBD 0xFF000000
  84. /* Host Circular Buffer Write Pointer */
  85. #define H_CBWP 0x00FF0000
  86. /* Host Circular Buffer Read Pointer */
  87. #define H_CBRP 0x0000FF00
  88. /* Host Reset */
  89. #define H_RST 0x00000010
  90. /* Host Ready */
  91. #define H_RDY 0x00000008
  92. /* Host Interrupt Generate */
  93. #define H_IG 0x00000004
  94. /* Host Interrupt Status */
  95. #define H_IS 0x00000002
  96. /* Host Interrupt Enable */
  97. #define H_IE 0x00000001
  98. /* register bits of ME_CSR_HA (ME Control Status Host Access register) */
  99. /* ME CB (Circular Buffer) Depth HRA (Host Read Access) - host read only
  100. access to ME_CBD */
  101. #define ME_CBD_HRA 0xFF000000
  102. /* ME CB Write Pointer HRA - host read only access to ME_CBWP */
  103. #define ME_CBWP_HRA 0x00FF0000
  104. /* ME CB Read Pointer HRA - host read only access to ME_CBRP */
  105. #define ME_CBRP_HRA 0x0000FF00
  106. /* ME Reset HRA - host read only access to ME_RST */
  107. #define ME_RST_HRA 0x00000010
  108. /* ME Ready HRA - host read only access to ME_RDY */
  109. #define ME_RDY_HRA 0x00000008
  110. /* ME Interrupt Generate HRA - host read only access to ME_IG */
  111. #define ME_IG_HRA 0x00000004
  112. /* ME Interrupt Status HRA - host read only access to ME_IS */
  113. #define ME_IS_HRA 0x00000002
  114. /* ME Interrupt Enable HRA - host read only access to ME_IE */
  115. #define ME_IE_HRA 0x00000001
  116. /*
  117. * MEI Version
  118. */
  119. #define HBM_MINOR_VERSION 0
  120. #define HBM_MAJOR_VERSION 1
  121. #define HBM_TIMEOUT 1 /* 1 second */
  122. /* Host bus message command opcode */
  123. #define MEI_HBM_CMD_OP_MSK 0x7f
  124. /* Host bus message command RESPONSE */
  125. #define MEI_HBM_CMD_RES_MSK 0x80
  126. /*
  127. * MEI Bus Message Command IDs
  128. */
  129. #define HOST_START_REQ_CMD 0x01
  130. #define HOST_START_RES_CMD 0x81
  131. #define HOST_STOP_REQ_CMD 0x02
  132. #define HOST_STOP_RES_CMD 0x82
  133. #define ME_STOP_REQ_CMD 0x03
  134. #define HOST_ENUM_REQ_CMD 0x04
  135. #define HOST_ENUM_RES_CMD 0x84
  136. #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
  137. #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
  138. #define CLIENT_CONNECT_REQ_CMD 0x06
  139. #define CLIENT_CONNECT_RES_CMD 0x86
  140. #define CLIENT_DISCONNECT_REQ_CMD 0x07
  141. #define CLIENT_DISCONNECT_RES_CMD 0x87
  142. #define MEI_FLOW_CONTROL_CMD 0x08
  143. /*
  144. * MEI Stop Reason
  145. * used by hbm_host_stop_request.reason
  146. */
  147. enum mei_stop_reason_types {
  148. DRIVER_STOP_REQUEST = 0x00,
  149. DEVICE_D1_ENTRY = 0x01,
  150. DEVICE_D2_ENTRY = 0x02,
  151. DEVICE_D3_ENTRY = 0x03,
  152. SYSTEM_S1_ENTRY = 0x04,
  153. SYSTEM_S2_ENTRY = 0x05,
  154. SYSTEM_S3_ENTRY = 0x06,
  155. SYSTEM_S4_ENTRY = 0x07,
  156. SYSTEM_S5_ENTRY = 0x08
  157. };
  158. /*
  159. * Client Connect Status
  160. * used by hbm_client_connect_response.status
  161. */
  162. enum client_connect_status_types {
  163. CCS_SUCCESS = 0x00,
  164. CCS_NOT_FOUND = 0x01,
  165. CCS_ALREADY_STARTED = 0x02,
  166. CCS_OUT_OF_RESOURCES = 0x03,
  167. CCS_MESSAGE_SMALL = 0x04
  168. };
  169. /*
  170. * Client Disconnect Status
  171. */
  172. enum client_disconnect_status_types {
  173. CDS_SUCCESS = 0x00
  174. };
  175. /*
  176. * MEI BUS Interface Section
  177. */
  178. struct mei_msg_hdr {
  179. u32 me_addr:8;
  180. u32 host_addr:8;
  181. u32 length:9;
  182. u32 reserved:6;
  183. u32 msg_complete:1;
  184. } __packed;
  185. struct mei_bus_message {
  186. u8 hbm_cmd;
  187. u8 data[0];
  188. } __packed;
  189. struct hbm_version {
  190. u8 minor_version;
  191. u8 major_version;
  192. } __packed;
  193. struct hbm_host_version_request {
  194. u8 hbm_cmd;
  195. u8 reserved;
  196. struct hbm_version host_version;
  197. } __packed;
  198. struct hbm_host_version_response {
  199. u8 hbm_cmd;
  200. u8 host_version_supported;
  201. struct hbm_version me_max_version;
  202. } __packed;
  203. struct hbm_host_stop_request {
  204. u8 hbm_cmd;
  205. u8 reason;
  206. u8 reserved[2];
  207. } __packed;
  208. struct hbm_host_stop_response {
  209. u8 hbm_cmd;
  210. u8 reserved[3];
  211. } __packed;
  212. struct hbm_me_stop_request {
  213. u8 hbm_cmd;
  214. u8 reason;
  215. u8 reserved[2];
  216. } __packed;
  217. struct hbm_host_enum_request {
  218. u8 hbm_cmd;
  219. u8 reserved[3];
  220. } __packed;
  221. struct hbm_host_enum_response {
  222. u8 hbm_cmd;
  223. u8 reserved[3];
  224. u8 valid_addresses[32];
  225. } __packed;
  226. struct mei_client_properties {
  227. uuid_le protocol_name;
  228. u8 protocol_version;
  229. u8 max_number_of_connections;
  230. u8 fixed_address;
  231. u8 single_recv_buf;
  232. u32 max_msg_length;
  233. } __packed;
  234. struct hbm_props_request {
  235. u8 hbm_cmd;
  236. u8 address;
  237. u8 reserved[2];
  238. } __packed;
  239. struct hbm_props_response {
  240. u8 hbm_cmd;
  241. u8 address;
  242. u8 status;
  243. u8 reserved[1];
  244. struct mei_client_properties client_properties;
  245. } __packed;
  246. /**
  247. * struct hbm_client_connect_request - connect/disconnect request
  248. *
  249. * @hbm_cmd - bus message command header
  250. * @me_addr - address of the client in ME
  251. * @host_addr - address of the client in the driver
  252. * @reserved
  253. */
  254. struct hbm_client_connect_request {
  255. u8 hbm_cmd;
  256. u8 me_addr;
  257. u8 host_addr;
  258. u8 reserved;
  259. } __packed;
  260. /**
  261. * struct hbm_client_connect_response - connect/disconnect response
  262. *
  263. * @hbm_cmd - bus message command header
  264. * @me_addr - address of the client in ME
  265. * @host_addr - address of the client in the driver
  266. * @status - status of the request
  267. */
  268. struct hbm_client_connect_response {
  269. u8 hbm_cmd;
  270. u8 me_addr;
  271. u8 host_addr;
  272. u8 status;
  273. } __packed;
  274. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  275. struct hbm_flow_control {
  276. u8 hbm_cmd;
  277. u8 me_addr;
  278. u8 host_addr;
  279. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  280. } __packed;
  281. struct mei_me_client {
  282. struct mei_client_properties props;
  283. u8 client_id;
  284. u8 mei_flow_ctrl_creds;
  285. } __packed;
  286. #endif