aic7xxx.reg 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637
  1. /*
  2. * Aic7xxx register and scratch ram definitions.
  3. *
  4. * Copyright (c) 1994-2001 Justin T. Gibbs.
  5. * Copyright (c) 2000-2001 Adaptec Inc.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions, and the following disclaimer,
  13. * without modification.
  14. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  15. * substantially similar to the "NO WARRANTY" disclaimer below
  16. * ("Disclaimer") and any redistribution must be conditioned upon
  17. * including a substantially similar Disclaimer requirement for further
  18. * binary redistribution.
  19. * 3. Neither the names of the above-listed copyright holders nor the names
  20. * of any contributors may be used to endorse or promote products derived
  21. * from this software without specific prior written permission.
  22. *
  23. * Alternatively, this software may be distributed under the terms of the
  24. * GNU General Public License ("GPL") version 2 as published by the Free
  25. * Software Foundation.
  26. *
  27. * NO WARRANTY
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  37. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGES.
  39. *
  40. * $FreeBSD$
  41. */
  42. VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $"
  43. /*
  44. * This file is processed by the aic7xxx_asm utility for use in assembling
  45. * firmware for the aic7xxx family of SCSI host adapters as well as to generate
  46. * a C header file for use in the kernel portion of the Aic7xxx driver.
  47. *
  48. * All page numbers refer to the Adaptec AIC-7770 Data Book available from
  49. * Adaptec's Technical Documents Department 1-800-934-2766
  50. */
  51. /*
  52. * SCSI Sequence Control (p. 3-11).
  53. * Each bit, when set starts a specific SCSI sequence on the bus
  54. */
  55. register SCSISEQ {
  56. address 0x000
  57. access_mode RW
  58. field TEMODE 0x80
  59. field ENSELO 0x40
  60. field ENSELI 0x20
  61. field ENRSELI 0x10
  62. field ENAUTOATNO 0x08
  63. field ENAUTOATNI 0x04
  64. field ENAUTOATNP 0x02
  65. field SCSIRSTO 0x01
  66. }
  67. /*
  68. * SCSI Transfer Control 0 Register (pp. 3-13).
  69. * Controls the SCSI module data path.
  70. */
  71. register SXFRCTL0 {
  72. address 0x001
  73. access_mode RW
  74. field DFON 0x80
  75. field DFPEXP 0x40
  76. field FAST20 0x20
  77. field CLRSTCNT 0x10
  78. field SPIOEN 0x08
  79. field SCAMEN 0x04
  80. field CLRCHN 0x02
  81. }
  82. /*
  83. * SCSI Transfer Control 1 Register (pp. 3-14,15).
  84. * Controls the SCSI module data path.
  85. */
  86. register SXFRCTL1 {
  87. address 0x002
  88. access_mode RW
  89. field BITBUCKET 0x80
  90. field SWRAPEN 0x40
  91. field ENSPCHK 0x20
  92. mask STIMESEL 0x18
  93. field ENSTIMER 0x04
  94. field ACTNEGEN 0x02
  95. field STPWEN 0x01 /* Powered Termination */
  96. }
  97. /*
  98. * SCSI Control Signal Read Register (p. 3-15).
  99. * Reads the actual state of the SCSI bus pins
  100. */
  101. register SCSISIGI {
  102. address 0x003
  103. access_mode RO
  104. field CDI 0x80
  105. field IOI 0x40
  106. field MSGI 0x20
  107. field ATNI 0x10
  108. field SELI 0x08
  109. field BSYI 0x04
  110. field REQI 0x02
  111. field ACKI 0x01
  112. /*
  113. * Possible phases in SCSISIGI
  114. */
  115. mask PHASE_MASK CDI|IOI|MSGI
  116. mask P_DATAOUT 0x00
  117. mask P_DATAIN IOI
  118. mask P_DATAOUT_DT P_DATAOUT|MSGI
  119. mask P_DATAIN_DT P_DATAIN|MSGI
  120. mask P_COMMAND CDI
  121. mask P_MESGOUT CDI|MSGI
  122. mask P_STATUS CDI|IOI
  123. mask P_MESGIN CDI|IOI|MSGI
  124. }
  125. /*
  126. * SCSI Control Signal Write Register (p. 3-16).
  127. * Writing to this register modifies the control signals on the bus. Only
  128. * those signals that are allowed in the current mode (Initiator/Target) are
  129. * asserted.
  130. */
  131. register SCSISIGO {
  132. address 0x003
  133. access_mode WO
  134. field CDO 0x80
  135. field IOO 0x40
  136. field MSGO 0x20
  137. field ATNO 0x10
  138. field SELO 0x08
  139. field BSYO 0x04
  140. field REQO 0x02
  141. field ACKO 0x01
  142. /*
  143. * Possible phases to write into SCSISIG0
  144. */
  145. mask PHASE_MASK CDI|IOI|MSGI
  146. mask P_DATAOUT 0x00
  147. mask P_DATAIN IOI
  148. mask P_COMMAND CDI
  149. mask P_MESGOUT CDI|MSGI
  150. mask P_STATUS CDI|IOI
  151. mask P_MESGIN CDI|IOI|MSGI
  152. }
  153. /*
  154. * SCSI Rate Control (p. 3-17).
  155. * Contents of this register determine the Synchronous SCSI data transfer
  156. * rate and the maximum synchronous Req/Ack offset. An offset of 0 in the
  157. * SOFS (3:0) bits disables synchronous data transfers. Any offset value
  158. * greater than 0 enables synchronous transfers.
  159. */
  160. register SCSIRATE {
  161. address 0x004
  162. access_mode RW
  163. field WIDEXFER 0x80 /* Wide transfer control */
  164. field ENABLE_CRC 0x40 /* CRC for D-Phases */
  165. field SINGLE_EDGE 0x10 /* Disable DT Transfers */
  166. mask SXFR 0x70 /* Sync transfer rate */
  167. mask SXFR_ULTRA2 0x0f /* Sync transfer rate */
  168. mask SOFS 0x0f /* Sync offset */
  169. }
  170. /*
  171. * SCSI ID (p. 3-18).
  172. * Contains the ID of the board and the current target on the
  173. * selected channel.
  174. */
  175. register SCSIID {
  176. address 0x005
  177. access_mode RW
  178. mask TID 0xf0 /* Target ID mask */
  179. mask TWIN_TID 0x70
  180. field TWIN_CHNLB 0x80
  181. mask OID 0x0f /* Our ID mask */
  182. /*
  183. * SCSI Maximum Offset (p. 4-61 aic7890/91 Data Book)
  184. * The aic7890/91 allow an offset of up to 127 transfers in both wide
  185. * and narrow mode.
  186. */
  187. alias SCSIOFFSET
  188. mask SOFS_ULTRA2 0x7f /* Sync offset U2 chips */
  189. }
  190. /*
  191. * SCSI Latched Data (p. 3-19).
  192. * Read/Write latches used to transfer data on the SCSI bus during
  193. * Automatic or Manual PIO mode. SCSIDATH can be used for the
  194. * upper byte of a 16bit wide asynchronouse data phase transfer.
  195. */
  196. register SCSIDATL {
  197. address 0x006
  198. access_mode RW
  199. }
  200. register SCSIDATH {
  201. address 0x007
  202. access_mode RW
  203. }
  204. /*
  205. * SCSI Transfer Count (pp. 3-19,20)
  206. * These registers count down the number of bytes transferred
  207. * across the SCSI bus. The counter is decremented only once
  208. * the data has been safely transferred. SDONE in SSTAT0 is
  209. * set when STCNT goes to 0
  210. */
  211. register STCNT {
  212. address 0x008
  213. size 3
  214. access_mode RW
  215. }
  216. /* ALT_MODE registers (Ultra2 and Ultra160 chips) */
  217. register SXFRCTL2 {
  218. address 0x013
  219. access_mode RW
  220. field AUTORSTDIS 0x10
  221. field CMDDMAEN 0x08
  222. mask ASYNC_SETUP 0x07
  223. }
  224. /* ALT_MODE register on Ultra160 chips */
  225. register OPTIONMODE {
  226. address 0x008
  227. access_mode RW
  228. count 2
  229. field AUTORATEEN 0x80
  230. field AUTOACKEN 0x40
  231. field ATNMGMNTEN 0x20
  232. field BUSFREEREV 0x10
  233. field EXPPHASEDIS 0x08
  234. field SCSIDATL_IMGEN 0x04
  235. field AUTO_MSGOUT_DE 0x02
  236. field DIS_MSGIN_DUALEDGE 0x01
  237. mask OPTIONMODE_DEFAULTS AUTO_MSGOUT_DE|DIS_MSGIN_DUALEDGE
  238. }
  239. /* ALT_MODE register on Ultra160 chips */
  240. register TARGCRCCNT {
  241. address 0x00a
  242. size 2
  243. access_mode RW
  244. count 2
  245. }
  246. /*
  247. * Clear SCSI Interrupt 0 (p. 3-20)
  248. * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT0.
  249. */
  250. register CLRSINT0 {
  251. address 0x00b
  252. access_mode WO
  253. field CLRSELDO 0x40
  254. field CLRSELDI 0x20
  255. field CLRSELINGO 0x10
  256. field CLRSWRAP 0x08
  257. field CLRIOERR 0x08 /* Ultra2 Only */
  258. field CLRSPIORDY 0x02
  259. }
  260. /*
  261. * SCSI Status 0 (p. 3-21)
  262. * Contains one set of SCSI Interrupt codes
  263. * These are most likely of interest to the sequencer
  264. */
  265. register SSTAT0 {
  266. address 0x00b
  267. access_mode RO
  268. field TARGET 0x80 /* Board acting as target */
  269. field SELDO 0x40 /* Selection Done */
  270. field SELDI 0x20 /* Board has been selected */
  271. field SELINGO 0x10 /* Selection In Progress */
  272. field SWRAP 0x08 /* 24bit counter wrap */
  273. field IOERR 0x08 /* LVD Tranceiver mode changed */
  274. field SDONE 0x04 /* STCNT = 0x000000 */
  275. field SPIORDY 0x02 /* SCSI PIO Ready */
  276. field DMADONE 0x01 /* DMA transfer completed */
  277. }
  278. /*
  279. * Clear SCSI Interrupt 1 (p. 3-23)
  280. * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1.
  281. */
  282. register CLRSINT1 {
  283. address 0x00c
  284. access_mode WO
  285. field CLRSELTIMEO 0x80
  286. field CLRATNO 0x40
  287. field CLRSCSIRSTI 0x20
  288. field CLRBUSFREE 0x08
  289. field CLRSCSIPERR 0x04
  290. field CLRPHASECHG 0x02
  291. field CLRREQINIT 0x01
  292. }
  293. /*
  294. * SCSI Status 1 (p. 3-24)
  295. */
  296. register SSTAT1 {
  297. address 0x00c
  298. access_mode RO
  299. field SELTO 0x80
  300. field ATNTARG 0x40
  301. field SCSIRSTI 0x20
  302. field PHASEMIS 0x10
  303. field BUSFREE 0x08
  304. field SCSIPERR 0x04
  305. field PHASECHG 0x02
  306. field REQINIT 0x01
  307. }
  308. /*
  309. * SCSI Status 2 (pp. 3-25,26)
  310. */
  311. register SSTAT2 {
  312. address 0x00d
  313. access_mode RO
  314. field OVERRUN 0x80
  315. field SHVALID 0x40 /* Shaddow Layer non-zero */
  316. field EXP_ACTIVE 0x10 /* SCSI Expander Active */
  317. field CRCVALERR 0x08 /* CRC doesn't match (U3 only) */
  318. field CRCENDERR 0x04 /* No terminal CRC packet (U3 only) */
  319. field CRCREQERR 0x02 /* Illegal CRC packet req (U3 only) */
  320. field DUAL_EDGE_ERR 0x01 /* Incorrect data phase (U3 only) */
  321. mask SFCNT 0x1f
  322. }
  323. /*
  324. * SCSI Status 3 (p. 3-26)
  325. */
  326. register SSTAT3 {
  327. address 0x00e
  328. access_mode RO
  329. count 2
  330. mask SCSICNT 0xf0
  331. mask OFFCNT 0x0f
  332. mask U2OFFCNT 0x7f
  333. }
  334. /*
  335. * SCSI ID for the aic7890/91 chips
  336. */
  337. register SCSIID_ULTRA2 {
  338. address 0x00f
  339. access_mode RW
  340. mask TID 0xf0 /* Target ID mask */
  341. mask OID 0x0f /* Our ID mask */
  342. }
  343. /*
  344. * SCSI Interrupt Mode 1 (p. 3-28)
  345. * Setting any bit will enable the corresponding function
  346. * in SIMODE0 to interrupt via the IRQ pin.
  347. */
  348. register SIMODE0 {
  349. address 0x010
  350. access_mode RW
  351. count 2
  352. field ENSELDO 0x40
  353. field ENSELDI 0x20
  354. field ENSELINGO 0x10
  355. field ENSWRAP 0x08
  356. field ENIOERR 0x08 /* LVD Tranceiver mode changes */
  357. field ENSDONE 0x04
  358. field ENSPIORDY 0x02
  359. field ENDMADONE 0x01
  360. }
  361. /*
  362. * SCSI Interrupt Mode 1 (pp. 3-28,29)
  363. * Setting any bit will enable the corresponding function
  364. * in SIMODE1 to interrupt via the IRQ pin.
  365. */
  366. register SIMODE1 {
  367. address 0x011
  368. access_mode RW
  369. field ENSELTIMO 0x80
  370. field ENATNTARG 0x40
  371. field ENSCSIRST 0x20
  372. field ENPHASEMIS 0x10
  373. field ENBUSFREE 0x08
  374. field ENSCSIPERR 0x04
  375. field ENPHASECHG 0x02
  376. field ENREQINIT 0x01
  377. }
  378. /*
  379. * SCSI Data Bus (High) (p. 3-29)
  380. * This register reads data on the SCSI Data bus directly.
  381. */
  382. register SCSIBUSL {
  383. address 0x012
  384. access_mode RW
  385. }
  386. register SCSIBUSH {
  387. address 0x013
  388. access_mode RW
  389. }
  390. /*
  391. * SCSI/Host Address (p. 3-30)
  392. * These registers hold the host address for the byte about to be
  393. * transferred on the SCSI bus. They are counted up in the same
  394. * manner as STCNT is counted down. SHADDR should always be used
  395. * to determine the address of the last byte transferred since HADDR
  396. * can be skewed by write ahead.
  397. */
  398. register SHADDR {
  399. address 0x014
  400. size 4
  401. access_mode RO
  402. }
  403. /*
  404. * Selection Timeout Timer (p. 3-30)
  405. */
  406. register SELTIMER {
  407. address 0x018
  408. access_mode RW
  409. count 1
  410. field STAGE6 0x20
  411. field STAGE5 0x10
  412. field STAGE4 0x08
  413. field STAGE3 0x04
  414. field STAGE2 0x02
  415. field STAGE1 0x01
  416. alias TARGIDIN
  417. }
  418. /*
  419. * Selection/Reselection ID (p. 3-31)
  420. * Upper four bits are the device id. The ONEBIT is set when the re/selecting
  421. * device did not set its own ID.
  422. */
  423. register SELID {
  424. address 0x019
  425. access_mode RW
  426. mask SELID_MASK 0xf0
  427. field ONEBIT 0x08
  428. }
  429. register SCAMCTL {
  430. address 0x01a
  431. access_mode RW
  432. field ENSCAMSELO 0x80
  433. field CLRSCAMSELID 0x40
  434. field ALTSTIM 0x20
  435. field DFLTTID 0x10
  436. mask SCAMLVL 0x03
  437. }
  438. /*
  439. * Target Mode Selecting in ID bitmask (aic7890/91/96/97)
  440. */
  441. register TARGID {
  442. address 0x01b
  443. size 2
  444. access_mode RW
  445. count 14
  446. }
  447. /*
  448. * Serial Port I/O Cabability register (p. 4-95 aic7860 Data Book)
  449. * Indicates if external logic has been attached to the chip to
  450. * perform the tasks of accessing a serial eeprom, testing termination
  451. * strength, and performing cable detection. On the aic7860, most of
  452. * these features are handled on chip, but on the aic7855 an attached
  453. * aic3800 does the grunt work.
  454. */
  455. register SPIOCAP {
  456. address 0x01b
  457. access_mode RW
  458. count 10
  459. field SOFT1 0x80
  460. field SOFT0 0x40
  461. field SOFTCMDEN 0x20
  462. field EXT_BRDCTL 0x10 /* External Board control */
  463. field SEEPROM 0x08 /* External serial eeprom logic */
  464. field EEPROM 0x04 /* Writable external BIOS ROM */
  465. field ROM 0x02 /* Logic for accessing external ROM */
  466. field SSPIOCPS 0x01 /* Termination and cable detection */
  467. }
  468. register BRDCTL {
  469. address 0x01d
  470. count 11
  471. field BRDDAT7 0x80
  472. field BRDDAT6 0x40
  473. field BRDDAT5 0x20
  474. field BRDSTB 0x10
  475. field BRDCS 0x08
  476. field BRDRW 0x04
  477. field BRDCTL1 0x02
  478. field BRDCTL0 0x01
  479. /* 7890 Definitions */
  480. field BRDDAT4 0x10
  481. field BRDDAT3 0x08
  482. field BRDDAT2 0x04
  483. field BRDRW_ULTRA2 0x02
  484. field BRDSTB_ULTRA2 0x01
  485. }
  486. /*
  487. * Serial EEPROM Control (p. 4-92 in 7870 Databook)
  488. * Controls the reading and writing of an external serial 1-bit
  489. * EEPROM Device. In order to access the serial EEPROM, you must
  490. * first set the SEEMS bit that generates a request to the memory
  491. * port for access to the serial EEPROM device. When the memory
  492. * port is not busy servicing another request, it reconfigures
  493. * to allow access to the serial EEPROM. When this happens, SEERDY
  494. * gets set high to verify that the memory port access has been
  495. * granted.
  496. *
  497. * After successful arbitration for the memory port, the SEECS bit of
  498. * the SEECTL register is connected to the chip select. The SEECK,
  499. * SEEDO, and SEEDI are connected to the clock, data out, and data in
  500. * lines respectively. The SEERDY bit of SEECTL is useful in that it
  501. * gives us an 800 nsec timer. After a write to the SEECTL register,
  502. * the SEERDY goes high 800 nsec later. The one exception to this is
  503. * when we first request access to the memory port. The SEERDY goes
  504. * high to signify that access has been granted and, for this case, has
  505. * no implied timing.
  506. *
  507. * See 93cx6.c for detailed information on the protocol necessary to
  508. * read the serial EEPROM.
  509. */
  510. register SEECTL {
  511. address 0x01e
  512. count 11
  513. field EXTARBACK 0x80
  514. field EXTARBREQ 0x40
  515. field SEEMS 0x20
  516. field SEERDY 0x10
  517. field SEECS 0x08
  518. field SEECK 0x04
  519. field SEEDO 0x02
  520. field SEEDI 0x01
  521. }
  522. /*
  523. * SCSI Block Control (p. 3-32)
  524. * Controls Bus type and channel selection. In a twin channel configuration
  525. * addresses 0x00-0x1e are gated to the appropriate channel based on this
  526. * register. SELWIDE allows for the coexistence of 8bit and 16bit devices
  527. * on a wide bus.
  528. */
  529. register SBLKCTL {
  530. address 0x01f
  531. access_mode RW
  532. field DIAGLEDEN 0x80 /* Aic78X0 only */
  533. field DIAGLEDON 0x40 /* Aic78X0 only */
  534. field AUTOFLUSHDIS 0x20
  535. field SELBUSB 0x08
  536. field ENAB40 0x08 /* LVD transceiver active */
  537. field ENAB20 0x04 /* SE/HVD transceiver active */
  538. field SELWIDE 0x02
  539. field XCVR 0x01 /* External transceiver active */
  540. }
  541. /*
  542. * Sequencer Control (p. 3-33)
  543. * Error detection mode and speed configuration
  544. */
  545. register SEQCTL {
  546. address 0x060
  547. access_mode RW
  548. count 15
  549. field PERRORDIS 0x80
  550. field PAUSEDIS 0x40
  551. field FAILDIS 0x20
  552. field FASTMODE 0x10
  553. field BRKADRINTEN 0x08
  554. field STEP 0x04
  555. field SEQRESET 0x02
  556. field LOADRAM 0x01
  557. }
  558. /*
  559. * Sequencer RAM Data (p. 3-34)
  560. * Single byte window into the Scratch Ram area starting at the address
  561. * specified by SEQADDR0 and SEQADDR1. To write a full word, simply write
  562. * four bytes in succession. The SEQADDRs will increment after the most
  563. * significant byte is written
  564. */
  565. register SEQRAM {
  566. address 0x061
  567. access_mode RW
  568. count 2
  569. }
  570. /*
  571. * Sequencer Address Registers (p. 3-35)
  572. * Only the first bit of SEQADDR1 holds addressing information
  573. */
  574. register SEQADDR0 {
  575. address 0x062
  576. access_mode RW
  577. }
  578. register SEQADDR1 {
  579. address 0x063
  580. access_mode RW
  581. count 8
  582. mask SEQADDR1_MASK 0x01
  583. }
  584. /*
  585. * Accumulator
  586. * We cheat by passing arguments in the Accumulator up to the kernel driver
  587. */
  588. register ACCUM {
  589. address 0x064
  590. access_mode RW
  591. accumulator
  592. }
  593. register SINDEX {
  594. address 0x065
  595. access_mode RW
  596. sindex
  597. }
  598. register DINDEX {
  599. address 0x066
  600. access_mode RW
  601. }
  602. register ALLONES {
  603. address 0x069
  604. access_mode RO
  605. allones
  606. }
  607. register ALLZEROS {
  608. address 0x06a
  609. access_mode RO
  610. allzeros
  611. }
  612. register NONE {
  613. address 0x06a
  614. access_mode WO
  615. none
  616. }
  617. register FLAGS {
  618. address 0x06b
  619. access_mode RO
  620. count 18
  621. field ZERO 0x02
  622. field CARRY 0x01
  623. }
  624. register SINDIR {
  625. address 0x06c
  626. access_mode RO
  627. }
  628. register DINDIR {
  629. address 0x06d
  630. access_mode WO
  631. }
  632. register FUNCTION1 {
  633. address 0x06e
  634. access_mode RW
  635. }
  636. register STACK {
  637. address 0x06f
  638. access_mode RO
  639. count 5
  640. }
  641. const STACK_SIZE 4
  642. /*
  643. * Board Control (p. 3-43)
  644. */
  645. register BCTL {
  646. address 0x084
  647. access_mode RW
  648. field ACE 0x08
  649. field ENABLE 0x01
  650. }
  651. /*
  652. * On the aic78X0 chips, Board Control is replaced by the DSCommand
  653. * register (p. 4-64)
  654. */
  655. register DSCOMMAND0 {
  656. address 0x084
  657. access_mode RW
  658. count 7
  659. field CACHETHEN 0x80 /* Cache Threshold enable */
  660. field DPARCKEN 0x40 /* Data Parity Check Enable */
  661. field MPARCKEN 0x20 /* Memory Parity Check Enable */
  662. field EXTREQLCK 0x10 /* External Request Lock */
  663. /* aic7890/91/96/97 only */
  664. field INTSCBRAMSEL 0x08 /* Internal SCB RAM Select */
  665. field RAMPS 0x04 /* External SCB RAM Present */
  666. field USCBSIZE32 0x02 /* Use 32byte SCB Page Size */
  667. field CIOPARCKEN 0x01 /* Internal bus parity error enable */
  668. }
  669. register DSCOMMAND1 {
  670. address 0x085
  671. access_mode RW
  672. mask DSLATT 0xfc /* PCI latency timer (non-ultra2) */
  673. field HADDLDSEL1 0x02 /* Host Address Load Select Bits */
  674. field HADDLDSEL0 0x01
  675. }
  676. /*
  677. * Bus On/Off Time (p. 3-44) aic7770 only
  678. */
  679. register BUSTIME {
  680. address 0x085
  681. access_mode RW
  682. count 2
  683. mask BOFF 0xf0
  684. mask BON 0x0f
  685. }
  686. /*
  687. * Bus Speed (p. 3-45) aic7770 only
  688. */
  689. register BUSSPD {
  690. address 0x086
  691. access_mode RW
  692. count 2
  693. mask DFTHRSH 0xc0
  694. mask STBOFF 0x38
  695. mask STBON 0x07
  696. mask DFTHRSH_100 0xc0
  697. mask DFTHRSH_75 0x80
  698. }
  699. /* aic7850/55/60/70/80/95 only */
  700. register DSPCISTATUS {
  701. address 0x086
  702. count 4
  703. mask DFTHRSH_100 0xc0
  704. }
  705. /* aic7890/91/96/97 only */
  706. register HS_MAILBOX {
  707. address 0x086
  708. mask HOST_MAILBOX 0xF0
  709. mask SEQ_MAILBOX 0x0F
  710. mask HOST_TQINPOS 0x80 /* Boundary at either 0 or 128 */
  711. }
  712. const HOST_MAILBOX_SHIFT 4
  713. const SEQ_MAILBOX_SHIFT 0
  714. /*
  715. * Host Control (p. 3-47) R/W
  716. * Overall host control of the device.
  717. */
  718. register HCNTRL {
  719. address 0x087
  720. access_mode RW
  721. count 14
  722. field POWRDN 0x40
  723. field SWINT 0x10
  724. field IRQMS 0x08
  725. field PAUSE 0x04
  726. field INTEN 0x02
  727. field CHIPRST 0x01
  728. field CHIPRSTACK 0x01
  729. }
  730. /*
  731. * Host Address (p. 3-48)
  732. * This register contains the address of the byte about
  733. * to be transferred across the host bus.
  734. */
  735. register HADDR {
  736. address 0x088
  737. size 4
  738. access_mode RW
  739. }
  740. register HCNT {
  741. address 0x08c
  742. size 3
  743. access_mode RW
  744. }
  745. /*
  746. * SCB Pointer (p. 3-49)
  747. * Gate one of the SCBs into the SCBARRAY window.
  748. */
  749. register SCBPTR {
  750. address 0x090
  751. access_mode RW
  752. }
  753. /*
  754. * Interrupt Status (p. 3-50)
  755. * Status for system interrupts
  756. */
  757. register INTSTAT {
  758. address 0x091
  759. access_mode RW
  760. field BRKADRINT 0x08
  761. field SCSIINT 0x04
  762. field CMDCMPLT 0x02
  763. field SEQINT 0x01
  764. mask BAD_PHASE SEQINT /* unknown scsi bus phase */
  765. mask SEND_REJECT 0x10|SEQINT /* sending a message reject */
  766. mask PROTO_VIOLATION 0x20|SEQINT /* SCSI protocol violation */
  767. mask NO_MATCH 0x30|SEQINT /* no cmd match for reconnect */
  768. mask IGN_WIDE_RES 0x40|SEQINT /* Complex IGN Wide Res Msg */
  769. mask PDATA_REINIT 0x50|SEQINT /*
  770. * Returned to data phase
  771. * that requires data
  772. * transfer pointers to be
  773. * recalculated from the
  774. * transfer residual.
  775. */
  776. mask HOST_MSG_LOOP 0x60|SEQINT /*
  777. * The bus is ready for the
  778. * host to perform another
  779. * message transaction. This
  780. * mechanism is used for things
  781. * like sync/wide negotiation
  782. * that require a kernel based
  783. * message state engine.
  784. */
  785. mask BAD_STATUS 0x70|SEQINT /* Bad status from target */
  786. mask PERR_DETECTED 0x80|SEQINT /*
  787. * Either the phase_lock
  788. * or inb_next routine has
  789. * noticed a parity error.
  790. */
  791. mask DATA_OVERRUN 0x90|SEQINT /*
  792. * Target attempted to write
  793. * beyond the bounds of its
  794. * command.
  795. */
  796. mask MKMSG_FAILED 0xa0|SEQINT /*
  797. * Target completed command
  798. * without honoring our ATN
  799. * request to issue a message.
  800. */
  801. mask MISSED_BUSFREE 0xb0|SEQINT /*
  802. * The sequencer never saw
  803. * the bus go free after
  804. * either a command complete
  805. * or disconnect message.
  806. */
  807. mask SCB_MISMATCH 0xc0|SEQINT /*
  808. * Downloaded SCB's tag does
  809. * not match the entry we
  810. * intended to download.
  811. */
  812. mask NO_FREE_SCB 0xd0|SEQINT /*
  813. * get_free_or_disc_scb failed.
  814. */
  815. mask OUT_OF_RANGE 0xe0|SEQINT
  816. mask SEQINT_MASK 0xf0|SEQINT /* SEQINT Status Codes */
  817. mask INT_PEND (BRKADRINT|SEQINT|SCSIINT|CMDCMPLT)
  818. }
  819. /*
  820. * Hard Error (p. 3-53)
  821. * Reporting of catastrophic errors. You usually cannot recover from
  822. * these without a full board reset.
  823. */
  824. register ERROR {
  825. address 0x092
  826. access_mode RO
  827. count 26
  828. field CIOPARERR 0x80 /* Ultra2 only */
  829. field PCIERRSTAT 0x40 /* PCI only */
  830. field MPARERR 0x20 /* PCI only */
  831. field DPARERR 0x10 /* PCI only */
  832. field SQPARERR 0x08
  833. field ILLOPCODE 0x04
  834. field ILLSADDR 0x02
  835. field ILLHADDR 0x01
  836. }
  837. /*
  838. * Clear Interrupt Status (p. 3-52)
  839. */
  840. register CLRINT {
  841. address 0x092
  842. access_mode WO
  843. count 24
  844. field CLRPARERR 0x10 /* PCI only */
  845. field CLRBRKADRINT 0x08
  846. field CLRSCSIINT 0x04
  847. field CLRCMDINT 0x02
  848. field CLRSEQINT 0x01
  849. }
  850. register DFCNTRL {
  851. address 0x093
  852. access_mode RW
  853. field PRELOADEN 0x80 /* aic7890 only */
  854. field WIDEODD 0x40
  855. field SCSIEN 0x20
  856. field SDMAEN 0x10
  857. field SDMAENACK 0x10
  858. field HDMAEN 0x08
  859. field HDMAENACK 0x08
  860. field DIRECTION 0x04
  861. field FIFOFLUSH 0x02
  862. field FIFORESET 0x01
  863. }
  864. register DFSTATUS {
  865. address 0x094
  866. access_mode RO
  867. field PRELOAD_AVAIL 0x80
  868. field DFCACHETH 0x40
  869. field FIFOQWDEMP 0x20
  870. field MREQPEND 0x10
  871. field HDONE 0x08
  872. field DFTHRESH 0x04
  873. field FIFOFULL 0x02
  874. field FIFOEMP 0x01
  875. }
  876. register DFWADDR {
  877. address 0x95
  878. access_mode RW
  879. }
  880. register DFRADDR {
  881. address 0x97
  882. access_mode RW
  883. }
  884. register DFDAT {
  885. address 0x099
  886. access_mode RW
  887. }
  888. /*
  889. * SCB Auto Increment (p. 3-59)
  890. * Byte offset into the SCB Array and an optional bit to allow auto
  891. * incrementing of the address during download and upload operations
  892. */
  893. register SCBCNT {
  894. address 0x09a
  895. access_mode RW
  896. count 1
  897. field SCBAUTO 0x80
  898. mask SCBCNT_MASK 0x1f
  899. }
  900. /*
  901. * Queue In FIFO (p. 3-60)
  902. * Input queue for queued SCBs (commands that the seqencer has yet to start)
  903. */
  904. register QINFIFO {
  905. address 0x09b
  906. access_mode RW
  907. count 12
  908. }
  909. /*
  910. * Queue In Count (p. 3-60)
  911. * Number of queued SCBs
  912. */
  913. register QINCNT {
  914. address 0x09c
  915. access_mode RO
  916. }
  917. /*
  918. * Queue Out FIFO (p. 3-61)
  919. * Queue of SCBs that have completed and await the host
  920. */
  921. register QOUTFIFO {
  922. address 0x09d
  923. access_mode WO
  924. count 7
  925. }
  926. register CRCCONTROL1 {
  927. address 0x09d
  928. access_mode RW
  929. count 3
  930. field CRCONSEEN 0x80
  931. field CRCVALCHKEN 0x40
  932. field CRCENDCHKEN 0x20
  933. field CRCREQCHKEN 0x10
  934. field TARGCRCENDEN 0x08
  935. field TARGCRCCNTEN 0x04
  936. }
  937. /*
  938. * Queue Out Count (p. 3-61)
  939. * Number of queued SCBs in the Out FIFO
  940. */
  941. register QOUTCNT {
  942. address 0x09e
  943. access_mode RO
  944. }
  945. register SCSIPHASE {
  946. address 0x09e
  947. access_mode RO
  948. field STATUS_PHASE 0x20
  949. field COMMAND_PHASE 0x10
  950. field MSG_IN_PHASE 0x08
  951. field MSG_OUT_PHASE 0x04
  952. field DATA_IN_PHASE 0x02
  953. field DATA_OUT_PHASE 0x01
  954. mask DATA_PHASE_MASK 0x03
  955. }
  956. /*
  957. * Special Function
  958. */
  959. register SFUNCT {
  960. address 0x09f
  961. access_mode RW
  962. count 4
  963. field ALT_MODE 0x80
  964. }
  965. /*
  966. * SCB Definition (p. 5-4)
  967. */
  968. scb {
  969. address 0x0a0
  970. size 64
  971. SCB_CDB_PTR {
  972. size 4
  973. alias SCB_RESIDUAL_DATACNT
  974. alias SCB_CDB_STORE
  975. }
  976. SCB_RESIDUAL_SGPTR {
  977. size 4
  978. }
  979. SCB_SCSI_STATUS {
  980. size 1
  981. }
  982. SCB_TARGET_PHASES {
  983. size 1
  984. }
  985. SCB_TARGET_DATA_DIR {
  986. size 1
  987. }
  988. SCB_TARGET_ITAG {
  989. size 1
  990. }
  991. SCB_DATAPTR {
  992. size 4
  993. }
  994. SCB_DATACNT {
  995. /*
  996. * The last byte is really the high address bits for
  997. * the data address.
  998. */
  999. size 4
  1000. field SG_LAST_SEG 0x80 /* In the fourth byte */
  1001. mask SG_HIGH_ADDR_BITS 0x7F /* In the fourth byte */
  1002. }
  1003. SCB_SGPTR {
  1004. size 4
  1005. field SG_RESID_VALID 0x04 /* In the first byte */
  1006. field SG_FULL_RESID 0x02 /* In the first byte */
  1007. field SG_LIST_NULL 0x01 /* In the first byte */
  1008. }
  1009. SCB_CONTROL {
  1010. size 1
  1011. field TARGET_SCB 0x80
  1012. field STATUS_RCVD 0x80
  1013. field DISCENB 0x40
  1014. field TAG_ENB 0x20
  1015. field MK_MESSAGE 0x10
  1016. field ULTRAENB 0x08
  1017. field DISCONNECTED 0x04
  1018. mask SCB_TAG_TYPE 0x03
  1019. }
  1020. SCB_SCSIID {
  1021. size 1
  1022. field TWIN_CHNLB 0x80
  1023. mask TWIN_TID 0x70
  1024. mask TID 0xf0
  1025. mask OID 0x0f
  1026. }
  1027. SCB_LUN {
  1028. field SCB_XFERLEN_ODD 0x80
  1029. mask LID 0x3f
  1030. size 1
  1031. }
  1032. SCB_TAG {
  1033. size 1
  1034. }
  1035. SCB_CDB_LEN {
  1036. size 1
  1037. }
  1038. SCB_SCSIRATE {
  1039. size 1
  1040. }
  1041. SCB_SCSIOFFSET {
  1042. size 1
  1043. count 1
  1044. }
  1045. SCB_NEXT {
  1046. size 1
  1047. }
  1048. SCB_64_SPARE {
  1049. size 16
  1050. }
  1051. SCB_64_BTT {
  1052. size 16
  1053. }
  1054. }
  1055. const SCB_UPLOAD_SIZE 32
  1056. const SCB_DOWNLOAD_SIZE 32
  1057. const SCB_DOWNLOAD_SIZE_64 48
  1058. const SG_SIZEOF 0x08 /* sizeof(struct ahc_dma) */
  1059. /* --------------------- AHA-2840-only definitions -------------------- */
  1060. register SEECTL_2840 {
  1061. address 0x0c0
  1062. access_mode RW
  1063. count 2
  1064. field CS_2840 0x04
  1065. field CK_2840 0x02
  1066. field DO_2840 0x01
  1067. }
  1068. register STATUS_2840 {
  1069. address 0x0c1
  1070. access_mode RW
  1071. count 4
  1072. field EEPROM_TF 0x80
  1073. mask BIOS_SEL 0x60
  1074. mask ADSEL 0x1e
  1075. field DI_2840 0x01
  1076. }
  1077. /* --------------------- AIC-7870-only definitions -------------------- */
  1078. register CCHADDR {
  1079. address 0x0E0
  1080. size 8
  1081. }
  1082. register CCHCNT {
  1083. address 0x0E8
  1084. }
  1085. register CCSGRAM {
  1086. address 0x0E9
  1087. }
  1088. register CCSGADDR {
  1089. address 0x0EA
  1090. }
  1091. register CCSGCTL {
  1092. address 0x0EB
  1093. field CCSGDONE 0x80
  1094. field CCSGEN 0x08
  1095. field SG_FETCH_NEEDED 0x02 /* Bit used for software state */
  1096. field CCSGRESET 0x01
  1097. }
  1098. register CCSCBCNT {
  1099. address 0xEF
  1100. count 1
  1101. }
  1102. register CCSCBCTL {
  1103. address 0x0EE
  1104. field CCSCBDONE 0x80
  1105. field ARRDONE 0x40 /* SCB Array prefetch done */
  1106. field CCARREN 0x10
  1107. field CCSCBEN 0x08
  1108. field CCSCBDIR 0x04
  1109. field CCSCBRESET 0x01
  1110. }
  1111. register CCSCBADDR {
  1112. address 0x0ED
  1113. }
  1114. register CCSCBRAM {
  1115. address 0xEC
  1116. }
  1117. /*
  1118. * SCB bank address (7895/7896/97 only)
  1119. */
  1120. register SCBBADDR {
  1121. address 0x0F0
  1122. access_mode RW
  1123. count 3
  1124. }
  1125. register CCSCBPTR {
  1126. address 0x0F1
  1127. }
  1128. register HNSCB_QOFF {
  1129. address 0x0F4
  1130. count 4
  1131. }
  1132. register SNSCB_QOFF {
  1133. address 0x0F6
  1134. }
  1135. register SDSCB_QOFF {
  1136. address 0x0F8
  1137. }
  1138. register QOFF_CTLSTA {
  1139. address 0x0FA
  1140. field SCB_AVAIL 0x40
  1141. field SNSCB_ROLLOVER 0x20
  1142. field SDSCB_ROLLOVER 0x10
  1143. mask SCB_QSIZE 0x07
  1144. mask SCB_QSIZE_256 0x06
  1145. }
  1146. register DFF_THRSH {
  1147. address 0x0FB
  1148. mask WR_DFTHRSH 0x70
  1149. mask RD_DFTHRSH 0x07
  1150. mask RD_DFTHRSH_MIN 0x00
  1151. mask RD_DFTHRSH_25 0x01
  1152. mask RD_DFTHRSH_50 0x02
  1153. mask RD_DFTHRSH_63 0x03
  1154. mask RD_DFTHRSH_75 0x04
  1155. mask RD_DFTHRSH_85 0x05
  1156. mask RD_DFTHRSH_90 0x06
  1157. mask RD_DFTHRSH_MAX 0x07
  1158. mask WR_DFTHRSH_MIN 0x00
  1159. mask WR_DFTHRSH_25 0x10
  1160. mask WR_DFTHRSH_50 0x20
  1161. mask WR_DFTHRSH_63 0x30
  1162. mask WR_DFTHRSH_75 0x40
  1163. mask WR_DFTHRSH_85 0x50
  1164. mask WR_DFTHRSH_90 0x60
  1165. mask WR_DFTHRSH_MAX 0x70
  1166. count 4
  1167. }
  1168. register SG_CACHE_PRE {
  1169. access_mode WO
  1170. address 0x0fc
  1171. mask SG_ADDR_MASK 0xf8
  1172. field LAST_SEG 0x02
  1173. field LAST_SEG_DONE 0x01
  1174. }
  1175. register SG_CACHE_SHADOW {
  1176. access_mode RO
  1177. address 0x0fc
  1178. mask SG_ADDR_MASK 0xf8
  1179. field LAST_SEG 0x02
  1180. field LAST_SEG_DONE 0x01
  1181. }
  1182. /* ---------------------- Scratch RAM Offsets ------------------------- */
  1183. /* These offsets are either to values that are initialized by the board's
  1184. * BIOS or are specified by the sequencer code.
  1185. *
  1186. * The host adapter card (at least the BIOS) uses 20-2f for SCSI
  1187. * device information, 32-33 and 5a-5f as well. As it turns out, the
  1188. * BIOS trashes 20-2f, writing the synchronous negotiation results
  1189. * on top of the BIOS values, so we re-use those for our per-target
  1190. * scratchspace (actually a value that can be copied directly into
  1191. * SCSIRATE). The kernel driver will enable synchronous negotiation
  1192. * for all targets that have a value other than 0 in the lower four
  1193. * bits of the target scratch space. This should work regardless of
  1194. * whether the bios has been installed.
  1195. */
  1196. scratch_ram {
  1197. address 0x020
  1198. size 58
  1199. /*
  1200. * 1 byte per target starting at this address for configuration values
  1201. */
  1202. BUSY_TARGETS {
  1203. alias TARG_SCSIRATE
  1204. size 16
  1205. }
  1206. /*
  1207. * Bit vector of targets that have ULTRA enabled as set by
  1208. * the BIOS. The Sequencer relies on a per-SCB field to
  1209. * control whether to enable Ultra transfers or not. During
  1210. * initialization, we read this field and reuse it for 2
  1211. * entries in the busy target table.
  1212. */
  1213. ULTRA_ENB {
  1214. alias CMDSIZE_TABLE
  1215. size 2
  1216. count 2
  1217. }
  1218. /*
  1219. * Bit vector of targets that have disconnection disabled as set by
  1220. * the BIOS. The Sequencer relies in a per-SCB field to control the
  1221. * disconnect priveldge. During initialization, we read this field
  1222. * and reuse it for 2 entries in the busy target table.
  1223. */
  1224. DISC_DSB {
  1225. size 2
  1226. count 6
  1227. }
  1228. CMDSIZE_TABLE_TAIL {
  1229. size 4
  1230. }
  1231. /*
  1232. * Partial transfer past cacheline end to be
  1233. * transferred using an extra S/G.
  1234. */
  1235. MWI_RESIDUAL {
  1236. size 1
  1237. }
  1238. /*
  1239. * SCBID of the next SCB to be started by the controller.
  1240. */
  1241. NEXT_QUEUED_SCB {
  1242. size 1
  1243. }
  1244. /*
  1245. * Single byte buffer used to designate the type or message
  1246. * to send to a target.
  1247. */
  1248. MSG_OUT {
  1249. size 1
  1250. }
  1251. /* Parameters for DMA Logic */
  1252. DMAPARAMS {
  1253. size 1
  1254. count 12
  1255. field PRELOADEN 0x80
  1256. field WIDEODD 0x40
  1257. field SCSIEN 0x20
  1258. field SDMAEN 0x10
  1259. field SDMAENACK 0x10
  1260. field HDMAEN 0x08
  1261. field HDMAENACK 0x08
  1262. field DIRECTION 0x04 /* Set indicates PCI->SCSI */
  1263. field FIFOFLUSH 0x02
  1264. field FIFORESET 0x01
  1265. }
  1266. SEQ_FLAGS {
  1267. size 1
  1268. field NOT_IDENTIFIED 0x80
  1269. field NO_CDB_SENT 0x40
  1270. field TARGET_CMD_IS_TAGGED 0x40
  1271. field DPHASE 0x20
  1272. /* Target flags */
  1273. field TARG_CMD_PENDING 0x10
  1274. field CMDPHASE_PENDING 0x08
  1275. field DPHASE_PENDING 0x04
  1276. field SPHASE_PENDING 0x02
  1277. field NO_DISCONNECT 0x01
  1278. }
  1279. /*
  1280. * Temporary storage for the
  1281. * target/channel/lun of a
  1282. * reconnecting target
  1283. */
  1284. SAVED_SCSIID {
  1285. size 1
  1286. }
  1287. SAVED_LUN {
  1288. size 1
  1289. }
  1290. /*
  1291. * The last bus phase as seen by the sequencer.
  1292. */
  1293. LASTPHASE {
  1294. size 1
  1295. field CDI 0x80
  1296. field IOI 0x40
  1297. field MSGI 0x20
  1298. mask PHASE_MASK CDI|IOI|MSGI
  1299. mask P_DATAOUT 0x00
  1300. mask P_DATAIN IOI
  1301. mask P_COMMAND CDI
  1302. mask P_MESGOUT CDI|MSGI
  1303. mask P_STATUS CDI|IOI
  1304. mask P_MESGIN CDI|IOI|MSGI
  1305. mask P_BUSFREE 0x01
  1306. }
  1307. /*
  1308. * head of list of SCBs awaiting
  1309. * selection
  1310. */
  1311. WAITING_SCBH {
  1312. size 1
  1313. }
  1314. /*
  1315. * head of list of SCBs that are
  1316. * disconnected. Used for SCB
  1317. * paging.
  1318. */
  1319. DISCONNECTED_SCBH {
  1320. size 1
  1321. }
  1322. /*
  1323. * head of list of SCBs that are
  1324. * not in use. Used for SCB paging.
  1325. */
  1326. FREE_SCBH {
  1327. size 1
  1328. }
  1329. /*
  1330. * head of list of SCBs that have
  1331. * completed but have not been
  1332. * put into the qoutfifo.
  1333. */
  1334. COMPLETE_SCBH {
  1335. size 1
  1336. }
  1337. /*
  1338. * Address of the hardware scb array in the host.
  1339. */
  1340. HSCB_ADDR {
  1341. size 4
  1342. }
  1343. /*
  1344. * Base address of our shared data with the kernel driver in host
  1345. * memory. This includes the qoutfifo and target mode
  1346. * incoming command queue.
  1347. */
  1348. SHARED_DATA_ADDR {
  1349. size 4
  1350. }
  1351. KERNEL_QINPOS {
  1352. size 1
  1353. }
  1354. QINPOS {
  1355. size 1
  1356. }
  1357. QOUTPOS {
  1358. size 1
  1359. }
  1360. /*
  1361. * Kernel and sequencer offsets into the queue of
  1362. * incoming target mode command descriptors. The
  1363. * queue is full when the KERNEL_TQINPOS == TQINPOS.
  1364. */
  1365. KERNEL_TQINPOS {
  1366. size 1
  1367. }
  1368. TQINPOS {
  1369. size 1
  1370. }
  1371. ARG_1 {
  1372. size 1
  1373. count 1
  1374. mask SEND_MSG 0x80
  1375. mask SEND_SENSE 0x40
  1376. mask SEND_REJ 0x20
  1377. mask MSGOUT_PHASEMIS 0x10
  1378. mask EXIT_MSG_LOOP 0x08
  1379. mask CONT_MSG_LOOP 0x04
  1380. mask CONT_TARG_SESSION 0x02
  1381. alias RETURN_1
  1382. }
  1383. ARG_2 {
  1384. size 1
  1385. alias RETURN_2
  1386. }
  1387. /*
  1388. * Snapshot of MSG_OUT taken after each message is sent.
  1389. */
  1390. LAST_MSG {
  1391. size 1
  1392. alias TARG_IMMEDIATE_SCB
  1393. }
  1394. /*
  1395. * Sequences the kernel driver has okayed for us. This allows
  1396. * the driver to do things like prevent initiator or target
  1397. * operations.
  1398. */
  1399. SCSISEQ_TEMPLATE {
  1400. size 1
  1401. field ENSELO 0x40
  1402. field ENSELI 0x20
  1403. field ENRSELI 0x10
  1404. field ENAUTOATNO 0x08
  1405. field ENAUTOATNI 0x04
  1406. field ENAUTOATNP 0x02
  1407. }
  1408. }
  1409. scratch_ram {
  1410. address 0x056
  1411. size 4
  1412. /*
  1413. * These scratch ram locations are initialized by the 274X BIOS.
  1414. * We reuse them after capturing the BIOS settings during
  1415. * initialization.
  1416. */
  1417. /*
  1418. * The initiator specified tag for this target mode transaction.
  1419. */
  1420. HA_274_BIOSGLOBAL {
  1421. size 1
  1422. field HA_274_EXTENDED_TRANS 0x01
  1423. alias INITIATOR_TAG
  1424. count 1
  1425. }
  1426. SEQ_FLAGS2 {
  1427. size 1
  1428. field SCB_DMA 0x01
  1429. field TARGET_MSG_PENDING 0x02
  1430. }
  1431. }
  1432. scratch_ram {
  1433. address 0x05a
  1434. size 6
  1435. /*
  1436. * These are reserved registers in the card's scratch ram on the 2742.
  1437. * The EISA configuraiton chip is mapped here. On Rev E. of the
  1438. * aic7770, the sequencer can use this area for scratch, but the
  1439. * host cannot directly access these registers. On later chips, this
  1440. * area can be read and written by both the host and the sequencer.
  1441. * Even on later chips, many of these locations are initialized by
  1442. * the BIOS.
  1443. */
  1444. SCSICONF {
  1445. size 1
  1446. count 12
  1447. field TERM_ENB 0x80
  1448. field RESET_SCSI 0x40
  1449. field ENSPCHK 0x20
  1450. mask HSCSIID 0x07 /* our SCSI ID */
  1451. mask HWSCSIID 0x0f /* our SCSI ID if Wide Bus */
  1452. }
  1453. INTDEF {
  1454. address 0x05c
  1455. size 1
  1456. count 1
  1457. field EDGE_TRIG 0x80
  1458. mask VECTOR 0x0f
  1459. }
  1460. HOSTCONF {
  1461. address 0x05d
  1462. size 1
  1463. count 1
  1464. }
  1465. HA_274_BIOSCTRL {
  1466. address 0x05f
  1467. size 1
  1468. count 1
  1469. mask BIOSMODE 0x30
  1470. mask BIOSDISABLED 0x30
  1471. field CHANNEL_B_PRIMARY 0x08
  1472. }
  1473. }
  1474. scratch_ram {
  1475. address 0x070
  1476. size 16
  1477. /*
  1478. * Per target SCSI offset values for Ultra2 controllers.
  1479. */
  1480. TARG_OFFSET {
  1481. size 16
  1482. count 1
  1483. }
  1484. }
  1485. const TID_SHIFT 4
  1486. const SCB_LIST_NULL 0xff
  1487. const TARGET_CMD_CMPLT 0xfe
  1488. const CCSGADDR_MAX 0x80
  1489. const CCSGRAM_MAXSEGS 16
  1490. /* WDTR Message values */
  1491. const BUS_8_BIT 0x00
  1492. const BUS_16_BIT 0x01
  1493. const BUS_32_BIT 0x02
  1494. /* Offset maximums */
  1495. const MAX_OFFSET_8BIT 0x0f
  1496. const MAX_OFFSET_16BIT 0x08
  1497. const MAX_OFFSET_ULTRA2 0x7f
  1498. const MAX_OFFSET 0x7f
  1499. const HOST_MSG 0xff
  1500. /* Target mode command processing constants */
  1501. const CMD_GROUP_CODE_SHIFT 0x05
  1502. const STATUS_BUSY 0x08
  1503. const STATUS_QUEUE_FULL 0x28
  1504. const TARGET_DATA_IN 1
  1505. /*
  1506. * Downloaded (kernel inserted) constants
  1507. */
  1508. /* Offsets into the SCBID array where different data is stored */
  1509. const QOUTFIFO_OFFSET download
  1510. const QINFIFO_OFFSET download
  1511. const CACHESIZE_MASK download
  1512. const INVERTED_CACHESIZE_MASK download
  1513. const SG_PREFETCH_CNT download
  1514. const SG_PREFETCH_ALIGN_MASK download
  1515. const SG_PREFETCH_ADDR_MASK download