hw.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. *
  3. * Intel Management Engine Interface (Intel MEI) Linux driver
  4. * Copyright (c) 2003-2011, 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
  21. */
  22. #define MEI_INTEROP_TIMEOUT (HZ * 7)
  23. #define MEI_CONNECT_TIMEOUT 3 /* at least 2 seconds */
  24. #define CONNECT_TIMEOUT 15 /* HPS definition */
  25. #define INIT_CLIENTS_TIMEOUT 15 /* HPS definition */
  26. #define IAMTHIF_STALL_TIMER 12 /* seconds */
  27. #define IAMTHIF_READ_TIMER 10000 /* ms */
  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 /* Cougerpoint */
  63. #define MEI_DEV_ID_PBG_1 0x1D3A /* PBG */
  64. #define MEI_DEV_ID_PPT_1 0x1E3A /* Pantherpoint PPT */
  65. #define MEI_DEV_ID_PPT_2 0x1CBA /* Pantherpoint PPT */
  66. #define MEI_DEV_ID_PPT_3 0x1DBA /* Pantherpoint PPT */
  67. /*
  68. * MEI HW Section
  69. */
  70. /* MEI registers */
  71. /* H_CB_WW - Host Circular Buffer (CB) Write Window register */
  72. #define H_CB_WW 0
  73. /* H_CSR - Host Control Status register */
  74. #define H_CSR 4
  75. /* ME_CB_RW - ME Circular Buffer Read Window register (read only) */
  76. #define ME_CB_RW 8
  77. /* ME_CSR_HA - ME Control Status Host Access register (read only) */
  78. #define ME_CSR_HA 0xC
  79. /* register bits of H_CSR (Host Control Status register) */
  80. /* Host Circular Buffer Depth - maximum number of 32-bit entries in CB */
  81. #define H_CBD 0xFF000000
  82. /* Host Circular Buffer Write Pointer */
  83. #define H_CBWP 0x00FF0000
  84. /* Host Circular Buffer Read Pointer */
  85. #define H_CBRP 0x0000FF00
  86. /* Host Reset */
  87. #define H_RST 0x00000010
  88. /* Host Ready */
  89. #define H_RDY 0x00000008
  90. /* Host Interrupt Generate */
  91. #define H_IG 0x00000004
  92. /* Host Interrupt Status */
  93. #define H_IS 0x00000002
  94. /* Host Interrupt Enable */
  95. #define H_IE 0x00000001
  96. /* register bits of ME_CSR_HA (ME Control Status Host Access register) */
  97. /* ME CB (Circular Buffer) Depth HRA (Host Read Access) - host read only
  98. access to ME_CBD */
  99. #define ME_CBD_HRA 0xFF000000
  100. /* ME CB Write Pointer HRA - host read only access to ME_CBWP */
  101. #define ME_CBWP_HRA 0x00FF0000
  102. /* ME CB Read Pointer HRA - host read only access to ME_CBRP */
  103. #define ME_CBRP_HRA 0x0000FF00
  104. /* ME Reset HRA - host read only access to ME_RST */
  105. #define ME_RST_HRA 0x00000010
  106. /* ME Ready HRA - host read only access to ME_RDY */
  107. #define ME_RDY_HRA 0x00000008
  108. /* ME Interrupt Generate HRA - host read only access to ME_IG */
  109. #define ME_IG_HRA 0x00000004
  110. /* ME Interrupt Status HRA - host read only access to ME_IS */
  111. #define ME_IS_HRA 0x00000002
  112. /* ME Interrupt Enable HRA - host read only access to ME_IE */
  113. #define ME_IE_HRA 0x00000001
  114. /*
  115. * MEI Version
  116. */
  117. #define HBM_MINOR_VERSION 0
  118. #define HBM_MAJOR_VERSION 1
  119. #define HBM_TIMEOUT 1 /* 1 second */
  120. /*
  121. * MEI Bus Message Command IDs
  122. */
  123. #define HOST_START_REQ_CMD 0x01
  124. #define HOST_START_RES_CMD 0x81
  125. #define HOST_STOP_REQ_CMD 0x02
  126. #define HOST_STOP_RES_CMD 0x82
  127. #define ME_STOP_REQ_CMD 0x03
  128. #define HOST_ENUM_REQ_CMD 0x04
  129. #define HOST_ENUM_RES_CMD 0x84
  130. #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
  131. #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
  132. #define CLIENT_CONNECT_REQ_CMD 0x06
  133. #define CLIENT_CONNECT_RES_CMD 0x86
  134. #define CLIENT_DISCONNECT_REQ_CMD 0x07
  135. #define CLIENT_DISCONNECT_RES_CMD 0x87
  136. #define MEI_FLOW_CONTROL_CMD 0x08
  137. /*
  138. * MEI Stop Reason
  139. * used by hbm_host_stop_request.reason
  140. */
  141. enum mei_stop_reason_types {
  142. DRIVER_STOP_REQUEST = 0x00,
  143. DEVICE_D1_ENTRY = 0x01,
  144. DEVICE_D2_ENTRY = 0x02,
  145. DEVICE_D3_ENTRY = 0x03,
  146. SYSTEM_S1_ENTRY = 0x04,
  147. SYSTEM_S2_ENTRY = 0x05,
  148. SYSTEM_S3_ENTRY = 0x06,
  149. SYSTEM_S4_ENTRY = 0x07,
  150. SYSTEM_S5_ENTRY = 0x08
  151. };
  152. /*
  153. * Client Connect Status
  154. * used by hbm_client_connect_response.status
  155. */
  156. enum client_connect_status_types {
  157. CCS_SUCCESS = 0x00,
  158. CCS_NOT_FOUND = 0x01,
  159. CCS_ALREADY_STARTED = 0x02,
  160. CCS_OUT_OF_RESOURCES = 0x03,
  161. CCS_MESSAGE_SMALL = 0x04
  162. };
  163. /*
  164. * Client Disconnect Status
  165. */
  166. enum client_disconnect_status_types {
  167. CDS_SUCCESS = 0x00
  168. };
  169. /*
  170. * MEI BUS Interface Section
  171. */
  172. struct mei_msg_hdr {
  173. u32 me_addr:8;
  174. u32 host_addr:8;
  175. u32 length:9;
  176. u32 reserved:6;
  177. u32 msg_complete:1;
  178. } __packed;
  179. struct hbm_cmd {
  180. u8 cmd:7;
  181. u8 is_response:1;
  182. } __packed;
  183. struct mei_bus_message {
  184. struct hbm_cmd cmd;
  185. u8 command_specific_data[];
  186. } __packed;
  187. struct hbm_version {
  188. u8 minor_version;
  189. u8 major_version;
  190. } __packed;
  191. struct hbm_host_version_request {
  192. struct hbm_cmd cmd;
  193. u8 reserved;
  194. struct hbm_version host_version;
  195. } __packed;
  196. struct hbm_host_version_response {
  197. struct hbm_cmd cmd;
  198. int host_version_supported;
  199. struct hbm_version me_max_version;
  200. } __packed;
  201. struct hbm_host_stop_request {
  202. struct hbm_cmd cmd;
  203. u8 reason;
  204. u8 reserved[2];
  205. } __packed;
  206. struct hbm_host_stop_response {
  207. struct hbm_cmd cmd;
  208. u8 reserved[3];
  209. } __packed;
  210. struct hbm_me_stop_request {
  211. struct hbm_cmd cmd;
  212. u8 reason;
  213. u8 reserved[2];
  214. } __packed;
  215. struct hbm_host_enum_request {
  216. struct hbm_cmd cmd;
  217. u8 reserved[3];
  218. } __packed;
  219. struct hbm_host_enum_response {
  220. struct hbm_cmd cmd;
  221. u8 reserved[3];
  222. u8 valid_addresses[32];
  223. } __packed;
  224. struct mei_client_properties {
  225. uuid_le protocol_name;
  226. u8 protocol_version;
  227. u8 max_number_of_connections;
  228. u8 fixed_address;
  229. u8 single_recv_buf;
  230. u32 max_msg_length;
  231. } __packed;
  232. struct hbm_props_request {
  233. struct hbm_cmd cmd;
  234. u8 address;
  235. u8 reserved[2];
  236. } __packed;
  237. struct hbm_props_response {
  238. struct hbm_cmd cmd;
  239. u8 address;
  240. u8 status;
  241. u8 reserved[1];
  242. struct mei_client_properties client_properties;
  243. } __packed;
  244. struct hbm_client_connect_request {
  245. struct hbm_cmd cmd;
  246. u8 me_addr;
  247. u8 host_addr;
  248. u8 reserved;
  249. } __packed;
  250. struct hbm_client_connect_response {
  251. struct hbm_cmd cmd;
  252. u8 me_addr;
  253. u8 host_addr;
  254. u8 status;
  255. } __packed;
  256. struct hbm_client_disconnect_request {
  257. struct hbm_cmd cmd;
  258. u8 me_addr;
  259. u8 host_addr;
  260. u8 reserved[1];
  261. } __packed;
  262. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  263. struct hbm_flow_control {
  264. struct hbm_cmd cmd;
  265. u8 me_addr;
  266. u8 host_addr;
  267. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  268. } __packed;
  269. struct mei_me_client {
  270. struct mei_client_properties props;
  271. u8 client_id;
  272. u8 mei_flow_ctrl_creds;
  273. } __packed;
  274. #endif