aic7xxx.reg 37 KB

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