hw.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2003-2022, Intel Corporation. All rights reserved
  4. * Intel Management Engine Interface (Intel MEI) Linux driver
  5. */
  6. #ifndef _MEI_HW_TYPES_H_
  7. #define _MEI_HW_TYPES_H_
  8. #include <linux/mei.h>
  9. /*
  10. * Timeouts in Seconds
  11. */
  12. #define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */
  13. #define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */
  14. #define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
  15. #define MEI_CL_CONNECT_TIMEOUT_SLOW 30 /* HPS: Client Connect Timeout, slow FW */
  16. #define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */
  17. #define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */
  18. #define MEI_D0I3_TIMEOUT 5 /* D0i3 set/unset max response time */
  19. #define MEI_HBM_TIMEOUT 1 /* 1 second */
  20. #define MEI_HBM_TIMEOUT_SLOW 5 /* 5 second, slow FW */
  21. #define MKHI_RCV_TIMEOUT 500 /* receive timeout in msec */
  22. #define MKHI_RCV_TIMEOUT_SLOW 10000 /* receive timeout in msec, slow FW */
  23. #define MEI_LINK_RESET_WAIT_TIMEOUT_MSEC 500 /* Max wait timeout for link reset, in msec */
  24. /*
  25. * FW page size for DMA allocations
  26. */
  27. #define MEI_FW_PAGE_SIZE 4096UL
  28. /*
  29. * MEI Version
  30. */
  31. #define HBM_MINOR_VERSION 2
  32. #define HBM_MAJOR_VERSION 2
  33. /*
  34. * MEI version with PGI support
  35. */
  36. #define HBM_MINOR_VERSION_PGI 1
  37. #define HBM_MAJOR_VERSION_PGI 1
  38. /*
  39. * MEI version with Dynamic clients support
  40. */
  41. #define HBM_MINOR_VERSION_DC 0
  42. #define HBM_MAJOR_VERSION_DC 2
  43. /*
  44. * MEI version with immediate reply to enum request support
  45. */
  46. #define HBM_MINOR_VERSION_IE 0
  47. #define HBM_MAJOR_VERSION_IE 2
  48. /*
  49. * MEI version with disconnect on connection timeout support
  50. */
  51. #define HBM_MINOR_VERSION_DOT 0
  52. #define HBM_MAJOR_VERSION_DOT 2
  53. /*
  54. * MEI version with notification support
  55. */
  56. #define HBM_MINOR_VERSION_EV 0
  57. #define HBM_MAJOR_VERSION_EV 2
  58. /*
  59. * MEI version with fixed address client support
  60. */
  61. #define HBM_MINOR_VERSION_FA 0
  62. #define HBM_MAJOR_VERSION_FA 2
  63. /*
  64. * MEI version with OS ver message support
  65. */
  66. #define HBM_MINOR_VERSION_OS 0
  67. #define HBM_MAJOR_VERSION_OS 2
  68. /*
  69. * MEI version with dma ring support
  70. */
  71. #define HBM_MINOR_VERSION_DR 1
  72. #define HBM_MAJOR_VERSION_DR 2
  73. /*
  74. * MEI version with vm tag support
  75. */
  76. #define HBM_MINOR_VERSION_VT 2
  77. #define HBM_MAJOR_VERSION_VT 2
  78. /*
  79. * MEI version with GSC support
  80. */
  81. #define HBM_MINOR_VERSION_GSC 2
  82. #define HBM_MAJOR_VERSION_GSC 2
  83. /*
  84. * MEI version with capabilities message support
  85. */
  86. #define HBM_MINOR_VERSION_CAP 2
  87. #define HBM_MAJOR_VERSION_CAP 2
  88. /*
  89. * MEI version with client DMA support
  90. */
  91. #define HBM_MINOR_VERSION_CD 2
  92. #define HBM_MAJOR_VERSION_CD 2
  93. /* Host bus message command opcode */
  94. #define MEI_HBM_CMD_OP_MSK 0x7f
  95. /* Host bus message command RESPONSE */
  96. #define MEI_HBM_CMD_RES_MSK 0x80
  97. /*
  98. * MEI Bus Message Command IDs
  99. */
  100. #define HOST_START_REQ_CMD 0x01
  101. #define HOST_START_RES_CMD 0x81
  102. #define HOST_STOP_REQ_CMD 0x02
  103. #define HOST_STOP_RES_CMD 0x82
  104. #define ME_STOP_REQ_CMD 0x03
  105. #define HOST_ENUM_REQ_CMD 0x04
  106. #define HOST_ENUM_RES_CMD 0x84
  107. #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
  108. #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
  109. #define CLIENT_CONNECT_REQ_CMD 0x06
  110. #define CLIENT_CONNECT_RES_CMD 0x86
  111. #define CLIENT_DISCONNECT_REQ_CMD 0x07
  112. #define CLIENT_DISCONNECT_RES_CMD 0x87
  113. #define MEI_FLOW_CONTROL_CMD 0x08
  114. #define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a
  115. #define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a
  116. #define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b
  117. #define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b
  118. #define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f
  119. #define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f
  120. #define MEI_HBM_NOTIFY_REQ_CMD 0x10
  121. #define MEI_HBM_NOTIFY_RES_CMD 0x90
  122. #define MEI_HBM_NOTIFICATION_CMD 0x11
  123. #define MEI_HBM_DMA_SETUP_REQ_CMD 0x12
  124. #define MEI_HBM_DMA_SETUP_RES_CMD 0x92
  125. #define MEI_HBM_CAPABILITIES_REQ_CMD 0x13
  126. #define MEI_HBM_CAPABILITIES_RES_CMD 0x93
  127. #define MEI_HBM_CLIENT_DMA_MAP_REQ_CMD 0x14
  128. #define MEI_HBM_CLIENT_DMA_MAP_RES_CMD 0x94
  129. #define MEI_HBM_CLIENT_DMA_UNMAP_REQ_CMD 0x15
  130. #define MEI_HBM_CLIENT_DMA_UNMAP_RES_CMD 0x95
  131. /*
  132. * MEI Stop Reason
  133. * used by hbm_host_stop_request.reason
  134. */
  135. enum mei_stop_reason_types {
  136. DRIVER_STOP_REQUEST = 0x00,
  137. DEVICE_D1_ENTRY = 0x01,
  138. DEVICE_D2_ENTRY = 0x02,
  139. DEVICE_D3_ENTRY = 0x03,
  140. SYSTEM_S1_ENTRY = 0x04,
  141. SYSTEM_S2_ENTRY = 0x05,
  142. SYSTEM_S3_ENTRY = 0x06,
  143. SYSTEM_S4_ENTRY = 0x07,
  144. SYSTEM_S5_ENTRY = 0x08
  145. };
  146. /**
  147. * enum mei_hbm_status - mei host bus messages return values
  148. *
  149. * @MEI_HBMS_SUCCESS : status success
  150. * @MEI_HBMS_CLIENT_NOT_FOUND : client not found
  151. * @MEI_HBMS_ALREADY_EXISTS : connection already established
  152. * @MEI_HBMS_REJECTED : connection is rejected
  153. * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
  154. * @MEI_HBMS_NOT_ALLOWED : operation not allowed
  155. * @MEI_HBMS_ALREADY_STARTED : system is already started
  156. * @MEI_HBMS_NOT_STARTED : system not started
  157. *
  158. * @MEI_HBMS_MAX : sentinel
  159. */
  160. enum mei_hbm_status {
  161. MEI_HBMS_SUCCESS = 0,
  162. MEI_HBMS_CLIENT_NOT_FOUND = 1,
  163. MEI_HBMS_ALREADY_EXISTS = 2,
  164. MEI_HBMS_REJECTED = 3,
  165. MEI_HBMS_INVALID_PARAMETER = 4,
  166. MEI_HBMS_NOT_ALLOWED = 5,
  167. MEI_HBMS_ALREADY_STARTED = 6,
  168. MEI_HBMS_NOT_STARTED = 7,
  169. MEI_HBMS_MAX
  170. };
  171. /*
  172. * Client Connect Status
  173. * used by hbm_client_connect_response.status
  174. */
  175. enum mei_cl_connect_status {
  176. MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS,
  177. MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND,
  178. MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS,
  179. MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
  180. MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER,
  181. MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED,
  182. };
  183. /*
  184. * Client Disconnect Status
  185. */
  186. enum mei_cl_disconnect_status {
  187. MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
  188. };
  189. /**
  190. * enum mei_ext_hdr_type - extended header type used in
  191. * extended header TLV
  192. *
  193. * @MEI_EXT_HDR_NONE: sentinel
  194. * @MEI_EXT_HDR_VTAG: vtag header
  195. * @MEI_EXT_HDR_GSC: gsc header
  196. */
  197. enum mei_ext_hdr_type {
  198. MEI_EXT_HDR_NONE = 0,
  199. MEI_EXT_HDR_VTAG = 1,
  200. MEI_EXT_HDR_GSC = 2,
  201. };
  202. /**
  203. * struct mei_ext_hdr - extend header descriptor (TLV)
  204. * @type: enum mei_ext_hdr_type
  205. * @length: length excluding descriptor
  206. */
  207. struct mei_ext_hdr {
  208. u8 type;
  209. u8 length;
  210. } __packed;
  211. /**
  212. * struct mei_ext_meta_hdr - extend header meta data
  213. * @count: number of headers
  214. * @size: total size of the extended header list excluding meta header
  215. * @reserved: reserved
  216. * @hdrs: extended headers TLV list
  217. */
  218. struct mei_ext_meta_hdr {
  219. u8 count;
  220. u8 size;
  221. u8 reserved[2];
  222. u8 hdrs[];
  223. } __packed;
  224. /**
  225. * struct mei_ext_hdr_vtag - extend header for vtag
  226. *
  227. * @hdr: standard extend header
  228. * @vtag: virtual tag
  229. * @reserved: reserved
  230. */
  231. struct mei_ext_hdr_vtag {
  232. struct mei_ext_hdr hdr;
  233. u8 vtag;
  234. u8 reserved;
  235. } __packed;
  236. /*
  237. * Extended header iterator functions
  238. */
  239. /**
  240. * mei_ext_begin - extended header iterator begin
  241. *
  242. * @meta: meta header of the extended header list
  243. *
  244. * Return: The first extended header
  245. */
  246. static inline struct mei_ext_hdr *mei_ext_begin(struct mei_ext_meta_hdr *meta)
  247. {
  248. return (struct mei_ext_hdr *)meta->hdrs;
  249. }
  250. /**
  251. * mei_ext_last - check if the ext is the last one in the TLV list
  252. *
  253. * @meta: meta header of the extended header list
  254. * @ext: a meta header on the list
  255. *
  256. * Return: true if ext is the last header on the list
  257. */
  258. static inline bool mei_ext_last(struct mei_ext_meta_hdr *meta,
  259. struct mei_ext_hdr *ext)
  260. {
  261. return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4);
  262. }
  263. struct mei_gsc_sgl {
  264. u32 low;
  265. u32 high;
  266. u32 length;
  267. } __packed;
  268. #define GSC_HECI_MSG_KERNEL 0
  269. #define GSC_HECI_MSG_USER 1
  270. #define GSC_ADDRESS_TYPE_GTT 0
  271. #define GSC_ADDRESS_TYPE_PPGTT 1
  272. #define GSC_ADDRESS_TYPE_PHYSICAL_CONTINUOUS 2 /* max of 64K */
  273. #define GSC_ADDRESS_TYPE_PHYSICAL_SGL 3
  274. /**
  275. * struct mei_ext_hdr_gsc_h2f - extended header: gsc host to firmware interface
  276. *
  277. * @hdr: extended header
  278. * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER
  279. * @addr_type: GSC_ADDRESS_TYPE_{GTT, PPGTT, PHYSICAL_CONTINUOUS, PHYSICAL_SGL}
  280. * @fence_id: synchronization marker
  281. * @input_address_count: number of input sgl buffers
  282. * @output_address_count: number of output sgl buffers
  283. * @reserved: reserved
  284. * @sgl: sg list
  285. */
  286. struct mei_ext_hdr_gsc_h2f {
  287. struct mei_ext_hdr hdr;
  288. u8 client_id;
  289. u8 addr_type;
  290. u32 fence_id;
  291. u8 input_address_count;
  292. u8 output_address_count;
  293. u8 reserved[2];
  294. struct mei_gsc_sgl sgl[];
  295. } __packed;
  296. /**
  297. * struct mei_ext_hdr_gsc_f2h - gsc firmware to host interface
  298. *
  299. * @hdr: extended header
  300. * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER
  301. * @reserved: reserved
  302. * @fence_id: synchronization marker
  303. * @written: number of bytes written to firmware
  304. */
  305. struct mei_ext_hdr_gsc_f2h {
  306. struct mei_ext_hdr hdr;
  307. u8 client_id;
  308. u8 reserved;
  309. u32 fence_id;
  310. u32 written;
  311. } __packed;
  312. /**
  313. * mei_ext_next - following extended header on the TLV list
  314. *
  315. * @ext: current extend header
  316. *
  317. * Context: The function does not check for the overflows,
  318. * one should call mei_ext_last before.
  319. *
  320. * Return: The following extend header after @ext
  321. */
  322. static inline struct mei_ext_hdr *mei_ext_next(struct mei_ext_hdr *ext)
  323. {
  324. return (struct mei_ext_hdr *)((u8 *)ext + (ext->length * 4));
  325. }
  326. /**
  327. * mei_ext_hdr_len - get ext header length in bytes
  328. *
  329. * @ext: extend header
  330. *
  331. * Return: extend header length in bytes
  332. */
  333. static inline u32 mei_ext_hdr_len(const struct mei_ext_hdr *ext)
  334. {
  335. if (!ext)
  336. return 0;
  337. return ext->length * sizeof(u32);
  338. }
  339. /**
  340. * struct mei_msg_hdr - MEI BUS Interface Section
  341. *
  342. * @me_addr: device address
  343. * @host_addr: host address
  344. * @length: message length
  345. * @reserved: reserved
  346. * @extended: message has extended header
  347. * @dma_ring: message is on dma ring
  348. * @internal: message is internal
  349. * @msg_complete: last packet of the message
  350. * @extension: extension of the header
  351. */
  352. struct mei_msg_hdr {
  353. u32 me_addr:8;
  354. u32 host_addr:8;
  355. u32 length:9;
  356. u32 reserved:3;
  357. u32 extended:1;
  358. u32 dma_ring:1;
  359. u32 internal:1;
  360. u32 msg_complete:1;
  361. u32 extension[];
  362. } __packed;
  363. /* The length is up to 9 bits */
  364. #define MEI_MSG_MAX_LEN_MASK GENMASK(9, 0)
  365. struct mei_bus_message {
  366. u8 hbm_cmd;
  367. u8 data[];
  368. } __packed;
  369. /**
  370. * struct mei_hbm_cl_cmd - client specific host bus command
  371. * CONNECT, DISCONNECT, and FlOW CONTROL
  372. *
  373. * @hbm_cmd: bus message command header
  374. * @me_addr: address of the client in ME
  375. * @host_addr: address of the client in the driver
  376. * @data: generic data
  377. */
  378. struct mei_hbm_cl_cmd {
  379. u8 hbm_cmd;
  380. u8 me_addr;
  381. u8 host_addr;
  382. u8 data;
  383. };
  384. struct hbm_version {
  385. u8 minor_version;
  386. u8 major_version;
  387. } __packed;
  388. struct hbm_host_version_request {
  389. u8 hbm_cmd;
  390. u8 reserved;
  391. struct hbm_version host_version;
  392. } __packed;
  393. struct hbm_host_version_response {
  394. u8 hbm_cmd;
  395. u8 host_version_supported;
  396. struct hbm_version me_max_version;
  397. } __packed;
  398. struct hbm_host_stop_request {
  399. u8 hbm_cmd;
  400. u8 reason;
  401. u8 reserved[2];
  402. } __packed;
  403. struct hbm_host_stop_response {
  404. u8 hbm_cmd;
  405. u8 reserved[3];
  406. } __packed;
  407. struct hbm_me_stop_request {
  408. u8 hbm_cmd;
  409. u8 reason;
  410. u8 reserved[2];
  411. } __packed;
  412. /**
  413. * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
  414. *
  415. * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
  416. * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
  417. */
  418. enum hbm_host_enum_flags {
  419. MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
  420. MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
  421. };
  422. /**
  423. * struct hbm_host_enum_request - enumeration request from host to fw
  424. *
  425. * @hbm_cmd : bus message command header
  426. * @flags : request flags
  427. * @reserved: reserved
  428. */
  429. struct hbm_host_enum_request {
  430. u8 hbm_cmd;
  431. u8 flags;
  432. u8 reserved[2];
  433. } __packed;
  434. struct hbm_host_enum_response {
  435. u8 hbm_cmd;
  436. u8 reserved[3];
  437. u8 valid_addresses[32];
  438. } __packed;
  439. /**
  440. * struct mei_client_properties - mei client properties
  441. *
  442. * @protocol_name: guid of the client
  443. * @protocol_version: client protocol version
  444. * @max_number_of_connections: number of possible connections.
  445. * @fixed_address: fixed me address (0 if the client is dynamic)
  446. * @single_recv_buf: 1 if all connections share a single receive buffer.
  447. * @vt_supported: the client support vtag
  448. * @reserved: reserved
  449. * @max_msg_length: MTU of the client
  450. */
  451. struct mei_client_properties {
  452. uuid_le protocol_name;
  453. u8 protocol_version;
  454. u8 max_number_of_connections;
  455. u8 fixed_address;
  456. u8 single_recv_buf:1;
  457. u8 vt_supported:1;
  458. u8 reserved:6;
  459. u32 max_msg_length;
  460. } __packed;
  461. struct hbm_props_request {
  462. u8 hbm_cmd;
  463. u8 me_addr;
  464. u8 reserved[2];
  465. } __packed;
  466. struct hbm_props_response {
  467. u8 hbm_cmd;
  468. u8 me_addr;
  469. u8 status;
  470. u8 reserved;
  471. struct mei_client_properties client_properties;
  472. } __packed;
  473. /**
  474. * struct hbm_add_client_request - request to add a client
  475. * might be sent by fw after enumeration has already completed
  476. *
  477. * @hbm_cmd: bus message command header
  478. * @me_addr: address of the client in ME
  479. * @reserved: reserved
  480. * @client_properties: client properties
  481. */
  482. struct hbm_add_client_request {
  483. u8 hbm_cmd;
  484. u8 me_addr;
  485. u8 reserved[2];
  486. struct mei_client_properties client_properties;
  487. } __packed;
  488. /**
  489. * struct hbm_add_client_response - response to add a client
  490. * sent by the host to report client addition status to fw
  491. *
  492. * @hbm_cmd: bus message command header
  493. * @me_addr: address of the client in ME
  494. * @status: if HBMS_SUCCESS then the client can now accept connections.
  495. * @reserved: reserved
  496. */
  497. struct hbm_add_client_response {
  498. u8 hbm_cmd;
  499. u8 me_addr;
  500. u8 status;
  501. u8 reserved;
  502. } __packed;
  503. /**
  504. * struct hbm_power_gate - power gate request/response
  505. *
  506. * @hbm_cmd: bus message command header
  507. * @reserved: reserved
  508. */
  509. struct hbm_power_gate {
  510. u8 hbm_cmd;
  511. u8 reserved[3];
  512. } __packed;
  513. /**
  514. * struct hbm_client_connect_request - connect/disconnect request
  515. *
  516. * @hbm_cmd: bus message command header
  517. * @me_addr: address of the client in ME
  518. * @host_addr: address of the client in the driver
  519. * @reserved: reserved
  520. */
  521. struct hbm_client_connect_request {
  522. u8 hbm_cmd;
  523. u8 me_addr;
  524. u8 host_addr;
  525. u8 reserved;
  526. } __packed;
  527. /**
  528. * struct hbm_client_connect_response - connect/disconnect response
  529. *
  530. * @hbm_cmd: bus message command header
  531. * @me_addr: address of the client in ME
  532. * @host_addr: address of the client in the driver
  533. * @status: status of the request
  534. */
  535. struct hbm_client_connect_response {
  536. u8 hbm_cmd;
  537. u8 me_addr;
  538. u8 host_addr;
  539. u8 status;
  540. } __packed;
  541. #define MEI_FC_MESSAGE_RESERVED_LENGTH 5
  542. struct hbm_flow_control {
  543. u8 hbm_cmd;
  544. u8 me_addr;
  545. u8 host_addr;
  546. u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
  547. } __packed;
  548. #define MEI_HBM_NOTIFICATION_START 1
  549. #define MEI_HBM_NOTIFICATION_STOP 0
  550. /**
  551. * struct hbm_notification_request - start/stop notification request
  552. *
  553. * @hbm_cmd: bus message command header
  554. * @me_addr: address of the client in ME
  555. * @host_addr: address of the client in the driver
  556. * @start: start = 1 or stop = 0 asynchronous notifications
  557. */
  558. struct hbm_notification_request {
  559. u8 hbm_cmd;
  560. u8 me_addr;
  561. u8 host_addr;
  562. u8 start;
  563. } __packed;
  564. /**
  565. * struct hbm_notification_response - start/stop notification response
  566. *
  567. * @hbm_cmd: bus message command header
  568. * @me_addr: address of the client in ME
  569. * @host_addr: - address of the client in the driver
  570. * @status: (mei_hbm_status) response status for the request
  571. * - MEI_HBMS_SUCCESS: successful stop/start
  572. * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
  573. * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
  574. * started notification.
  575. * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
  576. * asynchronous notifications are currently disabled.
  577. *
  578. * @start: start = 1 or stop = 0 asynchronous notifications
  579. * @reserved: reserved
  580. */
  581. struct hbm_notification_response {
  582. u8 hbm_cmd;
  583. u8 me_addr;
  584. u8 host_addr;
  585. u8 status;
  586. u8 start;
  587. u8 reserved[3];
  588. } __packed;
  589. /**
  590. * struct hbm_notification - notification event
  591. *
  592. * @hbm_cmd: bus message command header
  593. * @me_addr: address of the client in ME
  594. * @host_addr: address of the client in the driver
  595. * @reserved: reserved for alignment
  596. */
  597. struct hbm_notification {
  598. u8 hbm_cmd;
  599. u8 me_addr;
  600. u8 host_addr;
  601. u8 reserved;
  602. } __packed;
  603. /**
  604. * struct hbm_dma_mem_dscr - dma ring
  605. *
  606. * @addr_hi: the high 32bits of 64 bit address
  607. * @addr_lo: the low 32bits of 64 bit address
  608. * @size : size in bytes (must be power of 2)
  609. */
  610. struct hbm_dma_mem_dscr {
  611. u32 addr_hi;
  612. u32 addr_lo;
  613. u32 size;
  614. } __packed;
  615. enum {
  616. DMA_DSCR_HOST = 0,
  617. DMA_DSCR_DEVICE = 1,
  618. DMA_DSCR_CTRL = 2,
  619. DMA_DSCR_NUM,
  620. };
  621. /**
  622. * struct hbm_dma_setup_request - dma setup request
  623. *
  624. * @hbm_cmd: bus message command header
  625. * @reserved: reserved for alignment
  626. * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
  627. */
  628. struct hbm_dma_setup_request {
  629. u8 hbm_cmd;
  630. u8 reserved[3];
  631. struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
  632. } __packed;
  633. /**
  634. * struct hbm_dma_setup_response - dma setup response
  635. *
  636. * @hbm_cmd: bus message command header
  637. * @status: 0 on success; otherwise DMA setup failed.
  638. * @reserved: reserved for alignment
  639. */
  640. struct hbm_dma_setup_response {
  641. u8 hbm_cmd;
  642. u8 status;
  643. u8 reserved[2];
  644. } __packed;
  645. /**
  646. * struct hbm_dma_ring_ctrl - dma ring control block
  647. *
  648. * @hbuf_wr_idx: host circular buffer write index in slots
  649. * @reserved1: reserved for alignment
  650. * @hbuf_rd_idx: host circular buffer read index in slots
  651. * @reserved2: reserved for alignment
  652. * @dbuf_wr_idx: device circular buffer write index in slots
  653. * @reserved3: reserved for alignment
  654. * @dbuf_rd_idx: device circular buffer read index in slots
  655. * @reserved4: reserved for alignment
  656. */
  657. struct hbm_dma_ring_ctrl {
  658. u32 hbuf_wr_idx;
  659. u32 reserved1;
  660. u32 hbuf_rd_idx;
  661. u32 reserved2;
  662. u32 dbuf_wr_idx;
  663. u32 reserved3;
  664. u32 dbuf_rd_idx;
  665. u32 reserved4;
  666. } __packed;
  667. /* virtual tag supported */
  668. #define HBM_CAP_VT BIT(0)
  669. /* gsc extended header support */
  670. #define HBM_CAP_GSC BIT(1)
  671. /* client dma supported */
  672. #define HBM_CAP_CD BIT(2)
  673. /**
  674. * struct hbm_capability_request - capability request from host to fw
  675. *
  676. * @hbm_cmd : bus message command header
  677. * @capability_requested: bitmask of capabilities requested by host
  678. */
  679. struct hbm_capability_request {
  680. u8 hbm_cmd;
  681. u8 capability_requested[3];
  682. } __packed;
  683. /**
  684. * struct hbm_capability_response - capability response from fw to host
  685. *
  686. * @hbm_cmd : bus message command header
  687. * @capability_granted: bitmask of capabilities granted by FW
  688. */
  689. struct hbm_capability_response {
  690. u8 hbm_cmd;
  691. u8 capability_granted[3];
  692. } __packed;
  693. /**
  694. * struct hbm_client_dma_map_request - client dma map request from host to fw
  695. *
  696. * @hbm_cmd: bus message command header
  697. * @client_buffer_id: client buffer id
  698. * @reserved: reserved
  699. * @address_lsb: DMA address LSB
  700. * @address_msb: DMA address MSB
  701. * @size: DMA size
  702. */
  703. struct hbm_client_dma_map_request {
  704. u8 hbm_cmd;
  705. u8 client_buffer_id;
  706. u8 reserved[2];
  707. u32 address_lsb;
  708. u32 address_msb;
  709. u32 size;
  710. } __packed;
  711. /**
  712. * struct hbm_client_dma_unmap_request - client dma unmap request
  713. * from the host to the firmware
  714. *
  715. * @hbm_cmd: bus message command header
  716. * @status: unmap status
  717. * @client_buffer_id: client buffer id
  718. * @reserved: reserved
  719. */
  720. struct hbm_client_dma_unmap_request {
  721. u8 hbm_cmd;
  722. u8 status;
  723. u8 client_buffer_id;
  724. u8 reserved;
  725. } __packed;
  726. /**
  727. * struct hbm_client_dma_response - client dma unmap response
  728. * from the firmware to the host
  729. *
  730. * @hbm_cmd: bus message command header
  731. * @status: command status
  732. */
  733. struct hbm_client_dma_response {
  734. u8 hbm_cmd;
  735. u8 status;
  736. } __packed;
  737. #endif