t4fw_api.h 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. /*
  2. * This file is part of the Chelsio T4 Ethernet driver for Linux.
  3. *
  4. * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef _T4FW_INTERFACE_H_
  35. #define _T4FW_INTERFACE_H_
  36. #define FW_T4VF_SGE_BASE_ADDR 0x0000
  37. #define FW_T4VF_MPS_BASE_ADDR 0x0100
  38. #define FW_T4VF_PL_BASE_ADDR 0x0200
  39. #define FW_T4VF_MBDATA_BASE_ADDR 0x0240
  40. #define FW_T4VF_CIM_BASE_ADDR 0x0300
  41. enum fw_wr_opcodes {
  42. FW_FILTER_WR = 0x02,
  43. FW_ULPTX_WR = 0x04,
  44. FW_TP_WR = 0x05,
  45. FW_ETH_TX_PKT_WR = 0x08,
  46. FW_FLOWC_WR = 0x0a,
  47. FW_OFLD_TX_DATA_WR = 0x0b,
  48. FW_CMD_WR = 0x10,
  49. FW_ETH_TX_PKT_VM_WR = 0x11,
  50. FW_RI_RES_WR = 0x0c,
  51. FW_RI_INIT_WR = 0x0d,
  52. FW_RI_RDMA_WRITE_WR = 0x14,
  53. FW_RI_SEND_WR = 0x15,
  54. FW_RI_RDMA_READ_WR = 0x16,
  55. FW_RI_RECV_WR = 0x17,
  56. FW_RI_BIND_MW_WR = 0x18,
  57. FW_RI_FR_NSMR_WR = 0x19,
  58. FW_RI_INV_LSTAG_WR = 0x1a,
  59. FW_LASTC2E_WR = 0x40
  60. };
  61. struct fw_wr_hdr {
  62. __be32 hi;
  63. __be32 lo;
  64. };
  65. #define FW_WR_OP(x) ((x) << 24)
  66. #define FW_WR_OP_GET(x) (((x) >> 24) & 0xff)
  67. #define FW_WR_ATOMIC(x) ((x) << 23)
  68. #define FW_WR_FLUSH(x) ((x) << 22)
  69. #define FW_WR_COMPL(x) ((x) << 21)
  70. #define FW_WR_IMMDLEN_MASK 0xff
  71. #define FW_WR_IMMDLEN(x) ((x) << 0)
  72. #define FW_WR_EQUIQ (1U << 31)
  73. #define FW_WR_EQUEQ (1U << 30)
  74. #define FW_WR_FLOWID(x) ((x) << 8)
  75. #define FW_WR_LEN16(x) ((x) << 0)
  76. #define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
  77. struct fw_ulptx_wr {
  78. __be32 op_to_compl;
  79. __be32 flowid_len16;
  80. u64 cookie;
  81. };
  82. struct fw_tp_wr {
  83. __be32 op_to_immdlen;
  84. __be32 flowid_len16;
  85. u64 cookie;
  86. };
  87. struct fw_eth_tx_pkt_wr {
  88. __be32 op_immdlen;
  89. __be32 equiq_to_len16;
  90. __be64 r3;
  91. };
  92. enum fw_flowc_mnem {
  93. FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
  94. FW_FLOWC_MNEM_CH,
  95. FW_FLOWC_MNEM_PORT,
  96. FW_FLOWC_MNEM_IQID,
  97. FW_FLOWC_MNEM_SNDNXT,
  98. FW_FLOWC_MNEM_RCVNXT,
  99. FW_FLOWC_MNEM_SNDBUF,
  100. FW_FLOWC_MNEM_MSS,
  101. };
  102. struct fw_flowc_mnemval {
  103. u8 mnemonic;
  104. u8 r4[3];
  105. __be32 val;
  106. };
  107. struct fw_flowc_wr {
  108. __be32 op_to_nparams;
  109. #define FW_FLOWC_WR_NPARAMS(x) ((x) << 0)
  110. __be32 flowid_len16;
  111. struct fw_flowc_mnemval mnemval[0];
  112. };
  113. struct fw_ofld_tx_data_wr {
  114. __be32 op_to_immdlen;
  115. __be32 flowid_len16;
  116. __be32 plen;
  117. __be32 tunnel_to_proxy;
  118. #define FW_OFLD_TX_DATA_WR_TUNNEL(x) ((x) << 19)
  119. #define FW_OFLD_TX_DATA_WR_SAVE(x) ((x) << 18)
  120. #define FW_OFLD_TX_DATA_WR_FLUSH(x) ((x) << 17)
  121. #define FW_OFLD_TX_DATA_WR_URGENT(x) ((x) << 16)
  122. #define FW_OFLD_TX_DATA_WR_MORE(x) ((x) << 15)
  123. #define FW_OFLD_TX_DATA_WR_SHOVE(x) ((x) << 14)
  124. #define FW_OFLD_TX_DATA_WR_ULPMODE(x) ((x) << 10)
  125. #define FW_OFLD_TX_DATA_WR_ULPSUBMODE(x) ((x) << 6)
  126. };
  127. struct fw_cmd_wr {
  128. __be32 op_dma;
  129. #define FW_CMD_WR_DMA (1U << 17)
  130. __be32 len16_pkd;
  131. __be64 cookie_daddr;
  132. };
  133. struct fw_eth_tx_pkt_vm_wr {
  134. __be32 op_immdlen;
  135. __be32 equiq_to_len16;
  136. __be32 r3[2];
  137. u8 ethmacdst[6];
  138. u8 ethmacsrc[6];
  139. __be16 ethtype;
  140. __be16 vlantci;
  141. };
  142. #define FW_CMD_MAX_TIMEOUT 3000
  143. /*
  144. * If a host driver does a HELLO and discovers that there's already a MASTER
  145. * selected, we may have to wait for that MASTER to finish issuing RESET,
  146. * configuration and INITIALIZE commands. Also, there's a possibility that
  147. * our own HELLO may get lost if it happens right as the MASTER is issuign a
  148. * RESET command, so we need to be willing to make a few retries of our HELLO.
  149. */
  150. #define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
  151. #define FW_CMD_HELLO_RETRIES 3
  152. enum fw_cmd_opcodes {
  153. FW_LDST_CMD = 0x01,
  154. FW_RESET_CMD = 0x03,
  155. FW_HELLO_CMD = 0x04,
  156. FW_BYE_CMD = 0x05,
  157. FW_INITIALIZE_CMD = 0x06,
  158. FW_CAPS_CONFIG_CMD = 0x07,
  159. FW_PARAMS_CMD = 0x08,
  160. FW_PFVF_CMD = 0x09,
  161. FW_IQ_CMD = 0x10,
  162. FW_EQ_MNGT_CMD = 0x11,
  163. FW_EQ_ETH_CMD = 0x12,
  164. FW_EQ_CTRL_CMD = 0x13,
  165. FW_EQ_OFLD_CMD = 0x21,
  166. FW_VI_CMD = 0x14,
  167. FW_VI_MAC_CMD = 0x15,
  168. FW_VI_RXMODE_CMD = 0x16,
  169. FW_VI_ENABLE_CMD = 0x17,
  170. FW_ACL_MAC_CMD = 0x18,
  171. FW_ACL_VLAN_CMD = 0x19,
  172. FW_VI_STATS_CMD = 0x1a,
  173. FW_PORT_CMD = 0x1b,
  174. FW_PORT_STATS_CMD = 0x1c,
  175. FW_PORT_LB_STATS_CMD = 0x1d,
  176. FW_PORT_TRACE_CMD = 0x1e,
  177. FW_PORT_TRACE_MMAP_CMD = 0x1f,
  178. FW_RSS_IND_TBL_CMD = 0x20,
  179. FW_RSS_GLB_CONFIG_CMD = 0x22,
  180. FW_RSS_VI_CONFIG_CMD = 0x23,
  181. FW_LASTC2E_CMD = 0x40,
  182. FW_ERROR_CMD = 0x80,
  183. FW_DEBUG_CMD = 0x81,
  184. };
  185. enum fw_cmd_cap {
  186. FW_CMD_CAP_PF = 0x01,
  187. FW_CMD_CAP_DMAQ = 0x02,
  188. FW_CMD_CAP_PORT = 0x04,
  189. FW_CMD_CAP_PORTPROMISC = 0x08,
  190. FW_CMD_CAP_PORTSTATS = 0x10,
  191. FW_CMD_CAP_VF = 0x80,
  192. };
  193. /*
  194. * Generic command header flit0
  195. */
  196. struct fw_cmd_hdr {
  197. __be32 hi;
  198. __be32 lo;
  199. };
  200. #define FW_CMD_OP(x) ((x) << 24)
  201. #define FW_CMD_OP_GET(x) (((x) >> 24) & 0xff)
  202. #define FW_CMD_REQUEST (1U << 23)
  203. #define FW_CMD_REQUEST_GET(x) (((x) >> 23) & 0x1)
  204. #define FW_CMD_READ (1U << 22)
  205. #define FW_CMD_WRITE (1U << 21)
  206. #define FW_CMD_EXEC (1U << 20)
  207. #define FW_CMD_RAMASK(x) ((x) << 20)
  208. #define FW_CMD_RETVAL(x) ((x) << 8)
  209. #define FW_CMD_RETVAL_GET(x) (((x) >> 8) & 0xff)
  210. #define FW_CMD_LEN16(x) ((x) << 0)
  211. #define FW_LEN16(fw_struct) FW_CMD_LEN16(sizeof(fw_struct) / 16)
  212. enum fw_ldst_addrspc {
  213. FW_LDST_ADDRSPC_FIRMWARE = 0x0001,
  214. FW_LDST_ADDRSPC_SGE_EGRC = 0x0008,
  215. FW_LDST_ADDRSPC_SGE_INGC = 0x0009,
  216. FW_LDST_ADDRSPC_SGE_FLMC = 0x000a,
  217. FW_LDST_ADDRSPC_SGE_CONMC = 0x000b,
  218. FW_LDST_ADDRSPC_TP_PIO = 0x0010,
  219. FW_LDST_ADDRSPC_TP_TM_PIO = 0x0011,
  220. FW_LDST_ADDRSPC_TP_MIB = 0x0012,
  221. FW_LDST_ADDRSPC_MDIO = 0x0018,
  222. FW_LDST_ADDRSPC_MPS = 0x0020,
  223. FW_LDST_ADDRSPC_FUNC = 0x0028,
  224. FW_LDST_ADDRSPC_FUNC_PCIE = 0x0029,
  225. };
  226. enum fw_ldst_mps_fid {
  227. FW_LDST_MPS_ATRB,
  228. FW_LDST_MPS_RPLC
  229. };
  230. enum fw_ldst_func_access_ctl {
  231. FW_LDST_FUNC_ACC_CTL_VIID,
  232. FW_LDST_FUNC_ACC_CTL_FID
  233. };
  234. enum fw_ldst_func_mod_index {
  235. FW_LDST_FUNC_MPS
  236. };
  237. struct fw_ldst_cmd {
  238. __be32 op_to_addrspace;
  239. #define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
  240. __be32 cycles_to_len16;
  241. union fw_ldst {
  242. struct fw_ldst_addrval {
  243. __be32 addr;
  244. __be32 val;
  245. } addrval;
  246. struct fw_ldst_idctxt {
  247. __be32 physid;
  248. __be32 msg_pkd;
  249. __be32 ctxt_data7;
  250. __be32 ctxt_data6;
  251. __be32 ctxt_data5;
  252. __be32 ctxt_data4;
  253. __be32 ctxt_data3;
  254. __be32 ctxt_data2;
  255. __be32 ctxt_data1;
  256. __be32 ctxt_data0;
  257. } idctxt;
  258. struct fw_ldst_mdio {
  259. __be16 paddr_mmd;
  260. __be16 raddr;
  261. __be16 vctl;
  262. __be16 rval;
  263. } mdio;
  264. struct fw_ldst_mps {
  265. __be16 fid_ctl;
  266. __be16 rplcpf_pkd;
  267. __be32 rplc127_96;
  268. __be32 rplc95_64;
  269. __be32 rplc63_32;
  270. __be32 rplc31_0;
  271. __be32 atrb;
  272. __be16 vlan[16];
  273. } mps;
  274. struct fw_ldst_func {
  275. u8 access_ctl;
  276. u8 mod_index;
  277. __be16 ctl_id;
  278. __be32 offset;
  279. __be64 data0;
  280. __be64 data1;
  281. } func;
  282. struct fw_ldst_pcie {
  283. u8 ctrl_to_fn;
  284. u8 bnum;
  285. u8 r;
  286. u8 ext_r;
  287. u8 select_naccess;
  288. u8 pcie_fn;
  289. __be16 nset_pkd;
  290. __be32 data[12];
  291. } pcie;
  292. } u;
  293. };
  294. #define FW_LDST_CMD_MSG(x) ((x) << 31)
  295. #define FW_LDST_CMD_PADDR(x) ((x) << 8)
  296. #define FW_LDST_CMD_MMD(x) ((x) << 0)
  297. #define FW_LDST_CMD_FID(x) ((x) << 15)
  298. #define FW_LDST_CMD_CTL(x) ((x) << 0)
  299. #define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
  300. #define FW_LDST_CMD_LC (1U << 4)
  301. #define FW_LDST_CMD_NACCESS(x) ((x) << 0)
  302. #define FW_LDST_CMD_FN(x) ((x) << 0)
  303. struct fw_reset_cmd {
  304. __be32 op_to_write;
  305. __be32 retval_len16;
  306. __be32 val;
  307. __be32 halt_pkd;
  308. };
  309. #define FW_RESET_CMD_HALT_SHIFT 31
  310. #define FW_RESET_CMD_HALT_MASK 0x1
  311. #define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
  312. #define FW_RESET_CMD_HALT_GET(x) \
  313. (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
  314. enum fw_hellow_cmd {
  315. fw_hello_cmd_stage_os = 0x0
  316. };
  317. struct fw_hello_cmd {
  318. __be32 op_to_write;
  319. __be32 retval_len16;
  320. __be32 err_to_clearinit;
  321. #define FW_HELLO_CMD_ERR (1U << 31)
  322. #define FW_HELLO_CMD_INIT (1U << 30)
  323. #define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
  324. #define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
  325. #define FW_HELLO_CMD_MBMASTER_MASK 0xfU
  326. #define FW_HELLO_CMD_MBMASTER_SHIFT 24
  327. #define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
  328. #define FW_HELLO_CMD_MBMASTER_GET(x) \
  329. (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
  330. #define FW_HELLO_CMD_MBASYNCNOTINT(x) ((x) << 23)
  331. #define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
  332. #define FW_HELLO_CMD_STAGE(x) ((x) << 17)
  333. #define FW_HELLO_CMD_CLEARINIT (1U << 16)
  334. __be32 fwrev;
  335. };
  336. struct fw_bye_cmd {
  337. __be32 op_to_write;
  338. __be32 retval_len16;
  339. __be64 r3;
  340. };
  341. struct fw_initialize_cmd {
  342. __be32 op_to_write;
  343. __be32 retval_len16;
  344. __be64 r3;
  345. };
  346. enum fw_caps_config_hm {
  347. FW_CAPS_CONFIG_HM_PCIE = 0x00000001,
  348. FW_CAPS_CONFIG_HM_PL = 0x00000002,
  349. FW_CAPS_CONFIG_HM_SGE = 0x00000004,
  350. FW_CAPS_CONFIG_HM_CIM = 0x00000008,
  351. FW_CAPS_CONFIG_HM_ULPTX = 0x00000010,
  352. FW_CAPS_CONFIG_HM_TP = 0x00000020,
  353. FW_CAPS_CONFIG_HM_ULPRX = 0x00000040,
  354. FW_CAPS_CONFIG_HM_PMRX = 0x00000080,
  355. FW_CAPS_CONFIG_HM_PMTX = 0x00000100,
  356. FW_CAPS_CONFIG_HM_MC = 0x00000200,
  357. FW_CAPS_CONFIG_HM_LE = 0x00000400,
  358. FW_CAPS_CONFIG_HM_MPS = 0x00000800,
  359. FW_CAPS_CONFIG_HM_XGMAC = 0x00001000,
  360. FW_CAPS_CONFIG_HM_CPLSWITCH = 0x00002000,
  361. FW_CAPS_CONFIG_HM_T4DBG = 0x00004000,
  362. FW_CAPS_CONFIG_HM_MI = 0x00008000,
  363. FW_CAPS_CONFIG_HM_I2CM = 0x00010000,
  364. FW_CAPS_CONFIG_HM_NCSI = 0x00020000,
  365. FW_CAPS_CONFIG_HM_SMB = 0x00040000,
  366. FW_CAPS_CONFIG_HM_MA = 0x00080000,
  367. FW_CAPS_CONFIG_HM_EDRAM = 0x00100000,
  368. FW_CAPS_CONFIG_HM_PMU = 0x00200000,
  369. FW_CAPS_CONFIG_HM_UART = 0x00400000,
  370. FW_CAPS_CONFIG_HM_SF = 0x00800000,
  371. };
  372. enum fw_caps_config_nbm {
  373. FW_CAPS_CONFIG_NBM_IPMI = 0x00000001,
  374. FW_CAPS_CONFIG_NBM_NCSI = 0x00000002,
  375. };
  376. enum fw_caps_config_link {
  377. FW_CAPS_CONFIG_LINK_PPP = 0x00000001,
  378. FW_CAPS_CONFIG_LINK_QFC = 0x00000002,
  379. FW_CAPS_CONFIG_LINK_DCBX = 0x00000004,
  380. };
  381. enum fw_caps_config_switch {
  382. FW_CAPS_CONFIG_SWITCH_INGRESS = 0x00000001,
  383. FW_CAPS_CONFIG_SWITCH_EGRESS = 0x00000002,
  384. };
  385. enum fw_caps_config_nic {
  386. FW_CAPS_CONFIG_NIC = 0x00000001,
  387. FW_CAPS_CONFIG_NIC_VM = 0x00000002,
  388. };
  389. enum fw_caps_config_ofld {
  390. FW_CAPS_CONFIG_OFLD = 0x00000001,
  391. };
  392. enum fw_caps_config_rdma {
  393. FW_CAPS_CONFIG_RDMA_RDDP = 0x00000001,
  394. FW_CAPS_CONFIG_RDMA_RDMAC = 0x00000002,
  395. };
  396. enum fw_caps_config_iscsi {
  397. FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU = 0x00000001,
  398. FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002,
  399. FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004,
  400. FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008,
  401. };
  402. enum fw_caps_config_fcoe {
  403. FW_CAPS_CONFIG_FCOE_INITIATOR = 0x00000001,
  404. FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
  405. FW_CAPS_CONFIG_FCOE_CTRL_OFLD = 0x00000004,
  406. };
  407. enum fw_memtype_cf {
  408. FW_MEMTYPE_CF_EDC0 = 0x0,
  409. FW_MEMTYPE_CF_EDC1 = 0x1,
  410. FW_MEMTYPE_CF_EXTMEM = 0x2,
  411. FW_MEMTYPE_CF_FLASH = 0x4,
  412. FW_MEMTYPE_CF_INTERNAL = 0x5,
  413. };
  414. struct fw_caps_config_cmd {
  415. __be32 op_to_write;
  416. __be32 cfvalid_to_len16;
  417. __be32 r2;
  418. __be32 hwmbitmap;
  419. __be16 nbmcaps;
  420. __be16 linkcaps;
  421. __be16 switchcaps;
  422. __be16 r3;
  423. __be16 niccaps;
  424. __be16 ofldcaps;
  425. __be16 rdmacaps;
  426. __be16 r4;
  427. __be16 iscsicaps;
  428. __be16 fcoecaps;
  429. __be32 cfcsum;
  430. __be32 finiver;
  431. __be32 finicsum;
  432. };
  433. #define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
  434. #define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
  435. #define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
  436. /*
  437. * params command mnemonics
  438. */
  439. enum fw_params_mnem {
  440. FW_PARAMS_MNEM_DEV = 1, /* device params */
  441. FW_PARAMS_MNEM_PFVF = 2, /* function params */
  442. FW_PARAMS_MNEM_REG = 3, /* limited register access */
  443. FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
  444. FW_PARAMS_MNEM_LAST
  445. };
  446. /*
  447. * device parameters
  448. */
  449. enum fw_params_param_dev {
  450. FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
  451. FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
  452. FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
  453. * allocated by the device's
  454. * Lookup Engine
  455. */
  456. FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ = 0x03,
  457. FW_PARAMS_PARAM_DEV_INTVER_NIC = 0x04,
  458. FW_PARAMS_PARAM_DEV_INTVER_VNIC = 0x05,
  459. FW_PARAMS_PARAM_DEV_INTVER_OFLD = 0x06,
  460. FW_PARAMS_PARAM_DEV_INTVER_RI = 0x07,
  461. FW_PARAMS_PARAM_DEV_INTVER_ISCSIPDU = 0x08,
  462. FW_PARAMS_PARAM_DEV_INTVER_ISCSI = 0x09,
  463. FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
  464. FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
  465. FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
  466. FW_PARAMS_PARAM_DEV_CF = 0x0D,
  467. };
  468. /*
  469. * physical and virtual function parameters
  470. */
  471. enum fw_params_param_pfvf {
  472. FW_PARAMS_PARAM_PFVF_RWXCAPS = 0x00,
  473. FW_PARAMS_PARAM_PFVF_ROUTE_START = 0x01,
  474. FW_PARAMS_PARAM_PFVF_ROUTE_END = 0x02,
  475. FW_PARAMS_PARAM_PFVF_CLIP_START = 0x03,
  476. FW_PARAMS_PARAM_PFVF_CLIP_END = 0x04,
  477. FW_PARAMS_PARAM_PFVF_FILTER_START = 0x05,
  478. FW_PARAMS_PARAM_PFVF_FILTER_END = 0x06,
  479. FW_PARAMS_PARAM_PFVF_SERVER_START = 0x07,
  480. FW_PARAMS_PARAM_PFVF_SERVER_END = 0x08,
  481. FW_PARAMS_PARAM_PFVF_TDDP_START = 0x09,
  482. FW_PARAMS_PARAM_PFVF_TDDP_END = 0x0A,
  483. FW_PARAMS_PARAM_PFVF_ISCSI_START = 0x0B,
  484. FW_PARAMS_PARAM_PFVF_ISCSI_END = 0x0C,
  485. FW_PARAMS_PARAM_PFVF_STAG_START = 0x0D,
  486. FW_PARAMS_PARAM_PFVF_STAG_END = 0x0E,
  487. FW_PARAMS_PARAM_PFVF_RQ_START = 0x1F,
  488. FW_PARAMS_PARAM_PFVF_RQ_END = 0x10,
  489. FW_PARAMS_PARAM_PFVF_PBL_START = 0x11,
  490. FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
  491. FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
  492. FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
  493. FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
  494. FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
  495. FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
  496. FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
  497. FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
  498. FW_PARAMS_PARAM_PFVF_VIID = 0x24,
  499. FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
  500. FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26,
  501. FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27,
  502. FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28,
  503. FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29,
  504. FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
  505. FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
  506. FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
  507. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
  508. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E
  509. };
  510. /*
  511. * dma queue parameters
  512. */
  513. enum fw_params_param_dmaq {
  514. FW_PARAMS_PARAM_DMAQ_IQ_DCAEN_DCACPU = 0x00,
  515. FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH = 0x01,
  516. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10,
  517. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
  518. FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
  519. };
  520. #define FW_PARAMS_MNEM(x) ((x) << 24)
  521. #define FW_PARAMS_PARAM_X(x) ((x) << 16)
  522. #define FW_PARAMS_PARAM_Y_SHIFT 8
  523. #define FW_PARAMS_PARAM_Y_MASK 0xffU
  524. #define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
  525. #define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
  526. FW_PARAMS_PARAM_Y_MASK)
  527. #define FW_PARAMS_PARAM_Z_SHIFT 0
  528. #define FW_PARAMS_PARAM_Z_MASK 0xffu
  529. #define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
  530. #define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
  531. FW_PARAMS_PARAM_Z_MASK)
  532. #define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
  533. #define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
  534. struct fw_params_cmd {
  535. __be32 op_to_vfn;
  536. __be32 retval_len16;
  537. struct fw_params_param {
  538. __be32 mnem;
  539. __be32 val;
  540. } param[7];
  541. };
  542. #define FW_PARAMS_CMD_PFN(x) ((x) << 8)
  543. #define FW_PARAMS_CMD_VFN(x) ((x) << 0)
  544. struct fw_pfvf_cmd {
  545. __be32 op_to_vfn;
  546. __be32 retval_len16;
  547. __be32 niqflint_niq;
  548. __be32 type_to_neq;
  549. __be32 tc_to_nexactf;
  550. __be32 r_caps_to_nethctrl;
  551. __be16 nricq;
  552. __be16 nriqp;
  553. __be32 r4;
  554. };
  555. #define FW_PFVF_CMD_PFN(x) ((x) << 8)
  556. #define FW_PFVF_CMD_VFN(x) ((x) << 0)
  557. #define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
  558. #define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
  559. #define FW_PFVF_CMD_NIQ(x) ((x) << 0)
  560. #define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
  561. #define FW_PFVF_CMD_TYPE (1 << 31)
  562. #define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
  563. #define FW_PFVF_CMD_CMASK(x) ((x) << 24)
  564. #define FW_PFVF_CMD_CMASK_MASK 0xf
  565. #define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
  566. #define FW_PFVF_CMD_PMASK(x) ((x) << 20)
  567. #define FW_PFVF_CMD_PMASK_MASK 0xf
  568. #define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
  569. #define FW_PFVF_CMD_NEQ(x) ((x) << 0)
  570. #define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
  571. #define FW_PFVF_CMD_TC(x) ((x) << 24)
  572. #define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
  573. #define FW_PFVF_CMD_NVI(x) ((x) << 16)
  574. #define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
  575. #define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
  576. #define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
  577. #define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
  578. #define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
  579. #define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
  580. #define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
  581. #define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
  582. #define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
  583. enum fw_iq_type {
  584. FW_IQ_TYPE_FL_INT_CAP,
  585. FW_IQ_TYPE_NO_FL_INT_CAP
  586. };
  587. struct fw_iq_cmd {
  588. __be32 op_to_vfn;
  589. __be32 alloc_to_len16;
  590. __be16 physiqid;
  591. __be16 iqid;
  592. __be16 fl0id;
  593. __be16 fl1id;
  594. __be32 type_to_iqandstindex;
  595. __be16 iqdroprss_to_iqesize;
  596. __be16 iqsize;
  597. __be64 iqaddr;
  598. __be32 iqns_to_fl0congen;
  599. __be16 fl0dcaen_to_fl0cidxfthresh;
  600. __be16 fl0size;
  601. __be64 fl0addr;
  602. __be32 fl1cngchmap_to_fl1congen;
  603. __be16 fl1dcaen_to_fl1cidxfthresh;
  604. __be16 fl1size;
  605. __be64 fl1addr;
  606. };
  607. #define FW_IQ_CMD_PFN(x) ((x) << 8)
  608. #define FW_IQ_CMD_VFN(x) ((x) << 0)
  609. #define FW_IQ_CMD_ALLOC (1U << 31)
  610. #define FW_IQ_CMD_FREE (1U << 30)
  611. #define FW_IQ_CMD_MODIFY (1U << 29)
  612. #define FW_IQ_CMD_IQSTART(x) ((x) << 28)
  613. #define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
  614. #define FW_IQ_CMD_TYPE(x) ((x) << 29)
  615. #define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
  616. #define FW_IQ_CMD_VIID(x) ((x) << 16)
  617. #define FW_IQ_CMD_IQANDST(x) ((x) << 15)
  618. #define FW_IQ_CMD_IQANUS(x) ((x) << 14)
  619. #define FW_IQ_CMD_IQANUD(x) ((x) << 12)
  620. #define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
  621. #define FW_IQ_CMD_IQDROPRSS (1U << 15)
  622. #define FW_IQ_CMD_IQGTSMODE (1U << 14)
  623. #define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
  624. #define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
  625. #define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
  626. #define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
  627. #define FW_IQ_CMD_IQO (1U << 3)
  628. #define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
  629. #define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
  630. #define FW_IQ_CMD_IQNS(x) ((x) << 31)
  631. #define FW_IQ_CMD_IQRO(x) ((x) << 30)
  632. #define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
  633. #define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
  634. #define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
  635. #define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
  636. #define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
  637. #define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
  638. #define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
  639. #define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
  640. #define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
  641. #define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
  642. #define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
  643. #define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
  644. #define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
  645. #define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
  646. #define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
  647. #define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
  648. #define FW_IQ_CMD_FL0PADEN(x) ((x) << 2)
  649. #define FW_IQ_CMD_FL0PACKEN(x) ((x) << 1)
  650. #define FW_IQ_CMD_FL0CONGEN (1U << 0)
  651. #define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
  652. #define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
  653. #define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
  654. #define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
  655. #define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
  656. #define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
  657. #define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
  658. #define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
  659. #define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
  660. #define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
  661. #define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
  662. #define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
  663. #define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
  664. #define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
  665. #define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
  666. #define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
  667. #define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
  668. #define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
  669. #define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
  670. #define FW_IQ_CMD_FL1PADEN (1U << 2)
  671. #define FW_IQ_CMD_FL1PACKEN (1U << 1)
  672. #define FW_IQ_CMD_FL1CONGEN (1U << 0)
  673. #define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
  674. #define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
  675. #define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
  676. #define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
  677. #define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
  678. #define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
  679. struct fw_eq_eth_cmd {
  680. __be32 op_to_vfn;
  681. __be32 alloc_to_len16;
  682. __be32 eqid_pkd;
  683. __be32 physeqid_pkd;
  684. __be32 fetchszm_to_iqid;
  685. __be32 dcaen_to_eqsize;
  686. __be64 eqaddr;
  687. __be32 viid_pkd;
  688. __be32 r8_lo;
  689. __be64 r9;
  690. };
  691. #define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
  692. #define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
  693. #define FW_EQ_ETH_CMD_ALLOC (1U << 31)
  694. #define FW_EQ_ETH_CMD_FREE (1U << 30)
  695. #define FW_EQ_ETH_CMD_MODIFY (1U << 29)
  696. #define FW_EQ_ETH_CMD_EQSTART (1U << 28)
  697. #define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
  698. #define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
  699. #define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  700. #define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
  701. #define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  702. #define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
  703. #define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
  704. #define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
  705. #define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
  706. #define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
  707. #define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
  708. #define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
  709. #define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
  710. #define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
  711. #define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
  712. #define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
  713. #define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
  714. #define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
  715. #define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
  716. #define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
  717. #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
  718. #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
  719. #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
  720. struct fw_eq_ctrl_cmd {
  721. __be32 op_to_vfn;
  722. __be32 alloc_to_len16;
  723. __be32 cmpliqid_eqid;
  724. __be32 physeqid_pkd;
  725. __be32 fetchszm_to_iqid;
  726. __be32 dcaen_to_eqsize;
  727. __be64 eqaddr;
  728. };
  729. #define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
  730. #define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
  731. #define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
  732. #define FW_EQ_CTRL_CMD_FREE (1U << 30)
  733. #define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
  734. #define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
  735. #define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
  736. #define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
  737. #define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
  738. #define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  739. #define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  740. #define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
  741. #define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
  742. #define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
  743. #define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
  744. #define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
  745. #define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
  746. #define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
  747. #define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
  748. #define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
  749. #define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
  750. #define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
  751. #define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
  752. #define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
  753. #define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
  754. #define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
  755. #define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
  756. #define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
  757. struct fw_eq_ofld_cmd {
  758. __be32 op_to_vfn;
  759. __be32 alloc_to_len16;
  760. __be32 eqid_pkd;
  761. __be32 physeqid_pkd;
  762. __be32 fetchszm_to_iqid;
  763. __be32 dcaen_to_eqsize;
  764. __be64 eqaddr;
  765. };
  766. #define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
  767. #define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
  768. #define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
  769. #define FW_EQ_OFLD_CMD_FREE (1U << 30)
  770. #define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
  771. #define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
  772. #define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
  773. #define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
  774. #define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  775. #define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  776. #define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
  777. #define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
  778. #define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
  779. #define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
  780. #define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
  781. #define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
  782. #define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
  783. #define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
  784. #define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
  785. #define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
  786. #define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
  787. #define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
  788. #define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
  789. #define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
  790. #define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
  791. #define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
  792. #define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
  793. /*
  794. * Macros for VIID parsing:
  795. * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
  796. */
  797. #define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
  798. #define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
  799. #define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
  800. struct fw_vi_cmd {
  801. __be32 op_to_vfn;
  802. __be32 alloc_to_len16;
  803. __be16 type_viid;
  804. u8 mac[6];
  805. u8 portid_pkd;
  806. u8 nmac;
  807. u8 nmac0[6];
  808. __be16 rsssize_pkd;
  809. u8 nmac1[6];
  810. __be16 idsiiq_pkd;
  811. u8 nmac2[6];
  812. __be16 idseiq_pkd;
  813. u8 nmac3[6];
  814. __be64 r9;
  815. __be64 r10;
  816. };
  817. #define FW_VI_CMD_PFN(x) ((x) << 8)
  818. #define FW_VI_CMD_VFN(x) ((x) << 0)
  819. #define FW_VI_CMD_ALLOC (1U << 31)
  820. #define FW_VI_CMD_FREE (1U << 30)
  821. #define FW_VI_CMD_VIID(x) ((x) << 0)
  822. #define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
  823. #define FW_VI_CMD_PORTID(x) ((x) << 4)
  824. #define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
  825. #define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
  826. /* Special VI_MAC command index ids */
  827. #define FW_VI_MAC_ADD_MAC 0x3FF
  828. #define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
  829. #define FW_VI_MAC_MAC_BASED_FREE 0x3FD
  830. #define FW_CLS_TCAM_NUM_ENTRIES 336
  831. enum fw_vi_mac_smac {
  832. FW_VI_MAC_MPS_TCAM_ENTRY,
  833. FW_VI_MAC_MPS_TCAM_ONLY,
  834. FW_VI_MAC_SMT_ONLY,
  835. FW_VI_MAC_SMT_AND_MPSTCAM
  836. };
  837. enum fw_vi_mac_result {
  838. FW_VI_MAC_R_SUCCESS,
  839. FW_VI_MAC_R_F_NONEXISTENT_NOMEM,
  840. FW_VI_MAC_R_SMAC_FAIL,
  841. FW_VI_MAC_R_F_ACL_CHECK
  842. };
  843. struct fw_vi_mac_cmd {
  844. __be32 op_to_viid;
  845. __be32 freemacs_to_len16;
  846. union fw_vi_mac {
  847. struct fw_vi_mac_exact {
  848. __be16 valid_to_idx;
  849. u8 macaddr[6];
  850. } exact[7];
  851. struct fw_vi_mac_hash {
  852. __be64 hashvec;
  853. } hash;
  854. } u;
  855. };
  856. #define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
  857. #define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
  858. #define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
  859. #define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
  860. #define FW_VI_MAC_CMD_VALID (1U << 15)
  861. #define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
  862. #define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
  863. #define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
  864. #define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
  865. #define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
  866. #define FW_RXMODE_MTU_NO_CHG 65535
  867. struct fw_vi_rxmode_cmd {
  868. __be32 op_to_viid;
  869. __be32 retval_len16;
  870. __be32 mtu_to_vlanexen;
  871. __be32 r4_lo;
  872. };
  873. #define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
  874. #define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
  875. #define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
  876. #define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
  877. #define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
  878. #define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
  879. #define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
  880. #define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
  881. #define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
  882. #define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
  883. #define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
  884. struct fw_vi_enable_cmd {
  885. __be32 op_to_viid;
  886. __be32 ien_to_len16;
  887. __be16 blinkdur;
  888. __be16 r3;
  889. __be32 r4;
  890. };
  891. #define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
  892. #define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
  893. #define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
  894. #define FW_VI_ENABLE_CMD_LED (1U << 29)
  895. /* VI VF stats offset definitions */
  896. #define VI_VF_NUM_STATS 16
  897. enum fw_vi_stats_vf_index {
  898. FW_VI_VF_STAT_TX_BCAST_BYTES_IX,
  899. FW_VI_VF_STAT_TX_BCAST_FRAMES_IX,
  900. FW_VI_VF_STAT_TX_MCAST_BYTES_IX,
  901. FW_VI_VF_STAT_TX_MCAST_FRAMES_IX,
  902. FW_VI_VF_STAT_TX_UCAST_BYTES_IX,
  903. FW_VI_VF_STAT_TX_UCAST_FRAMES_IX,
  904. FW_VI_VF_STAT_TX_DROP_FRAMES_IX,
  905. FW_VI_VF_STAT_TX_OFLD_BYTES_IX,
  906. FW_VI_VF_STAT_TX_OFLD_FRAMES_IX,
  907. FW_VI_VF_STAT_RX_BCAST_BYTES_IX,
  908. FW_VI_VF_STAT_RX_BCAST_FRAMES_IX,
  909. FW_VI_VF_STAT_RX_MCAST_BYTES_IX,
  910. FW_VI_VF_STAT_RX_MCAST_FRAMES_IX,
  911. FW_VI_VF_STAT_RX_UCAST_BYTES_IX,
  912. FW_VI_VF_STAT_RX_UCAST_FRAMES_IX,
  913. FW_VI_VF_STAT_RX_ERR_FRAMES_IX
  914. };
  915. /* VI PF stats offset definitions */
  916. #define VI_PF_NUM_STATS 17
  917. enum fw_vi_stats_pf_index {
  918. FW_VI_PF_STAT_TX_BCAST_BYTES_IX,
  919. FW_VI_PF_STAT_TX_BCAST_FRAMES_IX,
  920. FW_VI_PF_STAT_TX_MCAST_BYTES_IX,
  921. FW_VI_PF_STAT_TX_MCAST_FRAMES_IX,
  922. FW_VI_PF_STAT_TX_UCAST_BYTES_IX,
  923. FW_VI_PF_STAT_TX_UCAST_FRAMES_IX,
  924. FW_VI_PF_STAT_TX_OFLD_BYTES_IX,
  925. FW_VI_PF_STAT_TX_OFLD_FRAMES_IX,
  926. FW_VI_PF_STAT_RX_BYTES_IX,
  927. FW_VI_PF_STAT_RX_FRAMES_IX,
  928. FW_VI_PF_STAT_RX_BCAST_BYTES_IX,
  929. FW_VI_PF_STAT_RX_BCAST_FRAMES_IX,
  930. FW_VI_PF_STAT_RX_MCAST_BYTES_IX,
  931. FW_VI_PF_STAT_RX_MCAST_FRAMES_IX,
  932. FW_VI_PF_STAT_RX_UCAST_BYTES_IX,
  933. FW_VI_PF_STAT_RX_UCAST_FRAMES_IX,
  934. FW_VI_PF_STAT_RX_ERR_FRAMES_IX
  935. };
  936. struct fw_vi_stats_cmd {
  937. __be32 op_to_viid;
  938. __be32 retval_len16;
  939. union fw_vi_stats {
  940. struct fw_vi_stats_ctl {
  941. __be16 nstats_ix;
  942. __be16 r6;
  943. __be32 r7;
  944. __be64 stat0;
  945. __be64 stat1;
  946. __be64 stat2;
  947. __be64 stat3;
  948. __be64 stat4;
  949. __be64 stat5;
  950. } ctl;
  951. struct fw_vi_stats_pf {
  952. __be64 tx_bcast_bytes;
  953. __be64 tx_bcast_frames;
  954. __be64 tx_mcast_bytes;
  955. __be64 tx_mcast_frames;
  956. __be64 tx_ucast_bytes;
  957. __be64 tx_ucast_frames;
  958. __be64 tx_offload_bytes;
  959. __be64 tx_offload_frames;
  960. __be64 rx_pf_bytes;
  961. __be64 rx_pf_frames;
  962. __be64 rx_bcast_bytes;
  963. __be64 rx_bcast_frames;
  964. __be64 rx_mcast_bytes;
  965. __be64 rx_mcast_frames;
  966. __be64 rx_ucast_bytes;
  967. __be64 rx_ucast_frames;
  968. __be64 rx_err_frames;
  969. } pf;
  970. struct fw_vi_stats_vf {
  971. __be64 tx_bcast_bytes;
  972. __be64 tx_bcast_frames;
  973. __be64 tx_mcast_bytes;
  974. __be64 tx_mcast_frames;
  975. __be64 tx_ucast_bytes;
  976. __be64 tx_ucast_frames;
  977. __be64 tx_drop_frames;
  978. __be64 tx_offload_bytes;
  979. __be64 tx_offload_frames;
  980. __be64 rx_bcast_bytes;
  981. __be64 rx_bcast_frames;
  982. __be64 rx_mcast_bytes;
  983. __be64 rx_mcast_frames;
  984. __be64 rx_ucast_bytes;
  985. __be64 rx_ucast_frames;
  986. __be64 rx_err_frames;
  987. } vf;
  988. } u;
  989. };
  990. #define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
  991. #define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
  992. #define FW_VI_STATS_CMD_IX(x) ((x) << 0)
  993. struct fw_acl_mac_cmd {
  994. __be32 op_to_vfn;
  995. __be32 en_to_len16;
  996. u8 nmac;
  997. u8 r3[7];
  998. __be16 r4;
  999. u8 macaddr0[6];
  1000. __be16 r5;
  1001. u8 macaddr1[6];
  1002. __be16 r6;
  1003. u8 macaddr2[6];
  1004. __be16 r7;
  1005. u8 macaddr3[6];
  1006. };
  1007. #define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
  1008. #define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
  1009. #define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
  1010. struct fw_acl_vlan_cmd {
  1011. __be32 op_to_vfn;
  1012. __be32 en_to_len16;
  1013. u8 nvlan;
  1014. u8 dropnovlan_fm;
  1015. u8 r3_lo[6];
  1016. __be16 vlanid[16];
  1017. };
  1018. #define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
  1019. #define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
  1020. #define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
  1021. #define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
  1022. #define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
  1023. enum fw_port_cap {
  1024. FW_PORT_CAP_SPEED_100M = 0x0001,
  1025. FW_PORT_CAP_SPEED_1G = 0x0002,
  1026. FW_PORT_CAP_SPEED_2_5G = 0x0004,
  1027. FW_PORT_CAP_SPEED_10G = 0x0008,
  1028. FW_PORT_CAP_SPEED_40G = 0x0010,
  1029. FW_PORT_CAP_SPEED_100G = 0x0020,
  1030. FW_PORT_CAP_FC_RX = 0x0040,
  1031. FW_PORT_CAP_FC_TX = 0x0080,
  1032. FW_PORT_CAP_ANEG = 0x0100,
  1033. FW_PORT_CAP_MDI_0 = 0x0200,
  1034. FW_PORT_CAP_MDI_1 = 0x0400,
  1035. FW_PORT_CAP_BEAN = 0x0800,
  1036. FW_PORT_CAP_PMA_LPBK = 0x1000,
  1037. FW_PORT_CAP_PCS_LPBK = 0x2000,
  1038. FW_PORT_CAP_PHYXS_LPBK = 0x4000,
  1039. FW_PORT_CAP_FAR_END_LPBK = 0x8000,
  1040. };
  1041. enum fw_port_mdi {
  1042. FW_PORT_MDI_UNCHANGED,
  1043. FW_PORT_MDI_AUTO,
  1044. FW_PORT_MDI_F_STRAIGHT,
  1045. FW_PORT_MDI_F_CROSSOVER
  1046. };
  1047. #define FW_PORT_MDI(x) ((x) << 9)
  1048. enum fw_port_action {
  1049. FW_PORT_ACTION_L1_CFG = 0x0001,
  1050. FW_PORT_ACTION_L2_CFG = 0x0002,
  1051. FW_PORT_ACTION_GET_PORT_INFO = 0x0003,
  1052. FW_PORT_ACTION_L2_PPP_CFG = 0x0004,
  1053. FW_PORT_ACTION_L2_DCB_CFG = 0x0005,
  1054. FW_PORT_ACTION_LOW_PWR_TO_NORMAL = 0x0010,
  1055. FW_PORT_ACTION_L1_LOW_PWR_EN = 0x0011,
  1056. FW_PORT_ACTION_L2_WOL_MODE_EN = 0x0012,
  1057. FW_PORT_ACTION_LPBK_TO_NORMAL = 0x0020,
  1058. FW_PORT_ACTION_L1_LPBK = 0x0021,
  1059. FW_PORT_ACTION_L1_PMA_LPBK = 0x0022,
  1060. FW_PORT_ACTION_L1_PCS_LPBK = 0x0023,
  1061. FW_PORT_ACTION_L1_PHYXS_CSIDE_LPBK = 0x0024,
  1062. FW_PORT_ACTION_L1_PHYXS_ESIDE_LPBK = 0x0025,
  1063. FW_PORT_ACTION_PHY_RESET = 0x0040,
  1064. FW_PORT_ACTION_PMA_RESET = 0x0041,
  1065. FW_PORT_ACTION_PCS_RESET = 0x0042,
  1066. FW_PORT_ACTION_PHYXS_RESET = 0x0043,
  1067. FW_PORT_ACTION_DTEXS_REEST = 0x0044,
  1068. FW_PORT_ACTION_AN_RESET = 0x0045
  1069. };
  1070. enum fw_port_l2cfg_ctlbf {
  1071. FW_PORT_L2_CTLBF_OVLAN0 = 0x01,
  1072. FW_PORT_L2_CTLBF_OVLAN1 = 0x02,
  1073. FW_PORT_L2_CTLBF_OVLAN2 = 0x04,
  1074. FW_PORT_L2_CTLBF_OVLAN3 = 0x08,
  1075. FW_PORT_L2_CTLBF_IVLAN = 0x10,
  1076. FW_PORT_L2_CTLBF_TXIPG = 0x20
  1077. };
  1078. enum fw_port_dcb_cfg {
  1079. FW_PORT_DCB_CFG_PG = 0x01,
  1080. FW_PORT_DCB_CFG_PFC = 0x02,
  1081. FW_PORT_DCB_CFG_APPL = 0x04
  1082. };
  1083. enum fw_port_dcb_cfg_rc {
  1084. FW_PORT_DCB_CFG_SUCCESS = 0x0,
  1085. FW_PORT_DCB_CFG_ERROR = 0x1
  1086. };
  1087. enum fw_port_dcb_type {
  1088. FW_PORT_DCB_TYPE_PGID = 0x00,
  1089. FW_PORT_DCB_TYPE_PGRATE = 0x01,
  1090. FW_PORT_DCB_TYPE_PRIORATE = 0x02,
  1091. FW_PORT_DCB_TYPE_PFC = 0x03,
  1092. FW_PORT_DCB_TYPE_APP_ID = 0x04,
  1093. };
  1094. struct fw_port_cmd {
  1095. __be32 op_to_portid;
  1096. __be32 action_to_len16;
  1097. union fw_port {
  1098. struct fw_port_l1cfg {
  1099. __be32 rcap;
  1100. __be32 r;
  1101. } l1cfg;
  1102. struct fw_port_l2cfg {
  1103. __be16 ctlbf_to_ivlan0;
  1104. __be16 ivlantype;
  1105. __be32 txipg_pkd;
  1106. __be16 ovlan0mask;
  1107. __be16 ovlan0type;
  1108. __be16 ovlan1mask;
  1109. __be16 ovlan1type;
  1110. __be16 ovlan2mask;
  1111. __be16 ovlan2type;
  1112. __be16 ovlan3mask;
  1113. __be16 ovlan3type;
  1114. } l2cfg;
  1115. struct fw_port_info {
  1116. __be32 lstatus_to_modtype;
  1117. __be16 pcap;
  1118. __be16 acap;
  1119. __be16 mtu;
  1120. __u8 cbllen;
  1121. __u8 r9;
  1122. __be32 r10;
  1123. __be64 r11;
  1124. } info;
  1125. struct fw_port_ppp {
  1126. __be32 pppen_to_ncsich;
  1127. __be32 r11;
  1128. } ppp;
  1129. struct fw_port_dcb {
  1130. __be16 cfg;
  1131. u8 up_map;
  1132. u8 sf_cfgrc;
  1133. __be16 prot_ix;
  1134. u8 pe7_to_pe0;
  1135. u8 numTCPFCs;
  1136. __be32 pgid0_to_pgid7;
  1137. __be32 numTCs_oui;
  1138. u8 pgpc[8];
  1139. } dcb;
  1140. } u;
  1141. };
  1142. #define FW_PORT_CMD_READ (1U << 22)
  1143. #define FW_PORT_CMD_PORTID(x) ((x) << 0)
  1144. #define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
  1145. #define FW_PORT_CMD_ACTION(x) ((x) << 16)
  1146. #define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
  1147. #define FW_PORT_CMD_CTLBF(x) ((x) << 10)
  1148. #define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
  1149. #define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
  1150. #define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
  1151. #define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
  1152. #define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
  1153. #define FW_PORT_CMD_TXIPG(x) ((x) << 19)
  1154. #define FW_PORT_CMD_LSTATUS (1U << 31)
  1155. #define FW_PORT_CMD_LSTATUS_GET(x) (((x) >> 31) & 0x1)
  1156. #define FW_PORT_CMD_LSPEED(x) ((x) << 24)
  1157. #define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
  1158. #define FW_PORT_CMD_TXPAUSE (1U << 23)
  1159. #define FW_PORT_CMD_RXPAUSE (1U << 22)
  1160. #define FW_PORT_CMD_MDIOCAP (1U << 21)
  1161. #define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
  1162. #define FW_PORT_CMD_LPTXPAUSE (1U << 15)
  1163. #define FW_PORT_CMD_LPRXPAUSE (1U << 14)
  1164. #define FW_PORT_CMD_PTYPE_MASK 0x1f
  1165. #define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
  1166. #define FW_PORT_CMD_MODTYPE_MASK 0x1f
  1167. #define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
  1168. #define FW_PORT_CMD_PPPEN(x) ((x) << 31)
  1169. #define FW_PORT_CMD_TPSRC(x) ((x) << 28)
  1170. #define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
  1171. #define FW_PORT_CMD_CH0(x) ((x) << 20)
  1172. #define FW_PORT_CMD_CH1(x) ((x) << 16)
  1173. #define FW_PORT_CMD_CH2(x) ((x) << 12)
  1174. #define FW_PORT_CMD_CH3(x) ((x) << 8)
  1175. #define FW_PORT_CMD_NCSICH(x) ((x) << 4)
  1176. enum fw_port_type {
  1177. FW_PORT_TYPE_FIBER_XFI,
  1178. FW_PORT_TYPE_FIBER_XAUI,
  1179. FW_PORT_TYPE_BT_SGMII,
  1180. FW_PORT_TYPE_BT_XFI,
  1181. FW_PORT_TYPE_BT_XAUI,
  1182. FW_PORT_TYPE_KX4,
  1183. FW_PORT_TYPE_CX4,
  1184. FW_PORT_TYPE_KX,
  1185. FW_PORT_TYPE_KR,
  1186. FW_PORT_TYPE_SFP,
  1187. FW_PORT_TYPE_BP_AP,
  1188. FW_PORT_TYPE_BP4_AP,
  1189. FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
  1190. };
  1191. enum fw_port_module_type {
  1192. FW_PORT_MOD_TYPE_NA,
  1193. FW_PORT_MOD_TYPE_LR,
  1194. FW_PORT_MOD_TYPE_SR,
  1195. FW_PORT_MOD_TYPE_ER,
  1196. FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
  1197. FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
  1198. FW_PORT_MOD_TYPE_LRM,
  1199. FW_PORT_MOD_TYPE_ERROR = FW_PORT_CMD_MODTYPE_MASK - 3,
  1200. FW_PORT_MOD_TYPE_UNKNOWN = FW_PORT_CMD_MODTYPE_MASK - 2,
  1201. FW_PORT_MOD_TYPE_NOTSUPPORTED = FW_PORT_CMD_MODTYPE_MASK - 1,
  1202. FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
  1203. };
  1204. /* port stats */
  1205. #define FW_NUM_PORT_STATS 50
  1206. #define FW_NUM_PORT_TX_STATS 23
  1207. #define FW_NUM_PORT_RX_STATS 27
  1208. enum fw_port_stats_tx_index {
  1209. FW_STAT_TX_PORT_BYTES_IX,
  1210. FW_STAT_TX_PORT_FRAMES_IX,
  1211. FW_STAT_TX_PORT_BCAST_IX,
  1212. FW_STAT_TX_PORT_MCAST_IX,
  1213. FW_STAT_TX_PORT_UCAST_IX,
  1214. FW_STAT_TX_PORT_ERROR_IX,
  1215. FW_STAT_TX_PORT_64B_IX,
  1216. FW_STAT_TX_PORT_65B_127B_IX,
  1217. FW_STAT_TX_PORT_128B_255B_IX,
  1218. FW_STAT_TX_PORT_256B_511B_IX,
  1219. FW_STAT_TX_PORT_512B_1023B_IX,
  1220. FW_STAT_TX_PORT_1024B_1518B_IX,
  1221. FW_STAT_TX_PORT_1519B_MAX_IX,
  1222. FW_STAT_TX_PORT_DROP_IX,
  1223. FW_STAT_TX_PORT_PAUSE_IX,
  1224. FW_STAT_TX_PORT_PPP0_IX,
  1225. FW_STAT_TX_PORT_PPP1_IX,
  1226. FW_STAT_TX_PORT_PPP2_IX,
  1227. FW_STAT_TX_PORT_PPP3_IX,
  1228. FW_STAT_TX_PORT_PPP4_IX,
  1229. FW_STAT_TX_PORT_PPP5_IX,
  1230. FW_STAT_TX_PORT_PPP6_IX,
  1231. FW_STAT_TX_PORT_PPP7_IX
  1232. };
  1233. enum fw_port_stat_rx_index {
  1234. FW_STAT_RX_PORT_BYTES_IX,
  1235. FW_STAT_RX_PORT_FRAMES_IX,
  1236. FW_STAT_RX_PORT_BCAST_IX,
  1237. FW_STAT_RX_PORT_MCAST_IX,
  1238. FW_STAT_RX_PORT_UCAST_IX,
  1239. FW_STAT_RX_PORT_MTU_ERROR_IX,
  1240. FW_STAT_RX_PORT_MTU_CRC_ERROR_IX,
  1241. FW_STAT_RX_PORT_CRC_ERROR_IX,
  1242. FW_STAT_RX_PORT_LEN_ERROR_IX,
  1243. FW_STAT_RX_PORT_SYM_ERROR_IX,
  1244. FW_STAT_RX_PORT_64B_IX,
  1245. FW_STAT_RX_PORT_65B_127B_IX,
  1246. FW_STAT_RX_PORT_128B_255B_IX,
  1247. FW_STAT_RX_PORT_256B_511B_IX,
  1248. FW_STAT_RX_PORT_512B_1023B_IX,
  1249. FW_STAT_RX_PORT_1024B_1518B_IX,
  1250. FW_STAT_RX_PORT_1519B_MAX_IX,
  1251. FW_STAT_RX_PORT_PAUSE_IX,
  1252. FW_STAT_RX_PORT_PPP0_IX,
  1253. FW_STAT_RX_PORT_PPP1_IX,
  1254. FW_STAT_RX_PORT_PPP2_IX,
  1255. FW_STAT_RX_PORT_PPP3_IX,
  1256. FW_STAT_RX_PORT_PPP4_IX,
  1257. FW_STAT_RX_PORT_PPP5_IX,
  1258. FW_STAT_RX_PORT_PPP6_IX,
  1259. FW_STAT_RX_PORT_PPP7_IX,
  1260. FW_STAT_RX_PORT_LESS_64B_IX
  1261. };
  1262. struct fw_port_stats_cmd {
  1263. __be32 op_to_portid;
  1264. __be32 retval_len16;
  1265. union fw_port_stats {
  1266. struct fw_port_stats_ctl {
  1267. u8 nstats_bg_bm;
  1268. u8 tx_ix;
  1269. __be16 r6;
  1270. __be32 r7;
  1271. __be64 stat0;
  1272. __be64 stat1;
  1273. __be64 stat2;
  1274. __be64 stat3;
  1275. __be64 stat4;
  1276. __be64 stat5;
  1277. } ctl;
  1278. struct fw_port_stats_all {
  1279. __be64 tx_bytes;
  1280. __be64 tx_frames;
  1281. __be64 tx_bcast;
  1282. __be64 tx_mcast;
  1283. __be64 tx_ucast;
  1284. __be64 tx_error;
  1285. __be64 tx_64b;
  1286. __be64 tx_65b_127b;
  1287. __be64 tx_128b_255b;
  1288. __be64 tx_256b_511b;
  1289. __be64 tx_512b_1023b;
  1290. __be64 tx_1024b_1518b;
  1291. __be64 tx_1519b_max;
  1292. __be64 tx_drop;
  1293. __be64 tx_pause;
  1294. __be64 tx_ppp0;
  1295. __be64 tx_ppp1;
  1296. __be64 tx_ppp2;
  1297. __be64 tx_ppp3;
  1298. __be64 tx_ppp4;
  1299. __be64 tx_ppp5;
  1300. __be64 tx_ppp6;
  1301. __be64 tx_ppp7;
  1302. __be64 rx_bytes;
  1303. __be64 rx_frames;
  1304. __be64 rx_bcast;
  1305. __be64 rx_mcast;
  1306. __be64 rx_ucast;
  1307. __be64 rx_mtu_error;
  1308. __be64 rx_mtu_crc_error;
  1309. __be64 rx_crc_error;
  1310. __be64 rx_len_error;
  1311. __be64 rx_sym_error;
  1312. __be64 rx_64b;
  1313. __be64 rx_65b_127b;
  1314. __be64 rx_128b_255b;
  1315. __be64 rx_256b_511b;
  1316. __be64 rx_512b_1023b;
  1317. __be64 rx_1024b_1518b;
  1318. __be64 rx_1519b_max;
  1319. __be64 rx_pause;
  1320. __be64 rx_ppp0;
  1321. __be64 rx_ppp1;
  1322. __be64 rx_ppp2;
  1323. __be64 rx_ppp3;
  1324. __be64 rx_ppp4;
  1325. __be64 rx_ppp5;
  1326. __be64 rx_ppp6;
  1327. __be64 rx_ppp7;
  1328. __be64 rx_less_64b;
  1329. __be64 rx_bg_drop;
  1330. __be64 rx_bg_trunc;
  1331. } all;
  1332. } u;
  1333. };
  1334. #define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
  1335. #define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
  1336. #define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
  1337. #define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
  1338. /* port loopback stats */
  1339. #define FW_NUM_LB_STATS 16
  1340. enum fw_port_lb_stats_index {
  1341. FW_STAT_LB_PORT_BYTES_IX,
  1342. FW_STAT_LB_PORT_FRAMES_IX,
  1343. FW_STAT_LB_PORT_BCAST_IX,
  1344. FW_STAT_LB_PORT_MCAST_IX,
  1345. FW_STAT_LB_PORT_UCAST_IX,
  1346. FW_STAT_LB_PORT_ERROR_IX,
  1347. FW_STAT_LB_PORT_64B_IX,
  1348. FW_STAT_LB_PORT_65B_127B_IX,
  1349. FW_STAT_LB_PORT_128B_255B_IX,
  1350. FW_STAT_LB_PORT_256B_511B_IX,
  1351. FW_STAT_LB_PORT_512B_1023B_IX,
  1352. FW_STAT_LB_PORT_1024B_1518B_IX,
  1353. FW_STAT_LB_PORT_1519B_MAX_IX,
  1354. FW_STAT_LB_PORT_DROP_FRAMES_IX
  1355. };
  1356. struct fw_port_lb_stats_cmd {
  1357. __be32 op_to_lbport;
  1358. __be32 retval_len16;
  1359. union fw_port_lb_stats {
  1360. struct fw_port_lb_stats_ctl {
  1361. u8 nstats_bg_bm;
  1362. u8 ix_pkd;
  1363. __be16 r6;
  1364. __be32 r7;
  1365. __be64 stat0;
  1366. __be64 stat1;
  1367. __be64 stat2;
  1368. __be64 stat3;
  1369. __be64 stat4;
  1370. __be64 stat5;
  1371. } ctl;
  1372. struct fw_port_lb_stats_all {
  1373. __be64 tx_bytes;
  1374. __be64 tx_frames;
  1375. __be64 tx_bcast;
  1376. __be64 tx_mcast;
  1377. __be64 tx_ucast;
  1378. __be64 tx_error;
  1379. __be64 tx_64b;
  1380. __be64 tx_65b_127b;
  1381. __be64 tx_128b_255b;
  1382. __be64 tx_256b_511b;
  1383. __be64 tx_512b_1023b;
  1384. __be64 tx_1024b_1518b;
  1385. __be64 tx_1519b_max;
  1386. __be64 rx_lb_drop;
  1387. __be64 rx_lb_trunc;
  1388. } all;
  1389. } u;
  1390. };
  1391. #define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
  1392. #define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
  1393. #define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
  1394. #define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
  1395. struct fw_rss_ind_tbl_cmd {
  1396. __be32 op_to_viid;
  1397. #define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
  1398. __be32 retval_len16;
  1399. __be16 niqid;
  1400. __be16 startidx;
  1401. __be32 r3;
  1402. __be32 iq0_to_iq2;
  1403. #define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
  1404. #define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
  1405. #define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
  1406. __be32 iq3_to_iq5;
  1407. __be32 iq6_to_iq8;
  1408. __be32 iq9_to_iq11;
  1409. __be32 iq12_to_iq14;
  1410. __be32 iq15_to_iq17;
  1411. __be32 iq18_to_iq20;
  1412. __be32 iq21_to_iq23;
  1413. __be32 iq24_to_iq26;
  1414. __be32 iq27_to_iq29;
  1415. __be32 iq30_iq31;
  1416. __be32 r15_lo;
  1417. };
  1418. struct fw_rss_glb_config_cmd {
  1419. __be32 op_to_write;
  1420. __be32 retval_len16;
  1421. union fw_rss_glb_config {
  1422. struct fw_rss_glb_config_manual {
  1423. __be32 mode_pkd;
  1424. __be32 r3;
  1425. __be64 r4;
  1426. __be64 r5;
  1427. } manual;
  1428. struct fw_rss_glb_config_basicvirtual {
  1429. __be32 mode_pkd;
  1430. __be32 synmapen_to_hashtoeplitz;
  1431. #define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
  1432. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
  1433. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
  1434. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
  1435. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
  1436. #define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
  1437. #define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
  1438. #define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
  1439. #define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
  1440. __be64 r8;
  1441. __be64 r9;
  1442. } basicvirtual;
  1443. } u;
  1444. };
  1445. #define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
  1446. #define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
  1447. #define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
  1448. #define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
  1449. struct fw_rss_vi_config_cmd {
  1450. __be32 op_to_viid;
  1451. #define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
  1452. __be32 retval_len16;
  1453. union fw_rss_vi_config {
  1454. struct fw_rss_vi_config_manual {
  1455. __be64 r3;
  1456. __be64 r4;
  1457. __be64 r5;
  1458. } manual;
  1459. struct fw_rss_vi_config_basicvirtual {
  1460. __be32 r6;
  1461. __be32 defaultq_to_udpen;
  1462. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
  1463. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
  1464. #define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
  1465. #define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
  1466. #define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
  1467. #define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
  1468. #define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
  1469. __be64 r9;
  1470. __be64 r10;
  1471. } basicvirtual;
  1472. } u;
  1473. };
  1474. enum fw_error_type {
  1475. FW_ERROR_TYPE_EXCEPTION = 0x0,
  1476. FW_ERROR_TYPE_HWMODULE = 0x1,
  1477. FW_ERROR_TYPE_WR = 0x2,
  1478. FW_ERROR_TYPE_ACL = 0x3,
  1479. };
  1480. struct fw_error_cmd {
  1481. __be32 op_to_type;
  1482. __be32 len16_pkd;
  1483. union fw_error {
  1484. struct fw_error_exception {
  1485. __be32 info[6];
  1486. } exception;
  1487. struct fw_error_hwmodule {
  1488. __be32 regaddr;
  1489. __be32 regval;
  1490. } hwmodule;
  1491. struct fw_error_wr {
  1492. __be16 cidx;
  1493. __be16 pfn_vfn;
  1494. __be32 eqid;
  1495. u8 wrhdr[16];
  1496. } wr;
  1497. struct fw_error_acl {
  1498. __be16 cidx;
  1499. __be16 pfn_vfn;
  1500. __be32 eqid;
  1501. __be16 mv_pkd;
  1502. u8 val[6];
  1503. __be64 r4;
  1504. } acl;
  1505. } u;
  1506. };
  1507. struct fw_debug_cmd {
  1508. __be32 op_type;
  1509. #define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
  1510. __be32 len16_pkd;
  1511. union fw_debug {
  1512. struct fw_debug_assert {
  1513. __be32 fcid;
  1514. __be32 line;
  1515. __be32 x;
  1516. __be32 y;
  1517. u8 filename_0_7[8];
  1518. u8 filename_8_15[8];
  1519. __be64 r3;
  1520. } assert;
  1521. struct fw_debug_prt {
  1522. __be16 dprtstridx;
  1523. __be16 r3[3];
  1524. __be32 dprtstrparam0;
  1525. __be32 dprtstrparam1;
  1526. __be32 dprtstrparam2;
  1527. __be32 dprtstrparam3;
  1528. } prt;
  1529. } u;
  1530. };
  1531. #define FW_PCIE_FW_ERR (1U << 31)
  1532. #define FW_PCIE_FW_INIT (1U << 30)
  1533. #define FW_PCIE_FW_HALT (1U << 29)
  1534. #define FW_PCIE_FW_MASTER_VLD (1U << 15)
  1535. #define FW_PCIE_FW_MASTER_MASK 0x7
  1536. #define FW_PCIE_FW_MASTER_SHIFT 12
  1537. #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
  1538. #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
  1539. FW_PCIE_FW_MASTER_MASK)
  1540. struct fw_hdr {
  1541. u8 ver;
  1542. u8 reserved1;
  1543. __be16 len512; /* bin length in units of 512-bytes */
  1544. __be32 fw_ver; /* firmware version */
  1545. __be32 tp_microcode_ver;
  1546. u8 intfver_nic;
  1547. u8 intfver_vnic;
  1548. u8 intfver_ofld;
  1549. u8 intfver_ri;
  1550. u8 intfver_iscsipdu;
  1551. u8 intfver_iscsi;
  1552. u8 intfver_fcoe;
  1553. u8 reserved2;
  1554. __u32 reserved3;
  1555. __u32 reserved4;
  1556. __u32 reserved5;
  1557. __be32 flags;
  1558. __be32 reserved6[23];
  1559. };
  1560. #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
  1561. #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
  1562. #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
  1563. #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
  1564. enum fw_hdr_flags {
  1565. FW_HDR_FLAGS_RESET_HALT = 0x00000001,
  1566. };
  1567. #endif /* _T4FW_INTERFACE_H_ */