aic7xxx.reg 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761
  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