hw.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. * MEI Version
  30. */
  31. #define HBM_MINOR_VERSION 0
  32. #define HBM_MAJOR_VERSION 1
  33. #define HBM_TIMEOUT 1 /* 1 second */
  34. /* Host bus message command opcode */
  35. #define MEI_HBM_CMD_OP_MSK 0x7f
  36. /* Host bus message command RESPONSE */
  37. #define MEI_HBM_CMD_RES_MSK 0x80
  38. /*
  39. * MEI Bus Message Command IDs
  40. */
  41. #define HOST_START_REQ_CMD 0x01
  42. #define HOST_START_RES_CMD 0x81
  43. #define HOST_STOP_REQ_CMD 0x02
  44. #define HOST_STOP_RES_CMD 0x82
  45. #define ME_STOP_REQ_CMD 0x03
  46. #define HOST_ENUM_REQ_CMD 0x04
  47. #define HOST_ENUM_RES_CMD 0x84
  48. #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
  49. #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
  50. #define CLIENT_CONNECT_REQ_CMD 0x06
  51. #define CLIENT_CONNECT_RES_CMD 0x86
  52. #define CLIENT_DISCONNECT_REQ_CMD 0x07
  53. #define CLIENT_DISCONNECT_RES_CMD 0x87
  54. #define MEI_FLOW_CONTROL_CMD 0x08
  55. /*
  56. * MEI Stop Reason
  57. * used by hbm_host_stop_request.reason
  58. */
  59. enum mei_stop_reason_types {
  60. DRIVER_STOP_REQUEST = 0x00,
  61. DEVICE_D1_ENTRY = 0x01,
  62. DEVICE_D2_ENTRY = 0x02,
  63. DEVICE_D3_ENTRY = 0x03,
  64. SYSTEM_S1_ENTRY = 0x04,
  65. SYSTEM_S2_ENTRY = 0x05,
  66. SYSTEM_S3_ENTRY = 0x06,
  67. SYSTEM_S4_ENTRY = 0x07,
  68. SYSTEM_S5_ENTRY = 0x08
  69. };
  70. /*
  71. * Client Connect Status
  72. * used by hbm_client_connect_response.status
  73. */
  74. enum client_connect_status_types {
  75. CCS_SUCCESS = 0x00,
  76. CCS_NOT_FOUND = 0x01,
  77. CCS_ALREADY_STARTED = 0x02,
  78. CCS_OUT_OF_RESOURCES = 0x03,
  79. CCS_MESSAGE_SMALL = 0x04
  80. };
  81. /*
  82. * Client Disconnect Status
  83. */
  84. enum client_disconnect_status_types {
  85. CDS_SUCCESS = 0x00
  86. };
  87. /*
  88. * MEI BUS Interface Section
  89. */
  90. struct mei_msg_hdr {
  91. u32 me_addr:8;
  92. u32 host_addr:8;
  93. u32 length:9;
  94. u32 reserved:6;
  95. u32 msg_complete:1;
  96. } __packed;
  97. struct mei_bus_message {
  98. u8 hbm_cmd;
  99. u8 data[0];
  100. } __packed;
  101. /**
  102. * struct hbm_cl_cmd - client specific host bus command
  103. * CONNECT, DISCONNECT, and FlOW CONTROL
  104. *
  105. * @hbm_cmd - bus message command header
  106. * @me_addr - address of the client in ME
  107. * @host_addr - address of the client in the driver
  108. * @data
  109. */
  110. struct mei_hbm_cl_cmd {
  111. u8 hbm_cmd;
  112. u8 me_addr;
  113. u8 host_addr;
  114. u8 data;
  115. };
  116. struct hbm_version {
  117. u8 minor_version;
  118. u8 major_version;
  119. } __packed;
  120. struct hbm_host_version_request {
  121. u8 hbm_cmd;
  122. u8 reserved;
  123. struct hbm_version host_version;
  124. } __packed;
  125. struct hbm_host_version_response {
  126. u8 hbm_cmd;
  127. u8 host_version_supported;
  128. struct hbm_version me_max_version;
  129. } __packed;
  130. struct hbm_host_stop_request {
  131. u8 hbm_cmd;
  132. u8 reason;
  133. u8 reserved[2];
  134. } __packed;
  135. struct hbm_host_stop_response {
  136. u8 hbm_cmd;
  137. u8 reserved[3];
  138. } __packed;
  139. struct hbm_me_stop_request {
  140. u8 hbm_cmd;
  141. u8 reason;
  142. u8 reserved[2];
  143. } __packed;
  144. struct hbm_host_enum_request {
  145. u8 hbm_cmd;
  146. u8 reserved[3];
  147. } __packed;
  148. struct hbm_host_enum_response {
  149. u8 hbm_cmd;
  150. u8 reserved[3];
  151. u8 valid_addresses[32];
  152. } __packed;
  153. struct mei_client_properties {
  154. uuid_le protocol_name;
  155. u8 protocol_version;
  156. u8 max_number_of_connections;
  157. u8 fixed_address;
  158. u8 single_recv_buf;
  159. u32 max_msg_length;
  160. } __packed;
  161. struct hbm_props_request {
  162. u8 hbm_cmd;
  163. u8 address;
  164. u8 reserved[2];
  165. } __packed;
  166. struct hbm_props_response {
  167. u8 hbm_cmd;
  168. u8 address;
  169. u8 status;
  170. u8 reserved[1];
  171. struct mei_client_properties client_properties;
  172. } __packed;
  173. /**
  174. * struct hbm_client_connect_request - connect/disconnect request
  175. *
  176. * @hbm_cmd - bus message command header
  177. * @me_addr - address of the client in ME
  178. * @host_addr - address of the client in the driver
  179. * @reserved
  180. */
  181. struct hbm_client_connect_request {
  182. u8 hbm_cmd;
  183. u8 me_addr;
  184. u8 host_addr;
  185. u8 reserved;
  186. } __packed;
  187. /**
  188. * struct hbm_client_connect_response - connect/disconnect response
  189. *
  190. * @hbm_cmd - bus message command header
  191. * @me_addr - address of the client in ME
  192. * @host_addr - address of the client in the driver
  193. * @status - status of the request
  194. */
  195. struct hbm_client_connect_response {
  196. u8 hbm_cmd;
  197. u8 me_addr;
  198. u8 host_addr;
  199. u8 status;
  200. } __packed;
  201. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  202. struct hbm_flow_control {
  203. u8 hbm_cmd;
  204. u8 me_addr;
  205. u8 host_addr;
  206. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  207. } __packed;
  208. #endif