cassini.h 123 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915
  1. /* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $
  2. * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver.
  3. *
  4. * Copyright (C) 2004 Sun Microsystems Inc.
  5. * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com)
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  20. * 02111-1307, USA.
  21. *
  22. * vendor id: 0x108E (Sun Microsystems, Inc.)
  23. * device id: 0xabba (Cassini)
  24. * revision ids: 0x01 = Cassini
  25. * 0x02 = Cassini rev 2
  26. * 0x10 = Cassini+
  27. * 0x11 = Cassini+ 0.2u
  28. *
  29. * vendor id: 0x100b (National Semiconductor)
  30. * device id: 0x0035 (DP83065/Saturn)
  31. * revision ids: 0x30 = Saturn B2
  32. *
  33. * rings are all offset from 0.
  34. *
  35. * there are two clock domains:
  36. * PCI: 33/66MHz clock
  37. * chip: 125MHz clock
  38. */
  39. #ifndef _CASSINI_H
  40. #define _CASSINI_H
  41. /* cassini register map: 2M memory mapped in 32-bit memory space accessible as
  42. * 32-bit words. there is no i/o port access. REG_ addresses are
  43. * shared between cassini and cassini+. REG_PLUS_ addresses only
  44. * appear in cassini+. REG_MINUS_ addresses only appear in cassini.
  45. */
  46. #define CAS_ID_REV2 0x02
  47. #define CAS_ID_REVPLUS 0x10
  48. #define CAS_ID_REVPLUS02u 0x11
  49. #define CAS_ID_REVSATURNB2 0x30
  50. /** global resources **/
  51. /* this register sets the weights for the weighted round robin arbiter. e.g.,
  52. * if rx weight == 1 and tx weight == 0, rx == 2x tx transfer credit
  53. * for its next turn to access the pci bus.
  54. * map: 0x0 = x1, 0x1 = x2, 0x2 = x4, 0x3 = x8
  55. * DEFAULT: 0x0, SIZE: 5 bits
  56. */
  57. #define REG_CAWR 0x0004 /* core arbitration weight */
  58. #define CAWR_RX_DMA_WEIGHT_SHIFT 0
  59. #define CAWR_RX_DMA_WEIGHT_MASK 0x03 /* [0:1] */
  60. #define CAWR_TX_DMA_WEIGHT_SHIFT 2
  61. #define CAWR_TX_DMA_WEIGHT_MASK 0x0C /* [3:2] */
  62. #define CAWR_RR_DIS 0x10 /* [4] */
  63. /* if enabled, BIM can send bursts across PCI bus > cacheline size. burst
  64. * sizes determined by length of packet or descriptor transfer and the
  65. * max length allowed by the target.
  66. * DEFAULT: 0x0, SIZE: 1 bit
  67. */
  68. #define REG_INF_BURST 0x0008 /* infinite burst enable reg */
  69. #define INF_BURST_EN 0x1 /* enable */
  70. /* top level interrupts [0-9] are auto-cleared to 0 when the status
  71. * register is read. second level interrupts [13 - 18] are cleared at
  72. * the source. tx completion register 3 is replicated in [19 - 31]
  73. * DEFAULT: 0x00000000, SIZE: 29 bits
  74. */
  75. #define REG_INTR_STATUS 0x000C /* interrupt status register */
  76. #define INTR_TX_INTME 0x00000001 /* frame w/ INT ME desc bit set
  77. xferred from host queue to
  78. TX FIFO */
  79. #define INTR_TX_ALL 0x00000002 /* all xmit frames xferred into
  80. TX FIFO. i.e.,
  81. TX Kick == TX complete. if
  82. PACED_MODE set, then TX FIFO
  83. also empty */
  84. #define INTR_TX_DONE 0x00000004 /* any frame xferred into tx
  85. FIFO */
  86. #define INTR_TX_TAG_ERROR 0x00000008 /* TX FIFO tag framing
  87. corrupted. FATAL ERROR */
  88. #define INTR_RX_DONE 0x00000010 /* at least 1 frame xferred
  89. from RX FIFO to host mem.
  90. RX completion reg updated.
  91. may be delayed by recv
  92. intr blanking. */
  93. #define INTR_RX_BUF_UNAVAIL 0x00000020 /* no more receive buffers.
  94. RX Kick == RX complete */
  95. #define INTR_RX_TAG_ERROR 0x00000040 /* RX FIFO tag framing
  96. corrupted. FATAL ERROR */
  97. #define INTR_RX_COMP_FULL 0x00000080 /* no more room in completion
  98. ring to post descriptors.
  99. RX complete head incr to
  100. almost reach RX complete
  101. tail */
  102. #define INTR_RX_BUF_AE 0x00000100 /* less than the
  103. programmable threshold #
  104. of free descr avail for
  105. hw use */
  106. #define INTR_RX_COMP_AF 0x00000200 /* less than the
  107. programmable threshold #
  108. of descr spaces for hw
  109. use in completion descr
  110. ring */
  111. #define INTR_RX_LEN_MISMATCH 0x00000400 /* len field from MAC !=
  112. len of non-reassembly pkt
  113. from fifo during DMA or
  114. header parser provides TCP
  115. header and payload size >
  116. MAC packet size.
  117. FATAL ERROR */
  118. #define INTR_SUMMARY 0x00001000 /* summary interrupt bit. this
  119. bit will be set if an interrupt
  120. generated on the pci bus. useful
  121. when driver is polling for
  122. interrupts */
  123. #define INTR_PCS_STATUS 0x00002000 /* PCS interrupt status register */
  124. #define INTR_TX_MAC_STATUS 0x00004000 /* TX MAC status register has at
  125. least 1 unmasked interrupt set */
  126. #define INTR_RX_MAC_STATUS 0x00008000 /* RX MAC status register has at
  127. least 1 unmasked interrupt set */
  128. #define INTR_MAC_CTRL_STATUS 0x00010000 /* MAC control status register has
  129. at least 1 unmasked interrupt
  130. set */
  131. #define INTR_MIF_STATUS 0x00020000 /* MIF status register has at least
  132. 1 unmasked interrupt set */
  133. #define INTR_PCI_ERROR_STATUS 0x00040000 /* PCI error status register in the
  134. BIF has at least 1 unmasked
  135. interrupt set */
  136. #define INTR_TX_COMP_3_MASK 0xFFF80000 /* mask for TX completion
  137. 3 reg data */
  138. #define INTR_TX_COMP_3_SHIFT 19
  139. #define INTR_ERROR_MASK (INTR_MIF_STATUS | INTR_PCI_ERROR_STATUS | \
  140. INTR_PCS_STATUS | INTR_RX_LEN_MISMATCH | \
  141. INTR_TX_MAC_STATUS | INTR_RX_MAC_STATUS | \
  142. INTR_TX_TAG_ERROR | INTR_RX_TAG_ERROR | \
  143. INTR_MAC_CTRL_STATUS)
  144. /* determines which status events will cause an interrupt. layout same
  145. * as REG_INTR_STATUS.
  146. * DEFAULT: 0xFFFFFFFF, SIZE: 16 bits
  147. */
  148. #define REG_INTR_MASK 0x0010 /* Interrupt mask */
  149. /* top level interrupt bits that are cleared during read of REG_INTR_STATUS_ALIAS.
  150. * useful when driver is polling for interrupts. layout same as REG_INTR_MASK.
  151. * DEFAULT: 0x00000000, SIZE: 12 bits
  152. */
  153. #define REG_ALIAS_CLEAR 0x0014 /* alias clear mask
  154. (used w/ status alias) */
  155. /* same as REG_INTR_STATUS except that only bits cleared are those selected by
  156. * REG_ALIAS_CLEAR
  157. * DEFAULT: 0x00000000, SIZE: 29 bits
  158. */
  159. #define REG_INTR_STATUS_ALIAS 0x001C /* interrupt status alias
  160. (selective clear) */
  161. /* DEFAULT: 0x0, SIZE: 3 bits */
  162. #define REG_PCI_ERR_STATUS 0x1000 /* PCI error status */
  163. #define PCI_ERR_BADACK 0x01 /* reserved in Cassini+.
  164. set if no ACK64# during ABS64 cycle
  165. in Cassini. */
  166. #define PCI_ERR_DTRTO 0x02 /* delayed xaction timeout. set if
  167. no read retry after 2^15 clocks */
  168. #define PCI_ERR_OTHER 0x04 /* other PCI errors */
  169. #define PCI_ERR_BIM_DMA_WRITE 0x08 /* BIM received 0 count DMA write req.
  170. unused in Cassini. */
  171. #define PCI_ERR_BIM_DMA_READ 0x10 /* BIM received 0 count DMA read req.
  172. unused in Cassini. */
  173. #define PCI_ERR_BIM_DMA_TIMEOUT 0x20 /* BIM received 255 retries during
  174. DMA. unused in cassini. */
  175. /* mask for PCI status events that will set PCI_ERR_STATUS. if cleared, event
  176. * causes an interrupt to be generated.
  177. * DEFAULT: 0x7, SIZE: 3 bits
  178. */
  179. #define REG_PCI_ERR_STATUS_MASK 0x1004 /* PCI Error status mask */
  180. /* used to configure PCI related parameters that are not in PCI config space.
  181. * DEFAULT: 0bxx000, SIZE: 5 bits
  182. */
  183. #define REG_BIM_CFG 0x1008 /* BIM Configuration */
  184. #define BIM_CFG_RESERVED0 0x001 /* reserved */
  185. #define BIM_CFG_RESERVED1 0x002 /* reserved */
  186. #define BIM_CFG_64BIT_DISABLE 0x004 /* disable 64-bit mode */
  187. #define BIM_CFG_66MHZ 0x008 /* (ro) 1 = 66MHz, 0 = < 66MHz */
  188. #define BIM_CFG_32BIT 0x010 /* (ro) 1 = 32-bit slot, 0 = 64-bit */
  189. #define BIM_CFG_DPAR_INTR_ENABLE 0x020 /* detected parity err enable */
  190. #define BIM_CFG_RMA_INTR_ENABLE 0x040 /* master abort intr enable */
  191. #define BIM_CFG_RTA_INTR_ENABLE 0x080 /* target abort intr enable */
  192. #define BIM_CFG_RESERVED2 0x100 /* reserved */
  193. #define BIM_CFG_BIM_DISABLE 0x200 /* stop BIM DMA. use before global
  194. reset. reserved in Cassini. */
  195. #define BIM_CFG_BIM_STATUS 0x400 /* (ro) 1 = BIM DMA suspended.
  196. reserved in Cassini. */
  197. #define BIM_CFG_PERROR_BLOCK 0x800 /* block PERR# to pci bus. def: 0.
  198. reserved in Cassini. */
  199. /* DEFAULT: 0x00000000, SIZE: 32 bits */
  200. #define REG_BIM_DIAG 0x100C /* BIM Diagnostic */
  201. #define BIM_DIAG_MSTR_SM_MASK 0x3FFFFF00 /* PCI master controller state
  202. machine bits [21:0] */
  203. #define BIM_DIAG_BRST_SM_MASK 0x7F /* PCI burst controller state
  204. machine bits [6:0] */
  205. /* writing to SW_RESET_TX and SW_RESET_RX will issue a global
  206. * reset. poll until TX and RX read back as 0's for completion.
  207. */
  208. #define REG_SW_RESET 0x1010 /* Software reset */
  209. #define SW_RESET_TX 0x00000001 /* reset TX DMA engine. poll until
  210. cleared to 0. */
  211. #define SW_RESET_RX 0x00000002 /* reset RX DMA engine. poll until
  212. cleared to 0. */
  213. #define SW_RESET_RSTOUT 0x00000004 /* force RSTOUT# pin active (low).
  214. resets PHY and anything else
  215. connected to RSTOUT#. RSTOUT#
  216. is also activated by local PCI
  217. reset when hot-swap is being
  218. done. */
  219. #define SW_RESET_BLOCK_PCS_SLINK 0x00000008 /* if a global reset is done with
  220. this bit set, PCS and SLINK
  221. modules won't be reset.
  222. i.e., link won't drop. */
  223. #define SW_RESET_BREQ_SM_MASK 0x00007F00 /* breq state machine [6:0] */
  224. #define SW_RESET_PCIARB_SM_MASK 0x00070000 /* pci arbitration state bits:
  225. 0b000: ARB_IDLE1
  226. 0b001: ARB_IDLE2
  227. 0b010: ARB_WB_ACK
  228. 0b011: ARB_WB_WAT
  229. 0b100: ARB_RB_ACK
  230. 0b101: ARB_RB_WAT
  231. 0b110: ARB_RB_END
  232. 0b111: ARB_WB_END */
  233. #define SW_RESET_RDPCI_SM_MASK 0x00300000 /* read pci state bits:
  234. 0b00: RD_PCI_WAT
  235. 0b01: RD_PCI_RDY
  236. 0b11: RD_PCI_ACK */
  237. #define SW_RESET_RDARB_SM_MASK 0x00C00000 /* read arbitration state bits:
  238. 0b00: AD_IDL_RX
  239. 0b01: AD_ACK_RX
  240. 0b10: AD_ACK_TX
  241. 0b11: AD_IDL_TX */
  242. #define SW_RESET_WRPCI_SM_MASK 0x06000000 /* write pci state bits
  243. 0b00: WR_PCI_WAT
  244. 0b01: WR_PCI_RDY
  245. 0b11: WR_PCI_ACK */
  246. #define SW_RESET_WRARB_SM_MASK 0x38000000 /* write arbitration state bits:
  247. 0b000: ARB_IDLE1
  248. 0b001: ARB_IDLE2
  249. 0b010: ARB_TX_ACK
  250. 0b011: ARB_TX_WAT
  251. 0b100: ARB_RX_ACK
  252. 0b110: ARB_RX_WAT */
  253. /* Cassini only. 64-bit register used to check PCI datapath. when read,
  254. * value written has both lower and upper 32-bit halves rotated to the right
  255. * one bit position. e.g., FFFFFFFF FFFFFFFF -> 7FFFFFFF 7FFFFFFF
  256. */
  257. #define REG_MINUS_BIM_DATAPATH_TEST 0x1018 /* Cassini: BIM datapath test
  258. Cassini+: reserved */
  259. /* output enables are provided for each device's chip select and for the rest
  260. * of the outputs from cassini to its local bus devices. two sw programmable
  261. * bits are connected to general purpus control/status bits.
  262. * DEFAULT: 0x7
  263. */
  264. #define REG_BIM_LOCAL_DEV_EN 0x1020 /* BIM local device
  265. output EN. default: 0x7 */
  266. #define BIM_LOCAL_DEV_PAD 0x01 /* address bus, RW signal, and
  267. OE signal output enable on the
  268. local bus interface. these
  269. are shared between both local
  270. bus devices. tristate when 0. */
  271. #define BIM_LOCAL_DEV_PROM 0x02 /* PROM chip select */
  272. #define BIM_LOCAL_DEV_EXT 0x04 /* secondary local bus device chip
  273. select output enable */
  274. #define BIM_LOCAL_DEV_SOFT_0 0x08 /* sw programmable ctrl bit 0 */
  275. #define BIM_LOCAL_DEV_SOFT_1 0x10 /* sw programmable ctrl bit 1 */
  276. #define BIM_LOCAL_DEV_HW_RESET 0x20 /* internal hw reset. Cassini+ only. */
  277. /* access 24 entry BIM read and write buffers. put address in REG_BIM_BUFFER_ADDR
  278. * and read/write from/to it REG_BIM_BUFFER_DATA_LOW and _DATA_HI.
  279. * _DATA_HI should be the last access of the sequence.
  280. * DEFAULT: undefined
  281. */
  282. #define REG_BIM_BUFFER_ADDR 0x1024 /* BIM buffer address. for
  283. purposes. */
  284. #define BIM_BUFFER_ADDR_MASK 0x3F /* index (0 - 23) of buffer */
  285. #define BIM_BUFFER_WR_SELECT 0x40 /* write buffer access = 1
  286. read buffer access = 0 */
  287. /* DEFAULT: undefined */
  288. #define REG_BIM_BUFFER_DATA_LOW 0x1028 /* BIM buffer data low */
  289. #define REG_BIM_BUFFER_DATA_HI 0x102C /* BIM buffer data high */
  290. /* set BIM_RAM_BIST_START to start built-in self test for BIM read buffer.
  291. * bit auto-clears when done with status read from _SUMMARY and _PASS bits.
  292. */
  293. #define REG_BIM_RAM_BIST 0x102C /* BIM RAM (read buffer) BIST
  294. control/status */
  295. #define BIM_RAM_BIST_RD_START 0x01 /* start BIST for BIM read buffer */
  296. #define BIM_RAM_BIST_WR_START 0x02 /* start BIST for BIM write buffer.
  297. Cassini only. reserved in
  298. Cassini+. */
  299. #define BIM_RAM_BIST_RD_PASS 0x04 /* summary BIST pass status for read
  300. buffer. */
  301. #define BIM_RAM_BIST_WR_PASS 0x08 /* summary BIST pass status for write
  302. buffer. Cassini only. reserved
  303. in Cassini+. */
  304. #define BIM_RAM_BIST_RD_LOW_PASS 0x10 /* read low bank passes BIST */
  305. #define BIM_RAM_BIST_RD_HI_PASS 0x20 /* read high bank passes BIST */
  306. #define BIM_RAM_BIST_WR_LOW_PASS 0x40 /* write low bank passes BIST.
  307. Cassini only. reserved in
  308. Cassini+. */
  309. #define BIM_RAM_BIST_WR_HI_PASS 0x80 /* write high bank passes BIST.
  310. Cassini only. reserved in
  311. Cassini+. */
  312. /* ASUN: i'm not sure what this does as it's not in the spec.
  313. * DEFAULT: 0xFC
  314. */
  315. #define REG_BIM_DIAG_MUX 0x1030 /* BIM diagnostic probe mux
  316. select register */
  317. /* enable probe monitoring mode and select data appearing on the P_A* bus. bit
  318. * values for _SEL_HI_MASK and _SEL_LOW_MASK:
  319. * 0x0: internal probe[7:0] (pci arb state, wtc empty w, wtc full w, wtc empty w,
  320. * wtc empty r, post pci)
  321. * 0x1: internal probe[15:8] (pci wbuf comp, pci wpkt comp, pci rbuf comp,
  322. * pci rpkt comp, txdma wr req, txdma wr ack,
  323. * txdma wr rdy, txdma wr xfr done)
  324. * 0x2: internal probe[23:16] (txdma rd req, txdma rd ack, txdma rd rdy, rxdma rd,
  325. * rd arb state, rd pci state)
  326. * 0x3: internal probe[31:24] (rxdma req, rxdma ack, rxdma rdy, wrarb state,
  327. * wrpci state)
  328. * 0x4: pci io probe[7:0] 0x5: pci io probe[15:8]
  329. * 0x6: pci io probe[23:16] 0x7: pci io probe[31:24]
  330. * 0x8: pci io probe[39:32] 0x9: pci io probe[47:40]
  331. * 0xa: pci io probe[55:48] 0xb: pci io probe[63:56]
  332. * the following are not available in Cassini:
  333. * 0xc: rx probe[7:0] 0xd: tx probe[7:0]
  334. * 0xe: hp probe[7:0] 0xf: mac probe[7:0]
  335. */
  336. #define REG_PLUS_PROBE_MUX_SELECT 0x1034 /* Cassini+: PROBE MUX SELECT */
  337. #define PROBE_MUX_EN 0x80000000 /* allow probe signals to be
  338. driven on local bus P_A[15:0]
  339. for debugging */
  340. #define PROBE_MUX_SUB_MUX_MASK 0x0000FF00 /* select sub module probe signals:
  341. 0x03 = mac[1:0]
  342. 0x0C = rx[1:0]
  343. 0x30 = tx[1:0]
  344. 0xC0 = hp[1:0] */
  345. #define PROBE_MUX_SEL_HI_MASK 0x000000F0 /* select which module to appear
  346. on P_A[15:8]. see above for
  347. values. */
  348. #define PROBE_MUX_SEL_LOW_MASK 0x0000000F /* select which module to appear
  349. on P_A[7:0]. see above for
  350. values. */
  351. /* values mean the same thing as REG_INTR_MASK excep that it's for INTB.
  352. DEFAULT: 0x1F */
  353. #define REG_PLUS_INTR_MASK_1 0x1038 /* Cassini+: interrupt mask
  354. register 2 for INTB */
  355. #define REG_PLUS_INTRN_MASK(x) (REG_PLUS_INTR_MASK_1 + ((x) - 1)*16)
  356. /* bits correspond to both _MASK and _STATUS registers. _ALT corresponds to
  357. * all of the alternate (2-4) INTR registers while _1 corresponds to only
  358. * _MASK_1 and _STATUS_1 registers.
  359. * DEFAULT: 0x7 for MASK registers, 0x0 for ALIAS_CLEAR registers
  360. */
  361. #define INTR_RX_DONE_ALT 0x01
  362. #define INTR_RX_COMP_FULL_ALT 0x02
  363. #define INTR_RX_COMP_AF_ALT 0x04
  364. #define INTR_RX_BUF_UNAVAIL_1 0x08
  365. #define INTR_RX_BUF_AE_1 0x10 /* almost empty */
  366. #define INTRN_MASK_RX_EN 0x80
  367. #define INTRN_MASK_CLEAR_ALL (INTR_RX_DONE_ALT | \
  368. INTR_RX_COMP_FULL_ALT | \
  369. INTR_RX_COMP_AF_ALT | \
  370. INTR_RX_BUF_UNAVAIL_1 | \
  371. INTR_RX_BUF_AE_1)
  372. #define REG_PLUS_INTR_STATUS_1 0x103C /* Cassini+: interrupt status
  373. register 2 for INTB. default: 0x1F */
  374. #define REG_PLUS_INTRN_STATUS(x) (REG_PLUS_INTR_STATUS_1 + ((x) - 1)*16)
  375. #define INTR_STATUS_ALT_INTX_EN 0x80 /* generate INTX when one of the
  376. flags are set. enables desc ring. */
  377. #define REG_PLUS_ALIAS_CLEAR_1 0x1040 /* Cassini+: alias clear mask
  378. register 2 for INTB */
  379. #define REG_PLUS_ALIASN_CLEAR(x) (REG_PLUS_ALIAS_CLEAR_1 + ((x) - 1)*16)
  380. #define REG_PLUS_INTR_STATUS_ALIAS_1 0x1044 /* Cassini+: interrupt status
  381. register alias 2 for INTB */
  382. #define REG_PLUS_INTRN_STATUS_ALIAS(x) (REG_PLUS_INTR_STATUS_ALIAS_1 + ((x) - 1)*16)
  383. #define REG_SATURN_PCFG 0x106c /* pin configuration register for
  384. integrated macphy */
  385. #define SATURN_PCFG_TLA 0x00000001 /* 1 = phy actled */
  386. #define SATURN_PCFG_FLA 0x00000002 /* 1 = phy link10led */
  387. #define SATURN_PCFG_CLA 0x00000004 /* 1 = phy link100led */
  388. #define SATURN_PCFG_LLA 0x00000008 /* 1 = phy link1000led */
  389. #define SATURN_PCFG_RLA 0x00000010 /* 1 = phy duplexled */
  390. #define SATURN_PCFG_PDS 0x00000020 /* phy debug mode.
  391. 0 = normal */
  392. #define SATURN_PCFG_MTP 0x00000080 /* test point select */
  393. #define SATURN_PCFG_GMO 0x00000100 /* GMII observe. 1 =
  394. GMII on SERDES pins for
  395. monitoring. */
  396. #define SATURN_PCFG_FSI 0x00000200 /* 1 = freeze serdes/gmii. all
  397. pins configed as outputs.
  398. for power saving when using
  399. internal phy. */
  400. #define SATURN_PCFG_LAD 0x00000800 /* 0 = mac core led ctrl
  401. polarity from strapping
  402. value.
  403. 1 = mac core led ctrl
  404. polarity active low. */
  405. /** transmit dma registers **/
  406. #define MAX_TX_RINGS_SHIFT 2
  407. #define MAX_TX_RINGS (1 << MAX_TX_RINGS_SHIFT)
  408. #define MAX_TX_RINGS_MASK (MAX_TX_RINGS - 1)
  409. /* TX configuration.
  410. * descr ring sizes size = 32 * (1 << n), n < 9. e.g., 0x8 = 8k. default: 0x8
  411. * DEFAULT: 0x3F000001
  412. */
  413. #define REG_TX_CFG 0x2004 /* TX config */
  414. #define TX_CFG_DMA_EN 0x00000001 /* enable TX DMA. if cleared, DMA
  415. will stop after xfer of current
  416. buffer has been completed. */
  417. #define TX_CFG_FIFO_PIO_SEL 0x00000002 /* TX DMA FIFO can be
  418. accessed w/ FIFO addr
  419. and data registers.
  420. TX DMA should be
  421. disabled. */
  422. #define TX_CFG_DESC_RING0_MASK 0x0000003C /* # desc entries in
  423. ring 1. */
  424. #define TX_CFG_DESC_RING0_SHIFT 2
  425. #define TX_CFG_DESC_RINGN_MASK(a) (TX_CFG_DESC_RING0_MASK << (a)*4)
  426. #define TX_CFG_DESC_RINGN_SHIFT(a) (TX_CFG_DESC_RING0_SHIFT + (a)*4)
  427. #define TX_CFG_PACED_MODE 0x00100000 /* TX_ALL only set after
  428. TX FIFO becomes empty.
  429. if 0, TX_ALL set
  430. if descr queue empty. */
  431. #define TX_CFG_DMA_RDPIPE_DIS 0x01000000 /* always set to 1 */
  432. #define TX_CFG_COMPWB_Q1 0x02000000 /* completion writeback happens at
  433. the end of every packet kicked
  434. through Q1. */
  435. #define TX_CFG_COMPWB_Q2 0x04000000 /* completion writeback happens at
  436. the end of every packet kicked
  437. through Q2. */
  438. #define TX_CFG_COMPWB_Q3 0x08000000 /* completion writeback happens at
  439. the end of every packet kicked
  440. through Q3 */
  441. #define TX_CFG_COMPWB_Q4 0x10000000 /* completion writeback happens at
  442. the end of every packet kicked
  443. through Q4 */
  444. #define TX_CFG_INTR_COMPWB_DIS 0x20000000 /* disable pre-interrupt completion
  445. writeback */
  446. #define TX_CFG_CTX_SEL_MASK 0xC0000000 /* selects tx test port
  447. connection
  448. 0b00: tx mac req,
  449. tx mac retry req,
  450. tx ack and tx tag.
  451. 0b01: txdma rd req,
  452. txdma rd ack,
  453. txdma rd rdy,
  454. txdma rd type0
  455. 0b11: txdma wr req,
  456. txdma wr ack,
  457. txdma wr rdy,
  458. txdma wr xfr done. */
  459. #define TX_CFG_CTX_SEL_SHIFT 30
  460. /* 11-bit counters that point to next location in FIFO to be loaded/retrieved.
  461. * used for diagnostics only.
  462. */
  463. #define REG_TX_FIFO_WRITE_PTR 0x2014 /* TX FIFO write pointer */
  464. #define REG_TX_FIFO_SHADOW_WRITE_PTR 0x2018 /* TX FIFO shadow write
  465. pointer. temp hold reg.
  466. diagnostics only. */
  467. #define REG_TX_FIFO_READ_PTR 0x201C /* TX FIFO read pointer */
  468. #define REG_TX_FIFO_SHADOW_READ_PTR 0x2020 /* TX FIFO shadow read
  469. pointer */
  470. /* (ro) 11-bit up/down counter w/ # of frames currently in TX FIFO */
  471. #define REG_TX_FIFO_PKT_CNT 0x2024 /* TX FIFO packet counter */
  472. /* current state of all state machines in TX */
  473. #define REG_TX_SM_1 0x2028 /* TX state machine reg #1 */
  474. #define TX_SM_1_CHAIN_MASK 0x000003FF /* chaining state machine */
  475. #define TX_SM_1_CSUM_MASK 0x00000C00 /* checksum state machine */
  476. #define TX_SM_1_FIFO_LOAD_MASK 0x0003F000 /* FIFO load state machine.
  477. = 0x01 when TX disabled. */
  478. #define TX_SM_1_FIFO_UNLOAD_MASK 0x003C0000 /* FIFO unload state machine */
  479. #define TX_SM_1_CACHE_MASK 0x03C00000 /* desc. prefetch cache controller
  480. state machine */
  481. #define TX_SM_1_CBQ_ARB_MASK 0xF8000000 /* CBQ arbiter state machine */
  482. #define REG_TX_SM_2 0x202C /* TX state machine reg #2 */
  483. #define TX_SM_2_COMP_WB_MASK 0x07 /* completion writeback sm */
  484. #define TX_SM_2_SUB_LOAD_MASK 0x38 /* sub load state machine */
  485. #define TX_SM_2_KICK_MASK 0xC0 /* kick state machine */
  486. /* 64-bit pointer to the transmit data buffer. only the 50 LSB are incremented
  487. * while the upper 23 bits are taken from the TX descriptor
  488. */
  489. #define REG_TX_DATA_PTR_LOW 0x2030 /* TX data pointer low */
  490. #define REG_TX_DATA_PTR_HI 0x2034 /* TX data pointer high */
  491. /* 13 bit registers written by driver w/ descriptor value that follows
  492. * last valid xmit descriptor. kick # and complete # values are used by
  493. * the xmit dma engine to control tx descr fetching. if > 1 valid
  494. * tx descr is available within the cache line being read, cassini will
  495. * internally cache up to 4 of them. 0 on reset. _KICK = rw, _COMP = ro.
  496. */
  497. #define REG_TX_KICK0 0x2038 /* TX kick reg #1 */
  498. #define REG_TX_KICKN(x) (REG_TX_KICK0 + (x)*4)
  499. #define REG_TX_COMP0 0x2048 /* TX completion reg #1 */
  500. #define REG_TX_COMPN(x) (REG_TX_COMP0 + (x)*4)
  501. /* values of TX_COMPLETE_1-4 are written. each completion register
  502. * is 2bytes in size and contiguous. 8B allocation w/ 8B alignment.
  503. * NOTE: completion reg values are only written back prior to TX_INTME and
  504. * TX_ALL interrupts. at all other times, the most up-to-date index values
  505. * should be obtained from the REG_TX_COMPLETE_# registers.
  506. * here's the layout:
  507. * offset from base addr completion # byte
  508. * 0 TX_COMPLETE_1_MSB
  509. * 1 TX_COMPLETE_1_LSB
  510. * 2 TX_COMPLETE_2_MSB
  511. * 3 TX_COMPLETE_2_LSB
  512. * 4 TX_COMPLETE_3_MSB
  513. * 5 TX_COMPLETE_3_LSB
  514. * 6 TX_COMPLETE_4_MSB
  515. * 7 TX_COMPLETE_4_LSB
  516. */
  517. #define TX_COMPWB_SIZE 8
  518. #define REG_TX_COMPWB_DB_LOW 0x2058 /* TX completion write back
  519. base low */
  520. #define REG_TX_COMPWB_DB_HI 0x205C /* TX completion write back
  521. base high */
  522. #define TX_COMPWB_MSB_MASK 0x00000000000000FFULL
  523. #define TX_COMPWB_MSB_SHIFT 0
  524. #define TX_COMPWB_LSB_MASK 0x000000000000FF00ULL
  525. #define TX_COMPWB_LSB_SHIFT 8
  526. #define TX_COMPWB_NEXT(x) ((x) >> 16)
  527. /* 53 MSB used as base address. 11 LSB assumed to be 0. TX desc pointer must
  528. * be 2KB-aligned. */
  529. #define REG_TX_DB0_LOW 0x2060 /* TX descriptor base low #1 */
  530. #define REG_TX_DB0_HI 0x2064 /* TX descriptor base hi #1 */
  531. #define REG_TX_DBN_LOW(x) (REG_TX_DB0_LOW + (x)*8)
  532. #define REG_TX_DBN_HI(x) (REG_TX_DB0_HI + (x)*8)
  533. /* 16-bit registers hold weights for the weighted round-robin of the
  534. * four CBQ TX descr rings. weights correspond to # bytes xferred from
  535. * host to TXFIFO in a round of WRR arbitration. can be set
  536. * dynamically with new weights set upon completion of the current
  537. * packet transfer from host memory to TXFIFO. a dummy write to any of
  538. * these registers causes a queue1 pre-emption with all historical bw
  539. * deficit data reset to 0 (useful when congestion requires a
  540. * pre-emption/re-allocation of network bandwidth
  541. */
  542. #define REG_TX_MAXBURST_0 0x2080 /* TX MaxBurst #1 */
  543. #define REG_TX_MAXBURST_1 0x2084 /* TX MaxBurst #2 */
  544. #define REG_TX_MAXBURST_2 0x2088 /* TX MaxBurst #3 */
  545. #define REG_TX_MAXBURST_3 0x208C /* TX MaxBurst #4 */
  546. /* diagnostics access to any TX FIFO location. every access is 65
  547. * bits. _DATA_LOW = 32 LSB, _DATA_HI_T1/T0 = 32 MSB. _TAG = tag bit.
  548. * writing _DATA_HI_T0 sets tag bit low, writing _DATA_HI_T1 sets tag
  549. * bit high. TX_FIFO_PIO_SEL must be set for TX FIFO PIO access. if
  550. * TX FIFO data integrity is desired, TX DMA should be
  551. * disabled. _DATA_HI_Tx should be the last access of the sequence.
  552. */
  553. #define REG_TX_FIFO_ADDR 0x2104 /* TX FIFO address */
  554. #define REG_TX_FIFO_TAG 0x2108 /* TX FIFO tag */
  555. #define REG_TX_FIFO_DATA_LOW 0x210C /* TX FIFO data low */
  556. #define REG_TX_FIFO_DATA_HI_T1 0x2110 /* TX FIFO data high t1 */
  557. #define REG_TX_FIFO_DATA_HI_T0 0x2114 /* TX FIFO data high t0 */
  558. #define REG_TX_FIFO_SIZE 0x2118 /* (ro) TX FIFO size = 0x090 = 9KB */
  559. /* 9-bit register controls BIST of TX FIFO. bit set indicates that the BIST
  560. * passed for the specified memory
  561. */
  562. #define REG_TX_RAMBIST 0x211C /* TX RAMBIST control/status */
  563. #define TX_RAMBIST_STATE 0x01C0 /* progress state of RAMBIST
  564. controller state machine */
  565. #define TX_RAMBIST_RAM33A_PASS 0x0020 /* RAM33A passed */
  566. #define TX_RAMBIST_RAM32A_PASS 0x0010 /* RAM32A passed */
  567. #define TX_RAMBIST_RAM33B_PASS 0x0008 /* RAM33B passed */
  568. #define TX_RAMBIST_RAM32B_PASS 0x0004 /* RAM32B passed */
  569. #define TX_RAMBIST_SUMMARY 0x0002 /* all RAM passed */
  570. #define TX_RAMBIST_START 0x0001 /* write 1 to start BIST. self
  571. clears on completion. */
  572. /** receive dma registers **/
  573. #define MAX_RX_DESC_RINGS 2
  574. #define MAX_RX_COMP_RINGS 4
  575. /* receive DMA channel configuration. default: 0x80910
  576. * free ring size = (1 << n)*32 -> [32 - 8k]
  577. * completion ring size = (1 << n)*128 -> [128 - 32k], n < 9
  578. * DEFAULT: 0x80910
  579. */
  580. #define REG_RX_CFG 0x4000 /* RX config */
  581. #define RX_CFG_DMA_EN 0x00000001 /* enable RX DMA. 0 stops
  582. channel as soon as current
  583. frame xfer has completed.
  584. driver should disable MAC
  585. for 200ms before disabling
  586. RX */
  587. #define RX_CFG_DESC_RING_MASK 0x0000001E /* # desc entries in RX
  588. free desc ring.
  589. def: 0x8 = 8k */
  590. #define RX_CFG_DESC_RING_SHIFT 1
  591. #define RX_CFG_COMP_RING_MASK 0x000001E0 /* # desc entries in RX complete
  592. ring. def: 0x8 = 32k */
  593. #define RX_CFG_COMP_RING_SHIFT 5
  594. #define RX_CFG_BATCH_DIS 0x00000200 /* disable receive desc
  595. batching. def: 0x0 =
  596. enabled */
  597. #define RX_CFG_SWIVEL_MASK 0x00001C00 /* byte offset of the 1st
  598. data byte of the packet
  599. w/in 8 byte boundares.
  600. this swivels the data
  601. DMA'ed to header
  602. buffers, jumbo buffers
  603. when header split is not
  604. requested and MTU sized
  605. buffers. def: 0x2 */
  606. #define RX_CFG_SWIVEL_SHIFT 10
  607. /* cassini+ only */
  608. #define RX_CFG_DESC_RING1_MASK 0x000F0000 /* # of desc entries in
  609. RX free desc ring 2.
  610. def: 0x8 = 8k */
  611. #define RX_CFG_DESC_RING1_SHIFT 16
  612. /* the page size register allows cassini chips to do the following with
  613. * received data:
  614. * [--------------------------------------------------------------] page
  615. * [off][buf1][pad][off][buf2][pad][off][buf3][pad][off][buf4][pad]
  616. * |--------------| = PAGE_SIZE_BUFFER_STRIDE
  617. * page = PAGE_SIZE
  618. * offset = PAGE_SIZE_MTU_OFF
  619. * for the above example, MTU_BUFFER_COUNT = 4.
  620. * NOTE: as is apparent, you need to ensure that the following holds:
  621. * MTU_BUFFER_COUNT <= PAGE_SIZE/PAGE_SIZE_BUFFER_STRIDE
  622. * DEFAULT: 0x48002002 (8k pages)
  623. */
  624. #define REG_RX_PAGE_SIZE 0x4004 /* RX page size */
  625. #define RX_PAGE_SIZE_MASK 0x00000003 /* size of pages pointed to
  626. by receive descriptors.
  627. if jumbo buffers are
  628. supported the page size
  629. should not be < 8k.
  630. 0b00 = 2k, 0b01 = 4k
  631. 0b10 = 8k, 0b11 = 16k
  632. DEFAULT: 8k */
  633. #define RX_PAGE_SIZE_SHIFT 0
  634. #define RX_PAGE_SIZE_MTU_COUNT_MASK 0x00007800 /* # of MTU buffers the hw
  635. packs into a page.
  636. DEFAULT: 4 */
  637. #define RX_PAGE_SIZE_MTU_COUNT_SHIFT 11
  638. #define RX_PAGE_SIZE_MTU_STRIDE_MASK 0x18000000 /* # of bytes that separate
  639. each MTU buffer +
  640. offset from each
  641. other.
  642. 0b00 = 1k, 0b01 = 2k
  643. 0b10 = 4k, 0b11 = 8k
  644. DEFAULT: 0x1 */
  645. #define RX_PAGE_SIZE_MTU_STRIDE_SHIFT 27
  646. #define RX_PAGE_SIZE_MTU_OFF_MASK 0xC0000000 /* offset in each page that
  647. hw writes the MTU buffer
  648. into.
  649. 0b00 = 0,
  650. 0b01 = 64 bytes
  651. 0b10 = 96, 0b11 = 128
  652. DEFAULT: 0x1 */
  653. #define RX_PAGE_SIZE_MTU_OFF_SHIFT 30
  654. /* 11-bit counter points to next location in RX FIFO to be loaded/read.
  655. * shadow write pointers enable retries in case of early receive aborts.
  656. * DEFAULT: 0x0. generated on 64-bit boundaries.
  657. */
  658. #define REG_RX_FIFO_WRITE_PTR 0x4008 /* RX FIFO write pointer */
  659. #define REG_RX_FIFO_READ_PTR 0x400C /* RX FIFO read pointer */
  660. #define REG_RX_IPP_FIFO_SHADOW_WRITE_PTR 0x4010 /* RX IPP FIFO shadow write
  661. pointer */
  662. #define REG_RX_IPP_FIFO_SHADOW_READ_PTR 0x4014 /* RX IPP FIFO shadow read
  663. pointer */
  664. #define REG_RX_IPP_FIFO_READ_PTR 0x400C /* RX IPP FIFO read
  665. pointer. (8-bit counter) */
  666. /* current state of RX DMA state engines + other info
  667. * DEFAULT: 0x0
  668. */
  669. #define REG_RX_DEBUG 0x401C /* RX debug */
  670. #define RX_DEBUG_LOAD_STATE_MASK 0x0000000F /* load state machine w/ MAC:
  671. 0x0 = idle, 0x1 = load_bop
  672. 0x2 = load 1, 0x3 = load 2
  673. 0x4 = load 3, 0x5 = load 4
  674. 0x6 = last detect
  675. 0x7 = wait req
  676. 0x8 = wait req statuss 1st
  677. 0x9 = load st
  678. 0xa = bubble mac
  679. 0xb = error */
  680. #define RX_DEBUG_LM_STATE_MASK 0x00000070 /* load state machine w/ HP and
  681. RX FIFO:
  682. 0x0 = idle, 0x1 = hp xfr
  683. 0x2 = wait hp ready
  684. 0x3 = wait flow code
  685. 0x4 = fifo xfer
  686. 0x5 = make status
  687. 0x6 = csum ready
  688. 0x7 = error */
  689. #define RX_DEBUG_FC_STATE_MASK 0x000000180 /* flow control state machine
  690. w/ MAC:
  691. 0x0 = idle
  692. 0x1 = wait xoff ack
  693. 0x2 = wait xon
  694. 0x3 = wait xon ack */
  695. #define RX_DEBUG_DATA_STATE_MASK 0x000001E00 /* unload data state machine
  696. states:
  697. 0x0 = idle data
  698. 0x1 = header begin
  699. 0x2 = xfer header
  700. 0x3 = xfer header ld
  701. 0x4 = mtu begin
  702. 0x5 = xfer mtu
  703. 0x6 = xfer mtu ld
  704. 0x7 = jumbo begin
  705. 0x8 = xfer jumbo
  706. 0x9 = xfer jumbo ld
  707. 0xa = reas begin
  708. 0xb = xfer reas
  709. 0xc = flush tag
  710. 0xd = xfer reas ld
  711. 0xe = error
  712. 0xf = bubble idle */
  713. #define RX_DEBUG_DESC_STATE_MASK 0x0001E000 /* unload desc state machine
  714. states:
  715. 0x0 = idle desc
  716. 0x1 = wait ack
  717. 0x9 = wait ack 2
  718. 0x2 = fetch desc 1
  719. 0xa = fetch desc 2
  720. 0x3 = load ptrs
  721. 0x4 = wait dma
  722. 0x5 = wait ack batch
  723. 0x6 = post batch
  724. 0x7 = xfr done */
  725. #define RX_DEBUG_INTR_READ_PTR_MASK 0x30000000 /* interrupt read ptr of the
  726. interrupt queue */
  727. #define RX_DEBUG_INTR_WRITE_PTR_MASK 0xC0000000 /* interrupt write pointer
  728. of the interrupt queue */
  729. /* flow control frames are emitted using two PAUSE thresholds:
  730. * XOFF PAUSE uses pause time value pre-programmed in the Send PAUSE MAC reg
  731. * XON PAUSE uses a pause time of 0. granularity of threshold is 64bytes.
  732. * PAUSE thresholds defined in terms of FIFO occupancy and may be translated
  733. * into FIFO vacancy using RX_FIFO_SIZE. setting ON will trigger XON frames
  734. * when FIFO reaches 0. OFF threshold should not be > size of RX FIFO. max
  735. * value is is 0x6F.
  736. * DEFAULT: 0x00078
  737. */
  738. #define REG_RX_PAUSE_THRESH 0x4020 /* RX pause thresholds */
  739. #define RX_PAUSE_THRESH_QUANTUM 64
  740. #define RX_PAUSE_THRESH_OFF_MASK 0x000001FF /* XOFF PAUSE emitted when
  741. RX FIFO occupancy >
  742. value*64B */
  743. #define RX_PAUSE_THRESH_OFF_SHIFT 0
  744. #define RX_PAUSE_THRESH_ON_MASK 0x001FF000 /* XON PAUSE emitted after
  745. emitting XOFF PAUSE when RX
  746. FIFO occupancy falls below
  747. this value*64B. must be
  748. < XOFF threshold. if =
  749. RX_FIFO_SIZE< XON frames are
  750. never emitted. */
  751. #define RX_PAUSE_THRESH_ON_SHIFT 12
  752. /* 13-bit register used to control RX desc fetching and intr generation. if 4+
  753. * valid RX descriptors are available, Cassini will read 4 at a time.
  754. * writing N means that all desc up to *but* excluding N are available. N must
  755. * be a multiple of 4 (N % 4 = 0). first desc should be cache-line aligned.
  756. * DEFAULT: 0 on reset
  757. */
  758. #define REG_RX_KICK 0x4024 /* RX kick reg */
  759. /* 8KB aligned 64-bit pointer to the base of the RX free/completion rings.
  760. * lower 13 bits of the low register are hard-wired to 0.
  761. */
  762. #define REG_RX_DB_LOW 0x4028 /* RX descriptor ring
  763. base low */
  764. #define REG_RX_DB_HI 0x402C /* RX descriptor ring
  765. base hi */
  766. #define REG_RX_CB_LOW 0x4030 /* RX completion ring
  767. base low */
  768. #define REG_RX_CB_HI 0x4034 /* RX completion ring
  769. base hi */
  770. /* 13-bit register indicate desc used by cassini for receive frames. used
  771. * for diagnostic purposes.
  772. * DEFAULT: 0 on reset
  773. */
  774. #define REG_RX_COMP 0x4038 /* (ro) RX completion */
  775. /* HEAD and TAIL are used to control RX desc posting and interrupt
  776. * generation. hw moves the head register to pass ownership to sw. sw
  777. * moves the tail register to pass ownership back to hw. to give all
  778. * entries to hw, set TAIL = HEAD. if HEAD and TAIL indicate that no
  779. * more entries are available, DMA will pause and an interrupt will be
  780. * generated to indicate no more entries are available. sw can use
  781. * this interrupt to reduce the # of times it must update the
  782. * completion tail register.
  783. * DEFAULT: 0 on reset
  784. */
  785. #define REG_RX_COMP_HEAD 0x403C /* RX completion head */
  786. #define REG_RX_COMP_TAIL 0x4040 /* RX completion tail */
  787. /* values used for receive interrupt blanking. loaded each time the ISR is read
  788. * DEFAULT: 0x00000000
  789. */
  790. #define REG_RX_BLANK 0x4044 /* RX blanking register
  791. for ISR read */
  792. #define RX_BLANK_INTR_PKT_MASK 0x000001FF /* RX_DONE intr asserted if
  793. this many sets of completion
  794. writebacks (up to 2 packets)
  795. occur since the last time
  796. the ISR was read. 0 = no
  797. packet blanking */
  798. #define RX_BLANK_INTR_PKT_SHIFT 0
  799. #define RX_BLANK_INTR_TIME_MASK 0x3FFFF000 /* RX_DONE interrupt asserted
  800. if that many clocks were
  801. counted since last time the
  802. ISR was read.
  803. each count is 512 core
  804. clocks (125MHz). 0 = no
  805. time blanking */
  806. #define RX_BLANK_INTR_TIME_SHIFT 12
  807. /* values used for interrupt generation based on threshold values of how
  808. * many free desc and completion entries are available for hw use.
  809. * DEFAULT: 0x00000000
  810. */
  811. #define REG_RX_AE_THRESH 0x4048 /* RX almost empty
  812. thresholds */
  813. #define RX_AE_THRESH_FREE_MASK 0x00001FFF /* RX_BUF_AE will be
  814. generated if # desc
  815. avail for hw use <=
  816. # */
  817. #define RX_AE_THRESH_FREE_SHIFT 0
  818. #define RX_AE_THRESH_COMP_MASK 0x0FFFE000 /* RX_COMP_AE will be
  819. generated if # of
  820. completion entries
  821. avail for hw use <=
  822. # */
  823. #define RX_AE_THRESH_COMP_SHIFT 13
  824. /* probabilities for random early drop (RED) thresholds on a FIFO threshold
  825. * basis. probability should increase when the FIFO level increases. control
  826. * packets are never dropped and not counted in stats. probability programmed
  827. * on a 12.5% granularity. e.g., 0x1 = 1/8 packets dropped.
  828. * DEFAULT: 0x00000000
  829. */
  830. #define REG_RX_RED 0x404C /* RX random early detect enable */
  831. #define RX_RED_4K_6K_FIFO_MASK 0x000000FF /* 4KB < FIFO thresh < 6KB */
  832. #define RX_RED_6K_8K_FIFO_MASK 0x0000FF00 /* 6KB < FIFO thresh < 8KB */
  833. #define RX_RED_8K_10K_FIFO_MASK 0x00FF0000 /* 8KB < FIFO thresh < 10KB */
  834. #define RX_RED_10K_12K_FIFO_MASK 0xFF000000 /* 10KB < FIFO thresh < 12KB */
  835. /* FIFO fullness levels for RX FIFO, RX control FIFO, and RX IPP FIFO.
  836. * RX control FIFO = # of packets in RX FIFO.
  837. * DEFAULT: 0x0
  838. */
  839. #define REG_RX_FIFO_FULLNESS 0x4050 /* (ro) RX FIFO fullness */
  840. #define RX_FIFO_FULLNESS_RX_FIFO_MASK 0x3FF80000 /* level w/ 8B granularity */
  841. #define RX_FIFO_FULLNESS_IPP_FIFO_MASK 0x0007FF00 /* level w/ 8B granularity */
  842. #define RX_FIFO_FULLNESS_RX_PKT_MASK 0x000000FF /* # packets in RX FIFO */
  843. #define REG_RX_IPP_PACKET_COUNT 0x4054 /* RX IPP packet counter */
  844. #define REG_RX_WORK_DMA_PTR_LOW 0x4058 /* RX working DMA ptr low */
  845. #define REG_RX_WORK_DMA_PTR_HI 0x405C /* RX working DMA ptr
  846. high */
  847. /* BIST testing ro RX FIFO, RX control FIFO, and RX IPP FIFO. only RX BIST
  848. * START/COMPLETE is writeable. START will clear when the BIST has completed
  849. * checking all 17 RAMS.
  850. * DEFAULT: 0bxxxx xxxxx xxxx xxxx xxxx x000 0000 0000 00x0
  851. */
  852. #define REG_RX_BIST 0x4060 /* (ro) RX BIST */
  853. #define RX_BIST_32A_PASS 0x80000000 /* RX FIFO 32A passed */
  854. #define RX_BIST_33A_PASS 0x40000000 /* RX FIFO 33A passed */
  855. #define RX_BIST_32B_PASS 0x20000000 /* RX FIFO 32B passed */
  856. #define RX_BIST_33B_PASS 0x10000000 /* RX FIFO 33B passed */
  857. #define RX_BIST_32C_PASS 0x08000000 /* RX FIFO 32C passed */
  858. #define RX_BIST_33C_PASS 0x04000000 /* RX FIFO 33C passed */
  859. #define RX_BIST_IPP_32A_PASS 0x02000000 /* RX IPP FIFO 33B passed */
  860. #define RX_BIST_IPP_33A_PASS 0x01000000 /* RX IPP FIFO 33A passed */
  861. #define RX_BIST_IPP_32B_PASS 0x00800000 /* RX IPP FIFO 32B passed */
  862. #define RX_BIST_IPP_33B_PASS 0x00400000 /* RX IPP FIFO 33B passed */
  863. #define RX_BIST_IPP_32C_PASS 0x00200000 /* RX IPP FIFO 32C passed */
  864. #define RX_BIST_IPP_33C_PASS 0x00100000 /* RX IPP FIFO 33C passed */
  865. #define RX_BIST_CTRL_32_PASS 0x00800000 /* RX CTRL FIFO 32 passed */
  866. #define RX_BIST_CTRL_33_PASS 0x00400000 /* RX CTRL FIFO 33 passed */
  867. #define RX_BIST_REAS_26A_PASS 0x00200000 /* RX Reas 26A passed */
  868. #define RX_BIST_REAS_26B_PASS 0x00100000 /* RX Reas 26B passed */
  869. #define RX_BIST_REAS_27_PASS 0x00080000 /* RX Reas 27 passed */
  870. #define RX_BIST_STATE_MASK 0x00078000 /* BIST state machine */
  871. #define RX_BIST_SUMMARY 0x00000002 /* when BIST complete,
  872. summary pass bit
  873. contains AND of BIST
  874. results of all 16
  875. RAMS */
  876. #define RX_BIST_START 0x00000001 /* write 1 to start
  877. BIST. self clears
  878. on completion. */
  879. /* next location in RX CTRL FIFO that will be loaded w/ data from RX IPP/read
  880. * from to retrieve packet control info.
  881. * DEFAULT: 0
  882. */
  883. #define REG_RX_CTRL_FIFO_WRITE_PTR 0x4064 /* (ro) RX control FIFO
  884. write ptr */
  885. #define REG_RX_CTRL_FIFO_READ_PTR 0x4068 /* (ro) RX control FIFO read
  886. ptr */
  887. /* receive interrupt blanking. loaded each time interrupt alias register is
  888. * read.
  889. * DEFAULT: 0x0
  890. */
  891. #define REG_RX_BLANK_ALIAS_READ 0x406C /* RX blanking register for
  892. alias read */
  893. #define RX_BAR_INTR_PACKET_MASK 0x000001FF /* assert RX_DONE if #
  894. completion writebacks
  895. > # since last ISR
  896. read. 0 = no
  897. blanking. up to 2
  898. packets per
  899. completion wb. */
  900. #define RX_BAR_INTR_TIME_MASK 0x3FFFF000 /* assert RX_DONE if #
  901. clocks > # since last
  902. ISR read. each count
  903. is 512 core clocks
  904. (125MHz). 0 = no
  905. blanking. */
  906. /* diagnostic access to RX FIFO. 32 LSB accessed via DATA_LOW. 32 MSB accessed
  907. * via DATA_HI_T0 or DATA_HI_T1. TAG reads the tag bit. writing HI_T0
  908. * will unset the tag bit while writing HI_T1 will set the tag bit. to reset
  909. * to normal operation after diagnostics, write to address location 0x0.
  910. * RX_DMA_EN bit must be set to 0x0 for RX FIFO PIO access. DATA_HI should
  911. * be the last write access of a write sequence.
  912. * DEFAULT: undefined
  913. */
  914. #define REG_RX_FIFO_ADDR 0x4080 /* RX FIFO address */
  915. #define REG_RX_FIFO_TAG 0x4084 /* RX FIFO tag */
  916. #define REG_RX_FIFO_DATA_LOW 0x4088 /* RX FIFO data low */
  917. #define REG_RX_FIFO_DATA_HI_T0 0x408C /* RX FIFO data high T0 */
  918. #define REG_RX_FIFO_DATA_HI_T1 0x4090 /* RX FIFO data high T1 */
  919. /* diagnostic assess to RX CTRL FIFO. 8-bit FIFO_ADDR holds address of
  920. * 81 bit control entry and 6 bit flow id. LOW and MID are both 32-bit
  921. * accesses. HI is 7-bits with 6-bit flow id and 1 bit control
  922. * word. RX_DMA_EN must be 0 for RX CTRL FIFO PIO access. DATA_HI
  923. * should be last write access of the write sequence.
  924. * DEFAULT: undefined
  925. */
  926. #define REG_RX_CTRL_FIFO_ADDR 0x4094 /* RX Control FIFO and
  927. Batching FIFO addr */
  928. #define REG_RX_CTRL_FIFO_DATA_LOW 0x4098 /* RX Control FIFO data
  929. low */
  930. #define REG_RX_CTRL_FIFO_DATA_MID 0x409C /* RX Control FIFO data
  931. mid */
  932. #define REG_RX_CTRL_FIFO_DATA_HI 0x4100 /* RX Control FIFO data
  933. hi and flow id */
  934. #define RX_CTRL_FIFO_DATA_HI_CTRL 0x0001 /* upper bit of ctrl word */
  935. #define RX_CTRL_FIFO_DATA_HI_FLOW_MASK 0x007E /* flow id */
  936. /* diagnostic access to RX IPP FIFO. same semantics as RX_FIFO.
  937. * DEFAULT: undefined
  938. */
  939. #define REG_RX_IPP_FIFO_ADDR 0x4104 /* RX IPP FIFO address */
  940. #define REG_RX_IPP_FIFO_TAG 0x4108 /* RX IPP FIFO tag */
  941. #define REG_RX_IPP_FIFO_DATA_LOW 0x410C /* RX IPP FIFO data low */
  942. #define REG_RX_IPP_FIFO_DATA_HI_T0 0x4110 /* RX IPP FIFO data high
  943. T0 */
  944. #define REG_RX_IPP_FIFO_DATA_HI_T1 0x4114 /* RX IPP FIFO data high
  945. T1 */
  946. /* 64-bit pointer to receive data buffer in host memory used for headers and
  947. * small packets. MSB in high register. loaded by DMA state machine and
  948. * increments as DMA writes receive data. only 50 LSB are incremented. top
  949. * 13 bits taken from RX descriptor.
  950. * DEFAULT: undefined
  951. */
  952. #define REG_RX_HEADER_PAGE_PTR_LOW 0x4118 /* (ro) RX header page ptr
  953. low */
  954. #define REG_RX_HEADER_PAGE_PTR_HI 0x411C /* (ro) RX header page ptr
  955. high */
  956. #define REG_RX_MTU_PAGE_PTR_LOW 0x4120 /* (ro) RX MTU page pointer
  957. low */
  958. #define REG_RX_MTU_PAGE_PTR_HI 0x4124 /* (ro) RX MTU page pointer
  959. high */
  960. /* PIO diagnostic access to RX reassembly DMA Table RAM. 6-bit register holds
  961. * one of 64 79-bit locations in the RX Reassembly DMA table and the addr of
  962. * one of the 64 byte locations in the Batching table. LOW holds 32 LSB.
  963. * MID holds the next 32 LSB. HIGH holds the 15 MSB. RX_DMA_EN must be set
  964. * to 0 for PIO access. DATA_HIGH should be last write of write sequence.
  965. * layout:
  966. * reassmbl ptr [78:15] | reassmbl index [14:1] | reassmbl entry valid [0]
  967. * DEFAULT: undefined
  968. */
  969. #define REG_RX_TABLE_ADDR 0x4128 /* RX reassembly DMA table
  970. address */
  971. #define RX_TABLE_ADDR_MASK 0x0000003F /* address mask */
  972. #define REG_RX_TABLE_DATA_LOW 0x412C /* RX reassembly DMA table
  973. data low */
  974. #define REG_RX_TABLE_DATA_MID 0x4130 /* RX reassembly DMA table
  975. data mid */
  976. #define REG_RX_TABLE_DATA_HI 0x4134 /* RX reassembly DMA table
  977. data high */
  978. /* cassini+ only */
  979. /* 8KB aligned 64-bit pointer to base of RX rings. lower 13 bits hardwired to
  980. * 0. same semantics as primary desc/complete rings.
  981. */
  982. #define REG_PLUS_RX_DB1_LOW 0x4200 /* RX descriptor ring
  983. 2 base low */
  984. #define REG_PLUS_RX_DB1_HI 0x4204 /* RX descriptor ring
  985. 2 base high */
  986. #define REG_PLUS_RX_CB1_LOW 0x4208 /* RX completion ring
  987. 2 base low. 4 total */
  988. #define REG_PLUS_RX_CB1_HI 0x420C /* RX completion ring
  989. 2 base high. 4 total */
  990. #define REG_PLUS_RX_CBN_LOW(x) (REG_PLUS_RX_CB1_LOW + 8*((x) - 1))
  991. #define REG_PLUS_RX_CBN_HI(x) (REG_PLUS_RX_CB1_HI + 8*((x) - 1))
  992. #define REG_PLUS_RX_KICK1 0x4220 /* RX Kick 2 register */
  993. #define REG_PLUS_RX_COMP1 0x4224 /* (ro) RX completion 2
  994. reg */
  995. #define REG_PLUS_RX_COMP1_HEAD 0x4228 /* (ro) RX completion 2
  996. head reg. 4 total. */
  997. #define REG_PLUS_RX_COMP1_TAIL 0x422C /* RX completion 2
  998. tail reg. 4 total. */
  999. #define REG_PLUS_RX_COMPN_HEAD(x) (REG_PLUS_RX_COMP1_HEAD + 8*((x) - 1))
  1000. #define REG_PLUS_RX_COMPN_TAIL(x) (REG_PLUS_RX_COMP1_TAIL + 8*((x) - 1))
  1001. #define REG_PLUS_RX_AE1_THRESH 0x4240 /* RX almost empty 2
  1002. thresholds */
  1003. #define RX_AE1_THRESH_FREE_MASK RX_AE_THRESH_FREE_MASK
  1004. #define RX_AE1_THRESH_FREE_SHIFT RX_AE_THRESH_FREE_SHIFT
  1005. /** header parser registers **/
  1006. /* RX parser configuration register.
  1007. * DEFAULT: 0x1651004
  1008. */
  1009. #define REG_HP_CFG 0x4140 /* header parser
  1010. configuration reg */
  1011. #define HP_CFG_PARSE_EN 0x00000001 /* enab header parsing */
  1012. #define HP_CFG_NUM_CPU_MASK 0x000000FC /* # processors
  1013. 0 = 64. 0x3f = 63 */
  1014. #define HP_CFG_NUM_CPU_SHIFT 2
  1015. #define HP_CFG_SYN_INC_MASK 0x00000100 /* SYN bit won't increment
  1016. TCP seq # by one when
  1017. stored in FDBM */
  1018. #define HP_CFG_TCP_THRESH_MASK 0x000FFE00 /* # bytes of TCP data
  1019. needed to be considered
  1020. for reassembly */
  1021. #define HP_CFG_TCP_THRESH_SHIFT 9
  1022. /* access to RX Instruction RAM. 5-bit register/counter holds addr
  1023. * of 39 bit entry to be read/written. 32 LSB in _DATA_LOW. 7 MSB in _DATA_HI.
  1024. * RX_DMA_EN must be 0 for RX instr PIO access. DATA_HI should be last access
  1025. * of sequence.
  1026. * DEFAULT: undefined
  1027. */
  1028. #define REG_HP_INSTR_RAM_ADDR 0x4144 /* HP instruction RAM
  1029. address */
  1030. #define HP_INSTR_RAM_ADDR_MASK 0x01F /* 5-bit mask */
  1031. #define REG_HP_INSTR_RAM_DATA_LOW 0x4148 /* HP instruction RAM
  1032. data low */
  1033. #define HP_INSTR_RAM_LOW_OUTMASK_MASK 0x0000FFFF
  1034. #define HP_INSTR_RAM_LOW_OUTMASK_SHIFT 0
  1035. #define HP_INSTR_RAM_LOW_OUTSHIFT_MASK 0x000F0000
  1036. #define HP_INSTR_RAM_LOW_OUTSHIFT_SHIFT 16
  1037. #define HP_INSTR_RAM_LOW_OUTEN_MASK 0x00300000
  1038. #define HP_INSTR_RAM_LOW_OUTEN_SHIFT 20
  1039. #define HP_INSTR_RAM_LOW_OUTARG_MASK 0xFFC00000
  1040. #define HP_INSTR_RAM_LOW_OUTARG_SHIFT 22
  1041. #define REG_HP_INSTR_RAM_DATA_MID 0x414C /* HP instruction RAM
  1042. data mid */
  1043. #define HP_INSTR_RAM_MID_OUTARG_MASK 0x00000003
  1044. #define HP_INSTR_RAM_MID_OUTARG_SHIFT 0
  1045. #define HP_INSTR_RAM_MID_OUTOP_MASK 0x0000003C
  1046. #define HP_INSTR_RAM_MID_OUTOP_SHIFT 2
  1047. #define HP_INSTR_RAM_MID_FNEXT_MASK 0x000007C0
  1048. #define HP_INSTR_RAM_MID_FNEXT_SHIFT 6
  1049. #define HP_INSTR_RAM_MID_FOFF_MASK 0x0003F800
  1050. #define HP_INSTR_RAM_MID_FOFF_SHIFT 11
  1051. #define HP_INSTR_RAM_MID_SNEXT_MASK 0x007C0000
  1052. #define HP_INSTR_RAM_MID_SNEXT_SHIFT 18
  1053. #define HP_INSTR_RAM_MID_SOFF_MASK 0x3F800000
  1054. #define HP_INSTR_RAM_MID_SOFF_SHIFT 23
  1055. #define HP_INSTR_RAM_MID_OP_MASK 0xC0000000
  1056. #define HP_INSTR_RAM_MID_OP_SHIFT 30
  1057. #define REG_HP_INSTR_RAM_DATA_HI 0x4150 /* HP instruction RAM
  1058. data high */
  1059. #define HP_INSTR_RAM_HI_VAL_MASK 0x0000FFFF
  1060. #define HP_INSTR_RAM_HI_VAL_SHIFT 0
  1061. #define HP_INSTR_RAM_HI_MASK_MASK 0xFFFF0000
  1062. #define HP_INSTR_RAM_HI_MASK_SHIFT 16
  1063. /* PIO access into RX Header parser data RAM and flow database.
  1064. * 11-bit register. Data fills the LSB portion of bus if less than 32 bits.
  1065. * DATA_RAM: write RAM_FDB_DATA with index to access DATA_RAM.
  1066. * RAM bytes = 4*(x - 1) + [3:0]. e.g., 0 -> [3:0], 31 -> [123:120]
  1067. * FLOWDB: write DATA_RAM_FDB register and then read/write FDB1-12 to access
  1068. * flow database.
  1069. * RX_DMA_EN must be 0 for RX parser RAM PIO access. RX Parser RAM data reg
  1070. * should be the last write access of the write sequence.
  1071. * DEFAULT: undefined
  1072. */
  1073. #define REG_HP_DATA_RAM_FDB_ADDR 0x4154 /* HP data and FDB
  1074. RAM address */
  1075. #define HP_DATA_RAM_FDB_DATA_MASK 0x001F /* select 1 of 86 byte
  1076. locations in header
  1077. parser data ram to
  1078. read/write */
  1079. #define HP_DATA_RAM_FDB_FDB_MASK 0x3F00 /* 1 of 64 353-bit locations
  1080. in the flow database */
  1081. #define REG_HP_DATA_RAM_DATA 0x4158 /* HP data RAM data */
  1082. /* HP flow database registers: 1 - 12, 0x415C - 0x4188, 4 8-bit bytes
  1083. * FLOW_DB(1) = IP_SA[127:96], FLOW_DB(2) = IP_SA[95:64]
  1084. * FLOW_DB(3) = IP_SA[63:32], FLOW_DB(4) = IP_SA[31:0]
  1085. * FLOW_DB(5) = IP_DA[127:96], FLOW_DB(6) = IP_DA[95:64]
  1086. * FLOW_DB(7) = IP_DA[63:32], FLOW_DB(8) = IP_DA[31:0]
  1087. * FLOW_DB(9) = {TCP_SP[15:0],TCP_DP[15:0]}
  1088. * FLOW_DB(10) = bit 0 has value for flow valid
  1089. * FLOW_DB(11) = TCP_SEQ[63:32], FLOW_DB(12) = TCP_SEQ[31:0]
  1090. */
  1091. #define REG_HP_FLOW_DB0 0x415C /* HP flow database 1 reg */
  1092. #define REG_HP_FLOW_DBN(x) (REG_HP_FLOW_DB0 + (x)*4)
  1093. /* diagnostics for RX Header Parser block.
  1094. * ASUN: the header parser state machine register is used for diagnostics
  1095. * purposes. however, the spec doesn't have any details on it.
  1096. */
  1097. #define REG_HP_STATE_MACHINE 0x418C /* (ro) HP state machine */
  1098. #define REG_HP_STATUS0 0x4190 /* (ro) HP status 1 */
  1099. #define HP_STATUS0_SAP_MASK 0xFFFF0000 /* SAP */
  1100. #define HP_STATUS0_L3_OFF_MASK 0x0000FE00 /* L3 offset */
  1101. #define HP_STATUS0_LB_CPUNUM_MASK 0x000001F8 /* load balancing CPU
  1102. number */
  1103. #define HP_STATUS0_HRP_OPCODE_MASK 0x00000007 /* HRP opcode */
  1104. #define REG_HP_STATUS1 0x4194 /* (ro) HP status 2 */
  1105. #define HP_STATUS1_ACCUR2_MASK 0xE0000000 /* accu R2[6:4] */
  1106. #define HP_STATUS1_FLOWID_MASK 0x1F800000 /* flow id */
  1107. #define HP_STATUS1_TCP_OFF_MASK 0x007F0000 /* tcp payload offset */
  1108. #define HP_STATUS1_TCP_SIZE_MASK 0x0000FFFF /* tcp payload size */
  1109. #define REG_HP_STATUS2 0x4198 /* (ro) HP status 3 */
  1110. #define HP_STATUS2_ACCUR2_MASK 0xF0000000 /* accu R2[3:0] */
  1111. #define HP_STATUS2_CSUM_OFF_MASK 0x07F00000 /* checksum start
  1112. start offset */
  1113. #define HP_STATUS2_ACCUR1_MASK 0x000FE000 /* accu R1 */
  1114. #define HP_STATUS2_FORCE_DROP 0x00001000 /* force drop */
  1115. #define HP_STATUS2_BWO_REASSM 0x00000800 /* batching w/o
  1116. reassembly */
  1117. #define HP_STATUS2_JH_SPLIT_EN 0x00000400 /* jumbo header split
  1118. enable */
  1119. #define HP_STATUS2_FORCE_TCP_NOCHECK 0x00000200 /* force tcp no payload
  1120. check */
  1121. #define HP_STATUS2_DATA_MASK_ZERO 0x00000100 /* mask of data length
  1122. equal to zero */
  1123. #define HP_STATUS2_FORCE_TCP_CHECK 0x00000080 /* force tcp payload
  1124. chk */
  1125. #define HP_STATUS2_MASK_TCP_THRESH 0x00000040 /* mask of payload
  1126. threshold */
  1127. #define HP_STATUS2_NO_ASSIST 0x00000020 /* no assist */
  1128. #define HP_STATUS2_CTRL_PACKET_FLAG 0x00000010 /* control packet flag */
  1129. #define HP_STATUS2_TCP_FLAG_CHECK 0x00000008 /* tcp flag check */
  1130. #define HP_STATUS2_SYN_FLAG 0x00000004 /* syn flag */
  1131. #define HP_STATUS2_TCP_CHECK 0x00000002 /* tcp payload chk */
  1132. #define HP_STATUS2_TCP_NOCHECK 0x00000001 /* tcp no payload chk */
  1133. /* BIST for header parser(HP) and flow database memories (FDBM). set _START
  1134. * to start BIST. controller clears _START on completion. _START can also
  1135. * be cleared to force termination of BIST. a bit set indicates that that
  1136. * memory passed its BIST.
  1137. */
  1138. #define REG_HP_RAM_BIST 0x419C /* HP RAM BIST reg */
  1139. #define HP_RAM_BIST_HP_DATA_PASS 0x80000000 /* HP data ram */
  1140. #define HP_RAM_BIST_HP_INSTR0_PASS 0x40000000 /* HP instr ram 0 */
  1141. #define HP_RAM_BIST_HP_INSTR1_PASS 0x20000000 /* HP instr ram 1 */
  1142. #define HP_RAM_BIST_HP_INSTR2_PASS 0x10000000 /* HP instr ram 2 */
  1143. #define HP_RAM_BIST_FDBM_AGE0_PASS 0x08000000 /* FDBM aging RAM0 */
  1144. #define HP_RAM_BIST_FDBM_AGE1_PASS 0x04000000 /* FDBM aging RAM1 */
  1145. #define HP_RAM_BIST_FDBM_FLOWID00_PASS 0x02000000 /* FDBM flowid RAM0
  1146. bank 0 */
  1147. #define HP_RAM_BIST_FDBM_FLOWID10_PASS 0x01000000 /* FDBM flowid RAM1
  1148. bank 0 */
  1149. #define HP_RAM_BIST_FDBM_FLOWID20_PASS 0x00800000 /* FDBM flowid RAM2
  1150. bank 0 */
  1151. #define HP_RAM_BIST_FDBM_FLOWID30_PASS 0x00400000 /* FDBM flowid RAM3
  1152. bank 0 */
  1153. #define HP_RAM_BIST_FDBM_FLOWID01_PASS 0x00200000 /* FDBM flowid RAM0
  1154. bank 1 */
  1155. #define HP_RAM_BIST_FDBM_FLOWID11_PASS 0x00100000 /* FDBM flowid RAM1
  1156. bank 2 */
  1157. #define HP_RAM_BIST_FDBM_FLOWID21_PASS 0x00080000 /* FDBM flowid RAM2
  1158. bank 1 */
  1159. #define HP_RAM_BIST_FDBM_FLOWID31_PASS 0x00040000 /* FDBM flowid RAM3
  1160. bank 1 */
  1161. #define HP_RAM_BIST_FDBM_TCPSEQ_PASS 0x00020000 /* FDBM tcp sequence
  1162. RAM */
  1163. #define HP_RAM_BIST_SUMMARY 0x00000002 /* all BIST tests */
  1164. #define HP_RAM_BIST_START 0x00000001 /* start/stop BIST */
  1165. /** MAC registers. **/
  1166. /* reset bits are set using a PIO write and self-cleared after the command
  1167. * execution has completed.
  1168. */
  1169. #define REG_MAC_TX_RESET 0x6000 /* TX MAC software reset
  1170. command (default: 0x0) */
  1171. #define REG_MAC_RX_RESET 0x6004 /* RX MAC software reset
  1172. command (default: 0x0) */
  1173. /* execute a pause flow control frame transmission
  1174. DEFAULT: 0x0XXXX */
  1175. #define REG_MAC_SEND_PAUSE 0x6008 /* send pause command reg */
  1176. #define MAC_SEND_PAUSE_TIME_MASK 0x0000FFFF /* value of pause time
  1177. to be sent on network
  1178. in units of slot
  1179. times */
  1180. #define MAC_SEND_PAUSE_SEND 0x00010000 /* send pause flow ctrl
  1181. frame on network */
  1182. /* bit set indicates that event occurred. auto-cleared when status register
  1183. * is read and have corresponding mask bits in mask register. events will
  1184. * trigger an interrupt if the corresponding mask bit is 0.
  1185. * status register default: 0x00000000
  1186. * mask register default = 0xFFFFFFFF on reset
  1187. */
  1188. #define REG_MAC_TX_STATUS 0x6010 /* TX MAC status reg */
  1189. #define MAC_TX_FRAME_XMIT 0x0001 /* successful frame
  1190. transmision */
  1191. #define MAC_TX_UNDERRUN 0x0002 /* terminated frame
  1192. transmission due to
  1193. data starvation in the
  1194. xmit data path */
  1195. #define MAC_TX_MAX_PACKET_ERR 0x0004 /* frame exceeds max allowed
  1196. length passed to TX MAC
  1197. by the DMA engine */
  1198. #define MAC_TX_COLL_NORMAL 0x0008 /* rollover of the normal
  1199. collision counter */
  1200. #define MAC_TX_COLL_EXCESS 0x0010 /* rollover of the excessive
  1201. collision counter */
  1202. #define MAC_TX_COLL_LATE 0x0020 /* rollover of the late
  1203. collision counter */
  1204. #define MAC_TX_COLL_FIRST 0x0040 /* rollover of the first
  1205. collision counter */
  1206. #define MAC_TX_DEFER_TIMER 0x0080 /* rollover of the defer
  1207. timer */
  1208. #define MAC_TX_PEAK_ATTEMPTS 0x0100 /* rollover of the peak
  1209. attempts counter */
  1210. #define REG_MAC_RX_STATUS 0x6014 /* RX MAC status reg */
  1211. #define MAC_RX_FRAME_RECV 0x0001 /* successful receipt of
  1212. a frame */
  1213. #define MAC_RX_OVERFLOW 0x0002 /* dropped frame due to
  1214. RX FIFO overflow */
  1215. #define MAC_RX_FRAME_COUNT 0x0004 /* rollover of receive frame
  1216. counter */
  1217. #define MAC_RX_ALIGN_ERR 0x0008 /* rollover of alignment
  1218. error counter */
  1219. #define MAC_RX_CRC_ERR 0x0010 /* rollover of crc error
  1220. counter */
  1221. #define MAC_RX_LEN_ERR 0x0020 /* rollover of length
  1222. error counter */
  1223. #define MAC_RX_VIOL_ERR 0x0040 /* rollover of code
  1224. violation error */
  1225. /* DEFAULT: 0xXXXX0000 on reset */
  1226. #define REG_MAC_CTRL_STATUS 0x6018 /* MAC control status reg */
  1227. #define MAC_CTRL_PAUSE_RECEIVED 0x00000001 /* successful
  1228. reception of a
  1229. pause control
  1230. frame */
  1231. #define MAC_CTRL_PAUSE_STATE 0x00000002 /* MAC has made a
  1232. transition from
  1233. "not paused" to
  1234. "paused" */
  1235. #define MAC_CTRL_NOPAUSE_STATE 0x00000004 /* MAC has made a
  1236. transition from
  1237. "paused" to "not
  1238. paused" */
  1239. #define MAC_CTRL_PAUSE_TIME_MASK 0xFFFF0000 /* value of pause time
  1240. operand that was
  1241. received in the last
  1242. pause flow control
  1243. frame */
  1244. /* layout identical to TX MAC[8:0] */
  1245. #define REG_MAC_TX_MASK 0x6020 /* TX MAC mask reg */
  1246. /* layout identical to RX MAC[6:0] */
  1247. #define REG_MAC_RX_MASK 0x6024 /* RX MAC mask reg */
  1248. /* layout identical to CTRL MAC[2:0] */
  1249. #define REG_MAC_CTRL_MASK 0x6028 /* MAC control mask reg */
  1250. /* to ensure proper operation, CFG_EN must be cleared to 0 and a delay
  1251. * imposed before writes to other bits in the TX_MAC_CFG register or any of
  1252. * the MAC parameters is performed. delay dependent upon time required to
  1253. * transmit a maximum size frame (= MAC_FRAMESIZE_MAX*8/Mbps). e.g.,
  1254. * the delay for a 1518-byte frame on a 100Mbps network is 125us.
  1255. * alternatively, just poll TX_CFG_EN until it reads back as 0.
  1256. * NOTE: on half-duplex 1Gbps, TX_CFG_CARRIER_EXTEND and
  1257. * RX_CFG_CARRIER_EXTEND should be set and the SLOT_TIME register should
  1258. * be 0x200 (slot time of 512 bytes)
  1259. */
  1260. #define REG_MAC_TX_CFG 0x6030 /* TX MAC config reg */
  1261. #define MAC_TX_CFG_EN 0x0001 /* enable TX MAC. 0 will
  1262. force TXMAC state
  1263. machine to remain in
  1264. idle state or to
  1265. transition to idle state
  1266. on completion of an
  1267. ongoing packet. */
  1268. #define MAC_TX_CFG_IGNORE_CARRIER 0x0002 /* disable CSMA/CD deferral
  1269. process. set to 1 when
  1270. full duplex and 0 when
  1271. half duplex */
  1272. #define MAC_TX_CFG_IGNORE_COLL 0x0004 /* disable CSMA/CD backoff
  1273. algorithm. set to 1 when
  1274. full duplex and 0 when
  1275. half duplex */
  1276. #define MAC_TX_CFG_IPG_EN 0x0008 /* enable extension of the
  1277. Rx-to-TX IPG. after
  1278. receiving a frame, TX
  1279. MAC will reset its
  1280. deferral process to
  1281. carrier sense for the
  1282. amount of time = IPG0 +
  1283. IPG1 and commit to
  1284. transmission for time
  1285. specified in IPG2. when
  1286. 0 or when xmitting frames
  1287. back-to-pack (Tx-to-Tx
  1288. IPG), TX MAC ignores
  1289. IPG0 and will only use
  1290. IPG1 for deferral time.
  1291. IPG2 still used. */
  1292. #define MAC_TX_CFG_NEVER_GIVE_UP_EN 0x0010 /* TX MAC will not easily
  1293. give up on frame
  1294. xmission. if backoff
  1295. algorithm reaches the
  1296. ATTEMPT_LIMIT, it will
  1297. clear attempts counter
  1298. and continue trying to
  1299. send the frame as
  1300. specified by
  1301. GIVE_UP_LIM. when 0,
  1302. TX MAC will execute
  1303. standard CSMA/CD prot. */
  1304. #define MAC_TX_CFG_NEVER_GIVE_UP_LIM 0x0020 /* when set, TX MAC will
  1305. continue to try to xmit
  1306. until successful. when
  1307. 0, TX MAC will continue
  1308. to try xmitting until
  1309. successful or backoff
  1310. algorithm reaches
  1311. ATTEMPT_LIMIT*16 */
  1312. #define MAC_TX_CFG_NO_BACKOFF 0x0040 /* modify CSMA/CD to disable
  1313. backoff algorithm. TX
  1314. MAC will not back off
  1315. after a xmission attempt
  1316. that resulted in a
  1317. collision. */
  1318. #define MAC_TX_CFG_SLOW_DOWN 0x0080 /* modify CSMA/CD so that
  1319. deferral process is reset
  1320. in response to carrier
  1321. sense during the entire
  1322. duration of IPG. TX MAC
  1323. will only commit to frame
  1324. xmission after frame
  1325. xmission has actually
  1326. begun. */
  1327. #define MAC_TX_CFG_NO_FCS 0x0100 /* TX MAC will not generate
  1328. CRC for all xmitted
  1329. packets. when clear, CRC
  1330. generation is dependent
  1331. upon NO_CRC bit in the
  1332. xmit control word from
  1333. TX DMA */
  1334. #define MAC_TX_CFG_CARRIER_EXTEND 0x0200 /* enables xmit part of the
  1335. carrier extension
  1336. feature. this allows for
  1337. longer collision domains
  1338. by extending the carrier
  1339. and collision window
  1340. from the end of FCS until
  1341. the end of the slot time
  1342. if necessary. Required
  1343. for half-duplex at 1Gbps,
  1344. clear otherwise. */
  1345. /* when CRC is not stripped, reassembly packets will not contain the CRC.
  1346. * these will be stripped by HRP because it reassembles layer 4 data, and the
  1347. * CRC is layer 2. however, non-reassembly packets will still contain the CRC
  1348. * when passed to the host. to ensure proper operation, need to wait 3.2ms
  1349. * after clearing RX_CFG_EN before writing to any other RX MAC registers
  1350. * or other MAC parameters. alternatively, poll RX_CFG_EN until it clears
  1351. * to 0. similary, HASH_FILTER_EN and ADDR_FILTER_EN have the same
  1352. * restrictions as CFG_EN.
  1353. */
  1354. #define REG_MAC_RX_CFG 0x6034 /* RX MAC config reg */
  1355. #define MAC_RX_CFG_EN 0x0001 /* enable RX MAC */
  1356. #define MAC_RX_CFG_STRIP_PAD 0x0002 /* always program to 0.
  1357. feature not supported */
  1358. #define MAC_RX_CFG_STRIP_FCS 0x0004 /* RX MAC will strip the
  1359. last 4 bytes of a
  1360. received frame. */
  1361. #define MAC_RX_CFG_PROMISC_EN 0x0008 /* promiscuous mode */
  1362. #define MAC_RX_CFG_PROMISC_GROUP_EN 0x0010 /* accept all valid
  1363. multicast frames (group
  1364. bit in DA field set) */
  1365. #define MAC_RX_CFG_HASH_FILTER_EN 0x0020 /* use hash table to filter
  1366. multicast addresses */
  1367. #define MAC_RX_CFG_ADDR_FILTER_EN 0x0040 /* cause RX MAC to use
  1368. address filtering regs
  1369. to filter both unicast
  1370. and multicast
  1371. addresses */
  1372. #define MAC_RX_CFG_DISABLE_DISCARD 0x0080 /* pass errored frames to
  1373. RX DMA by setting BAD
  1374. bit but not Abort bit
  1375. in the status. CRC,
  1376. framing, and length errs
  1377. will not increment
  1378. error counters. frames
  1379. which don't match dest
  1380. addr will be passed up
  1381. w/ BAD bit set. */
  1382. #define MAC_RX_CFG_CARRIER_EXTEND 0x0100 /* enable reception of
  1383. packet bursts generated
  1384. by carrier extension
  1385. with packet bursting
  1386. senders. only applies
  1387. to half-duplex 1Gbps */
  1388. /* DEFAULT: 0x0 */
  1389. #define REG_MAC_CTRL_CFG 0x6038 /* MAC control config reg */
  1390. #define MAC_CTRL_CFG_SEND_PAUSE_EN 0x0001 /* respond to requests for
  1391. sending pause flow ctrl
  1392. frames */
  1393. #define MAC_CTRL_CFG_RECV_PAUSE_EN 0x0002 /* respond to received
  1394. pause flow ctrl frames */
  1395. #define MAC_CTRL_CFG_PASS_CTRL 0x0004 /* pass valid MAC ctrl
  1396. packets to RX DMA */
  1397. /* to ensure proper operation, a global initialization sequence should be
  1398. * performed when a loopback config is entered or exited. if programmed after
  1399. * a hw or global sw reset, RX/TX MAC software reset and initialization
  1400. * should be done to ensure stable clocking.
  1401. * DEFAULT: 0x0
  1402. */
  1403. #define REG_MAC_XIF_CFG 0x603C /* XIF config reg */
  1404. #define MAC_XIF_TX_MII_OUTPUT_EN 0x0001 /* enable output drivers
  1405. on MII xmit bus */
  1406. #define MAC_XIF_MII_INT_LOOPBACK 0x0002 /* loopback GMII xmit data
  1407. path to GMII recv data
  1408. path. phy mode register
  1409. clock selection must be
  1410. set to GMII mode and
  1411. GMII_MODE should be set
  1412. to 1. in loopback mode,
  1413. REFCLK will drive the
  1414. entire mac core. 0 for
  1415. normal operation. */
  1416. #define MAC_XIF_DISABLE_ECHO 0x0004 /* disables receive data
  1417. path during packet
  1418. xmission. clear to 0
  1419. in any full duplex mode,
  1420. in any loopback mode,
  1421. or in half-duplex SERDES
  1422. or SLINK modes. set when
  1423. in half-duplex when
  1424. using external phy. */
  1425. #define MAC_XIF_GMII_MODE 0x0008 /* MAC operates with GMII
  1426. clocks and datapath */
  1427. #define MAC_XIF_MII_BUFFER_OUTPUT_EN 0x0010 /* MII_BUF_EN pin. enable
  1428. external tristate buffer
  1429. on the MII receive
  1430. bus. */
  1431. #define MAC_XIF_LINK_LED 0x0020 /* LINKLED# active (low) */
  1432. #define MAC_XIF_FDPLX_LED 0x0040 /* FDPLXLED# active (low) */
  1433. #define REG_MAC_IPG0 0x6040 /* inter-packet gap0 reg.
  1434. recommended: 0x00 */
  1435. #define REG_MAC_IPG1 0x6044 /* inter-packet gap1 reg
  1436. recommended: 0x08 */
  1437. #define REG_MAC_IPG2 0x6048 /* inter-packet gap2 reg
  1438. recommended: 0x04 */
  1439. #define REG_MAC_SLOT_TIME 0x604C /* slot time reg
  1440. recommended: 0x40 */
  1441. #define REG_MAC_FRAMESIZE_MIN 0x6050 /* min frame size reg
  1442. recommended: 0x40 */
  1443. /* FRAMESIZE_MAX holds both the max frame size as well as the max burst size.
  1444. * recommended value: 0x2000.05EE
  1445. */
  1446. #define REG_MAC_FRAMESIZE_MAX 0x6054 /* max frame size reg */
  1447. #define MAC_FRAMESIZE_MAX_BURST_MASK 0x3FFF0000 /* max burst size */
  1448. #define MAC_FRAMESIZE_MAX_BURST_SHIFT 16
  1449. #define MAC_FRAMESIZE_MAX_FRAME_MASK 0x00007FFF /* max frame size */
  1450. #define MAC_FRAMESIZE_MAX_FRAME_SHIFT 0
  1451. #define REG_MAC_PA_SIZE 0x6058 /* PA size reg. number of
  1452. preamble bytes that the
  1453. TX MAC will xmit at the
  1454. beginning of each frame
  1455. value should be 2 or
  1456. greater. recommended
  1457. value: 0x07 */
  1458. #define REG_MAC_JAM_SIZE 0x605C /* jam size reg. duration
  1459. of jam in units of media
  1460. byte time. recommended
  1461. value: 0x04 */
  1462. #define REG_MAC_ATTEMPT_LIMIT 0x6060 /* attempt limit reg. #
  1463. of attempts TX MAC will
  1464. make to xmit a frame
  1465. before it resets its
  1466. attempts counter. after
  1467. the limit has been
  1468. reached, TX MAC may or
  1469. may not drop the frame
  1470. dependent upon value
  1471. in TX_MAC_CFG.
  1472. recommended
  1473. value: 0x10 */
  1474. #define REG_MAC_CTRL_TYPE 0x6064 /* MAC control type reg.
  1475. type field of a MAC
  1476. ctrl frame. recommended
  1477. value: 0x8808 */
  1478. /* mac address registers: 0 - 44, 0x6080 - 0x6130, 4 8-bit bytes.
  1479. * register contains comparison
  1480. * 0 16 MSB of primary MAC addr [47:32] of DA field
  1481. * 1 16 middle bits "" [31:16] of DA field
  1482. * 2 16 LSB "" [15:0] of DA field
  1483. * 3*x 16MSB of alt MAC addr 1-15 [47:32] of DA field
  1484. * 4*x 16 middle bits "" [31:16]
  1485. * 5*x 16 LSB "" [15:0]
  1486. * 42 16 MSB of MAC CTRL addr [47:32] of DA.
  1487. * 43 16 middle bits "" [31:16]
  1488. * 44 16 LSB "" [15:0]
  1489. * MAC CTRL addr must be the reserved multicast addr for MAC CTRL frames.
  1490. * if there is a match, MAC will set the bit for alternative address
  1491. * filter pass [15]
  1492. * here is the map of registers given MAC address notation: a:b:c:d:e:f
  1493. * ab cd ef
  1494. * primary addr reg 2 reg 1 reg 0
  1495. * alt addr 1 reg 5 reg 4 reg 3
  1496. * alt addr x reg 5*x reg 4*x reg 3*x
  1497. * ctrl addr reg 44 reg 43 reg 42
  1498. */
  1499. #define REG_MAC_ADDR0 0x6080 /* MAC address 0 reg */
  1500. #define REG_MAC_ADDRN(x) (REG_MAC_ADDR0 + (x)*4)
  1501. #define REG_MAC_ADDR_FILTER0 0x614C /* address filter 0 reg
  1502. [47:32] */
  1503. #define REG_MAC_ADDR_FILTER1 0x6150 /* address filter 1 reg
  1504. [31:16] */
  1505. #define REG_MAC_ADDR_FILTER2 0x6154 /* address filter 2 reg
  1506. [15:0] */
  1507. #define REG_MAC_ADDR_FILTER2_1_MASK 0x6158 /* address filter 2 and 1
  1508. mask reg. 8-bit reg
  1509. contains nibble mask for
  1510. reg 2 and 1. */
  1511. #define REG_MAC_ADDR_FILTER0_MASK 0x615C /* address filter 0 mask
  1512. reg */
  1513. /* hash table registers: 0 - 15, 0x6160 - 0x619C, 4 8-bit bytes
  1514. * 16-bit registers contain bits of the hash table.
  1515. * reg x -> [16*(15 - x) + 15 : 16*(15 - x)].
  1516. * e.g., 15 -> [15:0], 0 -> [255:240]
  1517. */
  1518. #define REG_MAC_HASH_TABLE0 0x6160 /* hash table 0 reg */
  1519. #define REG_MAC_HASH_TABLEN(x) (REG_MAC_HASH_TABLE0 + (x)*4)
  1520. /* statistics registers. these registers generate an interrupt on
  1521. * overflow. recommended initialization: 0x0000. most are 16-bits except
  1522. * for PEAK_ATTEMPTS register which is 8 bits.
  1523. */
  1524. #define REG_MAC_COLL_NORMAL 0x61A0 /* normal collision
  1525. counter. */
  1526. #define REG_MAC_COLL_FIRST 0x61A4 /* first attempt
  1527. successful collision
  1528. counter */
  1529. #define REG_MAC_COLL_EXCESS 0x61A8 /* excessive collision
  1530. counter */
  1531. #define REG_MAC_COLL_LATE 0x61AC /* late collision counter */
  1532. #define REG_MAC_TIMER_DEFER 0x61B0 /* defer timer. time base
  1533. is the media byte
  1534. clock/256 */
  1535. #define REG_MAC_ATTEMPTS_PEAK 0x61B4 /* peak attempts reg */
  1536. #define REG_MAC_RECV_FRAME 0x61B8 /* receive frame counter */
  1537. #define REG_MAC_LEN_ERR 0x61BC /* length error counter */
  1538. #define REG_MAC_ALIGN_ERR 0x61C0 /* alignment error counter */
  1539. #define REG_MAC_FCS_ERR 0x61C4 /* FCS error counter */
  1540. #define REG_MAC_RX_CODE_ERR 0x61C8 /* RX code violation
  1541. error counter */
  1542. /* misc registers */
  1543. #define REG_MAC_RANDOM_SEED 0x61CC /* random number seed reg.
  1544. 10-bit register used as a
  1545. seed for the random number
  1546. generator for the CSMA/CD
  1547. backoff algorithm. only
  1548. programmed after power-on
  1549. reset and should be a
  1550. random value which has a
  1551. high likelihood of being
  1552. unique for each MAC
  1553. attached to a network
  1554. segment (e.g., 10 LSB of
  1555. MAC address) */
  1556. /* ASUN: there's a PAUSE_TIMER (ro) described, but it's not in the address
  1557. * map
  1558. */
  1559. /* 27-bit register has the current state for key state machines in the MAC */
  1560. #define REG_MAC_STATE_MACHINE 0x61D0 /* (ro) state machine reg */
  1561. #define MAC_SM_RLM_MASK 0x07800000
  1562. #define MAC_SM_RLM_SHIFT 23
  1563. #define MAC_SM_RX_FC_MASK 0x00700000
  1564. #define MAC_SM_RX_FC_SHIFT 20
  1565. #define MAC_SM_TLM_MASK 0x000F0000
  1566. #define MAC_SM_TLM_SHIFT 16
  1567. #define MAC_SM_ENCAP_SM_MASK 0x0000F000
  1568. #define MAC_SM_ENCAP_SM_SHIFT 12
  1569. #define MAC_SM_TX_REQ_MASK 0x00000C00
  1570. #define MAC_SM_TX_REQ_SHIFT 10
  1571. #define MAC_SM_TX_FC_MASK 0x000003C0
  1572. #define MAC_SM_TX_FC_SHIFT 6
  1573. #define MAC_SM_FIFO_WRITE_SEL_MASK 0x00000038
  1574. #define MAC_SM_FIFO_WRITE_SEL_SHIFT 3
  1575. #define MAC_SM_TX_FIFO_EMPTY_MASK 0x00000007
  1576. #define MAC_SM_TX_FIFO_EMPTY_SHIFT 0
  1577. /** MIF registers. the MIF can be programmed in either bit-bang or
  1578. * frame mode.
  1579. **/
  1580. #define REG_MIF_BIT_BANG_CLOCK 0x6200 /* MIF bit-bang clock.
  1581. 1 -> 0 will generate a
  1582. rising edge. 0 -> 1 will
  1583. generate a falling edge. */
  1584. #define REG_MIF_BIT_BANG_DATA 0x6204 /* MIF bit-bang data. 1-bit
  1585. register generates data */
  1586. #define REG_MIF_BIT_BANG_OUTPUT_EN 0x6208 /* MIF bit-bang output
  1587. enable. enable when
  1588. xmitting data from MIF to
  1589. transceiver. */
  1590. /* 32-bit register serves as an instruction register when the MIF is
  1591. * programmed in frame mode. load this register w/ a valid instruction
  1592. * (as per IEEE 802.3u MII spec). poll this register to check for instruction
  1593. * execution completion. during a read operation, this register will also
  1594. * contain the 16-bit data returned by the tranceiver. unless specified
  1595. * otherwise, fields are considered "don't care" when polling for
  1596. * completion.
  1597. */
  1598. #define REG_MIF_FRAME 0x620C /* MIF frame/output reg */
  1599. #define MIF_FRAME_START_MASK 0xC0000000 /* start of frame.
  1600. load w/ 01 when
  1601. issuing an instr */
  1602. #define MIF_FRAME_ST 0x40000000 /* STart of frame */
  1603. #define MIF_FRAME_OPCODE_MASK 0x30000000 /* opcode. 01 for a
  1604. write. 10 for a
  1605. read */
  1606. #define MIF_FRAME_OP_READ 0x20000000 /* read OPcode */
  1607. #define MIF_FRAME_OP_WRITE 0x10000000 /* write OPcode */
  1608. #define MIF_FRAME_PHY_ADDR_MASK 0x0F800000 /* phy address. when
  1609. issuing an instr,
  1610. this field should be
  1611. loaded w/ the XCVR
  1612. addr */
  1613. #define MIF_FRAME_PHY_ADDR_SHIFT 23
  1614. #define MIF_FRAME_REG_ADDR_MASK 0x007C0000 /* register address.
  1615. when issuing an instr,
  1616. addr of register
  1617. to be read/written */
  1618. #define MIF_FRAME_REG_ADDR_SHIFT 18
  1619. #define MIF_FRAME_TURN_AROUND_MSB 0x00020000 /* turn around, MSB.
  1620. when issuing an instr,
  1621. set this bit to 1 */
  1622. #define MIF_FRAME_TURN_AROUND_LSB 0x00010000 /* turn around, LSB.
  1623. when issuing an instr,
  1624. set this bit to 0.
  1625. when polling for
  1626. completion, 1 means
  1627. that instr execution
  1628. has been completed */
  1629. #define MIF_FRAME_DATA_MASK 0x0000FFFF /* instruction payload
  1630. load with 16-bit data
  1631. to be written in
  1632. transceiver reg for a
  1633. write. doesn't matter
  1634. in a read. when
  1635. polling for
  1636. completion, field is
  1637. "don't care" for write
  1638. and 16-bit data
  1639. returned by the
  1640. transceiver for a
  1641. read (if valid bit
  1642. is set) */
  1643. #define REG_MIF_CFG 0x6210 /* MIF config reg */
  1644. #define MIF_CFG_PHY_SELECT 0x0001 /* 1 -> select MDIO_1
  1645. 0 -> select MDIO_0 */
  1646. #define MIF_CFG_POLL_EN 0x0002 /* enable polling
  1647. mechanism. if set,
  1648. BB_MODE should be 0 */
  1649. #define MIF_CFG_BB_MODE 0x0004 /* 1 -> bit-bang mode
  1650. 0 -> frame mode */
  1651. #define MIF_CFG_POLL_REG_MASK 0x00F8 /* register address to be
  1652. used by polling mode.
  1653. only meaningful if POLL_EN
  1654. is set to 1 */
  1655. #define MIF_CFG_POLL_REG_SHIFT 3
  1656. #define MIF_CFG_MDIO_0 0x0100 /* (ro) dual purpose.
  1657. when MDIO_0 is idle,
  1658. 1 -> tranceiver is
  1659. connected to MDIO_0.
  1660. when MIF is communicating
  1661. w/ MDIO_0 in bit-bang
  1662. mode, this bit indicates
  1663. the incoming bit stream
  1664. during a read op */
  1665. #define MIF_CFG_MDIO_1 0x0200 /* (ro) dual purpose.
  1666. when MDIO_1 is idle,
  1667. 1 -> transceiver is
  1668. connected to MDIO_1.
  1669. when MIF is communicating
  1670. w/ MDIO_1 in bit-bang
  1671. mode, this bit indicates
  1672. the incoming bit stream
  1673. during a read op */
  1674. #define MIF_CFG_POLL_PHY_MASK 0x7C00 /* tranceiver address to
  1675. be polled */
  1676. #define MIF_CFG_POLL_PHY_SHIFT 10
  1677. /* 16-bit register used to determine which bits in the POLL_STATUS portion of
  1678. * the MIF_STATUS register will cause an interrupt. if a mask bit is 0,
  1679. * corresponding bit of the POLL_STATUS will generate a MIF interrupt when
  1680. * set. DEFAULT: 0xFFFF
  1681. */
  1682. #define REG_MIF_MASK 0x6214 /* MIF mask reg */
  1683. /* 32-bit register used when in poll mode. auto-cleared after being read */
  1684. #define REG_MIF_STATUS 0x6218 /* MIF status reg */
  1685. #define MIF_STATUS_POLL_DATA_MASK 0xFFFF0000 /* poll data contains
  1686. the "latest image"
  1687. update of the XCVR
  1688. reg being read */
  1689. #define MIF_STATUS_POLL_DATA_SHIFT 16
  1690. #define MIF_STATUS_POLL_STATUS_MASK 0x0000FFFF /* poll status indicates
  1691. which bits in the
  1692. POLL_DATA field have
  1693. changed since the
  1694. MIF_STATUS reg was
  1695. last read */
  1696. #define MIF_STATUS_POLL_STATUS_SHIFT 0
  1697. /* 7-bit register has current state for all state machines in the MIF */
  1698. #define REG_MIF_STATE_MACHINE 0x621C /* MIF state machine reg */
  1699. #define MIF_SM_CONTROL_MASK 0x07 /* control state machine
  1700. state */
  1701. #define MIF_SM_EXECUTION_MASK 0x60 /* execution state machine
  1702. state */
  1703. /** PCS/Serialink. the following registers are equivalent to the standard
  1704. * MII management registers except that they're directly mapped in
  1705. * Cassini's register space.
  1706. **/
  1707. /* the auto-negotiation enable bit should be programmed the same at
  1708. * the link partner as in the local device to enable auto-negotiation to
  1709. * complete. when that bit is reprogrammed, auto-neg/manual config is
  1710. * restarted automatically.
  1711. * DEFAULT: 0x1040
  1712. */
  1713. #define REG_PCS_MII_CTRL 0x9000 /* PCS MII control reg */
  1714. #define PCS_MII_CTRL_1000_SEL 0x0040 /* reads 1. ignored on
  1715. writes */
  1716. #define PCS_MII_CTRL_COLLISION_TEST 0x0080 /* COL signal at the PCS
  1717. to MAC interface is
  1718. activated regardless
  1719. of activity */
  1720. #define PCS_MII_CTRL_DUPLEX 0x0100 /* forced 0x0. PCS
  1721. behaviour same for
  1722. half and full dplx */
  1723. #define PCS_MII_RESTART_AUTONEG 0x0200 /* self clearing.
  1724. restart auto-
  1725. negotiation */
  1726. #define PCS_MII_ISOLATE 0x0400 /* read as 0. ignored
  1727. on writes */
  1728. #define PCS_MII_POWER_DOWN 0x0800 /* read as 0. ignored
  1729. on writes */
  1730. #define PCS_MII_AUTONEG_EN 0x1000 /* default 1. PCS goes
  1731. through automatic
  1732. link config before it
  1733. can be used. when 0,
  1734. link can be used
  1735. w/out any link config
  1736. phase */
  1737. #define PCS_MII_10_100_SEL 0x2000 /* read as 0. ignored on
  1738. writes */
  1739. #define PCS_MII_RESET 0x8000 /* reset PCS. self-clears
  1740. when done */
  1741. /* DEFAULT: 0x0108 */
  1742. #define REG_PCS_MII_STATUS 0x9004 /* PCS MII status reg */
  1743. #define PCS_MII_STATUS_EXTEND_CAP 0x0001 /* reads 0 */
  1744. #define PCS_MII_STATUS_JABBER_DETECT 0x0002 /* reads 0 */
  1745. #define PCS_MII_STATUS_LINK_STATUS 0x0004 /* 1 -> link up.
  1746. 0 -> link down. 0 is
  1747. latched so that 0 is
  1748. kept until read. read
  1749. 2x to determine if the
  1750. link has gone up again */
  1751. #define PCS_MII_STATUS_AUTONEG_ABLE 0x0008 /* reads 1 (able to perform
  1752. auto-neg) */
  1753. #define PCS_MII_STATUS_REMOTE_FAULT 0x0010 /* 1 -> remote fault detected
  1754. from received link code
  1755. word. only valid after
  1756. auto-neg completed */
  1757. #define PCS_MII_STATUS_AUTONEG_COMP 0x0020 /* 1 -> auto-negotiation
  1758. completed
  1759. 0 -> auto-negotiation not
  1760. completed */
  1761. #define PCS_MII_STATUS_EXTEND_STATUS 0x0100 /* reads as 1. used as an
  1762. indication that this is
  1763. a 1000 Base-X PHY. writes
  1764. to it are ignored */
  1765. /* used during auto-negotiation.
  1766. * DEFAULT: 0x00E0
  1767. */
  1768. #define REG_PCS_MII_ADVERT 0x9008 /* PCS MII advertisement
  1769. reg */
  1770. #define PCS_MII_ADVERT_FD 0x0020 /* advertise full duplex
  1771. 1000 Base-X */
  1772. #define PCS_MII_ADVERT_HD 0x0040 /* advertise half-duplex
  1773. 1000 Base-X */
  1774. #define PCS_MII_ADVERT_SYM_PAUSE 0x0080 /* advertise PAUSE
  1775. symmetric capability */
  1776. #define PCS_MII_ADVERT_ASYM_PAUSE 0x0100 /* advertises PAUSE
  1777. asymmetric capability */
  1778. #define PCS_MII_ADVERT_RF_MASK 0x3000 /* remote fault. write bit13
  1779. to optionally indicate to
  1780. link partner that chip is
  1781. going off-line. bit12 will
  1782. get set when signal
  1783. detect == FAIL and will
  1784. remain set until
  1785. successful negotiation */
  1786. #define PCS_MII_ADVERT_ACK 0x4000 /* (ro) */
  1787. #define PCS_MII_ADVERT_NEXT_PAGE 0x8000 /* (ro) forced 0x0 */
  1788. /* contents updated as a result of autonegotiation. layout and definitions
  1789. * identical to PCS_MII_ADVERT
  1790. */
  1791. #define REG_PCS_MII_LPA 0x900C /* PCS MII link partner
  1792. ability reg */
  1793. #define PCS_MII_LPA_FD PCS_MII_ADVERT_FD
  1794. #define PCS_MII_LPA_HD PCS_MII_ADVERT_HD
  1795. #define PCS_MII_LPA_SYM_PAUSE PCS_MII_ADVERT_SYM_PAUSE
  1796. #define PCS_MII_LPA_ASYM_PAUSE PCS_MII_ADVERT_ASYM_PAUSE
  1797. #define PCS_MII_LPA_RF_MASK PCS_MII_ADVERT_RF_MASK
  1798. #define PCS_MII_LPA_ACK PCS_MII_ADVERT_ACK
  1799. #define PCS_MII_LPA_NEXT_PAGE PCS_MII_ADVERT_NEXT_PAGE
  1800. /* DEFAULT: 0x0 */
  1801. #define REG_PCS_CFG 0x9010 /* PCS config reg */
  1802. #define PCS_CFG_EN 0x01 /* enable PCS. must be
  1803. 0 when modifying
  1804. PCS_MII_ADVERT */
  1805. #define PCS_CFG_SD_OVERRIDE 0x02 /* sets signal detect to
  1806. OK. bit is
  1807. non-resettable */
  1808. #define PCS_CFG_SD_ACTIVE_LOW 0x04 /* changes interpretation
  1809. of optical signal to make
  1810. signal detect okay when
  1811. signal is low */
  1812. #define PCS_CFG_JITTER_STUDY_MASK 0x18 /* used to make jitter
  1813. measurements. a single
  1814. code group is xmitted
  1815. regularly.
  1816. 0x0 = normal operation
  1817. 0x1 = high freq test
  1818. pattern, D21.5
  1819. 0x2 = low freq test
  1820. pattern, K28.7
  1821. 0x3 = reserved */
  1822. #define PCS_CFG_10MS_TIMER_OVERRIDE 0x20 /* shortens 10-20ms auto-
  1823. negotiation timer to
  1824. a few cycles for test
  1825. purposes */
  1826. /* used for diagnostic purposes. bits 20-22 autoclear on read */
  1827. #define REG_PCS_STATE_MACHINE 0x9014 /* (ro) PCS state machine
  1828. and diagnostic reg */
  1829. #define PCS_SM_TX_STATE_MASK 0x0000000F /* 0 and 1 indicate
  1830. xmission of idle.
  1831. otherwise, xmission of
  1832. a packet */
  1833. #define PCS_SM_RX_STATE_MASK 0x000000F0 /* 0 indicates reception
  1834. of idle. otherwise,
  1835. reception of packet */
  1836. #define PCS_SM_WORD_SYNC_STATE_MASK 0x00000700 /* 0 indicates loss of
  1837. sync */
  1838. #define PCS_SM_SEQ_DETECT_STATE_MASK 0x00001800 /* cycling through 0-3
  1839. indicates reception of
  1840. Config codes. cycling
  1841. through 0-1 indicates
  1842. reception of idles */
  1843. #define PCS_SM_LINK_STATE_MASK 0x0001E000
  1844. #define SM_LINK_STATE_UP 0x00016000 /* link state is up */
  1845. #define PCS_SM_LOSS_LINK_C 0x00100000 /* loss of link due to
  1846. recept of Config
  1847. codes */
  1848. #define PCS_SM_LOSS_LINK_SYNC 0x00200000 /* loss of link due to
  1849. loss of sync */
  1850. #define PCS_SM_LOSS_SIGNAL_DETECT 0x00400000 /* signal detect goes
  1851. from OK to FAIL. bit29
  1852. will also be set if
  1853. this is set */
  1854. #define PCS_SM_NO_LINK_BREAKLINK 0x01000000 /* link not up due to
  1855. receipt of breaklink
  1856. C codes from partner.
  1857. C codes w/ 0 content
  1858. received triggering
  1859. start/restart of
  1860. autonegotiation.
  1861. should be sent for
  1862. no longer than 20ms */
  1863. #define PCS_SM_NO_LINK_SERDES 0x02000000 /* serdes being
  1864. initialized. see serdes
  1865. state reg */
  1866. #define PCS_SM_NO_LINK_C 0x04000000 /* C codes not stable or
  1867. not received */
  1868. #define PCS_SM_NO_LINK_SYNC 0x08000000 /* word sync not
  1869. achieved */
  1870. #define PCS_SM_NO_LINK_WAIT_C 0x10000000 /* waiting for C codes
  1871. w/ ack bit set */
  1872. #define PCS_SM_NO_LINK_NO_IDLE 0x20000000 /* link partner continues
  1873. to send C codes
  1874. instead of idle
  1875. symbols or pkt data */
  1876. /* this register indicates interrupt changes in specific PCS MII status bits.
  1877. * PCS_INT may be masked at the ISR level. only a single bit is implemented
  1878. * for link status change.
  1879. */
  1880. #define REG_PCS_INTR_STATUS 0x9018 /* PCS interrupt status */
  1881. #define PCS_INTR_STATUS_LINK_CHANGE 0x04 /* link status has changed
  1882. since last read */
  1883. /* control which network interface is used. no more than one bit should
  1884. * be set.
  1885. * DEFAULT: none
  1886. */
  1887. #define REG_PCS_DATAPATH_MODE 0x9050 /* datapath mode reg */
  1888. #define PCS_DATAPATH_MODE_MII 0x00 /* PCS is not used and
  1889. MII/GMII is selected.
  1890. selection between MII and
  1891. GMII is controlled by
  1892. XIF_CFG */
  1893. #define PCS_DATAPATH_MODE_SERDES 0x02 /* PCS is used via the
  1894. 10-bit interface */
  1895. /* input to serdes chip or serialink block */
  1896. #define REG_PCS_SERDES_CTRL 0x9054 /* serdes control reg */
  1897. #define PCS_SERDES_CTRL_LOOPBACK 0x01 /* enable loopback on
  1898. serdes interface */
  1899. #define PCS_SERDES_CTRL_SYNCD_EN 0x02 /* enable sync carrier
  1900. detection. should be
  1901. 0x0 for normal
  1902. operation */
  1903. #define PCS_SERDES_CTRL_LOCKREF 0x04 /* frequency-lock RBC[0:1]
  1904. to REFCLK when set.
  1905. when clear, receiver
  1906. clock locks to incoming
  1907. serial data */
  1908. /* multiplex test outputs into the PROM address (PA_3 through PA_0) pins.
  1909. * should be 0x0 for normal operations.
  1910. * 0b000 normal operation, PROM address[3:0] selected
  1911. * 0b001 rxdma req, rxdma ack, rxdma ready, rxdma read
  1912. * 0b010 rxmac req, rx ack, rx tag, rx clk shared
  1913. * 0b011 txmac req, tx ack, tx tag, tx retry req
  1914. * 0b100 tx tp3, tx tp2, tx tp1, tx tp0
  1915. * 0b101 R period RX, R period TX, R period HP, R period BIM
  1916. * DEFAULT: 0x0
  1917. */
  1918. #define REG_PCS_SHARED_OUTPUT_SEL 0x9058 /* shared output select */
  1919. #define PCS_SOS_PROM_ADDR_MASK 0x0007
  1920. /* used for diagnostics. this register indicates progress of the SERDES
  1921. * boot up.
  1922. * 0b00 undergoing reset
  1923. * 0b01 waiting 500us while lockrefn is asserted
  1924. * 0b10 waiting for comma detect
  1925. * 0b11 receive data is synchronized
  1926. * DEFAULT: 0x0
  1927. */
  1928. #define REG_PCS_SERDES_STATE 0x905C /* (ro) serdes state */
  1929. #define PCS_SERDES_STATE_MASK 0x03
  1930. /* used for diagnostics. indicates number of packets transmitted or received.
  1931. * counters rollover w/out generating an interrupt.
  1932. * DEFAULT: 0x0
  1933. */
  1934. #define REG_PCS_PACKET_COUNT 0x9060 /* (ro) PCS packet counter */
  1935. #define PCS_PACKET_COUNT_TX 0x000007FF /* pkts xmitted by PCS */
  1936. #define PCS_PACKET_COUNT_RX 0x07FF0000 /* pkts recvd by PCS
  1937. whether they
  1938. encountered an error
  1939. or not */
  1940. /** LocalBus Devices. the following provides run-time access to the
  1941. * Cassini's PROM
  1942. ***/
  1943. #define REG_EXPANSION_ROM_RUN_START 0x100000 /* expansion rom run time
  1944. access */
  1945. #define REG_EXPANSION_ROM_RUN_END 0x17FFFF
  1946. #define REG_SECOND_LOCALBUS_START 0x180000 /* secondary local bus
  1947. device */
  1948. #define REG_SECOND_LOCALBUS_END 0x1FFFFF
  1949. /* entropy device */
  1950. #define REG_ENTROPY_START REG_SECOND_LOCALBUS_START
  1951. #define REG_ENTROPY_DATA (REG_ENTROPY_START + 0x00)
  1952. #define REG_ENTROPY_STATUS (REG_ENTROPY_START + 0x04)
  1953. #define ENTROPY_STATUS_DRDY 0x01
  1954. #define ENTROPY_STATUS_BUSY 0x02
  1955. #define ENTROPY_STATUS_CIPHER 0x04
  1956. #define ENTROPY_STATUS_BYPASS_MASK 0x18
  1957. #define REG_ENTROPY_MODE (REG_ENTROPY_START + 0x05)
  1958. #define ENTROPY_MODE_KEY_MASK 0x07
  1959. #define ENTROPY_MODE_ENCRYPT 0x40
  1960. #define REG_ENTROPY_RAND_REG (REG_ENTROPY_START + 0x06)
  1961. #define REG_ENTROPY_RESET (REG_ENTROPY_START + 0x07)
  1962. #define ENTROPY_RESET_DES_IO 0x01
  1963. #define ENTROPY_RESET_STC_MODE 0x02
  1964. #define ENTROPY_RESET_KEY_CACHE 0x04
  1965. #define ENTROPY_RESET_IV 0x08
  1966. #define REG_ENTROPY_IV (REG_ENTROPY_START + 0x08)
  1967. #define REG_ENTROPY_KEY0 (REG_ENTROPY_START + 0x10)
  1968. #define REG_ENTROPY_KEYN(x) (REG_ENTROPY_KEY0 + 4*(x))
  1969. /* phys of interest w/ their special mii registers */
  1970. #define PHY_LUCENT_B0 0x00437421
  1971. #define LUCENT_MII_REG 0x1F
  1972. #define PHY_NS_DP83065 0x20005c78
  1973. #define DP83065_MII_MEM 0x16
  1974. #define DP83065_MII_REGD 0x1D
  1975. #define DP83065_MII_REGE 0x1E
  1976. #define PHY_BROADCOM_5411 0x00206071
  1977. #define PHY_BROADCOM_B0 0x00206050
  1978. #define BROADCOM_MII_REG4 0x14
  1979. #define BROADCOM_MII_REG5 0x15
  1980. #define BROADCOM_MII_REG7 0x17
  1981. #define BROADCOM_MII_REG8 0x18
  1982. #define CAS_MII_ANNPTR 0x07
  1983. #define CAS_MII_ANNPRR 0x08
  1984. #define CAS_MII_1000_CTRL 0x09
  1985. #define CAS_MII_1000_STATUS 0x0A
  1986. #define CAS_MII_1000_EXTEND 0x0F
  1987. #define CAS_BMSR_1000_EXTEND 0x0100 /* supports 1000Base-T extended status */
  1988. /*
  1989. * if autoneg is disabled, here's the table:
  1990. * BMCR_SPEED100 = 100Mbps
  1991. * BMCR_SPEED1000 = 1000Mbps
  1992. * ~(BMCR_SPEED100 | BMCR_SPEED1000) = 10Mbps
  1993. */
  1994. #define CAS_BMCR_SPEED1000 0x0040 /* Select 1000Mbps */
  1995. #define CAS_ADVERTISE_1000HALF 0x0100
  1996. #define CAS_ADVERTISE_1000FULL 0x0200
  1997. #define CAS_ADVERTISE_PAUSE 0x0400
  1998. #define CAS_ADVERTISE_ASYM_PAUSE 0x0800
  1999. /* regular lpa register */
  2000. #define CAS_LPA_PAUSE CAS_ADVERTISE_PAUSE
  2001. #define CAS_LPA_ASYM_PAUSE CAS_ADVERTISE_ASYM_PAUSE
  2002. /* 1000_STATUS register */
  2003. #define CAS_LPA_1000HALF 0x0400
  2004. #define CAS_LPA_1000FULL 0x0800
  2005. #define CAS_EXTEND_1000XFULL 0x8000
  2006. #define CAS_EXTEND_1000XHALF 0x4000
  2007. #define CAS_EXTEND_1000TFULL 0x2000
  2008. #define CAS_EXTEND_1000THALF 0x1000
  2009. /* cassini header parser firmware */
  2010. typedef struct cas_hp_inst {
  2011. const char *note;
  2012. u16 mask, val;
  2013. u8 op;
  2014. u8 soff, snext; /* if match succeeds, new offset and match */
  2015. u8 foff, fnext; /* if match fails, new offset and match */
  2016. /* output info */
  2017. u8 outop; /* output opcode */
  2018. u16 outarg; /* output argument */
  2019. u8 outenab; /* output enable: 0 = not, 1 = if match
  2020. 2 = if !match, 3 = always */
  2021. u8 outshift; /* barrel shift right, 4 bits */
  2022. u16 outmask;
  2023. } cas_hp_inst_t;
  2024. /* comparison */
  2025. #define OP_EQ 0 /* packet == value */
  2026. #define OP_LT 1 /* packet < value */
  2027. #define OP_GT 2 /* packet > value */
  2028. #define OP_NP 3 /* new packet */
  2029. /* output opcodes */
  2030. #define CL_REG 0
  2031. #define LD_FID 1
  2032. #define LD_SEQ 2
  2033. #define LD_CTL 3
  2034. #define LD_SAP 4
  2035. #define LD_R1 5
  2036. #define LD_L3 6
  2037. #define LD_SUM 7
  2038. #define LD_HDR 8
  2039. #define IM_FID 9
  2040. #define IM_SEQ 10
  2041. #define IM_SAP 11
  2042. #define IM_R1 12
  2043. #define IM_CTL 13
  2044. #define LD_LEN 14
  2045. #define ST_FLG 15
  2046. /* match setp #s for IP4TCP4 */
  2047. #define S1_PCKT 0
  2048. #define S1_VLAN 1
  2049. #define S1_CFI 2
  2050. #define S1_8023 3
  2051. #define S1_LLC 4
  2052. #define S1_LLCc 5
  2053. #define S1_IPV4 6
  2054. #define S1_IPV4c 7
  2055. #define S1_IPV4F 8
  2056. #define S1_TCP44 9
  2057. #define S1_IPV6 10
  2058. #define S1_IPV6L 11
  2059. #define S1_IPV6c 12
  2060. #define S1_TCP64 13
  2061. #define S1_TCPSQ 14
  2062. #define S1_TCPFG 15
  2063. #define S1_TCPHL 16
  2064. #define S1_TCPHc 17
  2065. #define S1_CLNP 18
  2066. #define S1_CLNP2 19
  2067. #define S1_DROP 20
  2068. #define S2_HTTP 21
  2069. #define S1_ESP4 22
  2070. #define S1_AH4 23
  2071. #define S1_ESP6 24
  2072. #define S1_AH6 25
  2073. #define CAS_PROG_IP46TCP4_PREAMBLE \
  2074. { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, \
  2075. CL_REG, 0x3ff, 1, 0x0, 0x0000}, \
  2076. { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, \
  2077. IM_CTL, 0x00a, 3, 0x0, 0xffff}, \
  2078. { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, \
  2079. CL_REG, 0x000, 0, 0x0, 0x0000}, \
  2080. { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, \
  2081. CL_REG, 0x000, 0, 0x0, 0x0000}, \
  2082. { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, \
  2083. CL_REG, 0x000, 0, 0x0, 0x0000}, \
  2084. { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, \
  2085. CL_REG, 0x000, 0, 0x0, 0x0000}, \
  2086. { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, \
  2087. LD_SAP, 0x100, 3, 0x0, 0xffff}, \
  2088. { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, \
  2089. LD_SUM, 0x00a, 1, 0x0, 0x0000}, \
  2090. { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, \
  2091. LD_LEN, 0x03e, 1, 0x0, 0xffff}, \
  2092. { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, \
  2093. LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ \
  2094. { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, \
  2095. LD_SUM, 0x015, 1, 0x0, 0x0000}, \
  2096. { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, \
  2097. IM_R1, 0x128, 1, 0x0, 0xffff}, \
  2098. { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, \
  2099. LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ \
  2100. { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, \
  2101. LD_LEN, 0x03f, 1, 0x0, 0xffff}
  2102. #ifdef USE_HP_IP46TCP4
  2103. static cas_hp_inst_t cas_prog_ip46tcp4tab[] = {
  2104. CAS_PROG_IP46TCP4_PREAMBLE,
  2105. { "TCP seq", /* DADDR should point to dest port */
  2106. 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ,
  2107. 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
  2108. { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
  2109. S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */
  2110. { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0,
  2111. S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000},
  2112. { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
  2113. S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
  2114. { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
  2115. IM_CTL, 0x001, 3, 0x0, 0x0001},
  2116. { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2117. IM_CTL, 0x000, 0, 0x0, 0x0000},
  2118. { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2119. IM_CTL, 0x080, 3, 0x0, 0xffff},
  2120. { NULL },
  2121. };
  2122. #ifdef HP_IP46TCP4_DEFAULT
  2123. #define CAS_HP_FIRMWARE cas_prog_ip46tcp4tab
  2124. #endif
  2125. #endif
  2126. /*
  2127. * Alternate table load which excludes HTTP server traffic from reassembly.
  2128. * It is substantially similar to the basic table, with one extra state
  2129. * and a few extra compares. */
  2130. #ifdef USE_HP_IP46TCP4NOHTTP
  2131. static cas_hp_inst_t cas_prog_ip46tcp4nohttptab[] = {
  2132. CAS_PROG_IP46TCP4_PREAMBLE,
  2133. { "TCP seq", /* DADDR should point to dest port */
  2134. 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ,
  2135. 0x081, 3, 0x0, 0xffff} , /* Load TCP seq # */
  2136. { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0,
  2137. S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f, }, /* Load TCP flags */
  2138. { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
  2139. LD_R1, 0x205, 3, 0xB, 0xf000},
  2140. { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2141. LD_HDR, 0x0ff, 3, 0x0, 0xffff},
  2142. { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
  2143. IM_CTL, 0x001, 3, 0x0, 0x0001},
  2144. { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2145. CL_REG, 0x002, 3, 0x0, 0x0000},
  2146. { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2147. IM_CTL, 0x080, 3, 0x0, 0xffff},
  2148. { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2149. IM_CTL, 0x044, 3, 0x0, 0xffff},
  2150. { NULL },
  2151. };
  2152. #ifdef HP_IP46TCP4NOHTTP_DEFAULT
  2153. #define CAS_HP_FIRMWARE cas_prog_ip46tcp4nohttptab
  2154. #endif
  2155. #endif
  2156. /* match step #s for IP4FRAG */
  2157. #define S3_IPV6c 11
  2158. #define S3_TCP64 12
  2159. #define S3_TCPSQ 13
  2160. #define S3_TCPFG 14
  2161. #define S3_TCPHL 15
  2162. #define S3_TCPHc 16
  2163. #define S3_FRAG 17
  2164. #define S3_FOFF 18
  2165. #define S3_CLNP 19
  2166. #ifdef USE_HP_IP4FRAG
  2167. static cas_hp_inst_t cas_prog_ip4fragtab[] = {
  2168. { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT,
  2169. CL_REG, 0x3ff, 1, 0x0, 0x0000},
  2170. { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
  2171. IM_CTL, 0x00a, 3, 0x0, 0xffff},
  2172. { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S3_CLNP, 1, S1_8023,
  2173. CL_REG, 0x000, 0, 0x0, 0x0000},
  2174. { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
  2175. CL_REG, 0x000, 0, 0x0, 0x0000},
  2176. { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S3_CLNP,
  2177. CL_REG, 0x000, 0, 0x0, 0x0000},
  2178. { "LLCc?",0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S3_CLNP,
  2179. CL_REG, 0x000, 0, 0x0, 0x0000},
  2180. { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
  2181. LD_SAP, 0x100, 3, 0x0, 0xffff},
  2182. { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S3_CLNP,
  2183. LD_SUM, 0x00a, 1, 0x0, 0x0000},
  2184. { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S3_FRAG,
  2185. LD_LEN, 0x03e, 3, 0x0, 0xffff},
  2186. { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S3_TCPSQ, 0, S3_CLNP,
  2187. LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */
  2188. { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S3_IPV6c, 0, S3_CLNP,
  2189. LD_SUM, 0x015, 1, 0x0, 0x0000},
  2190. { "IPV6 cont?", 0xf000, 0x6000, OP_EQ, 3, S3_TCP64, 0, S3_CLNP,
  2191. LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */
  2192. { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S3_TCPSQ, 0, S3_CLNP,
  2193. LD_LEN, 0x03f, 1, 0x0, 0xffff},
  2194. { "TCP seq", /* DADDR should point to dest port */
  2195. 0x0000, 0x0000, OP_EQ, 0, S3_TCPFG, 4, S3_TCPFG, LD_SEQ,
  2196. 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
  2197. { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHL, 0,
  2198. S3_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */
  2199. { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHc, 0, S3_TCPHc,
  2200. LD_R1, 0x205, 3, 0xB, 0xf000},
  2201. { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2202. LD_HDR, 0x0ff, 3, 0x0, 0xffff},
  2203. { "IP4 Fragment", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF,
  2204. LD_FID, 0x103, 3, 0x0, 0xffff}, /* FID IP4 src+dst */
  2205. { "IP4 frag offset", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF,
  2206. LD_SEQ, 0x040, 1, 0xD, 0xfff8},
  2207. { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2208. IM_CTL, 0x001, 3, 0x0, 0x0001},
  2209. { NULL },
  2210. };
  2211. #ifdef HP_IP4FRAG_DEFAULT
  2212. #define CAS_HP_FIRMWARE cas_prog_ip4fragtab
  2213. #endif
  2214. #endif
  2215. /*
  2216. * Alternate table which does batching without reassembly
  2217. */
  2218. #ifdef USE_HP_IP46TCP4BATCH
  2219. static cas_hp_inst_t cas_prog_ip46tcp4batchtab[] = {
  2220. CAS_PROG_IP46TCP4_PREAMBLE,
  2221. { "TCP seq", /* DADDR should point to dest port */
  2222. 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 0, S1_TCPFG, LD_SEQ,
  2223. 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
  2224. { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
  2225. S1_TCPHL, ST_FLG, 0x000, 3, 0x0, 0x0000}, /* Load TCP flags */
  2226. { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0,
  2227. S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000},
  2228. { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
  2229. S1_PCKT, IM_CTL, 0x040, 3, 0x0, 0xffff}, /* set batch bit */
  2230. { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2231. IM_CTL, 0x001, 3, 0x0, 0x0001},
  2232. { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
  2233. S1_PCKT, IM_CTL, 0x080, 3, 0x0, 0xffff},
  2234. { NULL },
  2235. };
  2236. #ifdef HP_IP46TCP4BATCH_DEFAULT
  2237. #define CAS_HP_FIRMWARE cas_prog_ip46tcp4batchtab
  2238. #endif
  2239. #endif
  2240. /* Workaround for Cassini rev2 descriptor corruption problem.
  2241. * Does batching without reassembly, and sets the SAP to a known
  2242. * data pattern for all packets.
  2243. */
  2244. #ifdef USE_HP_WORKAROUND
  2245. static cas_hp_inst_t cas_prog_workaroundtab[] = {
  2246. { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0,
  2247. S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000} ,
  2248. { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
  2249. IM_CTL, 0x04a, 3, 0x0, 0xffff},
  2250. { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023,
  2251. CL_REG, 0x000, 0, 0x0, 0x0000},
  2252. { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
  2253. CL_REG, 0x000, 0, 0x0, 0x0000},
  2254. { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP,
  2255. CL_REG, 0x000, 0, 0x0, 0x0000},
  2256. { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP,
  2257. CL_REG, 0x000, 0, 0x0, 0x0000},
  2258. { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
  2259. IM_SAP, 0x6AE, 3, 0x0, 0xffff},
  2260. { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP,
  2261. LD_SUM, 0x00a, 1, 0x0, 0x0000},
  2262. { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP,
  2263. LD_LEN, 0x03e, 1, 0x0, 0xffff},
  2264. { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP,
  2265. LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */
  2266. { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP,
  2267. LD_SUM, 0x015, 1, 0x0, 0x0000},
  2268. { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP,
  2269. IM_R1, 0x128, 1, 0x0, 0xffff},
  2270. { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP,
  2271. LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */
  2272. { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP,
  2273. LD_LEN, 0x03f, 1, 0x0, 0xffff},
  2274. { "TCP seq", /* DADDR should point to dest port */
  2275. 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ,
  2276. 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
  2277. { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
  2278. S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */
  2279. { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
  2280. LD_R1, 0x205, 3, 0xB, 0xf000},
  2281. { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
  2282. S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
  2283. { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
  2284. IM_SAP, 0x6AE, 3, 0x0, 0xffff} ,
  2285. { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2286. IM_CTL, 0x001, 3, 0x0, 0x0001},
  2287. { NULL },
  2288. };
  2289. #ifdef HP_WORKAROUND_DEFAULT
  2290. #define CAS_HP_FIRMWARE cas_prog_workaroundtab
  2291. #endif
  2292. #endif
  2293. #ifdef USE_HP_ENCRYPT
  2294. static cas_hp_inst_t cas_prog_encryptiontab[] = {
  2295. { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0,
  2296. S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000},
  2297. { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
  2298. IM_CTL, 0x00a, 3, 0x0, 0xffff},
  2299. #if 0
  2300. //"CFI?", /* 02 FIND CFI and If FIND go to S1_DROP */
  2301. //0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, CL_REG, 0x000, 0, 0x0, 0x00
  2302. 00,
  2303. #endif
  2304. { "CFI?", /* FIND CFI and If FIND go to CleanUP1 (ignore and send to host) */
  2305. 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023,
  2306. CL_REG, 0x000, 0, 0x0, 0x0000},
  2307. { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
  2308. CL_REG, 0x000, 0, 0x0, 0x0000},
  2309. { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP,
  2310. CL_REG, 0x000, 0, 0x0, 0x0000},
  2311. { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP,
  2312. CL_REG, 0x000, 0, 0x0, 0x0000},
  2313. { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
  2314. LD_SAP, 0x100, 3, 0x0, 0xffff},
  2315. { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP,
  2316. LD_SUM, 0x00a, 1, 0x0, 0x0000},
  2317. { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP,
  2318. LD_LEN, 0x03e, 1, 0x0, 0xffff},
  2319. { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_ESP4,
  2320. LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */
  2321. { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP,
  2322. LD_SUM, 0x015, 1, 0x0, 0x0000},
  2323. { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP,
  2324. IM_R1, 0x128, 1, 0x0, 0xffff},
  2325. { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP,
  2326. LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */
  2327. { "TCP64?",
  2328. #if 0
  2329. //@@@0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_ESP6, LD_LEN, 0x03f, 1, 0x0, 0xffff,
  2330. #endif
  2331. 0xff00, 0x0600, OP_EQ, 12, S1_TCPSQ, 0, S1_ESP6, LD_LEN,
  2332. 0x03f, 1, 0x0, 0xffff},
  2333. { "TCP seq", /* 14:DADDR should point to dest port */
  2334. 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ,
  2335. 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */
  2336. { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0,
  2337. S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f}, /* Load TCP flags */
  2338. { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
  2339. LD_R1, 0x205, 3, 0xB, 0xf000} ,
  2340. { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
  2341. S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
  2342. { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
  2343. IM_CTL, 0x001, 3, 0x0, 0x0001},
  2344. { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2345. CL_REG, 0x002, 3, 0x0, 0x0000},
  2346. { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2347. IM_CTL, 0x080, 3, 0x0, 0xffff},
  2348. { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
  2349. IM_CTL, 0x044, 3, 0x0, 0xffff},
  2350. { "IPV4 ESP encrypted?", /* S1_ESP4 */
  2351. 0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH4, IM_CTL,
  2352. 0x021, 1, 0x0, 0xffff},
  2353. { "IPV4 AH encrypted?", /* S1_AH4 */
  2354. 0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL,
  2355. 0x021, 1, 0x0, 0xffff},
  2356. { "IPV6 ESP encrypted?", /* S1_ESP6 */
  2357. #if 0
  2358. //@@@0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL, 0x021, 1, 0x0, 0xffff,
  2359. #endif
  2360. 0xff00, 0x3200, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL,
  2361. 0x021, 1, 0x0, 0xffff},
  2362. { "IPV6 AH encrypted?", /* S1_AH6 */
  2363. #if 0
  2364. //@@@0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, 0x021, 1, 0x0, 0xffff,
  2365. #endif
  2366. 0xff00, 0x3300, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL,
  2367. 0x021, 1, 0x0, 0xffff},
  2368. { NULL },
  2369. };
  2370. #ifdef HP_ENCRYPT_DEFAULT
  2371. #define CAS_HP_FIRMWARE cas_prog_encryptiontab
  2372. #endif
  2373. #endif
  2374. static cas_hp_inst_t cas_prog_null[] = { {NULL} };
  2375. #ifdef HP_NULL_DEFAULT
  2376. #define CAS_HP_FIRMWARE cas_prog_null
  2377. #endif
  2378. /* phy types */
  2379. #define CAS_PHY_UNKNOWN 0x00
  2380. #define CAS_PHY_SERDES 0x01
  2381. #define CAS_PHY_MII_MDIO0 0x02
  2382. #define CAS_PHY_MII_MDIO1 0x04
  2383. #define CAS_PHY_MII(x) ((x) & (CAS_PHY_MII_MDIO0 | CAS_PHY_MII_MDIO1))
  2384. /* _RING_INDEX is the index for the ring sizes to be used. _RING_SIZE
  2385. * is the actual size. the default index for the various rings is
  2386. * 8. NOTE: there a bunch of alignment constraints for the rings. to
  2387. * deal with that, i just allocate rings to create the desired
  2388. * alignment. here are the constraints:
  2389. * RX DESC and COMP rings must be 8KB aligned
  2390. * TX DESC must be 2KB aligned.
  2391. * if you change the numbers, be cognizant of how the alignment will change
  2392. * in INIT_BLOCK as well.
  2393. */
  2394. #define DESC_RING_I_TO_S(x) (32*(1 << (x)))
  2395. #define COMP_RING_I_TO_S(x) (128*(1 << (x)))
  2396. #define TX_DESC_RING_INDEX 4 /* 512 = 8k */
  2397. #define RX_DESC_RING_INDEX 4 /* 512 = 8k */
  2398. #define RX_COMP_RING_INDEX 4 /* 2048 = 64k: should be 4x rx ring size */
  2399. #if (TX_DESC_RING_INDEX > 8) || (TX_DESC_RING_INDEX < 0)
  2400. #error TX_DESC_RING_INDEX must be between 0 and 8
  2401. #endif
  2402. #if (RX_DESC_RING_INDEX > 8) || (RX_DESC_RING_INDEX < 0)
  2403. #error RX_DESC_RING_INDEX must be between 0 and 8
  2404. #endif
  2405. #if (RX_COMP_RING_INDEX > 8) || (RX_COMP_RING_INDEX < 0)
  2406. #error RX_COMP_RING_INDEX must be between 0 and 8
  2407. #endif
  2408. #define N_TX_RINGS MAX_TX_RINGS /* for QoS */
  2409. #define N_TX_RINGS_MASK MAX_TX_RINGS_MASK
  2410. #define N_RX_DESC_RINGS MAX_RX_DESC_RINGS /* 1 for ipsec */
  2411. #define N_RX_COMP_RINGS 0x1 /* for mult. PCI interrupts */
  2412. /* number of flows that can go through re-assembly */
  2413. #define N_RX_FLOWS 64
  2414. #define TX_DESC_RING_SIZE DESC_RING_I_TO_S(TX_DESC_RING_INDEX)
  2415. #define RX_DESC_RING_SIZE DESC_RING_I_TO_S(RX_DESC_RING_INDEX)
  2416. #define RX_COMP_RING_SIZE COMP_RING_I_TO_S(RX_COMP_RING_INDEX)
  2417. #define TX_DESC_RINGN_INDEX(x) TX_DESC_RING_INDEX
  2418. #define RX_DESC_RINGN_INDEX(x) RX_DESC_RING_INDEX
  2419. #define RX_COMP_RINGN_INDEX(x) RX_COMP_RING_INDEX
  2420. #define TX_DESC_RINGN_SIZE(x) TX_DESC_RING_SIZE
  2421. #define RX_DESC_RINGN_SIZE(x) RX_DESC_RING_SIZE
  2422. #define RX_COMP_RINGN_SIZE(x) RX_COMP_RING_SIZE
  2423. /* convert values */
  2424. #define CAS_BASE(x, y) (((y) << (x ## _SHIFT)) & (x ## _MASK))
  2425. #define CAS_VAL(x, y) (((y) & (x ## _MASK)) >> (x ## _SHIFT))
  2426. #define CAS_TX_RINGN_BASE(y) ((TX_DESC_RINGN_INDEX(y) << \
  2427. TX_CFG_DESC_RINGN_SHIFT(y)) & \
  2428. TX_CFG_DESC_RINGN_MASK(y))
  2429. /* min is 2k, but we can't do jumbo frames unless it's at least 8k */
  2430. #define CAS_MIN_PAGE_SHIFT 11 /* 2048 */
  2431. #define CAS_JUMBO_PAGE_SHIFT 13 /* 8192 */
  2432. #define CAS_MAX_PAGE_SHIFT 14 /* 16384 */
  2433. #define TX_DESC_BUFLEN_MASK 0x0000000000003FFFULL /* buffer length in
  2434. bytes. 0 - 9256 */
  2435. #define TX_DESC_BUFLEN_SHIFT 0
  2436. #define TX_DESC_CSUM_START_MASK 0x00000000001F8000ULL /* checksum start. #
  2437. of bytes to be
  2438. skipped before
  2439. csum calc begins.
  2440. value must be
  2441. even */
  2442. #define TX_DESC_CSUM_START_SHIFT 15
  2443. #define TX_DESC_CSUM_STUFF_MASK 0x000000001FE00000ULL /* checksum stuff.
  2444. byte offset w/in
  2445. the pkt for the
  2446. 1st csum byte.
  2447. must be > 8 */
  2448. #define TX_DESC_CSUM_STUFF_SHIFT 21
  2449. #define TX_DESC_CSUM_EN 0x0000000020000000ULL /* enable checksum */
  2450. #define TX_DESC_EOF 0x0000000040000000ULL /* end of frame */
  2451. #define TX_DESC_SOF 0x0000000080000000ULL /* start of frame */
  2452. #define TX_DESC_INTME 0x0000000100000000ULL /* interrupt me */
  2453. #define TX_DESC_NO_CRC 0x0000000200000000ULL /* debugging only.
  2454. CRC will not be
  2455. inserted into
  2456. outgoing frame. */
  2457. struct cas_tx_desc {
  2458. __le64 control;
  2459. __le64 buffer;
  2460. };
  2461. /* descriptor ring for free buffers contains page-sized buffers. the index
  2462. * value is not used by the hw in any way. it's just stored and returned in
  2463. * the completion ring.
  2464. */
  2465. struct cas_rx_desc {
  2466. __le64 index;
  2467. __le64 buffer;
  2468. };
  2469. /* received packets are put on the completion ring. */
  2470. /* word 1 */
  2471. #define RX_COMP1_DATA_SIZE_MASK 0x0000000007FFE000ULL
  2472. #define RX_COMP1_DATA_SIZE_SHIFT 13
  2473. #define RX_COMP1_DATA_OFF_MASK 0x000001FFF8000000ULL
  2474. #define RX_COMP1_DATA_OFF_SHIFT 27
  2475. #define RX_COMP1_DATA_INDEX_MASK 0x007FFE0000000000ULL
  2476. #define RX_COMP1_DATA_INDEX_SHIFT 41
  2477. #define RX_COMP1_SKIP_MASK 0x0180000000000000ULL
  2478. #define RX_COMP1_SKIP_SHIFT 55
  2479. #define RX_COMP1_RELEASE_NEXT 0x0200000000000000ULL
  2480. #define RX_COMP1_SPLIT_PKT 0x0400000000000000ULL
  2481. #define RX_COMP1_RELEASE_FLOW 0x0800000000000000ULL
  2482. #define RX_COMP1_RELEASE_DATA 0x1000000000000000ULL
  2483. #define RX_COMP1_RELEASE_HDR 0x2000000000000000ULL
  2484. #define RX_COMP1_TYPE_MASK 0xC000000000000000ULL
  2485. #define RX_COMP1_TYPE_SHIFT 62
  2486. /* word 2 */
  2487. #define RX_COMP2_NEXT_INDEX_MASK 0x00000007FFE00000ULL
  2488. #define RX_COMP2_NEXT_INDEX_SHIFT 21
  2489. #define RX_COMP2_HDR_SIZE_MASK 0x00000FF800000000ULL
  2490. #define RX_COMP2_HDR_SIZE_SHIFT 35
  2491. #define RX_COMP2_HDR_OFF_MASK 0x0003F00000000000ULL
  2492. #define RX_COMP2_HDR_OFF_SHIFT 44
  2493. #define RX_COMP2_HDR_INDEX_MASK 0xFFFC000000000000ULL
  2494. #define RX_COMP2_HDR_INDEX_SHIFT 50
  2495. /* word 3 */
  2496. #define RX_COMP3_SMALL_PKT 0x0000000000000001ULL
  2497. #define RX_COMP3_JUMBO_PKT 0x0000000000000002ULL
  2498. #define RX_COMP3_JUMBO_HDR_SPLIT_EN 0x0000000000000004ULL
  2499. #define RX_COMP3_CSUM_START_MASK 0x000000000007F000ULL
  2500. #define RX_COMP3_CSUM_START_SHIFT 12
  2501. #define RX_COMP3_FLOWID_MASK 0x0000000001F80000ULL
  2502. #define RX_COMP3_FLOWID_SHIFT 19
  2503. #define RX_COMP3_OPCODE_MASK 0x000000000E000000ULL
  2504. #define RX_COMP3_OPCODE_SHIFT 25
  2505. #define RX_COMP3_FORCE_FLAG 0x0000000010000000ULL
  2506. #define RX_COMP3_NO_ASSIST 0x0000000020000000ULL
  2507. #define RX_COMP3_LOAD_BAL_MASK 0x000001F800000000ULL
  2508. #define RX_COMP3_LOAD_BAL_SHIFT 35
  2509. #define RX_PLUS_COMP3_ENC_PKT 0x0000020000000000ULL /* cas+ */
  2510. #define RX_COMP3_L3_HEAD_OFF_MASK 0x0000FE0000000000ULL /* cas */
  2511. #define RX_COMP3_L3_HEAD_OFF_SHIFT 41
  2512. #define RX_PLUS_COMP_L3_HEAD_OFF_MASK 0x0000FC0000000000ULL /* cas+ */
  2513. #define RX_PLUS_COMP_L3_HEAD_OFF_SHIFT 42
  2514. #define RX_COMP3_SAP_MASK 0xFFFF000000000000ULL
  2515. #define RX_COMP3_SAP_SHIFT 48
  2516. /* word 4 */
  2517. #define RX_COMP4_TCP_CSUM_MASK 0x000000000000FFFFULL
  2518. #define RX_COMP4_TCP_CSUM_SHIFT 0
  2519. #define RX_COMP4_PKT_LEN_MASK 0x000000003FFF0000ULL
  2520. #define RX_COMP4_PKT_LEN_SHIFT 16
  2521. #define RX_COMP4_PERFECT_MATCH_MASK 0x00000003C0000000ULL
  2522. #define RX_COMP4_PERFECT_MATCH_SHIFT 30
  2523. #define RX_COMP4_ZERO 0x0000080000000000ULL
  2524. #define RX_COMP4_HASH_VAL_MASK 0x0FFFF00000000000ULL
  2525. #define RX_COMP4_HASH_VAL_SHIFT 44
  2526. #define RX_COMP4_HASH_PASS 0x1000000000000000ULL
  2527. #define RX_COMP4_BAD 0x4000000000000000ULL
  2528. #define RX_COMP4_LEN_MISMATCH 0x8000000000000000ULL
  2529. /* we encode the following: ring/index/release. only 14 bits
  2530. * are usable.
  2531. * NOTE: the encoding is dependent upon RX_DESC_RING_SIZE and
  2532. * MAX_RX_DESC_RINGS. */
  2533. #define RX_INDEX_NUM_MASK 0x0000000000000FFFULL
  2534. #define RX_INDEX_NUM_SHIFT 0
  2535. #define RX_INDEX_RING_MASK 0x0000000000001000ULL
  2536. #define RX_INDEX_RING_SHIFT 12
  2537. #define RX_INDEX_RELEASE 0x0000000000002000ULL
  2538. struct cas_rx_comp {
  2539. __le64 word1;
  2540. __le64 word2;
  2541. __le64 word3;
  2542. __le64 word4;
  2543. };
  2544. enum link_state {
  2545. link_down = 0, /* No link, will retry */
  2546. link_aneg, /* Autoneg in progress */
  2547. link_force_try, /* Try Forced link speed */
  2548. link_force_ret, /* Forced mode worked, retrying autoneg */
  2549. link_force_ok, /* Stay in forced mode */
  2550. link_up /* Link is up */
  2551. };
  2552. typedef struct cas_page {
  2553. struct list_head list;
  2554. struct page *buffer;
  2555. dma_addr_t dma_addr;
  2556. int used;
  2557. } cas_page_t;
  2558. /* some alignment constraints:
  2559. * TX DESC, RX DESC, and RX COMP must each be 8K aligned.
  2560. * TX COMPWB must be 8-byte aligned.
  2561. * to accomplish this, here's what we do:
  2562. *
  2563. * INIT_BLOCK_RX_COMP = 64k (already aligned)
  2564. * INIT_BLOCK_RX_DESC = 8k
  2565. * INIT_BLOCK_TX = 8k
  2566. * INIT_BLOCK_RX1_DESC = 8k
  2567. * TX COMPWB
  2568. */
  2569. #define INIT_BLOCK_TX (TX_DESC_RING_SIZE)
  2570. #define INIT_BLOCK_RX_DESC (RX_DESC_RING_SIZE)
  2571. #define INIT_BLOCK_RX_COMP (RX_COMP_RING_SIZE)
  2572. struct cas_init_block {
  2573. struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP];
  2574. struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC];
  2575. struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX];
  2576. __le64 tx_compwb;
  2577. };
  2578. /* tiny buffers to deal with target abort issue. we allocate a bit
  2579. * over so that we don't have target abort issues with these buffers
  2580. * as well.
  2581. */
  2582. #define TX_TINY_BUF_LEN 0x100
  2583. #define TX_TINY_BUF_BLOCK ((INIT_BLOCK_TX + 1)*TX_TINY_BUF_LEN)
  2584. struct cas_tiny_count {
  2585. int nbufs;
  2586. int used;
  2587. };
  2588. struct cas {
  2589. spinlock_t lock; /* for most bits */
  2590. spinlock_t tx_lock[N_TX_RINGS]; /* tx bits */
  2591. spinlock_t stat_lock[N_TX_RINGS + 1]; /* for stat gathering */
  2592. spinlock_t rx_inuse_lock; /* rx inuse list */
  2593. spinlock_t rx_spare_lock; /* rx spare list */
  2594. void __iomem *regs;
  2595. int tx_new[N_TX_RINGS], tx_old[N_TX_RINGS];
  2596. int rx_old[N_RX_DESC_RINGS];
  2597. int rx_cur[N_RX_COMP_RINGS], rx_new[N_RX_COMP_RINGS];
  2598. int rx_last[N_RX_DESC_RINGS];
  2599. struct napi_struct napi;
  2600. /* Set when chip is actually in operational state
  2601. * (ie. not power managed) */
  2602. int hw_running;
  2603. int opened;
  2604. struct mutex pm_mutex; /* open/close/suspend/resume */
  2605. struct cas_init_block *init_block;
  2606. struct cas_tx_desc *init_txds[MAX_TX_RINGS];
  2607. struct cas_rx_desc *init_rxds[MAX_RX_DESC_RINGS];
  2608. struct cas_rx_comp *init_rxcs[MAX_RX_COMP_RINGS];
  2609. /* we use sk_buffs for tx and pages for rx. the rx skbuffs
  2610. * are there for flow re-assembly. */
  2611. struct sk_buff *tx_skbs[N_TX_RINGS][TX_DESC_RING_SIZE];
  2612. struct sk_buff_head rx_flows[N_RX_FLOWS];
  2613. cas_page_t *rx_pages[N_RX_DESC_RINGS][RX_DESC_RING_SIZE];
  2614. struct list_head rx_spare_list, rx_inuse_list;
  2615. int rx_spares_needed;
  2616. /* for small packets when copying would be quicker than
  2617. mapping */
  2618. struct cas_tiny_count tx_tiny_use[N_TX_RINGS][TX_DESC_RING_SIZE];
  2619. u8 *tx_tiny_bufs[N_TX_RINGS];
  2620. u32 msg_enable;
  2621. /* N_TX_RINGS must be >= N_RX_DESC_RINGS */
  2622. struct net_device_stats net_stats[N_TX_RINGS + 1];
  2623. u32 pci_cfg[64 >> 2];
  2624. u8 pci_revision;
  2625. int phy_type;
  2626. int phy_addr;
  2627. u32 phy_id;
  2628. #define CAS_FLAG_1000MB_CAP 0x00000001
  2629. #define CAS_FLAG_REG_PLUS 0x00000002
  2630. #define CAS_FLAG_TARGET_ABORT 0x00000004
  2631. #define CAS_FLAG_SATURN 0x00000008
  2632. #define CAS_FLAG_RXD_POST_MASK 0x000000F0
  2633. #define CAS_FLAG_RXD_POST_SHIFT 4
  2634. #define CAS_FLAG_RXD_POST(x) ((1 << (CAS_FLAG_RXD_POST_SHIFT + (x))) & \
  2635. CAS_FLAG_RXD_POST_MASK)
  2636. #define CAS_FLAG_ENTROPY_DEV 0x00000100
  2637. #define CAS_FLAG_NO_HW_CSUM 0x00000200
  2638. u32 cas_flags;
  2639. int packet_min; /* minimum packet size */
  2640. int tx_fifo_size;
  2641. int rx_fifo_size;
  2642. int rx_pause_off;
  2643. int rx_pause_on;
  2644. int crc_size; /* 4 if half-duplex */
  2645. int pci_irq_INTC;
  2646. int min_frame_size; /* for tx fifo workaround */
  2647. /* page size allocation */
  2648. int page_size;
  2649. int page_order;
  2650. int mtu_stride;
  2651. u32 mac_rx_cfg;
  2652. /* Autoneg & PHY control */
  2653. int link_cntl;
  2654. int link_fcntl;
  2655. enum link_state lstate;
  2656. struct timer_list link_timer;
  2657. int timer_ticks;
  2658. struct work_struct reset_task;
  2659. #if 0
  2660. atomic_t reset_task_pending;
  2661. #else
  2662. atomic_t reset_task_pending;
  2663. atomic_t reset_task_pending_mtu;
  2664. atomic_t reset_task_pending_spare;
  2665. atomic_t reset_task_pending_all;
  2666. #endif
  2667. /* Link-down problem workaround */
  2668. #define LINK_TRANSITION_UNKNOWN 0
  2669. #define LINK_TRANSITION_ON_FAILURE 1
  2670. #define LINK_TRANSITION_STILL_FAILED 2
  2671. #define LINK_TRANSITION_LINK_UP 3
  2672. #define LINK_TRANSITION_LINK_CONFIG 4
  2673. #define LINK_TRANSITION_LINK_DOWN 5
  2674. #define LINK_TRANSITION_REQUESTED_RESET 6
  2675. int link_transition;
  2676. int link_transition_jiffies_valid;
  2677. unsigned long link_transition_jiffies;
  2678. /* Tuning */
  2679. u8 orig_cacheline_size; /* value when loaded */
  2680. #define CAS_PREF_CACHELINE_SIZE 0x20 /* Minimum desired */
  2681. /* Diagnostic counters and state. */
  2682. int casreg_len; /* reg-space size for dumping */
  2683. u64 pause_entered;
  2684. u16 pause_last_time_recvd;
  2685. dma_addr_t block_dvma, tx_tiny_dvma[N_TX_RINGS];
  2686. struct pci_dev *pdev;
  2687. struct net_device *dev;
  2688. #if defined(CONFIG_OF)
  2689. struct device_node *of_node;
  2690. #endif
  2691. /* Firmware Info */
  2692. u16 fw_load_addr;
  2693. u32 fw_size;
  2694. u8 *fw_data;
  2695. };
  2696. #define TX_DESC_NEXT(r, x) (((x) + 1) & (TX_DESC_RINGN_SIZE(r) - 1))
  2697. #define RX_DESC_ENTRY(r, x) ((x) & (RX_DESC_RINGN_SIZE(r) - 1))
  2698. #define RX_COMP_ENTRY(r, x) ((x) & (RX_COMP_RINGN_SIZE(r) - 1))
  2699. #define TX_BUFF_COUNT(r, x, y) ((x) <= (y) ? ((y) - (x)) : \
  2700. (TX_DESC_RINGN_SIZE(r) - (x) + (y)))
  2701. #define TX_BUFFS_AVAIL(cp, i) ((cp)->tx_old[(i)] <= (cp)->tx_new[(i)] ? \
  2702. (cp)->tx_old[(i)] + (TX_DESC_RINGN_SIZE(i) - 1) - (cp)->tx_new[(i)] : \
  2703. (cp)->tx_old[(i)] - (cp)->tx_new[(i)] - 1)
  2704. #define CAS_ALIGN(addr, align) \
  2705. (((unsigned long) (addr) + ((align) - 1UL)) & ~((align) - 1))
  2706. #define RX_FIFO_SIZE 16384
  2707. #define EXPANSION_ROM_SIZE 65536
  2708. #define CAS_MC_EXACT_MATCH_SIZE 15
  2709. #define CAS_MC_HASH_SIZE 256
  2710. #define CAS_MC_HASH_MAX (CAS_MC_EXACT_MATCH_SIZE + \
  2711. CAS_MC_HASH_SIZE)
  2712. #define TX_TARGET_ABORT_LEN 0x20
  2713. #define RX_SWIVEL_OFF_VAL 0x2
  2714. #define RX_AE_FREEN_VAL(x) (RX_DESC_RINGN_SIZE(x) >> 1)
  2715. #define RX_AE_COMP_VAL (RX_COMP_RING_SIZE >> 1)
  2716. #define RX_BLANK_INTR_PKT_VAL 0x05
  2717. #define RX_BLANK_INTR_TIME_VAL 0x0F
  2718. #define HP_TCP_THRESH_VAL 1530 /* reduce to enable reassembly */
  2719. #define RX_SPARE_COUNT (RX_DESC_RING_SIZE >> 1)
  2720. #define RX_SPARE_RECOVER_VAL (RX_SPARE_COUNT >> 2)
  2721. #endif /* _CASSINI_H */