aic94xx_reg_def.h 72 KB

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