hw.h 20 KB

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