aic7xxx.reg 34 KB

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