hw.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. * Client Connect Status
  82. * used by hbm_client_connect_response.status
  83. */
  84. enum mei_cl_connect_status {
  85. MEI_CL_CONN_SUCCESS = 0x00,
  86. MEI_CL_CONN_NOT_FOUND = 0x01,
  87. MEI_CL_CONN_ALREADY_STARTED = 0x02,
  88. MEI_CL_CONN_OUT_OF_RESOURCES = 0x03,
  89. MEI_CL_CONN_MESSAGE_SMALL = 0x04
  90. };
  91. /*
  92. * Client Disconnect Status
  93. */
  94. enum mei_cl_disconnect_status {
  95. MEI_CL_DISCONN_SUCCESS = 0x00
  96. };
  97. /*
  98. * MEI BUS Interface Section
  99. */
  100. struct mei_msg_hdr {
  101. u32 me_addr:8;
  102. u32 host_addr:8;
  103. u32 length:9;
  104. u32 reserved:5;
  105. u32 internal:1;
  106. u32 msg_complete:1;
  107. } __packed;
  108. struct mei_bus_message {
  109. u8 hbm_cmd;
  110. u8 data[0];
  111. } __packed;
  112. /**
  113. * struct hbm_cl_cmd - client specific host bus command
  114. * CONNECT, DISCONNECT, and FlOW CONTROL
  115. *
  116. * @hbm_cmd - bus message command header
  117. * @me_addr - address of the client in ME
  118. * @host_addr - address of the client in the driver
  119. * @data
  120. */
  121. struct mei_hbm_cl_cmd {
  122. u8 hbm_cmd;
  123. u8 me_addr;
  124. u8 host_addr;
  125. u8 data;
  126. };
  127. struct hbm_version {
  128. u8 minor_version;
  129. u8 major_version;
  130. } __packed;
  131. struct hbm_host_version_request {
  132. u8 hbm_cmd;
  133. u8 reserved;
  134. struct hbm_version host_version;
  135. } __packed;
  136. struct hbm_host_version_response {
  137. u8 hbm_cmd;
  138. u8 host_version_supported;
  139. struct hbm_version me_max_version;
  140. } __packed;
  141. struct hbm_host_stop_request {
  142. u8 hbm_cmd;
  143. u8 reason;
  144. u8 reserved[2];
  145. } __packed;
  146. struct hbm_host_stop_response {
  147. u8 hbm_cmd;
  148. u8 reserved[3];
  149. } __packed;
  150. struct hbm_me_stop_request {
  151. u8 hbm_cmd;
  152. u8 reason;
  153. u8 reserved[2];
  154. } __packed;
  155. struct hbm_host_enum_request {
  156. u8 hbm_cmd;
  157. u8 reserved[3];
  158. } __packed;
  159. struct hbm_host_enum_response {
  160. u8 hbm_cmd;
  161. u8 reserved[3];
  162. u8 valid_addresses[32];
  163. } __packed;
  164. struct mei_client_properties {
  165. uuid_le protocol_name;
  166. u8 protocol_version;
  167. u8 max_number_of_connections;
  168. u8 fixed_address;
  169. u8 single_recv_buf;
  170. u32 max_msg_length;
  171. } __packed;
  172. struct hbm_props_request {
  173. u8 hbm_cmd;
  174. u8 address;
  175. u8 reserved[2];
  176. } __packed;
  177. struct hbm_props_response {
  178. u8 hbm_cmd;
  179. u8 address;
  180. u8 status;
  181. u8 reserved[1];
  182. struct mei_client_properties client_properties;
  183. } __packed;
  184. /**
  185. * struct hbm_power_gate - power gate request/response
  186. *
  187. * @hbm_cmd - bus message command header
  188. * @reserved[3]
  189. */
  190. struct hbm_power_gate {
  191. u8 hbm_cmd;
  192. u8 reserved[3];
  193. } __packed;
  194. /**
  195. * struct hbm_client_connect_request - connect/disconnect request
  196. *
  197. * @hbm_cmd - bus message command header
  198. * @me_addr - address of the client in ME
  199. * @host_addr - address of the client in the driver
  200. * @reserved
  201. */
  202. struct hbm_client_connect_request {
  203. u8 hbm_cmd;
  204. u8 me_addr;
  205. u8 host_addr;
  206. u8 reserved;
  207. } __packed;
  208. /**
  209. * struct hbm_client_connect_response - connect/disconnect response
  210. *
  211. * @hbm_cmd - bus message command header
  212. * @me_addr - address of the client in ME
  213. * @host_addr - address of the client in the driver
  214. * @status - status of the request
  215. */
  216. struct hbm_client_connect_response {
  217. u8 hbm_cmd;
  218. u8 me_addr;
  219. u8 host_addr;
  220. u8 status;
  221. } __packed;
  222. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  223. struct hbm_flow_control {
  224. u8 hbm_cmd;
  225. u8 me_addr;
  226. u8 host_addr;
  227. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  228. } __packed;
  229. #endif