cassini.h 122 KB

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