bna_hw.h 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  1. /*
  2. * Linux network driver for Brocade Converged Network Adapter.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License (GPL) Version 2 as
  6. * published by the Free Software Foundation
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. */
  13. /*
  14. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  15. * All rights reserved
  16. * www.brocade.com
  17. */
  18. /**
  19. * File for interrupt macros and functions
  20. */
  21. #ifndef __BNA_HW_H__
  22. #define __BNA_HW_H__
  23. #include "bfi_reg.h"
  24. /**
  25. *
  26. * SW imposed limits
  27. *
  28. */
  29. #ifndef BNA_BIOS_BUILD
  30. #define BFI_MAX_TXQ 64
  31. #define BFI_MAX_RXQ 64
  32. #define BFI_MAX_RXF 64
  33. #define BFI_MAX_IB 128
  34. #define BFI_MAX_RIT_SIZE 256
  35. #define BFI_RSS_RIT_SIZE 64
  36. #define BFI_NONRSS_RIT_SIZE 1
  37. #define BFI_MAX_UCMAC 256
  38. #define BFI_MAX_MCMAC 512
  39. #define BFI_IBIDX_SIZE 4
  40. #define BFI_MAX_VLAN 4095
  41. /**
  42. * There are 2 free IB index pools:
  43. * pool1: 120 segments of 1 index each
  44. * pool8: 1 segment of 8 indexes
  45. */
  46. #define BFI_IBIDX_POOL1_SIZE 116
  47. #define BFI_IBIDX_POOL1_ENTRY_SIZE 1
  48. #define BFI_IBIDX_POOL2_SIZE 2
  49. #define BFI_IBIDX_POOL2_ENTRY_SIZE 2
  50. #define BFI_IBIDX_POOL8_SIZE 1
  51. #define BFI_IBIDX_POOL8_ENTRY_SIZE 8
  52. #define BFI_IBIDX_TOTAL_POOLS 3
  53. #define BFI_IBIDX_TOTAL_SEGS 119 /* (POOL1 + POOL2 + POOL8)_SIZE */
  54. #define BFI_IBIDX_MAX_SEGSIZE 8
  55. #define init_ibidx_pool(name) \
  56. static struct bna_ibidx_pool name[BFI_IBIDX_TOTAL_POOLS] = \
  57. { \
  58. { BFI_IBIDX_POOL1_SIZE, BFI_IBIDX_POOL1_ENTRY_SIZE }, \
  59. { BFI_IBIDX_POOL2_SIZE, BFI_IBIDX_POOL2_ENTRY_SIZE }, \
  60. { BFI_IBIDX_POOL8_SIZE, BFI_IBIDX_POOL8_ENTRY_SIZE } \
  61. }
  62. /**
  63. * There are 2 free RIT segment pools:
  64. * Pool1: 192 segments of 1 RIT entry each
  65. * Pool2: 1 segment of 64 RIT entry
  66. */
  67. #define BFI_RIT_SEG_POOL1_SIZE 192
  68. #define BFI_RIT_SEG_POOL1_ENTRY_SIZE 1
  69. #define BFI_RIT_SEG_POOLRSS_SIZE 1
  70. #define BFI_RIT_SEG_POOLRSS_ENTRY_SIZE 64
  71. #define BFI_RIT_SEG_TOTAL_POOLS 2
  72. #define BFI_RIT_TOTAL_SEGS 193 /* POOL1_SIZE + POOLRSS_SIZE */
  73. #define init_ritseg_pool(name) \
  74. static struct bna_ritseg_pool_cfg name[BFI_RIT_SEG_TOTAL_POOLS] = \
  75. { \
  76. { BFI_RIT_SEG_POOL1_SIZE, BFI_RIT_SEG_POOL1_ENTRY_SIZE }, \
  77. { BFI_RIT_SEG_POOLRSS_SIZE, BFI_RIT_SEG_POOLRSS_ENTRY_SIZE } \
  78. }
  79. #else /* BNA_BIOS_BUILD */
  80. #define BFI_MAX_TXQ 1
  81. #define BFI_MAX_RXQ 1
  82. #define BFI_MAX_RXF 1
  83. #define BFI_MAX_IB 2
  84. #define BFI_MAX_RIT_SIZE 2
  85. #define BFI_RSS_RIT_SIZE 64
  86. #define BFI_NONRSS_RIT_SIZE 1
  87. #define BFI_MAX_UCMAC 1
  88. #define BFI_MAX_MCMAC 8
  89. #define BFI_IBIDX_SIZE 4
  90. #define BFI_MAX_VLAN 4095
  91. /* There is one free pool: 2 segments of 1 index each */
  92. #define BFI_IBIDX_POOL1_SIZE 2
  93. #define BFI_IBIDX_POOL1_ENTRY_SIZE 1
  94. #define BFI_IBIDX_TOTAL_POOLS 1
  95. #define BFI_IBIDX_TOTAL_SEGS 2 /* POOL1_SIZE */
  96. #define BFI_IBIDX_MAX_SEGSIZE 1
  97. #define init_ibidx_pool(name) \
  98. static struct bna_ibidx_pool name[BFI_IBIDX_TOTAL_POOLS] = \
  99. { \
  100. { BFI_IBIDX_POOL1_SIZE, BFI_IBIDX_POOL1_ENTRY_SIZE } \
  101. }
  102. #define BFI_RIT_SEG_POOL1_SIZE 1
  103. #define BFI_RIT_SEG_POOL1_ENTRY_SIZE 1
  104. #define BFI_RIT_SEG_TOTAL_POOLS 1
  105. #define BFI_RIT_TOTAL_SEGS 1 /* POOL1_SIZE */
  106. #define init_ritseg_pool(name) \
  107. static struct bna_ritseg_pool_cfg name[BFI_RIT_SEG_TOTAL_POOLS] = \
  108. { \
  109. { BFI_RIT_SEG_POOL1_SIZE, BFI_RIT_SEG_POOL1_ENTRY_SIZE } \
  110. }
  111. #endif /* BNA_BIOS_BUILD */
  112. #define BFI_RSS_HASH_KEY_LEN 10
  113. #define BFI_COALESCING_TIMER_UNIT 5 /* 5us */
  114. #define BFI_MAX_COALESCING_TIMEO 0xFF /* in 5us units */
  115. #define BFI_MAX_INTERPKT_COUNT 0xFF
  116. #define BFI_MAX_INTERPKT_TIMEO 0xF /* in 0.5us units */
  117. #define BFI_TX_COALESCING_TIMEO 20 /* 20 * 5 = 100us */
  118. #define BFI_TX_INTERPKT_COUNT 32
  119. #define BFI_RX_COALESCING_TIMEO 12 /* 12 * 5 = 60us */
  120. #define BFI_RX_INTERPKT_COUNT 6 /* Pkt Cnt = 6 */
  121. #define BFI_RX_INTERPKT_TIMEO 3 /* 3 * 0.5 = 1.5us */
  122. #define BFI_TXQ_WI_SIZE 64 /* bytes */
  123. #define BFI_RXQ_WI_SIZE 8 /* bytes */
  124. #define BFI_CQ_WI_SIZE 16 /* bytes */
  125. #define BFI_TX_MAX_WRR_QUOTA 0xFFF
  126. #define BFI_TX_MAX_VECTORS_PER_WI 4
  127. #define BFI_TX_MAX_VECTORS_PER_PKT 0xFF
  128. #define BFI_TX_MAX_DATA_PER_VECTOR 0xFFFF
  129. #define BFI_TX_MAX_DATA_PER_PKT 0xFFFFFF
  130. /* Small Q buffer size */
  131. #define BFI_SMALL_RXBUF_SIZE 128
  132. /* Defined separately since BFA_FLASH_DMA_BUF_SZ is in bfa_flash.c */
  133. #define BFI_FLASH_DMA_BUF_SZ 0x010000 /* 64K DMA */
  134. #define BFI_HW_STATS_SIZE 0x4000 /* 16K DMA */
  135. /**
  136. *
  137. * HW register offsets, macros
  138. *
  139. */
  140. /* DMA Block Register Host Window Start Address */
  141. #define DMA_BLK_REG_ADDR 0x00013000
  142. /* DMA Block Internal Registers */
  143. #define DMA_CTRL_REG0 (DMA_BLK_REG_ADDR + 0x000)
  144. #define DMA_CTRL_REG1 (DMA_BLK_REG_ADDR + 0x004)
  145. #define DMA_ERR_INT_STATUS (DMA_BLK_REG_ADDR + 0x008)
  146. #define DMA_ERR_INT_ENABLE (DMA_BLK_REG_ADDR + 0x00c)
  147. #define DMA_ERR_INT_STATUS_SET (DMA_BLK_REG_ADDR + 0x010)
  148. /* APP Block Register Address Offset from BAR0 */
  149. #define APP_BLK_REG_ADDR 0x00014000
  150. /* Host Function Interrupt Mask Registers */
  151. #define HOSTFN0_INT_MASK (APP_BLK_REG_ADDR + 0x004)
  152. #define HOSTFN1_INT_MASK (APP_BLK_REG_ADDR + 0x104)
  153. #define HOSTFN2_INT_MASK (APP_BLK_REG_ADDR + 0x304)
  154. #define HOSTFN3_INT_MASK (APP_BLK_REG_ADDR + 0x404)
  155. /**
  156. * Host Function PCIe Error Registers
  157. * Duplicates "Correctable" & "Uncorrectable"
  158. * registers in PCIe Config space.
  159. */
  160. #define FN0_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x014)
  161. #define FN1_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x114)
  162. #define FN2_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x314)
  163. #define FN3_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x414)
  164. /* Host Function Error Type Status Registers */
  165. #define FN0_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x018)
  166. #define FN1_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x118)
  167. #define FN2_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x318)
  168. #define FN3_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x418)
  169. /* Host Function Error Type Mask Registers */
  170. #define FN0_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x01c)
  171. #define FN1_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x11c)
  172. #define FN2_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x31c)
  173. #define FN3_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x41c)
  174. /* Catapult Host Semaphore Status Registers (App block) */
  175. #define HOST_SEM_STS0_REG (APP_BLK_REG_ADDR + 0x630)
  176. #define HOST_SEM_STS1_REG (APP_BLK_REG_ADDR + 0x634)
  177. #define HOST_SEM_STS2_REG (APP_BLK_REG_ADDR + 0x638)
  178. #define HOST_SEM_STS3_REG (APP_BLK_REG_ADDR + 0x63c)
  179. #define HOST_SEM_STS4_REG (APP_BLK_REG_ADDR + 0x640)
  180. #define HOST_SEM_STS5_REG (APP_BLK_REG_ADDR + 0x644)
  181. #define HOST_SEM_STS6_REG (APP_BLK_REG_ADDR + 0x648)
  182. #define HOST_SEM_STS7_REG (APP_BLK_REG_ADDR + 0x64c)
  183. /* PCIe Misc Register */
  184. #define PCIE_MISC_REG (APP_BLK_REG_ADDR + 0x200)
  185. /* Temp Sensor Control Registers */
  186. #define TEMPSENSE_CNTL_REG (APP_BLK_REG_ADDR + 0x250)
  187. #define TEMPSENSE_STAT_REG (APP_BLK_REG_ADDR + 0x254)
  188. /* APP Block local error registers */
  189. #define APP_LOCAL_ERR_STAT (APP_BLK_REG_ADDR + 0x258)
  190. #define APP_LOCAL_ERR_MSK (APP_BLK_REG_ADDR + 0x25c)
  191. /* PCIe Link Error registers */
  192. #define PCIE_LNK_ERR_STAT (APP_BLK_REG_ADDR + 0x260)
  193. #define PCIE_LNK_ERR_MSK (APP_BLK_REG_ADDR + 0x264)
  194. /**
  195. * FCoE/FIP Ethertype Register
  196. * 31:16 -- Chip wide value for FIP type
  197. * 15:0 -- Chip wide value for FCoE type
  198. */
  199. #define FCOE_FIP_ETH_TYPE (APP_BLK_REG_ADDR + 0x280)
  200. /**
  201. * Reserved Ethertype Register
  202. * 31:16 -- Reserved
  203. * 15:0 -- Other ethertype
  204. */
  205. #define RESV_ETH_TYPE (APP_BLK_REG_ADDR + 0x284)
  206. /**
  207. * Host Command Status Registers
  208. * Each set consists of 3 registers :
  209. * clear, set, cmd
  210. * 16 such register sets in all
  211. * See catapult_spec.pdf for detailed functionality
  212. * Put each type in a single macro accessed by _num ?
  213. */
  214. #define HOST_CMDSTS0_CLR_REG (APP_BLK_REG_ADDR + 0x500)
  215. #define HOST_CMDSTS0_SET_REG (APP_BLK_REG_ADDR + 0x504)
  216. #define HOST_CMDSTS0_REG (APP_BLK_REG_ADDR + 0x508)
  217. #define HOST_CMDSTS1_CLR_REG (APP_BLK_REG_ADDR + 0x510)
  218. #define HOST_CMDSTS1_SET_REG (APP_BLK_REG_ADDR + 0x514)
  219. #define HOST_CMDSTS1_REG (APP_BLK_REG_ADDR + 0x518)
  220. #define HOST_CMDSTS2_CLR_REG (APP_BLK_REG_ADDR + 0x520)
  221. #define HOST_CMDSTS2_SET_REG (APP_BLK_REG_ADDR + 0x524)
  222. #define HOST_CMDSTS2_REG (APP_BLK_REG_ADDR + 0x528)
  223. #define HOST_CMDSTS3_CLR_REG (APP_BLK_REG_ADDR + 0x530)
  224. #define HOST_CMDSTS3_SET_REG (APP_BLK_REG_ADDR + 0x534)
  225. #define HOST_CMDSTS3_REG (APP_BLK_REG_ADDR + 0x538)
  226. #define HOST_CMDSTS4_CLR_REG (APP_BLK_REG_ADDR + 0x540)
  227. #define HOST_CMDSTS4_SET_REG (APP_BLK_REG_ADDR + 0x544)
  228. #define HOST_CMDSTS4_REG (APP_BLK_REG_ADDR + 0x548)
  229. #define HOST_CMDSTS5_CLR_REG (APP_BLK_REG_ADDR + 0x550)
  230. #define HOST_CMDSTS5_SET_REG (APP_BLK_REG_ADDR + 0x554)
  231. #define HOST_CMDSTS5_REG (APP_BLK_REG_ADDR + 0x558)
  232. #define HOST_CMDSTS6_CLR_REG (APP_BLK_REG_ADDR + 0x560)
  233. #define HOST_CMDSTS6_SET_REG (APP_BLK_REG_ADDR + 0x564)
  234. #define HOST_CMDSTS6_REG (APP_BLK_REG_ADDR + 0x568)
  235. #define HOST_CMDSTS7_CLR_REG (APP_BLK_REG_ADDR + 0x570)
  236. #define HOST_CMDSTS7_SET_REG (APP_BLK_REG_ADDR + 0x574)
  237. #define HOST_CMDSTS7_REG (APP_BLK_REG_ADDR + 0x578)
  238. #define HOST_CMDSTS8_CLR_REG (APP_BLK_REG_ADDR + 0x580)
  239. #define HOST_CMDSTS8_SET_REG (APP_BLK_REG_ADDR + 0x584)
  240. #define HOST_CMDSTS8_REG (APP_BLK_REG_ADDR + 0x588)
  241. #define HOST_CMDSTS9_CLR_REG (APP_BLK_REG_ADDR + 0x590)
  242. #define HOST_CMDSTS9_SET_REG (APP_BLK_REG_ADDR + 0x594)
  243. #define HOST_CMDSTS9_REG (APP_BLK_REG_ADDR + 0x598)
  244. #define HOST_CMDSTS10_CLR_REG (APP_BLK_REG_ADDR + 0x5A0)
  245. #define HOST_CMDSTS10_SET_REG (APP_BLK_REG_ADDR + 0x5A4)
  246. #define HOST_CMDSTS10_REG (APP_BLK_REG_ADDR + 0x5A8)
  247. #define HOST_CMDSTS11_CLR_REG (APP_BLK_REG_ADDR + 0x5B0)
  248. #define HOST_CMDSTS11_SET_REG (APP_BLK_REG_ADDR + 0x5B4)
  249. #define HOST_CMDSTS11_REG (APP_BLK_REG_ADDR + 0x5B8)
  250. #define HOST_CMDSTS12_CLR_REG (APP_BLK_REG_ADDR + 0x5C0)
  251. #define HOST_CMDSTS12_SET_REG (APP_BLK_REG_ADDR + 0x5C4)
  252. #define HOST_CMDSTS12_REG (APP_BLK_REG_ADDR + 0x5C8)
  253. #define HOST_CMDSTS13_CLR_REG (APP_BLK_REG_ADDR + 0x5D0)
  254. #define HOST_CMDSTS13_SET_REG (APP_BLK_REG_ADDR + 0x5D4)
  255. #define HOST_CMDSTS13_REG (APP_BLK_REG_ADDR + 0x5D8)
  256. #define HOST_CMDSTS14_CLR_REG (APP_BLK_REG_ADDR + 0x5E0)
  257. #define HOST_CMDSTS14_SET_REG (APP_BLK_REG_ADDR + 0x5E4)
  258. #define HOST_CMDSTS14_REG (APP_BLK_REG_ADDR + 0x5E8)
  259. #define HOST_CMDSTS15_CLR_REG (APP_BLK_REG_ADDR + 0x5F0)
  260. #define HOST_CMDSTS15_SET_REG (APP_BLK_REG_ADDR + 0x5F4)
  261. #define HOST_CMDSTS15_REG (APP_BLK_REG_ADDR + 0x5F8)
  262. /**
  263. * LPU0 Block Register Address Offset from BAR0
  264. * Range 0x18000 - 0x18033
  265. */
  266. #define LPU0_BLK_REG_ADDR 0x00018000
  267. /**
  268. * LPU0 Registers
  269. * Should they be directly used from host,
  270. * except for diagnostics ?
  271. * CTL_REG : Control register
  272. * CMD_REG : Triggers exec. of cmd. in
  273. * Mailbox memory
  274. */
  275. #define LPU0_MBOX_CTL_REG (LPU0_BLK_REG_ADDR + 0x000)
  276. #define LPU0_MBOX_CMD_REG (LPU0_BLK_REG_ADDR + 0x004)
  277. #define LPU0_MBOX_LINK_0REG (LPU0_BLK_REG_ADDR + 0x008)
  278. #define LPU1_MBOX_LINK_0REG (LPU0_BLK_REG_ADDR + 0x00c)
  279. #define LPU0_MBOX_STATUS_0REG (LPU0_BLK_REG_ADDR + 0x010)
  280. #define LPU1_MBOX_STATUS_0REG (LPU0_BLK_REG_ADDR + 0x014)
  281. #define LPU0_ERR_STATUS_REG (LPU0_BLK_REG_ADDR + 0x018)
  282. #define LPU0_ERR_SET_REG (LPU0_BLK_REG_ADDR + 0x020)
  283. /**
  284. * LPU1 Block Register Address Offset from BAR0
  285. * Range 0x18400 - 0x18433
  286. */
  287. #define LPU1_BLK_REG_ADDR 0x00018400
  288. /**
  289. * LPU1 Registers
  290. * Same as LPU0 registers above
  291. */
  292. #define LPU1_MBOX_CTL_REG (LPU1_BLK_REG_ADDR + 0x000)
  293. #define LPU1_MBOX_CMD_REG (LPU1_BLK_REG_ADDR + 0x004)
  294. #define LPU0_MBOX_LINK_1REG (LPU1_BLK_REG_ADDR + 0x008)
  295. #define LPU1_MBOX_LINK_1REG (LPU1_BLK_REG_ADDR + 0x00c)
  296. #define LPU0_MBOX_STATUS_1REG (LPU1_BLK_REG_ADDR + 0x010)
  297. #define LPU1_MBOX_STATUS_1REG (LPU1_BLK_REG_ADDR + 0x014)
  298. #define LPU1_ERR_STATUS_REG (LPU1_BLK_REG_ADDR + 0x018)
  299. #define LPU1_ERR_SET_REG (LPU1_BLK_REG_ADDR + 0x020)
  300. /**
  301. * PSS Block Register Address Offset from BAR0
  302. * Range 0x18800 - 0x188DB
  303. */
  304. #define PSS_BLK_REG_ADDR 0x00018800
  305. /**
  306. * PSS Registers
  307. * For details, see catapult_spec.pdf
  308. * ERR_STATUS_REG : Indicates error in PSS module
  309. * RAM_ERR_STATUS_REG : Indicates RAM module that detected error
  310. */
  311. #define ERR_STATUS_SET (PSS_BLK_REG_ADDR + 0x018)
  312. #define PSS_RAM_ERR_STATUS_REG (PSS_BLK_REG_ADDR + 0x01C)
  313. /**
  314. * PSS Semaphore Lock Registers, total 16
  315. * First read when unlocked returns 0,
  316. * and is set to 1, atomically.
  317. * Subsequent reads returns 1.
  318. * To clear set the value to 0.
  319. * Range : 0x20 to 0x5c
  320. */
  321. #define PSS_SEM_LOCK_REG(_num) \
  322. (PSS_BLK_REG_ADDR + 0x020 + ((_num) << 2))
  323. /**
  324. * PSS Semaphore Status Registers,
  325. * corresponding to the lock registers above
  326. */
  327. #define PSS_SEM_STATUS_REG(_num) \
  328. (PSS_BLK_REG_ADDR + 0x060 + ((_num) << 2))
  329. /**
  330. * Catapult CPQ Registers
  331. * Defines for Mailbox Registers
  332. * Used to send mailbox commands to firmware from
  333. * host. The data part is written to the MBox
  334. * memory, registers are used to indicate that
  335. * a commnad is resident in memory.
  336. *
  337. * Note : LPU0<->LPU1 mailboxes are not listed here
  338. */
  339. #define CPQ_BLK_REG_ADDR 0x00019000
  340. #define HOSTFN0_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x130)
  341. #define HOSTFN0_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x134)
  342. #define LPU0_HOSTFN0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x138)
  343. #define LPU1_HOSTFN0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x13C)
  344. #define HOSTFN1_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x140)
  345. #define HOSTFN1_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x144)
  346. #define LPU0_HOSTFN1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x148)
  347. #define LPU1_HOSTFN1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x14C)
  348. #define HOSTFN2_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x170)
  349. #define HOSTFN2_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x174)
  350. #define LPU0_HOSTFN2_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x178)
  351. #define LPU1_HOSTFN2_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x17C)
  352. #define HOSTFN3_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x180)
  353. #define HOSTFN3_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x184)
  354. #define LPU0_HOSTFN3_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x188)
  355. #define LPU1_HOSTFN3_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x18C)
  356. /* Host Function Force Parity Error Registers */
  357. #define HOSTFN0_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x120)
  358. #define HOSTFN1_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x124)
  359. #define HOSTFN2_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x128)
  360. #define HOSTFN3_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x12C)
  361. /* LL Port[0|1] Halt Mask Registers */
  362. #define LL_HALT_MSK_P0 (CPQ_BLK_REG_ADDR + 0x1A0)
  363. #define LL_HALT_MSK_P1 (CPQ_BLK_REG_ADDR + 0x1B0)
  364. /* LL Port[0|1] Error Mask Registers */
  365. #define LL_ERR_MSK_P0 (CPQ_BLK_REG_ADDR + 0x1D0)
  366. #define LL_ERR_MSK_P1 (CPQ_BLK_REG_ADDR + 0x1D4)
  367. /* EMC FLI (Flash Controller) Block Register Address Offset from BAR0 */
  368. #define FLI_BLK_REG_ADDR 0x0001D000
  369. /* EMC FLI Registers */
  370. #define FLI_CMD_REG (FLI_BLK_REG_ADDR + 0x000)
  371. #define FLI_ADDR_REG (FLI_BLK_REG_ADDR + 0x004)
  372. #define FLI_CTL_REG (FLI_BLK_REG_ADDR + 0x008)
  373. #define FLI_WRDATA_REG (FLI_BLK_REG_ADDR + 0x00C)
  374. #define FLI_RDDATA_REG (FLI_BLK_REG_ADDR + 0x010)
  375. #define FLI_DEV_STATUS_REG (FLI_BLK_REG_ADDR + 0x014)
  376. #define FLI_SIG_WD_REG (FLI_BLK_REG_ADDR + 0x018)
  377. /**
  378. * RO register
  379. * 31:16 -- Vendor Id
  380. * 15:0 -- Device Id
  381. */
  382. #define FLI_DEV_VENDOR_REG (FLI_BLK_REG_ADDR + 0x01C)
  383. #define FLI_ERR_STATUS_REG (FLI_BLK_REG_ADDR + 0x020)
  384. /**
  385. * RAD (RxAdm) Block Register Address Offset from BAR0
  386. * RAD0 Range : 0x20000 - 0x203FF
  387. * RAD1 Range : 0x20400 - 0x207FF
  388. */
  389. #define RAD0_BLK_REG_ADDR 0x00020000
  390. #define RAD1_BLK_REG_ADDR 0x00020400
  391. /* RAD0 Registers */
  392. #define RAD0_CTL_REG (RAD0_BLK_REG_ADDR + 0x000)
  393. #define RAD0_PE_PARM_REG (RAD0_BLK_REG_ADDR + 0x004)
  394. #define RAD0_BCN_REG (RAD0_BLK_REG_ADDR + 0x008)
  395. /* Default function ID register */
  396. #define RAD0_DEFAULT_REG (RAD0_BLK_REG_ADDR + 0x00C)
  397. /* Default promiscuous ID register */
  398. #define RAD0_PROMISC_REG (RAD0_BLK_REG_ADDR + 0x010)
  399. #define RAD0_BCNQ_REG (RAD0_BLK_REG_ADDR + 0x014)
  400. /*
  401. * This register selects 1 of 8 PM Q's using
  402. * VLAN pri, for non-BCN packets without a VLAN tag
  403. */
  404. #define RAD0_DEFAULTQ_REG (RAD0_BLK_REG_ADDR + 0x018)
  405. #define RAD0_ERR_STS (RAD0_BLK_REG_ADDR + 0x01C)
  406. #define RAD0_SET_ERR_STS (RAD0_BLK_REG_ADDR + 0x020)
  407. #define RAD0_ERR_INT_EN (RAD0_BLK_REG_ADDR + 0x024)
  408. #define RAD0_FIRST_ERR (RAD0_BLK_REG_ADDR + 0x028)
  409. #define RAD0_FORCE_ERR (RAD0_BLK_REG_ADDR + 0x02C)
  410. #define RAD0_IF_RCVD (RAD0_BLK_REG_ADDR + 0x030)
  411. #define RAD0_IF_RCVD_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x034)
  412. #define RAD0_IF_RCVD_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x038)
  413. #define RAD0_IF_RCVD_VLAN (RAD0_BLK_REG_ADDR + 0x03C)
  414. #define RAD0_IF_RCVD_UCAST (RAD0_BLK_REG_ADDR + 0x040)
  415. #define RAD0_IF_RCVD_UCAST_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x044)
  416. #define RAD0_IF_RCVD_UCAST_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x048)
  417. #define RAD0_IF_RCVD_UCAST_VLAN (RAD0_BLK_REG_ADDR + 0x04C)
  418. #define RAD0_IF_RCVD_MCAST (RAD0_BLK_REG_ADDR + 0x050)
  419. #define RAD0_IF_RCVD_MCAST_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x054)
  420. #define RAD0_IF_RCVD_MCAST_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x058)
  421. #define RAD0_IF_RCVD_MCAST_VLAN (RAD0_BLK_REG_ADDR + 0x05C)
  422. #define RAD0_IF_RCVD_BCAST (RAD0_BLK_REG_ADDR + 0x060)
  423. #define RAD0_IF_RCVD_BCAST_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x064)
  424. #define RAD0_IF_RCVD_BCAST_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x068)
  425. #define RAD0_IF_RCVD_BCAST_VLAN (RAD0_BLK_REG_ADDR + 0x06C)
  426. #define RAD0_DROPPED_FRAMES (RAD0_BLK_REG_ADDR + 0x070)
  427. #define RAD0_MAC_MAN_1H (RAD0_BLK_REG_ADDR + 0x080)
  428. #define RAD0_MAC_MAN_1L (RAD0_BLK_REG_ADDR + 0x084)
  429. #define RAD0_MAC_MAN_2H (RAD0_BLK_REG_ADDR + 0x088)
  430. #define RAD0_MAC_MAN_2L (RAD0_BLK_REG_ADDR + 0x08C)
  431. #define RAD0_MAC_MAN_3H (RAD0_BLK_REG_ADDR + 0x090)
  432. #define RAD0_MAC_MAN_3L (RAD0_BLK_REG_ADDR + 0x094)
  433. #define RAD0_MAC_MAN_4H (RAD0_BLK_REG_ADDR + 0x098)
  434. #define RAD0_MAC_MAN_4L (RAD0_BLK_REG_ADDR + 0x09C)
  435. #define RAD0_LAST4_IP (RAD0_BLK_REG_ADDR + 0x100)
  436. /* RAD1 Registers */
  437. #define RAD1_CTL_REG (RAD1_BLK_REG_ADDR + 0x000)
  438. #define RAD1_PE_PARM_REG (RAD1_BLK_REG_ADDR + 0x004)
  439. #define RAD1_BCN_REG (RAD1_BLK_REG_ADDR + 0x008)
  440. /* Default function ID register */
  441. #define RAD1_DEFAULT_REG (RAD1_BLK_REG_ADDR + 0x00C)
  442. /* Promiscuous function ID register */
  443. #define RAD1_PROMISC_REG (RAD1_BLK_REG_ADDR + 0x010)
  444. #define RAD1_BCNQ_REG (RAD1_BLK_REG_ADDR + 0x014)
  445. /*
  446. * This register selects 1 of 8 PM Q's using
  447. * VLAN pri, for non-BCN packets without a VLAN tag
  448. */
  449. #define RAD1_DEFAULTQ_REG (RAD1_BLK_REG_ADDR + 0x018)
  450. #define RAD1_ERR_STS (RAD1_BLK_REG_ADDR + 0x01C)
  451. #define RAD1_SET_ERR_STS (RAD1_BLK_REG_ADDR + 0x020)
  452. #define RAD1_ERR_INT_EN (RAD1_BLK_REG_ADDR + 0x024)
  453. /**
  454. * TXA Block Register Address Offset from BAR0
  455. * TXA0 Range : 0x21000 - 0x213FF
  456. * TXA1 Range : 0x21400 - 0x217FF
  457. */
  458. #define TXA0_BLK_REG_ADDR 0x00021000
  459. #define TXA1_BLK_REG_ADDR 0x00021400
  460. /* TXA Registers */
  461. #define TXA0_CTRL_REG (TXA0_BLK_REG_ADDR + 0x000)
  462. #define TXA1_CTRL_REG (TXA1_BLK_REG_ADDR + 0x000)
  463. /**
  464. * TSO Sequence # Registers (RO)
  465. * Total 8 (for 8 queues)
  466. * Holds the last seq.# for TSO frames
  467. * See catapult_spec.pdf for more details
  468. */
  469. #define TXA0_TSO_TCP_SEQ_REG(_num) \
  470. (TXA0_BLK_REG_ADDR + 0x020 + ((_num) << 2))
  471. #define TXA1_TSO_TCP_SEQ_REG(_num) \
  472. (TXA1_BLK_REG_ADDR + 0x020 + ((_num) << 2))
  473. /**
  474. * TSO IP ID # Registers (RO)
  475. * Total 8 (for 8 queues)
  476. * Holds the last IP ID for TSO frames
  477. * See catapult_spec.pdf for more details
  478. */
  479. #define TXA0_TSO_IP_INFO_REG(_num) \
  480. (TXA0_BLK_REG_ADDR + 0x040 + ((_num) << 2))
  481. #define TXA1_TSO_IP_INFO_REG(_num) \
  482. (TXA1_BLK_REG_ADDR + 0x040 + ((_num) << 2))
  483. /**
  484. * RXA Block Register Address Offset from BAR0
  485. * RXA0 Range : 0x21800 - 0x21BFF
  486. * RXA1 Range : 0x21C00 - 0x21FFF
  487. */
  488. #define RXA0_BLK_REG_ADDR 0x00021800
  489. #define RXA1_BLK_REG_ADDR 0x00021C00
  490. /* RXA Registers */
  491. #define RXA0_CTL_REG (RXA0_BLK_REG_ADDR + 0x040)
  492. #define RXA1_CTL_REG (RXA1_BLK_REG_ADDR + 0x040)
  493. /**
  494. * PPLB Block Register Address Offset from BAR0
  495. * PPLB0 Range : 0x22000 - 0x223FF
  496. * PPLB1 Range : 0x22400 - 0x227FF
  497. */
  498. #define PLB0_BLK_REG_ADDR 0x00022000
  499. #define PLB1_BLK_REG_ADDR 0x00022400
  500. /**
  501. * PLB Registers
  502. * Holds RL timer used time stamps in RLT tagged frames
  503. */
  504. #define PLB0_ECM_TIMER_REG (PLB0_BLK_REG_ADDR + 0x05C)
  505. #define PLB1_ECM_TIMER_REG (PLB1_BLK_REG_ADDR + 0x05C)
  506. /* Controls the rate-limiter on each of the priority class */
  507. #define PLB0_RL_CTL (PLB0_BLK_REG_ADDR + 0x060)
  508. #define PLB1_RL_CTL (PLB1_BLK_REG_ADDR + 0x060)
  509. /**
  510. * Max byte register, total 8, 0-7
  511. * see catapult_spec.pdf for details
  512. */
  513. #define PLB0_RL_MAX_BC(_num) \
  514. (PLB0_BLK_REG_ADDR + 0x064 + ((_num) << 2))
  515. #define PLB1_RL_MAX_BC(_num) \
  516. (PLB1_BLK_REG_ADDR + 0x064 + ((_num) << 2))
  517. /**
  518. * RL Time Unit Register for priority 0-7
  519. * 4 bits per priority
  520. * (2^rl_unit)*1us is the actual time period
  521. */
  522. #define PLB0_RL_TU_PRIO (PLB0_BLK_REG_ADDR + 0x084)
  523. #define PLB1_RL_TU_PRIO (PLB1_BLK_REG_ADDR + 0x084)
  524. /**
  525. * RL byte count register,
  526. * bytes transmitted in (rl_unit*1)us time period
  527. * 1 per priority, 8 in all, 0-7.
  528. */
  529. #define PLB0_RL_BYTE_CNT(_num) \
  530. (PLB0_BLK_REG_ADDR + 0x088 + ((_num) << 2))
  531. #define PLB1_RL_BYTE_CNT(_num) \
  532. (PLB1_BLK_REG_ADDR + 0x088 + ((_num) << 2))
  533. /**
  534. * RL Min factor register
  535. * 2 bits per priority,
  536. * 4 factors possible: 1, 0.5, 0.25, 0
  537. * 2'b00 - 0; 2'b01 - 0.25; 2'b10 - 0.5; 2'b11 - 1
  538. */
  539. #define PLB0_RL_MIN_REG (PLB0_BLK_REG_ADDR + 0x0A8)
  540. #define PLB1_RL_MIN_REG (PLB1_BLK_REG_ADDR + 0x0A8)
  541. /**
  542. * RL Max factor register
  543. * 2 bits per priority,
  544. * 4 factors possible: 1, 0.5, 0.25, 0
  545. * 2'b00 - 0; 2'b01 - 0.25; 2'b10 - 0.5; 2'b11 - 1
  546. */
  547. #define PLB0_RL_MAX_REG (PLB0_BLK_REG_ADDR + 0x0AC)
  548. #define PLB1_RL_MAX_REG (PLB1_BLK_REG_ADDR + 0x0AC)
  549. /* MAC SERDES Address Paging register */
  550. #define PLB0_EMS_ADD_REG (PLB0_BLK_REG_ADDR + 0xD0)
  551. #define PLB1_EMS_ADD_REG (PLB1_BLK_REG_ADDR + 0xD0)
  552. /* LL EMS Registers */
  553. #define LL_EMS0_BLK_REG_ADDR 0x00026800
  554. #define LL_EMS1_BLK_REG_ADDR 0x00026C00
  555. /**
  556. * BPC Block Register Address Offset from BAR0
  557. * BPC0 Range : 0x23000 - 0x233FF
  558. * BPC1 Range : 0x23400 - 0x237FF
  559. */
  560. #define BPC0_BLK_REG_ADDR 0x00023000
  561. #define BPC1_BLK_REG_ADDR 0x00023400
  562. /**
  563. * PMM Block Register Address Offset from BAR0
  564. * PMM0 Range : 0x23800 - 0x23BFF
  565. * PMM1 Range : 0x23C00 - 0x23FFF
  566. */
  567. #define PMM0_BLK_REG_ADDR 0x00023800
  568. #define PMM1_BLK_REG_ADDR 0x00023C00
  569. /**
  570. * HQM Block Register Address Offset from BAR0
  571. * HQM0 Range : 0x24000 - 0x243FF
  572. * HQM1 Range : 0x24400 - 0x247FF
  573. */
  574. #define HQM0_BLK_REG_ADDR 0x00024000
  575. #define HQM1_BLK_REG_ADDR 0x00024400
  576. /**
  577. * HQM Control Register
  578. * Controls some aspects of IB
  579. * See catapult_spec.pdf for details
  580. */
  581. #define HQM0_CTL_REG (HQM0_BLK_REG_ADDR + 0x000)
  582. #define HQM1_CTL_REG (HQM1_BLK_REG_ADDR + 0x000)
  583. /**
  584. * HQM Stop Q Semaphore Registers.
  585. * Only one Queue resource can be stopped at
  586. * any given time. This register controls access
  587. * to the single stop Q resource.
  588. * See catapult_spec.pdf for details
  589. */
  590. #define HQM0_RXQ_STOP_SEM (HQM0_BLK_REG_ADDR + 0x028)
  591. #define HQM0_TXQ_STOP_SEM (HQM0_BLK_REG_ADDR + 0x02C)
  592. #define HQM1_RXQ_STOP_SEM (HQM1_BLK_REG_ADDR + 0x028)
  593. #define HQM1_TXQ_STOP_SEM (HQM1_BLK_REG_ADDR + 0x02C)
  594. /**
  595. * LUT Block Register Address Offset from BAR0
  596. * LUT0 Range : 0x25800 - 0x25BFF
  597. * LUT1 Range : 0x25C00 - 0x25FFF
  598. */
  599. #define LUT0_BLK_REG_ADDR 0x00025800
  600. #define LUT1_BLK_REG_ADDR 0x00025C00
  601. /**
  602. * LUT Registers
  603. * See catapult_spec.pdf for details
  604. */
  605. #define LUT0_ERR_STS (LUT0_BLK_REG_ADDR + 0x000)
  606. #define LUT1_ERR_STS (LUT1_BLK_REG_ADDR + 0x000)
  607. #define LUT0_SET_ERR_STS (LUT0_BLK_REG_ADDR + 0x004)
  608. #define LUT1_SET_ERR_STS (LUT1_BLK_REG_ADDR + 0x004)
  609. /**
  610. * TRC (Debug/Trace) Register Offset from BAR0
  611. * Range : 0x26000 -- 0x263FFF
  612. */
  613. #define TRC_BLK_REG_ADDR 0x00026000
  614. /**
  615. * TRC Registers
  616. * See catapult_spec.pdf for details of each
  617. */
  618. #define TRC_CTL_REG (TRC_BLK_REG_ADDR + 0x000)
  619. #define TRC_MODS_REG (TRC_BLK_REG_ADDR + 0x004)
  620. #define TRC_TRGC_REG (TRC_BLK_REG_ADDR + 0x008)
  621. #define TRC_CNT1_REG (TRC_BLK_REG_ADDR + 0x010)
  622. #define TRC_CNT2_REG (TRC_BLK_REG_ADDR + 0x014)
  623. #define TRC_NXTS_REG (TRC_BLK_REG_ADDR + 0x018)
  624. #define TRC_DIRR_REG (TRC_BLK_REG_ADDR + 0x01C)
  625. /**
  626. * TRC Trigger match filters, total 10
  627. * Determines the trigger condition
  628. */
  629. #define TRC_TRGM_REG(_num) \
  630. (TRC_BLK_REG_ADDR + 0x040 + ((_num) << 2))
  631. /**
  632. * TRC Next State filters, total 10
  633. * Determines the next state conditions
  634. */
  635. #define TRC_NXTM_REG(_num) \
  636. (TRC_BLK_REG_ADDR + 0x080 + ((_num) << 2))
  637. /**
  638. * TRC Store Match filters, total 10
  639. * Determines the store conditions
  640. */
  641. #define TRC_STRM_REG(_num) \
  642. (TRC_BLK_REG_ADDR + 0x0C0 + ((_num) << 2))
  643. /* DOORBELLS ACCESS */
  644. /**
  645. * Catapult doorbells
  646. * Each doorbell-queue set has
  647. * 1 RxQ, 1 TxQ, 2 IBs in that order
  648. * Size of each entry in 32 bytes, even though only 1 word
  649. * is used. For Non-VM case each doorbell-q set is
  650. * separated by 128 bytes, for VM case it is separated
  651. * by 4K bytes
  652. * Non VM case Range : 0x38000 - 0x39FFF
  653. * VM case Range : 0x100000 - 0x11FFFF
  654. * The range applies to both HQMs
  655. */
  656. #define HQM_DOORBELL_BLK_BASE_ADDR 0x00038000
  657. #define HQM_DOORBELL_VM_BLK_BASE_ADDR 0x00100000
  658. /* MEMORY ACCESS */
  659. /**
  660. * Catapult H/W Block Memory Access Address
  661. * To the host a memory space of 32K (page) is visible
  662. * at a time. The address range is from 0x08000 to 0x0FFFF
  663. */
  664. #define HW_BLK_HOST_MEM_ADDR 0x08000
  665. /**
  666. * Catapult LUT Memory Access Page Numbers
  667. * Range : LUT0 0xa0-0xa1
  668. * LUT1 0xa2-0xa3
  669. */
  670. #define LUT0_MEM_BLK_BASE_PG_NUM 0x000000A0
  671. #define LUT1_MEM_BLK_BASE_PG_NUM 0x000000A2
  672. /**
  673. * Catapult RxFn Database Memory Block Base Offset
  674. *
  675. * The Rx function database exists in LUT block.
  676. * In PCIe space this is accessible as a 256x32
  677. * bit block. Each entry in this database is 4
  678. * (4 byte) words. Max. entries is 64.
  679. * Address of an entry corresponding to a function
  680. * = base_addr + (function_no. * 16)
  681. */
  682. #define RX_FNDB_RAM_BASE_OFFSET 0x0000B400
  683. /**
  684. * Catapult TxFn Database Memory Block Base Offset Address
  685. *
  686. * The Tx function database exists in LUT block.
  687. * In PCIe space this is accessible as a 64x32
  688. * bit block. Each entry in this database is 1
  689. * (4 byte) word. Max. entries is 64.
  690. * Address of an entry corresponding to a function
  691. * = base_addr + (function_no. * 4)
  692. */
  693. #define TX_FNDB_RAM_BASE_OFFSET 0x0000B800
  694. /**
  695. * Catapult Unicast CAM Base Offset Address
  696. *
  697. * Exists in LUT memory space.
  698. * Shared by both the LL & FCoE driver.
  699. * Size is 256x48 bits; mapped to PCIe space
  700. * 512x32 bit blocks. For each address, bits
  701. * are written in the order : [47:32] and then
  702. * [31:0].
  703. */
  704. #define UCAST_CAM_BASE_OFFSET 0x0000A800
  705. /**
  706. * Catapult Unicast RAM Base Offset Address
  707. *
  708. * Exists in LUT memory space.
  709. * Shared by both the LL & FCoE driver.
  710. * Size is 256x9 bits.
  711. */
  712. #define UCAST_RAM_BASE_OFFSET 0x0000B000
  713. /**
  714. * Catapult Mulicast CAM Base Offset Address
  715. *
  716. * Exists in LUT memory space.
  717. * Shared by both the LL & FCoE driver.
  718. * Size is 256x48 bits; mapped to PCIe space
  719. * 512x32 bit blocks. For each address, bits
  720. * are written in the order : [47:32] and then
  721. * [31:0].
  722. */
  723. #define MCAST_CAM_BASE_OFFSET 0x0000A000
  724. /**
  725. * Catapult VLAN RAM Base Offset Address
  726. *
  727. * Exists in LUT memory space.
  728. * Size is 4096x66 bits; mapped to PCIe space as
  729. * 8192x32 bit blocks.
  730. * All the 4K entries are within the address range
  731. * 0x0000 to 0x8000, so in the first LUT page.
  732. */
  733. #define VLAN_RAM_BASE_OFFSET 0x00000000
  734. /**
  735. * Catapult Tx Stats RAM Base Offset Address
  736. *
  737. * Exists in LUT memory space.
  738. * Size is 1024x33 bits;
  739. * Each Tx function has 64 bytes of space
  740. */
  741. #define TX_STATS_RAM_BASE_OFFSET 0x00009000
  742. /**
  743. * Catapult Rx Stats RAM Base Offset Address
  744. *
  745. * Exists in LUT memory space.
  746. * Size is 1024x33 bits;
  747. * Each Rx function has 64 bytes of space
  748. */
  749. #define RX_STATS_RAM_BASE_OFFSET 0x00008000
  750. /* Catapult RXA Memory Access Page Numbers */
  751. #define RXA0_MEM_BLK_BASE_PG_NUM 0x0000008C
  752. #define RXA1_MEM_BLK_BASE_PG_NUM 0x0000008D
  753. /**
  754. * Catapult Multicast Vector Table Base Offset Address
  755. *
  756. * Exists in RxA memory space.
  757. * Organized as 512x65 bit block.
  758. * However for each entry 16 bytes allocated (power of 2)
  759. * Total size 512*16 bytes.
  760. * There are two logical divisions, 256 entries each :
  761. * a) Entries 0x00 to 0xff (256) -- Approx. MVT
  762. * Offset 0x000 to 0xFFF
  763. * b) Entries 0x100 to 0x1ff (256) -- Exact MVT
  764. * Offsets 0x1000 to 0x1FFF
  765. */
  766. #define MCAST_APPROX_MVT_BASE_OFFSET 0x00000000
  767. #define MCAST_EXACT_MVT_BASE_OFFSET 0x00001000
  768. /**
  769. * Catapult RxQ Translate Table (RIT) Base Offset Address
  770. *
  771. * Exists in RxA memory space
  772. * Total no. of entries 64
  773. * Each entry is 1 (4 byte) word.
  774. * 31:12 -- Reserved
  775. * 11:0 -- Two 6 bit RxQ Ids
  776. */
  777. #define FUNCTION_TO_RXQ_TRANSLATE 0x00002000
  778. /* Catapult RxAdm (RAD) Memory Access Page Numbers */
  779. #define RAD0_MEM_BLK_BASE_PG_NUM 0x00000086
  780. #define RAD1_MEM_BLK_BASE_PG_NUM 0x00000087
  781. /**
  782. * Catapult RSS Table Base Offset Address
  783. *
  784. * Exists in RAD memory space.
  785. * Each entry is 352 bits, but aligned on
  786. * 64 byte (512 bit) boundary. Accessed
  787. * 4 byte words, the whole entry can be
  788. * broken into 11 word accesses.
  789. */
  790. #define RSS_TABLE_BASE_OFFSET 0x00000800
  791. /**
  792. * Catapult CPQ Block Page Number
  793. * This value is written to the page number registers
  794. * to access the memory associated with the mailboxes.
  795. */
  796. #define CPQ_BLK_PG_NUM 0x00000005
  797. /**
  798. * Clarification :
  799. * LL functions are 2 & 3; can HostFn0/HostFn1
  800. * <-> LPU0/LPU1 memories be used ?
  801. */
  802. /**
  803. * Catapult HostFn0/HostFn1 to LPU0/LPU1 Mbox memory
  804. * Per catapult_spec.pdf, the offset of the mbox
  805. * memory is in the register space at an offset of 0x200
  806. */
  807. #define CPQ_BLK_REG_MBOX_ADDR (CPQ_BLK_REG_ADDR + 0x200)
  808. #define HOSTFN_LPU_MBOX (CPQ_BLK_REG_MBOX_ADDR + 0x000)
  809. /* Catapult LPU0/LPU1 to HostFn0/HostFn1 Mbox memory */
  810. #define LPU_HOSTFN_MBOX (CPQ_BLK_REG_MBOX_ADDR + 0x080)
  811. /**
  812. * Catapult HQM Block Page Number
  813. * This is written to the page number register for
  814. * the appropriate function to access the memory
  815. * associated with HQM
  816. */
  817. #define HQM0_BLK_PG_NUM 0x00000096
  818. #define HQM1_BLK_PG_NUM 0x00000097
  819. /**
  820. * Note that TxQ and RxQ entries are interlaced
  821. * the HQM memory, i.e RXQ0, TXQ0, RXQ1, TXQ1.. etc.
  822. */
  823. #define HQM_RXTX_Q_RAM_BASE_OFFSET 0x00004000
  824. /**
  825. * CQ Memory
  826. * Exists in HQM Memory space
  827. * Each entry is 16 (4 byte) words of which
  828. * only 12 words are used for configuration
  829. * Total 64 entries per HQM memory space
  830. */
  831. #define HQM_CQ_RAM_BASE_OFFSET 0x00006000
  832. /**
  833. * Interrupt Block (IB) Memory
  834. * Exists in HQM Memory space
  835. * Each entry is 8 (4 byte) words of which
  836. * only 5 words are used for configuration
  837. * Total 128 entries per HQM memory space
  838. */
  839. #define HQM_IB_RAM_BASE_OFFSET 0x00001000
  840. /**
  841. * Index Table (IT) Memory
  842. * Exists in HQM Memory space
  843. * Each entry is 1 (4 byte) word which
  844. * is used for configuration
  845. * Total 128 entries per HQM memory space
  846. */
  847. #define HQM_INDX_TBL_RAM_BASE_OFFSET 0x00002000
  848. /**
  849. * PSS Block Memory Page Number
  850. * This is written to the appropriate page number
  851. * register to access the CPU memory.
  852. * Also known as the PSS secondary memory (SMEM).
  853. * Range : 0x180 to 0x1CF
  854. * See catapult_spec.pdf for details
  855. */
  856. #define PSS_BLK_PG_NUM 0x00000180
  857. /**
  858. * Offsets of different instances of PSS SMEM
  859. * 2.5M of continuous 1T memory space : 2 blocks
  860. * of 1M each (32 pages each, page=32KB) and 4 smaller
  861. * blocks of 128K each (4 pages each, page=32KB)
  862. * PSS_LMEM_INST0 is used for firmware download
  863. */
  864. #define PSS_LMEM_INST0 0x00000000
  865. #define PSS_LMEM_INST1 0x00100000
  866. #define PSS_LMEM_INST2 0x00200000
  867. #define PSS_LMEM_INST3 0x00220000
  868. #define PSS_LMEM_INST4 0x00240000
  869. #define PSS_LMEM_INST5 0x00260000
  870. #define BNA_PCI_REG_CT_ADDRSZ (0x40000)
  871. #define BNA_GET_PAGE_NUM(_base_page, _offset) \
  872. ((_base_page) + ((_offset) >> 15))
  873. #define BNA_GET_PAGE_OFFSET(_offset) \
  874. ((_offset) & 0x7fff)
  875. #define BNA_GET_MEM_BASE_ADDR(_bar0, _base_offset) \
  876. ((_bar0) + HW_BLK_HOST_MEM_ADDR \
  877. + BNA_GET_PAGE_OFFSET((_base_offset)))
  878. #define BNA_GET_VLAN_MEM_ENTRY_ADDR(_bar0, _fn_id, _vlan_id)\
  879. (_bar0 + (HW_BLK_HOST_MEM_ADDR) \
  880. + (BNA_GET_PAGE_OFFSET(VLAN_RAM_BASE_OFFSET)) \
  881. + (((_fn_id) & 0x3f) << 9) \
  882. + (((_vlan_id) & 0xfe0) >> 3))
  883. /**
  884. *
  885. * Interrupt related bits, flags and macros
  886. *
  887. */
  888. #define __LPU02HOST_MBOX0_STATUS_BITS 0x00100000
  889. #define __LPU12HOST_MBOX0_STATUS_BITS 0x00200000
  890. #define __LPU02HOST_MBOX1_STATUS_BITS 0x00400000
  891. #define __LPU12HOST_MBOX1_STATUS_BITS 0x00800000
  892. #define __LPU02HOST_MBOX0_MASK_BITS 0x00100000
  893. #define __LPU12HOST_MBOX0_MASK_BITS 0x00200000
  894. #define __LPU02HOST_MBOX1_MASK_BITS 0x00400000
  895. #define __LPU12HOST_MBOX1_MASK_BITS 0x00800000
  896. #define __LPU2HOST_MBOX_MASK_BITS \
  897. (__LPU02HOST_MBOX0_MASK_BITS | __LPU02HOST_MBOX1_MASK_BITS | \
  898. __LPU12HOST_MBOX0_MASK_BITS | __LPU12HOST_MBOX1_MASK_BITS)
  899. #define __LPU2HOST_IB_STATUS_BITS 0x0000ffff
  900. #define BNA_IS_LPU0_MBOX_INTR(_intr_status) \
  901. ((_intr_status) & (__LPU02HOST_MBOX0_STATUS_BITS | \
  902. __LPU02HOST_MBOX1_STATUS_BITS))
  903. #define BNA_IS_LPU1_MBOX_INTR(_intr_status) \
  904. ((_intr_status) & (__LPU12HOST_MBOX0_STATUS_BITS | \
  905. __LPU12HOST_MBOX1_STATUS_BITS))
  906. #define BNA_IS_MBOX_INTR(_intr_status) \
  907. ((_intr_status) & \
  908. (__LPU02HOST_MBOX0_STATUS_BITS | \
  909. __LPU02HOST_MBOX1_STATUS_BITS | \
  910. __LPU12HOST_MBOX0_STATUS_BITS | \
  911. __LPU12HOST_MBOX1_STATUS_BITS))
  912. #define __EMC_ERROR_STATUS_BITS 0x00010000
  913. #define __LPU0_ERROR_STATUS_BITS 0x00020000
  914. #define __LPU1_ERROR_STATUS_BITS 0x00040000
  915. #define __PSS_ERROR_STATUS_BITS 0x00080000
  916. #define __HALT_STATUS_BITS 0x01000000
  917. #define __EMC_ERROR_MASK_BITS 0x00010000
  918. #define __LPU0_ERROR_MASK_BITS 0x00020000
  919. #define __LPU1_ERROR_MASK_BITS 0x00040000
  920. #define __PSS_ERROR_MASK_BITS 0x00080000
  921. #define __HALT_MASK_BITS 0x01000000
  922. #define __ERROR_MASK_BITS \
  923. (__EMC_ERROR_MASK_BITS | __LPU0_ERROR_MASK_BITS | \
  924. __LPU1_ERROR_MASK_BITS | __PSS_ERROR_MASK_BITS | \
  925. __HALT_MASK_BITS)
  926. #define BNA_IS_ERR_INTR(_intr_status) \
  927. ((_intr_status) & \
  928. (__EMC_ERROR_STATUS_BITS | \
  929. __LPU0_ERROR_STATUS_BITS | \
  930. __LPU1_ERROR_STATUS_BITS | \
  931. __PSS_ERROR_STATUS_BITS | \
  932. __HALT_STATUS_BITS))
  933. #define BNA_IS_MBOX_ERR_INTR(_intr_status) \
  934. (BNA_IS_MBOX_INTR((_intr_status)) | \
  935. BNA_IS_ERR_INTR((_intr_status)))
  936. #define BNA_IS_INTX_DATA_INTR(_intr_status) \
  937. ((_intr_status) & __LPU2HOST_IB_STATUS_BITS)
  938. #define BNA_INTR_STATUS_MBOX_CLR(_intr_status) \
  939. do { \
  940. (_intr_status) &= ~(__LPU02HOST_MBOX0_STATUS_BITS | \
  941. __LPU02HOST_MBOX1_STATUS_BITS | \
  942. __LPU12HOST_MBOX0_STATUS_BITS | \
  943. __LPU12HOST_MBOX1_STATUS_BITS); \
  944. } while (0)
  945. #define BNA_INTR_STATUS_ERR_CLR(_intr_status) \
  946. do { \
  947. (_intr_status) &= ~(__EMC_ERROR_STATUS_BITS | \
  948. __LPU0_ERROR_STATUS_BITS | \
  949. __LPU1_ERROR_STATUS_BITS | \
  950. __PSS_ERROR_STATUS_BITS | \
  951. __HALT_STATUS_BITS); \
  952. } while (0)
  953. #define bna_intx_disable(_bna, _cur_mask) \
  954. { \
  955. (_cur_mask) = readl((_bna)->regs.fn_int_mask);\
  956. writel(0xffffffff, (_bna)->regs.fn_int_mask);\
  957. }
  958. #define bna_intx_enable(bna, new_mask) \
  959. writel((new_mask), (bna)->regs.fn_int_mask)
  960. #define bna_mbox_intr_disable(bna) \
  961. writel((readl((bna)->regs.fn_int_mask) | \
  962. (__LPU2HOST_MBOX_MASK_BITS | __ERROR_MASK_BITS)), \
  963. (bna)->regs.fn_int_mask)
  964. #define bna_mbox_intr_enable(bna) \
  965. writel((readl((bna)->regs.fn_int_mask) & \
  966. ~(__LPU2HOST_MBOX_MASK_BITS | __ERROR_MASK_BITS)), \
  967. (bna)->regs.fn_int_mask)
  968. #define bna_intr_status_get(_bna, _status) \
  969. { \
  970. (_status) = readl((_bna)->regs.fn_int_status); \
  971. if ((_status)) { \
  972. writel((_status) & ~(__LPU02HOST_MBOX0_STATUS_BITS |\
  973. __LPU02HOST_MBOX1_STATUS_BITS |\
  974. __LPU12HOST_MBOX0_STATUS_BITS |\
  975. __LPU12HOST_MBOX1_STATUS_BITS), \
  976. (_bna)->regs.fn_int_status);\
  977. } \
  978. }
  979. #define bna_intr_status_get_no_clr(_bna, _status) \
  980. (_status) = readl((_bna)->regs.fn_int_status)
  981. #define bna_intr_mask_get(bna, mask) \
  982. (*mask) = readl((bna)->regs.fn_int_mask)
  983. #define bna_intr_ack(bna, intr_bmap) \
  984. writel((intr_bmap), (bna)->regs.fn_int_status)
  985. #define bna_ib_intx_disable(bna, ib_id) \
  986. writel(readl((bna)->regs.fn_int_mask) | \
  987. (1 << (ib_id)), \
  988. (bna)->regs.fn_int_mask)
  989. #define bna_ib_intx_enable(bna, ib_id) \
  990. writel(readl((bna)->regs.fn_int_mask) & \
  991. ~(1 << (ib_id)), \
  992. (bna)->regs.fn_int_mask)
  993. #define bna_mbox_msix_idx_set(_device) \
  994. do {\
  995. writel(((_device)->vector & 0x000001FF), \
  996. (_device)->bna->pcidev.pci_bar_kva + \
  997. reg_offset[(_device)->bna->pcidev.pci_func].msix_idx);\
  998. } while (0)
  999. /**
  1000. *
  1001. * TxQ, RxQ, CQ related bits, offsets, macros
  1002. *
  1003. */
  1004. #define BNA_Q_IDLE_STATE 0x00008001
  1005. #define BNA_GET_DOORBELL_BASE_ADDR(_bar0) \
  1006. ((_bar0) + HQM_DOORBELL_BLK_BASE_ADDR)
  1007. #define BNA_GET_DOORBELL_ENTRY_OFFSET(_entry) \
  1008. ((HQM_DOORBELL_BLK_BASE_ADDR) \
  1009. + (_entry << 7))
  1010. #define BNA_DOORBELL_IB_INT_ACK(_timeout, _events) \
  1011. (0x80000000 | ((_timeout) << 16) | (_events))
  1012. #define BNA_DOORBELL_IB_INT_DISABLE (0x40000000)
  1013. /* TxQ Entry Opcodes */
  1014. #define BNA_TXQ_WI_SEND (0x402) /* Single Frame Transmission */
  1015. #define BNA_TXQ_WI_SEND_LSO (0x403) /* Multi-Frame Transmission */
  1016. #define BNA_TXQ_WI_EXTENSION (0x104) /* Extension WI */
  1017. /* TxQ Entry Control Flags */
  1018. #define BNA_TXQ_WI_CF_FCOE_CRC (1 << 8)
  1019. #define BNA_TXQ_WI_CF_IPID_MODE (1 << 5)
  1020. #define BNA_TXQ_WI_CF_INS_PRIO (1 << 4)
  1021. #define BNA_TXQ_WI_CF_INS_VLAN (1 << 3)
  1022. #define BNA_TXQ_WI_CF_UDP_CKSUM (1 << 2)
  1023. #define BNA_TXQ_WI_CF_TCP_CKSUM (1 << 1)
  1024. #define BNA_TXQ_WI_CF_IP_CKSUM (1 << 0)
  1025. #define BNA_TXQ_WI_L4_HDR_N_OFFSET(_hdr_size, _offset) \
  1026. (((_hdr_size) << 10) | ((_offset) & 0x3FF))
  1027. /*
  1028. * Completion Q defines
  1029. */
  1030. /* CQ Entry Flags */
  1031. #define BNA_CQ_EF_MAC_ERROR (1 << 0)
  1032. #define BNA_CQ_EF_FCS_ERROR (1 << 1)
  1033. #define BNA_CQ_EF_TOO_LONG (1 << 2)
  1034. #define BNA_CQ_EF_FC_CRC_OK (1 << 3)
  1035. #define BNA_CQ_EF_RSVD1 (1 << 4)
  1036. #define BNA_CQ_EF_L4_CKSUM_OK (1 << 5)
  1037. #define BNA_CQ_EF_L3_CKSUM_OK (1 << 6)
  1038. #define BNA_CQ_EF_HDS_HEADER (1 << 7)
  1039. #define BNA_CQ_EF_UDP (1 << 8)
  1040. #define BNA_CQ_EF_TCP (1 << 9)
  1041. #define BNA_CQ_EF_IP_OPTIONS (1 << 10)
  1042. #define BNA_CQ_EF_IPV6 (1 << 11)
  1043. #define BNA_CQ_EF_IPV4 (1 << 12)
  1044. #define BNA_CQ_EF_VLAN (1 << 13)
  1045. #define BNA_CQ_EF_RSS (1 << 14)
  1046. #define BNA_CQ_EF_RSVD2 (1 << 15)
  1047. #define BNA_CQ_EF_MCAST_MATCH (1 << 16)
  1048. #define BNA_CQ_EF_MCAST (1 << 17)
  1049. #define BNA_CQ_EF_BCAST (1 << 18)
  1050. #define BNA_CQ_EF_REMOTE (1 << 19)
  1051. #define BNA_CQ_EF_LOCAL (1 << 20)
  1052. /**
  1053. *
  1054. * Data structures
  1055. *
  1056. */
  1057. enum txf_flags {
  1058. BFI_TXF_CF_ENABLE = 1 << 0,
  1059. BFI_TXF_CF_VLAN_FILTER = 1 << 8,
  1060. BFI_TXF_CF_VLAN_ADMIT = 1 << 9,
  1061. BFI_TXF_CF_VLAN_INSERT = 1 << 10,
  1062. BFI_TXF_CF_RSVD1 = 1 << 11,
  1063. BFI_TXF_CF_MAC_SA_CHECK = 1 << 12,
  1064. BFI_TXF_CF_VLAN_WI_BASED = 1 << 13,
  1065. BFI_TXF_CF_VSWITCH_MCAST = 1 << 14,
  1066. BFI_TXF_CF_VSWITCH_UCAST = 1 << 15,
  1067. BFI_TXF_CF_RSVD2 = 0x7F << 1
  1068. };
  1069. enum ib_flags {
  1070. BFI_IB_CF_MASTER_ENABLE = (1 << 0),
  1071. BFI_IB_CF_MSIX_MODE = (1 << 1),
  1072. BFI_IB_CF_COALESCING_MODE = (1 << 2),
  1073. BFI_IB_CF_INTER_PKT_ENABLE = (1 << 3),
  1074. BFI_IB_CF_INT_ENABLE = (1 << 4),
  1075. BFI_IB_CF_INTER_PKT_DMA = (1 << 5),
  1076. BFI_IB_CF_ACK_PENDING = (1 << 6),
  1077. BFI_IB_CF_RESERVED1 = (1 << 7)
  1078. };
  1079. enum rss_hash_type {
  1080. BFI_RSS_T_V4_TCP = (1 << 11),
  1081. BFI_RSS_T_V4_IP = (1 << 10),
  1082. BFI_RSS_T_V6_TCP = (1 << 9),
  1083. BFI_RSS_T_V6_IP = (1 << 8)
  1084. };
  1085. enum hds_header_type {
  1086. BNA_HDS_T_V4_TCP = (1 << 11),
  1087. BNA_HDS_T_V4_UDP = (1 << 10),
  1088. BNA_HDS_T_V6_TCP = (1 << 9),
  1089. BNA_HDS_T_V6_UDP = (1 << 8),
  1090. BNA_HDS_FORCED = (1 << 7),
  1091. };
  1092. enum rxf_flags {
  1093. BNA_RXF_CF_SM_LG_RXQ = (1 << 15),
  1094. BNA_RXF_CF_DEFAULT_VLAN = (1 << 14),
  1095. BNA_RXF_CF_DEFAULT_FUNCTION_ENABLE = (1 << 13),
  1096. BNA_RXF_CF_VLAN_STRIP = (1 << 12),
  1097. BNA_RXF_CF_RSS_ENABLE = (1 << 8)
  1098. };
  1099. struct bna_chip_regs_offset {
  1100. u32 page_addr;
  1101. u32 fn_int_status;
  1102. u32 fn_int_mask;
  1103. u32 msix_idx;
  1104. };
  1105. struct bna_chip_regs {
  1106. void __iomem *page_addr;
  1107. void __iomem *fn_int_status;
  1108. void __iomem *fn_int_mask;
  1109. };
  1110. struct bna_txq_mem {
  1111. u32 pg_tbl_addr_lo;
  1112. u32 pg_tbl_addr_hi;
  1113. u32 cur_q_entry_lo;
  1114. u32 cur_q_entry_hi;
  1115. u32 reserved1;
  1116. u32 reserved2;
  1117. u32 pg_cnt_n_prd_ptr; /* 31:16->total page count */
  1118. /* 15:0 ->producer pointer (index?) */
  1119. u32 entry_n_pg_size; /* 31:16->entry size */
  1120. /* 15:0 ->page size */
  1121. u32 int_blk_n_cns_ptr; /* 31:24->Int Blk Id; */
  1122. /* 23:16->Int Blk Offset */
  1123. /* 15:0 ->consumer pointer(index?) */
  1124. u32 cns_ptr2_n_q_state; /* 31:16->cons. ptr 2; 15:0-> Q state */
  1125. u32 nxt_qid_n_fid_n_pri; /* 17:10->next */
  1126. /* QId;9:3->FID;2:0->Priority */
  1127. u32 wvc_n_cquota_n_rquota; /* 31:24->WI Vector Count; */
  1128. /* 23:12->Cfg Quota; */
  1129. /* 11:0 ->Run Quota */
  1130. u32 reserved3[4];
  1131. };
  1132. struct bna_rxq_mem {
  1133. u32 pg_tbl_addr_lo;
  1134. u32 pg_tbl_addr_hi;
  1135. u32 cur_q_entry_lo;
  1136. u32 cur_q_entry_hi;
  1137. u32 reserved1;
  1138. u32 reserved2;
  1139. u32 pg_cnt_n_prd_ptr; /* 31:16->total page count */
  1140. /* 15:0 ->producer pointer (index?) */
  1141. u32 entry_n_pg_size; /* 31:16->entry size */
  1142. /* 15:0 ->page size */
  1143. u32 sg_n_cq_n_cns_ptr; /* 31:28->reserved; 27:24->sg count */
  1144. /* 23:16->CQ; */
  1145. /* 15:0->consumer pointer(index?) */
  1146. u32 buf_sz_n_q_state; /* 31:16->buffer size; 15:0-> Q state */
  1147. u32 next_qid; /* 17:10->next QId */
  1148. u32 reserved3;
  1149. u32 reserved4[4];
  1150. };
  1151. struct bna_rxtx_q_mem {
  1152. struct bna_rxq_mem rxq;
  1153. struct bna_txq_mem txq;
  1154. };
  1155. struct bna_cq_mem {
  1156. u32 pg_tbl_addr_lo;
  1157. u32 pg_tbl_addr_hi;
  1158. u32 cur_q_entry_lo;
  1159. u32 cur_q_entry_hi;
  1160. u32 reserved1;
  1161. u32 reserved2;
  1162. u32 pg_cnt_n_prd_ptr; /* 31:16->total page count */
  1163. /* 15:0 ->producer pointer (index?) */
  1164. u32 entry_n_pg_size; /* 31:16->entry size */
  1165. /* 15:0 ->page size */
  1166. u32 int_blk_n_cns_ptr; /* 31:24->Int Blk Id; */
  1167. /* 23:16->Int Blk Offset */
  1168. /* 15:0 ->consumer pointer(index?) */
  1169. u32 q_state; /* 31:16->reserved; 15:0-> Q state */
  1170. u32 reserved3[2];
  1171. u32 reserved4[4];
  1172. };
  1173. struct bna_ib_blk_mem {
  1174. u32 host_addr_lo;
  1175. u32 host_addr_hi;
  1176. u32 clsc_n_ctrl_n_msix; /* 31:24->coalescing; */
  1177. /* 23:16->coalescing cfg; */
  1178. /* 15:8 ->control; */
  1179. /* 7:0 ->msix; */
  1180. u32 ipkt_n_ent_n_idxof;
  1181. u32 ipkt_cnt_cfg_n_unacked;
  1182. u32 reserved[3];
  1183. };
  1184. struct bna_idx_tbl_mem {
  1185. u32 idx; /* !< 31:16->res;15:0->idx; */
  1186. };
  1187. struct bna_doorbell_qset {
  1188. u32 rxq[0x20 >> 2];
  1189. u32 txq[0x20 >> 2];
  1190. u32 ib0[0x20 >> 2];
  1191. u32 ib1[0x20 >> 2];
  1192. };
  1193. struct bna_rx_fndb_ram {
  1194. u32 rss_prop;
  1195. u32 size_routing_props;
  1196. u32 rit_hds_mcastq;
  1197. u32 control_flags;
  1198. };
  1199. struct bna_tx_fndb_ram {
  1200. u32 vlan_n_ctrl_flags;
  1201. };
  1202. /**
  1203. * @brief
  1204. * Structure which maps to RxFn Indirection Table (RIT)
  1205. * Size : 1 word
  1206. * See catapult_spec.pdf, RxA for details
  1207. */
  1208. struct bna_rit_mem {
  1209. u32 rxq_ids; /* !< 31:12->res;11:0->two 6 bit RxQ Ids */
  1210. };
  1211. /**
  1212. * @brief
  1213. * Structure which maps to RSS Table entry
  1214. * Size : 16 words
  1215. * See catapult_spec.pdf, RAD for details
  1216. */
  1217. struct bna_rss_mem {
  1218. /*
  1219. * 31:12-> res
  1220. * 11:8 -> protocol type
  1221. * 7:0 -> hash index
  1222. */
  1223. u32 type_n_hash;
  1224. u32 hash_key[10]; /* !< 40 byte Toeplitz hash key */
  1225. u32 reserved[5];
  1226. };
  1227. /* TxQ Vector (a.k.a. Tx-Buffer Descriptor) */
  1228. struct bna_dma_addr {
  1229. u32 msb;
  1230. u32 lsb;
  1231. };
  1232. struct bna_txq_wi_vector {
  1233. u16 reserved;
  1234. u16 length; /* Only 14 LSB are valid */
  1235. struct bna_dma_addr host_addr; /* Tx-Buf DMA addr */
  1236. };
  1237. typedef u16 bna_txq_wi_opcode_t;
  1238. typedef u16 bna_txq_wi_ctrl_flag_t;
  1239. /**
  1240. * TxQ Entry Structure
  1241. *
  1242. * BEWARE: Load values into this structure with correct endianess.
  1243. */
  1244. struct bna_txq_entry {
  1245. union {
  1246. struct {
  1247. u8 reserved;
  1248. u8 num_vectors; /* number of vectors present */
  1249. bna_txq_wi_opcode_t opcode; /* Either */
  1250. /* BNA_TXQ_WI_SEND or */
  1251. /* BNA_TXQ_WI_SEND_LSO */
  1252. bna_txq_wi_ctrl_flag_t flags; /* OR of all the flags */
  1253. u16 l4_hdr_size_n_offset;
  1254. u16 vlan_tag;
  1255. u16 lso_mss; /* Only 14 LSB are valid */
  1256. u32 frame_length; /* Only 24 LSB are valid */
  1257. } wi;
  1258. struct {
  1259. u16 reserved;
  1260. bna_txq_wi_opcode_t opcode; /* Must be */
  1261. /* BNA_TXQ_WI_EXTENSION */
  1262. u32 reserved2[3]; /* Place holder for */
  1263. /* removed vector (12 bytes) */
  1264. } wi_ext;
  1265. } hdr;
  1266. struct bna_txq_wi_vector vector[4];
  1267. };
  1268. #define wi_hdr hdr.wi
  1269. #define wi_ext_hdr hdr.wi_ext
  1270. /* RxQ Entry Structure */
  1271. struct bna_rxq_entry { /* Rx-Buffer */
  1272. struct bna_dma_addr host_addr; /* Rx-Buffer DMA address */
  1273. };
  1274. typedef u32 bna_cq_e_flag_t;
  1275. /* CQ Entry Structure */
  1276. struct bna_cq_entry {
  1277. bna_cq_e_flag_t flags;
  1278. u16 vlan_tag;
  1279. u16 length;
  1280. u32 rss_hash;
  1281. u8 valid;
  1282. u8 reserved1;
  1283. u8 reserved2;
  1284. u8 rxq_id;
  1285. };
  1286. #endif /* __BNA_HW_H__ */