aic94xx_reg_def.h 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399
  1. /*
  2. * Aic94xx SAS/SATA driver hardware registers definitions.
  3. *
  4. * Copyright (C) 2004 Adaptec, Inc. All rights reserved.
  5. * Copyright (C) 2004 David Chaw <david_chaw@adaptec.com>
  6. * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
  7. *
  8. * Luben Tuikov: Some register value updates to make it work with the window
  9. * agnostic register r/w functions. Some register corrections, sizes,
  10. * etc.
  11. *
  12. * This file is licensed under GPLv2.
  13. *
  14. * This file is part of the aic94xx driver.
  15. *
  16. * The aic94xx driver is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation; version 2 of the
  19. * License.
  20. *
  21. * The aic94xx driver is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. * General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with the aic94xx driver; if not, write to the Free Software
  28. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. *
  30. * $Id: //depot/aic94xx/aic94xx_reg_def.h#27 $
  31. *
  32. */
  33. #ifndef _ADP94XX_REG_DEF_H_
  34. #define _ADP94XX_REG_DEF_H_
  35. /*
  36. * Common definitions.
  37. */
  38. #define CSEQ_MODE_PAGE_SIZE 0x200 /* CSEQ mode page size */
  39. #define LmSEQ_MODE_PAGE_SIZE 0x200 /* LmSEQ mode page size */
  40. #define LmSEQ_HOST_REG_SIZE 0x4000 /* LmSEQ Host Register size */
  41. /********************* COM_SAS registers definition *************************/
  42. /* The base is REG_BASE_ADDR, defined in aic94xx_reg.h.
  43. */
  44. /*
  45. * CHIM Registers, Address Range : (0x00-0xFF)
  46. */
  47. #define COMBIST (REG_BASE_ADDR + 0x00)
  48. /* bits 31:24 */
  49. #define L7BLKRST 0x80000000
  50. #define L6BLKRST 0x40000000
  51. #define L5BLKRST 0x20000000
  52. #define L4BLKRST 0x10000000
  53. #define L3BLKRST 0x08000000
  54. #define L2BLKRST 0x04000000
  55. #define L1BLKRST 0x02000000
  56. #define L0BLKRST 0x01000000
  57. #define LmBLKRST 0xFF000000
  58. #define LmBLKRST_COMBIST(phyid) (1 << (24 + phyid))
  59. #define OCMBLKRST 0x00400000
  60. #define CTXMEMBLKRST 0x00200000
  61. #define CSEQBLKRST 0x00100000
  62. #define EXSIBLKRST 0x00040000
  63. #define DPIBLKRST 0x00020000
  64. #define DFIFBLKRST 0x00010000
  65. #define HARDRST 0x00000200
  66. #define COMBLKRST 0x00000100
  67. #define FRCDFPERR 0x00000080
  68. #define FRCCIOPERR 0x00000020
  69. #define FRCBISTERR 0x00000010
  70. #define COMBISTEN 0x00000004
  71. #define COMBISTDONE 0x00000002 /* ro */
  72. #define COMBISTFAIL 0x00000001 /* ro */
  73. #define COMSTAT (REG_BASE_ADDR + 0x04)
  74. #define REQMBXREAD 0x00000040
  75. #define RSPMBXAVAIL 0x00000020
  76. #define CSBUFPERR 0x00000008
  77. #define OVLYERR 0x00000004
  78. #define CSERR 0x00000002
  79. #define OVLYDMADONE 0x00000001
  80. #define COMSTAT_MASK (REQMBXREAD | RSPMBXAVAIL | \
  81. CSBUFPERR | OVLYERR | CSERR |\
  82. OVLYDMADONE)
  83. #define COMSTATEN (REG_BASE_ADDR + 0x08)
  84. #define EN_REQMBXREAD 0x00000040
  85. #define EN_RSPMBXAVAIL 0x00000020
  86. #define EN_CSBUFPERR 0x00000008
  87. #define EN_OVLYERR 0x00000004
  88. #define EN_CSERR 0x00000002
  89. #define EN_OVLYDONE 0x00000001
  90. #define SCBPRO (REG_BASE_ADDR + 0x0C)
  91. #define SCBCONS_MASK 0xFFFF0000
  92. #define SCBPRO_MASK 0x0000FFFF
  93. #define CHIMREQMBX (REG_BASE_ADDR + 0x10)
  94. #define CHIMRSPMBX (REG_BASE_ADDR + 0x14)
  95. #define CHIMINT (REG_BASE_ADDR + 0x18)
  96. #define EXT_INT0 0x00000800
  97. #define EXT_INT1 0x00000400
  98. #define PORRSTDET 0x00000200
  99. #define HARDRSTDET 0x00000100
  100. #define DLAVAILQ 0x00000080 /* ro */
  101. #define HOSTERR 0x00000040
  102. #define INITERR 0x00000020
  103. #define DEVINT 0x00000010
  104. #define COMINT 0x00000008
  105. #define DEVTIMER2 0x00000004
  106. #define DEVTIMER1 0x00000002
  107. #define DLAVAIL 0x00000001
  108. #define CHIMINT_MASK (HOSTERR | INITERR | DEVINT | COMINT |\
  109. DEVTIMER2 | DEVTIMER1 | DLAVAIL)
  110. #define DEVEXCEPT_MASK (HOSTERR | INITERR | DEVINT | COMINT)
  111. #define CHIMINTEN (REG_BASE_ADDR + 0x1C)
  112. #define RST_EN_EXT_INT1 0x01000000
  113. #define RST_EN_EXT_INT0 0x00800000
  114. #define RST_EN_HOSTERR 0x00400000
  115. #define RST_EN_INITERR 0x00200000
  116. #define RST_EN_DEVINT 0x00100000
  117. #define RST_EN_COMINT 0x00080000
  118. #define RST_EN_DEVTIMER2 0x00040000
  119. #define RST_EN_DEVTIMER1 0x00020000
  120. #define RST_EN_DLAVAIL 0x00010000
  121. #define SET_EN_EXT_INT1 0x00000100
  122. #define SET_EN_EXT_INT0 0x00000080
  123. #define SET_EN_HOSTERR 0x00000040
  124. #define SET_EN_INITERR 0x00000020
  125. #define SET_EN_DEVINT 0x00000010
  126. #define SET_EN_COMINT 0x00000008
  127. #define SET_EN_DEVTIMER2 0x00000004
  128. #define SET_EN_DEVTIMER1 0x00000002
  129. #define SET_EN_DLAVAIL 0x00000001
  130. #define RST_CHIMINTEN (RST_EN_HOSTERR | RST_EN_INITERR | \
  131. RST_EN_DEVINT | RST_EN_COMINT | \
  132. RST_EN_DEVTIMER2 | RST_EN_DEVTIMER1 |\
  133. RST_EN_DLAVAIL)
  134. #define SET_CHIMINTEN (SET_EN_HOSTERR | SET_EN_INITERR |\
  135. SET_EN_DEVINT | SET_EN_COMINT |\
  136. SET_EN_DLAVAIL)
  137. #define OVLYDMACTL (REG_BASE_ADDR + 0x20)
  138. #define OVLYADR_MASK 0x07FF0000
  139. #define OVLYLSEQ_MASK 0x0000FF00
  140. #define OVLYCSEQ 0x00000080
  141. #define OVLYHALTERR 0x00000040
  142. #define PIOCMODE 0x00000020
  143. #define RESETOVLYDMA 0x00000008 /* wo */
  144. #define STARTOVLYDMA 0x00000004
  145. #define STOPOVLYDMA 0x00000002 /* wo */
  146. #define OVLYDMAACT 0x00000001 /* ro */
  147. #define OVLYDMACNT (REG_BASE_ADDR + 0x24)
  148. #define OVLYDOMAIN1 0x20000000 /* ro */
  149. #define OVLYDOMAIN0 0x10000000
  150. #define OVLYBUFADR_MASK 0x007F0000
  151. #define OVLYDMACNT_MASK 0x00003FFF
  152. #define OVLYDMAADR (REG_BASE_ADDR + 0x28)
  153. #define DMAERR (REG_BASE_ADDR + 0x30)
  154. #define OVLYERRSTAT_MASK 0x0000FF00 /* ro */
  155. #define CSERRSTAT_MASK 0x000000FF /* ro */
  156. #define SPIODATA (REG_BASE_ADDR + 0x34)
  157. /* 0x38 - 0x3C are reserved */
  158. #define T1CNTRLR (REG_BASE_ADDR + 0x40)
  159. #define T1DONE 0x00010000 /* ro */
  160. #define TIMER64 0x00000400
  161. #define T1ENABLE 0x00000200
  162. #define T1RELOAD 0x00000100
  163. #define T1PRESCALER_MASK 0x00000003
  164. #define T1CMPR (REG_BASE_ADDR + 0x44)
  165. #define T1CNTR (REG_BASE_ADDR + 0x48)
  166. #define T2CNTRLR (REG_BASE_ADDR + 0x4C)
  167. #define T2DONE 0x00010000 /* ro */
  168. #define T2ENABLE 0x00000200
  169. #define T2RELOAD 0x00000100
  170. #define T2PRESCALER_MASK 0x00000003
  171. #define T2CMPR (REG_BASE_ADDR + 0x50)
  172. #define T2CNTR (REG_BASE_ADDR + 0x54)
  173. /* 0x58h - 0xFCh are reserved */
  174. /*
  175. * DCH_SAS Registers, Address Range : (0x800-0xFFF)
  176. */
  177. #define CMDCTXBASE (REG_BASE_ADDR + 0x800)
  178. #define DEVCTXBASE (REG_BASE_ADDR + 0x808)
  179. #define CTXDOMAIN (REG_BASE_ADDR + 0x810)
  180. #define DEVCTXDOMAIN1 0x00000008 /* ro */
  181. #define DEVCTXDOMAIN0 0x00000004
  182. #define CMDCTXDOMAIN1 0x00000002 /* ro */
  183. #define CMDCTXDOMAIN0 0x00000001
  184. #define DCHCTL (REG_BASE_ADDR + 0x814)
  185. #define OCMBISTREPAIR 0x00080000
  186. #define OCMBISTEN 0x00040000
  187. #define OCMBISTDN 0x00020000 /* ro */
  188. #define OCMBISTFAIL 0x00010000 /* ro */
  189. #define DDBBISTEN 0x00004000
  190. #define DDBBISTDN 0x00002000 /* ro */
  191. #define DDBBISTFAIL 0x00001000 /* ro */
  192. #define SCBBISTEN 0x00000400
  193. #define SCBBISTDN 0x00000200 /* ro */
  194. #define SCBBISTFAIL 0x00000100 /* ro */
  195. #define MEMSEL_MASK 0x000000E0
  196. #define MEMSEL_CCM_LSEQ 0x00000000
  197. #define MEMSEL_CCM_IOP 0x00000020
  198. #define MEMSEL_CCM_SASCTL 0x00000040
  199. #define MEMSEL_DCM_LSEQ 0x00000060
  200. #define MEMSEL_DCM_IOP 0x00000080
  201. #define MEMSEL_OCM 0x000000A0
  202. #define FRCERR 0x00000010
  203. #define AUTORLS 0x00000001
  204. #define DCHREVISION (REG_BASE_ADDR + 0x818)
  205. #define DCHREVISION_MASK 0x000000FF
  206. #define DCHSTATUS (REG_BASE_ADDR + 0x81C)
  207. #define EN_CFIFTOERR 0x00020000
  208. #define CFIFTOERR 0x00000200
  209. #define CSEQINT 0x00000100 /* ro */
  210. #define LSEQ7INT 0x00000080 /* ro */
  211. #define LSEQ6INT 0x00000040 /* ro */
  212. #define LSEQ5INT 0x00000020 /* ro */
  213. #define LSEQ4INT 0x00000010 /* ro */
  214. #define LSEQ3INT 0x00000008 /* ro */
  215. #define LSEQ2INT 0x00000004 /* ro */
  216. #define LSEQ1INT 0x00000002 /* ro */
  217. #define LSEQ0INT 0x00000001 /* ro */
  218. #define LSEQINT_MASK (LSEQ7INT | LSEQ6INT | LSEQ5INT |\
  219. LSEQ4INT | LSEQ3INT | LSEQ2INT |\
  220. LSEQ1INT | LSEQ0INT)
  221. #define DCHDFIFDEBUG (REG_BASE_ADDR + 0x820)
  222. #define ENFAIRMST 0x00FF0000
  223. #define DISWRMST9 0x00000200
  224. #define DISWRMST8 0x00000100
  225. #define DISRDMST 0x000000FF
  226. #define ATOMICSTATCTL (REG_BASE_ADDR + 0x824)
  227. /* 8 bit wide */
  228. #define AUTOINC 0x80
  229. #define ATOMICERR 0x04
  230. #define ATOMICWIN 0x02
  231. #define ATOMICDONE 0x01
  232. #define ALTCIOADR (REG_BASE_ADDR + 0x828)
  233. /* 16 bit; bits 8:0 define CIO addr space of CSEQ */
  234. #define ASCBPTR (REG_BASE_ADDR + 0x82C)
  235. /* 16 bit wide */
  236. #define ADDBPTR (REG_BASE_ADDR + 0x82E)
  237. /* 16 bit wide */
  238. #define ANEWDATA (REG_BASE_ADDR + 0x830)
  239. /* 16 bit */
  240. #define AOLDDATA (REG_BASE_ADDR + 0x834)
  241. /* 16 bit */
  242. #define CTXACCESS (REG_BASE_ADDR + 0x838)
  243. /* 32 bit */
  244. /* 0x83Ch - 0xFFCh are reserved */
  245. /*
  246. * ARP2 External Processor Registers, Address Range : (0x00-0x1F)
  247. */
  248. #define ARP2CTL 0x00
  249. #define FRCSCRPERR 0x00040000
  250. #define FRCARP2PERR 0x00020000
  251. #define FRCARP2ILLOPC 0x00010000
  252. #define ENWAITTO 0x00008000
  253. #define PERRORDIS 0x00004000
  254. #define FAILDIS 0x00002000
  255. #define CIOPERRDIS 0x00001000
  256. #define BREAKEN3 0x00000800
  257. #define BREAKEN2 0x00000400
  258. #define BREAKEN1 0x00000200
  259. #define BREAKEN0 0x00000100
  260. #define EPAUSE 0x00000008
  261. #define PAUSED 0x00000004 /* ro */
  262. #define STEP 0x00000002
  263. #define ARP2RESET 0x00000001 /* wo */
  264. #define ARP2INT 0x04
  265. #define HALTCODE_MASK 0x00FF0000 /* ro */
  266. #define ARP2WAITTO 0x00000100
  267. #define ARP2HALTC 0x00000080
  268. #define ARP2ILLOPC 0x00000040
  269. #define ARP2PERR 0x00000020
  270. #define ARP2CIOPERR 0x00000010
  271. #define ARP2BREAK3 0x00000008
  272. #define ARP2BREAK2 0x00000004
  273. #define ARP2BREAK1 0x00000002
  274. #define ARP2BREAK0 0x00000001
  275. #define ARP2INTEN 0x08
  276. #define EN_ARP2WAITTO 0x00000100
  277. #define EN_ARP2HALTC 0x00000080
  278. #define EN_ARP2ILLOPC 0x00000040
  279. #define EN_ARP2PERR 0x00000020
  280. #define EN_ARP2CIOPERR 0x00000010
  281. #define EN_ARP2BREAK3 0x00000008
  282. #define EN_ARP2BREAK2 0x00000004
  283. #define EN_ARP2BREAK1 0x00000002
  284. #define EN_ARP2BREAK0 0x00000001
  285. #define ARP2BREAKADR01 0x0C
  286. #define BREAKADR1_MASK 0x0FFF0000
  287. #define BREAKADR0_MASK 0x00000FFF
  288. #define ARP2BREAKADR23 0x10
  289. #define BREAKADR3_MASK 0x0FFF0000
  290. #define BREAKADR2_MASK 0x00000FFF
  291. /* 0x14h - 0x1Ch are reserved */
  292. /*
  293. * ARP2 Registers, Address Range : (0x00-0x1F)
  294. * The definitions have the same address offset for CSEQ and LmSEQ
  295. * CIO Bus Registers.
  296. */
  297. #define MODEPTR 0x00
  298. #define DSTMODE 0xF0
  299. #define SRCMODE 0x0F
  300. #define ALTMODE 0x01
  301. #define ALTDMODE 0xF0
  302. #define ALTSMODE 0x0F
  303. #define ATOMICXCHG 0x02
  304. #define FLAG 0x04
  305. #define INTCODE_MASK 0xF0
  306. #define ALTMODEV2 0x04
  307. #define CARRY_INT 0x02
  308. #define CARRY 0x01
  309. #define ARP2INTCTL 0x05
  310. #define PAUSEDIS 0x80
  311. #define RSTINTCTL 0x40
  312. #define POPALTMODE 0x08
  313. #define ALTMODEV 0x04
  314. #define INTMASK 0x02
  315. #define IRET 0x01
  316. #define STACK 0x06
  317. #define FUNCTION1 0x07
  318. #define PRGMCNT 0x08
  319. #define ACCUM 0x0A
  320. #define SINDEX 0x0C
  321. #define DINDEX 0x0E
  322. #define ALLONES 0x10
  323. #define ALLZEROS 0x11
  324. #define SINDIR 0x12
  325. #define DINDIR 0x13
  326. #define JUMLDIR 0x14
  327. #define ARP2HALTCODE 0x15
  328. #define CURRADDR 0x16
  329. #define LASTADDR 0x18
  330. #define NXTLADDR 0x1A
  331. #define DBGPORTPTR 0x1C
  332. #define DBGPORT 0x1D
  333. /*
  334. * CIO Registers.
  335. * The definitions have the same address offset for CSEQ and LmSEQ
  336. * CIO Bus Registers.
  337. */
  338. #define MnSCBPTR 0x20
  339. #define MnDDBPTR 0x22
  340. #define SCRATCHPAGE 0x24
  341. #define MnSCRATCHPAGE 0x25
  342. #define SCRATCHPAGESV 0x26
  343. #define MnSCRATCHPAGESV 0x27
  344. #define MnDMAERRS 0x46
  345. #define MnSGDMAERRS 0x47
  346. #define MnSGBUF 0x53
  347. #define MnSGDMASTAT 0x5b
  348. #define MnDDMACTL 0x5c /* RAZOR.rspec.fm rev 1.5 is wrong */
  349. #define MnDDMASTAT 0x5d /* RAZOR.rspec.fm rev 1.5 is wrong */
  350. #define MnDDMAMODE 0x5e /* RAZOR.rspec.fm rev 1.5 is wrong */
  351. #define MnDMAENG 0x60
  352. #define MnPIPECTL 0x61
  353. #define MnSGBADR 0x65
  354. #define MnSCB_SITE 0x100
  355. #define MnDDB_SITE 0x180
  356. /*
  357. * The common definitions below have the same address offset for both
  358. * CSEQ and LmSEQ.
  359. */
  360. #define BISTCTL0 0x4C
  361. #define BISTCTL1 0x50
  362. #define MAPPEDSCR 0x800
  363. /*
  364. * CSEQ Host Register, Address Range : (0x000-0xFFC)
  365. */
  366. #define CSEQ_HOST_REG_BASE_ADR 0xB8001000
  367. #define CARP2CTL (CSEQ_HOST_REG_BASE_ADR + ARP2CTL)
  368. #define CARP2INT (CSEQ_HOST_REG_BASE_ADR + ARP2INT)
  369. #define CARP2INTEN (CSEQ_HOST_REG_BASE_ADR + ARP2INTEN)
  370. #define CARP2BREAKADR01 (CSEQ_HOST_REG_BASE_ADR+ARP2BREAKADR01)
  371. #define CARP2BREAKADR23 (CSEQ_HOST_REG_BASE_ADR+ARP2BREAKADR23)
  372. #define CBISTCTL (CSEQ_HOST_REG_BASE_ADR + BISTCTL1)
  373. #define CSEQRAMBISTEN 0x00000040
  374. #define CSEQRAMBISTDN 0x00000020 /* ro */
  375. #define CSEQRAMBISTFAIL 0x00000010 /* ro */
  376. #define CSEQSCRBISTEN 0x00000004
  377. #define CSEQSCRBISTDN 0x00000002 /* ro */
  378. #define CSEQSCRBISTFAIL 0x00000001 /* ro */
  379. #define CMAPPEDSCR (CSEQ_HOST_REG_BASE_ADR + MAPPEDSCR)
  380. /*
  381. * CSEQ CIO Bus Registers, Address Range : (0x0000-0x1FFC)
  382. * 16 modes, each mode is 512 bytes.
  383. * Unless specified, the register should valid for all modes.
  384. */
  385. #define CSEQ_CIO_REG_BASE_ADR REG_BASE_ADDR_CSEQCIO
  386. #define CSEQm_CIO_REG(Mode, Reg) \
  387. (CSEQ_CIO_REG_BASE_ADR + \
  388. ((u32) (Mode) * CSEQ_MODE_PAGE_SIZE) + (u32) (Reg))
  389. #define CMODEPTR (CSEQ_CIO_REG_BASE_ADR + MODEPTR)
  390. #define CALTMODE (CSEQ_CIO_REG_BASE_ADR + ALTMODE)
  391. #define CATOMICXCHG (CSEQ_CIO_REG_BASE_ADR + ATOMICXCHG)
  392. #define CFLAG (CSEQ_CIO_REG_BASE_ADR + FLAG)
  393. #define CARP2INTCTL (CSEQ_CIO_REG_BASE_ADR + ARP2INTCTL)
  394. #define CSTACK (CSEQ_CIO_REG_BASE_ADR + STACK)
  395. #define CFUNCTION1 (CSEQ_CIO_REG_BASE_ADR + FUNCTION1)
  396. #define CPRGMCNT (CSEQ_CIO_REG_BASE_ADR + PRGMCNT)
  397. #define CACCUM (CSEQ_CIO_REG_BASE_ADR + ACCUM)
  398. #define CSINDEX (CSEQ_CIO_REG_BASE_ADR + SINDEX)
  399. #define CDINDEX (CSEQ_CIO_REG_BASE_ADR + DINDEX)
  400. #define CALLONES (CSEQ_CIO_REG_BASE_ADR + ALLONES)
  401. #define CALLZEROS (CSEQ_CIO_REG_BASE_ADR + ALLZEROS)
  402. #define CSINDIR (CSEQ_CIO_REG_BASE_ADR + SINDIR)
  403. #define CDINDIR (CSEQ_CIO_REG_BASE_ADR + DINDIR)
  404. #define CJUMLDIR (CSEQ_CIO_REG_BASE_ADR + JUMLDIR)
  405. #define CARP2HALTCODE (CSEQ_CIO_REG_BASE_ADR + ARP2HALTCODE)
  406. #define CCURRADDR (CSEQ_CIO_REG_BASE_ADR + CURRADDR)
  407. #define CLASTADDR (CSEQ_CIO_REG_BASE_ADR + LASTADDR)
  408. #define CNXTLADDR (CSEQ_CIO_REG_BASE_ADR + NXTLADDR)
  409. #define CDBGPORTPTR (CSEQ_CIO_REG_BASE_ADR + DBGPORTPTR)
  410. #define CDBGPORT (CSEQ_CIO_REG_BASE_ADR + DBGPORT)
  411. #define CSCRATCHPAGE (CSEQ_CIO_REG_BASE_ADR + SCRATCHPAGE)
  412. #define CMnSCBPTR(Mode) CSEQm_CIO_REG(Mode, MnSCBPTR)
  413. #define CMnDDBPTR(Mode) CSEQm_CIO_REG(Mode, MnDDBPTR)
  414. #define CMnSCRATCHPAGE(Mode) CSEQm_CIO_REG(Mode, MnSCRATCHPAGE)
  415. #define CLINKCON (CSEQ_CIO_REG_BASE_ADR + 0x28)
  416. #define CCIOAACESS (CSEQ_CIO_REG_BASE_ADR + 0x2C)
  417. /* mode 0-7 */
  418. #define MnREQMBX 0x30
  419. #define CMnREQMBX(Mode) CSEQm_CIO_REG(Mode, 0x30)
  420. /* mode 8 */
  421. #define CSEQCON CSEQm_CIO_REG(8, 0x30)
  422. /* mode 0-7 */
  423. #define MnRSPMBX 0x34
  424. #define CMnRSPMBX(Mode) CSEQm_CIO_REG(Mode, 0x34)
  425. /* mode 8 */
  426. #define CSEQCOMCTL CSEQm_CIO_REG(8, 0x34)
  427. /* mode 8 */
  428. #define CSEQCOMSTAT CSEQm_CIO_REG(8, 0x35)
  429. /* mode 8 */
  430. #define CSEQCOMINTEN CSEQm_CIO_REG(8, 0x36)
  431. /* mode 8 */
  432. #define CSEQCOMDMACTL CSEQm_CIO_REG(8, 0x37)
  433. #define CSHALTERR 0x10
  434. #define RESETCSDMA 0x08 /* wo */
  435. #define STARTCSDMA 0x04
  436. #define STOPCSDMA 0x02 /* wo */
  437. #define CSDMAACT 0x01 /* ro */
  438. /* mode 0-7 */
  439. #define MnINT 0x38
  440. #define CMnINT(Mode) CSEQm_CIO_REG(Mode, 0x38)
  441. #define CMnREQMBXE 0x02
  442. #define CMnRSPMBXF 0x01
  443. #define CMnINT_MASK 0x00000003
  444. /* mode 8 */
  445. #define CSEQREQMBX CSEQm_CIO_REG(8, 0x38)
  446. /* mode 0-7 */
  447. #define MnINTEN 0x3C
  448. #define CMnINTEN(Mode) CSEQm_CIO_REG(Mode, 0x3C)
  449. #define EN_CMnRSPMBXF 0x01
  450. /* mode 8 */
  451. #define CSEQRSPMBX CSEQm_CIO_REG(8, 0x3C)
  452. /* mode 8 */
  453. #define CSDMAADR CSEQm_CIO_REG(8, 0x40)
  454. /* mode 8 */
  455. #define CSDMACNT CSEQm_CIO_REG(8, 0x48)
  456. /* mode 8 */
  457. #define CSEQDLCTL CSEQm_CIO_REG(8, 0x4D)
  458. #define DONELISTEND 0x10
  459. #define DONELISTSIZE_MASK 0x0F
  460. #define DONELISTSIZE_8ELEM 0x01
  461. #define DONELISTSIZE_16ELEM 0x02
  462. #define DONELISTSIZE_32ELEM 0x03
  463. #define DONELISTSIZE_64ELEM 0x04
  464. #define DONELISTSIZE_128ELEM 0x05
  465. #define DONELISTSIZE_256ELEM 0x06
  466. #define DONELISTSIZE_512ELEM 0x07
  467. #define DONELISTSIZE_1024ELEM 0x08
  468. #define DONELISTSIZE_2048ELEM 0x09
  469. #define DONELISTSIZE_4096ELEM 0x0A
  470. #define DONELISTSIZE_8192ELEM 0x0B
  471. #define DONELISTSIZE_16384ELEM 0x0C
  472. /* mode 8 */
  473. #define CSEQDLOFFS CSEQm_CIO_REG(8, 0x4E)
  474. /* mode 11 */
  475. #define CM11INTVEC0 CSEQm_CIO_REG(11, 0x50)
  476. /* mode 11 */
  477. #define CM11INTVEC1 CSEQm_CIO_REG(11, 0x52)
  478. /* mode 11 */
  479. #define CM11INTVEC2 CSEQm_CIO_REG(11, 0x54)
  480. #define CCONMSK (CSEQ_CIO_REG_BASE_ADR + 0x60)
  481. #define CCONEXIST (CSEQ_CIO_REG_BASE_ADR + 0x61)
  482. #define CCONMODE (CSEQ_CIO_REG_BASE_ADR + 0x62)
  483. #define CTIMERCALC (CSEQ_CIO_REG_BASE_ADR + 0x64)
  484. #define CINTDIS (CSEQ_CIO_REG_BASE_ADR + 0x68)
  485. /* mode 8, 32x32 bits, 128 bytes of mapped buffer */
  486. #define CSBUFFER CSEQm_CIO_REG(8, 0x80)
  487. #define CSCRATCH (CSEQ_CIO_REG_BASE_ADR + 0x1C0)
  488. /* mode 0-8 */
  489. #define CMnSCRATCH(Mode) CSEQm_CIO_REG(Mode, 0x1E0)
  490. /*
  491. * CSEQ Mapped Instruction RAM Page, Address Range : (0x0000-0x1FFC)
  492. */
  493. #define CSEQ_RAM_REG_BASE_ADR 0xB8004000
  494. /*
  495. * The common definitions below have the same address offset for all the Link
  496. * sequencers.
  497. */
  498. #define MODECTL 0x40
  499. #define DBGMODE 0x44
  500. #define CONTROL 0x48
  501. #define LEDTIMER 0x00010000
  502. #define LEDTIMERS_10us 0x00000000
  503. #define LEDTIMERS_1ms 0x00000800
  504. #define LEDTIMERS_100ms 0x00001000
  505. #define LEDMODE_TXRX 0x00000000
  506. #define LEDMODE_CONNECTED 0x00000200
  507. #define LEDPOL 0x00000100
  508. #define LSEQRAM 0x1000
  509. /*
  510. * LmSEQ Host Registers, Address Range : (0x0000-0x3FFC)
  511. */
  512. #define LSEQ0_HOST_REG_BASE_ADR 0xB8020000
  513. #define LSEQ1_HOST_REG_BASE_ADR 0xB8024000
  514. #define LSEQ2_HOST_REG_BASE_ADR 0xB8028000
  515. #define LSEQ3_HOST_REG_BASE_ADR 0xB802C000
  516. #define LSEQ4_HOST_REG_BASE_ADR 0xB8030000
  517. #define LSEQ5_HOST_REG_BASE_ADR 0xB8034000
  518. #define LSEQ6_HOST_REG_BASE_ADR 0xB8038000
  519. #define LSEQ7_HOST_REG_BASE_ADR 0xB803C000
  520. #define LmARP2CTL(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  521. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  522. ARP2CTL)
  523. #define LmARP2INT(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  524. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  525. ARP2INT)
  526. #define LmARP2INTEN(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  527. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  528. ARP2INTEN)
  529. #define LmDBGMODE(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  530. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  531. DBGMODE)
  532. #define LmCONTROL(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  533. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  534. CONTROL)
  535. #define LmARP2BREAKADR01(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  536. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  537. ARP2BREAKADR01)
  538. #define LmARP2BREAKADR23(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  539. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  540. ARP2BREAKADR23)
  541. #define LmMODECTL(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  542. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  543. MODECTL)
  544. #define LmAUTODISCI 0x08000000
  545. #define LmDSBLBITLT 0x04000000
  546. #define LmDSBLANTT 0x02000000
  547. #define LmDSBLCRTT 0x01000000
  548. #define LmDSBLCONT 0x00000100
  549. #define LmPRIMODE 0x00000080
  550. #define LmDSBLHOLD 0x00000040
  551. #define LmDISACK 0x00000020
  552. #define LmBLIND48 0x00000010
  553. #define LmRCVMODE_MASK 0x0000000C
  554. #define LmRCVMODE_PLD 0x00000000
  555. #define LmRCVMODE_HPC 0x00000004
  556. #define LmDBGMODE(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  557. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  558. DBGMODE)
  559. #define LmFRCPERR 0x80000000
  560. #define LmMEMSEL_MASK 0x30000000
  561. #define LmFRCRBPERR 0x00000000
  562. #define LmFRCTBPERR 0x10000000
  563. #define LmFRCSGBPERR 0x20000000
  564. #define LmFRCARBPERR 0x30000000
  565. #define LmRCVIDW 0x00080000
  566. #define LmINVDWERR 0x00040000
  567. #define LmRCVDISP 0x00004000
  568. #define LmDISPERR 0x00002000
  569. #define LmDSBLDSCR 0x00000800
  570. #define LmDSBLSCR 0x00000400
  571. #define LmFRCNAK 0x00000200
  572. #define LmFRCROFS 0x00000100
  573. #define LmFRCCRC 0x00000080
  574. #define LmFRMTYPE_MASK 0x00000070
  575. #define LmSG_DATA 0x00000000
  576. #define LmSG_COMMAND 0x00000010
  577. #define LmSG_TASK 0x00000020
  578. #define LmSG_TGTXFER 0x00000030
  579. #define LmSG_RESPONSE 0x00000040
  580. #define LmSG_IDENADDR 0x00000050
  581. #define LmSG_OPENADDR 0x00000060
  582. #define LmDISCRCGEN 0x00000008
  583. #define LmDISCRCCHK 0x00000004
  584. #define LmSSXMTFRM 0x00000002
  585. #define LmSSRCVFRM 0x00000001
  586. #define LmCONTROL(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  587. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  588. CONTROL)
  589. #define LmSTEPXMTFRM 0x00000002
  590. #define LmSTEPRCVFRM 0x00000001
  591. #define LmBISTCTL0(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  592. ((LinkNum)*LmSEQ_HOST_REG_SIZE) + \
  593. BISTCTL0)
  594. #define ARBBISTEN 0x40000000
  595. #define ARBBISTDN 0x20000000 /* ro */
  596. #define ARBBISTFAIL 0x10000000 /* ro */
  597. #define TBBISTEN 0x00000400
  598. #define TBBISTDN 0x00000200 /* ro */
  599. #define TBBISTFAIL 0x00000100 /* ro */
  600. #define RBBISTEN 0x00000040
  601. #define RBBISTDN 0x00000020 /* ro */
  602. #define RBBISTFAIL 0x00000010 /* ro */
  603. #define SGBISTEN 0x00000004
  604. #define SGBISTDN 0x00000002 /* ro */
  605. #define SGBISTFAIL 0x00000001 /* ro */
  606. #define LmBISTCTL1(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  607. ((LinkNum)*LmSEQ_HOST_REG_SIZE) +\
  608. BISTCTL1)
  609. #define LmRAMPAGE1 0x00000200
  610. #define LmRAMPAGE0 0x00000100
  611. #define LmIMEMBISTEN 0x00000040
  612. #define LmIMEMBISTDN 0x00000020 /* ro */
  613. #define LmIMEMBISTFAIL 0x00000010 /* ro */
  614. #define LmSCRBISTEN 0x00000004
  615. #define LmSCRBISTDN 0x00000002 /* ro */
  616. #define LmSCRBISTFAIL 0x00000001 /* ro */
  617. #define LmRAMPAGE (LmRAMPAGE1 + LmRAMPAGE0)
  618. #define LmRAMPAGE_LSHIFT 0x8
  619. #define LmSCRATCH(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  620. ((LinkNum) * LmSEQ_HOST_REG_SIZE) +\
  621. MAPPEDSCR)
  622. #define LmSEQRAM(LinkNum) (LSEQ0_HOST_REG_BASE_ADR + \
  623. ((LinkNum) * LmSEQ_HOST_REG_SIZE) +\
  624. LSEQRAM)
  625. /*
  626. * LmSEQ CIO Bus Register, Address Range : (0x0000-0xFFC)
  627. * 8 modes, each mode is 512 bytes.
  628. * Unless specified, the register should valid for all modes.
  629. */
  630. #define LmSEQ_CIOBUS_REG_BASE 0x2000
  631. #define LmSEQ_PHY_BASE(Mode, LinkNum) \
  632. (LSEQ0_HOST_REG_BASE_ADR + \
  633. (LmSEQ_HOST_REG_SIZE * (u32) (LinkNum)) + \
  634. LmSEQ_CIOBUS_REG_BASE + \
  635. ((u32) (Mode) * LmSEQ_MODE_PAGE_SIZE))
  636. #define LmSEQ_PHY_REG(Mode, LinkNum, Reg) \
  637. (LmSEQ_PHY_BASE(Mode, LinkNum) + (u32) (Reg))
  638. #define LmMODEPTR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, MODEPTR)
  639. #define LmALTMODE(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ALTMODE)
  640. #define LmATOMICXCHG(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ATOMICXCHG)
  641. #define LmFLAG(LinkNum) LmSEQ_PHY_REG(0, LinkNum, FLAG)
  642. #define LmARP2INTCTL(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ARP2INTCTL)
  643. #define LmSTACK(LinkNum) LmSEQ_PHY_REG(0, LinkNum, STACK)
  644. #define LmFUNCTION1(LinkNum) LmSEQ_PHY_REG(0, LinkNum, FUNCTION1)
  645. #define LmPRGMCNT(LinkNum) LmSEQ_PHY_REG(0, LinkNum, PRGMCNT)
  646. #define LmACCUM(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ACCUM)
  647. #define LmSINDEX(LinkNum) LmSEQ_PHY_REG(0, LinkNum, SINDEX)
  648. #define LmDINDEX(LinkNum) LmSEQ_PHY_REG(0, LinkNum, DINDEX)
  649. #define LmALLONES(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ALLONES)
  650. #define LmALLZEROS(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ALLZEROS)
  651. #define LmSINDIR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, SINDIR)
  652. #define LmDINDIR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, DINDIR)
  653. #define LmJUMLDIR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, JUMLDIR)
  654. #define LmARP2HALTCODE(LinkNum) LmSEQ_PHY_REG(0, LinkNum, ARP2HALTCODE)
  655. #define LmCURRADDR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, CURRADDR)
  656. #define LmLASTADDR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, LASTADDR)
  657. #define LmNXTLADDR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, NXTLADDR)
  658. #define LmDBGPORTPTR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, DBGPORTPTR)
  659. #define LmDBGPORT(LinkNum) LmSEQ_PHY_REG(0, LinkNum, DBGPORT)
  660. #define LmSCRATCHPAGE(LinkNum) LmSEQ_PHY_REG(0, LinkNum, SCRATCHPAGE)
  661. #define LmMnSCRATCHPAGE(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, \
  662. MnSCRATCHPAGE)
  663. #define LmTIMERCALC(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x28)
  664. #define LmREQMBX(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x30)
  665. #define LmRSPMBX(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x34)
  666. #define LmMnINT(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x38)
  667. #define CTXMEMSIZE 0x80000000 /* ro */
  668. #define LmACKREQ 0x08000000
  669. #define LmNAKREQ 0x04000000
  670. #define LmMnXMTERR 0x02000000
  671. #define LmM5OOBSVC 0x01000000
  672. #define LmHWTINT 0x00800000
  673. #define LmMnCTXDONE 0x00100000
  674. #define LmM2REQMBXF 0x00080000
  675. #define LmM2RSPMBXE 0x00040000
  676. #define LmMnDMAERR 0x00020000
  677. #define LmRCVPRIM 0x00010000
  678. #define LmRCVERR 0x00008000
  679. #define LmADDRRCV 0x00004000
  680. #define LmMnHDRMISS 0x00002000
  681. #define LmMnWAITSCB 0x00001000
  682. #define LmMnRLSSCB 0x00000800
  683. #define LmMnSAVECTX 0x00000400
  684. #define LmMnFETCHSG 0x00000200
  685. #define LmMnLOADCTX 0x00000100
  686. #define LmMnCFGICL 0x00000080
  687. #define LmMnCFGSATA 0x00000040
  688. #define LmMnCFGEXPSATA 0x00000020
  689. #define LmMnCFGCMPLT 0x00000010
  690. #define LmMnCFGRBUF 0x00000008
  691. #define LmMnSAVETTR 0x00000004
  692. #define LmMnCFGRDAT 0x00000002
  693. #define LmMnCFGHDR 0x00000001
  694. #define LmMnINTEN(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x3C)
  695. #define EN_LmACKREQ 0x08000000
  696. #define EN_LmNAKREQ 0x04000000
  697. #define EN_LmMnXMTERR 0x02000000
  698. #define EN_LmM5OOBSVC 0x01000000
  699. #define EN_LmHWTINT 0x00800000
  700. #define EN_LmMnCTXDONE 0x00100000
  701. #define EN_LmM2REQMBXF 0x00080000
  702. #define EN_LmM2RSPMBXE 0x00040000
  703. #define EN_LmMnDMAERR 0x00020000
  704. #define EN_LmRCVPRIM 0x00010000
  705. #define EN_LmRCVERR 0x00008000
  706. #define EN_LmADDRRCV 0x00004000
  707. #define EN_LmMnHDRMISS 0x00002000
  708. #define EN_LmMnWAITSCB 0x00001000
  709. #define EN_LmMnRLSSCB 0x00000800
  710. #define EN_LmMnSAVECTX 0x00000400
  711. #define EN_LmMnFETCHSG 0x00000200
  712. #define EN_LmMnLOADCTX 0x00000100
  713. #define EN_LmMnCFGICL 0x00000080
  714. #define EN_LmMnCFGSATA 0x00000040
  715. #define EN_LmMnCFGEXPSATA 0x00000020
  716. #define EN_LmMnCFGCMPLT 0x00000010
  717. #define EN_LmMnCFGRBUF 0x00000008
  718. #define EN_LmMnSAVETTR 0x00000004
  719. #define EN_LmMnCFGRDAT 0x00000002
  720. #define EN_LmMnCFGHDR 0x00000001
  721. #define LmM0INTEN_MASK (EN_LmMnCFGCMPLT | EN_LmMnCFGRBUF | \
  722. EN_LmMnSAVETTR | EN_LmMnCFGRDAT | \
  723. EN_LmMnCFGHDR | EN_LmRCVERR | \
  724. EN_LmADDRRCV | EN_LmMnHDRMISS | \
  725. EN_LmMnRLSSCB | EN_LmMnSAVECTX | \
  726. EN_LmMnFETCHSG | EN_LmMnLOADCTX | \
  727. EN_LmHWTINT | EN_LmMnCTXDONE | \
  728. EN_LmRCVPRIM | EN_LmMnCFGSATA | \
  729. EN_LmMnCFGEXPSATA | EN_LmMnDMAERR)
  730. #define LmM1INTEN_MASK (EN_LmMnCFGCMPLT | EN_LmADDRRCV | \
  731. EN_LmMnRLSSCB | EN_LmMnSAVECTX | \
  732. EN_LmMnFETCHSG | EN_LmMnLOADCTX | \
  733. EN_LmMnXMTERR | EN_LmHWTINT | \
  734. EN_LmMnCTXDONE | EN_LmRCVPRIM | \
  735. EN_LmRCVERR | EN_LmMnDMAERR)
  736. #define LmM2INTEN_MASK (EN_LmADDRRCV | EN_LmHWTINT | \
  737. EN_LmM2REQMBXF | EN_LmRCVPRIM | \
  738. EN_LmRCVERR)
  739. #define LmM5INTEN_MASK (EN_LmADDRRCV | EN_LmM5OOBSVC | \
  740. EN_LmHWTINT | EN_LmRCVPRIM | \
  741. EN_LmRCVERR)
  742. #define LmXMTPRIMD(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x40)
  743. #define LmXMTPRIMCS(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x44)
  744. #define LmCONSTAT(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x45)
  745. #define LmMnDMAERRS(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x46)
  746. #define LmMnSGDMAERRS(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x47)
  747. #define LmM0EXPHDRP(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x48)
  748. #define LmM1SASALIGN(LinkNum) LmSEQ_PHY_REG(1, LinkNum, 0x48)
  749. #define SAS_ALIGN_DEFAULT 0xFF
  750. #define LmM0MSKHDRP(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x49)
  751. #define LmM1STPALIGN(LinkNum) LmSEQ_PHY_REG(1, LinkNum, 0x49)
  752. #define STP_ALIGN_DEFAULT 0x1F
  753. #define LmM0RCVHDRP(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x4A)
  754. #define LmM1XMTHDRP(LinkNum) LmSEQ_PHY_REG(1, LinkNum, 0x4A)
  755. #define LmM0ICLADR(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x4B)
  756. #define LmM1ALIGNMODE(LinkNum) LmSEQ_PHY_REG(1, LinkNum, 0x4B)
  757. #define LmDISALIGN 0x20
  758. #define LmROTSTPALIGN 0x10
  759. #define LmSTPALIGN 0x08
  760. #define LmROTNOTIFY 0x04
  761. #define LmDUALALIGN 0x02
  762. #define LmROTALIGN 0x01
  763. #define LmM0EXPRCVNT(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x4C)
  764. #define LmM1XMTCNT(LinkNum) LmSEQ_PHY_REG(1, LinkNum, 0x4C)
  765. #define LmMnBUFSTAT(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x4E)
  766. #define LmMnBUFPERR 0x01
  767. /* mode 0-1 */
  768. #define LmMnXFRLVL(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x59)
  769. #define LmMnXFRLVL_128 0x05
  770. #define LmMnXFRLVL_256 0x04
  771. #define LmMnXFRLVL_512 0x03
  772. #define LmMnXFRLVL_1024 0x02
  773. #define LmMnXFRLVL_1536 0x01
  774. #define LmMnXFRLVL_2048 0x00
  775. /* mode 0-1 */
  776. #define LmMnSGDMACTL(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x5A)
  777. #define LmMnRESETSG 0x04
  778. #define LmMnSTOPSG 0x02
  779. #define LmMnSTARTSG 0x01
  780. /* mode 0-1 */
  781. #define LmMnSGDMASTAT(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x5B)
  782. /* mode 0-1 */
  783. #define LmMnDDMACTL(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x5C)
  784. #define LmMnFLUSH 0x40 /* wo */
  785. #define LmMnRLSRTRY 0x20 /* wo */
  786. #define LmMnDISCARD 0x10 /* wo */
  787. #define LmMnRESETDAT 0x08 /* wo */
  788. #define LmMnSUSDAT 0x04 /* wo */
  789. #define LmMnSTOPDAT 0x02 /* wo */
  790. #define LmMnSTARTDAT 0x01 /* wo */
  791. /* mode 0-1 */
  792. #define LmMnDDMASTAT(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x5D)
  793. #define LmMnDPEMPTY 0x80
  794. #define LmMnFLUSHING 0x40
  795. #define LmMnDDMAREQ 0x20
  796. #define LmMnHDMAREQ 0x10
  797. #define LmMnDATFREE 0x08
  798. #define LmMnDATSUS 0x04
  799. #define LmMnDATACT 0x02
  800. #define LmMnDATEN 0x01
  801. /* mode 0-1 */
  802. #define LmMnDDMAMODE(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x5E)
  803. #define LmMnDMATYPE_NORMAL 0x0000
  804. #define LmMnDMATYPE_HOST_ONLY_TX 0x0001
  805. #define LmMnDMATYPE_DEVICE_ONLY_TX 0x0002
  806. #define LmMnDMATYPE_INVALID 0x0003
  807. #define LmMnDMATYPE_MASK 0x0003
  808. #define LmMnDMAWRAP 0x0004
  809. #define LmMnBITBUCKET 0x0008
  810. #define LmMnDISHDR 0x0010
  811. #define LmMnSTPCRC 0x0020
  812. #define LmXTEST 0x0040
  813. #define LmMnDISCRC 0x0080
  814. #define LmMnENINTLK 0x0100
  815. #define LmMnADDRFRM 0x0400
  816. #define LmMnENXMTCRC 0x0800
  817. /* mode 0-1 */
  818. #define LmMnXFRCNT(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x70)
  819. /* mode 0-1 */
  820. #define LmMnDPSEL(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x7B)
  821. #define LmMnDPSEL_MASK 0x07
  822. #define LmMnEOLPRE 0x40
  823. #define LmMnEOSPRE 0x80
  824. /* Registers used in conjunction with LmMnDPSEL and LmMnDPACC registers */
  825. /* Receive Mode n = 0 */
  826. #define LmMnHRADDR 0x00
  827. #define LmMnHBYTECNT 0x01
  828. #define LmMnHREWIND 0x02
  829. #define LmMnDWADDR 0x03
  830. #define LmMnDSPACECNT 0x04
  831. #define LmMnDFRMSIZE 0x05
  832. /* Registers used in conjunction with LmMnDPSEL and LmMnDPACC registers */
  833. /* Transmit Mode n = 1 */
  834. #define LmMnHWADDR 0x00
  835. #define LmMnHSPACECNT 0x01
  836. /* #define LmMnHREWIND 0x02 */
  837. #define LmMnDRADDR 0x03
  838. #define LmMnDBYTECNT 0x04
  839. /* #define LmMnDFRMSIZE 0x05 */
  840. /* mode 0-1 */
  841. #define LmMnDPACC(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x78)
  842. #define LmMnDPACC_MASK 0x00FFFFFF
  843. /* mode 0-1 */
  844. #define LmMnHOLDLVL(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x7D)
  845. #define LmPRMSTAT0(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x80)
  846. #define LmPRMSTAT0BYTE0 0x80
  847. #define LmPRMSTAT0BYTE1 0x81
  848. #define LmPRMSTAT0BYTE2 0x82
  849. #define LmPRMSTAT0BYTE3 0x83
  850. #define LmFRAMERCVD 0x80000000
  851. #define LmXFRRDYRCVD 0x40000000
  852. #define LmUNKNOWNP 0x20000000
  853. #define LmBREAK 0x10000000
  854. #define LmDONE 0x08000000
  855. #define LmOPENACPT 0x04000000
  856. #define LmOPENRJCT 0x02000000
  857. #define LmOPENRTRY 0x01000000
  858. #define LmCLOSERV1 0x00800000
  859. #define LmCLOSERV0 0x00400000
  860. #define LmCLOSENORM 0x00200000
  861. #define LmCLOSECLAF 0x00100000
  862. #define LmNOTIFYRV2 0x00080000
  863. #define LmNOTIFYRV1 0x00040000
  864. #define LmNOTIFYRV0 0x00020000
  865. #define LmNOTIFYSPIN 0x00010000
  866. #define LmBROADRV4 0x00008000
  867. #define LmBROADRV3 0x00004000
  868. #define LmBROADRV2 0x00002000
  869. #define LmBROADRV1 0x00001000
  870. #define LmBROADSES 0x00000800
  871. #define LmBROADRVCH1 0x00000400
  872. #define LmBROADRVCH0 0x00000200
  873. #define LmBROADCH 0x00000100
  874. #define LmAIPRVWP 0x00000080
  875. #define LmAIPWP 0x00000040
  876. #define LmAIPWD 0x00000020
  877. #define LmAIPWC 0x00000010
  878. #define LmAIPRV2 0x00000008
  879. #define LmAIPRV1 0x00000004
  880. #define LmAIPRV0 0x00000002
  881. #define LmAIPNRML 0x00000001
  882. #define LmBROADCAST_MASK (LmBROADCH | LmBROADRVCH0 | \
  883. LmBROADRVCH1)
  884. #define LmPRMSTAT1(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0x84)
  885. #define LmPRMSTAT1BYTE0 0x84
  886. #define LmPRMSTAT1BYTE1 0x85
  887. #define LmPRMSTAT1BYTE2 0x86
  888. #define LmPRMSTAT1BYTE3 0x87
  889. #define LmFRMRCVDSTAT 0x80000000
  890. #define LmBREAK_DET 0x04000000
  891. #define LmCLOSE_DET 0x02000000
  892. #define LmDONE_DET 0x01000000
  893. #define LmXRDY 0x00040000
  894. #define LmSYNCSRST 0x00020000
  895. #define LmSYNC 0x00010000
  896. #define LmXHOLD 0x00008000
  897. #define LmRRDY 0x00004000
  898. #define LmHOLD 0x00002000
  899. #define LmROK 0x00001000
  900. #define LmRIP 0x00000800
  901. #define LmCRBLK 0x00000400
  902. #define LmACK 0x00000200
  903. #define LmNAK 0x00000100
  904. #define LmHARDRST 0x00000080
  905. #define LmERROR 0x00000040
  906. #define LmRERR 0x00000020
  907. #define LmPMREQP 0x00000010
  908. #define LmPMREQS 0x00000008
  909. #define LmPMACK 0x00000004
  910. #define LmPMNAK 0x00000002
  911. #define LmDMAT 0x00000001
  912. /* mode 1 */
  913. #define LmMnSATAFS(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x7E)
  914. #define LmMnXMTSIZE(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0x93)
  915. /* mode 0 */
  916. #define LmMnFRMERR(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0xB0)
  917. #define LmACRCERR 0x00000800
  918. #define LmPHYOVRN 0x00000400
  919. #define LmOBOVRN 0x00000200
  920. #define LmMnZERODATA 0x00000100
  921. #define LmSATAINTLK 0x00000080
  922. #define LmMnCRCERR 0x00000020
  923. #define LmRRDYOVRN 0x00000010
  924. #define LmMISSSOAF 0x00000008
  925. #define LmMISSSOF 0x00000004
  926. #define LmMISSEOAF 0x00000002
  927. #define LmMISSEOF 0x00000001
  928. #define LmFRMERREN(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xB4)
  929. #define EN_LmACRCERR 0x00000800
  930. #define EN_LmPHYOVRN 0x00000400
  931. #define EN_LmOBOVRN 0x00000200
  932. #define EN_LmMnZERODATA 0x00000100
  933. #define EN_LmSATAINTLK 0x00000080
  934. #define EN_LmFRMBAD 0x00000040
  935. #define EN_LmMnCRCERR 0x00000020
  936. #define EN_LmRRDYOVRN 0x00000010
  937. #define EN_LmMISSSOAF 0x00000008
  938. #define EN_LmMISSSOF 0x00000004
  939. #define EN_LmMISSEOAF 0x00000002
  940. #define EN_LmMISSEOF 0x00000001
  941. #define LmFRMERREN_MASK (EN_LmSATAINTLK | EN_LmMnCRCERR | \
  942. EN_LmRRDYOVRN | EN_LmMISSSOF | \
  943. EN_LmMISSEOAF | EN_LmMISSEOF | \
  944. EN_LmACRCERR | LmPHYOVRN | \
  945. EN_LmOBOVRN | EN_LmMnZERODATA)
  946. #define LmHWTSTATEN(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xC5)
  947. #define EN_LmDONETO 0x80
  948. #define EN_LmINVDISP 0x40
  949. #define EN_LmINVDW 0x20
  950. #define EN_LmDWSEVENT 0x08
  951. #define EN_LmCRTTTO 0x04
  952. #define EN_LmANTTTO 0x02
  953. #define EN_LmBITLTTO 0x01
  954. #define LmHWTSTATEN_MASK (EN_LmINVDISP | EN_LmINVDW | \
  955. EN_LmDWSEVENT | EN_LmCRTTTO | \
  956. EN_LmANTTTO | EN_LmDONETO | \
  957. EN_LmBITLTTO)
  958. #define LmHWTSTAT(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xC7)
  959. #define LmDONETO 0x80
  960. #define LmINVDISP 0x40
  961. #define LmINVDW 0x20
  962. #define LmDWSEVENT 0x08
  963. #define LmCRTTTO 0x04
  964. #define LmANTTTO 0x02
  965. #define LmBITLTTO 0x01
  966. #define LmMnDATABUFADR(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0xC8)
  967. #define LmDATABUFADR_MASK 0x0FFF
  968. #define LmMnDATABUF(LinkNum, Mode) LmSEQ_PHY_REG(Mode, LinkNum, 0xCA)
  969. #define LmPRIMSTAT0EN(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xE0)
  970. #define EN_LmUNKNOWNP 0x20000000
  971. #define EN_LmBREAK 0x10000000
  972. #define EN_LmDONE 0x08000000
  973. #define EN_LmOPENACPT 0x04000000
  974. #define EN_LmOPENRJCT 0x02000000
  975. #define EN_LmOPENRTRY 0x01000000
  976. #define EN_LmCLOSERV1 0x00800000
  977. #define EN_LmCLOSERV0 0x00400000
  978. #define EN_LmCLOSENORM 0x00200000
  979. #define EN_LmCLOSECLAF 0x00100000
  980. #define EN_LmNOTIFYRV2 0x00080000
  981. #define EN_LmNOTIFYRV1 0x00040000
  982. #define EN_LmNOTIFYRV0 0x00020000
  983. #define EN_LmNOTIFYSPIN 0x00010000
  984. #define EN_LmBROADRV4 0x00008000
  985. #define EN_LmBROADRV3 0x00004000
  986. #define EN_LmBROADRV2 0x00002000
  987. #define EN_LmBROADRV1 0x00001000
  988. #define EN_LmBROADRV0 0x00000800
  989. #define EN_LmBROADRVCH1 0x00000400
  990. #define EN_LmBROADRVCH0 0x00000200
  991. #define EN_LmBROADCH 0x00000100
  992. #define EN_LmAIPRVWP 0x00000080
  993. #define EN_LmAIPWP 0x00000040
  994. #define EN_LmAIPWD 0x00000020
  995. #define EN_LmAIPWC 0x00000010
  996. #define EN_LmAIPRV2 0x00000008
  997. #define EN_LmAIPRV1 0x00000004
  998. #define EN_LmAIPRV0 0x00000002
  999. #define EN_LmAIPNRML 0x00000001
  1000. #define LmPRIMSTAT0EN_MASK (EN_LmBREAK | \
  1001. EN_LmDONE | EN_LmOPENACPT | \
  1002. EN_LmOPENRJCT | EN_LmOPENRTRY | \
  1003. EN_LmCLOSERV1 | EN_LmCLOSERV0 | \
  1004. EN_LmCLOSENORM | EN_LmCLOSECLAF | \
  1005. EN_LmBROADRV4 | EN_LmBROADRV3 | \
  1006. EN_LmBROADRV2 | EN_LmBROADRV1 | \
  1007. EN_LmBROADRV0 | EN_LmBROADRVCH1 | \
  1008. EN_LmBROADRVCH0 | EN_LmBROADCH | \
  1009. EN_LmAIPRVWP | EN_LmAIPWP | \
  1010. EN_LmAIPWD | EN_LmAIPWC | \
  1011. EN_LmAIPRV2 | EN_LmAIPRV1 | \
  1012. EN_LmAIPRV0 | EN_LmAIPNRML)
  1013. #define LmPRIMSTAT1EN(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xE4)
  1014. #define EN_LmXRDY 0x00040000
  1015. #define EN_LmSYNCSRST 0x00020000
  1016. #define EN_LmSYNC 0x00010000
  1017. #define EN_LmXHOLD 0x00008000
  1018. #define EN_LmRRDY 0x00004000
  1019. #define EN_LmHOLD 0x00002000
  1020. #define EN_LmROK 0x00001000
  1021. #define EN_LmRIP 0x00000800
  1022. #define EN_LmCRBLK 0x00000400
  1023. #define EN_LmACK 0x00000200
  1024. #define EN_LmNAK 0x00000100
  1025. #define EN_LmHARDRST 0x00000080
  1026. #define EN_LmERROR 0x00000040
  1027. #define EN_LmRERR 0x00000020
  1028. #define EN_LmPMREQP 0x00000010
  1029. #define EN_LmPMREQS 0x00000008
  1030. #define EN_LmPMACK 0x00000004
  1031. #define EN_LmPMNAK 0x00000002
  1032. #define EN_LmDMAT 0x00000001
  1033. #define LmPRIMSTAT1EN_MASK (EN_LmHARDRST | \
  1034. EN_LmSYNCSRST | \
  1035. EN_LmPMREQP | EN_LmPMREQS | \
  1036. EN_LmPMACK | EN_LmPMNAK)
  1037. #define LmSMSTATE(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xE8)
  1038. #define LmSMSTATEBRK(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xEC)
  1039. #define LmSMDBGCTL(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xF0)
  1040. /*
  1041. * LmSEQ CIO Bus Mode 3 Register.
  1042. * Mode 3: Configuration and Setup, IOP Context SCB.
  1043. */
  1044. #define LmM3SATATIMER(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x48)
  1045. #define LmM3INTVEC0(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x90)
  1046. #define LmM3INTVEC1(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x92)
  1047. #define LmM3INTVEC2(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x94)
  1048. #define LmM3INTVEC3(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x96)
  1049. #define LmM3INTVEC4(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x98)
  1050. #define LmM3INTVEC5(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x9A)
  1051. #define LmM3INTVEC6(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x9C)
  1052. #define LmM3INTVEC7(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0x9E)
  1053. #define LmM3INTVEC8(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0xA4)
  1054. #define LmM3INTVEC9(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0xA6)
  1055. #define LmM3INTVEC10(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0xB0)
  1056. #define LmM3FRMGAP(LinkNum) LmSEQ_PHY_REG(3, LinkNum, 0xB4)
  1057. #define LmBITL_TIMER(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xA2)
  1058. #define LmWWN(LinkNum) LmSEQ_PHY_REG(0, LinkNum, 0xA8)
  1059. /*
  1060. * LmSEQ CIO Bus Mode 5 Registers.
  1061. * Mode 5: Phy/OOB Control and Status.
  1062. */
  1063. #define LmSEQ_OOB_REG(phy_id, reg) LmSEQ_PHY_REG(5, (phy_id), (reg))
  1064. #define OOB_BFLTR 0x100
  1065. #define BFLTR_THR_MASK 0xF0
  1066. #define BFLTR_TC_MASK 0x0F
  1067. #define OOB_INIT_MIN 0x102
  1068. #define OOB_INIT_MAX 0x104
  1069. #define OOB_INIT_NEG 0x106
  1070. #define OOB_SAS_MIN 0x108
  1071. #define OOB_SAS_MAX 0x10A
  1072. #define OOB_SAS_NEG 0x10C
  1073. #define OOB_WAKE_MIN 0x10E
  1074. #define OOB_WAKE_MAX 0x110
  1075. #define OOB_WAKE_NEG 0x112
  1076. #define OOB_IDLE_MAX 0x114
  1077. #define OOB_BURST_MAX 0x116
  1078. #define OOB_DATA_KBITS 0x126
  1079. #define OOB_ALIGN_0_DATA 0x12C
  1080. #define OOB_ALIGN_1_DATA 0x130
  1081. #define D10_2_DATA_k 0x00
  1082. #define SYNC_DATA_k 0x02
  1083. #define ALIGN_1_DATA_k 0x04
  1084. #define ALIGN_0_DATA_k 0x08
  1085. #define BURST_DATA_k 0x10
  1086. #define OOB_PHY_RESET_COUNT 0x13C
  1087. #define OOB_SIG_GEN 0x140
  1088. #define START_OOB 0x80
  1089. #define START_DWS 0x40
  1090. #define ALIGN_CNT3 0x30
  1091. #define ALIGN_CNT2 0x20
  1092. #define ALIGN_CNT1 0x10
  1093. #define ALIGN_CNT4 0x00
  1094. #define STOP_DWS 0x08
  1095. #define SEND_COMSAS 0x04
  1096. #define SEND_COMINIT 0x02
  1097. #define SEND_COMWAKE 0x01
  1098. #define OOB_XMIT 0x141
  1099. #define TX_ENABLE 0x80
  1100. #define XMIT_OOB_BURST 0x10
  1101. #define XMIT_D10_2 0x08
  1102. #define XMIT_SYNC 0x04
  1103. #define XMIT_ALIGN_1 0x02
  1104. #define XMIT_ALIGN_0 0x01
  1105. #define FUNCTION_MASK 0x142
  1106. #define SAS_MODE_DIS 0x80
  1107. #define SATA_MODE_DIS 0x40
  1108. #define SPINUP_HOLD_DIS 0x20
  1109. #define HOT_PLUG_DIS 0x10
  1110. #define SATA_PS_DIS 0x08
  1111. #define FUNCTION_MASK_DEFAULT (SPINUP_HOLD_DIS | SATA_PS_DIS)
  1112. #define OOB_MODE 0x143
  1113. #define SAS_MODE 0x80
  1114. #define SATA_MODE 0x40
  1115. #define SLOW_CLK 0x20
  1116. #define FORCE_XMIT_15 0x08
  1117. #define PHY_SPEED_60 0x04
  1118. #define PHY_SPEED_30 0x02
  1119. #define PHY_SPEED_15 0x01
  1120. #define CURRENT_STATUS 0x144
  1121. #define CURRENT_OOB_DONE 0x80
  1122. #define CURRENT_LOSS_OF_SIGNAL 0x40
  1123. #define CURRENT_SPINUP_HOLD 0x20
  1124. #define CURRENT_HOT_PLUG_CNCT 0x10
  1125. #define CURRENT_GTO_TIMEOUT 0x08
  1126. #define CURRENT_OOB_TIMEOUT 0x04
  1127. #define CURRENT_DEVICE_PRESENT 0x02
  1128. #define CURRENT_OOB_ERROR 0x01
  1129. #define CURRENT_OOB1_ERROR (CURRENT_HOT_PLUG_CNCT | \
  1130. CURRENT_GTO_TIMEOUT)
  1131. #define CURRENT_OOB2_ERROR (CURRENT_HOT_PLUG_CNCT | \
  1132. CURRENT_OOB_ERROR)
  1133. #define DEVICE_ADDED_W_CNT (CURRENT_OOB_DONE | \
  1134. CURRENT_HOT_PLUG_CNCT | \
  1135. CURRENT_DEVICE_PRESENT)
  1136. #define DEVICE_ADDED_WO_CNT (CURRENT_OOB_DONE | \
  1137. CURRENT_DEVICE_PRESENT)
  1138. #define DEVICE_REMOVED CURRENT_LOSS_OF_SIGNAL
  1139. #define CURRENT_PHY_MASK (CURRENT_OOB_DONE | \
  1140. CURRENT_LOSS_OF_SIGNAL | \
  1141. CURRENT_SPINUP_HOLD | \
  1142. CURRENT_HOT_PLUG_CNCT | \
  1143. CURRENT_GTO_TIMEOUT | \
  1144. CURRENT_DEVICE_PRESENT | \
  1145. CURRENT_OOB_ERROR )
  1146. #define CURRENT_ERR_MASK (CURRENT_LOSS_OF_SIGNAL | \
  1147. CURRENT_GTO_TIMEOUT | \
  1148. CURRENT_OOB_TIMEOUT | \
  1149. CURRENT_OOB_ERROR )
  1150. #define SPEED_MASK 0x145
  1151. #define SATA_SPEED_30_DIS 0x10
  1152. #define SATA_SPEED_15_DIS 0x08
  1153. #define SAS_SPEED_60_DIS 0x04
  1154. #define SAS_SPEED_30_DIS 0x02
  1155. #define SAS_SPEED_15_DIS 0x01
  1156. #define SAS_SPEED_MASK_DEFAULT 0x00
  1157. #define OOB_TIMER_ENABLE 0x14D
  1158. #define HOT_PLUG_EN 0x80
  1159. #define RCD_EN 0x40
  1160. #define COMTIMER_EN 0x20
  1161. #define SNTT_EN 0x10
  1162. #define SNLT_EN 0x04
  1163. #define SNWT_EN 0x02
  1164. #define ALIGN_EN 0x01
  1165. #define OOB_STATUS 0x14E
  1166. #define OOB_DONE 0x80
  1167. #define LOSS_OF_SIGNAL 0x40 /* ro */
  1168. #define SPINUP_HOLD 0x20
  1169. #define HOT_PLUG_CNCT 0x10 /* ro */
  1170. #define GTO_TIMEOUT 0x08 /* ro */
  1171. #define OOB_TIMEOUT 0x04 /* ro */
  1172. #define DEVICE_PRESENT 0x02 /* ro */
  1173. #define OOB_ERROR 0x01 /* ro */
  1174. #define OOB_STATUS_ERROR_MASK (LOSS_OF_SIGNAL | GTO_TIMEOUT | \
  1175. OOB_TIMEOUT | OOB_ERROR)
  1176. #define OOB_STATUS_CLEAR 0x14F
  1177. #define OOB_DONE_CLR 0x80
  1178. #define LOSS_OF_SIGNAL_CLR 0x40
  1179. #define SPINUP_HOLD_CLR 0x20
  1180. #define HOT_PLUG_CNCT_CLR 0x10
  1181. #define GTO_TIMEOUT_CLR 0x08
  1182. #define OOB_TIMEOUT_CLR 0x04
  1183. #define OOB_ERROR_CLR 0x01
  1184. #define HOT_PLUG_DELAY 0x150
  1185. /* In 5 ms units. 20 = 100 ms. */
  1186. #define HOTPLUG_DELAY_TIMEOUT 20
  1187. #define INT_ENABLE_2 0x15A
  1188. #define OOB_DONE_EN 0x80
  1189. #define LOSS_OF_SIGNAL_EN 0x40
  1190. #define SPINUP_HOLD_EN 0x20
  1191. #define HOT_PLUG_CNCT_EN 0x10
  1192. #define GTO_TIMEOUT_EN 0x08
  1193. #define OOB_TIMEOUT_EN 0x04
  1194. #define DEVICE_PRESENT_EN 0x02
  1195. #define OOB_ERROR_EN 0x01
  1196. #define PHY_CONTROL_0 0x160
  1197. #define PHY_LOWPWREN_TX 0x80
  1198. #define PHY_LOWPWREN_RX 0x40
  1199. #define SPARE_REG_160_B5 0x20
  1200. #define OFFSET_CANCEL_RX 0x10
  1201. /* bits 3:2 */
  1202. #define PHY_RXCOMCENTER_60V 0x00
  1203. #define PHY_RXCOMCENTER_70V 0x04
  1204. #define PHY_RXCOMCENTER_80V 0x08
  1205. #define PHY_RXCOMCENTER_90V 0x0C
  1206. #define PHY_RXCOMCENTER_MASK 0x0C
  1207. #define PHY_RESET 0x02
  1208. #define SAS_DEFAULT_SEL 0x01
  1209. #define PHY_CONTROL_1 0x161
  1210. /* bits 2:0 */
  1211. #define SATA_PHY_DETLEVEL_50mv 0x00
  1212. #define SATA_PHY_DETLEVEL_75mv 0x01
  1213. #define SATA_PHY_DETLEVEL_100mv 0x02
  1214. #define SATA_PHY_DETLEVEL_125mv 0x03
  1215. #define SATA_PHY_DETLEVEL_150mv 0x04
  1216. #define SATA_PHY_DETLEVEL_175mv 0x05
  1217. #define SATA_PHY_DETLEVEL_200mv 0x06
  1218. #define SATA_PHY_DETLEVEL_225mv 0x07
  1219. #define SATA_PHY_DETLEVEL_MASK 0x07
  1220. /* bits 5:3 */
  1221. #define SAS_PHY_DETLEVEL_50mv 0x00
  1222. #define SAS_PHY_DETLEVEL_75mv 0x08
  1223. #define SAS_PHY_DETLEVEL_100mv 0x10
  1224. #define SAS_PHY_DETLEVEL_125mv 0x11
  1225. #define SAS_PHY_DETLEVEL_150mv 0x20
  1226. #define SAS_PHY_DETLEVEL_175mv 0x21
  1227. #define SAS_PHY_DETLEVEL_200mv 0x30
  1228. #define SAS_PHY_DETLEVEL_225mv 0x31
  1229. #define SAS_PHY_DETLEVEL_MASK 0x38
  1230. #define PHY_CONTROL_2 0x162
  1231. /* bits 7:5 */
  1232. #define SATA_PHY_DRV_400mv 0x00
  1233. #define SATA_PHY_DRV_450mv 0x20
  1234. #define SATA_PHY_DRV_500mv 0x40
  1235. #define SATA_PHY_DRV_550mv 0x60
  1236. #define SATA_PHY_DRV_600mv 0x80
  1237. #define SATA_PHY_DRV_650mv 0xA0
  1238. #define SATA_PHY_DRV_725mv 0xC0
  1239. #define SATA_PHY_DRV_800mv 0xE0
  1240. #define SATA_PHY_DRV_MASK 0xE0
  1241. /* bits 4:3 */
  1242. #define SATA_PREEMP_0 0x00
  1243. #define SATA_PREEMP_1 0x08
  1244. #define SATA_PREEMP_2 0x10
  1245. #define SATA_PREEMP_3 0x18
  1246. #define SATA_PREEMP_MASK 0x18
  1247. #define SATA_CMSH1P5 0x04
  1248. /* bits 1:0 */
  1249. #define SATA_SLEW_0 0x00
  1250. #define SATA_SLEW_1 0x01
  1251. #define SATA_SLEW_2 0x02
  1252. #define SATA_SLEW_3 0x03
  1253. #define SATA_SLEW_MASK 0x03
  1254. #define PHY_CONTROL_3 0x163
  1255. /* bits 7:5 */
  1256. #define SAS_PHY_DRV_400mv 0x00
  1257. #define SAS_PHY_DRV_450mv 0x20
  1258. #define SAS_PHY_DRV_500mv 0x40
  1259. #define SAS_PHY_DRV_550mv 0x60
  1260. #define SAS_PHY_DRV_600mv 0x80
  1261. #define SAS_PHY_DRV_650mv 0xA0
  1262. #define SAS_PHY_DRV_725mv 0xC0
  1263. #define SAS_PHY_DRV_800mv 0xE0
  1264. #define SAS_PHY_DRV_MASK 0xE0
  1265. /* bits 4:3 */
  1266. #define SAS_PREEMP_0 0x00
  1267. #define SAS_PREEMP_1 0x08
  1268. #define SAS_PREEMP_2 0x10
  1269. #define SAS_PREEMP_3 0x18
  1270. #define SAS_PREEMP_MASK 0x18
  1271. #define SAS_CMSH1P5 0x04
  1272. /* bits 1:0 */
  1273. #define SAS_SLEW_0 0x00
  1274. #define SAS_SLEW_1 0x01
  1275. #define SAS_SLEW_2 0x02
  1276. #define SAS_SLEW_3 0x03
  1277. #define SAS_SLEW_MASK 0x03
  1278. #define PHY_CONTROL_4 0x168
  1279. #define PHY_DONE_CAL_TX 0x80
  1280. #define PHY_DONE_CAL_RX 0x40
  1281. #define RX_TERM_LOAD_DIS 0x20
  1282. #define TX_TERM_LOAD_DIS 0x10
  1283. #define AUTO_TERM_CAL_DIS 0x08
  1284. #define PHY_SIGDET_FLTR_EN 0x04
  1285. #define OSC_FREQ 0x02
  1286. #define PHY_START_CAL 0x01
  1287. /*
  1288. * HST_PCIX2 Registers, Address Range: (0x00-0xFC)
  1289. */
  1290. #define PCIX_REG_BASE_ADR 0xB8040000
  1291. #define PCIC_VENDOR_ID 0x00
  1292. #define PCIC_DEVICE_ID 0x02
  1293. #define PCIC_COMMAND 0x04
  1294. #define INT_DIS 0x0400
  1295. #define FBB_EN 0x0200 /* ro */
  1296. #define SERR_EN 0x0100
  1297. #define STEP_EN 0x0080 /* ro */
  1298. #define PERR_EN 0x0040
  1299. #define VGA_EN 0x0020 /* ro */
  1300. #define MWI_EN 0x0010
  1301. #define SPC_EN 0x0008
  1302. #define MST_EN 0x0004
  1303. #define MEM_EN 0x0002
  1304. #define IO_EN 0x0001
  1305. #define PCIC_STATUS 0x06
  1306. #define PERR_DET 0x8000
  1307. #define SERR_GEN 0x4000
  1308. #define MABT_DET 0x2000
  1309. #define TABT_DET 0x1000
  1310. #define TABT_GEN 0x0800
  1311. #define DPERR_DET 0x0100
  1312. #define CAP_LIST 0x0010
  1313. #define INT_STAT 0x0008
  1314. #define PCIC_DEVREV_ID 0x08
  1315. #define PCIC_CLASS_CODE 0x09
  1316. #define PCIC_CACHELINE_SIZE 0x0C
  1317. #define PCIC_MBAR0 0x10
  1318. #define PCIC_MBAR0_OFFSET 0
  1319. #define PCIC_MBAR1 0x18
  1320. #define PCIC_MBAR1_OFFSET 2
  1321. #define PCIC_IOBAR 0x20
  1322. #define PCIC_IOBAR_OFFSET 4
  1323. #define PCIC_SUBVENDOR_ID 0x2C
  1324. #define PCIC_SUBSYTEM_ID 0x2E
  1325. #define PCIX_STATUS 0x44
  1326. #define RCV_SCE 0x20000000
  1327. #define UNEXP_SC 0x00080000
  1328. #define SC_DISCARD 0x00040000
  1329. #define ECC_CTRL_STAT 0x48
  1330. #define UNCOR_ECCERR 0x00000008
  1331. #define PCIC_PM_CSR 0x5C
  1332. #define PWR_STATE_D0 0
  1333. #define PWR_STATE_D1 1 /* not supported */
  1334. #define PWR_STATE_D2 2 /* not supported */
  1335. #define PWR_STATE_D3 3
  1336. #define PCIC_BASE1 0x6C /* internal use only */
  1337. #define BASE1_RSVD 0xFFFFFFF8
  1338. #define PCIC_BASEA 0x70 /* internal use only */
  1339. #define BASEA_RSVD 0xFFFFFFC0
  1340. #define BASEA_START 0
  1341. #define PCIC_BASEB 0x74 /* internal use only */
  1342. #define BASEB_RSVD 0xFFFFFF80
  1343. #define BASEB_IOMAP_MASK 0x7F
  1344. #define BASEB_START 0x80
  1345. #define PCIC_BASEC 0x78 /* internal use only */
  1346. #define BASEC_RSVD 0xFFFFFFFC
  1347. #define BASEC_MASK 0x03
  1348. #define BASEC_START 0x58
  1349. #define PCIC_MBAR_KEY 0x7C /* internal use only */
  1350. #define MBAR_KEY_MASK 0xFFFFFFFF
  1351. #define PCIC_HSTPCIX_CNTRL 0xA0
  1352. #define REWIND_DIS 0x0800
  1353. #define SC_TMR_DIS 0x04000000
  1354. #define PCIC_MBAR0_MASK 0xA8
  1355. #define PCIC_MBAR0_SIZE_MASK 0x1FFFE000
  1356. #define PCIC_MBAR0_SIZE_SHIFT 13
  1357. #define PCIC_MBAR0_SIZE(val) \
  1358. (((val) & PCIC_MBAR0_SIZE_MASK) >> PCIC_MBAR0_SIZE_SHIFT)
  1359. #define PCIC_FLASH_MBAR 0xB8
  1360. #define PCIC_INTRPT_STAT 0xD4
  1361. #define PCIC_TP_CTRL 0xFC
  1362. /*
  1363. * EXSI Registers, Address Range: (0x00-0xFC)
  1364. */
  1365. #define EXSI_REG_BASE_ADR REG_BASE_ADDR_EXSI
  1366. #define EXSICNFGR (EXSI_REG_BASE_ADR + 0x00)
  1367. #define OCMINITIALIZED 0x80000000
  1368. #define ASIEN 0x00400000
  1369. #define HCMODE 0x00200000
  1370. #define PCIDEF 0x00100000
  1371. #define COMSTOCK 0x00080000
  1372. #define SEEPROMEND 0x00040000
  1373. #define MSTTIMEN 0x00020000
  1374. #define XREGEX 0x00000200
  1375. #define NVRAMW 0x00000100
  1376. #define NVRAMEX 0x00000080
  1377. #define SRAMW 0x00000040
  1378. #define SRAMEX 0x00000020
  1379. #define FLASHW 0x00000010
  1380. #define FLASHEX 0x00000008
  1381. #define SEEPROMCFG 0x00000004
  1382. #define SEEPROMTYP 0x00000002
  1383. #define SEEPROMEX 0x00000001
  1384. #define EXSICNTRLR (EXSI_REG_BASE_ADR + 0x04)
  1385. #define MODINT_EN 0x00000001
  1386. #define PMSTATR (EXSI_REG_BASE_ADR + 0x10)
  1387. #define FLASHRST 0x00000002
  1388. #define FLASHRDY 0x00000001
  1389. #define FLCNFGR (EXSI_REG_BASE_ADR + 0x14)
  1390. #define FLWEH_MASK 0x30000000
  1391. #define FLWESU_MASK 0x0C000000
  1392. #define FLWEPW_MASK 0x03F00000
  1393. #define FLOEH_MASK 0x000C0000
  1394. #define FLOESU_MASK 0x00030000
  1395. #define FLOEPW_MASK 0x0000FC00
  1396. #define FLCSH_MASK 0x00000300
  1397. #define FLCSSU_MASK 0x000000C0
  1398. #define FLCSPW_MASK 0x0000003F
  1399. #define SRCNFGR (EXSI_REG_BASE_ADR + 0x18)
  1400. #define SRWEH_MASK 0x30000000
  1401. #define SRWESU_MASK 0x0C000000
  1402. #define SRWEPW_MASK 0x03F00000
  1403. #define SROEH_MASK 0x000C0000
  1404. #define SROESU_MASK 0x00030000
  1405. #define SROEPW_MASK 0x0000FC00
  1406. #define SRCSH_MASK 0x00000300
  1407. #define SRCSSU_MASK 0x000000C0
  1408. #define SRCSPW_MASK 0x0000003F
  1409. #define NVCNFGR (EXSI_REG_BASE_ADR + 0x1C)
  1410. #define NVWEH_MASK 0x30000000
  1411. #define NVWESU_MASK 0x0C000000
  1412. #define NVWEPW_MASK 0x03F00000
  1413. #define NVOEH_MASK 0x000C0000
  1414. #define NVOESU_MASK 0x00030000
  1415. #define NVOEPW_MASK 0x0000FC00
  1416. #define NVCSH_MASK 0x00000300
  1417. #define NVCSSU_MASK 0x000000C0
  1418. #define NVCSPW_MASK 0x0000003F
  1419. #define XRCNFGR (EXSI_REG_BASE_ADR + 0x20)
  1420. #define XRWEH_MASK 0x30000000
  1421. #define XRWESU_MASK 0x0C000000
  1422. #define XRWEPW_MASK 0x03F00000
  1423. #define XROEH_MASK 0x000C0000
  1424. #define XROESU_MASK 0x00030000
  1425. #define XROEPW_MASK 0x0000FC00
  1426. #define XRCSH_MASK 0x00000300
  1427. #define XRCSSU_MASK 0x000000C0
  1428. #define XRCSPW_MASK 0x0000003F
  1429. #define XREGADDR (EXSI_REG_BASE_ADR + 0x24)
  1430. #define XRADDRINCEN 0x80000000
  1431. #define XREGADD_MASK 0x007FFFFF
  1432. #define XREGDATAR (EXSI_REG_BASE_ADR + 0x28)
  1433. #define XREGDATA_MASK 0x0000FFFF
  1434. #define GPIOOER (EXSI_REG_BASE_ADR + 0x40)
  1435. #define GPIOODENR (EXSI_REG_BASE_ADR + 0x44)
  1436. #define GPIOINVR (EXSI_REG_BASE_ADR + 0x48)
  1437. #define GPIODATAOR (EXSI_REG_BASE_ADR + 0x4C)
  1438. #define GPIODATAIR (EXSI_REG_BASE_ADR + 0x50)
  1439. #define GPIOCNFGR (EXSI_REG_BASE_ADR + 0x54)
  1440. #define GPIO_EXTSRC 0x00000001
  1441. #define SCNTRLR (EXSI_REG_BASE_ADR + 0xA0)
  1442. #define SXFERDONE 0x00000100
  1443. #define SXFERCNT_MASK 0x000000E0
  1444. #define SCMDTYP_MASK 0x0000001C
  1445. #define SXFERSTART 0x00000002
  1446. #define SXFEREN 0x00000001
  1447. #define SRATER (EXSI_REG_BASE_ADR + 0xA4)
  1448. #define SADDRR (EXSI_REG_BASE_ADR + 0xA8)
  1449. #define SADDR_MASK 0x0000FFFF
  1450. #define SDATAOR (EXSI_REG_BASE_ADR + 0xAC)
  1451. #define SDATAOR0 (EXSI_REG_BASE_ADR + 0xAC)
  1452. #define SDATAOR1 (EXSI_REG_BASE_ADR + 0xAD)
  1453. #define SDATAOR2 (EXSI_REG_BASE_ADR + 0xAE)
  1454. #define SDATAOR3 (EXSI_REG_BASE_ADR + 0xAF)
  1455. #define SDATAIR (EXSI_REG_BASE_ADR + 0xB0)
  1456. #define SDATAIR0 (EXSI_REG_BASE_ADR + 0xB0)
  1457. #define SDATAIR1 (EXSI_REG_BASE_ADR + 0xB1)
  1458. #define SDATAIR2 (EXSI_REG_BASE_ADR + 0xB2)
  1459. #define SDATAIR3 (EXSI_REG_BASE_ADR + 0xB3)
  1460. #define ASISTAT0R (EXSI_REG_BASE_ADR + 0xD0)
  1461. #define ASIFMTERR 0x00000400
  1462. #define ASISEECHKERR 0x00000200
  1463. #define ASIERR 0x00000100
  1464. #define ASISTAT1R (EXSI_REG_BASE_ADR + 0xD4)
  1465. #define CHECKSUM_MASK 0x0000FFFF
  1466. #define ASIERRADDR (EXSI_REG_BASE_ADR + 0xD8)
  1467. #define ASIERRDATAR (EXSI_REG_BASE_ADR + 0xDC)
  1468. #define ASIERRSTATR (EXSI_REG_BASE_ADR + 0xE0)
  1469. #define CPI2ASIBYTECNT_MASK 0x00070000
  1470. #define CPI2ASIBYTEEN_MASK 0x0000F000
  1471. #define CPI2ASITARGERR_MASK 0x00000F00
  1472. #define CPI2ASITARGMID_MASK 0x000000F0
  1473. #define CPI2ASIMSTERR_MASK 0x0000000F
  1474. /*
  1475. * XSRAM, External SRAM (DWord and any BE pattern accessible)
  1476. */
  1477. #define XSRAM_REG_BASE_ADDR 0xB8100000
  1478. #define XSRAM_SIZE 0x100000
  1479. /*
  1480. * NVRAM Registers, Address Range: (0x00000 - 0x3FFFF).
  1481. */
  1482. #define NVRAM_REG_BASE_ADR 0xBF800000
  1483. #define NVRAM_MAX_BASE_ADR 0x003FFFFF
  1484. /* OCM base address */
  1485. #define OCM_BASE_ADDR 0xA0000000
  1486. #define OCM_MAX_SIZE 0x20000
  1487. /*
  1488. * Sequencers (Central and Link) Scratch RAM page definitions.
  1489. */
  1490. /*
  1491. * The Central Management Sequencer (CSEQ) Scratch Memory is a 1024
  1492. * byte memory. It is dword accessible and has byte parity
  1493. * protection. The CSEQ accesses it in 32 byte windows, either as mode
  1494. * dependent or mode independent memory. Each mode has 96 bytes,
  1495. * (three 32 byte pages 0-2, not contiguous), leaving 128 bytes of
  1496. * Mode Independent memory (four 32 byte pages 3-7). Note that mode
  1497. * dependent scratch memory, Mode 8, page 0-3 overlaps mode
  1498. * independent scratch memory, pages 0-3.
  1499. * - 896 bytes of mode dependent scratch, 96 bytes per Modes 0-7, and
  1500. * 128 bytes in mode 8,
  1501. * - 259 bytes of mode independent scratch, common to modes 0-15.
  1502. *
  1503. * Sequencer scratch RAM is 1024 bytes. This scratch memory is
  1504. * divided into mode dependent and mode independent scratch with this
  1505. * memory further subdivided into pages of size 32 bytes. There are 5
  1506. * pages (160 bytes) of mode independent scratch and 3 pages of
  1507. * dependent scratch memory for modes 0-7 (768 bytes). Mode 8 pages
  1508. * 0-2 dependent scratch overlap with pages 0-2 of mode independent
  1509. * scratch memory.
  1510. *
  1511. * The host accesses this scratch in a different manner from the
  1512. * central sequencer. The sequencer has to use CSEQ registers CSCRPAGE
  1513. * and CMnSCRPAGE to access the scratch memory. A flat mapping of the
  1514. * scratch memory is available for software convenience and to prevent
  1515. * corruption while the sequencer is running. This memory is mapped
  1516. * onto addresses 800h - BFFh, total of 400h bytes.
  1517. *
  1518. * These addresses are mapped as follows:
  1519. *
  1520. * 800h-83Fh Mode Dependent Scratch Mode 0 Pages 0-1
  1521. * 840h-87Fh Mode Dependent Scratch Mode 1 Pages 0-1
  1522. * 880h-8BFh Mode Dependent Scratch Mode 2 Pages 0-1
  1523. * 8C0h-8FFh Mode Dependent Scratch Mode 3 Pages 0-1
  1524. * 900h-93Fh Mode Dependent Scratch Mode 4 Pages 0-1
  1525. * 940h-97Fh Mode Dependent Scratch Mode 5 Pages 0-1
  1526. * 980h-9BFh Mode Dependent Scratch Mode 6 Pages 0-1
  1527. * 9C0h-9FFh Mode Dependent Scratch Mode 7 Pages 0-1
  1528. * A00h-A5Fh Mode Dependent Scratch Mode 8 Pages 0-2
  1529. * Mode Independent Scratch Pages 0-2
  1530. * A60h-A7Fh Mode Dependent Scratch Mode 8 Page 3
  1531. * Mode Independent Scratch Page 3
  1532. * A80h-AFFh Mode Independent Scratch Pages 4-7
  1533. * B00h-B1Fh Mode Dependent Scratch Mode 0 Page 2
  1534. * B20h-B3Fh Mode Dependent Scratch Mode 1 Page 2
  1535. * B40h-B5Fh Mode Dependent Scratch Mode 2 Page 2
  1536. * B60h-B7Fh Mode Dependent Scratch Mode 3 Page 2
  1537. * B80h-B9Fh Mode Dependent Scratch Mode 4 Page 2
  1538. * BA0h-BBFh Mode Dependent Scratch Mode 5 Page 2
  1539. * BC0h-BDFh Mode Dependent Scratch Mode 6 Page 2
  1540. * BE0h-BFFh Mode Dependent Scratch Mode 7 Page 2
  1541. */
  1542. /* General macros */
  1543. #define CSEQ_PAGE_SIZE 32 /* Scratch page size (in bytes) */
  1544. /* All macros start with offsets from base + 0x800 (CMAPPEDSCR).
  1545. * Mode dependent scratch page 0, mode 0.
  1546. * For modes 1-7 you have to do arithmetic. */
  1547. #define CSEQ_LRM_SAVE_SINDEX (CMAPPEDSCR + 0x0000)
  1548. #define CSEQ_LRM_SAVE_SCBPTR (CMAPPEDSCR + 0x0002)
  1549. #define CSEQ_Q_LINK_HEAD (CMAPPEDSCR + 0x0004)
  1550. #define CSEQ_Q_LINK_TAIL (CMAPPEDSCR + 0x0006)
  1551. #define CSEQ_LRM_SAVE_SCRPAGE (CMAPPEDSCR + 0x0008)
  1552. /* Mode dependent scratch page 0 mode 8 macros. */
  1553. #define CSEQ_RET_ADDR (CMAPPEDSCR + 0x0200)
  1554. #define CSEQ_RET_SCBPTR (CMAPPEDSCR + 0x0202)
  1555. #define CSEQ_SAVE_SCBPTR (CMAPPEDSCR + 0x0204)
  1556. #define CSEQ_EMPTY_TRANS_CTX (CMAPPEDSCR + 0x0206)
  1557. #define CSEQ_RESP_LEN (CMAPPEDSCR + 0x0208)
  1558. #define CSEQ_TMF_SCBPTR (CMAPPEDSCR + 0x020A)
  1559. #define CSEQ_GLOBAL_PREV_SCB (CMAPPEDSCR + 0x020C)
  1560. #define CSEQ_GLOBAL_HEAD (CMAPPEDSCR + 0x020E)
  1561. #define CSEQ_CLEAR_LU_HEAD (CMAPPEDSCR + 0x0210)
  1562. #define CSEQ_TMF_OPCODE (CMAPPEDSCR + 0x0212)
  1563. #define CSEQ_SCRATCH_FLAGS (CMAPPEDSCR + 0x0213)
  1564. #define CSEQ_HSB_SITE (CMAPPEDSCR + 0x021A)
  1565. #define CSEQ_FIRST_INV_SCB_SITE (CMAPPEDSCR + 0x021C)
  1566. #define CSEQ_FIRST_INV_DDB_SITE (CMAPPEDSCR + 0x021E)
  1567. /* Mode dependent scratch page 1 mode 8 macros. */
  1568. #define CSEQ_LUN_TO_CLEAR (CMAPPEDSCR + 0x0220)
  1569. #define CSEQ_LUN_TO_CHECK (CMAPPEDSCR + 0x0228)
  1570. /* Mode dependent scratch page 2 mode 8 macros */
  1571. #define CSEQ_HQ_NEW_POINTER (CMAPPEDSCR + 0x0240)
  1572. #define CSEQ_HQ_DONE_BASE (CMAPPEDSCR + 0x0248)
  1573. #define CSEQ_HQ_DONE_POINTER (CMAPPEDSCR + 0x0250)
  1574. #define CSEQ_HQ_DONE_PASS (CMAPPEDSCR + 0x0254)
  1575. /* Mode independent scratch page 4 macros. */
  1576. #define CSEQ_Q_EXE_HEAD (CMAPPEDSCR + 0x0280)
  1577. #define CSEQ_Q_EXE_TAIL (CMAPPEDSCR + 0x0282)
  1578. #define CSEQ_Q_DONE_HEAD (CMAPPEDSCR + 0x0284)
  1579. #define CSEQ_Q_DONE_TAIL (CMAPPEDSCR + 0x0286)
  1580. #define CSEQ_Q_SEND_HEAD (CMAPPEDSCR + 0x0288)
  1581. #define CSEQ_Q_SEND_TAIL (CMAPPEDSCR + 0x028A)
  1582. #define CSEQ_Q_DMA2CHIM_HEAD (CMAPPEDSCR + 0x028C)
  1583. #define CSEQ_Q_DMA2CHIM_TAIL (CMAPPEDSCR + 0x028E)
  1584. #define CSEQ_Q_COPY_HEAD (CMAPPEDSCR + 0x0290)
  1585. #define CSEQ_Q_COPY_TAIL (CMAPPEDSCR + 0x0292)
  1586. #define CSEQ_REG0 (CMAPPEDSCR + 0x0294)
  1587. #define CSEQ_REG1 (CMAPPEDSCR + 0x0296)
  1588. #define CSEQ_REG2 (CMAPPEDSCR + 0x0298)
  1589. #define CSEQ_LINK_CTL_Q_MAP (CMAPPEDSCR + 0x029C)
  1590. #define CSEQ_MAX_CSEQ_MODE (CMAPPEDSCR + 0x029D)
  1591. #define CSEQ_FREE_LIST_HACK_COUNT (CMAPPEDSCR + 0x029E)
  1592. /* Mode independent scratch page 5 macros. */
  1593. #define CSEQ_EST_NEXUS_REQ_QUEUE (CMAPPEDSCR + 0x02A0)
  1594. #define CSEQ_EST_NEXUS_REQ_COUNT (CMAPPEDSCR + 0x02A8)
  1595. #define CSEQ_Q_EST_NEXUS_HEAD (CMAPPEDSCR + 0x02B0)
  1596. #define CSEQ_Q_EST_NEXUS_TAIL (CMAPPEDSCR + 0x02B2)
  1597. #define CSEQ_NEED_EST_NEXUS_SCB (CMAPPEDSCR + 0x02B4)
  1598. #define CSEQ_EST_NEXUS_REQ_HEAD (CMAPPEDSCR + 0x02B6)
  1599. #define CSEQ_EST_NEXUS_REQ_TAIL (CMAPPEDSCR + 0x02B7)
  1600. #define CSEQ_EST_NEXUS_SCB_OFFSET (CMAPPEDSCR + 0x02B8)
  1601. /* Mode independent scratch page 6 macros. */
  1602. #define CSEQ_INT_ROUT_RET_ADDR0 (CMAPPEDSCR + 0x02C0)
  1603. #define CSEQ_INT_ROUT_RET_ADDR1 (CMAPPEDSCR + 0x02C2)
  1604. #define CSEQ_INT_ROUT_SCBPTR (CMAPPEDSCR + 0x02C4)
  1605. #define CSEQ_INT_ROUT_MODE (CMAPPEDSCR + 0x02C6)
  1606. #define CSEQ_ISR_SCRATCH_FLAGS (CMAPPEDSCR + 0x02C7)
  1607. #define CSEQ_ISR_SAVE_SINDEX (CMAPPEDSCR + 0x02C8)
  1608. #define CSEQ_ISR_SAVE_DINDEX (CMAPPEDSCR + 0x02CA)
  1609. #define CSEQ_Q_MONIRTT_HEAD (CMAPPEDSCR + 0x02D0)
  1610. #define CSEQ_Q_MONIRTT_TAIL (CMAPPEDSCR + 0x02D2)
  1611. #define CSEQ_FREE_SCB_MASK (CMAPPEDSCR + 0x02D5)
  1612. #define CSEQ_BUILTIN_FREE_SCB_HEAD (CMAPPEDSCR + 0x02D6)
  1613. #define CSEQ_BUILTIN_FREE_SCB_TAIL (CMAPPEDSCR + 0x02D8)
  1614. #define CSEQ_EXTENDED_FREE_SCB_HEAD (CMAPPEDSCR + 0x02DA)
  1615. #define CSEQ_EXTENDED_FREE_SCB_TAIL (CMAPPEDSCR + 0x02DC)
  1616. /* Mode independent scratch page 7 macros. */
  1617. #define CSEQ_EMPTY_REQ_QUEUE (CMAPPEDSCR + 0x02E0)
  1618. #define CSEQ_EMPTY_REQ_COUNT (CMAPPEDSCR + 0x02E8)
  1619. #define CSEQ_Q_EMPTY_HEAD (CMAPPEDSCR + 0x02F0)
  1620. #define CSEQ_Q_EMPTY_TAIL (CMAPPEDSCR + 0x02F2)
  1621. #define CSEQ_NEED_EMPTY_SCB (CMAPPEDSCR + 0x02F4)
  1622. #define CSEQ_EMPTY_REQ_HEAD (CMAPPEDSCR + 0x02F6)
  1623. #define CSEQ_EMPTY_REQ_TAIL (CMAPPEDSCR + 0x02F7)
  1624. #define CSEQ_EMPTY_SCB_OFFSET (CMAPPEDSCR + 0x02F8)
  1625. #define CSEQ_PRIMITIVE_DATA (CMAPPEDSCR + 0x02FA)
  1626. #define CSEQ_TIMEOUT_CONST (CMAPPEDSCR + 0x02FC)
  1627. /***************************************************************************
  1628. * Link m Sequencer scratch RAM is 512 bytes.
  1629. * This scratch memory is divided into mode dependent and mode
  1630. * independent scratch with this memory further subdivided into
  1631. * pages of size 32 bytes. There are 4 pages (128 bytes) of
  1632. * mode independent scratch and 4 pages of dependent scratch
  1633. * memory for modes 0-2 (384 bytes).
  1634. *
  1635. * The host accesses this scratch in a different manner from the
  1636. * link sequencer. The sequencer has to use LSEQ registers
  1637. * LmSCRPAGE and LmMnSCRPAGE to access the scratch memory. A flat
  1638. * mapping of the scratch memory is available for software
  1639. * convenience and to prevent corruption while the sequencer is
  1640. * running. This memory is mapped onto addresses 800h - 9FFh.
  1641. *
  1642. * These addresses are mapped as follows:
  1643. *
  1644. * 800h-85Fh Mode Dependent Scratch Mode 0 Pages 0-2
  1645. * 860h-87Fh Mode Dependent Scratch Mode 0 Page 3
  1646. * Mode Dependent Scratch Mode 5 Page 0
  1647. * 880h-8DFh Mode Dependent Scratch Mode 1 Pages 0-2
  1648. * 8E0h-8FFh Mode Dependent Scratch Mode 1 Page 3
  1649. * Mode Dependent Scratch Mode 5 Page 1
  1650. * 900h-95Fh Mode Dependent Scratch Mode 2 Pages 0-2
  1651. * 960h-97Fh Mode Dependent Scratch Mode 2 Page 3
  1652. * Mode Dependent Scratch Mode 5 Page 2
  1653. * 980h-9DFh Mode Independent Scratch Pages 0-3
  1654. * 9E0h-9FFh Mode Independent Scratch Page 3
  1655. * Mode Dependent Scratch Mode 5 Page 3
  1656. *
  1657. ****************************************************************************/
  1658. /* General macros */
  1659. #define LSEQ_MODE_SCRATCH_SIZE 0x80 /* Size of scratch RAM per mode */
  1660. #define LSEQ_PAGE_SIZE 0x20 /* Scratch page size (in bytes) */
  1661. #define LSEQ_MODE5_PAGE0_OFFSET 0x60
  1662. /* Common mode dependent scratch page 0 macros for modes 0,1,2, and 5 */
  1663. /* Indexed using LSEQ_MODE_SCRATCH_SIZE * mode, for modes 0,1,2. */
  1664. #define LmSEQ_RET_ADDR(LinkNum) (LmSCRATCH(LinkNum) + 0x0000)
  1665. #define LmSEQ_REG0_MODE(LinkNum) (LmSCRATCH(LinkNum) + 0x0002)
  1666. #define LmSEQ_MODE_FLAGS(LinkNum) (LmSCRATCH(LinkNum) + 0x0004)
  1667. /* Mode flag macros (byte 0) */
  1668. #define SAS_SAVECTX_OCCURRED 0x80
  1669. #define SAS_OOBSVC_OCCURRED 0x40
  1670. #define SAS_OOB_DEVICE_PRESENT 0x20
  1671. #define SAS_CFGHDR_OCCURRED 0x10
  1672. #define SAS_RCV_INTS_ARE_DISABLED 0x08
  1673. #define SAS_OOB_HOT_PLUG_CNCT 0x04
  1674. #define SAS_AWAIT_OPEN_CONNECTION 0x02
  1675. #define SAS_CFGCMPLT_OCCURRED 0x01
  1676. /* Mode flag macros (byte 1) */
  1677. #define SAS_RLSSCB_OCCURRED 0x80
  1678. #define SAS_FORCED_HEADER_MISS 0x40
  1679. #define LmSEQ_RET_ADDR2(LinkNum) (LmSCRATCH(LinkNum) + 0x0006)
  1680. #define LmSEQ_RET_ADDR1(LinkNum) (LmSCRATCH(LinkNum) + 0x0008)
  1681. #define LmSEQ_OPCODE_TO_CSEQ(LinkNum) (LmSCRATCH(LinkNum) + 0x000B)
  1682. #define LmSEQ_DATA_TO_CSEQ(LinkNum) (LmSCRATCH(LinkNum) + 0x000C)
  1683. /* Mode dependent scratch page 0 macros for mode 0 (non-common) */
  1684. /* Absolute offsets */
  1685. #define LmSEQ_FIRST_INV_DDB_SITE(LinkNum) (LmSCRATCH(LinkNum) + 0x000E)
  1686. #define LmSEQ_EMPTY_TRANS_CTX(LinkNum) (LmSCRATCH(LinkNum) + 0x0010)
  1687. #define LmSEQ_RESP_LEN(LinkNum) (LmSCRATCH(LinkNum) + 0x0012)
  1688. #define LmSEQ_FIRST_INV_SCB_SITE(LinkNum) (LmSCRATCH(LinkNum) + 0x0014)
  1689. #define LmSEQ_INTEN_SAVE(LinkNum) (LmSCRATCH(LinkNum) + 0x0016)
  1690. #define LmSEQ_LINK_RST_FRM_LEN(LinkNum) (LmSCRATCH(LinkNum) + 0x001A)
  1691. #define LmSEQ_LINK_RST_PROTOCOL(LinkNum) (LmSCRATCH(LinkNum) + 0x001B)
  1692. #define LmSEQ_RESP_STATUS(LinkNum) (LmSCRATCH(LinkNum) + 0x001C)
  1693. #define LmSEQ_LAST_LOADED_SGE(LinkNum) (LmSCRATCH(LinkNum) + 0x001D)
  1694. #define LmSEQ_SAVE_SCBPTR(LinkNum) (LmSCRATCH(LinkNum) + 0x001E)
  1695. /* Mode dependent scratch page 0 macros for mode 1 (non-common) */
  1696. /* Absolute offsets */
  1697. #define LmSEQ_Q_XMIT_HEAD(LinkNum) (LmSCRATCH(LinkNum) + 0x008E)
  1698. #define LmSEQ_M1_EMPTY_TRANS_CTX(LinkNum) (LmSCRATCH(LinkNum) + 0x0090)
  1699. #define LmSEQ_INI_CONN_TAG(LinkNum) (LmSCRATCH(LinkNum) + 0x0092)
  1700. #define LmSEQ_FAILED_OPEN_STATUS(LinkNum) (LmSCRATCH(LinkNum) + 0x009A)
  1701. #define LmSEQ_XMIT_REQUEST_TYPE(LinkNum) (LmSCRATCH(LinkNum) + 0x009B)
  1702. #define LmSEQ_M1_RESP_STATUS(LinkNum) (LmSCRATCH(LinkNum) + 0x009C)
  1703. #define LmSEQ_M1_LAST_LOADED_SGE(LinkNum) (LmSCRATCH(LinkNum) + 0x009D)
  1704. #define LmSEQ_M1_SAVE_SCBPTR(LinkNum) (LmSCRATCH(LinkNum) + 0x009E)
  1705. /* Mode dependent scratch page 0 macros for mode 2 (non-common) */
  1706. #define LmSEQ_PORT_COUNTER(LinkNum) (LmSCRATCH(LinkNum) + 0x010E)
  1707. #define LmSEQ_PM_TABLE_PTR(LinkNum) (LmSCRATCH(LinkNum) + 0x0110)
  1708. #define LmSEQ_SATA_INTERLOCK_TMR_SAVE(LinkNum) (LmSCRATCH(LinkNum) + 0x0112)
  1709. #define LmSEQ_IP_BITL(LinkNum) (LmSCRATCH(LinkNum) + 0x0114)
  1710. #define LmSEQ_COPY_SMP_CONN_TAG(LinkNum) (LmSCRATCH(LinkNum) + 0x0116)
  1711. #define LmSEQ_P0M2_OFFS1AH(LinkNum) (LmSCRATCH(LinkNum) + 0x011A)
  1712. /* Mode dependent scratch page 0 macros for modes 4/5 (non-common) */
  1713. /* Absolute offsets */
  1714. #define LmSEQ_SAVED_OOB_STATUS(LinkNum) (LmSCRATCH(LinkNum) + 0x006E)
  1715. #define LmSEQ_SAVED_OOB_MODE(LinkNum) (LmSCRATCH(LinkNum) + 0x006F)
  1716. #define LmSEQ_Q_LINK_HEAD(LinkNum) (LmSCRATCH(LinkNum) + 0x0070)
  1717. #define LmSEQ_LINK_RST_ERR(LinkNum) (LmSCRATCH(LinkNum) + 0x0072)
  1718. #define LmSEQ_SAVED_OOB_SIGNALS(LinkNum) (LmSCRATCH(LinkNum) + 0x0073)
  1719. #define LmSEQ_SAS_RESET_MODE(LinkNum) (LmSCRATCH(LinkNum) + 0x0074)
  1720. #define LmSEQ_LINK_RESET_RETRY_COUNT(LinkNum) (LmSCRATCH(LinkNum) + 0x0075)
  1721. #define LmSEQ_NUM_LINK_RESET_RETRIES(LinkNum) (LmSCRATCH(LinkNum) + 0x0076)
  1722. #define LmSEQ_OOB_INT_ENABLES(LinkNum) (LmSCRATCH(LinkNum) + 0x0078)
  1723. #define LmSEQ_NOTIFY_TIMER_DOWN_COUNT(LinkNum) (LmSCRATCH(LinkNum) + 0x007A)
  1724. #define LmSEQ_NOTIFY_TIMER_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x007C)
  1725. #define LmSEQ_NOTIFY_TIMER_INITIAL_COUNT(LinkNum) (LmSCRATCH(LinkNum) + 0x007E)
  1726. /* Mode dependent scratch page 1, mode 0 and mode 1 */
  1727. #define LmSEQ_SG_LIST_PTR_ADDR0(LinkNum) (LmSCRATCH(LinkNum) + 0x0020)
  1728. #define LmSEQ_SG_LIST_PTR_ADDR1(LinkNum) (LmSCRATCH(LinkNum) + 0x0030)
  1729. #define LmSEQ_M1_SG_LIST_PTR_ADDR0(LinkNum) (LmSCRATCH(LinkNum) + 0x00A0)
  1730. #define LmSEQ_M1_SG_LIST_PTR_ADDR1(LinkNum) (LmSCRATCH(LinkNum) + 0x00B0)
  1731. /* Mode dependent scratch page 1 macros for mode 2 */
  1732. /* Absolute offsets */
  1733. #define LmSEQ_INVALID_DWORD_COUNT(LinkNum) (LmSCRATCH(LinkNum) + 0x0120)
  1734. #define LmSEQ_DISPARITY_ERROR_COUNT(LinkNum) (LmSCRATCH(LinkNum) + 0x0124)
  1735. #define LmSEQ_LOSS_OF_SYNC_COUNT(LinkNum) (LmSCRATCH(LinkNum) + 0x0128)
  1736. /* Mode dependent scratch page 1 macros for mode 4/5 */
  1737. #define LmSEQ_FRAME_TYPE_MASK(LinkNum) (LmSCRATCH(LinkNum) + 0x00E0)
  1738. #define LmSEQ_HASHED_DEST_ADDR_MASK(LinkNum) (LmSCRATCH(LinkNum) + 0x00E1)
  1739. #define LmSEQ_HASHED_SRC_ADDR_MASK_PRINT(LinkNum) (LmSCRATCH(LinkNum) + 0x00E4)
  1740. #define LmSEQ_HASHED_SRC_ADDR_MASK(LinkNum) (LmSCRATCH(LinkNum) + 0x00E5)
  1741. #define LmSEQ_NUM_FILL_BYTES_MASK(LinkNum) (LmSCRATCH(LinkNum) + 0x00EB)
  1742. #define LmSEQ_TAG_MASK(LinkNum) (LmSCRATCH(LinkNum) + 0x00F0)
  1743. #define LmSEQ_TARGET_PORT_XFER_TAG(LinkNum) (LmSCRATCH(LinkNum) + 0x00F2)
  1744. #define LmSEQ_DATA_OFFSET(LinkNum) (LmSCRATCH(LinkNum) + 0x00F4)
  1745. /* Mode dependent scratch page 2 macros for mode 0 */
  1746. /* Absolute offsets */
  1747. #define LmSEQ_SMP_RCV_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0040)
  1748. #define LmSEQ_DEVICE_BITS(LinkNum) (LmSCRATCH(LinkNum) + 0x005B)
  1749. #define LmSEQ_SDB_DDB(LinkNum) (LmSCRATCH(LinkNum) + 0x005C)
  1750. #define LmSEQ_SDB_NUM_TAGS(LinkNum) (LmSCRATCH(LinkNum) + 0x005E)
  1751. #define LmSEQ_SDB_CURR_TAG(LinkNum) (LmSCRATCH(LinkNum) + 0x005F)
  1752. /* Mode dependent scratch page 2 macros for mode 1 */
  1753. /* Absolute offsets */
  1754. /* byte 0 bits 1-0 are domain select. */
  1755. #define LmSEQ_TX_ID_ADDR_FRAME(LinkNum) (LmSCRATCH(LinkNum) + 0x00C0)
  1756. #define LmSEQ_OPEN_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x00C8)
  1757. #define LmSEQ_SRST_AS_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x00CC)
  1758. #define LmSEQ_LAST_LOADED_SG_EL(LinkNum) (LmSCRATCH(LinkNum) + 0x00D4)
  1759. /* Mode dependent scratch page 2 macros for mode 2 */
  1760. /* Absolute offsets */
  1761. #define LmSEQ_STP_SHUTDOWN_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0140)
  1762. #define LmSEQ_CLOSE_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0144)
  1763. #define LmSEQ_BREAK_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0148)
  1764. #define LmSEQ_DWS_RESET_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x014C)
  1765. #define LmSEQ_SATA_INTERLOCK_TIMER_TERM_TS(LinkNum) \
  1766. (LmSCRATCH(LinkNum) + 0x0150)
  1767. #define LmSEQ_MCTL_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0154)
  1768. /* Mode dependent scratch page 2 macros for mode 5 */
  1769. #define LmSEQ_COMINIT_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0160)
  1770. #define LmSEQ_RCV_ID_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0164)
  1771. #define LmSEQ_RCV_FIS_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x0168)
  1772. #define LmSEQ_DEV_PRES_TIMER_TERM_TS(LinkNum) (LmSCRATCH(LinkNum) + 0x016C)
  1773. /* Mode dependent scratch page 3 macros for modes 0 and 1 */
  1774. /* None defined */
  1775. /* Mode dependent scratch page 3 macros for modes 2 and 5 */
  1776. /* None defined */
  1777. /* Mode Independent Scratch page 0 macros. */
  1778. #define LmSEQ_Q_TGTXFR_HEAD(LinkNum) (LmSCRATCH(LinkNum) + 0x0180)
  1779. #define LmSEQ_Q_TGTXFR_TAIL(LinkNum) (LmSCRATCH(LinkNum) + 0x0182)
  1780. #define LmSEQ_LINK_NUMBER(LinkNum) (LmSCRATCH(LinkNum) + 0x0186)
  1781. #define LmSEQ_SCRATCH_FLAGS(LinkNum) (LmSCRATCH(LinkNum) + 0x0187)
  1782. /*
  1783. * Currently only bit 0, SAS_DWSAQD, is used.
  1784. */
  1785. #define SAS_DWSAQD 0x01 /*
  1786. * DWSSTATUS: DWSAQD
  1787. * bit las read in ISR.
  1788. */
  1789. #define LmSEQ_CONNECTION_STATE(LinkNum) (LmSCRATCH(LinkNum) + 0x0188)
  1790. /* Connection states (byte 0) */
  1791. #define SAS_WE_OPENED_CS 0x01
  1792. #define SAS_DEVICE_OPENED_CS 0x02
  1793. #define SAS_WE_SENT_DONE_CS 0x04
  1794. #define SAS_DEVICE_SENT_DONE_CS 0x08
  1795. #define SAS_WE_SENT_CLOSE_CS 0x10
  1796. #define SAS_DEVICE_SENT_CLOSE_CS 0x20
  1797. #define SAS_WE_SENT_BREAK_CS 0x40
  1798. #define SAS_DEVICE_SENT_BREAK_CS 0x80
  1799. /* Connection states (byte 1) */
  1800. #define SAS_OPN_TIMEOUT_OR_OPN_RJCT_CS 0x01
  1801. #define SAS_AIP_RECEIVED_CS 0x02
  1802. #define SAS_CREDIT_TIMEOUT_OCCURRED_CS 0x04
  1803. #define SAS_ACKNAK_TIMEOUT_OCCURRED_CS 0x08
  1804. #define SAS_SMPRSP_TIMEOUT_OCCURRED_CS 0x10
  1805. #define SAS_DONE_TIMEOUT_OCCURRED_CS 0x20
  1806. /* Connection states (byte 2) */
  1807. #define SAS_SMP_RESPONSE_RECEIVED_CS 0x01
  1808. #define SAS_INTLK_TIMEOUT_OCCURRED_CS 0x02
  1809. #define SAS_DEVICE_SENT_DMAT_CS 0x04
  1810. #define SAS_DEVICE_SENT_SYNCSRST_CS 0x08
  1811. #define SAS_CLEARING_AFFILIATION_CS 0x20
  1812. #define SAS_RXTASK_ACTIVE_CS 0x40
  1813. #define SAS_TXTASK_ACTIVE_CS 0x80
  1814. /* Connection states (byte 3) */
  1815. #define SAS_PHY_LOSS_OF_SIGNAL_CS 0x01
  1816. #define SAS_DWS_TIMER_EXPIRED_CS 0x02
  1817. #define SAS_LINK_RESET_NOT_COMPLETE_CS 0x04
  1818. #define SAS_PHY_DISABLED_CS 0x08
  1819. #define SAS_LINK_CTL_TASK_ACTIVE_CS 0x10
  1820. #define SAS_PHY_EVENT_TASK_ACTIVE_CS 0x20
  1821. #define SAS_DEVICE_SENT_ID_FRAME_CS 0x40
  1822. #define SAS_DEVICE_SENT_REG_FIS_CS 0x40
  1823. #define SAS_DEVICE_SENT_HARD_RESET_CS 0x80
  1824. #define SAS_PHY_IS_DOWN_FLAGS (SAS_PHY_LOSS_OF_SIGNAL_CS|\
  1825. SAS_DWS_TIMER_EXPIRED_CS |\
  1826. SAS_LINK_RESET_NOT_COMPLETE_CS|\
  1827. SAS_PHY_DISABLED_CS)
  1828. #define SAS_LINK_CTL_PHY_EVENT_FLAGS (SAS_LINK_CTL_TASK_ACTIVE_CS |\
  1829. SAS_PHY_EVENT_TASK_ACTIVE_CS |\
  1830. SAS_DEVICE_SENT_ID_FRAME_CS |\
  1831. SAS_DEVICE_SENT_HARD_RESET_CS)
  1832. #define LmSEQ_CONCTL(LinkNum) (LmSCRATCH(LinkNum) + 0x018C)
  1833. #define LmSEQ_CONSTAT(LinkNum) (LmSCRATCH(LinkNum) + 0x018E)
  1834. #define LmSEQ_CONNECTION_MODES(LinkNum) (LmSCRATCH(LinkNum) + 0x018F)
  1835. #define LmSEQ_REG1_ISR(LinkNum) (LmSCRATCH(LinkNum) + 0x0192)
  1836. #define LmSEQ_REG2_ISR(LinkNum) (LmSCRATCH(LinkNum) + 0x0194)
  1837. #define LmSEQ_REG3_ISR(LinkNum) (LmSCRATCH(LinkNum) + 0x0196)
  1838. #define LmSEQ_REG0_ISR(LinkNum) (LmSCRATCH(LinkNum) + 0x0198)
  1839. /* Mode independent scratch page 1 macros. */
  1840. #define LmSEQ_EST_NEXUS_SCBPTR0(LinkNum) (LmSCRATCH(LinkNum) + 0x01A0)
  1841. #define LmSEQ_EST_NEXUS_SCBPTR1(LinkNum) (LmSCRATCH(LinkNum) + 0x01A2)
  1842. #define LmSEQ_EST_NEXUS_SCBPTR2(LinkNum) (LmSCRATCH(LinkNum) + 0x01A4)
  1843. #define LmSEQ_EST_NEXUS_SCBPTR3(LinkNum) (LmSCRATCH(LinkNum) + 0x01A6)
  1844. #define LmSEQ_EST_NEXUS_SCB_OPCODE0(LinkNum) (LmSCRATCH(LinkNum) + 0x01A8)
  1845. #define LmSEQ_EST_NEXUS_SCB_OPCODE1(LinkNum) (LmSCRATCH(LinkNum) + 0x01A9)
  1846. #define LmSEQ_EST_NEXUS_SCB_OPCODE2(LinkNum) (LmSCRATCH(LinkNum) + 0x01AA)
  1847. #define LmSEQ_EST_NEXUS_SCB_OPCODE3(LinkNum) (LmSCRATCH(LinkNum) + 0x01AB)
  1848. #define LmSEQ_EST_NEXUS_SCB_HEAD(LinkNum) (LmSCRATCH(LinkNum) + 0x01AC)
  1849. #define LmSEQ_EST_NEXUS_SCB_TAIL(LinkNum) (LmSCRATCH(LinkNum) + 0x01AD)
  1850. #define LmSEQ_EST_NEXUS_BUF_AVAIL(LinkNum) (LmSCRATCH(LinkNum) + 0x01AE)
  1851. #define LmSEQ_TIMEOUT_CONST(LinkNum) (LmSCRATCH(LinkNum) + 0x01B8)
  1852. #define LmSEQ_ISR_SAVE_SINDEX(LinkNum) (LmSCRATCH(LinkNum) + 0x01BC)
  1853. #define LmSEQ_ISR_SAVE_DINDEX(LinkNum) (LmSCRATCH(LinkNum) + 0x01BE)
  1854. /* Mode independent scratch page 2 macros. */
  1855. #define LmSEQ_EMPTY_SCB_PTR0(LinkNum) (LmSCRATCH(LinkNum) + 0x01C0)
  1856. #define LmSEQ_EMPTY_SCB_PTR1(LinkNum) (LmSCRATCH(LinkNum) + 0x01C2)
  1857. #define LmSEQ_EMPTY_SCB_PTR2(LinkNum) (LmSCRATCH(LinkNum) + 0x01C4)
  1858. #define LmSEQ_EMPTY_SCB_PTR3(LinkNum) (LmSCRATCH(LinkNum) + 0x01C6)
  1859. #define LmSEQ_EMPTY_SCB_OPCD0(LinkNum) (LmSCRATCH(LinkNum) + 0x01C8)
  1860. #define LmSEQ_EMPTY_SCB_OPCD1(LinkNum) (LmSCRATCH(LinkNum) + 0x01C9)
  1861. #define LmSEQ_EMPTY_SCB_OPCD2(LinkNum) (LmSCRATCH(LinkNum) + 0x01CA)
  1862. #define LmSEQ_EMPTY_SCB_OPCD3(LinkNum) (LmSCRATCH(LinkNum) + 0x01CB)
  1863. #define LmSEQ_EMPTY_SCB_HEAD(LinkNum) (LmSCRATCH(LinkNum) + 0x01CC)
  1864. #define LmSEQ_EMPTY_SCB_TAIL(LinkNum) (LmSCRATCH(LinkNum) + 0x01CD)
  1865. #define LmSEQ_EMPTY_BUFS_AVAIL(LinkNum) (LmSCRATCH(LinkNum) + 0x01CE)
  1866. #define LmSEQ_ATA_SCR_REGS(LinkNum) (LmSCRATCH(LinkNum) + 0x01D4)
  1867. /* Mode independent scratch page 3 macros. */
  1868. #define LmSEQ_DEV_PRES_TMR_TOUT_CONST(LinkNum) (LmSCRATCH(LinkNum) + 0x01E0)
  1869. #define LmSEQ_SATA_INTERLOCK_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01E4)
  1870. #define LmSEQ_STP_SHUTDOWN_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01E8)
  1871. #define LmSEQ_SRST_ASSERT_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01EC)
  1872. #define LmSEQ_RCV_FIS_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01F0)
  1873. #define LmSEQ_ONE_MILLISEC_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01F4)
  1874. #define LmSEQ_TEN_MS_COMINIT_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01F8)
  1875. #define LmSEQ_SMP_RCV_TIMEOUT(LinkNum) (LmSCRATCH(LinkNum) + 0x01FC)
  1876. #endif