xref: /linux/drivers/scsi/aic7xxx/aic7xxx.reg (revision ec0a95ab)
11da177e4SLinus Torvalds/*
21da177e4SLinus Torvalds * Aic7xxx register and scratch ram definitions.
31da177e4SLinus Torvalds *
41da177e4SLinus Torvalds * Copyright (c) 1994-2001 Justin T. Gibbs.
51da177e4SLinus Torvalds * Copyright (c) 2000-2001 Adaptec Inc.
61da177e4SLinus Torvalds * All rights reserved.
71da177e4SLinus Torvalds *
81da177e4SLinus Torvalds * Redistribution and use in source and binary forms, with or without
91da177e4SLinus Torvalds * modification, are permitted provided that the following conditions
101da177e4SLinus Torvalds * are met:
111da177e4SLinus Torvalds * 1. Redistributions of source code must retain the above copyright
121da177e4SLinus Torvalds *    notice, this list of conditions, and the following disclaimer,
131da177e4SLinus Torvalds *    without modification.
141da177e4SLinus Torvalds * 2. Redistributions in binary form must reproduce at minimum a disclaimer
151da177e4SLinus Torvalds *    substantially similar to the "NO WARRANTY" disclaimer below
161da177e4SLinus Torvalds *    ("Disclaimer") and any redistribution must be conditioned upon
171da177e4SLinus Torvalds *    including a substantially similar Disclaimer requirement for further
181da177e4SLinus Torvalds *    binary redistribution.
191da177e4SLinus Torvalds * 3. Neither the names of the above-listed copyright holders nor the names
201da177e4SLinus Torvalds *    of any contributors may be used to endorse or promote products derived
211da177e4SLinus Torvalds *    from this software without specific prior written permission.
221da177e4SLinus Torvalds *
231da177e4SLinus Torvalds * Alternatively, this software may be distributed under the terms of the
241da177e4SLinus Torvalds * GNU General Public License ("GPL") version 2 as published by the Free
251da177e4SLinus Torvalds * Software Foundation.
261da177e4SLinus Torvalds *
271da177e4SLinus Torvalds * NO WARRANTY
281da177e4SLinus Torvalds * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
291da177e4SLinus Torvalds * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
301da177e4SLinus Torvalds * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
311da177e4SLinus Torvalds * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
321da177e4SLinus Torvalds * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331da177e4SLinus Torvalds * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341da177e4SLinus Torvalds * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351da177e4SLinus Torvalds * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
361da177e4SLinus Torvalds * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
371da177e4SLinus Torvalds * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
381da177e4SLinus Torvalds * POSSIBILITY OF SUCH DAMAGES.
391da177e4SLinus Torvalds *
401da177e4SLinus Torvalds * $FreeBSD$
411da177e4SLinus Torvalds */
4279778a27SJames BottomleyVERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $"
431da177e4SLinus Torvalds
441da177e4SLinus Torvalds/*
451da177e4SLinus Torvalds * This file is processed by the aic7xxx_asm utility for use in assembling
461da177e4SLinus Torvalds * firmware for the aic7xxx family of SCSI host adapters as well as to generate
471da177e4SLinus Torvalds * a C header file for use in the kernel portion of the Aic7xxx driver.
481da177e4SLinus Torvalds *
491da177e4SLinus Torvalds * All page numbers refer to the Adaptec AIC-7770 Data Book available from
501da177e4SLinus Torvalds * Adaptec's Technical Documents Department 1-800-934-2766
511da177e4SLinus Torvalds */
521da177e4SLinus Torvalds
531da177e4SLinus Torvalds/*
547b61ab89SDenys Vlasenko * Registers marked "dont_generate_debug_code" are not (yet) referenced
557b61ab89SDenys Vlasenko * from the driver code, and this keyword inhibit generation
567b61ab89SDenys Vlasenko * of debug code for them.
577b61ab89SDenys Vlasenko *
587b61ab89SDenys Vlasenko * REG_PRETTY_PRINT config will complain if dont_generate_debug_code
597b61ab89SDenys Vlasenko * is added to the register which is referenced in the driver.
607b61ab89SDenys Vlasenko * Unreferenced register with no dont_generate_debug_code will result
617b61ab89SDenys Vlasenko * in dead code. No warning is issued.
627b61ab89SDenys Vlasenko */
637b61ab89SDenys Vlasenko
647b61ab89SDenys Vlasenko/*
651da177e4SLinus Torvalds * SCSI Sequence Control (p. 3-11).
661da177e4SLinus Torvalds * Each bit, when set starts a specific SCSI sequence on the bus
671da177e4SLinus Torvalds */
681da177e4SLinus Torvaldsregister SCSISEQ {
691da177e4SLinus Torvalds	address			0x000
701da177e4SLinus Torvalds	access_mode RW
711da177e4SLinus Torvalds	field	TEMODE		0x80
721da177e4SLinus Torvalds	field	ENSELO		0x40
731da177e4SLinus Torvalds	field	ENSELI		0x20
741da177e4SLinus Torvalds	field	ENRSELI		0x10
751da177e4SLinus Torvalds	field	ENAUTOATNO	0x08
761da177e4SLinus Torvalds	field	ENAUTOATNI	0x04
771da177e4SLinus Torvalds	field	ENAUTOATNP	0x02
781da177e4SLinus Torvalds	field	SCSIRSTO	0x01
791da177e4SLinus Torvalds}
801da177e4SLinus Torvalds
811da177e4SLinus Torvalds/*
821da177e4SLinus Torvalds * SCSI Transfer Control 0 Register (pp. 3-13).
831da177e4SLinus Torvalds * Controls the SCSI module data path.
841da177e4SLinus Torvalds */
851da177e4SLinus Torvaldsregister SXFRCTL0 {
861da177e4SLinus Torvalds	address			0x001
871da177e4SLinus Torvalds	access_mode RW
881da177e4SLinus Torvalds	field	DFON		0x80
891da177e4SLinus Torvalds	field	DFPEXP		0x40
901da177e4SLinus Torvalds	field	FAST20		0x20
911da177e4SLinus Torvalds	field	CLRSTCNT	0x10
921da177e4SLinus Torvalds	field	SPIOEN		0x08
931da177e4SLinus Torvalds	field	SCAMEN		0x04
941da177e4SLinus Torvalds	field	CLRCHN		0x02
951da177e4SLinus Torvalds}
961da177e4SLinus Torvalds
971da177e4SLinus Torvalds/*
981da177e4SLinus Torvalds * SCSI Transfer Control 1 Register (pp. 3-14,15).
991da177e4SLinus Torvalds * Controls the SCSI module data path.
1001da177e4SLinus Torvalds */
1011da177e4SLinus Torvaldsregister SXFRCTL1 {
1021da177e4SLinus Torvalds	address			0x002
1031da177e4SLinus Torvalds	access_mode RW
1041da177e4SLinus Torvalds	field	BITBUCKET	0x80
1051da177e4SLinus Torvalds	field	SWRAPEN		0x40
1061da177e4SLinus Torvalds	field	ENSPCHK		0x20
1071da177e4SLinus Torvalds	mask	STIMESEL	0x18
1081da177e4SLinus Torvalds	field	ENSTIMER	0x04
1091da177e4SLinus Torvalds	field	ACTNEGEN	0x02
1101da177e4SLinus Torvalds	field	STPWEN		0x01	/* Powered Termination */
1117b61ab89SDenys Vlasenko	dont_generate_debug_code
1121da177e4SLinus Torvalds}
1131da177e4SLinus Torvalds
1141da177e4SLinus Torvalds/*
1151da177e4SLinus Torvalds * SCSI Control Signal Read Register (p. 3-15).
1161da177e4SLinus Torvalds * Reads the actual state of the SCSI bus pins
1171da177e4SLinus Torvalds */
1181da177e4SLinus Torvaldsregister SCSISIGI {
1191da177e4SLinus Torvalds	address			0x003
1201da177e4SLinus Torvalds	access_mode RO
1211da177e4SLinus Torvalds	field	CDI		0x80
1221da177e4SLinus Torvalds	field	IOI		0x40
1231da177e4SLinus Torvalds	field	MSGI		0x20
1241da177e4SLinus Torvalds	field	ATNI		0x10
1251da177e4SLinus Torvalds	field	SELI		0x08
1261da177e4SLinus Torvalds	field	BSYI		0x04
1271da177e4SLinus Torvalds	field	REQI		0x02
1281da177e4SLinus Torvalds	field	ACKI		0x01
1291da177e4SLinus Torvalds/*
1301da177e4SLinus Torvalds * Possible phases in SCSISIGI
1311da177e4SLinus Torvalds */
1321da177e4SLinus Torvalds	mask	PHASE_MASK	CDI|IOI|MSGI
1331da177e4SLinus Torvalds	mask	P_DATAOUT	0x00
1341da177e4SLinus Torvalds	mask	P_DATAIN	IOI
1351da177e4SLinus Torvalds	mask	P_DATAOUT_DT	P_DATAOUT|MSGI
1361da177e4SLinus Torvalds	mask	P_DATAIN_DT	P_DATAIN|MSGI
1371da177e4SLinus Torvalds	mask	P_COMMAND	CDI
1381da177e4SLinus Torvalds	mask	P_MESGOUT	CDI|MSGI
1391da177e4SLinus Torvalds	mask	P_STATUS	CDI|IOI
1401da177e4SLinus Torvalds	mask	P_MESGIN	CDI|IOI|MSGI
1411da177e4SLinus Torvalds}
1421da177e4SLinus Torvalds
1431da177e4SLinus Torvalds/*
1441da177e4SLinus Torvalds * SCSI Control Signal Write Register (p. 3-16).
1451da177e4SLinus Torvalds * Writing to this register modifies the control signals on the bus.  Only
1461da177e4SLinus Torvalds * those signals that are allowed in the current mode (Initiator/Target) are
1471da177e4SLinus Torvalds * asserted.
1481da177e4SLinus Torvalds */
1491da177e4SLinus Torvaldsregister SCSISIGO {
1501da177e4SLinus Torvalds	address			0x003
1511da177e4SLinus Torvalds	access_mode WO
1521da177e4SLinus Torvalds	field	CDO		0x80
1531da177e4SLinus Torvalds	field	IOO		0x40
1541da177e4SLinus Torvalds	field	MSGO		0x20
1551da177e4SLinus Torvalds	field	ATNO		0x10
1561da177e4SLinus Torvalds	field	SELO		0x08
1571da177e4SLinus Torvalds	field	BSYO		0x04
1581da177e4SLinus Torvalds	field	REQO		0x02
1591da177e4SLinus Torvalds	field	ACKO		0x01
1601da177e4SLinus Torvalds/*
1611da177e4SLinus Torvalds * Possible phases to write into SCSISIG0
1621da177e4SLinus Torvalds */
1631da177e4SLinus Torvalds	mask	PHASE_MASK	CDI|IOI|MSGI
1641da177e4SLinus Torvalds	mask	P_DATAOUT	0x00
1651da177e4SLinus Torvalds	mask	P_DATAIN	IOI
1661da177e4SLinus Torvalds	mask	P_COMMAND	CDI
1671da177e4SLinus Torvalds	mask	P_MESGOUT	CDI|MSGI
1681da177e4SLinus Torvalds	mask	P_STATUS	CDI|IOI
1691da177e4SLinus Torvalds	mask	P_MESGIN	CDI|IOI|MSGI
1707b61ab89SDenys Vlasenko	dont_generate_debug_code
1711da177e4SLinus Torvalds}
1721da177e4SLinus Torvalds
1731da177e4SLinus Torvalds/*
1741da177e4SLinus Torvalds * SCSI Rate Control (p. 3-17).
1751da177e4SLinus Torvalds * Contents of this register determine the Synchronous SCSI data transfer
1761da177e4SLinus Torvalds * rate and the maximum synchronous Req/Ack offset.  An offset of 0 in the
1771da177e4SLinus Torvalds * SOFS (3:0) bits disables synchronous data transfers.  Any offset value
1781da177e4SLinus Torvalds * greater than 0 enables synchronous transfers.
1791da177e4SLinus Torvalds */
1801da177e4SLinus Torvaldsregister SCSIRATE {
1811da177e4SLinus Torvalds	address			0x004
1821da177e4SLinus Torvalds	access_mode RW
1831da177e4SLinus Torvalds	field	WIDEXFER	0x80		/* Wide transfer control */
1841da177e4SLinus Torvalds	field	ENABLE_CRC	0x40		/* CRC for D-Phases */
1851da177e4SLinus Torvalds	field	SINGLE_EDGE	0x10		/* Disable DT Transfers */
1861da177e4SLinus Torvalds	mask	SXFR		0x70		/* Sync transfer rate */
1871da177e4SLinus Torvalds	mask	SXFR_ULTRA2	0x0f		/* Sync transfer rate */
1881da177e4SLinus Torvalds	mask	SOFS		0x0f		/* Sync offset */
1891da177e4SLinus Torvalds}
1901da177e4SLinus Torvalds
1911da177e4SLinus Torvalds/*
1921da177e4SLinus Torvalds * SCSI ID (p. 3-18).
1931da177e4SLinus Torvalds * Contains the ID of the board and the current target on the
1941da177e4SLinus Torvalds * selected channel.
1951da177e4SLinus Torvalds */
1961da177e4SLinus Torvaldsregister SCSIID	{
1971da177e4SLinus Torvalds	address			0x005
1981da177e4SLinus Torvalds	access_mode RW
1991da177e4SLinus Torvalds	mask	TID		0xf0		/* Target ID mask */
2001da177e4SLinus Torvalds	mask	TWIN_TID	0x70
2011da177e4SLinus Torvalds	field	TWIN_CHNLB	0x80
2021da177e4SLinus Torvalds	mask	OID		0x0f		/* Our ID mask */
2031da177e4SLinus Torvalds	/*
2041da177e4SLinus Torvalds	 * SCSI Maximum Offset (p. 4-61 aic7890/91 Data Book)
2051da177e4SLinus Torvalds	 * The aic7890/91 allow an offset of up to 127 transfers in both wide
2061da177e4SLinus Torvalds	 * and narrow mode.
2071da177e4SLinus Torvalds	 */
2081da177e4SLinus Torvalds	alias	SCSIOFFSET
2091da177e4SLinus Torvalds	mask	SOFS_ULTRA2	0x7f		/* Sync offset U2 chips */
2107b61ab89SDenys Vlasenko	dont_generate_debug_code
2111da177e4SLinus Torvalds}
2121da177e4SLinus Torvalds
2131da177e4SLinus Torvalds/*
2141da177e4SLinus Torvalds * SCSI Latched Data (p. 3-19).
2151da177e4SLinus Torvalds * Read/Write latches used to transfer data on the SCSI bus during
2161da177e4SLinus Torvalds * Automatic or Manual PIO mode.  SCSIDATH can be used for the
2171da177e4SLinus Torvalds * upper byte of a 16bit wide asynchronouse data phase transfer.
2181da177e4SLinus Torvalds */
2191da177e4SLinus Torvaldsregister SCSIDATL {
2201da177e4SLinus Torvalds	address			0x006
2211da177e4SLinus Torvalds	access_mode RW
2227b61ab89SDenys Vlasenko	dont_generate_debug_code
2231da177e4SLinus Torvalds}
2241da177e4SLinus Torvalds
2251da177e4SLinus Torvaldsregister SCSIDATH {
2261da177e4SLinus Torvalds	address			0x007
2271da177e4SLinus Torvalds	access_mode RW
2281da177e4SLinus Torvalds}
2291da177e4SLinus Torvalds
2301da177e4SLinus Torvalds/*
2311da177e4SLinus Torvalds * SCSI Transfer Count (pp. 3-19,20)
2321da177e4SLinus Torvalds * These registers count down the number of bytes transferred
2331da177e4SLinus Torvalds * across the SCSI bus.  The counter is decremented only once
2341da177e4SLinus Torvalds * the data has been safely transferred.  SDONE in SSTAT0 is
2351da177e4SLinus Torvalds * set when STCNT goes to 0
2361da177e4SLinus Torvalds */
2371da177e4SLinus Torvaldsregister STCNT {
2381da177e4SLinus Torvalds	address			0x008
2391da177e4SLinus Torvalds	size	3
2401da177e4SLinus Torvalds	access_mode RW
2417b61ab89SDenys Vlasenko	dont_generate_debug_code
2421da177e4SLinus Torvalds}
2431da177e4SLinus Torvalds
2441da177e4SLinus Torvalds/* ALT_MODE registers (Ultra2 and Ultra160 chips) */
2451da177e4SLinus Torvaldsregister SXFRCTL2 {
2461da177e4SLinus Torvalds	address			0x013
2471da177e4SLinus Torvalds	access_mode RW
2481da177e4SLinus Torvalds	field	AUTORSTDIS	0x10
2491da177e4SLinus Torvalds	field	CMDDMAEN	0x08
2501da177e4SLinus Torvalds	mask	ASYNC_SETUP	0x07
2511da177e4SLinus Torvalds}
2521da177e4SLinus Torvalds
2531da177e4SLinus Torvalds/* ALT_MODE register on Ultra160 chips */
2541da177e4SLinus Torvaldsregister OPTIONMODE {
2551da177e4SLinus Torvalds	address			0x008
2561da177e4SLinus Torvalds	access_mode RW
2573dbd10f3SHannes Reinecke	count		2
2581da177e4SLinus Torvalds	field	AUTORATEEN		0x80
2591da177e4SLinus Torvalds	field	AUTOACKEN		0x40
2601da177e4SLinus Torvalds	field	ATNMGMNTEN		0x20
2611da177e4SLinus Torvalds	field	BUSFREEREV		0x10
2621da177e4SLinus Torvalds	field	EXPPHASEDIS		0x08
2631da177e4SLinus Torvalds	field	SCSIDATL_IMGEN		0x04
2641da177e4SLinus Torvalds	field	AUTO_MSGOUT_DE		0x02
2651da177e4SLinus Torvalds	field	DIS_MSGIN_DUALEDGE	0x01
2661da177e4SLinus Torvalds	mask	OPTIONMODE_DEFAULTS	AUTO_MSGOUT_DE|DIS_MSGIN_DUALEDGE
2677b61ab89SDenys Vlasenko	dont_generate_debug_code
2681da177e4SLinus Torvalds}
2691da177e4SLinus Torvalds
2701da177e4SLinus Torvalds/* ALT_MODE register on Ultra160 chips */
2711da177e4SLinus Torvaldsregister TARGCRCCNT {
2721da177e4SLinus Torvalds	address			0x00a
2731da177e4SLinus Torvalds	size	2
2741da177e4SLinus Torvalds	access_mode RW
2753dbd10f3SHannes Reinecke	count		2
2767b61ab89SDenys Vlasenko	dont_generate_debug_code
2771da177e4SLinus Torvalds}
2781da177e4SLinus Torvalds
2791da177e4SLinus Torvalds/*
2801da177e4SLinus Torvalds * Clear SCSI Interrupt 0 (p. 3-20)
2811da177e4SLinus Torvalds * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT0.
2821da177e4SLinus Torvalds */
2831da177e4SLinus Torvaldsregister CLRSINT0 {
2841da177e4SLinus Torvalds	address			0x00b
2851da177e4SLinus Torvalds	access_mode WO
2861da177e4SLinus Torvalds	field	CLRSELDO	0x40
2871da177e4SLinus Torvalds	field	CLRSELDI	0x20
2881da177e4SLinus Torvalds	field	CLRSELINGO	0x10
2891da177e4SLinus Torvalds	field	CLRSWRAP	0x08
2901da177e4SLinus Torvalds	field	CLRIOERR	0x08	/* Ultra2 Only */
2911da177e4SLinus Torvalds	field	CLRSPIORDY	0x02
2927b61ab89SDenys Vlasenko	dont_generate_debug_code
2931da177e4SLinus Torvalds}
2941da177e4SLinus Torvalds
2951da177e4SLinus Torvalds/*
2961da177e4SLinus Torvalds * SCSI Status 0 (p. 3-21)
2971da177e4SLinus Torvalds * Contains one set of SCSI Interrupt codes
2981da177e4SLinus Torvalds * These are most likely of interest to the sequencer
2991da177e4SLinus Torvalds */
3001da177e4SLinus Torvaldsregister SSTAT0	{
3011da177e4SLinus Torvalds	address			0x00b
3021da177e4SLinus Torvalds	access_mode RO
3031da177e4SLinus Torvalds	field	TARGET		0x80	/* Board acting as target */
3041da177e4SLinus Torvalds	field	SELDO		0x40	/* Selection Done */
3051da177e4SLinus Torvalds	field	SELDI		0x20	/* Board has been selected */
3061da177e4SLinus Torvalds	field	SELINGO		0x10	/* Selection In Progress */
3071da177e4SLinus Torvalds	field	SWRAP		0x08	/* 24bit counter wrap */
3081da177e4SLinus Torvalds	field	IOERR		0x08	/* LVD Tranceiver mode changed */
3091da177e4SLinus Torvalds	field	SDONE		0x04	/* STCNT = 0x000000 */
3101da177e4SLinus Torvalds	field	SPIORDY		0x02	/* SCSI PIO Ready */
3111da177e4SLinus Torvalds	field	DMADONE		0x01	/* DMA transfer completed */
3121da177e4SLinus Torvalds}
3131da177e4SLinus Torvalds
3141da177e4SLinus Torvalds/*
3151da177e4SLinus Torvalds * Clear SCSI Interrupt 1 (p. 3-23)
3161da177e4SLinus Torvalds * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1.
3171da177e4SLinus Torvalds */
3181da177e4SLinus Torvaldsregister CLRSINT1 {
3191da177e4SLinus Torvalds	address			0x00c
3201da177e4SLinus Torvalds	access_mode WO
3211da177e4SLinus Torvalds	field	CLRSELTIMEO	0x80
3221da177e4SLinus Torvalds	field	CLRATNO		0x40
3231da177e4SLinus Torvalds	field	CLRSCSIRSTI	0x20
3241da177e4SLinus Torvalds	field	CLRBUSFREE	0x08
3251da177e4SLinus Torvalds	field	CLRSCSIPERR	0x04
3261da177e4SLinus Torvalds	field	CLRPHASECHG	0x02
3271da177e4SLinus Torvalds	field	CLRREQINIT	0x01
3287b61ab89SDenys Vlasenko	dont_generate_debug_code
3291da177e4SLinus Torvalds}
3301da177e4SLinus Torvalds
3311da177e4SLinus Torvalds/*
3321da177e4SLinus Torvalds * SCSI Status 1 (p. 3-24)
3331da177e4SLinus Torvalds */
3341da177e4SLinus Torvaldsregister SSTAT1	{
3351da177e4SLinus Torvalds	address			0x00c
3361da177e4SLinus Torvalds	access_mode RO
3371da177e4SLinus Torvalds	field	SELTO		0x80
3381da177e4SLinus Torvalds	field	ATNTARG 	0x40
3391da177e4SLinus Torvalds	field	SCSIRSTI	0x20
3401da177e4SLinus Torvalds	field	PHASEMIS	0x10
3411da177e4SLinus Torvalds	field	BUSFREE		0x08
3421da177e4SLinus Torvalds	field	SCSIPERR	0x04
3431da177e4SLinus Torvalds	field	PHASECHG	0x02
3441da177e4SLinus Torvalds	field	REQINIT		0x01
3451da177e4SLinus Torvalds}
3461da177e4SLinus Torvalds
3471da177e4SLinus Torvalds/*
3481da177e4SLinus Torvalds * SCSI Status 2 (pp. 3-25,26)
3491da177e4SLinus Torvalds */
3501da177e4SLinus Torvaldsregister SSTAT2 {
3511da177e4SLinus Torvalds	address			0x00d
3521da177e4SLinus Torvalds	access_mode RO
3531da177e4SLinus Torvalds	field	OVERRUN		0x80
35425985edcSLucas De Marchi	field	SHVALID		0x40	/* Shadow Layer non-zero */
3551da177e4SLinus Torvalds	field	EXP_ACTIVE	0x10	/* SCSI Expander Active */
3561da177e4SLinus Torvalds	field	CRCVALERR	0x08	/* CRC doesn't match (U3 only) */
3571da177e4SLinus Torvalds	field	CRCENDERR	0x04	/* No terminal CRC packet (U3 only) */
3581da177e4SLinus Torvalds	field	CRCREQERR	0x02	/* Illegal CRC packet req (U3 only) */
3591da177e4SLinus Torvalds	field	DUAL_EDGE_ERR	0x01	/* Incorrect data phase (U3 only) */
3601da177e4SLinus Torvalds	mask	SFCNT		0x1f
3611da177e4SLinus Torvalds}
3621da177e4SLinus Torvalds
3631da177e4SLinus Torvalds/*
3641da177e4SLinus Torvalds * SCSI Status 3 (p. 3-26)
3651da177e4SLinus Torvalds */
3661da177e4SLinus Torvaldsregister SSTAT3 {
3671da177e4SLinus Torvalds	address			0x00e
3681da177e4SLinus Torvalds	access_mode RO
3693dbd10f3SHannes Reinecke	count		2
3701da177e4SLinus Torvalds	mask	SCSICNT		0xf0
3711da177e4SLinus Torvalds	mask	OFFCNT		0x0f
3721da177e4SLinus Torvalds	mask	U2OFFCNT	0x7f
3731da177e4SLinus Torvalds}
3741da177e4SLinus Torvalds
3751da177e4SLinus Torvalds/*
3761da177e4SLinus Torvalds * SCSI ID for the aic7890/91 chips
3771da177e4SLinus Torvalds */
3781da177e4SLinus Torvaldsregister SCSIID_ULTRA2 {
3791da177e4SLinus Torvalds	address			0x00f
3801da177e4SLinus Torvalds	access_mode RW
3811da177e4SLinus Torvalds	mask	TID		0xf0		/* Target ID mask */
3821da177e4SLinus Torvalds	mask	OID		0x0f		/* Our ID mask */
3837b61ab89SDenys Vlasenko	dont_generate_debug_code
3841da177e4SLinus Torvalds}
3851da177e4SLinus Torvalds
3861da177e4SLinus Torvalds/*
3871da177e4SLinus Torvalds * SCSI Interrupt Mode 1 (p. 3-28)
3881da177e4SLinus Torvalds * Setting any bit will enable the corresponding function
3891da177e4SLinus Torvalds * in SIMODE0 to interrupt via the IRQ pin.
3901da177e4SLinus Torvalds */
3911da177e4SLinus Torvaldsregister SIMODE0 {
3921da177e4SLinus Torvalds	address			0x010
3931da177e4SLinus Torvalds	access_mode RW
3943dbd10f3SHannes Reinecke	count		2
3951da177e4SLinus Torvalds	field	ENSELDO		0x40
3961da177e4SLinus Torvalds	field	ENSELDI		0x20
3971da177e4SLinus Torvalds	field	ENSELINGO	0x10
3981da177e4SLinus Torvalds	field	ENSWRAP		0x08
3991da177e4SLinus Torvalds	field	ENIOERR		0x08	/* LVD Tranceiver mode changes */
4001da177e4SLinus Torvalds	field	ENSDONE		0x04
4011da177e4SLinus Torvalds	field	ENSPIORDY	0x02
4021da177e4SLinus Torvalds	field	ENDMADONE	0x01
4031da177e4SLinus Torvalds}
4041da177e4SLinus Torvalds
4051da177e4SLinus Torvalds/*
4061da177e4SLinus Torvalds * SCSI Interrupt Mode 1 (pp. 3-28,29)
4071da177e4SLinus Torvalds * Setting any bit will enable the corresponding function
4081da177e4SLinus Torvalds * in SIMODE1 to interrupt via the IRQ pin.
4091da177e4SLinus Torvalds */
4101da177e4SLinus Torvaldsregister SIMODE1 {
4111da177e4SLinus Torvalds	address			0x011
4121da177e4SLinus Torvalds	access_mode RW
4131da177e4SLinus Torvalds	field	ENSELTIMO	0x80
4141da177e4SLinus Torvalds	field	ENATNTARG	0x40
4151da177e4SLinus Torvalds	field	ENSCSIRST	0x20
4161da177e4SLinus Torvalds	field	ENPHASEMIS	0x10
4171da177e4SLinus Torvalds	field	ENBUSFREE	0x08
4181da177e4SLinus Torvalds	field	ENSCSIPERR	0x04
4191da177e4SLinus Torvalds	field	ENPHASECHG	0x02
4201da177e4SLinus Torvalds	field	ENREQINIT	0x01
4211da177e4SLinus Torvalds}
4221da177e4SLinus Torvalds
4231da177e4SLinus Torvalds/*
4241da177e4SLinus Torvalds * SCSI Data Bus (High) (p. 3-29)
4251da177e4SLinus Torvalds * This register reads data on the SCSI Data bus directly.
4261da177e4SLinus Torvalds */
4271da177e4SLinus Torvaldsregister SCSIBUSL {
4281da177e4SLinus Torvalds	address			0x012
4291da177e4SLinus Torvalds	access_mode RW
4301da177e4SLinus Torvalds}
4311da177e4SLinus Torvalds
4321da177e4SLinus Torvaldsregister SCSIBUSH {
4331da177e4SLinus Torvalds	address			0x013
4341da177e4SLinus Torvalds	access_mode RW
4351da177e4SLinus Torvalds}
4361da177e4SLinus Torvalds
4371da177e4SLinus Torvalds/*
4381da177e4SLinus Torvalds * SCSI/Host Address (p. 3-30)
4391da177e4SLinus Torvalds * These registers hold the host address for the byte about to be
4401da177e4SLinus Torvalds * transferred on the SCSI bus.  They are counted up in the same
4411da177e4SLinus Torvalds * manner as STCNT is counted down.  SHADDR should always be used
4421da177e4SLinus Torvalds * to determine the address of the last byte transferred since HADDR
4431da177e4SLinus Torvalds * can be skewed by write ahead.
4441da177e4SLinus Torvalds */
4451da177e4SLinus Torvaldsregister SHADDR {
4461da177e4SLinus Torvalds	address			0x014
4471da177e4SLinus Torvalds	size	4
4481da177e4SLinus Torvalds	access_mode RO
4497b61ab89SDenys Vlasenko	dont_generate_debug_code
4501da177e4SLinus Torvalds}
4511da177e4SLinus Torvalds
4521da177e4SLinus Torvalds/*
4531da177e4SLinus Torvalds * Selection Timeout Timer (p. 3-30)
4541da177e4SLinus Torvalds */
4551da177e4SLinus Torvaldsregister SELTIMER {
4561da177e4SLinus Torvalds	address			0x018
4571da177e4SLinus Torvalds	access_mode RW
4583dbd10f3SHannes Reinecke	count		1
4591da177e4SLinus Torvalds	field	STAGE6		0x20
4601da177e4SLinus Torvalds	field	STAGE5		0x10
4611da177e4SLinus Torvalds	field	STAGE4		0x08
4621da177e4SLinus Torvalds	field	STAGE3		0x04
4631da177e4SLinus Torvalds	field	STAGE2		0x02
4641da177e4SLinus Torvalds	field	STAGE1		0x01
4651da177e4SLinus Torvalds	alias	TARGIDIN
4667b61ab89SDenys Vlasenko	dont_generate_debug_code
4671da177e4SLinus Torvalds}
4681da177e4SLinus Torvalds
4691da177e4SLinus Torvalds/*
4701da177e4SLinus Torvalds * Selection/Reselection ID (p. 3-31)
4711da177e4SLinus Torvalds * Upper four bits are the device id.  The ONEBIT is set when the re/selecting
4721da177e4SLinus Torvalds * device did not set its own ID.
4731da177e4SLinus Torvalds */
4741da177e4SLinus Torvaldsregister SELID {
4751da177e4SLinus Torvalds	address			0x019
4761da177e4SLinus Torvalds	access_mode RW
4771da177e4SLinus Torvalds	mask	SELID_MASK	0xf0
4781da177e4SLinus Torvalds	field	ONEBIT		0x08
4797b61ab89SDenys Vlasenko	dont_generate_debug_code
4801da177e4SLinus Torvalds}
4811da177e4SLinus Torvalds
4821da177e4SLinus Torvaldsregister SCAMCTL {
4831da177e4SLinus Torvalds	address			0x01a
4841da177e4SLinus Torvalds	access_mode RW
4851da177e4SLinus Torvalds	field	ENSCAMSELO	0x80
4861da177e4SLinus Torvalds	field	CLRSCAMSELID	0x40
4871da177e4SLinus Torvalds	field	ALTSTIM		0x20
4881da177e4SLinus Torvalds	field	DFLTTID		0x10
4891da177e4SLinus Torvalds	mask	SCAMLVL		0x03
4901da177e4SLinus Torvalds}
4911da177e4SLinus Torvalds
4921da177e4SLinus Torvalds/*
4931da177e4SLinus Torvalds * Target Mode Selecting in ID bitmask (aic7890/91/96/97)
4941da177e4SLinus Torvalds */
4951da177e4SLinus Torvaldsregister TARGID {
4961da177e4SLinus Torvalds	address			0x01b
4971da177e4SLinus Torvalds	size			2
4981da177e4SLinus Torvalds	access_mode RW
4993dbd10f3SHannes Reinecke	count		14
5007b61ab89SDenys Vlasenko	dont_generate_debug_code
5011da177e4SLinus Torvalds}
5021da177e4SLinus Torvalds
5031da177e4SLinus Torvalds/*
5041da177e4SLinus Torvalds * Serial Port I/O Cabability register (p. 4-95 aic7860 Data Book)
5051da177e4SLinus Torvalds * Indicates if external logic has been attached to the chip to
5061da177e4SLinus Torvalds * perform the tasks of accessing a serial eeprom, testing termination
5071da177e4SLinus Torvalds * strength, and performing cable detection.  On the aic7860, most of
5081da177e4SLinus Torvalds * these features are handled on chip, but on the aic7855 an attached
5091da177e4SLinus Torvalds * aic3800 does the grunt work.
5101da177e4SLinus Torvalds */
5111da177e4SLinus Torvaldsregister SPIOCAP {
5121da177e4SLinus Torvalds	address			0x01b
5131da177e4SLinus Torvalds	access_mode RW
5143dbd10f3SHannes Reinecke	count		10
5151da177e4SLinus Torvalds	field	SOFT1		0x80
5161da177e4SLinus Torvalds	field	SOFT0		0x40
5171da177e4SLinus Torvalds	field	SOFTCMDEN	0x20
5181da177e4SLinus Torvalds	field	EXT_BRDCTL	0x10	/* External Board control */
5191da177e4SLinus Torvalds	field	SEEPROM		0x08	/* External serial eeprom logic */
5201da177e4SLinus Torvalds	field	EEPROM		0x04	/* Writable external BIOS ROM */
5211da177e4SLinus Torvalds	field	ROM		0x02	/* Logic for accessing external ROM */
5221da177e4SLinus Torvalds	field	SSPIOCPS	0x01	/* Termination and cable detection */
5237b61ab89SDenys Vlasenko	dont_generate_debug_code
5241da177e4SLinus Torvalds}
5251da177e4SLinus Torvalds
5261da177e4SLinus Torvaldsregister BRDCTL	{
5271da177e4SLinus Torvalds	address			0x01d
5283dbd10f3SHannes Reinecke	count		11
5291da177e4SLinus Torvalds	field	BRDDAT7		0x80
5301da177e4SLinus Torvalds	field	BRDDAT6		0x40
5311da177e4SLinus Torvalds	field	BRDDAT5		0x20
5321da177e4SLinus Torvalds	field	BRDSTB		0x10
5331da177e4SLinus Torvalds	field	BRDCS		0x08
5341da177e4SLinus Torvalds	field	BRDRW		0x04
5351da177e4SLinus Torvalds	field	BRDCTL1		0x02
5361da177e4SLinus Torvalds	field	BRDCTL0		0x01
5371da177e4SLinus Torvalds	/* 7890 Definitions */
5381da177e4SLinus Torvalds	field	BRDDAT4		0x10
5391da177e4SLinus Torvalds	field	BRDDAT3		0x08
5401da177e4SLinus Torvalds	field	BRDDAT2		0x04
5411da177e4SLinus Torvalds	field	BRDRW_ULTRA2	0x02
5421da177e4SLinus Torvalds	field	BRDSTB_ULTRA2	0x01
5437b61ab89SDenys Vlasenko	dont_generate_debug_code
5441da177e4SLinus Torvalds}
5451da177e4SLinus Torvalds
5461da177e4SLinus Torvalds/*
5471da177e4SLinus Torvalds * Serial EEPROM Control (p. 4-92 in 7870 Databook)
5481da177e4SLinus Torvalds * Controls the reading and writing of an external serial 1-bit
5491da177e4SLinus Torvalds * EEPROM Device.  In order to access the serial EEPROM, you must
5501da177e4SLinus Torvalds * first set the SEEMS bit that generates a request to the memory
5511da177e4SLinus Torvalds * port for access to the serial EEPROM device.  When the memory
5521da177e4SLinus Torvalds * port is not busy servicing another request, it reconfigures
5531da177e4SLinus Torvalds * to allow access to the serial EEPROM.  When this happens, SEERDY
5541da177e4SLinus Torvalds * gets set high to verify that the memory port access has been
5551da177e4SLinus Torvalds * granted.
5561da177e4SLinus Torvalds *
5571da177e4SLinus Torvalds * After successful arbitration for the memory port, the SEECS bit of
5581da177e4SLinus Torvalds * the SEECTL register is connected to the chip select.  The SEECK,
5591da177e4SLinus Torvalds * SEEDO, and SEEDI are connected to the clock, data out, and data in
5601da177e4SLinus Torvalds * lines respectively.  The SEERDY bit of SEECTL is useful in that it
5611da177e4SLinus Torvalds * gives us an 800 nsec timer.  After a write to the SEECTL register,
5621da177e4SLinus Torvalds * the SEERDY goes high 800 nsec later.  The one exception to this is
5631da177e4SLinus Torvalds * when we first request access to the memory port.  The SEERDY goes
5641da177e4SLinus Torvalds * high to signify that access has been granted and, for this case, has
5651da177e4SLinus Torvalds * no implied timing.
5661da177e4SLinus Torvalds *
5671da177e4SLinus Torvalds * See 93cx6.c for detailed information on the protocol necessary to
5681da177e4SLinus Torvalds * read the serial EEPROM.
5691da177e4SLinus Torvalds */
5701da177e4SLinus Torvaldsregister SEECTL {
5711da177e4SLinus Torvalds	address			0x01e
5723dbd10f3SHannes Reinecke	count		11
5731da177e4SLinus Torvalds	field	EXTARBACK	0x80
5741da177e4SLinus Torvalds	field	EXTARBREQ	0x40
5751da177e4SLinus Torvalds	field	SEEMS		0x20
5761da177e4SLinus Torvalds	field	SEERDY		0x10
5771da177e4SLinus Torvalds	field	SEECS		0x08
5781da177e4SLinus Torvalds	field	SEECK		0x04
5791da177e4SLinus Torvalds	field	SEEDO		0x02
5801da177e4SLinus Torvalds	field	SEEDI		0x01
5817b61ab89SDenys Vlasenko	dont_generate_debug_code
5821da177e4SLinus Torvalds}
5831da177e4SLinus Torvalds/*
5841da177e4SLinus Torvalds * SCSI Block Control (p. 3-32)
5851da177e4SLinus Torvalds * Controls Bus type and channel selection.  In a twin channel configuration
5861da177e4SLinus Torvalds * addresses 0x00-0x1e are gated to the appropriate channel based on this
5871da177e4SLinus Torvalds * register.  SELWIDE allows for the coexistence of 8bit and 16bit devices
5881da177e4SLinus Torvalds * on a wide bus.
5891da177e4SLinus Torvalds */
5901da177e4SLinus Torvaldsregister SBLKCTL {
5911da177e4SLinus Torvalds	address			0x01f
5921da177e4SLinus Torvalds	access_mode RW
5931da177e4SLinus Torvalds	field	DIAGLEDEN	0x80	/* Aic78X0 only */
5941da177e4SLinus Torvalds	field	DIAGLEDON	0x40	/* Aic78X0 only */
5951da177e4SLinus Torvalds	field	AUTOFLUSHDIS	0x20
5961da177e4SLinus Torvalds	field	SELBUSB		0x08
5971da177e4SLinus Torvalds	field	ENAB40		0x08	/* LVD transceiver active */
5981da177e4SLinus Torvalds	field	ENAB20		0x04	/* SE/HVD transceiver active */
5991da177e4SLinus Torvalds	field	SELWIDE		0x02
6001da177e4SLinus Torvalds	field	XCVR		0x01	/* External transceiver active */
6011da177e4SLinus Torvalds}
6021da177e4SLinus Torvalds
6031da177e4SLinus Torvalds/*
6041da177e4SLinus Torvalds * Sequencer Control (p. 3-33)
6051da177e4SLinus Torvalds * Error detection mode and speed configuration
6061da177e4SLinus Torvalds */
6071da177e4SLinus Torvaldsregister SEQCTL {
6081da177e4SLinus Torvalds	address			0x060
6091da177e4SLinus Torvalds	access_mode RW
6103dbd10f3SHannes Reinecke	count		15
6111da177e4SLinus Torvalds	field	PERRORDIS	0x80
6121da177e4SLinus Torvalds	field	PAUSEDIS	0x40
6131da177e4SLinus Torvalds	field	FAILDIS		0x20
6141da177e4SLinus Torvalds	field	FASTMODE	0x10
6151da177e4SLinus Torvalds	field	BRKADRINTEN	0x08
6161da177e4SLinus Torvalds	field	STEP		0x04
6171da177e4SLinus Torvalds	field	SEQRESET	0x02
6181da177e4SLinus Torvalds	field	LOADRAM		0x01
6191da177e4SLinus Torvalds}
6201da177e4SLinus Torvalds
6211da177e4SLinus Torvalds/*
6221da177e4SLinus Torvalds * Sequencer RAM Data (p. 3-34)
6231da177e4SLinus Torvalds * Single byte window into the Scratch Ram area starting at the address
6241da177e4SLinus Torvalds * specified by SEQADDR0 and SEQADDR1.  To write a full word, simply write
6251da177e4SLinus Torvalds * four bytes in succession.  The SEQADDRs will increment after the most
6261da177e4SLinus Torvalds * significant byte is written
6271da177e4SLinus Torvalds */
6281da177e4SLinus Torvaldsregister SEQRAM {
6291da177e4SLinus Torvalds	address			0x061
6301da177e4SLinus Torvalds	access_mode RW
6313dbd10f3SHannes Reinecke	count		2
6327b61ab89SDenys Vlasenko	dont_generate_debug_code
6331da177e4SLinus Torvalds}
6341da177e4SLinus Torvalds
6351da177e4SLinus Torvalds/*
6361da177e4SLinus Torvalds * Sequencer Address Registers (p. 3-35)
6371da177e4SLinus Torvalds * Only the first bit of SEQADDR1 holds addressing information
6381da177e4SLinus Torvalds */
6391da177e4SLinus Torvaldsregister SEQADDR0 {
6401da177e4SLinus Torvalds	address			0x062
6411da177e4SLinus Torvalds	access_mode RW
6427b61ab89SDenys Vlasenko	dont_generate_debug_code
6431da177e4SLinus Torvalds}
6441da177e4SLinus Torvalds
6451da177e4SLinus Torvaldsregister SEQADDR1 {
6461da177e4SLinus Torvalds	address			0x063
6471da177e4SLinus Torvalds	access_mode RW
6483dbd10f3SHannes Reinecke	count		8
6491da177e4SLinus Torvalds	mask	SEQADDR1_MASK	0x01
6507b61ab89SDenys Vlasenko	dont_generate_debug_code
6511da177e4SLinus Torvalds}
6521da177e4SLinus Torvalds
6531da177e4SLinus Torvalds/*
6541da177e4SLinus Torvalds * Accumulator
6551da177e4SLinus Torvalds * We cheat by passing arguments in the Accumulator up to the kernel driver
6561da177e4SLinus Torvalds */
6571da177e4SLinus Torvaldsregister ACCUM {
6581da177e4SLinus Torvalds	address			0x064
6591da177e4SLinus Torvalds	access_mode RW
6601da177e4SLinus Torvalds	accumulator
6617b61ab89SDenys Vlasenko	dont_generate_debug_code
6621da177e4SLinus Torvalds}
6631da177e4SLinus Torvalds
6641da177e4SLinus Torvaldsregister SINDEX	{
6651da177e4SLinus Torvalds	address			0x065
6661da177e4SLinus Torvalds	access_mode RW
6671da177e4SLinus Torvalds	sindex
6687b61ab89SDenys Vlasenko	dont_generate_debug_code
6691da177e4SLinus Torvalds}
6701da177e4SLinus Torvalds
6711da177e4SLinus Torvaldsregister DINDEX {
6721da177e4SLinus Torvalds	address			0x066
6731da177e4SLinus Torvalds	access_mode RW
6747b61ab89SDenys Vlasenko	dont_generate_debug_code
6751da177e4SLinus Torvalds}
6761da177e4SLinus Torvalds
6771da177e4SLinus Torvaldsregister ALLONES {
6781da177e4SLinus Torvalds	address			0x069
6791da177e4SLinus Torvalds	access_mode RO
6801da177e4SLinus Torvalds	allones
6817b61ab89SDenys Vlasenko	dont_generate_debug_code
6821da177e4SLinus Torvalds}
6831da177e4SLinus Torvalds
6841da177e4SLinus Torvaldsregister ALLZEROS {
6851da177e4SLinus Torvalds	address			0x06a
6861da177e4SLinus Torvalds	access_mode RO
6871da177e4SLinus Torvalds	allzeros
6887b61ab89SDenys Vlasenko	dont_generate_debug_code
6891da177e4SLinus Torvalds}
6901da177e4SLinus Torvalds
6911da177e4SLinus Torvaldsregister NONE {
6921da177e4SLinus Torvalds	address			0x06a
6931da177e4SLinus Torvalds	access_mode WO
6941da177e4SLinus Torvalds	none
6957b61ab89SDenys Vlasenko	dont_generate_debug_code
6961da177e4SLinus Torvalds}
6971da177e4SLinus Torvalds
6981da177e4SLinus Torvaldsregister FLAGS {
6991da177e4SLinus Torvalds	address			0x06b
7001da177e4SLinus Torvalds	access_mode RO
7013dbd10f3SHannes Reinecke	count		18
7021da177e4SLinus Torvalds	field	ZERO		0x02
7031da177e4SLinus Torvalds	field	CARRY		0x01
7047b61ab89SDenys Vlasenko	dont_generate_debug_code
7051da177e4SLinus Torvalds}
7061da177e4SLinus Torvalds
7071da177e4SLinus Torvaldsregister SINDIR	{
7081da177e4SLinus Torvalds	address			0x06c
7091da177e4SLinus Torvalds	access_mode RO
7107b61ab89SDenys Vlasenko	dont_generate_debug_code
7111da177e4SLinus Torvalds}
7121da177e4SLinus Torvalds
7131da177e4SLinus Torvaldsregister DINDIR	 {
7141da177e4SLinus Torvalds	address			0x06d
7151da177e4SLinus Torvalds	access_mode WO
7167b61ab89SDenys Vlasenko	dont_generate_debug_code
7171da177e4SLinus Torvalds}
7181da177e4SLinus Torvalds
7191da177e4SLinus Torvaldsregister FUNCTION1 {
7201da177e4SLinus Torvalds	address			0x06e
7211da177e4SLinus Torvalds	access_mode RW
7221da177e4SLinus Torvalds}
7231da177e4SLinus Torvalds
7241da177e4SLinus Torvaldsregister STACK {
7251da177e4SLinus Torvalds	address			0x06f
7261da177e4SLinus Torvalds	access_mode RO
7273dbd10f3SHannes Reinecke	count		5
7287b61ab89SDenys Vlasenko	dont_generate_debug_code
7291da177e4SLinus Torvalds}
7301da177e4SLinus Torvalds
7311da177e4SLinus Torvaldsconst	STACK_SIZE	4
7321da177e4SLinus Torvalds
7331da177e4SLinus Torvalds/*
7341da177e4SLinus Torvalds * Board Control (p. 3-43)
7351da177e4SLinus Torvalds */
7361da177e4SLinus Torvaldsregister BCTL {
7371da177e4SLinus Torvalds	address			0x084
7381da177e4SLinus Torvalds	access_mode RW
7391da177e4SLinus Torvalds	field	ACE		0x08
7401da177e4SLinus Torvalds	field	ENABLE		0x01
7411da177e4SLinus Torvalds}
7421da177e4SLinus Torvalds
7431da177e4SLinus Torvalds/*
7441da177e4SLinus Torvalds * On the aic78X0 chips, Board Control is replaced by the DSCommand
7451da177e4SLinus Torvalds * register (p. 4-64)
7461da177e4SLinus Torvalds */
7471da177e4SLinus Torvaldsregister DSCOMMAND0 {
7481da177e4SLinus Torvalds	address			0x084
7491da177e4SLinus Torvalds	access_mode RW
7503dbd10f3SHannes Reinecke	count		7
7511da177e4SLinus Torvalds	field	CACHETHEN	0x80	/* Cache Threshold enable */
7521da177e4SLinus Torvalds	field	DPARCKEN	0x40	/* Data Parity Check Enable */
7531da177e4SLinus Torvalds	field	MPARCKEN	0x20	/* Memory Parity Check Enable */
7541da177e4SLinus Torvalds	field	EXTREQLCK	0x10	/* External Request Lock */
7551da177e4SLinus Torvalds	/* aic7890/91/96/97 only */
7561da177e4SLinus Torvalds	field	INTSCBRAMSEL	0x08	/* Internal SCB RAM Select */
7571da177e4SLinus Torvalds	field	RAMPS		0x04	/* External SCB RAM Present */
7581da177e4SLinus Torvalds	field	USCBSIZE32	0x02	/* Use 32byte SCB Page Size */
7591da177e4SLinus Torvalds	field	CIOPARCKEN	0x01	/* Internal bus parity error enable */
7607b61ab89SDenys Vlasenko	dont_generate_debug_code
7611da177e4SLinus Torvalds}
7621da177e4SLinus Torvalds
7631da177e4SLinus Torvaldsregister DSCOMMAND1 {
7641da177e4SLinus Torvalds	address			0x085
7651da177e4SLinus Torvalds	access_mode RW
7661da177e4SLinus Torvalds	mask	DSLATT		0xfc	/* PCI latency timer (non-ultra2) */
7671da177e4SLinus Torvalds	field	HADDLDSEL1	0x02	/* Host Address Load Select Bits */
7681da177e4SLinus Torvalds	field	HADDLDSEL0	0x01
7697b61ab89SDenys Vlasenko	dont_generate_debug_code
7701da177e4SLinus Torvalds}
7711da177e4SLinus Torvalds
7721da177e4SLinus Torvalds/*
7731da177e4SLinus Torvalds * Bus On/Off Time (p. 3-44) aic7770 only
7741da177e4SLinus Torvalds */
7751da177e4SLinus Torvaldsregister BUSTIME {
7761da177e4SLinus Torvalds	address			0x085
7771da177e4SLinus Torvalds	access_mode RW
7783dbd10f3SHannes Reinecke	count		2
7791da177e4SLinus Torvalds	mask	BOFF		0xf0
7801da177e4SLinus Torvalds	mask	BON		0x0f
7817b61ab89SDenys Vlasenko	dont_generate_debug_code
7821da177e4SLinus Torvalds}
7831da177e4SLinus Torvalds
7841da177e4SLinus Torvalds/*
7851da177e4SLinus Torvalds * Bus Speed (p. 3-45) aic7770 only
7861da177e4SLinus Torvalds */
7871da177e4SLinus Torvaldsregister BUSSPD {
7881da177e4SLinus Torvalds	address			0x086
7891da177e4SLinus Torvalds	access_mode RW
7903dbd10f3SHannes Reinecke	count		2
7911da177e4SLinus Torvalds	mask	DFTHRSH		0xc0
7921da177e4SLinus Torvalds	mask	STBOFF		0x38
7931da177e4SLinus Torvalds	mask	STBON		0x07
7941da177e4SLinus Torvalds	mask	DFTHRSH_100	0xc0
7951da177e4SLinus Torvalds	mask	DFTHRSH_75	0x80
7967b61ab89SDenys Vlasenko	dont_generate_debug_code
7971da177e4SLinus Torvalds}
7981da177e4SLinus Torvalds
7991da177e4SLinus Torvalds/* aic7850/55/60/70/80/95 only */
8001da177e4SLinus Torvaldsregister DSPCISTATUS {
8011da177e4SLinus Torvalds	address			0x086
8023dbd10f3SHannes Reinecke	count		4
8031da177e4SLinus Torvalds	mask	DFTHRSH_100	0xc0
8047b61ab89SDenys Vlasenko	dont_generate_debug_code
8051da177e4SLinus Torvalds}
8061da177e4SLinus Torvalds
8071da177e4SLinus Torvalds/* aic7890/91/96/97 only */
8081da177e4SLinus Torvaldsregister HS_MAILBOX {
8091da177e4SLinus Torvalds	address			0x086
8101da177e4SLinus Torvalds	mask	HOST_MAILBOX	0xF0
8111da177e4SLinus Torvalds	mask	SEQ_MAILBOX	0x0F
8121da177e4SLinus Torvalds	mask	HOST_TQINPOS	0x80	/* Boundary at either 0 or 128 */
8137b61ab89SDenys Vlasenko	dont_generate_debug_code
8141da177e4SLinus Torvalds}
8151da177e4SLinus Torvalds
8161da177e4SLinus Torvaldsconst	HOST_MAILBOX_SHIFT	4
8171da177e4SLinus Torvaldsconst	SEQ_MAILBOX_SHIFT	0
8181da177e4SLinus Torvalds
8191da177e4SLinus Torvalds/*
8201da177e4SLinus Torvalds * Host Control (p. 3-47) R/W
8211da177e4SLinus Torvalds * Overall host control of the device.
8221da177e4SLinus Torvalds */
8231da177e4SLinus Torvaldsregister HCNTRL {
8241da177e4SLinus Torvalds	address			0x087
8251da177e4SLinus Torvalds	access_mode RW
8263dbd10f3SHannes Reinecke	count		14
8271da177e4SLinus Torvalds	field	POWRDN		0x40
8281da177e4SLinus Torvalds	field	SWINT		0x10
8291da177e4SLinus Torvalds	field	IRQMS		0x08
8301da177e4SLinus Torvalds	field	PAUSE		0x04
8311da177e4SLinus Torvalds	field	INTEN		0x02
8321da177e4SLinus Torvalds	field	CHIPRST		0x01
8331da177e4SLinus Torvalds	field	CHIPRSTACK	0x01
8347b61ab89SDenys Vlasenko	dont_generate_debug_code
8351da177e4SLinus Torvalds}
8361da177e4SLinus Torvalds
8371da177e4SLinus Torvalds/*
8381da177e4SLinus Torvalds * Host Address (p. 3-48)
8391da177e4SLinus Torvalds * This register contains the address of the byte about
8401da177e4SLinus Torvalds * to be transferred across the host bus.
8411da177e4SLinus Torvalds */
8421da177e4SLinus Torvaldsregister HADDR {
8431da177e4SLinus Torvalds	address			0x088
8441da177e4SLinus Torvalds	size	4
8451da177e4SLinus Torvalds	access_mode RW
8467b61ab89SDenys Vlasenko	dont_generate_debug_code
8471da177e4SLinus Torvalds}
8481da177e4SLinus Torvalds
8491da177e4SLinus Torvaldsregister HCNT {
8501da177e4SLinus Torvalds	address			0x08c
8511da177e4SLinus Torvalds	size	3
8521da177e4SLinus Torvalds	access_mode RW
8537b61ab89SDenys Vlasenko	dont_generate_debug_code
8541da177e4SLinus Torvalds}
8551da177e4SLinus Torvalds
8561da177e4SLinus Torvalds/*
8571da177e4SLinus Torvalds * SCB Pointer (p. 3-49)
8581da177e4SLinus Torvalds * Gate one of the SCBs into the SCBARRAY window.
8591da177e4SLinus Torvalds */
8601da177e4SLinus Torvaldsregister SCBPTR {
8611da177e4SLinus Torvalds	address			0x090
8621da177e4SLinus Torvalds	access_mode RW
8637b61ab89SDenys Vlasenko	dont_generate_debug_code
8641da177e4SLinus Torvalds}
8651da177e4SLinus Torvalds
8661da177e4SLinus Torvalds/*
8671da177e4SLinus Torvalds * Interrupt Status (p. 3-50)
8681da177e4SLinus Torvalds * Status for system interrupts
8691da177e4SLinus Torvalds */
8701da177e4SLinus Torvaldsregister INTSTAT {
8711da177e4SLinus Torvalds	address			0x091
8721da177e4SLinus Torvalds	access_mode RW
8731da177e4SLinus Torvalds	field	BRKADRINT 0x08
8741da177e4SLinus Torvalds	field	SCSIINT	  0x04
8751da177e4SLinus Torvalds	field	CMDCMPLT  0x02
8761da177e4SLinus Torvalds	field	SEQINT    0x01
8771da177e4SLinus Torvalds	mask	BAD_PHASE	SEQINT		/* unknown scsi bus phase */
8781da177e4SLinus Torvalds	mask	SEND_REJECT	0x10|SEQINT	/* sending a message reject */
8791da177e4SLinus Torvalds	mask	PROTO_VIOLATION	0x20|SEQINT	/* SCSI protocol violation */
8801da177e4SLinus Torvalds	mask	NO_MATCH	0x30|SEQINT	/* no cmd match for reconnect */
8811da177e4SLinus Torvalds	mask	IGN_WIDE_RES	0x40|SEQINT	/* Complex IGN Wide Res Msg */
8821da177e4SLinus Torvalds	mask	PDATA_REINIT	0x50|SEQINT	/*
8831da177e4SLinus Torvalds						 * Returned to data phase
8841da177e4SLinus Torvalds						 * that requires data
8851da177e4SLinus Torvalds						 * transfer pointers to be
8861da177e4SLinus Torvalds						 * recalculated from the
8871da177e4SLinus Torvalds						 * transfer residual.
8881da177e4SLinus Torvalds						 */
8891da177e4SLinus Torvalds	mask	HOST_MSG_LOOP	0x60|SEQINT	/*
8901da177e4SLinus Torvalds						 * The bus is ready for the
8911da177e4SLinus Torvalds						 * host to perform another
8921da177e4SLinus Torvalds						 * message transaction.  This
8931da177e4SLinus Torvalds						 * mechanism is used for things
8941da177e4SLinus Torvalds						 * like sync/wide negotiation
8951da177e4SLinus Torvalds						 * that require a kernel based
8961da177e4SLinus Torvalds						 * message state engine.
8971da177e4SLinus Torvalds						 */
8981da177e4SLinus Torvalds	mask	BAD_STATUS	0x70|SEQINT	/* Bad status from target */
8991da177e4SLinus Torvalds	mask	PERR_DETECTED	0x80|SEQINT	/*
9001da177e4SLinus Torvalds						 * Either the phase_lock
9011da177e4SLinus Torvalds						 * or inb_next routine has
9021da177e4SLinus Torvalds						 * noticed a parity error.
9031da177e4SLinus Torvalds						 */
9041da177e4SLinus Torvalds	mask	DATA_OVERRUN	0x90|SEQINT	/*
9051da177e4SLinus Torvalds						 * Target attempted to write
9061da177e4SLinus Torvalds						 * beyond the bounds of its
9071da177e4SLinus Torvalds						 * command.
9081da177e4SLinus Torvalds						 */
9091da177e4SLinus Torvalds	mask	MKMSG_FAILED	0xa0|SEQINT	/*
9101da177e4SLinus Torvalds						 * Target completed command
9111da177e4SLinus Torvalds						 * without honoring our ATN
9121da177e4SLinus Torvalds						 * request to issue a message.
9131da177e4SLinus Torvalds						 */
9141da177e4SLinus Torvalds	mask	MISSED_BUSFREE	0xb0|SEQINT	/*
9151da177e4SLinus Torvalds						 * The sequencer never saw
9161da177e4SLinus Torvalds						 * the bus go free after
9171da177e4SLinus Torvalds						 * either a command complete
9181da177e4SLinus Torvalds						 * or disconnect message.
9191da177e4SLinus Torvalds						 */
9201da177e4SLinus Torvalds	mask	SCB_MISMATCH	0xc0|SEQINT	/*
9211da177e4SLinus Torvalds						 * Downloaded SCB's tag does
9221da177e4SLinus Torvalds						 * not match the entry we
9231da177e4SLinus Torvalds						 * intended to download.
9241da177e4SLinus Torvalds						 */
9251da177e4SLinus Torvalds	mask	NO_FREE_SCB	0xd0|SEQINT	/*
9261da177e4SLinus Torvalds						 * get_free_or_disc_scb failed.
9271da177e4SLinus Torvalds						 */
9281da177e4SLinus Torvalds	mask	OUT_OF_RANGE	0xe0|SEQINT
9291da177e4SLinus Torvalds
9301da177e4SLinus Torvalds	mask	SEQINT_MASK	0xf0|SEQINT	/* SEQINT Status Codes */
9311da177e4SLinus Torvalds	mask	INT_PEND  (BRKADRINT|SEQINT|SCSIINT|CMDCMPLT)
9327b61ab89SDenys Vlasenko	dont_generate_debug_code
9331da177e4SLinus Torvalds}
9341da177e4SLinus Torvalds
9351da177e4SLinus Torvalds/*
9361da177e4SLinus Torvalds * Hard Error (p. 3-53)
9371da177e4SLinus Torvalds * Reporting of catastrophic errors.  You usually cannot recover from
9381da177e4SLinus Torvalds * these without a full board reset.
9391da177e4SLinus Torvalds */
9401da177e4SLinus Torvaldsregister ERROR {
9411da177e4SLinus Torvalds	address			0x092
9421da177e4SLinus Torvalds	access_mode RO
9433dbd10f3SHannes Reinecke	count		26
9441da177e4SLinus Torvalds	field	CIOPARERR	0x80	/* Ultra2 only */
9451da177e4SLinus Torvalds	field	PCIERRSTAT	0x40	/* PCI only */
9461da177e4SLinus Torvalds	field	MPARERR		0x20	/* PCI only */
9471da177e4SLinus Torvalds	field	DPARERR		0x10	/* PCI only */
9481da177e4SLinus Torvalds	field	SQPARERR	0x08
9491da177e4SLinus Torvalds	field	ILLOPCODE	0x04
9501da177e4SLinus Torvalds	field	ILLSADDR	0x02
9511da177e4SLinus Torvalds	field	ILLHADDR	0x01
9521da177e4SLinus Torvalds}
9531da177e4SLinus Torvalds
9541da177e4SLinus Torvalds/*
9551da177e4SLinus Torvalds * Clear Interrupt Status (p. 3-52)
9561da177e4SLinus Torvalds */
9571da177e4SLinus Torvaldsregister CLRINT {
9581da177e4SLinus Torvalds	address			0x092
9591da177e4SLinus Torvalds	access_mode WO
9603dbd10f3SHannes Reinecke	count		24
9611da177e4SLinus Torvalds	field	CLRPARERR	0x10	/* PCI only */
9621da177e4SLinus Torvalds	field	CLRBRKADRINT	0x08
9631da177e4SLinus Torvalds	field	CLRSCSIINT      0x04
9641da177e4SLinus Torvalds	field	CLRCMDINT 	0x02
9651da177e4SLinus Torvalds	field	CLRSEQINT 	0x01
9667b61ab89SDenys Vlasenko	dont_generate_debug_code
9671da177e4SLinus Torvalds}
9681da177e4SLinus Torvalds
9691da177e4SLinus Torvaldsregister DFCNTRL {
9701da177e4SLinus Torvalds	address			0x093
9711da177e4SLinus Torvalds	access_mode RW
9721da177e4SLinus Torvalds	field	PRELOADEN	0x80	/* aic7890 only */
9731da177e4SLinus Torvalds	field	WIDEODD		0x40
9741da177e4SLinus Torvalds	field	SCSIEN		0x20
9751da177e4SLinus Torvalds	field	SDMAEN		0x10
9761da177e4SLinus Torvalds	field	SDMAENACK	0x10
9771da177e4SLinus Torvalds	field	HDMAEN		0x08
9781da177e4SLinus Torvalds	field	HDMAENACK	0x08
9791da177e4SLinus Torvalds	field	DIRECTION	0x04
9801da177e4SLinus Torvalds	field	FIFOFLUSH	0x02
9811da177e4SLinus Torvalds	field	FIFORESET	0x01
9821da177e4SLinus Torvalds}
9831da177e4SLinus Torvalds
9841da177e4SLinus Torvaldsregister DFSTATUS {
9851da177e4SLinus Torvalds	address			0x094
9861da177e4SLinus Torvalds	access_mode RO
9871da177e4SLinus Torvalds	field	PRELOAD_AVAIL	0x80
9881da177e4SLinus Torvalds	field	DFCACHETH	0x40
9891da177e4SLinus Torvalds	field	FIFOQWDEMP	0x20
9901da177e4SLinus Torvalds	field	MREQPEND	0x10
9911da177e4SLinus Torvalds	field	HDONE		0x08
9921da177e4SLinus Torvalds	field	DFTHRESH	0x04
9931da177e4SLinus Torvalds	field	FIFOFULL	0x02
9941da177e4SLinus Torvalds	field	FIFOEMP		0x01
9951da177e4SLinus Torvalds}
9961da177e4SLinus Torvalds
9971da177e4SLinus Torvaldsregister DFWADDR {
9981da177e4SLinus Torvalds	address			0x95
9991da177e4SLinus Torvalds	access_mode RW
10007b61ab89SDenys Vlasenko	dont_generate_debug_code
10011da177e4SLinus Torvalds}
10021da177e4SLinus Torvalds
10031da177e4SLinus Torvaldsregister DFRADDR {
10041da177e4SLinus Torvalds	address			0x97
10051da177e4SLinus Torvalds	access_mode RW
10061da177e4SLinus Torvalds}
10071da177e4SLinus Torvalds
10081da177e4SLinus Torvaldsregister DFDAT {
10091da177e4SLinus Torvalds	address			0x099
10101da177e4SLinus Torvalds	access_mode RW
10117b61ab89SDenys Vlasenko	dont_generate_debug_code
10121da177e4SLinus Torvalds}
10131da177e4SLinus Torvalds
10141da177e4SLinus Torvalds/*
10151da177e4SLinus Torvalds * SCB Auto Increment (p. 3-59)
10161da177e4SLinus Torvalds * Byte offset into the SCB Array and an optional bit to allow auto
10171da177e4SLinus Torvalds * incrementing of the address during download and upload operations
10181da177e4SLinus Torvalds */
10191da177e4SLinus Torvaldsregister SCBCNT {
10201da177e4SLinus Torvalds	address			0x09a
10211da177e4SLinus Torvalds	access_mode RW
10223dbd10f3SHannes Reinecke	count		1
10231da177e4SLinus Torvalds	field	SCBAUTO		0x80
10241da177e4SLinus Torvalds	mask	SCBCNT_MASK	0x1f
10257b61ab89SDenys Vlasenko	dont_generate_debug_code
10261da177e4SLinus Torvalds}
10271da177e4SLinus Torvalds
10281da177e4SLinus Torvalds/*
10291da177e4SLinus Torvalds * Queue In FIFO (p. 3-60)
10301da177e4SLinus Torvalds * Input queue for queued SCBs (commands that the seqencer has yet to start)
10311da177e4SLinus Torvalds */
10321da177e4SLinus Torvaldsregister QINFIFO {
10331da177e4SLinus Torvalds	address			0x09b
10341da177e4SLinus Torvalds	access_mode RW
10353dbd10f3SHannes Reinecke	count		12
10367b61ab89SDenys Vlasenko	dont_generate_debug_code
10371da177e4SLinus Torvalds}
10381da177e4SLinus Torvalds
10391da177e4SLinus Torvalds/*
10401da177e4SLinus Torvalds * Queue In Count (p. 3-60)
10411da177e4SLinus Torvalds * Number of queued SCBs
10421da177e4SLinus Torvalds */
10431da177e4SLinus Torvaldsregister QINCNT	{
10441da177e4SLinus Torvalds	address			0x09c
10451da177e4SLinus Torvalds	access_mode RO
10461da177e4SLinus Torvalds}
10471da177e4SLinus Torvalds
10481da177e4SLinus Torvalds/*
10491da177e4SLinus Torvalds * Queue Out FIFO (p. 3-61)
10501da177e4SLinus Torvalds * Queue of SCBs that have completed and await the host
10511da177e4SLinus Torvalds */
10521da177e4SLinus Torvaldsregister QOUTFIFO {
10531da177e4SLinus Torvalds	address			0x09d
10541da177e4SLinus Torvalds	access_mode WO
10553dbd10f3SHannes Reinecke	count		7
10567b61ab89SDenys Vlasenko	dont_generate_debug_code
10571da177e4SLinus Torvalds}
10581da177e4SLinus Torvalds
10591da177e4SLinus Torvaldsregister CRCCONTROL1 {
10601da177e4SLinus Torvalds	address			0x09d
10611da177e4SLinus Torvalds	access_mode RW
10623dbd10f3SHannes Reinecke	count		3
10631da177e4SLinus Torvalds	field	CRCONSEEN		0x80
10641da177e4SLinus Torvalds	field	CRCVALCHKEN		0x40
10651da177e4SLinus Torvalds	field	CRCENDCHKEN		0x20
10661da177e4SLinus Torvalds	field	CRCREQCHKEN		0x10
10671da177e4SLinus Torvalds	field	TARGCRCENDEN		0x08
10681da177e4SLinus Torvalds	field	TARGCRCCNTEN		0x04
10697b61ab89SDenys Vlasenko	dont_generate_debug_code
10701da177e4SLinus Torvalds}
10711da177e4SLinus Torvalds
10721da177e4SLinus Torvalds
10731da177e4SLinus Torvalds/*
10741da177e4SLinus Torvalds * Queue Out Count (p. 3-61)
10751da177e4SLinus Torvalds * Number of queued SCBs in the Out FIFO
10761da177e4SLinus Torvalds */
10771da177e4SLinus Torvaldsregister QOUTCNT {
10781da177e4SLinus Torvalds	address			0x09e
10791da177e4SLinus Torvalds	access_mode RO
10801da177e4SLinus Torvalds}
10811da177e4SLinus Torvalds
10821da177e4SLinus Torvaldsregister SCSIPHASE {
10831da177e4SLinus Torvalds	address			0x09e
10841da177e4SLinus Torvalds	access_mode RO
10851da177e4SLinus Torvalds	field	STATUS_PHASE	0x20
10861da177e4SLinus Torvalds	field	COMMAND_PHASE	0x10
10871da177e4SLinus Torvalds	field	MSG_IN_PHASE	0x08
10881da177e4SLinus Torvalds	field	MSG_OUT_PHASE	0x04
10891da177e4SLinus Torvalds	field	DATA_IN_PHASE	0x02
10901da177e4SLinus Torvalds	field	DATA_OUT_PHASE	0x01
10911da177e4SLinus Torvalds	mask	DATA_PHASE_MASK	0x03
10921da177e4SLinus Torvalds}
10931da177e4SLinus Torvalds
10941da177e4SLinus Torvalds/*
10951da177e4SLinus Torvalds * Special Function
10961da177e4SLinus Torvalds */
10971da177e4SLinus Torvaldsregister SFUNCT {
10981da177e4SLinus Torvalds	address			0x09f
10991da177e4SLinus Torvalds	access_mode RW
11003dbd10f3SHannes Reinecke	count	    4
11011da177e4SLinus Torvalds	field	ALT_MODE	0x80
11027b61ab89SDenys Vlasenko	dont_generate_debug_code
11031da177e4SLinus Torvalds}
11041da177e4SLinus Torvalds
11051da177e4SLinus Torvalds/*
11061da177e4SLinus Torvalds * SCB Definition (p. 5-4)
11071da177e4SLinus Torvalds */
11081da177e4SLinus Torvaldsscb {
11091da177e4SLinus Torvalds	address		0x0a0
11101da177e4SLinus Torvalds	size		64
11111da177e4SLinus Torvalds
11121da177e4SLinus Torvalds	SCB_CDB_PTR {
11131da177e4SLinus Torvalds		size	4
11141da177e4SLinus Torvalds		alias	SCB_RESIDUAL_DATACNT
11151da177e4SLinus Torvalds		alias	SCB_CDB_STORE
11167b61ab89SDenys Vlasenko		dont_generate_debug_code
11171da177e4SLinus Torvalds	}
11181da177e4SLinus Torvalds	SCB_RESIDUAL_SGPTR {
11191da177e4SLinus Torvalds		size	4
11207b61ab89SDenys Vlasenko		dont_generate_debug_code
11211da177e4SLinus Torvalds	}
11221da177e4SLinus Torvalds	SCB_SCSI_STATUS {
11231da177e4SLinus Torvalds		size	1
11247b61ab89SDenys Vlasenko		dont_generate_debug_code
11251da177e4SLinus Torvalds	}
11261da177e4SLinus Torvalds	SCB_TARGET_PHASES {
11271da177e4SLinus Torvalds		size	1
11287b61ab89SDenys Vlasenko		dont_generate_debug_code
11291da177e4SLinus Torvalds	}
11301da177e4SLinus Torvalds	SCB_TARGET_DATA_DIR {
11311da177e4SLinus Torvalds		size	1
11327b61ab89SDenys Vlasenko		dont_generate_debug_code
11331da177e4SLinus Torvalds	}
11341da177e4SLinus Torvalds	SCB_TARGET_ITAG {
11351da177e4SLinus Torvalds		size	1
11367b61ab89SDenys Vlasenko		dont_generate_debug_code
11371da177e4SLinus Torvalds	}
11381da177e4SLinus Torvalds	SCB_DATAPTR {
11391da177e4SLinus Torvalds		size	4
11407b61ab89SDenys Vlasenko		dont_generate_debug_code
11411da177e4SLinus Torvalds	}
11421da177e4SLinus Torvalds	SCB_DATACNT {
11431da177e4SLinus Torvalds		/*
11441da177e4SLinus Torvalds		 * The last byte is really the high address bits for
11451da177e4SLinus Torvalds		 * the data address.
11461da177e4SLinus Torvalds		 */
11471da177e4SLinus Torvalds		size	4
11481da177e4SLinus Torvalds		field	SG_LAST_SEG		0x80	/* In the fourth byte */
11491da177e4SLinus Torvalds		mask	SG_HIGH_ADDR_BITS	0x7F	/* In the fourth byte */
11507b61ab89SDenys Vlasenko		dont_generate_debug_code
11511da177e4SLinus Torvalds	}
11521da177e4SLinus Torvalds	SCB_SGPTR {
11531da177e4SLinus Torvalds		size	4
11541da177e4SLinus Torvalds		field	SG_RESID_VALID	0x04	/* In the first byte */
11551da177e4SLinus Torvalds		field	SG_FULL_RESID	0x02	/* In the first byte */
11561da177e4SLinus Torvalds		field	SG_LIST_NULL	0x01	/* In the first byte */
11577b61ab89SDenys Vlasenko		dont_generate_debug_code
11581da177e4SLinus Torvalds	}
11591da177e4SLinus Torvalds	SCB_CONTROL {
11601da177e4SLinus Torvalds		size	1
11611da177e4SLinus Torvalds		field	TARGET_SCB			0x80
11621da177e4SLinus Torvalds		field	STATUS_RCVD			0x80
11631da177e4SLinus Torvalds		field	DISCENB				0x40
11641da177e4SLinus Torvalds		field	TAG_ENB				0x20
11651da177e4SLinus Torvalds		field	MK_MESSAGE			0x10
11661da177e4SLinus Torvalds		field	ULTRAENB			0x08
11671da177e4SLinus Torvalds		field	DISCONNECTED			0x04
11681da177e4SLinus Torvalds		mask	SCB_TAG_TYPE			0x03
11691da177e4SLinus Torvalds	}
11701da177e4SLinus Torvalds	SCB_SCSIID {
11711da177e4SLinus Torvalds		size	1
11721da177e4SLinus Torvalds		field	TWIN_CHNLB			0x80
11731da177e4SLinus Torvalds		mask	TWIN_TID			0x70
11741da177e4SLinus Torvalds		mask	TID				0xf0
11751da177e4SLinus Torvalds		mask	OID				0x0f
11761da177e4SLinus Torvalds	}
11771da177e4SLinus Torvalds	SCB_LUN {
11781da177e4SLinus Torvalds		field	SCB_XFERLEN_ODD			0x80
11791da177e4SLinus Torvalds		mask	LID				0x3f
11801da177e4SLinus Torvalds		size	1
11811da177e4SLinus Torvalds	}
11821da177e4SLinus Torvalds	SCB_TAG {
11831da177e4SLinus Torvalds		size	1
11841da177e4SLinus Torvalds	}
11851da177e4SLinus Torvalds	SCB_CDB_LEN {
11861da177e4SLinus Torvalds		size	1
11877b61ab89SDenys Vlasenko		dont_generate_debug_code
11881da177e4SLinus Torvalds	}
11891da177e4SLinus Torvalds	SCB_SCSIRATE {
11901da177e4SLinus Torvalds		size	1
11917b61ab89SDenys Vlasenko		dont_generate_debug_code
11921da177e4SLinus Torvalds	}
11931da177e4SLinus Torvalds	SCB_SCSIOFFSET {
11941da177e4SLinus Torvalds		size	1
11953dbd10f3SHannes Reinecke		count	1
11967b61ab89SDenys Vlasenko		dont_generate_debug_code
11971da177e4SLinus Torvalds	}
11981da177e4SLinus Torvalds	SCB_NEXT {
11991da177e4SLinus Torvalds		size	1
12007b61ab89SDenys Vlasenko		dont_generate_debug_code
12011da177e4SLinus Torvalds	}
12021da177e4SLinus Torvalds	SCB_64_SPARE {
12031da177e4SLinus Torvalds		size	16
12041da177e4SLinus Torvalds	}
12051da177e4SLinus Torvalds	SCB_64_BTT {
12061da177e4SLinus Torvalds		size	16
12077b61ab89SDenys Vlasenko		dont_generate_debug_code
12081da177e4SLinus Torvalds	}
12091da177e4SLinus Torvalds}
12101da177e4SLinus Torvalds
12111da177e4SLinus Torvaldsconst	SCB_UPLOAD_SIZE		32
12121da177e4SLinus Torvaldsconst	SCB_DOWNLOAD_SIZE	32
12131da177e4SLinus Torvaldsconst	SCB_DOWNLOAD_SIZE_64	48
12141da177e4SLinus Torvalds
12151da177e4SLinus Torvaldsconst	SG_SIZEOF	0x08		/* sizeof(struct ahc_dma) */
12161da177e4SLinus Torvalds
12171da177e4SLinus Torvalds/* --------------------- AHA-2840-only definitions -------------------- */
12181da177e4SLinus Torvalds
12191da177e4SLinus Torvaldsregister SEECTL_2840 {
12201da177e4SLinus Torvalds	address			0x0c0
12211da177e4SLinus Torvalds	access_mode RW
12223dbd10f3SHannes Reinecke	count		2
12231da177e4SLinus Torvalds	field	CS_2840		0x04
12241da177e4SLinus Torvalds	field	CK_2840		0x02
12251da177e4SLinus Torvalds	field	DO_2840		0x01
12267b61ab89SDenys Vlasenko	dont_generate_debug_code
12271da177e4SLinus Torvalds}
12281da177e4SLinus Torvalds
12291da177e4SLinus Torvaldsregister STATUS_2840 {
12301da177e4SLinus Torvalds	address			0x0c1
12311da177e4SLinus Torvalds	access_mode RW
12323dbd10f3SHannes Reinecke	count		4
12331da177e4SLinus Torvalds	field	EEPROM_TF	0x80
12341da177e4SLinus Torvalds	mask	BIOS_SEL	0x60
12351da177e4SLinus Torvalds	mask	ADSEL		0x1e
12361da177e4SLinus Torvalds	field	DI_2840		0x01
12377b61ab89SDenys Vlasenko	dont_generate_debug_code
12381da177e4SLinus Torvalds}
12391da177e4SLinus Torvalds
12401da177e4SLinus Torvalds/* --------------------- AIC-7870-only definitions -------------------- */
12411da177e4SLinus Torvalds
12421da177e4SLinus Torvaldsregister CCHADDR {
12431da177e4SLinus Torvalds	address			0x0E0
12441da177e4SLinus Torvalds	size 8
12457b61ab89SDenys Vlasenko	dont_generate_debug_code
12461da177e4SLinus Torvalds}
12471da177e4SLinus Torvalds
12481da177e4SLinus Torvaldsregister CCHCNT {
12491da177e4SLinus Torvalds	address			0x0E8
12507b61ab89SDenys Vlasenko	dont_generate_debug_code
12511da177e4SLinus Torvalds}
12521da177e4SLinus Torvalds
12531da177e4SLinus Torvaldsregister CCSGRAM {
12541da177e4SLinus Torvalds	address			0x0E9
12557b61ab89SDenys Vlasenko	dont_generate_debug_code
12561da177e4SLinus Torvalds}
12571da177e4SLinus Torvalds
12581da177e4SLinus Torvaldsregister CCSGADDR {
12591da177e4SLinus Torvalds	address			0x0EA
12607b61ab89SDenys Vlasenko	dont_generate_debug_code
12611da177e4SLinus Torvalds}
12621da177e4SLinus Torvalds
12631da177e4SLinus Torvaldsregister CCSGCTL {
12641da177e4SLinus Torvalds	address			0x0EB
12651da177e4SLinus Torvalds	field	CCSGDONE	0x80
12661da177e4SLinus Torvalds	field	CCSGEN		0x08
12671da177e4SLinus Torvalds	field	SG_FETCH_NEEDED 0x02	/* Bit used for software state */
12681da177e4SLinus Torvalds	field	CCSGRESET	0x01
12697b61ab89SDenys Vlasenko	dont_generate_debug_code
12701da177e4SLinus Torvalds}
12711da177e4SLinus Torvalds
12721da177e4SLinus Torvaldsregister CCSCBCNT {
12731da177e4SLinus Torvalds	address			0xEF
12743dbd10f3SHannes Reinecke	count		1
12757b61ab89SDenys Vlasenko	dont_generate_debug_code
12761da177e4SLinus Torvalds}
12771da177e4SLinus Torvalds
12781da177e4SLinus Torvaldsregister CCSCBCTL {
12791da177e4SLinus Torvalds	address			0x0EE
12801da177e4SLinus Torvalds	field	CCSCBDONE	0x80
12811da177e4SLinus Torvalds	field	ARRDONE		0x40	/* SCB Array prefetch done */
12821da177e4SLinus Torvalds	field	CCARREN		0x10
12831da177e4SLinus Torvalds	field	CCSCBEN		0x08
12841da177e4SLinus Torvalds	field	CCSCBDIR	0x04
12851da177e4SLinus Torvalds	field	CCSCBRESET	0x01
12867b61ab89SDenys Vlasenko	dont_generate_debug_code
12871da177e4SLinus Torvalds}
12881da177e4SLinus Torvalds
12891da177e4SLinus Torvaldsregister CCSCBADDR {
12901da177e4SLinus Torvalds	address			0x0ED
12917b61ab89SDenys Vlasenko	dont_generate_debug_code
12921da177e4SLinus Torvalds}
12931da177e4SLinus Torvalds
12941da177e4SLinus Torvaldsregister CCSCBRAM {
12951da177e4SLinus Torvalds	address			0xEC
12967b61ab89SDenys Vlasenko	dont_generate_debug_code
12971da177e4SLinus Torvalds}
12981da177e4SLinus Torvalds
12991da177e4SLinus Torvalds/*
13001da177e4SLinus Torvalds * SCB bank address (7895/7896/97 only)
13011da177e4SLinus Torvalds */
13021da177e4SLinus Torvaldsregister SCBBADDR {
13031da177e4SLinus Torvalds	address			0x0F0
13041da177e4SLinus Torvalds	access_mode RW
13053dbd10f3SHannes Reinecke	count		3
13067b61ab89SDenys Vlasenko	dont_generate_debug_code
13071da177e4SLinus Torvalds}
13081da177e4SLinus Torvalds
13091da177e4SLinus Torvaldsregister CCSCBPTR {
13101da177e4SLinus Torvalds	address			0x0F1
13117b61ab89SDenys Vlasenko	dont_generate_debug_code
13121da177e4SLinus Torvalds}
13131da177e4SLinus Torvalds
13141da177e4SLinus Torvaldsregister HNSCB_QOFF {
13151da177e4SLinus Torvalds	address			0x0F4
13163dbd10f3SHannes Reinecke	count		4
13177b61ab89SDenys Vlasenko	dont_generate_debug_code
13181da177e4SLinus Torvalds}
13191da177e4SLinus Torvalds
13201da177e4SLinus Torvaldsregister SNSCB_QOFF {
13211da177e4SLinus Torvalds	address			0x0F6
13227b61ab89SDenys Vlasenko	dont_generate_debug_code
13231da177e4SLinus Torvalds}
13241da177e4SLinus Torvalds
13251da177e4SLinus Torvaldsregister SDSCB_QOFF {
13261da177e4SLinus Torvalds	address			0x0F8
13277b61ab89SDenys Vlasenko	dont_generate_debug_code
13281da177e4SLinus Torvalds}
13291da177e4SLinus Torvalds
13301da177e4SLinus Torvaldsregister QOFF_CTLSTA {
13311da177e4SLinus Torvalds	address			0x0FA
13321da177e4SLinus Torvalds	field	SCB_AVAIL	0x40
13331da177e4SLinus Torvalds	field	SNSCB_ROLLOVER	0x20
13341da177e4SLinus Torvalds	field	SDSCB_ROLLOVER	0x10
13351da177e4SLinus Torvalds	mask	SCB_QSIZE	0x07
13361da177e4SLinus Torvalds	mask	SCB_QSIZE_256	0x06
13377b61ab89SDenys Vlasenko	dont_generate_debug_code
13381da177e4SLinus Torvalds}
13391da177e4SLinus Torvalds
13401da177e4SLinus Torvaldsregister DFF_THRSH {
13411da177e4SLinus Torvalds	address			0x0FB
13421da177e4SLinus Torvalds	mask	WR_DFTHRSH	0x70
13431da177e4SLinus Torvalds	mask	RD_DFTHRSH	0x07
13441da177e4SLinus Torvalds	mask	RD_DFTHRSH_MIN	0x00
13451da177e4SLinus Torvalds	mask	RD_DFTHRSH_25	0x01
13461da177e4SLinus Torvalds	mask	RD_DFTHRSH_50	0x02
13471da177e4SLinus Torvalds	mask	RD_DFTHRSH_63	0x03
13481da177e4SLinus Torvalds	mask	RD_DFTHRSH_75	0x04
13491da177e4SLinus Torvalds	mask	RD_DFTHRSH_85	0x05
13501da177e4SLinus Torvalds	mask	RD_DFTHRSH_90	0x06
13511da177e4SLinus Torvalds	mask	RD_DFTHRSH_MAX	0x07
13521da177e4SLinus Torvalds	mask	WR_DFTHRSH_MIN	0x00
13531da177e4SLinus Torvalds	mask	WR_DFTHRSH_25	0x10
13541da177e4SLinus Torvalds	mask	WR_DFTHRSH_50	0x20
13551da177e4SLinus Torvalds	mask	WR_DFTHRSH_63	0x30
13561da177e4SLinus Torvalds	mask	WR_DFTHRSH_75	0x40
13571da177e4SLinus Torvalds	mask	WR_DFTHRSH_85	0x50
13581da177e4SLinus Torvalds	mask	WR_DFTHRSH_90	0x60
13591da177e4SLinus Torvalds	mask	WR_DFTHRSH_MAX	0x70
13603dbd10f3SHannes Reinecke	count	4
13617b61ab89SDenys Vlasenko	dont_generate_debug_code
13621da177e4SLinus Torvalds}
13631da177e4SLinus Torvalds
13641da177e4SLinus Torvaldsregister SG_CACHE_PRE {
13651da177e4SLinus Torvalds	access_mode WO
13661da177e4SLinus Torvalds	address			0x0fc
13671da177e4SLinus Torvalds	mask	SG_ADDR_MASK	0xf8
13681da177e4SLinus Torvalds	field	LAST_SEG	0x02
13691da177e4SLinus Torvalds	field	LAST_SEG_DONE	0x01
13707b61ab89SDenys Vlasenko	dont_generate_debug_code
13711da177e4SLinus Torvalds}
13721da177e4SLinus Torvalds
13731da177e4SLinus Torvaldsregister SG_CACHE_SHADOW {
13741da177e4SLinus Torvalds	access_mode RO
13751da177e4SLinus Torvalds	address			0x0fc
13761da177e4SLinus Torvalds	mask	SG_ADDR_MASK	0xf8
13771da177e4SLinus Torvalds	field	LAST_SEG	0x02
13781da177e4SLinus Torvalds	field	LAST_SEG_DONE	0x01
13797b61ab89SDenys Vlasenko	dont_generate_debug_code
13801da177e4SLinus Torvalds}
13811da177e4SLinus Torvalds/* ---------------------- Scratch RAM Offsets ------------------------- */
13821da177e4SLinus Torvalds/* These offsets are either to values that are initialized by the board's
13831da177e4SLinus Torvalds * BIOS or are specified by the sequencer code.
13841da177e4SLinus Torvalds *
13851da177e4SLinus Torvalds * The host adapter card (at least the BIOS) uses 20-2f for SCSI
13861da177e4SLinus Torvalds * device information, 32-33 and 5a-5f as well. As it turns out, the
13871da177e4SLinus Torvalds * BIOS trashes 20-2f, writing the synchronous negotiation results
13881da177e4SLinus Torvalds * on top of the BIOS values, so we re-use those for our per-target
13891da177e4SLinus Torvalds * scratchspace (actually a value that can be copied directly into
13901da177e4SLinus Torvalds * SCSIRATE).  The kernel driver will enable synchronous negotiation
13911da177e4SLinus Torvalds * for all targets that have a value other than 0 in the lower four
13921da177e4SLinus Torvalds * bits of the target scratch space.  This should work regardless of
13931da177e4SLinus Torvalds * whether the bios has been installed.
13941da177e4SLinus Torvalds */
13951da177e4SLinus Torvalds
13961da177e4SLinus Torvaldsscratch_ram {
13971da177e4SLinus Torvalds	address		0x020
13981da177e4SLinus Torvalds	size		58
13991da177e4SLinus Torvalds
14001da177e4SLinus Torvalds	/*
14011da177e4SLinus Torvalds	 * 1 byte per target starting at this address for configuration values
14021da177e4SLinus Torvalds	 */
14031da177e4SLinus Torvalds	BUSY_TARGETS {
14041da177e4SLinus Torvalds		alias		TARG_SCSIRATE
14051da177e4SLinus Torvalds		size		16
14067b61ab89SDenys Vlasenko		dont_generate_debug_code
14071da177e4SLinus Torvalds	}
14081da177e4SLinus Torvalds	/*
14091da177e4SLinus Torvalds	 * Bit vector of targets that have ULTRA enabled as set by
14101da177e4SLinus Torvalds	 * the BIOS.  The Sequencer relies on a per-SCB field to
14111da177e4SLinus Torvalds	 * control whether to enable Ultra transfers or not.  During
14121da177e4SLinus Torvalds	 * initialization, we read this field and reuse it for 2
14131da177e4SLinus Torvalds	 * entries in the busy target table.
14141da177e4SLinus Torvalds	 */
14151da177e4SLinus Torvalds	ULTRA_ENB {
14161da177e4SLinus Torvalds		alias		CMDSIZE_TABLE
14171da177e4SLinus Torvalds		size		2
14183dbd10f3SHannes Reinecke		count		2
14197b61ab89SDenys Vlasenko		dont_generate_debug_code
14201da177e4SLinus Torvalds	}
14211da177e4SLinus Torvalds	/*
14221da177e4SLinus Torvalds	 * Bit vector of targets that have disconnection disabled as set by
14231da177e4SLinus Torvalds	 * the BIOS.  The Sequencer relies in a per-SCB field to control the
14241da177e4SLinus Torvalds	 * disconnect priveldge.  During initialization, we read this field
14251da177e4SLinus Torvalds	 * and reuse it for 2 entries in the busy target table.
14261da177e4SLinus Torvalds	 */
14271da177e4SLinus Torvalds	DISC_DSB {
14281da177e4SLinus Torvalds		size		2
14293dbd10f3SHannes Reinecke		count		6
14307b61ab89SDenys Vlasenko		dont_generate_debug_code
14311da177e4SLinus Torvalds	}
14321da177e4SLinus Torvalds	CMDSIZE_TABLE_TAIL {
14331da177e4SLinus Torvalds		size		4
14341da177e4SLinus Torvalds	}
14351da177e4SLinus Torvalds	/*
14361da177e4SLinus Torvalds	 * Partial transfer past cacheline end to be
14371da177e4SLinus Torvalds	 * transferred using an extra S/G.
14381da177e4SLinus Torvalds	 */
14391da177e4SLinus Torvalds	MWI_RESIDUAL {
14401da177e4SLinus Torvalds		size		1
14417b61ab89SDenys Vlasenko		dont_generate_debug_code
14421da177e4SLinus Torvalds	}
14431da177e4SLinus Torvalds	/*
14441da177e4SLinus Torvalds	 * SCBID of the next SCB to be started by the controller.
14451da177e4SLinus Torvalds	 */
14461da177e4SLinus Torvalds	NEXT_QUEUED_SCB {
14471da177e4SLinus Torvalds		size		1
14487b61ab89SDenys Vlasenko		dont_generate_debug_code
14491da177e4SLinus Torvalds	}
14501da177e4SLinus Torvalds	/*
14511da177e4SLinus Torvalds	 * Single byte buffer used to designate the type or message
14521da177e4SLinus Torvalds	 * to send to a target.
14531da177e4SLinus Torvalds	 */
14541da177e4SLinus Torvalds	MSG_OUT {
14551da177e4SLinus Torvalds		size		1
14567b61ab89SDenys Vlasenko		dont_generate_debug_code
14571da177e4SLinus Torvalds	}
14581da177e4SLinus Torvalds	/* Parameters for DMA Logic */
14591da177e4SLinus Torvalds	DMAPARAMS {
14601da177e4SLinus Torvalds		size		1
14613dbd10f3SHannes Reinecke		count		12
14621da177e4SLinus Torvalds		field	PRELOADEN	0x80
14631da177e4SLinus Torvalds		field	WIDEODD		0x40
14641da177e4SLinus Torvalds		field	SCSIEN		0x20
14651da177e4SLinus Torvalds		field	SDMAEN		0x10
14661da177e4SLinus Torvalds		field	SDMAENACK	0x10
14671da177e4SLinus Torvalds		field	HDMAEN		0x08
14681da177e4SLinus Torvalds		field	HDMAENACK	0x08
14691da177e4SLinus Torvalds		field	DIRECTION	0x04	/* Set indicates PCI->SCSI */
14701da177e4SLinus Torvalds		field	FIFOFLUSH	0x02
14711da177e4SLinus Torvalds		field	FIFORESET	0x01
14727b61ab89SDenys Vlasenko		dont_generate_debug_code
14731da177e4SLinus Torvalds	}
14741da177e4SLinus Torvalds	SEQ_FLAGS {
14751da177e4SLinus Torvalds		size		1
14761da177e4SLinus Torvalds		field	NOT_IDENTIFIED		0x80
14771da177e4SLinus Torvalds		field	NO_CDB_SENT		0x40
14781da177e4SLinus Torvalds		field	TARGET_CMD_IS_TAGGED	0x40
14791da177e4SLinus Torvalds		field	DPHASE			0x20
14801da177e4SLinus Torvalds		/* Target flags */
14811da177e4SLinus Torvalds		field	TARG_CMD_PENDING	0x10
14821da177e4SLinus Torvalds		field	CMDPHASE_PENDING	0x08
14831da177e4SLinus Torvalds		field	DPHASE_PENDING		0x04
14841da177e4SLinus Torvalds		field	SPHASE_PENDING		0x02
14851da177e4SLinus Torvalds		field	NO_DISCONNECT		0x01
14861da177e4SLinus Torvalds	}
14871da177e4SLinus Torvalds	/*
14881da177e4SLinus Torvalds	 * Temporary storage for the
14891da177e4SLinus Torvalds	 * target/channel/lun of a
14901da177e4SLinus Torvalds	 * reconnecting target
14911da177e4SLinus Torvalds	 */
14921da177e4SLinus Torvalds	SAVED_SCSIID {
14931da177e4SLinus Torvalds		size		1
14947b61ab89SDenys Vlasenko		dont_generate_debug_code
14951da177e4SLinus Torvalds	}
14961da177e4SLinus Torvalds	SAVED_LUN {
14971da177e4SLinus Torvalds		size		1
14987b61ab89SDenys Vlasenko		dont_generate_debug_code
14991da177e4SLinus Torvalds	}
15001da177e4SLinus Torvalds	/*
15011da177e4SLinus Torvalds	 * The last bus phase as seen by the sequencer.
15021da177e4SLinus Torvalds	 */
15031da177e4SLinus Torvalds	LASTPHASE {
15041da177e4SLinus Torvalds		size		1
15051da177e4SLinus Torvalds		field	CDI		0x80
15061da177e4SLinus Torvalds		field	IOI		0x40
15071da177e4SLinus Torvalds		field	MSGI		0x20
15081da177e4SLinus Torvalds		mask	PHASE_MASK	CDI|IOI|MSGI
15091da177e4SLinus Torvalds		mask	P_DATAOUT	0x00
15101da177e4SLinus Torvalds		mask	P_DATAIN	IOI
15111da177e4SLinus Torvalds		mask	P_COMMAND	CDI
15121da177e4SLinus Torvalds		mask	P_MESGOUT	CDI|MSGI
15131da177e4SLinus Torvalds		mask	P_STATUS	CDI|IOI
15141da177e4SLinus Torvalds		mask	P_MESGIN	CDI|IOI|MSGI
15151da177e4SLinus Torvalds		mask	P_BUSFREE	0x01
15161da177e4SLinus Torvalds	}
15171da177e4SLinus Torvalds	/*
15181da177e4SLinus Torvalds	 * head of list of SCBs awaiting
15191da177e4SLinus Torvalds	 * selection
15201da177e4SLinus Torvalds	 */
15211da177e4SLinus Torvalds	WAITING_SCBH {
15221da177e4SLinus Torvalds		size		1
15237b61ab89SDenys Vlasenko		dont_generate_debug_code
15241da177e4SLinus Torvalds	}
15251da177e4SLinus Torvalds	/*
15261da177e4SLinus Torvalds	 * head of list of SCBs that are
15271da177e4SLinus Torvalds	 * disconnected.  Used for SCB
15281da177e4SLinus Torvalds	 * paging.
15291da177e4SLinus Torvalds	 */
15301da177e4SLinus Torvalds	DISCONNECTED_SCBH {
15311da177e4SLinus Torvalds		size		1
15327b61ab89SDenys Vlasenko		dont_generate_debug_code
15331da177e4SLinus Torvalds	}
15341da177e4SLinus Torvalds	/*
15351da177e4SLinus Torvalds	 * head of list of SCBs that are
15361da177e4SLinus Torvalds	 * not in use.  Used for SCB paging.
15371da177e4SLinus Torvalds	 */
15381da177e4SLinus Torvalds	FREE_SCBH {
15391da177e4SLinus Torvalds		size		1
15407b61ab89SDenys Vlasenko		dont_generate_debug_code
15411da177e4SLinus Torvalds	}
15421da177e4SLinus Torvalds	/*
15431da177e4SLinus Torvalds	 * head of list of SCBs that have
15441da177e4SLinus Torvalds	 * completed but have not been
15451da177e4SLinus Torvalds	 * put into the qoutfifo.
15461da177e4SLinus Torvalds	 */
15471da177e4SLinus Torvalds	COMPLETE_SCBH {
15481da177e4SLinus Torvalds		size		1
15491da177e4SLinus Torvalds	}
15501da177e4SLinus Torvalds	/*
15511da177e4SLinus Torvalds	 * Address of the hardware scb array in the host.
15521da177e4SLinus Torvalds	 */
15531da177e4SLinus Torvalds	HSCB_ADDR {
15541da177e4SLinus Torvalds		size		4
15557b61ab89SDenys Vlasenko		dont_generate_debug_code
15561da177e4SLinus Torvalds	}
15571da177e4SLinus Torvalds	/*
15581da177e4SLinus Torvalds	 * Base address of our shared data with the kernel driver in host
15591da177e4SLinus Torvalds	 * memory.  This includes the qoutfifo and target mode
15601da177e4SLinus Torvalds	 * incoming command queue.
15611da177e4SLinus Torvalds	 */
15621da177e4SLinus Torvalds	SHARED_DATA_ADDR {
15631da177e4SLinus Torvalds		size		4
15647b61ab89SDenys Vlasenko		dont_generate_debug_code
15651da177e4SLinus Torvalds	}
15661da177e4SLinus Torvalds	KERNEL_QINPOS {
15671da177e4SLinus Torvalds		size		1
15687b61ab89SDenys Vlasenko		dont_generate_debug_code
15691da177e4SLinus Torvalds	}
15701da177e4SLinus Torvalds	QINPOS {
15711da177e4SLinus Torvalds		size		1
15727b61ab89SDenys Vlasenko		dont_generate_debug_code
15731da177e4SLinus Torvalds	}
15741da177e4SLinus Torvalds	QOUTPOS {
15751da177e4SLinus Torvalds		size		1
15767b61ab89SDenys Vlasenko		dont_generate_debug_code
15771da177e4SLinus Torvalds	}
15781da177e4SLinus Torvalds	/*
15791da177e4SLinus Torvalds	 * Kernel and sequencer offsets into the queue of
15801da177e4SLinus Torvalds	 * incoming target mode command descriptors.  The
15811da177e4SLinus Torvalds	 * queue is full when the KERNEL_TQINPOS == TQINPOS.
15821da177e4SLinus Torvalds	 */
15831da177e4SLinus Torvalds	KERNEL_TQINPOS {
15841da177e4SLinus Torvalds		size		1
15857b61ab89SDenys Vlasenko		dont_generate_debug_code
15861da177e4SLinus Torvalds	}
15871da177e4SLinus Torvalds	TQINPOS {
15881da177e4SLinus Torvalds		size		1
15897b61ab89SDenys Vlasenko		dont_generate_debug_code
15901da177e4SLinus Torvalds	}
15911da177e4SLinus Torvalds	ARG_1 {
15921da177e4SLinus Torvalds		size		1
15933dbd10f3SHannes Reinecke		count		1
15941da177e4SLinus Torvalds		mask	SEND_MSG		0x80
15951da177e4SLinus Torvalds		mask	SEND_SENSE		0x40
15961da177e4SLinus Torvalds		mask	SEND_REJ		0x20
15971da177e4SLinus Torvalds		mask	MSGOUT_PHASEMIS		0x10
15981da177e4SLinus Torvalds		mask	EXIT_MSG_LOOP		0x08
15991da177e4SLinus Torvalds		mask	CONT_MSG_LOOP		0x04
16001da177e4SLinus Torvalds		mask	CONT_TARG_SESSION	0x02
16011da177e4SLinus Torvalds		alias	RETURN_1
16027b61ab89SDenys Vlasenko		dont_generate_debug_code
16031da177e4SLinus Torvalds	}
16041da177e4SLinus Torvalds	ARG_2 {
16051da177e4SLinus Torvalds		size		1
16061da177e4SLinus Torvalds		alias	RETURN_2
16077b61ab89SDenys Vlasenko		dont_generate_debug_code
16081da177e4SLinus Torvalds	}
16091da177e4SLinus Torvalds
16101da177e4SLinus Torvalds	/*
16111da177e4SLinus Torvalds	 * Snapshot of MSG_OUT taken after each message is sent.
16121da177e4SLinus Torvalds	 */
16131da177e4SLinus Torvalds	LAST_MSG {
16141da177e4SLinus Torvalds		size		1
161579778a27SJames Bottomley		alias	TARG_IMMEDIATE_SCB
16167b61ab89SDenys Vlasenko		dont_generate_debug_code
16171da177e4SLinus Torvalds	}
16181da177e4SLinus Torvalds
16191da177e4SLinus Torvalds	/*
16201da177e4SLinus Torvalds	 * Sequences the kernel driver has okayed for us.  This allows
16211da177e4SLinus Torvalds	 * the driver to do things like prevent initiator or target
16221da177e4SLinus Torvalds	 * operations.
16231da177e4SLinus Torvalds	 */
16241da177e4SLinus Torvalds	SCSISEQ_TEMPLATE {
16251da177e4SLinus Torvalds		size		1
16261da177e4SLinus Torvalds		field	ENSELO		0x40
16271da177e4SLinus Torvalds		field	ENSELI		0x20
16281da177e4SLinus Torvalds		field	ENRSELI		0x10
16291da177e4SLinus Torvalds		field	ENAUTOATNO	0x08
16301da177e4SLinus Torvalds		field	ENAUTOATNI	0x04
16311da177e4SLinus Torvalds		field	ENAUTOATNP	0x02
16327b61ab89SDenys Vlasenko		dont_generate_debug_code
16331da177e4SLinus Torvalds	}
16341da177e4SLinus Torvalds}
16351da177e4SLinus Torvalds
16361da177e4SLinus Torvaldsscratch_ram {
16371da177e4SLinus Torvalds	address		0x056
16381da177e4SLinus Torvalds	size		4
16391da177e4SLinus Torvalds	/*
16401da177e4SLinus Torvalds	 * These scratch ram locations are initialized by the 274X BIOS.
16411da177e4SLinus Torvalds	 * We reuse them after capturing the BIOS settings during
16421da177e4SLinus Torvalds	 * initialization.
16431da177e4SLinus Torvalds	 */
16441da177e4SLinus Torvalds
16451da177e4SLinus Torvalds	/*
16461da177e4SLinus Torvalds	 * The initiator specified tag for this target mode transaction.
16471da177e4SLinus Torvalds	 */
16481da177e4SLinus Torvalds	HA_274_BIOSGLOBAL {
16491da177e4SLinus Torvalds		size	1
16501da177e4SLinus Torvalds		field	HA_274_EXTENDED_TRANS	0x01
16511da177e4SLinus Torvalds		alias	INITIATOR_TAG
16523dbd10f3SHannes Reinecke		count		1
16537b61ab89SDenys Vlasenko		dont_generate_debug_code
16541da177e4SLinus Torvalds	}
16551da177e4SLinus Torvalds
16561da177e4SLinus Torvalds	SEQ_FLAGS2 {
16571da177e4SLinus Torvalds		size	1
16581da177e4SLinus Torvalds		field	SCB_DMA			0x01
16591da177e4SLinus Torvalds		field	TARGET_MSG_PENDING	0x02
16607b61ab89SDenys Vlasenko		dont_generate_debug_code
16611da177e4SLinus Torvalds	}
16621da177e4SLinus Torvalds}
16631da177e4SLinus Torvalds
16641da177e4SLinus Torvaldsscratch_ram {
16651da177e4SLinus Torvalds	address		0x05a
16661da177e4SLinus Torvalds	size		6
16671da177e4SLinus Torvalds	/*
16681da177e4SLinus Torvalds	 * These are reserved registers in the card's scratch ram on the 2742.
1669*ec0a95abSGeert Uytterhoeven	 * The EISA configuration chip is mapped here.  On Rev E. of the
16701da177e4SLinus Torvalds	 * aic7770, the sequencer can use this area for scratch, but the
16711da177e4SLinus Torvalds	 * host cannot directly access these registers.  On later chips, this
16721da177e4SLinus Torvalds	 * area can be read and written by both the host and the sequencer.
16731da177e4SLinus Torvalds	 * Even on later chips, many of these locations are initialized by
16741da177e4SLinus Torvalds	 * the BIOS.
16751da177e4SLinus Torvalds	 */
16761da177e4SLinus Torvalds	SCSICONF {
16771da177e4SLinus Torvalds		size		1
16783dbd10f3SHannes Reinecke		count		12
16791da177e4SLinus Torvalds		field	TERM_ENB	0x80
16801da177e4SLinus Torvalds		field	RESET_SCSI	0x40
16811da177e4SLinus Torvalds		field	ENSPCHK		0x20
16821da177e4SLinus Torvalds		mask	HSCSIID		0x07	/* our SCSI ID */
16831da177e4SLinus Torvalds		mask	HWSCSIID	0x0f	/* our SCSI ID if Wide Bus */
16847b61ab89SDenys Vlasenko		dont_generate_debug_code
16851da177e4SLinus Torvalds	}
16861da177e4SLinus Torvalds	INTDEF {
16871da177e4SLinus Torvalds		address		0x05c
16881da177e4SLinus Torvalds		size		1
16893dbd10f3SHannes Reinecke		count		1
16901da177e4SLinus Torvalds		field	EDGE_TRIG	0x80
16911da177e4SLinus Torvalds		mask	VECTOR		0x0f
16927b61ab89SDenys Vlasenko		dont_generate_debug_code
16931da177e4SLinus Torvalds	}
16941da177e4SLinus Torvalds	HOSTCONF {
16951da177e4SLinus Torvalds		address		0x05d
16961da177e4SLinus Torvalds		size		1
16973dbd10f3SHannes Reinecke		count		1
16987b61ab89SDenys Vlasenko		dont_generate_debug_code
16991da177e4SLinus Torvalds	}
17001da177e4SLinus Torvalds	HA_274_BIOSCTRL	{
17011da177e4SLinus Torvalds		address		0x05f
17021da177e4SLinus Torvalds		size		1
17033dbd10f3SHannes Reinecke		count		1
17041da177e4SLinus Torvalds		mask	BIOSMODE		0x30
17051da177e4SLinus Torvalds		mask	BIOSDISABLED		0x30
17061da177e4SLinus Torvalds		field	CHANNEL_B_PRIMARY	0x08
17077b61ab89SDenys Vlasenko		dont_generate_debug_code
17081da177e4SLinus Torvalds	}
17091da177e4SLinus Torvalds}
17101da177e4SLinus Torvalds
17111da177e4SLinus Torvaldsscratch_ram {
17121da177e4SLinus Torvalds	address		0x070
17131da177e4SLinus Torvalds	size		16
17141da177e4SLinus Torvalds
17151da177e4SLinus Torvalds	/*
17161da177e4SLinus Torvalds	 * Per target SCSI offset values for Ultra2 controllers.
17171da177e4SLinus Torvalds	 */
17181da177e4SLinus Torvalds	TARG_OFFSET {
17191da177e4SLinus Torvalds		size		16
17203dbd10f3SHannes Reinecke		count		1
17217b61ab89SDenys Vlasenko		dont_generate_debug_code
17221da177e4SLinus Torvalds	}
17231da177e4SLinus Torvalds}
17241da177e4SLinus Torvalds
17251da177e4SLinus Torvaldsconst TID_SHIFT		4
17261da177e4SLinus Torvaldsconst SCB_LIST_NULL	0xff
17271da177e4SLinus Torvaldsconst TARGET_CMD_CMPLT	0xfe
17281da177e4SLinus Torvalds
17291da177e4SLinus Torvaldsconst CCSGADDR_MAX	0x80
17301da177e4SLinus Torvaldsconst CCSGRAM_MAXSEGS	16
17311da177e4SLinus Torvalds
17321da177e4SLinus Torvalds/* WDTR Message values */
17331da177e4SLinus Torvaldsconst BUS_8_BIT			0x00
17341da177e4SLinus Torvaldsconst BUS_16_BIT		0x01
17351da177e4SLinus Torvaldsconst BUS_32_BIT		0x02
17361da177e4SLinus Torvalds
17371da177e4SLinus Torvalds/* Offset maximums */
17381da177e4SLinus Torvaldsconst MAX_OFFSET_8BIT		0x0f
17391da177e4SLinus Torvaldsconst MAX_OFFSET_16BIT		0x08
17401da177e4SLinus Torvaldsconst MAX_OFFSET_ULTRA2		0x7f
17411da177e4SLinus Torvaldsconst MAX_OFFSET		0x7f
17421da177e4SLinus Torvaldsconst HOST_MSG			0xff
17431da177e4SLinus Torvalds
17441da177e4SLinus Torvalds/* Target mode command processing constants */
17451da177e4SLinus Torvaldsconst CMD_GROUP_CODE_SHIFT	0x05
17461da177e4SLinus Torvalds
17471da177e4SLinus Torvaldsconst STATUS_BUSY		0x08
17481da177e4SLinus Torvaldsconst STATUS_QUEUE_FULL	0x28
17491da177e4SLinus Torvaldsconst TARGET_DATA_IN		1
17501da177e4SLinus Torvalds
17511da177e4SLinus Torvalds/*
17521da177e4SLinus Torvalds * Downloaded (kernel inserted) constants
17531da177e4SLinus Torvalds */
17541da177e4SLinus Torvalds/* Offsets into the SCBID array where different data is stored */
17551da177e4SLinus Torvaldsconst QOUTFIFO_OFFSET download
17561da177e4SLinus Torvaldsconst QINFIFO_OFFSET download
17571da177e4SLinus Torvaldsconst CACHESIZE_MASK download
17581da177e4SLinus Torvaldsconst INVERTED_CACHESIZE_MASK download
17591da177e4SLinus Torvaldsconst SG_PREFETCH_CNT download
17601da177e4SLinus Torvaldsconst SG_PREFETCH_ALIGN_MASK download
17611da177e4SLinus Torvaldsconst SG_PREFETCH_ADDR_MASK download
1762