mc_cdx_pcol.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * Driver for AMD network controllers and boards
  4. *
  5. * Copyright (C) 2021, Xilinx, Inc.
  6. * Copyright (C) 2022-2023, Advanced Micro Devices, Inc.
  7. */
  8. #ifndef MC_CDX_PCOL_H
  9. #define MC_CDX_PCOL_H
  10. /* The current version of the MCDI protocol. */
  11. #define MCDI_PCOL_VERSION 2
  12. /*
  13. * Each MCDI request starts with an MCDI_HEADER, which is a 32bit
  14. * structure, filled in by the client.
  15. *
  16. * 0 7 8 16 20 22 23 24 31
  17. * | CODE | R | LEN | SEQ | Rsvd | E | R | XFLAGS |
  18. * | | |
  19. * | | \--- Response
  20. * | \------- Error
  21. * \------------------------------ Resync (always set)
  22. *
  23. * The client writes its request into MC shared memory, and rings the
  24. * doorbell. Each request is completed either by the MC writing
  25. * back into shared memory, or by writing out an event.
  26. *
  27. * All MCDI commands support completion by shared memory response. Each
  28. * request may also contain additional data (accounted for by HEADER.LEN),
  29. * and some responses may also contain additional data (again, accounted
  30. * for by HEADER.LEN).
  31. *
  32. * Some MCDI commands support completion by event, in which any associated
  33. * response data is included in the event.
  34. *
  35. * The protocol requires one response to be delivered for every request; a
  36. * request should not be sent unless the response for the previous request
  37. * has been received (either by polling shared memory, or by receiving
  38. * an event).
  39. */
  40. /** Request/Response structure */
  41. #define MCDI_HEADER_OFST 0
  42. #define MCDI_HEADER_CODE_LBN 0
  43. #define MCDI_HEADER_CODE_WIDTH 7
  44. #define MCDI_HEADER_RESYNC_LBN 7
  45. #define MCDI_HEADER_RESYNC_WIDTH 1
  46. #define MCDI_HEADER_DATALEN_LBN 8
  47. #define MCDI_HEADER_DATALEN_WIDTH 8
  48. #define MCDI_HEADER_SEQ_LBN 16
  49. #define MCDI_HEADER_SEQ_WIDTH 4
  50. #define MCDI_HEADER_RSVD_LBN 20
  51. #define MCDI_HEADER_RSVD_WIDTH 1
  52. #define MCDI_HEADER_NOT_EPOCH_LBN 21
  53. #define MCDI_HEADER_NOT_EPOCH_WIDTH 1
  54. #define MCDI_HEADER_ERROR_LBN 22
  55. #define MCDI_HEADER_ERROR_WIDTH 1
  56. #define MCDI_HEADER_RESPONSE_LBN 23
  57. #define MCDI_HEADER_RESPONSE_WIDTH 1
  58. #define MCDI_HEADER_XFLAGS_LBN 24
  59. #define MCDI_HEADER_XFLAGS_WIDTH 8
  60. /* Request response using event */
  61. #define MCDI_HEADER_XFLAGS_EVREQ 0x01
  62. /* Request (and signal) early doorbell return */
  63. #define MCDI_HEADER_XFLAGS_DBRET 0x02
  64. /* Maximum number of payload bytes */
  65. #define MCDI_CTL_SDU_LEN_MAX_V2 0x400
  66. #define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V2
  67. /*
  68. * The MC can generate events for two reasons:
  69. * - To advance a shared memory request if XFLAGS_EVREQ was set
  70. * - As a notification (link state, i2c event), controlled
  71. * via MC_CMD_LOG_CTRL
  72. *
  73. * Both events share a common structure:
  74. *
  75. * 0 32 33 36 44 52 60
  76. * | Data | Cont | Level | Src | Code | Rsvd |
  77. * |
  78. * \ There is another event pending in this notification
  79. *
  80. * If Code==CMDDONE, then the fields are further interpreted as:
  81. *
  82. * - LEVEL==INFO Command succeeded
  83. * - LEVEL==ERR Command failed
  84. *
  85. * 0 8 16 24 32
  86. * | Seq | Datalen | Errno | Rsvd |
  87. *
  88. * These fields are taken directly out of the standard MCDI header, i.e.,
  89. * LEVEL==ERR, Datalen == 0 => Reboot
  90. *
  91. * Events can be squirted out of the UART (using LOG_CTRL) without a
  92. * MCDI header. An event can be distinguished from a MCDI response by
  93. * examining the first byte which is 0xc0. This corresponds to the
  94. * non-existent MCDI command MC_CMD_DEBUG_LOG.
  95. *
  96. * 0 7 8
  97. * | command | Resync | = 0xc0
  98. *
  99. * Since the event is written in big-endian byte order, this works
  100. * providing bits 56-63 of the event are 0xc0.
  101. *
  102. * 56 60 63
  103. * | Rsvd | Code | = 0xc0
  104. *
  105. * Which means for convenience the event code is 0xc for all MC
  106. * generated events.
  107. */
  108. /*
  109. * the errno value may be followed by the (0-based) number of the
  110. * first argument that could not be processed.
  111. */
  112. #define MC_CMD_ERR_ARG_OFST 4
  113. /* MC_CMD_ERR MCDI error codes. */
  114. /* Operation not permitted. */
  115. #define MC_CMD_ERR_EPERM 0x1
  116. /* Non-existent command target */
  117. #define MC_CMD_ERR_ENOENT 0x2
  118. /* assert() has killed the MC */
  119. #define MC_CMD_ERR_EINTR 0x4
  120. /* I/O failure */
  121. #define MC_CMD_ERR_EIO 0x5
  122. /* Already exists */
  123. #define MC_CMD_ERR_EEXIST 0x6
  124. /* Try again */
  125. #define MC_CMD_ERR_EAGAIN 0xb
  126. /* Out of memory */
  127. #define MC_CMD_ERR_ENOMEM 0xc
  128. /* Caller does not hold required locks */
  129. #define MC_CMD_ERR_EACCES 0xd
  130. /* Resource is currently unavailable (e.g. lock contention) */
  131. #define MC_CMD_ERR_EBUSY 0x10
  132. /* No such device */
  133. #define MC_CMD_ERR_ENODEV 0x13
  134. /* Invalid argument to target */
  135. #define MC_CMD_ERR_EINVAL 0x16
  136. /* No space */
  137. #define MC_CMD_ERR_ENOSPC 0x1c
  138. /* Read-only */
  139. #define MC_CMD_ERR_EROFS 0x1e
  140. /* Broken pipe */
  141. #define MC_CMD_ERR_EPIPE 0x20
  142. /* Out of range */
  143. #define MC_CMD_ERR_ERANGE 0x22
  144. /* Non-recursive resource is already acquired */
  145. #define MC_CMD_ERR_EDEADLK 0x23
  146. /* Operation not implemented */
  147. #define MC_CMD_ERR_ENOSYS 0x26
  148. /* Operation timed out */
  149. #define MC_CMD_ERR_ETIME 0x3e
  150. /* Link has been severed */
  151. #define MC_CMD_ERR_ENOLINK 0x43
  152. /* Protocol error */
  153. #define MC_CMD_ERR_EPROTO 0x47
  154. /* Bad message */
  155. #define MC_CMD_ERR_EBADMSG 0x4a
  156. /* Operation not supported */
  157. #define MC_CMD_ERR_ENOTSUP 0x5f
  158. /* Address not available */
  159. #define MC_CMD_ERR_EADDRNOTAVAIL 0x63
  160. /* Not connected */
  161. #define MC_CMD_ERR_ENOTCONN 0x6b
  162. /* Operation already in progress */
  163. #define MC_CMD_ERR_EALREADY 0x72
  164. /* Stale handle. The handle references resource that no longer exists */
  165. #define MC_CMD_ERR_ESTALE 0x74
  166. /* Resource allocation failed. */
  167. #define MC_CMD_ERR_ALLOC_FAIL 0x1000
  168. /* V-adaptor not found. */
  169. #define MC_CMD_ERR_NO_VADAPTOR 0x1001
  170. /* EVB port not found. */
  171. #define MC_CMD_ERR_NO_EVB_PORT 0x1002
  172. /* V-switch not found. */
  173. #define MC_CMD_ERR_NO_VSWITCH 0x1003
  174. /* Too many VLAN tags. */
  175. #define MC_CMD_ERR_VLAN_LIMIT 0x1004
  176. /* Bad PCI function number. */
  177. #define MC_CMD_ERR_BAD_PCI_FUNC 0x1005
  178. /* Invalid VLAN mode. */
  179. #define MC_CMD_ERR_BAD_VLAN_MODE 0x1006
  180. /* Invalid v-switch type. */
  181. #define MC_CMD_ERR_BAD_VSWITCH_TYPE 0x1007
  182. /* Invalid v-port type. */
  183. #define MC_CMD_ERR_BAD_VPORT_TYPE 0x1008
  184. /* MAC address exists. */
  185. #define MC_CMD_ERR_MAC_EXIST 0x1009
  186. /* Slave core not present */
  187. #define MC_CMD_ERR_SLAVE_NOT_PRESENT 0x100a
  188. /* The datapath is disabled. */
  189. #define MC_CMD_ERR_DATAPATH_DISABLED 0x100b
  190. /* The requesting client is not a function */
  191. #define MC_CMD_ERR_CLIENT_NOT_FN 0x100c
  192. /*
  193. * The requested operation might require the command to be passed between
  194. * MCs, and the transport doesn't support that. Should only ever been seen over
  195. * the UART.
  196. */
  197. #define MC_CMD_ERR_NO_PRIVILEGE 0x1013
  198. /*
  199. * Workaround 26807 could not be turned on/off because some functions
  200. * have already installed filters. See the comment at
  201. * MC_CMD_WORKAROUND_BUG26807. May also returned for other operations such as
  202. * sub-variant switching.
  203. */
  204. #define MC_CMD_ERR_FILTERS_PRESENT 0x1014
  205. /* The clock whose frequency you've attempted to set doesn't exist */
  206. #define MC_CMD_ERR_NO_CLOCK 0x1015
  207. /*
  208. * Returned by MC_CMD_TESTASSERT if the action that should have caused an
  209. * assertion failed to do so.
  210. */
  211. #define MC_CMD_ERR_UNREACHABLE 0x1016
  212. /*
  213. * This command needs to be processed in the background but there were no
  214. * resources to do so. Send it again after a command has completed.
  215. */
  216. #define MC_CMD_ERR_QUEUE_FULL 0x1017
  217. /*
  218. * The operation could not be completed because the PCIe link has gone
  219. * away. This error code is never expected to be returned over the TLP
  220. * transport.
  221. */
  222. #define MC_CMD_ERR_NO_PCIE 0x1018
  223. /*
  224. * The operation could not be completed because the datapath has gone
  225. * away. This is distinct from MC_CMD_ERR_DATAPATH_DISABLED in that the
  226. * datapath absence may be temporary
  227. */
  228. #define MC_CMD_ERR_NO_DATAPATH 0x1019
  229. /* The operation could not complete because some VIs are allocated */
  230. #define MC_CMD_ERR_VIS_PRESENT 0x101a
  231. /*
  232. * The operation could not complete because some PIO buffers are
  233. * allocated
  234. */
  235. #define MC_CMD_ERR_PIOBUFS_PRESENT 0x101b
  236. /***********************************/
  237. /*
  238. * MC_CMD_CDX_BUS_ENUM_BUSES
  239. * CDX bus hosts devices (functions) that are implemented using the Composable
  240. * DMA subsystem and directly mapped into the memory space of the FGPA PSX
  241. * Application Processors (APUs). As such, they only apply to the PSX APU side,
  242. * not the host (PCIe). Unlike PCIe, these devices have no native configuration
  243. * space or enumeration mechanism, so this message set provides a minimal
  244. * interface for discovery and management (bus reset, FLR, BME) of such
  245. * devices. This command returns the number of CDX buses present in the system.
  246. */
  247. #define MC_CMD_CDX_BUS_ENUM_BUSES 0x1
  248. #define MC_CMD_CDX_BUS_ENUM_BUSES_MSGSET 0x1
  249. #undef MC_CMD_0x1_PRIVILEGE_CTG
  250. #define MC_CMD_0x1_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  251. /* MC_CMD_CDX_BUS_ENUM_BUSES_IN msgrequest */
  252. #define MC_CMD_CDX_BUS_ENUM_BUSES_IN_LEN 0
  253. /* MC_CMD_CDX_BUS_ENUM_BUSES_OUT msgresponse */
  254. #define MC_CMD_CDX_BUS_ENUM_BUSES_OUT_LEN 4
  255. /*
  256. * Number of CDX buses present in the system. Buses are numbered 0 to
  257. * BUS_COUNT-1
  258. */
  259. #define MC_CMD_CDX_BUS_ENUM_BUSES_OUT_BUS_COUNT_OFST 0
  260. #define MC_CMD_CDX_BUS_ENUM_BUSES_OUT_BUS_COUNT_LEN 4
  261. /***********************************/
  262. /*
  263. * MC_CMD_CDX_BUS_ENUM_DEVICES
  264. * Enumerate CDX bus devices on a given bus
  265. */
  266. #define MC_CMD_CDX_BUS_ENUM_DEVICES 0x2
  267. #define MC_CMD_CDX_BUS_ENUM_DEVICES_MSGSET 0x2
  268. #undef MC_CMD_0x2_PRIVILEGE_CTG
  269. #define MC_CMD_0x2_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  270. /* MC_CMD_CDX_BUS_ENUM_DEVICES_IN msgrequest */
  271. #define MC_CMD_CDX_BUS_ENUM_DEVICES_IN_LEN 4
  272. /*
  273. * Bus number to enumerate, in range 0 to BUS_COUNT-1, as returned by
  274. * MC_CMD_CDX_BUS_ENUM_BUSES_OUT
  275. */
  276. #define MC_CMD_CDX_BUS_ENUM_DEVICES_IN_BUS_OFST 0
  277. #define MC_CMD_CDX_BUS_ENUM_DEVICES_IN_BUS_LEN 4
  278. /* MC_CMD_CDX_BUS_ENUM_DEVICES_OUT msgresponse */
  279. #define MC_CMD_CDX_BUS_ENUM_DEVICES_OUT_LEN 4
  280. /*
  281. * Number of devices present on the bus. Devices on the bus are numbered 0 to
  282. * DEVICE_COUNT-1. Returns EAGAIN if number of devices unknown or if the target
  283. * devices are not ready (e.g. undergoing a bus reset)
  284. */
  285. #define MC_CMD_CDX_BUS_ENUM_DEVICES_OUT_DEVICE_COUNT_OFST 0
  286. #define MC_CMD_CDX_BUS_ENUM_DEVICES_OUT_DEVICE_COUNT_LEN 4
  287. /***********************************/
  288. /*
  289. * MC_CMD_CDX_BUS_GET_DEVICE_CONFIG
  290. * Returns device identification and MMIO/MSI resource data for a CDX device.
  291. * The expected usage is for the caller to first retrieve the number of devices
  292. * on the bus using MC_CMD_BUS_ENUM_DEVICES, then loop through the range (0,
  293. * DEVICE_COUNT - 1), retrieving device resource data. May return EAGAIN if the
  294. * number of exposed devices or device resources change during enumeration (due
  295. * to e.g. a PL reload / bus reset), in which case the caller is expected to
  296. * restart the enumeration loop. MMIO addresses are specified in terms of bus
  297. * addresses (prior to any potential IOMMU translation). For versal-net, these
  298. * are equivalent to APU physical addresses. Implementation note - for this to
  299. * work, the implementation needs to keep state (generation count) per client.
  300. */
  301. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG 0x3
  302. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_MSGSET 0x3
  303. #undef MC_CMD_0x3_PRIVILEGE_CTG
  304. #define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  305. /* MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN msgrequest */
  306. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_LEN 8
  307. /* Device bus number, in range 0 to BUS_COUNT-1 */
  308. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_BUS_OFST 0
  309. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_BUS_LEN 4
  310. /* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */
  311. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_DEVICE_OFST 4
  312. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_DEVICE_LEN 4
  313. /* MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT msgresponse */
  314. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_LEN 88
  315. /* 16-bit Vendor identifier, compliant with PCI-SIG VendorID assignment. */
  316. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_VENDOR_ID_OFST 0
  317. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_VENDOR_ID_LEN 2
  318. /* 16-bit Device ID assigned by the vendor */
  319. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_ID_OFST 2
  320. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_ID_LEN 2
  321. /*
  322. * 16-bit Subsystem Vendor ID, , compliant with PCI-SIG VendorID assignment.
  323. * For further device differentiation, as required. 0 if unused.
  324. */
  325. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_VENDOR_ID_OFST 4
  326. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_VENDOR_ID_LEN 2
  327. /*
  328. * 16-bit Subsystem Device ID assigned by the vendor. For further device
  329. * differentiation, as required. 0 if unused.
  330. */
  331. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_DEVICE_ID_OFST 6
  332. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_DEVICE_ID_LEN 2
  333. /* 24-bit Device Class code, compliant with PCI-SIG Device Class codes */
  334. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_CLASS_OFST 8
  335. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_CLASS_LEN 3
  336. /* 8-bit vendor-assigned revision */
  337. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_REVISION_OFST 11
  338. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_REVISION_LEN 1
  339. /* Reserved (alignment) */
  340. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_RESERVED_OFST 12
  341. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_RESERVED_LEN 4
  342. /* MMIO region 0 base address (bus address), 0 if unused */
  343. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_OFST 16
  344. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LEN 8
  345. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_OFST 16
  346. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_LEN 4
  347. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_LBN 128
  348. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_WIDTH 32
  349. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_OFST 20
  350. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_LEN 4
  351. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_LBN 160
  352. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_WIDTH 32
  353. /* MMIO region 0 size, 0 if unused */
  354. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_OFST 24
  355. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LEN 8
  356. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_OFST 24
  357. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_LEN 4
  358. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_LBN 192
  359. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_WIDTH 32
  360. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_OFST 28
  361. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_LEN 4
  362. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_LBN 224
  363. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_WIDTH 32
  364. /* MMIO region 1 base address (bus address), 0 if unused */
  365. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_OFST 32
  366. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LEN 8
  367. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_OFST 32
  368. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_LEN 4
  369. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_LBN 256
  370. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_WIDTH 32
  371. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_OFST 36
  372. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_LEN 4
  373. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_LBN 288
  374. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_WIDTH 32
  375. /* MMIO region 1 size, 0 if unused */
  376. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_OFST 40
  377. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LEN 8
  378. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_OFST 40
  379. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_LEN 4
  380. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_LBN 320
  381. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_WIDTH 32
  382. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_OFST 44
  383. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_LEN 4
  384. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_LBN 352
  385. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_WIDTH 32
  386. /* MMIO region 2 base address (bus address), 0 if unused */
  387. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_OFST 48
  388. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LEN 8
  389. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_OFST 48
  390. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_LEN 4
  391. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_LBN 384
  392. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_WIDTH 32
  393. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_OFST 52
  394. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_LEN 4
  395. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_LBN 416
  396. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_WIDTH 32
  397. /* MMIO region 2 size, 0 if unused */
  398. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_OFST 56
  399. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LEN 8
  400. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_OFST 56
  401. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_LEN 4
  402. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_LBN 448
  403. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_WIDTH 32
  404. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_OFST 60
  405. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_LEN 4
  406. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_LBN 480
  407. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_WIDTH 32
  408. /* MMIO region 3 base address (bus address), 0 if unused */
  409. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_OFST 64
  410. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LEN 8
  411. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_OFST 64
  412. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_LEN 4
  413. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_LBN 512
  414. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_WIDTH 32
  415. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_OFST 68
  416. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_LEN 4
  417. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_LBN 544
  418. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_WIDTH 32
  419. /* MMIO region 3 size, 0 if unused */
  420. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_OFST 72
  421. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LEN 8
  422. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_OFST 72
  423. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_LEN 4
  424. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_LBN 576
  425. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_WIDTH 32
  426. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_OFST 76
  427. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_LEN 4
  428. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_LBN 608
  429. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_WIDTH 32
  430. /* MSI vector count */
  431. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MSI_COUNT_OFST 80
  432. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MSI_COUNT_LEN 4
  433. /* Requester ID used by device (SMMU StreamID, GIC ITS DeviceID) */
  434. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_REQUESTER_ID_OFST 84
  435. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_REQUESTER_ID_LEN 4
  436. /* MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_V2 msgresponse */
  437. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_V2_LEN 92
  438. /* Requester ID used by device for GIC ITS DeviceID */
  439. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_V2_REQUESTER_DEVICE_ID_OFST 88
  440. #define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_V2_REQUESTER_DEVICE_ID_LEN 4
  441. /***********************************/
  442. /*
  443. * MC_CMD_CDX_BUS_DOWN
  444. * Asserting reset on the CDX bus causes all devices on the bus to be quiesced.
  445. * DMA bus mastering is disabled and any pending DMA request are flushed. Once
  446. * the response is returned, the devices are guaranteed to no longer issue DMA
  447. * requests or raise MSI interrupts. Further device MMIO accesses may have
  448. * undefined results. While the bus reset is asserted, any of the enumeration
  449. * or device configuration MCDIs will fail with EAGAIN. It is only legal to
  450. * reload the relevant PL region containing CDX devices if the corresponding CDX
  451. * bus is in reset. Depending on the implementation, the firmware may or may
  452. * not enforce this restriction and it is up to the caller to make sure this
  453. * requirement is satisfied.
  454. */
  455. #define MC_CMD_CDX_BUS_DOWN 0x4
  456. #define MC_CMD_CDX_BUS_DOWN_MSGSET 0x4
  457. /* MC_CMD_CDX_BUS_DOWN_IN msgrequest */
  458. #define MC_CMD_CDX_BUS_DOWN_IN_LEN 4
  459. /* Bus number to put in reset, in range 0 to BUS_COUNT-1 */
  460. #define MC_CMD_CDX_BUS_DOWN_IN_BUS_OFST 0
  461. #define MC_CMD_CDX_BUS_DOWN_IN_BUS_LEN 4
  462. /*
  463. * MC_CMD_CDX_BUS_DOWN_OUT msgresponse: The bus is quiesced, no further
  464. * upstream traffic for devices on this bus.
  465. */
  466. #define MC_CMD_CDX_BUS_DOWN_OUT_LEN 0
  467. /***********************************/
  468. /*
  469. * MC_CMD_CDX_BUS_UP
  470. * After bus reset is de-asserted, devices are in a state which is functionally
  471. * equivalent to each device having been reset with MC_CMD_CDX_DEVICE_RESET. In
  472. * other words, device logic is reset in a hardware-specific way, MMIO accesses
  473. * are forwarded to the device, DMA bus mastering is disabled and needs to be
  474. * re-enabled with MC_CMD_CDX_DEVICE_DMA_ENABLE once the driver is ready to
  475. * start servicing DMA. If the underlying number of devices or device resources
  476. * changed (e.g. if PL was reloaded) while the bus was in reset, the bus driver
  477. * is expected to re-enumerate the bus. Returns EALREADY if the bus was already
  478. * up before the call.
  479. */
  480. #define MC_CMD_CDX_BUS_UP 0x5
  481. #define MC_CMD_CDX_BUS_UP_MSGSET 0x5
  482. /* MC_CMD_CDX_BUS_UP_IN msgrequest */
  483. #define MC_CMD_CDX_BUS_UP_IN_LEN 4
  484. /* Bus number to take out of reset, in range 0 to BUS_COUNT-1 */
  485. #define MC_CMD_CDX_BUS_UP_IN_BUS_OFST 0
  486. #define MC_CMD_CDX_BUS_UP_IN_BUS_LEN 4
  487. /* MC_CMD_CDX_BUS_UP_OUT msgresponse: The bus can now be enumerated. */
  488. #define MC_CMD_CDX_BUS_UP_OUT_LEN 0
  489. /***********************************/
  490. /*
  491. * MC_CMD_CDX_DEVICE_RESET
  492. * After this call completes, device DMA and interrupts are quiesced, devices
  493. * logic is reset in a hardware-specific way and DMA bus mastering is disabled.
  494. */
  495. #define MC_CMD_CDX_DEVICE_RESET 0x6
  496. #define MC_CMD_CDX_DEVICE_RESET_MSGSET 0x6
  497. #undef MC_CMD_0x6_PRIVILEGE_CTG
  498. #define MC_CMD_0x6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  499. /* MC_CMD_CDX_DEVICE_RESET_IN msgrequest */
  500. #define MC_CMD_CDX_DEVICE_RESET_IN_LEN 8
  501. /* Device bus number, in range 0 to BUS_COUNT-1 */
  502. #define MC_CMD_CDX_DEVICE_RESET_IN_BUS_OFST 0
  503. #define MC_CMD_CDX_DEVICE_RESET_IN_BUS_LEN 4
  504. /* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */
  505. #define MC_CMD_CDX_DEVICE_RESET_IN_DEVICE_OFST 4
  506. #define MC_CMD_CDX_DEVICE_RESET_IN_DEVICE_LEN 4
  507. /*
  508. * MC_CMD_CDX_DEVICE_RESET_OUT msgresponse: The device is quiesced and all
  509. * pending device initiated DMA has completed.
  510. */
  511. #define MC_CMD_CDX_DEVICE_RESET_OUT_LEN 0
  512. /***********************************/
  513. /*
  514. * MC_CMD_CDX_DEVICE_CONTROL_SET
  515. * If BUS_MASTER is set to disabled, device DMA and interrupts are quiesced.
  516. * Pending DMA requests and MSI interrupts are flushed and no further DMA or
  517. * interrupts are issued after this command returns. If BUS_MASTER is set to
  518. * enabled, device is allowed to initiate DMA. Whether interrupts are enabled
  519. * also depends on the value of MSI_ENABLE bit. Note that, in this case, the
  520. * device may start DMA before the host receives and processes the MCDI
  521. * response. MSI_ENABLE masks or unmasks device interrupts only. Note that for
  522. * interrupts to be delivered to the host, both BUS_MASTER and MSI_ENABLE needs
  523. * to be set. MMIO_REGIONS_ENABLE enables or disables host accesses to device
  524. * MMIO regions. Note that an implementation is allowed to permanently set this
  525. * bit to 1, in which case MC_CMD_CDX_DEVICE_CONTROL_GET will always return 1
  526. * for this bit, regardless of the value set here.
  527. */
  528. #define MC_CMD_CDX_DEVICE_CONTROL_SET 0x7
  529. #define MC_CMD_CDX_DEVICE_CONTROL_SET_MSGSET 0x7
  530. #undef MC_CMD_0x7_PRIVILEGE_CTG
  531. #define MC_CMD_0x7_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  532. /* MC_CMD_CDX_DEVICE_CONTROL_SET_IN msgrequest */
  533. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_LEN 12
  534. /* Device bus number, in range 0 to BUS_COUNT-1 */
  535. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_OFST 0
  536. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_LEN 4
  537. /* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */
  538. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_DEVICE_OFST 4
  539. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_DEVICE_LEN 4
  540. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_FLAGS_OFST 8
  541. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_FLAGS_LEN 4
  542. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_OFST 8
  543. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_LBN 0
  544. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_WIDTH 1
  545. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MSI_ENABLE_OFST 8
  546. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MSI_ENABLE_LBN 1
  547. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MSI_ENABLE_WIDTH 1
  548. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MMIO_REGIONS_ENABLE_OFST 8
  549. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MMIO_REGIONS_ENABLE_LBN 2
  550. #define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MMIO_REGIONS_ENABLE_WIDTH 1
  551. /* MC_CMD_CDX_DEVICE_CONTROL_SET_OUT msgresponse */
  552. #define MC_CMD_CDX_DEVICE_CONTROL_SET_OUT_LEN 0
  553. /***********************************/
  554. /*
  555. * MC_CMD_CDX_DEVICE_CONTROL_GET
  556. * Returns device DMA, interrupt and MMIO region access control bits. See
  557. * MC_CMD_CDX_DEVICE_CONTROL_SET for definition of the available control bits.
  558. */
  559. #define MC_CMD_CDX_DEVICE_CONTROL_GET 0x8
  560. #define MC_CMD_CDX_DEVICE_CONTROL_GET_MSGSET 0x8
  561. #undef MC_CMD_0x8_PRIVILEGE_CTG
  562. #define MC_CMD_0x8_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  563. /* MC_CMD_CDX_DEVICE_CONTROL_GET_IN msgrequest */
  564. #define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_LEN 8
  565. /* Device bus number, in range 0 to BUS_COUNT-1 */
  566. #define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_BUS_OFST 0
  567. #define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_BUS_LEN 4
  568. /* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */
  569. #define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_DEVICE_OFST 4
  570. #define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_DEVICE_LEN 4
  571. /* MC_CMD_CDX_DEVICE_CONTROL_GET_OUT msgresponse */
  572. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_LEN 4
  573. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_FLAGS_OFST 0
  574. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_FLAGS_LEN 4
  575. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_BUS_MASTER_ENABLE_OFST 0
  576. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_BUS_MASTER_ENABLE_LBN 0
  577. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_BUS_MASTER_ENABLE_WIDTH 1
  578. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MSI_ENABLE_OFST 0
  579. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MSI_ENABLE_LBN 1
  580. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MSI_ENABLE_WIDTH 1
  581. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MMIO_REGIONS_ENABLE_OFST 0
  582. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MMIO_REGIONS_ENABLE_LBN 2
  583. #define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MMIO_REGIONS_ENABLE_WIDTH 1
  584. /***********************************/
  585. /*
  586. * MC_CMD_CDX_DEVICE_WRITE_MSI_MSG
  587. * Populates the MSI message to be used by the hardware to raise the specified
  588. * interrupt vector. Versal-net implementation specific limitations are that
  589. * only 4 CDX devices with MSI interrupt capability are supported and all
  590. * vectors within a device must use the same write address. The command will
  591. * return EINVAL if any of these limitations is violated.
  592. */
  593. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG 0x9
  594. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_MSGSET 0x9
  595. #undef MC_CMD_0x9_PRIVILEGE_CTG
  596. #define MC_CMD_0x9_PRIVILEGE_CTG SRIOV_CTG_ADMIN
  597. /* MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN msgrequest */
  598. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_LEN 28
  599. /* Device bus number, in range 0 to BUS_COUNT-1 */
  600. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_BUS_OFST 0
  601. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_BUS_LEN 4
  602. /* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */
  603. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_DEVICE_OFST 4
  604. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_DEVICE_LEN 4
  605. /*
  606. * Device-relative MSI vector number. Must be < MSI_COUNT reported for the
  607. * device.
  608. */
  609. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_VECTOR_OFST 8
  610. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_VECTOR_LEN 4
  611. /* Reserved (alignment) */
  612. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_RESERVED_OFST 12
  613. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_RESERVED_LEN 4
  614. /*
  615. * MSI address to be used by the hardware. Typically, on ARM systems this
  616. * address is translated by the IOMMU (if enabled) and it is the responsibility
  617. * of the entity managing the IOMMU (APU kernel) to supply the correct IOVA
  618. * here.
  619. */
  620. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_OFST 16
  621. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_LEN 8
  622. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_LO_OFST 16
  623. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_LO_LEN 4
  624. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_LO_LBN 128
  625. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_LO_WIDTH 32
  626. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_HI_OFST 20
  627. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_HI_LEN 4
  628. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_HI_LBN 160
  629. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_ADDRESS_HI_WIDTH 32
  630. /*
  631. * MSI data to be used by the hardware. On versal-net, only the lower 16-bits
  632. * are used, the remaining bits are ignored and should be set to zero.
  633. */
  634. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_DATA_OFST 24
  635. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_IN_MSI_DATA_LEN 4
  636. /* MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_OUT msgresponse */
  637. #define MC_CMD_CDX_DEVICE_WRITE_MSI_MSG_OUT_LEN 0
  638. /***********************************/
  639. /* MC_CMD_V2_EXTN - Encapsulation for a v2 extended command */
  640. #define MC_CMD_V2_EXTN 0x7f
  641. /* MC_CMD_V2_EXTN_IN msgrequest */
  642. #define MC_CMD_V2_EXTN_IN_LEN 4
  643. /* the extended command number */
  644. #define MC_CMD_V2_EXTN_IN_EXTENDED_CMD_LBN 0
  645. #define MC_CMD_V2_EXTN_IN_EXTENDED_CMD_WIDTH 15
  646. #define MC_CMD_V2_EXTN_IN_UNUSED_LBN 15
  647. #define MC_CMD_V2_EXTN_IN_UNUSED_WIDTH 1
  648. /* the actual length of the encapsulated command */
  649. #define MC_CMD_V2_EXTN_IN_ACTUAL_LEN_LBN 16
  650. #define MC_CMD_V2_EXTN_IN_ACTUAL_LEN_WIDTH 10
  651. #define MC_CMD_V2_EXTN_IN_UNUSED2_LBN 26
  652. #define MC_CMD_V2_EXTN_IN_UNUSED2_WIDTH 2
  653. /* Type of command/response */
  654. #define MC_CMD_V2_EXTN_IN_MESSAGE_TYPE_LBN 28
  655. #define MC_CMD_V2_EXTN_IN_MESSAGE_TYPE_WIDTH 4
  656. /*
  657. * enum: MCDI command directed to versal-net. MCDI responses of this type
  658. * are not defined.
  659. */
  660. #define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM 0x2
  661. #endif /* MC_CDX_PCOL_H */