hw.h 18 KB

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