mcdi_pcol.h 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578
  1. /****************************************************************************
  2. * Driver for Solarflare Solarstorm network controllers and boards
  3. * Copyright 2009 Solarflare Communications Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published
  7. * by the Free Software Foundation, incorporated herein by reference.
  8. */
  9. #ifndef MCDI_PCOL_H
  10. #define MCDI_PCOL_H
  11. /* Values to be written into FMCR_CZ_RESET_STATE_REG to control boot. */
  12. /* Power-on reset state */
  13. #define MC_FW_STATE_POR (1)
  14. /* If this is set in MC_RESET_STATE_REG then it should be
  15. * possible to jump into IMEM without loading code from flash. */
  16. #define MC_FW_WARM_BOOT_OK (2)
  17. /* The MC main image has started to boot. */
  18. #define MC_FW_STATE_BOOTING (4)
  19. /* The Scheduler has started. */
  20. #define MC_FW_STATE_SCHED (8)
  21. /* Values to be written to the per-port status dword in shared
  22. * memory on reboot and assert */
  23. #define MC_STATUS_DWORD_REBOOT (0xb007b007)
  24. #define MC_STATUS_DWORD_ASSERT (0xdeaddead)
  25. /* The current version of the MCDI protocol.
  26. *
  27. * Note that the ROM burnt into the card only talks V0, so at the very
  28. * least every driver must support version 0 and MCDI_PCOL_VERSION
  29. */
  30. #define MCDI_PCOL_VERSION 1
  31. /**
  32. * MCDI version 1
  33. *
  34. * Each MCDI request starts with an MCDI_HEADER, which is a 32byte
  35. * structure, filled in by the client.
  36. *
  37. * 0 7 8 16 20 22 23 24 31
  38. * | CODE | R | LEN | SEQ | Rsvd | E | R | XFLAGS |
  39. * | | |
  40. * | | \--- Response
  41. * | \------- Error
  42. * \------------------------------ Resync (always set)
  43. *
  44. * The client writes it's request into MC shared memory, and rings the
  45. * doorbell. Each request is completed by either by the MC writting
  46. * back into shared memory, or by writting out an event.
  47. *
  48. * All MCDI commands support completion by shared memory response. Each
  49. * request may also contain additional data (accounted for by HEADER.LEN),
  50. * and some response's may also contain additional data (again, accounted
  51. * for by HEADER.LEN).
  52. *
  53. * Some MCDI commands support completion by event, in which any associated
  54. * response data is included in the event.
  55. *
  56. * The protocol requires one response to be delivered for every request, a
  57. * request should not be sent unless the response for the previous request
  58. * has been received (either by polling shared memory, or by receiving
  59. * an event).
  60. */
  61. /** Request/Response structure */
  62. #define MCDI_HEADER_OFST 0
  63. #define MCDI_HEADER_CODE_LBN 0
  64. #define MCDI_HEADER_CODE_WIDTH 7
  65. #define MCDI_HEADER_RESYNC_LBN 7
  66. #define MCDI_HEADER_RESYNC_WIDTH 1
  67. #define MCDI_HEADER_DATALEN_LBN 8
  68. #define MCDI_HEADER_DATALEN_WIDTH 8
  69. #define MCDI_HEADER_SEQ_LBN 16
  70. #define MCDI_HEADER_RSVD_LBN 20
  71. #define MCDI_HEADER_RSVD_WIDTH 2
  72. #define MCDI_HEADER_SEQ_WIDTH 4
  73. #define MCDI_HEADER_ERROR_LBN 22
  74. #define MCDI_HEADER_ERROR_WIDTH 1
  75. #define MCDI_HEADER_RESPONSE_LBN 23
  76. #define MCDI_HEADER_RESPONSE_WIDTH 1
  77. #define MCDI_HEADER_XFLAGS_LBN 24
  78. #define MCDI_HEADER_XFLAGS_WIDTH 8
  79. /* Request response using event */
  80. #define MCDI_HEADER_XFLAGS_EVREQ 0x01
  81. /* Maximum number of payload bytes */
  82. #define MCDI_CTL_SDU_LEN_MAX 0xfc
  83. /* The MC can generate events for two reasons:
  84. * - To complete a shared memory request if XFLAGS_EVREQ was set
  85. * - As a notification (link state, i2c event), controlled
  86. * via MC_CMD_LOG_CTRL
  87. *
  88. * Both events share a common structure:
  89. *
  90. * 0 32 33 36 44 52 60
  91. * | Data | Cont | Level | Src | Code | Rsvd |
  92. * |
  93. * \ There is another event pending in this notification
  94. *
  95. * If Code==CMDDONE, then the fields are further interpreted as:
  96. *
  97. * - LEVEL==INFO Command succeded
  98. * - LEVEL==ERR Command failed
  99. *
  100. * 0 8 16 24 32
  101. * | Seq | Datalen | Errno | Rsvd |
  102. *
  103. * These fields are taken directly out of the standard MCDI header, i.e.,
  104. * LEVEL==ERR, Datalen == 0 => Reboot
  105. *
  106. * Events can be squirted out of the UART (using LOG_CTRL) without a
  107. * MCDI header. An event can be distinguished from a MCDI response by
  108. * examining the first byte which is 0xc0. This corresponds to the
  109. * non-existent MCDI command MC_CMD_DEBUG_LOG.
  110. *
  111. * 0 7 8
  112. * | command | Resync | = 0xc0
  113. *
  114. * Since the event is written in big-endian byte order, this works
  115. * providing bits 56-63 of the event are 0xc0.
  116. *
  117. * 56 60 63
  118. * | Rsvd | Code | = 0xc0
  119. *
  120. * Which means for convenience the event code is 0xc for all MC
  121. * generated events.
  122. */
  123. #define FSE_AZ_EV_CODE_MCDI_EVRESPONSE 0xc
  124. #define MCDI_EVENT_DATA_LBN 0
  125. #define MCDI_EVENT_DATA_WIDTH 32
  126. #define MCDI_EVENT_CONT_LBN 32
  127. #define MCDI_EVENT_CONT_WIDTH 1
  128. #define MCDI_EVENT_LEVEL_LBN 33
  129. #define MCDI_EVENT_LEVEL_WIDTH 3
  130. #define MCDI_EVENT_LEVEL_INFO (0)
  131. #define MCDI_EVENT_LEVEL_WARN (1)
  132. #define MCDI_EVENT_LEVEL_ERR (2)
  133. #define MCDI_EVENT_LEVEL_FATAL (3)
  134. #define MCDI_EVENT_SRC_LBN 36
  135. #define MCDI_EVENT_SRC_WIDTH 8
  136. #define MCDI_EVENT_CODE_LBN 44
  137. #define MCDI_EVENT_CODE_WIDTH 8
  138. #define MCDI_EVENT_CODE_BADSSERT (1)
  139. #define MCDI_EVENT_CODE_PMNOTICE (2)
  140. #define MCDI_EVENT_CODE_CMDDONE (3)
  141. #define MCDI_EVENT_CMDDONE_SEQ_LBN 0
  142. #define MCDI_EVENT_CMDDONE_SEQ_WIDTH 8
  143. #define MCDI_EVENT_CMDDONE_DATALEN_LBN 8
  144. #define MCDI_EVENT_CMDDONE_DATALEN_WIDTH 8
  145. #define MCDI_EVENT_CMDDONE_ERRNO_LBN 16
  146. #define MCDI_EVENT_CMDDONE_ERRNO_WIDTH 8
  147. #define MCDI_EVENT_CODE_LINKCHANGE (4)
  148. #define MCDI_EVENT_LINKCHANGE_LP_CAP_LBN 0
  149. #define MCDI_EVENT_LINKCHANGE_LP_CAP_WIDTH 16
  150. #define MCDI_EVENT_LINKCHANGE_SPEED_LBN 16
  151. #define MCDI_EVENT_LINKCHANGE_SPEED_WIDTH 4
  152. #define MCDI_EVENT_LINKCHANGE_SPEED_100M 1
  153. #define MCDI_EVENT_LINKCHANGE_SPEED_1G 2
  154. #define MCDI_EVENT_LINKCHANGE_SPEED_10G 3
  155. #define MCDI_EVENT_LINKCHANGE_FCNTL_LBN 20
  156. #define MCDI_EVENT_LINKCHANGE_FCNTL_WIDTH 4
  157. #define MCDI_EVENT_LINKCHANGE_LINK_FLAGS_LBN 24
  158. #define MCDI_EVENT_LINKCHANGE_LINK_FLAGS_WIDTH 8
  159. #define MCDI_EVENT_CODE_SENSOREVT (5)
  160. #define MCDI_EVENT_SENSOREVT_MONITOR_LBN 0
  161. #define MCDI_EVENT_SENSOREVT_MONITOR_WIDTH 8
  162. #define MCDI_EVENT_SENSOREVT_STATE_LBN 8
  163. #define MCDI_EVENT_SENSOREVT_STATE_WIDTH 8
  164. #define MCDI_EVENT_SENSOREVT_VALUE_LBN 16
  165. #define MCDI_EVENT_SENSOREVT_VALUE_WIDTH 16
  166. #define MCDI_EVENT_CODE_SCHEDERR (6)
  167. #define MCDI_EVENT_CODE_REBOOT (7)
  168. #define MCDI_EVENT_CODE_MAC_STATS_DMA (8)
  169. #define MCDI_EVENT_MAC_STATS_DMA_GENERATION_LBN 0
  170. #define MCDI_EVENT_MAC_STATS_DMA_GENERATION_WIDTH 32
  171. /* Non-existent command target */
  172. #define MC_CMD_ERR_ENOENT 2
  173. /* assert() has killed the MC */
  174. #define MC_CMD_ERR_EINTR 4
  175. /* Caller does not hold required locks */
  176. #define MC_CMD_ERR_EACCES 13
  177. /* Resource is currently unavailable (e.g. lock contention) */
  178. #define MC_CMD_ERR_EBUSY 16
  179. /* Invalid argument to target */
  180. #define MC_CMD_ERR_EINVAL 22
  181. /* Non-recursive resource is already acquired */
  182. #define MC_CMD_ERR_EDEADLK 35
  183. /* Operation not implemented */
  184. #define MC_CMD_ERR_ENOSYS 38
  185. /* Operation timed out */
  186. #define MC_CMD_ERR_ETIME 62
  187. #define MC_CMD_ERR_CODE_OFST 0
  188. /* MC_CMD_READ32: (debug, variadic out)
  189. * Read multiple 32byte words from MC memory
  190. */
  191. #define MC_CMD_READ32 0x01
  192. #define MC_CMD_READ32_IN_LEN 8
  193. #define MC_CMD_READ32_IN_ADDR_OFST 0
  194. #define MC_CMD_READ32_IN_NUMWORDS_OFST 4
  195. #define MC_CMD_READ32_OUT_LEN(_numwords) \
  196. (4 * (_numwords))
  197. #define MC_CMD_READ32_OUT_BUFFER_OFST 0
  198. /* MC_CMD_WRITE32: (debug, variadic in)
  199. * Write multiple 32byte words to MC memory
  200. */
  201. #define MC_CMD_WRITE32 0x02
  202. #define MC_CMD_WRITE32_IN_LEN(_numwords) (((_numwords) * 4) + 4)
  203. #define MC_CMD_WRITE32_IN_ADDR_OFST 0
  204. #define MC_CMD_WRITE32_IN_BUFFER_OFST 4
  205. #define MC_CMD_WRITE32_OUT_LEN 0
  206. /* MC_CMD_COPYCODE: (debug)
  207. * Copy MC code between two locations and jump
  208. */
  209. #define MC_CMD_COPYCODE 0x03
  210. #define MC_CMD_COPYCODE_IN_LEN 16
  211. #define MC_CMD_COPYCODE_IN_SRC_ADDR_OFST 0
  212. #define MC_CMD_COPYCODE_IN_DEST_ADDR_OFST 4
  213. #define MC_CMD_COPYCODE_IN_NUMWORDS_OFST 8
  214. #define MC_CMD_COPYCODE_IN_JUMP_OFST 12
  215. /* Control should return to the caller rather than jumping */
  216. #define MC_CMD_COPYCODE_JUMP_NONE 1
  217. #define MC_CMD_COPYCODE_OUT_LEN 0
  218. /* MC_CMD_SET_FUNC: (debug)
  219. * Select function for function-specific commands.
  220. */
  221. #define MC_CMD_SET_FUNC 0x04
  222. #define MC_CMD_SET_FUNC_IN_LEN 4
  223. #define MC_CMD_SET_FUNC_IN_FUNC_OFST 0
  224. #define MC_CMD_SET_FUNC_OUT_LEN 0
  225. /* MC_CMD_GET_BOOT_STATUS:
  226. * Get the instruction address from which the MC booted.
  227. */
  228. #define MC_CMD_GET_BOOT_STATUS 0x05
  229. #define MC_CMD_GET_BOOT_STATUS_IN_LEN 0
  230. #define MC_CMD_GET_BOOT_STATUS_OUT_LEN 8
  231. #define MC_CMD_GET_BOOT_STATUS_OUT_BOOT_OFFSET_OFST 0
  232. #define MC_CMD_GET_BOOT_STATUS_OUT_FLAGS_OFST 4
  233. /* Reboot caused by watchdog */
  234. #define MC_CMD_GET_BOOT_STATUS_FLAGS_WATCHDOG_LBN (0)
  235. #define MC_CMD_GET_BOOT_STATUS_FLAGS_WATCHDOG_WIDTH (1)
  236. /* MC booted from primary flash partition */
  237. #define MC_CMD_GET_BOOT_STATUS_FLAGS_PRIMARY_LBN (1)
  238. #define MC_CMD_GET_BOOT_STATUS_FLAGS_PRIMARY_WIDTH (1)
  239. /* MC booted from backup flash partition */
  240. #define MC_CMD_GET_BOOT_STATUS_FLAGS_BACKUP_LBN (2)
  241. #define MC_CMD_GET_BOOT_STATUS_FLAGS_BACKUP_WIDTH (1)
  242. /* MC_CMD_GET_ASSERTS: (debug, variadic out)
  243. * Get (and optionally clear) the current assertion status.
  244. *
  245. * Only OUT.GLOBAL_FLAGS is guaranteed to exist in the completion
  246. * payload. The other fields will only be present if
  247. * OUT.GLOBAL_FLAGS != NO_FAILS
  248. */
  249. #define MC_CMD_GET_ASSERTS 0x06
  250. #define MC_CMD_GET_ASSERTS_IN_LEN 4
  251. #define MC_CMD_GET_ASSERTS_IN_CLEAR_OFST 0
  252. #define MC_CMD_GET_ASSERTS_OUT_LEN 140
  253. /* Assertion status flag */
  254. #define MC_CMD_GET_ASSERTS_OUT_GLOBAL_FLAGS_OFST 0
  255. /*! No assertions have failed. */
  256. #define MC_CMD_GET_ASSERTS_FLAGS_NO_FAILS 1
  257. /*! A system-level assertion has failed. */
  258. #define MC_CMD_GET_ASSERTS_FLAGS_SYS_FAIL 2
  259. /*! A thread-level assertion has failed. */
  260. #define MC_CMD_GET_ASSERTS_FLAGS_THR_FAIL 3
  261. /*! The system was reset by the watchdog. */
  262. #define MC_CMD_GET_ASSERTS_FLAGS_WDOG_FIRED 4
  263. /* Failing PC value */
  264. #define MC_CMD_GET_ASSERTS_OUT_SAVED_PC_OFFS_OFST 4
  265. /* Saved GP regs */
  266. #define MC_CMD_GET_ASSERTS_OUT_GP_REGS_OFFS_OFST 8
  267. #define MC_CMD_GET_ASSERTS_OUT_GP_REGS_LEN 124
  268. /* Failing thread address */
  269. #define MC_CMD_GET_ASSERTS_OUT_THREAD_OFFS_OFST 132
  270. /* MC_CMD_LOG_CTRL:
  271. * Determine the output stream for various events and messages
  272. */
  273. #define MC_CMD_LOG_CTRL 0x07
  274. #define MC_CMD_LOG_CTRL_IN_LEN 8
  275. #define MC_CMD_LOG_CTRL_IN_LOG_DEST_OFST 0
  276. #define MC_CMD_LOG_CTRL_IN_LOG_DEST_UART (1)
  277. #define MC_CMD_LOG_CTRL_IN_LOG_DEST_EVQ (2)
  278. #define MC_CMD_LOG_CTRL_IN_LOG_DEST_EVQ_OFST 4
  279. #define MC_CMD_LOG_CTRL_OUT_LEN 0
  280. /* MC_CMD_GET_VERSION:
  281. * Get version information about the MC firmware
  282. */
  283. #define MC_CMD_GET_VERSION 0x08
  284. #define MC_CMD_GET_VERSION_IN_LEN 0
  285. #define MC_CMD_GET_VERSION_V0_OUT_LEN 4
  286. #define MC_CMD_GET_VERSION_V1_OUT_LEN 32
  287. #define MC_CMD_GET_VERSION_OUT_FIRMWARE_OFST 0
  288. /* Reserved version number to indicate "any" version. */
  289. #define MC_CMD_GET_VERSION_OUT_FIRMWARE_ANY 0xffffffff
  290. /* The version response of a boot ROM awaiting rescue */
  291. #define MC_CMD_GET_VERSION_OUT_FIRMWARE_BOOTROM 0xb0070000
  292. #define MC_CMD_GET_VERSION_V1_OUT_PCOL_OFST 4
  293. /* 128bit mask of functions supported by the current firmware */
  294. #define MC_CMD_GET_VERSION_V1_OUT_SUPPORTED_FUNCS_OFST 8
  295. /* The command set exported by the boot ROM (MCDI v0) */
  296. #define MC_CMD_GET_VERSION_V0_SUPPORTED_FUNCS { \
  297. (1 << MC_CMD_READ32) | \
  298. (1 << MC_CMD_WRITE32) | \
  299. (1 << MC_CMD_COPYCODE) | \
  300. (1 << MC_CMD_GET_VERSION), \
  301. 0, 0, 0 }
  302. #define MC_CMD_GET_VERSION_OUT_VERSION_OFST 24
  303. /* Vectors in the boot ROM */
  304. /* Point to the copycode entry point. */
  305. #define MC_BOOTROM_COPYCODE_VEC (0x7f4)
  306. /* Points to the recovery mode entry point. */
  307. #define MC_BOOTROM_NOFLASH_VEC (0x7f8)
  308. /* Test execution limits */
  309. #define MC_TESTEXEC_VARIANT_COUNT 16
  310. #define MC_TESTEXEC_RESULT_COUNT 7
  311. /* MC_CMD_SET_TESTVARS: (debug, variadic in)
  312. * Write variant words for test.
  313. *
  314. * The user supplies a bitmap of the variants they wish to set.
  315. * They must ensure that IN.LEN >= 4 + 4 * ffs(BITMAP)
  316. */
  317. #define MC_CMD_SET_TESTVARS 0x09
  318. #define MC_CMD_SET_TESTVARS_IN_LEN(_numwords) \
  319. (4 + 4*(_numwords))
  320. #define MC_CMD_SET_TESTVARS_IN_ARGS_BITMAP_OFST 0
  321. /* Up to MC_TESTEXEC_VARIANT_COUNT of 32byte words start here */
  322. #define MC_CMD_SET_TESTVARS_IN_ARGS_BUFFER_OFST 4
  323. #define MC_CMD_SET_TESTVARS_OUT_LEN 0
  324. /* MC_CMD_GET_TESTRCS: (debug, variadic out)
  325. * Return result words from test.
  326. */
  327. #define MC_CMD_GET_TESTRCS 0x0a
  328. #define MC_CMD_GET_TESTRCS_IN_LEN 4
  329. #define MC_CMD_GET_TESTRCS_IN_NUMWORDS_OFST 0
  330. #define MC_CMD_GET_TESTRCS_OUT_LEN(_numwords) \
  331. (4 * (_numwords))
  332. #define MC_CMD_GET_TESTRCS_OUT_BUFFER_OFST 0
  333. /* MC_CMD_RUN_TEST: (debug)
  334. * Run the test exported by this firmware image
  335. */
  336. #define MC_CMD_RUN_TEST 0x0b
  337. #define MC_CMD_RUN_TEST_IN_LEN 0
  338. #define MC_CMD_RUN_TEST_OUT_LEN 0
  339. /* MC_CMD_CSR_READ32: (debug, variadic out)
  340. * Read 32bit words from the indirect memory map
  341. */
  342. #define MC_CMD_CSR_READ32 0x0c
  343. #define MC_CMD_CSR_READ32_IN_LEN 12
  344. #define MC_CMD_CSR_READ32_IN_ADDR_OFST 0
  345. #define MC_CMD_CSR_READ32_IN_STEP_OFST 4
  346. #define MC_CMD_CSR_READ32_IN_NUMWORDS_OFST 8
  347. #define MC_CMD_CSR_READ32_OUT_LEN(_numwords) \
  348. (((_numwords) * 4) + 4)
  349. /* IN.NUMWORDS of 32bit words start here */
  350. #define MC_CMD_CSR_READ32_OUT_BUFFER_OFST 0
  351. #define MC_CMD_CSR_READ32_OUT_IREG_STATUS_OFST(_numwords) \
  352. ((_numwords) * 4)
  353. /* MC_CMD_CSR_WRITE32: (debug, variadic in)
  354. * Write 32bit dwords to the indirect memory map
  355. */
  356. #define MC_CMD_CSR_WRITE32 0x0d
  357. #define MC_CMD_CSR_WRITE32_IN_LEN(_numwords) \
  358. (((_numwords) * 4) + 8)
  359. #define MC_CMD_CSR_WRITE32_IN_ADDR_OFST 0
  360. #define MC_CMD_CSR_WRITE32_IN_STEP_OFST 4
  361. /* Multiple 32bit words of data to write start here */
  362. #define MC_CMD_CSR_WRITE32_IN_BUFFER_OFST 8
  363. #define MC_CMD_CSR_WRITE32_OUT_LEN 4
  364. #define MC_CMD_CSR_WRITE32_OUT_STATUS_OFST 0
  365. /* MC_CMD_JTAG_WORK: (debug, fpga only)
  366. * Process JTAG work buffer for RBF acceleration.
  367. *
  368. * Host: bit count, (up to) 32 words of data to clock out to JTAG
  369. * (bits 1,0=TMS,TDO for first bit; bits 3,2=TMS,TDO for second bit, etc.)
  370. * MC: bit count, (up to) 32 words of data clocked in from JTAG
  371. * (bit 0=TDI for first bit, bit 1=TDI for second bit, etc.; [31:16] unused)
  372. */
  373. #define MC_CMD_JTAG_WORK 0x0e
  374. /* MC_CMD_STACKINFO: (debug, variadic out)
  375. * Get stack information
  376. *
  377. * Host: nothing
  378. * MC: (thread ptr, stack size, free space) for each thread in system
  379. */
  380. #define MC_CMD_STACKINFO 0x0f
  381. /* MC_CMD_MDIO_READ:
  382. * MDIO register read
  383. */
  384. #define MC_CMD_MDIO_READ 0x10
  385. #define MC_CMD_MDIO_READ_IN_LEN 16
  386. #define MC_CMD_MDIO_READ_IN_BUS_OFST 0
  387. #define MC_CMD_MDIO_READ_IN_PRTAD_OFST 4
  388. #define MC_CMD_MDIO_READ_IN_DEVAD_OFST 8
  389. #define MC_CMD_MDIO_READ_IN_ADDR_OFST 12
  390. #define MC_CMD_MDIO_READ_OUT_LEN 8
  391. #define MC_CMD_MDIO_READ_OUT_VALUE_OFST 0
  392. #define MC_CMD_MDIO_READ_OUT_STATUS_OFST 4
  393. /* MC_CMD_MDIO_WRITE:
  394. * MDIO register write
  395. */
  396. #define MC_CMD_MDIO_WRITE 0x11
  397. #define MC_CMD_MDIO_WRITE_IN_LEN 20
  398. #define MC_CMD_MDIO_WRITE_IN_BUS_OFST 0
  399. #define MC_CMD_MDIO_WRITE_IN_PRTAD_OFST 4
  400. #define MC_CMD_MDIO_WRITE_IN_DEVAD_OFST 8
  401. #define MC_CMD_MDIO_WRITE_IN_ADDR_OFST 12
  402. #define MC_CMD_MDIO_WRITE_IN_VALUE_OFST 16
  403. #define MC_CMD_MDIO_WRITE_OUT_LEN 4
  404. #define MC_CMD_MDIO_WRITE_OUT_STATUS_OFST 0
  405. /* By default all the MCDI MDIO operations perform clause45 mode.
  406. * If you want to use clause22 then set DEVAD = MC_CMD_MDIO_CLAUSE22.
  407. */
  408. #define MC_CMD_MDIO_CLAUSE22 32
  409. /* There are two MDIO buses: one for the internal PHY, and one for external
  410. * devices.
  411. */
  412. #define MC_CMD_MDIO_BUS_INTERNAL 0
  413. #define MC_CMD_MDIO_BUS_EXTERNAL 1
  414. /* The MDIO commands return the raw status bits from the MDIO block. A "good"
  415. * transaction should have the DONE bit set and all other bits clear.
  416. */
  417. #define MC_CMD_MDIO_STATUS_GOOD 0x08
  418. /* MC_CMD_DBI_WRITE: (debug)
  419. * Write DBI register(s)
  420. *
  421. * Host: address, byte-enables (and VF selection, and cs2 flag),
  422. * value [,address ...]
  423. * MC: nothing
  424. */
  425. #define MC_CMD_DBI_WRITE 0x12
  426. #define MC_CMD_DBI_WRITE_IN_LEN(_numwords) \
  427. (12 * (_numwords))
  428. #define MC_CMD_DBI_WRITE_IN_ADDRESS_OFST(_word) \
  429. (((_word) * 12) + 0)
  430. #define MC_CMD_DBI_WRITE_IN_BYTE_MASK_OFST(_word) \
  431. (((_word) * 12) + 4)
  432. #define MC_CMD_DBI_WRITE_IN_VALUE_OFST(_word) \
  433. (((_word) * 12) + 8)
  434. #define MC_CMD_DBI_WRITE_OUT_LEN 0
  435. /* MC_CMD_DBI_READ: (debug)
  436. * Read DBI register(s)
  437. *
  438. * Host: address, [,address ...]
  439. * MC: value [,value ...]
  440. * (note: this does not support reading from VFs, but is retained for backwards
  441. * compatibility; see MC_CMD_DBI_READX below)
  442. */
  443. #define MC_CMD_DBI_READ 0x13
  444. #define MC_CMD_DBI_READ_IN_LEN(_numwords) \
  445. (4 * (_numwords))
  446. #define MC_CMD_DBI_READ_OUT_LEN(_numwords) \
  447. (4 * (_numwords))
  448. /* MC_CMD_PORT_READ32: (debug)
  449. * Read a 32-bit register from the indirect port register map.
  450. *
  451. * The port to access is implied by the Shared memory channel used.
  452. */
  453. #define MC_CMD_PORT_READ32 0x14
  454. #define MC_CMD_PORT_READ32_IN_LEN 4
  455. #define MC_CMD_PORT_READ32_IN_ADDR_OFST 0
  456. #define MC_CMD_PORT_READ32_OUT_LEN 8
  457. #define MC_CMD_PORT_READ32_OUT_VALUE_OFST 0
  458. #define MC_CMD_PORT_READ32_OUT_STATUS_OFST 4
  459. /* MC_CMD_PORT_WRITE32: (debug)
  460. * Write a 32-bit register to the indirect port register map.
  461. *
  462. * The port to access is implied by the Shared memory channel used.
  463. */
  464. #define MC_CMD_PORT_WRITE32 0x15
  465. #define MC_CMD_PORT_WRITE32_IN_LEN 8
  466. #define MC_CMD_PORT_WRITE32_IN_ADDR_OFST 0
  467. #define MC_CMD_PORT_WRITE32_IN_VALUE_OFST 4
  468. #define MC_CMD_PORT_WRITE32_OUT_LEN 4
  469. #define MC_CMD_PORT_WRITE32_OUT_STATUS_OFST 0
  470. /* MC_CMD_PORT_READ128: (debug)
  471. * Read a 128-bit register from indirect port register map
  472. *
  473. * The port to access is implied by the Shared memory channel used.
  474. */
  475. #define MC_CMD_PORT_READ128 0x16
  476. #define MC_CMD_PORT_READ128_IN_LEN 4
  477. #define MC_CMD_PORT_READ128_IN_ADDR_OFST 0
  478. #define MC_CMD_PORT_READ128_OUT_LEN 20
  479. #define MC_CMD_PORT_READ128_OUT_VALUE_OFST 0
  480. #define MC_CMD_PORT_READ128_OUT_STATUS_OFST 16
  481. /* MC_CMD_PORT_WRITE128: (debug)
  482. * Write a 128-bit register to indirect port register map.
  483. *
  484. * The port to access is implied by the Shared memory channel used.
  485. */
  486. #define MC_CMD_PORT_WRITE128 0x17
  487. #define MC_CMD_PORT_WRITE128_IN_LEN 20
  488. #define MC_CMD_PORT_WRITE128_IN_ADDR_OFST 0
  489. #define MC_CMD_PORT_WRITE128_IN_VALUE_OFST 4
  490. #define MC_CMD_PORT_WRITE128_OUT_LEN 4
  491. #define MC_CMD_PORT_WRITE128_OUT_STATUS_OFST 0
  492. /* MC_CMD_GET_BOARD_CFG:
  493. * Returns the MC firmware configuration structure
  494. *
  495. * The FW_SUBTYPE_LIST contains a 16-bit value for each of the 12 types of
  496. * NVRAM area. The values are defined in the firmware/mc/platform/<xxx>.c file
  497. * for a specific board type, but otherwise have no meaning to the MC; they
  498. * are used by the driver to manage selection of appropriate firmware updates.
  499. */
  500. #define MC_CMD_GET_BOARD_CFG 0x18
  501. #define MC_CMD_GET_BOARD_CFG_IN_LEN 0
  502. #define MC_CMD_GET_BOARD_CFG_OUT_LEN 96
  503. #define MC_CMD_GET_BOARD_CFG_OUT_BOARD_TYPE_OFST 0
  504. #define MC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_OFST 4
  505. #define MC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_LEN 32
  506. #define MC_CMD_GET_BOARD_CFG_OUT_CAPABILITIES_PORT0_OFST 36
  507. #define MC_CMD_GET_BOARD_CFG_OUT_CAPABILITIES_PORT1_OFST 40
  508. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST 44
  509. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_LEN 6
  510. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1_OFST 50
  511. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1_LEN 6
  512. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_COUNT_PORT0_OFST 56
  513. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_COUNT_PORT1_OFST 60
  514. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_STRIDE_PORT0_OFST 64
  515. #define MC_CMD_GET_BOARD_CFG_OUT_MAC_STRIDE_PORT1_OFST 68
  516. #define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST 72
  517. #define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN 24
  518. /* MC_CMD_DBI_READX: (debug)
  519. * Read DBI register(s) -- extended functionality
  520. *
  521. * Host: vf selection, address, [,vf selection ...]
  522. * MC: value [,value ...]
  523. */
  524. #define MC_CMD_DBI_READX 0x19
  525. #define MC_CMD_DBI_READX_IN_LEN(_numwords) \
  526. (8*(_numwords))
  527. #define MC_CMD_DBI_READX_OUT_LEN(_numwords) \
  528. (4*(_numwords))
  529. /* MC_CMD_SET_RAND_SEED:
  530. * Set the 16byte seed for the MC psuedo-random generator
  531. */
  532. #define MC_CMD_SET_RAND_SEED 0x1a
  533. #define MC_CMD_SET_RAND_SEED_IN_LEN 16
  534. #define MC_CMD_SET_RAND_SEED_IN_SEED_OFST 0
  535. #define MC_CMD_SET_RAND_SEED_OUT_LEN 0
  536. /* MC_CMD_LTSSM_HIST: (debug)
  537. * Retrieve the history of the LTSSM, if the build supports it.
  538. *
  539. * Host: nothing
  540. * MC: variable number of LTSSM values, as bytes
  541. * The history is read-to-clear.
  542. */
  543. #define MC_CMD_LTSSM_HIST 0x1b
  544. /* MC_CMD_DRV_ATTACH:
  545. * Inform MCPU that this port is managed on the host (i.e. driver active)
  546. */
  547. #define MC_CMD_DRV_ATTACH 0x1c
  548. #define MC_CMD_DRV_ATTACH_IN_LEN 8
  549. #define MC_CMD_DRV_ATTACH_IN_NEW_STATE_OFST 0
  550. #define MC_CMD_DRV_ATTACH_IN_UPDATE_OFST 4
  551. #define MC_CMD_DRV_ATTACH_OUT_LEN 4
  552. #define MC_CMD_DRV_ATTACH_OUT_OLD_STATE_OFST 0
  553. /* MC_CMD_NCSI_PROD: (debug)
  554. * Trigger an NC-SI event (and possibly an AEN in response)
  555. */
  556. #define MC_CMD_NCSI_PROD 0x1d
  557. #define MC_CMD_NCSI_PROD_IN_LEN 4
  558. #define MC_CMD_NCSI_PROD_IN_EVENTS_OFST 0
  559. #define MC_CMD_NCSI_PROD_LINKCHANGE_LBN 0
  560. #define MC_CMD_NCSI_PROD_LINKCHANGE_WIDTH 1
  561. #define MC_CMD_NCSI_PROD_RESET_LBN 1
  562. #define MC_CMD_NCSI_PROD_RESET_WIDTH 1
  563. #define MC_CMD_NCSI_PROD_DRVATTACH_LBN 2
  564. #define MC_CMD_NCSI_PROD_DRVATTACH_WIDTH 1
  565. #define MC_CMD_NCSI_PROD_OUT_LEN 0
  566. /* Enumeration */
  567. #define MC_CMD_NCSI_PROD_LINKCHANGE 0
  568. #define MC_CMD_NCSI_PROD_RESET 1
  569. #define MC_CMD_NCSI_PROD_DRVATTACH 2
  570. /* MC_CMD_DEVEL: (debug)
  571. * Reserved for development
  572. */
  573. #define MC_CMD_DEVEL 0x1e
  574. /* MC_CMD_SHMUART: (debug)
  575. * Route UART output to circular buffer in shared memory instead.
  576. */
  577. #define MC_CMD_SHMUART 0x1f
  578. #define MC_CMD_SHMUART_IN_FLAG_OFST 0
  579. #define MC_CMD_SHMUART_IN_LEN 4
  580. #define MC_CMD_SHMUART_OUT_LEN 0
  581. /* MC_CMD_PORT_RESET:
  582. * Generic per-port reset. There is no equivalent for per-board reset.
  583. *
  584. * Locks required: None
  585. * Return code: 0, ETIME
  586. */
  587. #define MC_CMD_PORT_RESET 0x20
  588. #define MC_CMD_PORT_RESET_IN_LEN 0
  589. #define MC_CMD_PORT_RESET_OUT_LEN 0
  590. /* MC_CMD_RESOURCE_LOCK:
  591. * Generic resource lock/unlock interface.
  592. *
  593. * Locks required: None
  594. * Return code: 0,
  595. * EBUSY (if trylock is contended by other port),
  596. * EDEADLK (if trylock is already acquired by this port)
  597. * EINVAL (if unlock doesn't own the lock)
  598. */
  599. #define MC_CMD_RESOURCE_LOCK 0x21
  600. #define MC_CMD_RESOURCE_LOCK_IN_LEN 8
  601. #define MC_CMD_RESOURCE_LOCK_IN_ACTION_OFST 0
  602. #define MC_CMD_RESOURCE_LOCK_ACTION_TRYLOCK 1
  603. #define MC_CMD_RESOURCE_LOCK_ACTION_UNLOCK 0
  604. #define MC_CMD_RESOURCE_LOCK_IN_RESOURCE_OFST 4
  605. #define MC_CMD_RESOURCE_LOCK_I2C 2
  606. #define MC_CMD_RESOURCE_LOCK_PHY 3
  607. #define MC_CMD_RESOURCE_LOCK_OUT_LEN 0
  608. /* MC_CMD_SPI_COMMAND: (variadic in, variadic out)
  609. * Read/Write to/from the SPI device.
  610. *
  611. * Locks required: SPI_LOCK
  612. * Return code: 0, ETIME, EINVAL, EACCES (if SPI_LOCK is not held)
  613. */
  614. #define MC_CMD_SPI_COMMAND 0x22
  615. #define MC_CMD_SPI_COMMAND_IN_LEN(_write_bytes) (12 + (_write_bytes))
  616. #define MC_CMD_SPI_COMMAND_IN_ARGS_OFST 0
  617. #define MC_CMD_SPI_COMMAND_IN_ARGS_ADDRESS_OFST 0
  618. #define MC_CMD_SPI_COMMAND_IN_ARGS_READ_BYTES_OFST 4
  619. #define MC_CMD_SPI_COMMAND_IN_ARGS_CHIP_SELECT_OFST 8
  620. /* Data to write here */
  621. #define MC_CMD_SPI_COMMAND_IN_WRITE_BUFFER_OFST 12
  622. #define MC_CMD_SPI_COMMAND_OUT_LEN(_read_bytes) (_read_bytes)
  623. /* Data read here */
  624. #define MC_CMD_SPI_COMMAND_OUT_READ_BUFFER_OFST 0
  625. /* MC_CMD_I2C_READ_WRITE: (variadic in, variadic out)
  626. * Read/Write to/from the I2C bus.
  627. *
  628. * Locks required: I2C_LOCK
  629. * Return code: 0, ETIME, EINVAL, EACCES (if I2C_LOCK is not held)
  630. */
  631. #define MC_CMD_I2C_RW 0x23
  632. #define MC_CMD_I2C_RW_IN_LEN(_write_bytes) (8 + (_write_bytes))
  633. #define MC_CMD_I2C_RW_IN_ARGS_OFST 0
  634. #define MC_CMD_I2C_RW_IN_ARGS_ADDR_OFST 0
  635. #define MC_CMD_I2C_RW_IN_ARGS_READ_BYTES_OFST 4
  636. /* Data to write here */
  637. #define MC_CMD_I2C_RW_IN_WRITE_BUFFER_OFSET 8
  638. #define MC_CMD_I2C_RW_OUT_LEN(_read_bytes) (_read_bytes)
  639. /* Data read here */
  640. #define MC_CMD_I2C_RW_OUT_READ_BUFFER_OFST 0
  641. /* Generic phy capability bitmask */
  642. #define MC_CMD_PHY_CAP_10HDX_LBN 1
  643. #define MC_CMD_PHY_CAP_10HDX_WIDTH 1
  644. #define MC_CMD_PHY_CAP_10FDX_LBN 2
  645. #define MC_CMD_PHY_CAP_10FDX_WIDTH 1
  646. #define MC_CMD_PHY_CAP_100HDX_LBN 3
  647. #define MC_CMD_PHY_CAP_100HDX_WIDTH 1
  648. #define MC_CMD_PHY_CAP_100FDX_LBN 4
  649. #define MC_CMD_PHY_CAP_100FDX_WIDTH 1
  650. #define MC_CMD_PHY_CAP_1000HDX_LBN 5
  651. #define MC_CMD_PHY_CAP_1000HDX_WIDTH 1
  652. #define MC_CMD_PHY_CAP_1000FDX_LBN 6
  653. #define MC_CMD_PHY_CAP_1000FDX_WIDTH 1
  654. #define MC_CMD_PHY_CAP_10000FDX_LBN 7
  655. #define MC_CMD_PHY_CAP_10000FDX_WIDTH 1
  656. #define MC_CMD_PHY_CAP_PAUSE_LBN 8
  657. #define MC_CMD_PHY_CAP_PAUSE_WIDTH 1
  658. #define MC_CMD_PHY_CAP_ASYM_LBN 9
  659. #define MC_CMD_PHY_CAP_ASYM_WIDTH 1
  660. #define MC_CMD_PHY_CAP_AN_LBN 10
  661. #define MC_CMD_PHY_CAP_AN_WIDTH 1
  662. /* Generic loopback enumeration */
  663. #define MC_CMD_LOOPBACK_NONE 0
  664. #define MC_CMD_LOOPBACK_DATA 1
  665. #define MC_CMD_LOOPBACK_GMAC 2
  666. #define MC_CMD_LOOPBACK_XGMII 3
  667. #define MC_CMD_LOOPBACK_XGXS 4
  668. #define MC_CMD_LOOPBACK_XAUI 5
  669. #define MC_CMD_LOOPBACK_GMII 6
  670. #define MC_CMD_LOOPBACK_SGMII 7
  671. #define MC_CMD_LOOPBACK_XGBR 8
  672. #define MC_CMD_LOOPBACK_XFI 9
  673. #define MC_CMD_LOOPBACK_XAUI_FAR 10
  674. #define MC_CMD_LOOPBACK_GMII_FAR 11
  675. #define MC_CMD_LOOPBACK_SGMII_FAR 12
  676. #define MC_CMD_LOOPBACK_XFI_FAR 13
  677. #define MC_CMD_LOOPBACK_GPHY 14
  678. #define MC_CMD_LOOPBACK_PHYXS 15
  679. #define MC_CMD_LOOPBACK_PCS 16
  680. #define MC_CMD_LOOPBACK_PMAPMD 17
  681. #define MC_CMD_LOOPBACK_XPORT 18
  682. #define MC_CMD_LOOPBACK_XGMII_WS 19
  683. #define MC_CMD_LOOPBACK_XAUI_WS 20
  684. #define MC_CMD_LOOPBACK_XAUI_WS_FAR 21
  685. #define MC_CMD_LOOPBACK_XAUI_WS_NEAR 22
  686. #define MC_CMD_LOOPBACK_GMII_WS 23
  687. #define MC_CMD_LOOPBACK_XFI_WS 24
  688. #define MC_CMD_LOOPBACK_XFI_WS_FAR 25
  689. #define MC_CMD_LOOPBACK_PHYXS_WS 26
  690. /* Generic PHY statistics enumeration */
  691. #define MC_CMD_OUI 0
  692. #define MC_CMD_PMA_PMD_LINK_UP 1
  693. #define MC_CMD_PMA_PMD_RX_FAULT 2
  694. #define MC_CMD_PMA_PMD_TX_FAULT 3
  695. #define MC_CMD_PMA_PMD_SIGNAL 4
  696. #define MC_CMD_PMA_PMD_SNR_A 5
  697. #define MC_CMD_PMA_PMD_SNR_B 6
  698. #define MC_CMD_PMA_PMD_SNR_C 7
  699. #define MC_CMD_PMA_PMD_SNR_D 8
  700. #define MC_CMD_PCS_LINK_UP 9
  701. #define MC_CMD_PCS_RX_FAULT 10
  702. #define MC_CMD_PCS_TX_FAULT 11
  703. #define MC_CMD_PCS_BER 12
  704. #define MC_CMD_PCS_BLOCK_ERRORS 13
  705. #define MC_CMD_PHYXS_LINK_UP 14
  706. #define MC_CMD_PHYXS_RX_FAULT 15
  707. #define MC_CMD_PHYXS_TX_FAULT 16
  708. #define MC_CMD_PHYXS_ALIGN 17
  709. #define MC_CMD_PHYXS_SYNC 18
  710. #define MC_CMD_AN_LINK_UP 19
  711. #define MC_CMD_AN_COMPLETE 20
  712. #define MC_CMD_AN_10GBT_STATUS 21
  713. #define MC_CMD_CL22_LINK_UP 22
  714. #define MC_CMD_PHY_NSTATS 23
  715. /* MC_CMD_GET_PHY_CFG:
  716. * Report PHY configuration. This guarantees to succeed even if the PHY is in
  717. * a "zombie" state.
  718. *
  719. * Locks required: None
  720. * Return code: 0
  721. */
  722. #define MC_CMD_GET_PHY_CFG 0x24
  723. #define MC_CMD_GET_PHY_CFG_IN_LEN 0
  724. #define MC_CMD_GET_PHY_CFG_OUT_LEN 72
  725. #define MC_CMD_GET_PHY_CFG_OUT_FLAGS_OFST 0
  726. #define MC_CMD_GET_PHY_CFG_PRESENT_LBN 0
  727. #define MC_CMD_GET_PHY_CFG_PRESENT_WIDTH 1
  728. #define MC_CMD_GET_PHY_CFG_SHORTBIST_LBN 1
  729. #define MC_CMD_GET_PHY_CFG_SHORTBIST_WIDTH 1
  730. #define MC_CMD_GET_PHY_CFG_LONGBIST_LBN 2
  731. #define MC_CMD_GET_PHY_CFG_LONGBIST_WIDTH 1
  732. #define MC_CMD_GET_PHY_CFG_LOWPOWER_LBN 3
  733. #define MC_CMD_GET_PHY_CFG_LOWPOWER_WIDTH 1
  734. #define MC_CMD_GET_PHY_CFG_POWEROFF_LBN 4
  735. #define MC_CMD_GET_PHY_CFG_POWEROFF_WIDTH 1
  736. #define MC_CMD_GET_PHY_CFG_TXDIS_LBN 5
  737. #define MC_CMD_GET_PHY_CFG_TXDIS_WIDTH 1
  738. #define MC_CMD_GET_PHY_CFG_OUT_TYPE_OFST 4
  739. /* Bitmask of supported capabilities */
  740. #define MC_CMD_GET_PHY_CFG_OUT_SUPPORTED_CAP_OFST 8
  741. #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_OFST 12
  742. #define MC_CMD_GET_PHY_CFG_OUT_PRT_OFST 16
  743. /* PHY statistics bitmap */
  744. #define MC_CMD_GET_PHY_CFG_OUT_STATS_MASK_OFST 20
  745. /* PHY type/name string */
  746. #define MC_CMD_GET_PHY_CFG_OUT_NAME_OFST 24
  747. #define MC_CMD_GET_PHY_CFG_OUT_NAME_LEN 20
  748. #define MC_CMD_GET_PHY_CFG_OUT_MEDIA_TYPE_OFST 44
  749. #define MC_CMD_MEDIA_XAUI 1
  750. #define MC_CMD_MEDIA_CX4 2
  751. #define MC_CMD_MEDIA_KX4 3
  752. #define MC_CMD_MEDIA_XFP 4
  753. #define MC_CMD_MEDIA_SFP_PLUS 5
  754. #define MC_CMD_MEDIA_BASE_T 6
  755. /* MDIO "MMDS" supported */
  756. #define MC_CMD_GET_PHY_CFG_OUT_MMD_MASK_OFST 48
  757. /* Native clause 22 */
  758. #define MC_CMD_MMD_CLAUSE22 0
  759. #define MC_CMD_MMD_CLAUSE45_PMAPMD 1
  760. #define MC_CMD_MMD_CLAUSE45_WIS 2
  761. #define MC_CMD_MMD_CLAUSE45_PCS 3
  762. #define MC_CMD_MMD_CLAUSE45_PHYXS 4
  763. #define MC_CMD_MMD_CLAUSE45_DTEXS 5
  764. #define MC_CMD_MMD_CLAUSE45_TC 6
  765. #define MC_CMD_MMD_CLAUSE45_AN 7
  766. /* Clause22 proxied over clause45 by PHY */
  767. #define MC_CMD_MMD_CLAUSE45_C22EXT 29
  768. #define MC_CMD_MMD_CLAUSE45_VEND1 30
  769. #define MC_CMD_MMD_CLAUSE45_VEND2 31
  770. /* PHY stepping version */
  771. #define MC_CMD_GET_PHY_CFG_OUT_REVISION_OFST 52
  772. #define MC_CMD_GET_PHY_CFG_OUT_REVISION_LEN 20
  773. /* MC_CMD_START_PHY_BIST:
  774. * Start a BIST test on the PHY.
  775. *
  776. * Locks required: PHY_LOCK if doing a PHY BIST
  777. * Return code: 0, EINVAL, EACCES (if PHY_LOCK is not held)
  778. */
  779. #define MC_CMD_START_BIST 0x25
  780. #define MC_CMD_START_BIST_IN_LEN 4
  781. #define MC_CMD_START_BIST_TYPE_OFST 0
  782. /* Run the PHY's short BIST */
  783. #define MC_CMD_PHY_BIST_SHORT 1
  784. /* Run the PHY's long BIST */
  785. #define MC_CMD_PHY_BIST_LONG 2
  786. /* Run BIST on the currently selected BPX Serdes (XAUI or XFI) */
  787. #define MC_CMD_BPX_SERDES_BIST 3
  788. /* MC_CMD_POLL_PHY_BIST: (variadic output)
  789. * Poll for BIST completion
  790. *
  791. * Returns a single status code, and a binary blob of phy-specific
  792. * bist output. If the driver can't succesfully parse the BIST output,
  793. * it should still respect the Pass/Fail in OUT.RESULT.
  794. *
  795. * Locks required: PHY_LOCK if doing a PHY BIST
  796. * Return code: 0, EACCES (if PHY_LOCK is not held)
  797. */
  798. #define MC_CMD_POLL_BIST 0x26
  799. #define MC_CMD_POLL_BIST_IN_LEN 0
  800. #define MC_CMD_POLL_BIST_OUT_LEN UNKNOWN
  801. #define MC_CMD_POLL_BIST_OUT_RESULT_OFST 0
  802. #define MC_CMD_POLL_BIST_RUNNING 1
  803. #define MC_CMD_POLL_BIST_PASSED 2
  804. #define MC_CMD_POLL_BIST_FAILED 3
  805. #define MC_CMD_POLL_BIST_TIMEOUT 4
  806. #define MC_CMD_POLL_BIST_OUT_PRIVATE_OFST 4
  807. /* MC_CMD_PHY_SPI: (variadic in, variadic out)
  808. * Read/Write/Erase the PHY SPI device
  809. *
  810. * Locks required: PHY_LOCK
  811. * Return code: 0, ETIME, EINVAL, EACCES (if PHY_LOCK is not held)
  812. */
  813. #define MC_CMD_PHY_SPI 0x27
  814. #define MC_CMD_PHY_SPI_IN_LEN(_write_bytes) (12 + (_write_bytes))
  815. #define MC_CMD_PHY_SPI_IN_ARGS_OFST 0
  816. #define MC_CMD_PHY_SPI_IN_ARGS_ADDR_OFST 0
  817. #define MC_CMD_PHY_SPI_IN_ARGS_READ_BYTES_OFST 4
  818. #define MC_CMD_PHY_SPI_IN_ARGS_ERASE_ALL_OFST 8
  819. /* Data to write here */
  820. #define MC_CMD_PHY_SPI_IN_WRITE_BUFFER_OFSET 12
  821. #define MC_CMD_PHY_SPI_OUT_LEN(_read_bytes) (_read_bytes)
  822. /* Data read here */
  823. #define MC_CMD_PHY_SPI_OUT_READ_BUFFER_OFST 0
  824. /* MC_CMD_GET_LOOPBACK_MODES:
  825. * Returns a bitmask of loopback modes evailable at each speed.
  826. *
  827. * Locks required: None
  828. * Return code: 0
  829. */
  830. #define MC_CMD_GET_LOOPBACK_MODES 0x28
  831. #define MC_CMD_GET_LOOPBACK_MODES_IN_LEN 0
  832. #define MC_CMD_GET_LOOPBACK_MODES_OUT_LEN 32
  833. #define MC_CMD_GET_LOOPBACK_MODES_100M_OFST 0
  834. #define MC_CMD_GET_LOOPBACK_MODES_1G_OFST 8
  835. #define MC_CMD_GET_LOOPBACK_MODES_10G_OFST 16
  836. #define MC_CMD_GET_LOOPBACK_MODES_SUGGESTED_OFST 24
  837. /* Flow control enumeration */
  838. #define MC_CMD_FCNTL_OFF 0
  839. #define MC_CMD_FCNTL_RESPOND 1
  840. #define MC_CMD_FCNTL_BIDIR 2
  841. /* Auto - Use what the link has autonegotiated
  842. * - The driver should modify the advertised capabilities via SET_LINK.CAP
  843. * to control the negotiated flow control mode.
  844. * - Can only be set if the PHY supports PAUSE+ASYM capabilities
  845. * - Never returned by GET_LINK as the value programmed into the MAC
  846. */
  847. #define MC_CMD_FCNTL_AUTO 3
  848. /* Generic mac fault bitmask */
  849. #define MC_CMD_MAC_FAULT_XGMII_LOCAL_LBN 0
  850. #define MC_CMD_MAC_FAULT_XGMII_LOCAL_WIDTH 1
  851. #define MC_CMD_MAC_FAULT_XGMII_REMOTE_LBN 1
  852. #define MC_CMD_MAC_FAULT_XGMII_REMOTE_WIDTH 1
  853. #define MC_CMD_MAC_FAULT_SGMII_REMOTE_LBN 2
  854. #define MC_CMD_MAC_FAULT_SGMII_REMOTE_WIDTH 1
  855. /* MC_CMD_GET_LINK:
  856. * Read the unified MAC/PHY link state
  857. *
  858. * Locks required: None
  859. * Return code: 0, ETIME
  860. */
  861. #define MC_CMD_GET_LINK 0x29
  862. #define MC_CMD_GET_LINK_IN_LEN 0
  863. #define MC_CMD_GET_LINK_OUT_LEN 28
  864. /* near-side and link-partner advertised capabilities */
  865. #define MC_CMD_GET_LINK_OUT_CAP_OFST 0
  866. #define MC_CMD_GET_LINK_OUT_LP_CAP_OFST 4
  867. /* Autonegotiated speed in mbit/s. The link may still be down
  868. * even if this reads non-zero */
  869. #define MC_CMD_GET_LINK_OUT_LINK_SPEED_OFST 8
  870. #define MC_CMD_GET_LINK_OUT_LOOPBACK_MODE_OFST 12
  871. #define MC_CMD_GET_LINK_OUT_FLAGS_OFST 16
  872. /* Whether we have overall link up */
  873. #define MC_CMD_GET_LINK_LINK_UP_LBN 0
  874. #define MC_CMD_GET_LINK_LINK_UP_WIDTH 1
  875. #define MC_CMD_GET_LINK_FULL_DUPLEX_LBN 1
  876. #define MC_CMD_GET_LINK_FULL_DUPLEX_WIDTH 1
  877. /* Whether we have link at the layers provided by the BPX */
  878. #define MC_CMD_GET_LINK_BPX_LINK_LBN 2
  879. #define MC_CMD_GET_LINK_BPX_LINK_WIDTH 1
  880. /* Whether the PHY has external link */
  881. #define MC_CMD_GET_LINK_PHY_LINK_LBN 3
  882. #define MC_CMD_GET_LINK_PHY_LINK_WIDTH 1
  883. #define MC_CMD_GET_LINK_OUT_FCNTL_OFST 20
  884. #define MC_CMD_GET_LINK_OUT_MAC_FAULT_OFST 24
  885. /* MC_CMD_SET_LINK:
  886. * Write the unified MAC/PHY link configuration
  887. *
  888. * A loopback speed of "0" is supported, and means
  889. * (choose any available speed)
  890. *
  891. * Locks required: None
  892. * Return code: 0, EINVAL, ETIME
  893. */
  894. #define MC_CMD_SET_LINK 0x2a
  895. #define MC_CMD_SET_LINK_IN_LEN 16
  896. #define MC_CMD_SET_LINK_IN_CAP_OFST 0
  897. #define MC_CMD_SET_LINK_IN_FLAGS_OFST 4
  898. #define MC_CMD_SET_LINK_LOWPOWER_LBN 0
  899. #define MC_CMD_SET_LINK_LOWPOWER_WIDTH 1
  900. #define MC_CMD_SET_LINK_POWEROFF_LBN 1
  901. #define MC_CMD_SET_LINK_POWEROFF_WIDTH 1
  902. #define MC_CMD_SET_LINK_TXDIS_LBN 2
  903. #define MC_CMD_SET_LINK_TXDIS_WIDTH 1
  904. #define MC_CMD_SET_LINK_IN_LOOPBACK_MODE_OFST 8
  905. #define MC_CMD_SET_LINK_IN_LOOPBACK_SPEED_OFST 12
  906. #define MC_CMD_SET_LINK_OUT_LEN 0
  907. /* MC_CMD_SET_ID_LED:
  908. * Set indentification LED state
  909. *
  910. * Locks required: None
  911. * Return code: 0, EINVAL
  912. */
  913. #define MC_CMD_SET_ID_LED 0x2b
  914. #define MC_CMD_SET_ID_LED_IN_LEN 4
  915. #define MC_CMD_SET_ID_LED_IN_STATE_OFST 0
  916. #define MC_CMD_LED_OFF 0
  917. #define MC_CMD_LED_ON 1
  918. #define MC_CMD_LED_DEFAULT 2
  919. #define MC_CMD_SET_ID_LED_OUT_LEN 0
  920. /* MC_CMD_SET_MAC:
  921. * Set MAC configuration
  922. *
  923. * The MTU is the MTU programmed directly into the XMAC/GMAC
  924. * (inclusive of EtherII, VLAN, bug16011 padding)
  925. *
  926. * Locks required: None
  927. * Return code: 0, EINVAL
  928. */
  929. #define MC_CMD_SET_MAC 0x2c
  930. #define MC_CMD_SET_MAC_IN_LEN 24
  931. #define MC_CMD_SET_MAC_IN_MTU_OFST 0
  932. #define MC_CMD_SET_MAC_IN_DRAIN_OFST 4
  933. #define MC_CMD_SET_MAC_IN_ADDR_OFST 8
  934. #define MC_CMD_SET_MAC_IN_REJECT_OFST 16
  935. #define MC_CMD_SET_MAC_IN_REJECT_UNCST_LBN 0
  936. #define MC_CMD_SET_MAC_IN_REJECT_UNCST_WIDTH 1
  937. #define MC_CMD_SET_MAC_IN_REJECT_BRDCST_LBN 1
  938. #define MC_CMD_SET_MAC_IN_REJECT_BRDCST_WIDTH 1
  939. #define MC_CMD_SET_MAC_IN_FCNTL_OFST 20
  940. #define MC_CMD_SET_MAC_OUT_LEN 0
  941. /* MC_CMD_PHY_STATS:
  942. * Get generic PHY statistics
  943. *
  944. * This call returns the statistics for a generic PHY, by direct DMA
  945. * into host memory, in a sparse array (indexed by the enumerate).
  946. * Each value is represented by a 32bit number.
  947. *
  948. * Locks required: None
  949. * Returns: 0, ETIME
  950. * Response methods: shared memory, event
  951. */
  952. #define MC_CMD_PHY_STATS 0x2d
  953. #define MC_CMD_PHY_STATS_IN_LEN 8
  954. #define MC_CMD_PHY_STATS_IN_DMA_ADDR_LO_OFST 0
  955. #define MC_CMD_PHY_STATS_IN_DMA_ADDR_HI_OFST 4
  956. #define MC_CMD_PHY_STATS_OUT_LEN 0
  957. /* Unified MAC statistics enumeration */
  958. #define MC_CMD_MAC_GENERATION_START 0
  959. #define MC_CMD_MAC_TX_PKTS 1
  960. #define MC_CMD_MAC_TX_PAUSE_PKTS 2
  961. #define MC_CMD_MAC_TX_CONTROL_PKTS 3
  962. #define MC_CMD_MAC_TX_UNICAST_PKTS 4
  963. #define MC_CMD_MAC_TX_MULTICAST_PKTS 5
  964. #define MC_CMD_MAC_TX_BROADCAST_PKTS 6
  965. #define MC_CMD_MAC_TX_BYTES 7
  966. #define MC_CMD_MAC_TX_BAD_BYTES 8
  967. #define MC_CMD_MAC_TX_LT64_PKTS 9
  968. #define MC_CMD_MAC_TX_64_PKTS 10
  969. #define MC_CMD_MAC_TX_65_TO_127_PKTS 11
  970. #define MC_CMD_MAC_TX_128_TO_255_PKTS 12
  971. #define MC_CMD_MAC_TX_256_TO_511_PKTS 13
  972. #define MC_CMD_MAC_TX_512_TO_1023_PKTS 14
  973. #define MC_CMD_MAC_TX_1024_TO_15XX_PKTS 15
  974. #define MC_CMD_MAC_TX_15XX_TO_JUMBO_PKTS 16
  975. #define MC_CMD_MAC_TX_GTJUMBO_PKTS 17
  976. #define MC_CMD_MAC_TX_BAD_FCS_PKTS 18
  977. #define MC_CMD_MAC_TX_SINGLE_COLLISION_PKTS 19
  978. #define MC_CMD_MAC_TX_MULTIPLE_COLLISION_PKTS 20
  979. #define MC_CMD_MAC_TX_EXCESSIVE_COLLISION_PKTS 21
  980. #define MC_CMD_MAC_TX_LATE_COLLISION_PKTS 22
  981. #define MC_CMD_MAC_TX_DEFERRED_PKTS 23
  982. #define MC_CMD_MAC_TX_EXCESSIVE_DEFERRED_PKTS 24
  983. #define MC_CMD_MAC_TX_NON_TCPUDP_PKTS 25
  984. #define MC_CMD_MAC_TX_MAC_SRC_ERR_PKTS 26
  985. #define MC_CMD_MAC_TX_IP_SRC_ERR_PKTS 27
  986. #define MC_CMD_MAC_RX_PKTS 28
  987. #define MC_CMD_MAC_RX_PAUSE_PKTS 29
  988. #define MC_CMD_MAC_RX_GOOD_PKTS 30
  989. #define MC_CMD_MAC_RX_CONTROL_PKTS 31
  990. #define MC_CMD_MAC_RX_UNICAST_PKTS 32
  991. #define MC_CMD_MAC_RX_MULTICAST_PKTS 33
  992. #define MC_CMD_MAC_RX_BROADCAST_PKTS 34
  993. #define MC_CMD_MAC_RX_BYTES 35
  994. #define MC_CMD_MAC_RX_BAD_BYTES 36
  995. #define MC_CMD_MAC_RX_64_PKTS 37
  996. #define MC_CMD_MAC_RX_65_TO_127_PKTS 38
  997. #define MC_CMD_MAC_RX_128_TO_255_PKTS 39
  998. #define MC_CMD_MAC_RX_256_TO_511_PKTS 40
  999. #define MC_CMD_MAC_RX_512_TO_1023_PKTS 41
  1000. #define MC_CMD_MAC_RX_1024_TO_15XX_PKTS 42
  1001. #define MC_CMD_MAC_RX_15XX_TO_JUMBO_PKTS 43
  1002. #define MC_CMD_MAC_RX_GTJUMBO_PKTS 44
  1003. #define MC_CMD_MAC_RX_UNDERSIZE_PKTS 45
  1004. #define MC_CMD_MAC_RX_BAD_FCS_PKTS 46
  1005. #define MC_CMD_MAC_RX_OVERFLOW_PKTS 47
  1006. #define MC_CMD_MAC_RX_FALSE_CARRIER_PKTS 48
  1007. #define MC_CMD_MAC_RX_SYMBOL_ERROR_PKTS 49
  1008. #define MC_CMD_MAC_RX_ALIGN_ERROR_PKTS 50
  1009. #define MC_CMD_MAC_RX_LENGTH_ERROR_PKTS 51
  1010. #define MC_CMD_MAC_RX_INTERNAL_ERROR_PKTS 52
  1011. #define MC_CMD_MAC_RX_JABBER_PKTS 53
  1012. #define MC_CMD_MAC_RX_NODESC_DROPS 54
  1013. #define MC_CMD_MAC_RX_LANES01_CHAR_ERR 55
  1014. #define MC_CMD_MAC_RX_LANES23_CHAR_ERR 56
  1015. #define MC_CMD_MAC_RX_LANES01_DISP_ERR 57
  1016. #define MC_CMD_MAC_RX_LANES23_DISP_ERR 58
  1017. #define MC_CMD_MAC_RX_MATCH_FAULT 59
  1018. /* Insert new members here. */
  1019. #define MC_CMD_MAC_GENERATION_END 60
  1020. #define MC_CMD_MAC_NSTATS (MC_CMD_MAC_GENERATION_END+1)
  1021. /* MC_CMD_MAC_STATS:
  1022. * Get unified GMAC/XMAC statistics
  1023. *
  1024. * This call returns unified statistics maintained by the MC as it
  1025. * switches between the GMAC and XMAC. The MC will write out all
  1026. * supported stats. The driver should zero initialise the buffer to
  1027. * guarantee consistent results.
  1028. *
  1029. * Locks required: None
  1030. * Returns: 0
  1031. * Response methods: shared memory, event
  1032. */
  1033. #define MC_CMD_MAC_STATS 0x2e
  1034. #define MC_CMD_MAC_STATS_IN_LEN 16
  1035. #define MC_CMD_MAC_STATS_IN_DMA_ADDR_LO_OFST 0
  1036. #define MC_CMD_MAC_STATS_IN_DMA_ADDR_HI_OFST 4
  1037. #define MC_CMD_MAC_STATS_IN_CMD_OFST 8
  1038. #define MC_CMD_MAC_STATS_CMD_DMA_LBN 0
  1039. #define MC_CMD_MAC_STATS_CMD_DMA_WIDTH 1
  1040. #define MC_CMD_MAC_STATS_CMD_CLEAR_LBN 1
  1041. #define MC_CMD_MAC_STATS_CMD_CLEAR_WIDTH 1
  1042. #define MC_CMD_MAC_STATS_CMD_PERIODIC_CHANGE_LBN 2
  1043. #define MC_CMD_MAC_STATS_CMD_PERIODIC_CHANGE_WIDTH 1
  1044. /* Fields only relevent when PERIODIC_CHANGE is set */
  1045. #define MC_CMD_MAC_STATS_CMD_PERIODIC_ENABLE_LBN 3
  1046. #define MC_CMD_MAC_STATS_CMD_PERIODIC_ENABLE_WIDTH 1
  1047. #define MC_CMD_MAC_STATS_CMD_PERIODIC_CLEAR_LBN 4
  1048. #define MC_CMD_MAC_STATS_CMD_PERIODIC_CLEAR_WIDTH 1
  1049. #define MC_CMD_MAC_STATS_CMD_PERIOD_MS_LBN 16
  1050. #define MC_CMD_MAC_STATS_CMD_PERIOD_MS_WIDTH 16
  1051. #define MC_CMD_MAC_STATS_IN_DMA_LEN_OFST 12
  1052. #define MC_CMD_MAC_STATS_OUT_LEN 0
  1053. /* Callisto flags */
  1054. #define MC_CMD_SFT9001_ROBUST_LBN 0
  1055. #define MC_CMD_SFT9001_ROBUST_WIDTH 1
  1056. #define MC_CMD_SFT9001_SHORT_REACH_LBN 1
  1057. #define MC_CMD_SFT9001_SHORT_REACH_WIDTH 1
  1058. /* MC_CMD_SFT9001_GET:
  1059. * Read current callisto specific setting
  1060. *
  1061. * Locks required: None
  1062. * Returns: 0, ETIME
  1063. */
  1064. #define MC_CMD_SFT9001_GET 0x30
  1065. #define MC_CMD_SFT9001_GET_IN_LEN 0
  1066. #define MC_CMD_SFT9001_GET_OUT_LEN 4
  1067. #define MC_CMD_SFT9001_GET_OUT_FLAGS_OFST 0
  1068. /* MC_CMD_SFT9001_SET:
  1069. * Write current callisto specific setting
  1070. *
  1071. * Locks required: None
  1072. * Returns: 0, ETIME, EINVAL
  1073. */
  1074. #define MC_CMD_SFT9001_SET 0x31
  1075. #define MC_CMD_SFT9001_SET_IN_LEN 4
  1076. #define MC_CMD_SFT9001_SET_IN_FLAGS_OFST 0
  1077. #define MC_CMD_SFT9001_SET_OUT_LEN 0
  1078. /* MC_CMD_WOL_FILTER_SET:
  1079. * Set a WoL filter
  1080. *
  1081. * Locks required: None
  1082. * Returns: 0, EBUSY, EINVAL, ENOSYS
  1083. */
  1084. #define MC_CMD_WOL_FILTER_SET 0x32
  1085. #define MC_CMD_WOL_FILTER_SET_IN_LEN 192 /* 190 rounded up to a word */
  1086. #define MC_CMD_WOL_FILTER_SET_IN_FILTER_MODE_OFST 0
  1087. #define MC_CMD_WOL_FILTER_SET_IN_WOL_TYPE_OFST 4
  1088. /* There is a union at offset 8, following defines overlap due to
  1089. * this */
  1090. #define MC_CMD_WOL_FILTER_SET_IN_DATA_OFST 8
  1091. #define MC_CMD_WOL_FILTER_SET_IN_MAGIC_MAC_OFST \
  1092. MC_CMD_WOL_FILTER_SET_IN_DATA_OFST
  1093. #define MC_CMD_WOL_FILTER_SET_IN_IPV4_SYN_SRC_IP_OFST \
  1094. MC_CMD_WOL_FILTER_SET_IN_DATA_OFST
  1095. #define MC_CMD_WOL_FILTER_SET_IN_IPV4_SYN_DST_IP_OFST \
  1096. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 4)
  1097. #define MC_CMD_WOL_FILTER_SET_IN_IPV4_SYN_SRC_PORT_OFST \
  1098. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 8)
  1099. #define MC_CMD_WOL_FILTER_SET_IN_IPV4_SYN_DST_PORT_OFST \
  1100. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 10)
  1101. #define MC_CMD_WOL_FILTER_SET_IN_IPV6_SYN_SRC_IP_OFST \
  1102. MC_CMD_WOL_FILTER_SET_IN_DATA_OFST
  1103. #define MC_CMD_WOL_FILTER_SET_IN_IPV6_SYN_DST_IP_OFST \
  1104. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 16)
  1105. #define MC_CMD_WOL_FILTER_SET_IN_IPV6_SYN_SRC_PORT_OFST \
  1106. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 32)
  1107. #define MC_CMD_WOL_FILTER_SET_IN_IPV6_SYN_DST_PORT_OFST \
  1108. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 34)
  1109. #define MC_CMD_WOL_FILTER_SET_IN_BITMAP_MASK_OFST \
  1110. MC_CMD_WOL_FILTER_SET_IN_DATA_OFST
  1111. #define MC_CMD_WOL_FILTER_SET_IN_BITMAP_OFST \
  1112. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 48)
  1113. #define MC_CMD_WOL_FILTER_SET_IN_BITMAP_LEN_OFST \
  1114. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 176)
  1115. #define MC_CMD_WOL_FILTER_SET_IN_BITMAP_LAYER3_OFST \
  1116. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 177)
  1117. #define MC_CMD_WOL_FILTER_SET_IN_BITMAP_LAYER4_OFST \
  1118. (MC_CMD_WOL_FILTER_SET_IN_DATA_OFST + 178)
  1119. #define MC_CMD_WOL_FILTER_SET_OUT_LEN 4
  1120. #define MC_CMD_WOL_FILTER_SET_OUT_FILTER_ID_OFST 0
  1121. /* WOL Filter types enumeration */
  1122. #define MC_CMD_WOL_TYPE_MAGIC 0x0
  1123. /* unused 0x1 */
  1124. #define MC_CMD_WOL_TYPE_WIN_MAGIC 0x2
  1125. #define MC_CMD_WOL_TYPE_IPV4_SYN 0x3
  1126. #define MC_CMD_WOL_TYPE_IPV6_SYN 0x4
  1127. #define MC_CMD_WOL_TYPE_BITMAP 0x5
  1128. #define MC_CMD_WOL_TYPE_MAX 0x6
  1129. #define MC_CMD_FILTER_MODE_SIMPLE 0x0
  1130. #define MC_CMD_FILTER_MODE_STRUCTURED 0xffffffff
  1131. /* MC_CMD_WOL_FILTER_REMOVE:
  1132. * Remove a WoL filter
  1133. *
  1134. * Locks required: None
  1135. * Returns: 0, EINVAL, ENOSYS
  1136. */
  1137. #define MC_CMD_WOL_FILTER_REMOVE 0x33
  1138. #define MC_CMD_WOL_FILTER_REMOVE_IN_LEN 4
  1139. #define MC_CMD_WOL_FILTER_REMOVE_IN_FILTER_ID_OFST 0
  1140. #define MC_CMD_WOL_FILTER_REMOVE_OUT_LEN 0
  1141. /* MC_CMD_WOL_FILTER_RESET:
  1142. * Reset (i.e. remove all) WoL filters
  1143. *
  1144. * Locks required: None
  1145. * Returns: 0, ENOSYS
  1146. */
  1147. #define MC_CMD_WOL_FILTER_RESET 0x34
  1148. #define MC_CMD_WOL_FILTER_RESET_IN_LEN 0
  1149. #define MC_CMD_WOL_FILTER_RESET_OUT_LEN 0
  1150. /* MC_CMD_SET_MCAST_HASH:
  1151. * Set the MCASH hash value without otherwise
  1152. * reconfiguring the MAC
  1153. */
  1154. #define MC_CMD_SET_MCAST_HASH 0x35
  1155. #define MC_CMD_SET_MCAST_HASH_IN_LEN 32
  1156. #define MC_CMD_SET_MCAST_HASH_IN_HASH0_OFST 0
  1157. #define MC_CMD_SET_MCAST_HASH_IN_HASH1_OFST 16
  1158. #define MC_CMD_SET_MCAST_HASH_OUT_LEN 0
  1159. /* MC_CMD_NVRAM_TYPES:
  1160. * Return bitfield indicating available types of virtual NVRAM partitions
  1161. *
  1162. * Locks required: none
  1163. * Returns: 0
  1164. */
  1165. #define MC_CMD_NVRAM_TYPES 0x36
  1166. #define MC_CMD_NVRAM_TYPES_IN_LEN 0
  1167. #define MC_CMD_NVRAM_TYPES_OUT_LEN 4
  1168. #define MC_CMD_NVRAM_TYPES_OUT_TYPES_OFST 0
  1169. /* Supported NVRAM types */
  1170. #define MC_CMD_NVRAM_TYPE_DISABLED_CALLISTO 0
  1171. #define MC_CMD_NVRAM_TYPE_MC_FW 1
  1172. #define MC_CMD_NVRAM_TYPE_MC_FW_BACKUP 2
  1173. #define MC_CMD_NVRAM_TYPE_STATIC_CFG_PORT0 3
  1174. #define MC_CMD_NVRAM_TYPE_STATIC_CFG_PORT1 4
  1175. #define MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT0 5
  1176. #define MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT1 6
  1177. #define MC_CMD_NVRAM_TYPE_EXP_ROM 7
  1178. #define MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT0 8
  1179. #define MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT1 9
  1180. #define MC_CMD_NVRAM_TYPE_PHY_PORT0 10
  1181. #define MC_CMD_NVRAM_TYPE_PHY_PORT1 11
  1182. #define MC_CMD_NVRAM_TYPE_LOG 12
  1183. /* MC_CMD_NVRAM_INFO:
  1184. * Read info about a virtual NVRAM partition
  1185. *
  1186. * Locks required: none
  1187. * Returns: 0, EINVAL (bad type)
  1188. */
  1189. #define MC_CMD_NVRAM_INFO 0x37
  1190. #define MC_CMD_NVRAM_INFO_IN_LEN 4
  1191. #define MC_CMD_NVRAM_INFO_IN_TYPE_OFST 0
  1192. #define MC_CMD_NVRAM_INFO_OUT_LEN 24
  1193. #define MC_CMD_NVRAM_INFO_OUT_TYPE_OFST 0
  1194. #define MC_CMD_NVRAM_INFO_OUT_SIZE_OFST 4
  1195. #define MC_CMD_NVRAM_INFO_OUT_ERASESIZE_OFST 8
  1196. #define MC_CMD_NVRAM_INFO_OUT_FLAGS_OFST 12
  1197. #define MC_CMD_NVRAM_PROTECTED_LBN 0
  1198. #define MC_CMD_NVRAM_PROTECTED_WIDTH 1
  1199. #define MC_CMD_NVRAM_INFO_OUT_PHYSDEV_OFST 16
  1200. #define MC_CMD_NVRAM_INFO_OUT_PHYSADDR_OFST 20
  1201. /* MC_CMD_NVRAM_UPDATE_START:
  1202. * Start a group of update operations on a virtual NVRAM partition
  1203. *
  1204. * Locks required: PHY_LOCK if type==*PHY*
  1205. * Returns: 0, EINVAL (bad type), EACCES (if PHY_LOCK required and not held)
  1206. */
  1207. #define MC_CMD_NVRAM_UPDATE_START 0x38
  1208. #define MC_CMD_NVRAM_UPDATE_START_IN_LEN 4
  1209. #define MC_CMD_NVRAM_UPDATE_START_IN_TYPE_OFST 0
  1210. #define MC_CMD_NVRAM_UPDATE_START_OUT_LEN 0
  1211. /* MC_CMD_NVRAM_READ:
  1212. * Read data from a virtual NVRAM partition
  1213. *
  1214. * Locks required: PHY_LOCK if type==*PHY*
  1215. * Returns: 0, EINVAL (bad type/offset/length), EACCES (if PHY_LOCK required and not held)
  1216. */
  1217. #define MC_CMD_NVRAM_READ 0x39
  1218. #define MC_CMD_NVRAM_READ_IN_LEN 12
  1219. #define MC_CMD_NVRAM_READ_IN_TYPE_OFST 0
  1220. #define MC_CMD_NVRAM_READ_IN_OFFSET_OFST 4
  1221. #define MC_CMD_NVRAM_READ_IN_LENGTH_OFST 8
  1222. #define MC_CMD_NVRAM_READ_OUT_LEN(_read_bytes) (_read_bytes)
  1223. #define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_OFST 0
  1224. /* MC_CMD_NVRAM_WRITE:
  1225. * Write data to a virtual NVRAM partition
  1226. *
  1227. * Locks required: PHY_LOCK if type==*PHY*
  1228. * Returns: 0, EINVAL (bad type/offset/length), EACCES (if PHY_LOCK required and not held)
  1229. */
  1230. #define MC_CMD_NVRAM_WRITE 0x3a
  1231. #define MC_CMD_NVRAM_WRITE_IN_TYPE_OFST 0
  1232. #define MC_CMD_NVRAM_WRITE_IN_OFFSET_OFST 4
  1233. #define MC_CMD_NVRAM_WRITE_IN_LENGTH_OFST 8
  1234. #define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_OFST 12
  1235. #define MC_CMD_NVRAM_WRITE_IN_LEN(_write_bytes) (12 + _write_bytes)
  1236. #define MC_CMD_NVRAM_WRITE_OUT_LEN 0
  1237. /* MC_CMD_NVRAM_ERASE:
  1238. * Erase sector(s) from a virtual NVRAM partition
  1239. *
  1240. * Locks required: PHY_LOCK if type==*PHY*
  1241. * Returns: 0, EINVAL (bad type/offset/length), EACCES (if PHY_LOCK required and not held)
  1242. */
  1243. #define MC_CMD_NVRAM_ERASE 0x3b
  1244. #define MC_CMD_NVRAM_ERASE_IN_LEN 12
  1245. #define MC_CMD_NVRAM_ERASE_IN_TYPE_OFST 0
  1246. #define MC_CMD_NVRAM_ERASE_IN_OFFSET_OFST 4
  1247. #define MC_CMD_NVRAM_ERASE_IN_LENGTH_OFST 8
  1248. #define MC_CMD_NVRAM_ERASE_OUT_LEN 0
  1249. /* MC_CMD_NVRAM_UPDATE_FINISH:
  1250. * Finish a group of update operations on a virtual NVRAM partition
  1251. *
  1252. * Locks required: PHY_LOCK if type==*PHY*
  1253. * Returns: 0, EINVAL (bad type/offset/length), EACCES (if PHY_LOCK required and not held)
  1254. */
  1255. #define MC_CMD_NVRAM_UPDATE_FINISH 0x3c
  1256. #define MC_CMD_NVRAM_UPDATE_FINISH_IN_LEN 4
  1257. #define MC_CMD_NVRAM_UPDATE_FINISH_IN_TYPE_OFST 0
  1258. #define MC_CMD_NVRAM_UPDATE_FINISH_OUT_LEN 0
  1259. /* MC_CMD_REBOOT:
  1260. * Reboot the MC. The AFTER_ASSERTION flag is intended to be used
  1261. * when the driver notices an assertion failure, to allow two ports to
  1262. * both recover (semi-)gracefully.
  1263. *
  1264. * Locks required: NONE
  1265. * Returns: Nothing. You get back a response with ERR=1, DATALEN=0
  1266. */
  1267. #define MC_CMD_REBOOT 0x3d
  1268. #define MC_CMD_REBOOT_IN_LEN 4
  1269. #define MC_CMD_REBOOT_IN_FLAGS_OFST 0
  1270. #define MC_CMD_REBOOT_FLAGS_AFTER_ASSERTION 1
  1271. #define MC_CMD_REBOOT_OUT_LEN 0
  1272. /* MC_CMD_SCHEDINFO:
  1273. * Request scheduler info. from the MC.
  1274. *
  1275. * Locks required: NONE
  1276. * Returns: An array of (timeslice,maximum overrun), one for each thread,
  1277. * in ascending order of thread address.s
  1278. */
  1279. #define MC_CMD_SCHEDINFO 0x3e
  1280. #define MC_CMD_SCHEDINFO_IN_LEN 0
  1281. /* MC_CMD_SET_REBOOT_MODE: (debug)
  1282. * Set the mode for the next MC reboot.
  1283. *
  1284. * Locks required: NONE
  1285. *
  1286. * Sets the reboot mode to the specified value. Returns the old mode.
  1287. */
  1288. #define MC_CMD_REBOOT_MODE 0x3f
  1289. #define MC_CMD_REBOOT_MODE_IN_LEN 4
  1290. #define MC_CMD_REBOOT_MODE_IN_VALUE_OFST 0
  1291. #define MC_CMD_REBOOT_MODE_OUT_LEN 4
  1292. #define MC_CMD_REBOOT_MODE_OUT_VALUE_OFST 0
  1293. #define MC_CMD_REBOOT_MODE_NORMAL 0
  1294. #define MC_CMD_REBOOT_MODE_SNAPPER 3
  1295. /* MC_CMD_DEBUG_LOG:
  1296. * Null request/response command (debug)
  1297. * - sequence number is always zero
  1298. * - only supported on the UART interface
  1299. * (the same set of bytes is delivered as an
  1300. * event over PCI)
  1301. */
  1302. #define MC_CMD_DEBUG_LOG 0x40
  1303. #define MC_CMD_DEBUG_LOG_IN_LEN 0
  1304. #define MC_CMD_DEBUG_LOG_OUT_LEN 0
  1305. /* Generic sensor enumeration. Note that a dual port NIC
  1306. * will EITHER expose PHY_COMMON_TEMP OR PHY0_TEMP and
  1307. * PHY1_TEMP depending on whether there is a single sensor
  1308. * in the vicinity of the two port, or one per port.
  1309. */
  1310. #define MC_CMD_SENSOR_CONTROLLER_TEMP 0 /* degC */
  1311. #define MC_CMD_SENSOR_PHY_COMMON_TEMP 1 /* degC */
  1312. #define MC_CMD_SENSOR_CONTROLLER_COOLING 2 /* bool */
  1313. #define MC_CMD_SENSOR_PHY0_TEMP 3 /* degC */
  1314. #define MC_CMD_SENSOR_PHY0_COOLING 4 /* bool */
  1315. #define MC_CMD_SENSOR_PHY1_TEMP 5 /* degC */
  1316. #define MC_CMD_SENSOR_PHY1_COOLING 6 /* bool */
  1317. #define MC_CMD_SENSOR_IN_1V0 7 /* mV */
  1318. #define MC_CMD_SENSOR_IN_1V2 8 /* mV */
  1319. #define MC_CMD_SENSOR_IN_1V8 9 /* mV */
  1320. #define MC_CMD_SENSOR_IN_2V5 10 /* mV */
  1321. #define MC_CMD_SENSOR_IN_3V3 11 /* mV */
  1322. #define MC_CMD_SENSOR_IN_12V0 12 /* mV */
  1323. /* Sensor state */
  1324. #define MC_CMD_SENSOR_STATE_OK 0
  1325. #define MC_CMD_SENSOR_STATE_WARNING 1
  1326. #define MC_CMD_SENSOR_STATE_FATAL 2
  1327. #define MC_CMD_SENSOR_STATE_BROKEN 3
  1328. /* MC_CMD_SENSOR_INFO:
  1329. * Returns information about every available sensor.
  1330. *
  1331. * Each sensor has a single (16bit) value, and a corresponding state.
  1332. * The mapping between value and sensor is nominally determined by the
  1333. * MC, but in practise is implemented as zero (BROKEN), one (TEMPERATURE),
  1334. * or two (VOLTAGE) ranges per sensor per state.
  1335. *
  1336. * This call returns a mask (32bit) of the sensors that are supported
  1337. * by this platform, then an array (indexed by MC_CMD_SENSOR) of byte
  1338. * offsets to the per-sensor arrays. Each sensor array has four 16bit
  1339. * numbers, min1, max1, min2, max2.
  1340. *
  1341. * Locks required: None
  1342. * Returns: 0
  1343. */
  1344. #define MC_CMD_SENSOR_INFO 0x41
  1345. #define MC_CMD_SENSOR_INFO_IN_LEN 0
  1346. #define MC_CMD_SENSOR_INFO_OUT_MASK_OFST 0
  1347. #define MC_CMD_SENSOR_INFO_OUT_OFFSET_OFST(_x) \
  1348. (4 + (_x))
  1349. #define MC_CMD_SENSOR_INFO_OUT_MIN1_OFST(_ofst) \
  1350. ((_ofst) + 0)
  1351. #define MC_CMD_SENSOR_INFO_OUT_MAX1_OFST(_ofst) \
  1352. ((_ofst) + 2)
  1353. #define MC_CMD_SENSOR_INFO_OUT_MIN2_OFST(_ofst) \
  1354. ((_ofst) + 4)
  1355. #define MC_CMD_SENSOR_INFO_OUT_MAX2_OFST(_ofst) \
  1356. ((_ofst) + 6)
  1357. /* MC_CMD_READ_SENSORS
  1358. * Returns the current (value, state) for each sensor
  1359. *
  1360. * Returns the current (value, state) [each 16bit] of each sensor supported by
  1361. * this board, by DMA'ing a sparse array (indexed by the sensor type) into host
  1362. * memory.
  1363. *
  1364. * The MC will send a SENSOREVT event every time any sensor changes state. The
  1365. * driver is responsible for ensuring that it doesn't miss any events. The board
  1366. * will function normally if all sensors are in STATE_OK or state_WARNING.
  1367. * Otherwise the board should not be expected to function.
  1368. */
  1369. #define MC_CMD_READ_SENSORS 0x42
  1370. #define MC_CMD_READ_SENSORS_IN_LEN 8
  1371. #define MC_CMD_READ_SENSORS_IN_DMA_ADDR_LO_OFST 0
  1372. #define MC_CMD_READ_SENSORS_IN_DMA_ADDR_HI_OFST 4
  1373. #define MC_CMD_READ_SENSORS_OUT_LEN 0
  1374. /* MC_CMD_GET_PHY_STATE:
  1375. * Report current state of PHY. A "zombie" PHY is a PHY that has failed to
  1376. * boot (e.g. due to missing or corrupted firmware).
  1377. *
  1378. * Locks required: None
  1379. * Return code: 0
  1380. */
  1381. #define MC_CMD_GET_PHY_STATE 0x43
  1382. #define MC_CMD_GET_PHY_STATE_IN_LEN 0
  1383. #define MC_CMD_GET_PHY_STATE_OUT_LEN 4
  1384. #define MC_CMD_GET_PHY_STATE_STATE_OFST 0
  1385. /* PHY state enumeration: */
  1386. #define MC_CMD_PHY_STATE_OK 1
  1387. #define MC_CMD_PHY_STATE_ZOMBIE 2
  1388. /* 802.1Qbb control. 8 Tx queues that map to priorities 0 - 7. Use all 1s to
  1389. * disable 802.Qbb for a given priority. */
  1390. #define MC_CMD_SETUP_8021QBB 0x44
  1391. #define MC_CMD_SETUP_8021QBB_IN_LEN 32
  1392. #define MC_CMD_SETUP_8021QBB_OUT_LEN 0
  1393. #define MC_CMD_SETUP_8021QBB_IN_TXQS_OFFST 0
  1394. /* MC_CMD_WOL_FILTER_GET:
  1395. * Retrieve ID of any WoL filters
  1396. *
  1397. * Locks required: None
  1398. * Returns: 0, ENOSYS
  1399. */
  1400. #define MC_CMD_WOL_FILTER_GET 0x45
  1401. #define MC_CMD_WOL_FILTER_GET_IN_LEN 0
  1402. #define MC_CMD_WOL_FILTER_GET_OUT_LEN 4
  1403. #define MC_CMD_WOL_FILTER_GET_OUT_FILTER_ID_OFST 0
  1404. /* MC_CMD_ADD_LIGHTSOUT_OFFLOAD:
  1405. * Offload a protocol to NIC for lights-out state
  1406. *
  1407. * Locks required: None
  1408. * Returns: 0, ENOSYS
  1409. */
  1410. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD 0x46
  1411. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_LEN 16
  1412. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_PROTOCOL_OFST 0
  1413. /* There is a union at offset 4, following defines overlap due to
  1414. * this */
  1415. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_DATA_OFST 4
  1416. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_ARPMAC_OFST 4
  1417. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_ARPIP_OFST 10
  1418. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_NSMAC_OFST 4
  1419. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_NSSNIPV6_OFST 10
  1420. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_IN_NSIPV6_OFST 26
  1421. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_OUT_LEN 4
  1422. #define MC_CMD_ADD_LIGHTSOUT_OFFLOAD_OUT_FILTER_ID_OFST 0
  1423. /* MC_CMD_REMOVE_LIGHTSOUT_PROTOCOL_OFFLOAD:
  1424. * Offload a protocol to NIC for lights-out state
  1425. *
  1426. * Locks required: None
  1427. * Returns: 0, ENOSYS
  1428. */
  1429. #define MC_CMD_REMOVE_LIGHTSOUT_OFFLOAD 0x47
  1430. #define MC_CMD_REMOVE_LIGHTSOUT_OFFLOAD_IN_LEN 8
  1431. #define MC_CMD_REMOVE_LIGHTSOUT_OFFLOAD_OUT_LEN 0
  1432. #define MC_CMD_REMOVE_LIGHTSOUT_OFFLOAD_IN_PROTOCOL_OFST 0
  1433. #define MC_CMD_REMOVE_LIGHTSOUT_OFFLOAD_IN_FILTER_ID_OFST 4
  1434. /* Lights-out offload protocols enumeration */
  1435. #define MC_CMD_LIGHTSOUT_OFFLOAD_PROTOCOL_ARP 0x1
  1436. #define MC_CMD_LIGHTSOUT_OFFLOAD_PROTOCOL_NS 0x2
  1437. /* MC_CMD_MAC_RESET_RESTORE:
  1438. * Restore MAC after block reset
  1439. *
  1440. * Locks required: None
  1441. * Returns: 0
  1442. */
  1443. #define MC_CMD_MAC_RESET_RESTORE 0x48
  1444. #define MC_CMD_MAC_RESET_RESTORE_IN_LEN 0
  1445. #define MC_CMD_MAC_RESET_RESTORE_OUT_LEN 0
  1446. #endif /* MCDI_PCOL_H */