t4fw_api.h 41 KB

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