hw.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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_HBM_TIMEOUT 1 /* 1 second */
  30. /*
  31. * MEI Version
  32. */
  33. #define HBM_MINOR_VERSION 1
  34. #define HBM_MAJOR_VERSION 1
  35. /*
  36. * MEI version with PGI support
  37. */
  38. #define HBM_MINOR_VERSION_PGI 1
  39. #define HBM_MAJOR_VERSION_PGI 1
  40. /* Host bus message command opcode */
  41. #define MEI_HBM_CMD_OP_MSK 0x7f
  42. /* Host bus message command RESPONSE */
  43. #define MEI_HBM_CMD_RES_MSK 0x80
  44. /*
  45. * MEI Bus Message Command IDs
  46. */
  47. #define HOST_START_REQ_CMD 0x01
  48. #define HOST_START_RES_CMD 0x81
  49. #define HOST_STOP_REQ_CMD 0x02
  50. #define HOST_STOP_RES_CMD 0x82
  51. #define ME_STOP_REQ_CMD 0x03
  52. #define HOST_ENUM_REQ_CMD 0x04
  53. #define HOST_ENUM_RES_CMD 0x84
  54. #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
  55. #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
  56. #define CLIENT_CONNECT_REQ_CMD 0x06
  57. #define CLIENT_CONNECT_RES_CMD 0x86
  58. #define CLIENT_DISCONNECT_REQ_CMD 0x07
  59. #define CLIENT_DISCONNECT_RES_CMD 0x87
  60. #define MEI_FLOW_CONTROL_CMD 0x08
  61. #define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
  62. #define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
  63. #define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
  64. #define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
  65. /*
  66. * MEI Stop Reason
  67. * used by hbm_host_stop_request.reason
  68. */
  69. enum mei_stop_reason_types {
  70. DRIVER_STOP_REQUEST = 0x00,
  71. DEVICE_D1_ENTRY = 0x01,
  72. DEVICE_D2_ENTRY = 0x02,
  73. DEVICE_D3_ENTRY = 0x03,
  74. SYSTEM_S1_ENTRY = 0x04,
  75. SYSTEM_S2_ENTRY = 0x05,
  76. SYSTEM_S3_ENTRY = 0x06,
  77. SYSTEM_S4_ENTRY = 0x07,
  78. SYSTEM_S5_ENTRY = 0x08
  79. };
  80. /**
  81. * enum mei_hbm_status - mei host bus messages return values
  82. *
  83. * @MEI_HBMS_SUCCESS : status success
  84. * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
  85. * @MEI_HBMS_ALREADY_EXISTS : connection already established
  86. * @MEI_HBMS_REJECTED : connection is rejected
  87. * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
  88. * @MEI_HBMS_NOT_ALLOWED : operation not allowed
  89. * @MEI_HBMS_ALREADY_STARTED : system is already started
  90. * @MEI_HBMS_NOT_STARTED : system not started
  91. *
  92. * @MEI_HBMS_MAX : sentinel
  93. */
  94. enum mei_hbm_status {
  95. MEI_HBMS_SUCCESS = 0,
  96. MEI_HBMS_CLIENT_NOT_FOUND = 1,
  97. MEI_HBMS_ALREADY_EXISTS = 2,
  98. MEI_HBMS_REJECTED = 3,
  99. MEI_HBMS_INVALID_PARAMETER = 4,
  100. MEI_HBMS_NOT_ALLOWED = 5,
  101. MEI_HBMS_ALREADY_STARTED = 6,
  102. MEI_HBMS_NOT_STARTED = 7,
  103. MEI_HBMS_MAX
  104. };
  105. /*
  106. * Client Connect Status
  107. * used by hbm_client_connect_response.status
  108. */
  109. enum mei_cl_connect_status {
  110. MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
  111. MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
  112. MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
  113. MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
  114. MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
  115. };
  116. /*
  117. * Client Disconnect Status
  118. */
  119. enum mei_cl_disconnect_status {
  120. MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
  121. };
  122. /*
  123. * MEI BUS Interface Section
  124. */
  125. struct mei_msg_hdr {
  126. u32 me_addr:8;
  127. u32 host_addr:8;
  128. u32 length:9;
  129. u32 reserved:5;
  130. u32 internal:1;
  131. u32 msg_complete:1;
  132. } __packed;
  133. struct mei_bus_message {
  134. u8 hbm_cmd;
  135. u8 data[0];
  136. } __packed;
  137. /**
  138. * struct hbm_cl_cmd - client specific host bus command
  139. * CONNECT, DISCONNECT, and FlOW CONTROL
  140. *
  141. * @hbm_cmd: bus message command header
  142. * @me_addr: address of the client in ME
  143. * @host_addr: address of the client in the driver
  144. * @data: generic data
  145. */
  146. struct mei_hbm_cl_cmd {
  147. u8 hbm_cmd;
  148. u8 me_addr;
  149. u8 host_addr;
  150. u8 data;
  151. };
  152. struct hbm_version {
  153. u8 minor_version;
  154. u8 major_version;
  155. } __packed;
  156. struct hbm_host_version_request {
  157. u8 hbm_cmd;
  158. u8 reserved;
  159. struct hbm_version host_version;
  160. } __packed;
  161. struct hbm_host_version_response {
  162. u8 hbm_cmd;
  163. u8 host_version_supported;
  164. struct hbm_version me_max_version;
  165. } __packed;
  166. struct hbm_host_stop_request {
  167. u8 hbm_cmd;
  168. u8 reason;
  169. u8 reserved[2];
  170. } __packed;
  171. struct hbm_host_stop_response {
  172. u8 hbm_cmd;
  173. u8 reserved[3];
  174. } __packed;
  175. struct hbm_me_stop_request {
  176. u8 hbm_cmd;
  177. u8 reason;
  178. u8 reserved[2];
  179. } __packed;
  180. struct hbm_host_enum_request {
  181. u8 hbm_cmd;
  182. u8 reserved[3];
  183. } __packed;
  184. struct hbm_host_enum_response {
  185. u8 hbm_cmd;
  186. u8 reserved[3];
  187. u8 valid_addresses[32];
  188. } __packed;
  189. struct mei_client_properties {
  190. uuid_le protocol_name;
  191. u8 protocol_version;
  192. u8 max_number_of_connections;
  193. u8 fixed_address;
  194. u8 single_recv_buf;
  195. u32 max_msg_length;
  196. } __packed;
  197. struct hbm_props_request {
  198. u8 hbm_cmd;
  199. u8 me_addr;
  200. u8 reserved[2];
  201. } __packed;
  202. struct hbm_props_response {
  203. u8 hbm_cmd;
  204. u8 me_addr;
  205. u8 status;
  206. u8 reserved[1];
  207. struct mei_client_properties client_properties;
  208. } __packed;
  209. /**
  210. * struct hbm_power_gate - power gate request/response
  211. *
  212. * @hbm_cmd: bus message command header
  213. * @reserved: reserved
  214. */
  215. struct hbm_power_gate {
  216. u8 hbm_cmd;
  217. u8 reserved[3];
  218. } __packed;
  219. /**
  220. * struct hbm_client_connect_request - connect/disconnect request
  221. *
  222. * @hbm_cmd: bus message command header
  223. * @me_addr: address of the client in ME
  224. * @host_addr: address of the client in the driver
  225. * @reserved: reserved
  226. */
  227. struct hbm_client_connect_request {
  228. u8 hbm_cmd;
  229. u8 me_addr;
  230. u8 host_addr;
  231. u8 reserved;
  232. } __packed;
  233. /**
  234. * struct hbm_client_connect_response - connect/disconnect response
  235. *
  236. * @hbm_cmd: bus message command header
  237. * @me_addr: address of the client in ME
  238. * @host_addr: address of the client in the driver
  239. * @status: status of the request
  240. */
  241. struct hbm_client_connect_response {
  242. u8 hbm_cmd;
  243. u8 me_addr;
  244. u8 host_addr;
  245. u8 status;
  246. } __packed;
  247. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  248. struct hbm_flow_control {
  249. u8 hbm_cmd;
  250. u8 me_addr;
  251. u8 host_addr;
  252. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  253. } __packed;
  254. #endif