bna_hw.h 44 KB

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