xref: /linux/drivers/scsi/ncr53c8xx.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
174ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
21da177e4SLinus Torvalds /******************************************************************************
31da177e4SLinus Torvalds **  Device driver for the PCI-SCSI NCR538XX controller family.
41da177e4SLinus Torvalds **
51da177e4SLinus Torvalds **  Copyright (C) 1994  Wolfgang Stanglmeier
619c65091SMatthew Wilcox **  Copyright (C) 1998-2001  Gerard Roudier <groudier@free.fr>
71da177e4SLinus Torvalds **
81da177e4SLinus Torvalds **
91da177e4SLinus Torvalds **-----------------------------------------------------------------------------
101da177e4SLinus Torvalds **
111da177e4SLinus Torvalds **  This driver has been ported to Linux from the FreeBSD NCR53C8XX driver
121da177e4SLinus Torvalds **  and is currently maintained by
131da177e4SLinus Torvalds **
141da177e4SLinus Torvalds **          Gerard Roudier              <groudier@free.fr>
151da177e4SLinus Torvalds **
161da177e4SLinus Torvalds **  Being given that this driver originates from the FreeBSD version, and
171da177e4SLinus Torvalds **  in order to keep synergy on both, any suggested enhancements and corrections
181da177e4SLinus Torvalds **  received on Linux are automatically a potential candidate for the FreeBSD
191da177e4SLinus Torvalds **  version.
201da177e4SLinus Torvalds **
211da177e4SLinus Torvalds **  The original driver has been written for 386bsd and FreeBSD by
221da177e4SLinus Torvalds **          Wolfgang Stanglmeier        <wolf@cologne.de>
231da177e4SLinus Torvalds **          Stefan Esser                <se@mi.Uni-Koeln.de>
241da177e4SLinus Torvalds **
251da177e4SLinus Torvalds **  And has been ported to NetBSD by
261da177e4SLinus Torvalds **          Charles M. Hannum           <mycroft@gnu.ai.mit.edu>
271da177e4SLinus Torvalds **
2819c65091SMatthew Wilcox **  NVRAM detection and reading.
2919c65091SMatthew Wilcox **    Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
3019c65091SMatthew Wilcox **
3119c65091SMatthew Wilcox **  Added support for MIPS big endian systems.
3219c65091SMatthew Wilcox **    Carsten Langgaard, carstenl@mips.com
3319c65091SMatthew Wilcox **    Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
3419c65091SMatthew Wilcox **
3519c65091SMatthew Wilcox **  Added support for HP PARISC big endian systems.
3619c65091SMatthew Wilcox **    Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
3719c65091SMatthew Wilcox **
381da177e4SLinus Torvalds *******************************************************************************
391da177e4SLinus Torvalds */
401da177e4SLinus Torvalds 
411da177e4SLinus Torvalds #ifndef NCR53C8XX_H
421da177e4SLinus Torvalds #define NCR53C8XX_H
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds #include <scsi/scsi_host.h>
451da177e4SLinus Torvalds 
46b0dc1db1SMatthew Wilcox 
4719c65091SMatthew Wilcox /*
48b0dc1db1SMatthew Wilcox **	If you want a driver as small as possible, donnot define the
4919c65091SMatthew Wilcox **	following options.
5019c65091SMatthew Wilcox */
5119c65091SMatthew Wilcox #define SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT
5219c65091SMatthew Wilcox #define SCSI_NCR_DEBUG_INFO_SUPPORT
5319c65091SMatthew Wilcox 
5419c65091SMatthew Wilcox /*
5519c65091SMatthew Wilcox **	To disable integrity checking, do not define the
5619c65091SMatthew Wilcox **	following option.
5719c65091SMatthew Wilcox */
5819c65091SMatthew Wilcox #ifdef	CONFIG_SCSI_NCR53C8XX_INTEGRITY_CHECK
5919c65091SMatthew Wilcox #	define SCSI_NCR_ENABLE_INTEGRITY_CHECK
6019c65091SMatthew Wilcox #endif
6119c65091SMatthew Wilcox 
6219c65091SMatthew Wilcox /* ---------------------------------------------------------------------
6319c65091SMatthew Wilcox ** Take into account kernel configured parameters.
6419c65091SMatthew Wilcox ** Most of these options can be overridden at startup by a command line.
6519c65091SMatthew Wilcox ** ---------------------------------------------------------------------
6619c65091SMatthew Wilcox */
6719c65091SMatthew Wilcox 
6819c65091SMatthew Wilcox /*
6919c65091SMatthew Wilcox  * For Ultra2 and Ultra3 SCSI support option, use special features.
7019c65091SMatthew Wilcox  *
7119c65091SMatthew Wilcox  * Value (default) means:
7219c65091SMatthew Wilcox  *	bit 0 : all features enabled, except:
7319c65091SMatthew Wilcox  *		bit 1 : PCI Write And Invalidate.
7419c65091SMatthew Wilcox  *		bit 2 : Data Phase Mismatch handling from SCRIPTS.
7519c65091SMatthew Wilcox  *
7619c65091SMatthew Wilcox  * Use boot options ncr53c8xx=specf:1 if you want all chip features to be
7719c65091SMatthew Wilcox  * enabled by the driver.
7819c65091SMatthew Wilcox  */
7919c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_SPECIAL_FEATURES		(3)
8019c65091SMatthew Wilcox 
8119c65091SMatthew Wilcox #define SCSI_NCR_MAX_SYNC			(80)
8219c65091SMatthew Wilcox 
8319c65091SMatthew Wilcox /*
8419c65091SMatthew Wilcox  * Allow tags from 2 to 256, default 8
8519c65091SMatthew Wilcox  */
8619c65091SMatthew Wilcox #ifdef	CONFIG_SCSI_NCR53C8XX_MAX_TAGS
8719c65091SMatthew Wilcox #if	CONFIG_SCSI_NCR53C8XX_MAX_TAGS < 2
8819c65091SMatthew Wilcox #define SCSI_NCR_MAX_TAGS	(2)
8919c65091SMatthew Wilcox #elif	CONFIG_SCSI_NCR53C8XX_MAX_TAGS > 256
9019c65091SMatthew Wilcox #define SCSI_NCR_MAX_TAGS	(256)
9119c65091SMatthew Wilcox #else
9219c65091SMatthew Wilcox #define	SCSI_NCR_MAX_TAGS	CONFIG_SCSI_NCR53C8XX_MAX_TAGS
9319c65091SMatthew Wilcox #endif
9419c65091SMatthew Wilcox #else
9519c65091SMatthew Wilcox #define SCSI_NCR_MAX_TAGS	(8)
9619c65091SMatthew Wilcox #endif
9719c65091SMatthew Wilcox 
9819c65091SMatthew Wilcox /*
9919c65091SMatthew Wilcox  * Allow tagged command queuing support if configured with default number
10019c65091SMatthew Wilcox  * of tags set to max (see above).
10119c65091SMatthew Wilcox  */
10219c65091SMatthew Wilcox #ifdef	CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
10319c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_TAGS	CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
10419c65091SMatthew Wilcox #elif	defined CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE
10519c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_TAGS	SCSI_NCR_MAX_TAGS
10619c65091SMatthew Wilcox #else
10719c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_TAGS	(0)
10819c65091SMatthew Wilcox #endif
10919c65091SMatthew Wilcox 
11019c65091SMatthew Wilcox /*
11119c65091SMatthew Wilcox  * Immediate arbitration
11219c65091SMatthew Wilcox  */
11319c65091SMatthew Wilcox #if defined(CONFIG_SCSI_NCR53C8XX_IARB)
11419c65091SMatthew Wilcox #define SCSI_NCR_IARB_SUPPORT
11519c65091SMatthew Wilcox #endif
11619c65091SMatthew Wilcox 
11719c65091SMatthew Wilcox /*
11819c65091SMatthew Wilcox  * Sync transfer frequency at startup.
11919c65091SMatthew Wilcox  * Allow from 5Mhz to 80Mhz default 20 Mhz.
12019c65091SMatthew Wilcox  */
12119c65091SMatthew Wilcox #ifndef	CONFIG_SCSI_NCR53C8XX_SYNC
12219c65091SMatthew Wilcox #define	CONFIG_SCSI_NCR53C8XX_SYNC	(20)
12319c65091SMatthew Wilcox #elif	CONFIG_SCSI_NCR53C8XX_SYNC > SCSI_NCR_MAX_SYNC
12419c65091SMatthew Wilcox #undef	CONFIG_SCSI_NCR53C8XX_SYNC
12519c65091SMatthew Wilcox #define	CONFIG_SCSI_NCR53C8XX_SYNC	SCSI_NCR_MAX_SYNC
12619c65091SMatthew Wilcox #endif
12719c65091SMatthew Wilcox 
12819c65091SMatthew Wilcox #if	CONFIG_SCSI_NCR53C8XX_SYNC == 0
12919c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_SYNC	(255)
13019c65091SMatthew Wilcox #elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 5
13119c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_SYNC	(50)
13219c65091SMatthew Wilcox #elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 20
13319c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_SYNC	(250/(CONFIG_SCSI_NCR53C8XX_SYNC))
13419c65091SMatthew Wilcox #elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 33
13519c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_SYNC	(11)
13619c65091SMatthew Wilcox #elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 40
13719c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_SYNC	(10)
13819c65091SMatthew Wilcox #else
13919c65091SMatthew Wilcox #define	SCSI_NCR_SETUP_DEFAULT_SYNC 	(9)
14019c65091SMatthew Wilcox #endif
14119c65091SMatthew Wilcox 
14219c65091SMatthew Wilcox /*
14319c65091SMatthew Wilcox  * Disallow disconnections at boot-up
14419c65091SMatthew Wilcox  */
14519c65091SMatthew Wilcox #ifdef CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT
14619c65091SMatthew Wilcox #define SCSI_NCR_SETUP_DISCONNECTION	(0)
14719c65091SMatthew Wilcox #else
14819c65091SMatthew Wilcox #define SCSI_NCR_SETUP_DISCONNECTION	(1)
14919c65091SMatthew Wilcox #endif
15019c65091SMatthew Wilcox 
15119c65091SMatthew Wilcox /*
15219c65091SMatthew Wilcox  * Force synchronous negotiation for all targets
15319c65091SMatthew Wilcox  */
15419c65091SMatthew Wilcox #ifdef CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO
15519c65091SMatthew Wilcox #define SCSI_NCR_SETUP_FORCE_SYNC_NEGO	(1)
15619c65091SMatthew Wilcox #else
15719c65091SMatthew Wilcox #define SCSI_NCR_SETUP_FORCE_SYNC_NEGO	(0)
15819c65091SMatthew Wilcox #endif
15919c65091SMatthew Wilcox 
16019c65091SMatthew Wilcox /*
16119c65091SMatthew Wilcox  * Disable master parity checking (flawed hardwares need that)
16219c65091SMatthew Wilcox  */
16319c65091SMatthew Wilcox #ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK
16419c65091SMatthew Wilcox #define SCSI_NCR_SETUP_MASTER_PARITY	(0)
16519c65091SMatthew Wilcox #else
16619c65091SMatthew Wilcox #define SCSI_NCR_SETUP_MASTER_PARITY	(1)
16719c65091SMatthew Wilcox #endif
16819c65091SMatthew Wilcox 
16919c65091SMatthew Wilcox /*
17019c65091SMatthew Wilcox  * Disable scsi parity checking (flawed devices may need that)
17119c65091SMatthew Wilcox  */
17219c65091SMatthew Wilcox #ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK
17319c65091SMatthew Wilcox #define SCSI_NCR_SETUP_SCSI_PARITY	(0)
17419c65091SMatthew Wilcox #else
17519c65091SMatthew Wilcox #define SCSI_NCR_SETUP_SCSI_PARITY	(1)
17619c65091SMatthew Wilcox #endif
17719c65091SMatthew Wilcox 
17819c65091SMatthew Wilcox /*
17919c65091SMatthew Wilcox  * Settle time after reset at boot-up
18019c65091SMatthew Wilcox  */
18119c65091SMatthew Wilcox #define SCSI_NCR_SETUP_SETTLE_TIME	(2)
18219c65091SMatthew Wilcox 
18319c65091SMatthew Wilcox /*
18419c65091SMatthew Wilcox **	Bridge quirks work-around option defaulted to 1.
18519c65091SMatthew Wilcox */
18619c65091SMatthew Wilcox #ifndef	SCSI_NCR_PCIQ_WORK_AROUND_OPT
18719c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_WORK_AROUND_OPT	1
18819c65091SMatthew Wilcox #endif
18919c65091SMatthew Wilcox 
19019c65091SMatthew Wilcox /*
19119c65091SMatthew Wilcox **	Work-around common bridge misbehaviour.
19219c65091SMatthew Wilcox **
19319c65091SMatthew Wilcox **	- Do not flush posted writes in the opposite
19419c65091SMatthew Wilcox **	  direction on read.
19519c65091SMatthew Wilcox **	- May reorder DMA writes to memory.
19619c65091SMatthew Wilcox **
19719c65091SMatthew Wilcox **	This option should not affect performances
19819c65091SMatthew Wilcox **	significantly, so it is the default.
19919c65091SMatthew Wilcox */
20019c65091SMatthew Wilcox #if	SCSI_NCR_PCIQ_WORK_AROUND_OPT == 1
20119c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_MAY_NOT_FLUSH_PW_UPSTREAM
20219c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_MAY_REORDER_WRITES
20319c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_MAY_MISS_COMPLETIONS
20419c65091SMatthew Wilcox 
20519c65091SMatthew Wilcox /*
20619c65091SMatthew Wilcox **	Same as option 1, but also deal with
20719c65091SMatthew Wilcox **	misconfigured interrupts.
20819c65091SMatthew Wilcox **
2090779bf2dSMatt LaPlante **	- Edge triggered instead of level sensitive.
21019c65091SMatthew Wilcox **	- No interrupt line connected.
21119c65091SMatthew Wilcox **	- IRQ number misconfigured.
21219c65091SMatthew Wilcox **
21319c65091SMatthew Wilcox **	If no interrupt is delivered, the driver will
21419c65091SMatthew Wilcox **	catch the interrupt conditions 10 times per
21519c65091SMatthew Wilcox **	second. No need to say that this option is
21619c65091SMatthew Wilcox **	not recommended.
21719c65091SMatthew Wilcox */
21819c65091SMatthew Wilcox #elif	SCSI_NCR_PCIQ_WORK_AROUND_OPT == 2
21919c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_MAY_NOT_FLUSH_PW_UPSTREAM
22019c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_MAY_REORDER_WRITES
22119c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_MAY_MISS_COMPLETIONS
22219c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_BROKEN_INTR
22319c65091SMatthew Wilcox 
22419c65091SMatthew Wilcox /*
22519c65091SMatthew Wilcox **	Some bridge designers decided to flush
22619c65091SMatthew Wilcox **	everything prior to deliver the interrupt.
22719c65091SMatthew Wilcox **	This option tries to deal with such a
22819c65091SMatthew Wilcox **	behaviour.
22919c65091SMatthew Wilcox */
23019c65091SMatthew Wilcox #elif	SCSI_NCR_PCIQ_WORK_AROUND_OPT == 3
23119c65091SMatthew Wilcox #define	SCSI_NCR_PCIQ_SYNC_ON_INTR
23219c65091SMatthew Wilcox #endif
23319c65091SMatthew Wilcox 
23419c65091SMatthew Wilcox /*
23519c65091SMatthew Wilcox **	Other parameters not configurable with "make config"
23619c65091SMatthew Wilcox **	Avoid to change these constants, unless you know what you are doing.
23719c65091SMatthew Wilcox */
23819c65091SMatthew Wilcox 
23919c65091SMatthew Wilcox #define SCSI_NCR_ALWAYS_SIMPLE_TAG
24019c65091SMatthew Wilcox #define SCSI_NCR_MAX_SCATTER	(127)
24119c65091SMatthew Wilcox #define SCSI_NCR_MAX_TARGET	(16)
24219c65091SMatthew Wilcox 
24319c65091SMatthew Wilcox /*
24419c65091SMatthew Wilcox **   Compute some desirable value for CAN_QUEUE
24519c65091SMatthew Wilcox **   and CMD_PER_LUN.
24619c65091SMatthew Wilcox **   The driver will use lower values if these
24719c65091SMatthew Wilcox **   ones appear to be too large.
24819c65091SMatthew Wilcox */
24919c65091SMatthew Wilcox #define SCSI_NCR_CAN_QUEUE	(8*SCSI_NCR_MAX_TAGS + 2*SCSI_NCR_MAX_TARGET)
25019c65091SMatthew Wilcox #define SCSI_NCR_CMD_PER_LUN	(SCSI_NCR_MAX_TAGS)
25119c65091SMatthew Wilcox 
25219c65091SMatthew Wilcox #define SCSI_NCR_SG_TABLESIZE	(SCSI_NCR_MAX_SCATTER)
25319c65091SMatthew Wilcox #define SCSI_NCR_TIMER_INTERVAL	(HZ)
25419c65091SMatthew Wilcox 
25519c65091SMatthew Wilcox #define SCSI_NCR_MAX_LUN	(16)
25619c65091SMatthew Wilcox 
25719c65091SMatthew Wilcox /*
25819c65091SMatthew Wilcox  *  IO functions definition for big/little endian CPU support.
25919c65091SMatthew Wilcox  *  For now, the NCR is only supported in little endian addressing mode,
26019c65091SMatthew Wilcox  */
26119c65091SMatthew Wilcox 
26219c65091SMatthew Wilcox #ifdef	__BIG_ENDIAN
26319c65091SMatthew Wilcox 
26419c65091SMatthew Wilcox #define	inw_l2b		inw
26519c65091SMatthew Wilcox #define	inl_l2b		inl
26619c65091SMatthew Wilcox #define	outw_b2l	outw
26719c65091SMatthew Wilcox #define	outl_b2l	outl
26819c65091SMatthew Wilcox 
26919c65091SMatthew Wilcox #define	readb_raw	readb
27019c65091SMatthew Wilcox #define	writeb_raw	writeb
27119c65091SMatthew Wilcox 
27219c65091SMatthew Wilcox #if defined(SCSI_NCR_BIG_ENDIAN)
27319c65091SMatthew Wilcox #define	readw_l2b	__raw_readw
27419c65091SMatthew Wilcox #define	readl_l2b	__raw_readl
27519c65091SMatthew Wilcox #define	writew_b2l	__raw_writew
27619c65091SMatthew Wilcox #define	writel_b2l	__raw_writel
27719c65091SMatthew Wilcox #define	readw_raw	__raw_readw
27819c65091SMatthew Wilcox #define	readl_raw	__raw_readl
27919c65091SMatthew Wilcox #define	writew_raw	__raw_writew
28019c65091SMatthew Wilcox #define	writel_raw	__raw_writel
28119c65091SMatthew Wilcox #else	/* Other big-endian */
28219c65091SMatthew Wilcox #define	readw_l2b	readw
28319c65091SMatthew Wilcox #define	readl_l2b	readl
28419c65091SMatthew Wilcox #define	writew_b2l	writew
28519c65091SMatthew Wilcox #define	writel_b2l	writel
28619c65091SMatthew Wilcox #define	readw_raw	readw
28719c65091SMatthew Wilcox #define	readl_raw	readl
28819c65091SMatthew Wilcox #define	writew_raw	writew
28919c65091SMatthew Wilcox #define	writel_raw	writel
29019c65091SMatthew Wilcox #endif
29119c65091SMatthew Wilcox 
29219c65091SMatthew Wilcox #else	/* little endian */
29319c65091SMatthew Wilcox 
29419c65091SMatthew Wilcox #define	inw_raw		inw
29519c65091SMatthew Wilcox #define	inl_raw		inl
29619c65091SMatthew Wilcox #define	outw_raw	outw
29719c65091SMatthew Wilcox #define	outl_raw	outl
29819c65091SMatthew Wilcox 
29919c65091SMatthew Wilcox #define	readb_raw	readb
30019c65091SMatthew Wilcox #define	readw_raw	readw
30119c65091SMatthew Wilcox #define	readl_raw	readl
30219c65091SMatthew Wilcox #define	writeb_raw	writeb
30319c65091SMatthew Wilcox #define	writew_raw	writew
30419c65091SMatthew Wilcox #define	writel_raw	writel
30519c65091SMatthew Wilcox 
30619c65091SMatthew Wilcox #endif
30719c65091SMatthew Wilcox 
30819c65091SMatthew Wilcox #if !defined(__hppa__) && !defined(__mips__)
30919c65091SMatthew Wilcox #ifdef	SCSI_NCR_BIG_ENDIAN
31019c65091SMatthew Wilcox #error	"The NCR in BIG ENDIAN addressing mode is not (yet) supported"
31119c65091SMatthew Wilcox #endif
31219c65091SMatthew Wilcox #endif
31319c65091SMatthew Wilcox 
31419c65091SMatthew Wilcox #define MEMORY_BARRIER()	mb()
31519c65091SMatthew Wilcox 
31619c65091SMatthew Wilcox 
31719c65091SMatthew Wilcox /*
31819c65091SMatthew Wilcox  *  If the NCR uses big endian addressing mode over the
31919c65091SMatthew Wilcox  *  PCI, actual io register addresses for byte and word
32019c65091SMatthew Wilcox  *  accesses must be changed according to lane routing.
32119c65091SMatthew Wilcox  *  Btw, ncr_offb() and ncr_offw() macros only apply to
32219c65091SMatthew Wilcox  *  constants and so donnot generate bloated code.
32319c65091SMatthew Wilcox  */
32419c65091SMatthew Wilcox 
32519c65091SMatthew Wilcox #if	defined(SCSI_NCR_BIG_ENDIAN)
32619c65091SMatthew Wilcox 
32719c65091SMatthew Wilcox #define ncr_offb(o)	(((o)&~3)+((~((o)&3))&3))
32819c65091SMatthew Wilcox #define ncr_offw(o)	(((o)&~3)+((~((o)&3))&2))
32919c65091SMatthew Wilcox 
33019c65091SMatthew Wilcox #else
33119c65091SMatthew Wilcox 
33219c65091SMatthew Wilcox #define ncr_offb(o)	(o)
33319c65091SMatthew Wilcox #define ncr_offw(o)	(o)
33419c65091SMatthew Wilcox 
33519c65091SMatthew Wilcox #endif
33619c65091SMatthew Wilcox 
33719c65091SMatthew Wilcox /*
33819c65091SMatthew Wilcox  *  If the CPU and the NCR use same endian-ness addressing,
33919c65091SMatthew Wilcox  *  no byte reordering is needed for script patching.
34019c65091SMatthew Wilcox  *  Macro cpu_to_scr() is to be used for script patching.
34119c65091SMatthew Wilcox  *  Macro scr_to_cpu() is to be used for getting a DWORD
34219c65091SMatthew Wilcox  *  from the script.
34319c65091SMatthew Wilcox  */
34419c65091SMatthew Wilcox 
34519c65091SMatthew Wilcox #if	defined(__BIG_ENDIAN) && !defined(SCSI_NCR_BIG_ENDIAN)
34619c65091SMatthew Wilcox 
34719c65091SMatthew Wilcox #define cpu_to_scr(dw)	cpu_to_le32(dw)
34819c65091SMatthew Wilcox #define scr_to_cpu(dw)	le32_to_cpu(dw)
34919c65091SMatthew Wilcox 
35019c65091SMatthew Wilcox #elif	defined(__LITTLE_ENDIAN) && defined(SCSI_NCR_BIG_ENDIAN)
35119c65091SMatthew Wilcox 
35219c65091SMatthew Wilcox #define cpu_to_scr(dw)	cpu_to_be32(dw)
35319c65091SMatthew Wilcox #define scr_to_cpu(dw)	be32_to_cpu(dw)
35419c65091SMatthew Wilcox 
35519c65091SMatthew Wilcox #else
35619c65091SMatthew Wilcox 
35719c65091SMatthew Wilcox #define cpu_to_scr(dw)	(dw)
35819c65091SMatthew Wilcox #define scr_to_cpu(dw)	(dw)
35919c65091SMatthew Wilcox 
36019c65091SMatthew Wilcox #endif
36119c65091SMatthew Wilcox 
36219c65091SMatthew Wilcox /*
36319c65091SMatthew Wilcox  *  Access to the controller chip.
36419c65091SMatthew Wilcox  *
36519c65091SMatthew Wilcox  *  If the CPU and the NCR use same endian-ness addressing,
36619c65091SMatthew Wilcox  *  no byte reordering is needed for accessing chip io
36719c65091SMatthew Wilcox  *  registers. Functions suffixed by '_raw' are assumed
36819c65091SMatthew Wilcox  *  to access the chip over the PCI without doing byte
36919c65091SMatthew Wilcox  *  reordering. Functions suffixed by '_l2b' are
37019c65091SMatthew Wilcox  *  assumed to perform little-endian to big-endian byte
37119c65091SMatthew Wilcox  *  reordering, those suffixed by '_b2l' blah, blah,
37219c65091SMatthew Wilcox  *  blah, ...
37319c65091SMatthew Wilcox  */
37419c65091SMatthew Wilcox 
37519c65091SMatthew Wilcox /*
37619c65091SMatthew Wilcox  *  MEMORY mapped IO input / output
37719c65091SMatthew Wilcox  */
37819c65091SMatthew Wilcox 
37919c65091SMatthew Wilcox #define INB_OFF(o)		readb_raw((char __iomem *)np->reg + ncr_offb(o))
38019c65091SMatthew Wilcox #define OUTB_OFF(o, val)	writeb_raw((val), (char __iomem *)np->reg + ncr_offb(o))
38119c65091SMatthew Wilcox 
38219c65091SMatthew Wilcox #if	defined(__BIG_ENDIAN) && !defined(SCSI_NCR_BIG_ENDIAN)
38319c65091SMatthew Wilcox 
38419c65091SMatthew Wilcox #define INW_OFF(o)		readw_l2b((char __iomem *)np->reg + ncr_offw(o))
38519c65091SMatthew Wilcox #define INL_OFF(o)		readl_l2b((char __iomem *)np->reg + (o))
38619c65091SMatthew Wilcox 
38719c65091SMatthew Wilcox #define OUTW_OFF(o, val)	writew_b2l((val), (char __iomem *)np->reg + ncr_offw(o))
38819c65091SMatthew Wilcox #define OUTL_OFF(o, val)	writel_b2l((val), (char __iomem *)np->reg + (o))
38919c65091SMatthew Wilcox 
39019c65091SMatthew Wilcox #elif	defined(__LITTLE_ENDIAN) && defined(SCSI_NCR_BIG_ENDIAN)
39119c65091SMatthew Wilcox 
39219c65091SMatthew Wilcox #define INW_OFF(o)		readw_b2l((char __iomem *)np->reg + ncr_offw(o))
39319c65091SMatthew Wilcox #define INL_OFF(o)		readl_b2l((char __iomem *)np->reg + (o))
39419c65091SMatthew Wilcox 
39519c65091SMatthew Wilcox #define OUTW_OFF(o, val)	writew_l2b((val), (char __iomem *)np->reg + ncr_offw(o))
39619c65091SMatthew Wilcox #define OUTL_OFF(o, val)	writel_l2b((val), (char __iomem *)np->reg + (o))
39719c65091SMatthew Wilcox 
39819c65091SMatthew Wilcox #else
39919c65091SMatthew Wilcox 
40019c65091SMatthew Wilcox #ifdef CONFIG_SCSI_NCR53C8XX_NO_WORD_TRANSFERS
40119c65091SMatthew Wilcox /* Only 8 or 32 bit transfers allowed */
40219c65091SMatthew Wilcox #define INW_OFF(o)		(readb((char __iomem *)np->reg + ncr_offw(o)) << 8 | readb((char __iomem *)np->reg + ncr_offw(o) + 1))
40319c65091SMatthew Wilcox #else
40419c65091SMatthew Wilcox #define INW_OFF(o)		readw_raw((char __iomem *)np->reg + ncr_offw(o))
40519c65091SMatthew Wilcox #endif
40619c65091SMatthew Wilcox #define INL_OFF(o)		readl_raw((char __iomem *)np->reg + (o))
40719c65091SMatthew Wilcox 
40819c65091SMatthew Wilcox #ifdef CONFIG_SCSI_NCR53C8XX_NO_WORD_TRANSFERS
40919c65091SMatthew Wilcox /* Only 8 or 32 bit transfers allowed */
41019c65091SMatthew Wilcox #define OUTW_OFF(o, val)	do { writeb((char)((val) >> 8), (char __iomem *)np->reg + ncr_offw(o)); writeb((char)(val), (char __iomem *)np->reg + ncr_offw(o) + 1); } while (0)
41119c65091SMatthew Wilcox #else
41219c65091SMatthew Wilcox #define OUTW_OFF(o, val)	writew_raw((val), (char __iomem *)np->reg + ncr_offw(o))
41319c65091SMatthew Wilcox #endif
41419c65091SMatthew Wilcox #define OUTL_OFF(o, val)	writel_raw((val), (char __iomem *)np->reg + (o))
41519c65091SMatthew Wilcox 
41619c65091SMatthew Wilcox #endif
41719c65091SMatthew Wilcox 
41819c65091SMatthew Wilcox #define INB(r)		INB_OFF (offsetof(struct ncr_reg,r))
41919c65091SMatthew Wilcox #define INW(r)		INW_OFF (offsetof(struct ncr_reg,r))
42019c65091SMatthew Wilcox #define INL(r)		INL_OFF (offsetof(struct ncr_reg,r))
42119c65091SMatthew Wilcox 
42219c65091SMatthew Wilcox #define OUTB(r, val)	OUTB_OFF (offsetof(struct ncr_reg,r), (val))
42319c65091SMatthew Wilcox #define OUTW(r, val)	OUTW_OFF (offsetof(struct ncr_reg,r), (val))
42419c65091SMatthew Wilcox #define OUTL(r, val)	OUTL_OFF (offsetof(struct ncr_reg,r), (val))
42519c65091SMatthew Wilcox 
42619c65091SMatthew Wilcox /*
42719c65091SMatthew Wilcox  *  Set bit field ON, OFF
42819c65091SMatthew Wilcox  */
42919c65091SMatthew Wilcox 
43019c65091SMatthew Wilcox #define OUTONB(r, m)	OUTB(r, INB(r) | (m))
43119c65091SMatthew Wilcox #define OUTOFFB(r, m)	OUTB(r, INB(r) & ~(m))
43219c65091SMatthew Wilcox #define OUTONW(r, m)	OUTW(r, INW(r) | (m))
43319c65091SMatthew Wilcox #define OUTOFFW(r, m)	OUTW(r, INW(r) & ~(m))
43419c65091SMatthew Wilcox #define OUTONL(r, m)	OUTL(r, INL(r) | (m))
43519c65091SMatthew Wilcox #define OUTOFFL(r, m)	OUTL(r, INL(r) & ~(m))
43619c65091SMatthew Wilcox 
43719c65091SMatthew Wilcox /*
43819c65091SMatthew Wilcox  *  We normally want the chip to have a consistent view
43919c65091SMatthew Wilcox  *  of driver internal data structures when we restart it.
44019c65091SMatthew Wilcox  *  Thus these macros.
44119c65091SMatthew Wilcox  */
44219c65091SMatthew Wilcox #define OUTL_DSP(v)				\
44319c65091SMatthew Wilcox 	do {					\
44419c65091SMatthew Wilcox 		MEMORY_BARRIER();		\
44519c65091SMatthew Wilcox 		OUTL (nc_dsp, (v));		\
44619c65091SMatthew Wilcox 	} while (0)
44719c65091SMatthew Wilcox 
44819c65091SMatthew Wilcox #define OUTONB_STD()				\
44919c65091SMatthew Wilcox 	do {					\
45019c65091SMatthew Wilcox 		MEMORY_BARRIER();		\
45119c65091SMatthew Wilcox 		OUTONB (nc_dcntl, (STD|NOCOM));	\
45219c65091SMatthew Wilcox 	} while (0)
45319c65091SMatthew Wilcox 
45419c65091SMatthew Wilcox 
45519c65091SMatthew Wilcox /*
45619c65091SMatthew Wilcox **   NCR53C8XX devices features table.
45719c65091SMatthew Wilcox */
45819c65091SMatthew Wilcox struct ncr_chip {
45919c65091SMatthew Wilcox 	unsigned short	revision_id;
46019c65091SMatthew Wilcox 	unsigned char	burst_max;	/* log-base-2 of max burst */
46119c65091SMatthew Wilcox 	unsigned char	offset_max;
46219c65091SMatthew Wilcox 	unsigned char	nr_divisor;
46319c65091SMatthew Wilcox 	unsigned int	features;
46419c65091SMatthew Wilcox #define FE_LED0		(1<<0)
46519c65091SMatthew Wilcox #define FE_WIDE		(1<<1)    /* Wide data transfers */
46619c65091SMatthew Wilcox #define FE_ULTRA	(1<<2)	  /* Ultra speed 20Mtrans/sec */
46719c65091SMatthew Wilcox #define FE_DBLR		(1<<4)	  /* Clock doubler present */
46819c65091SMatthew Wilcox #define FE_QUAD		(1<<5)	  /* Clock quadrupler present */
46919c65091SMatthew Wilcox #define FE_ERL		(1<<6)    /* Enable read line */
47019c65091SMatthew Wilcox #define FE_CLSE		(1<<7)    /* Cache line size enable */
47119c65091SMatthew Wilcox #define FE_WRIE		(1<<8)    /* Write & Invalidate enable */
47219c65091SMatthew Wilcox #define FE_ERMP		(1<<9)    /* Enable read multiple */
47319c65091SMatthew Wilcox #define FE_BOF		(1<<10)   /* Burst opcode fetch */
47419c65091SMatthew Wilcox #define FE_DFS		(1<<11)   /* DMA fifo size */
47519c65091SMatthew Wilcox #define FE_PFEN		(1<<12)   /* Prefetch enable */
47619c65091SMatthew Wilcox #define FE_LDSTR	(1<<13)   /* Load/Store supported */
47719c65091SMatthew Wilcox #define FE_RAM		(1<<14)   /* On chip RAM present */
47819c65091SMatthew Wilcox #define FE_VARCLK	(1<<15)   /* SCSI clock may vary */
47919c65091SMatthew Wilcox #define FE_RAM8K	(1<<16)   /* On chip RAM sized 8Kb */
48019c65091SMatthew Wilcox #define FE_64BIT	(1<<17)   /* Have a 64-bit PCI interface */
48119c65091SMatthew Wilcox #define FE_IO256	(1<<18)   /* Requires full 256 bytes in PCI space */
48219c65091SMatthew Wilcox #define FE_NOPM		(1<<19)   /* Scripts handles phase mismatch */
48319c65091SMatthew Wilcox #define FE_LEDC		(1<<20)   /* Hardware control of LED */
48419c65091SMatthew Wilcox #define FE_DIFF		(1<<21)   /* Support Differential SCSI */
48519c65091SMatthew Wilcox #define FE_66MHZ 	(1<<23)   /* 66MHz PCI Support */
48619c65091SMatthew Wilcox #define FE_DAC	 	(1<<24)   /* Support DAC cycles (64 bit addressing) */
48719c65091SMatthew Wilcox #define FE_ISTAT1 	(1<<25)   /* Have ISTAT1, MBOX0, MBOX1 registers */
48819c65091SMatthew Wilcox #define FE_DAC_IN_USE	(1<<26)	  /* Platform does DAC cycles */
48919c65091SMatthew Wilcox #define FE_EHP		(1<<27)   /* 720: Even host parity */
49019c65091SMatthew Wilcox #define FE_MUX		(1<<28)   /* 720: Multiplexed bus */
49119c65091SMatthew Wilcox #define FE_EA		(1<<29)   /* 720: Enable Ack */
49219c65091SMatthew Wilcox 
49319c65091SMatthew Wilcox #define FE_CACHE_SET	(FE_ERL|FE_CLSE|FE_WRIE|FE_ERMP)
49419c65091SMatthew Wilcox #define FE_SCSI_SET	(FE_WIDE|FE_ULTRA|FE_DBLR|FE_QUAD|F_CLK80)
49519c65091SMatthew Wilcox #define FE_SPECIAL_SET	(FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM)
49619c65091SMatthew Wilcox };
49719c65091SMatthew Wilcox 
49819c65091SMatthew Wilcox 
49919c65091SMatthew Wilcox /*
50019c65091SMatthew Wilcox **	Driver setup structure.
50119c65091SMatthew Wilcox **
50219c65091SMatthew Wilcox **	This structure is initialized from linux config options.
50319c65091SMatthew Wilcox **	It can be overridden at boot-up by the boot command line.
50419c65091SMatthew Wilcox */
50519c65091SMatthew Wilcox #define SCSI_NCR_MAX_EXCLUDES 8
50619c65091SMatthew Wilcox struct ncr_driver_setup {
50719c65091SMatthew Wilcox 	u8	master_parity;
50819c65091SMatthew Wilcox 	u8	scsi_parity;
50919c65091SMatthew Wilcox 	u8	disconnection;
51019c65091SMatthew Wilcox 	u8	special_features;
51119c65091SMatthew Wilcox 	u8	force_sync_nego;
51219c65091SMatthew Wilcox 	u8	reverse_probe;
51319c65091SMatthew Wilcox 	u8	pci_fix_up;
51419c65091SMatthew Wilcox 	u8	use_nvram;
51519c65091SMatthew Wilcox 	u8	verbose;
51619c65091SMatthew Wilcox 	u8	default_tags;
51719c65091SMatthew Wilcox 	u16	default_sync;
51819c65091SMatthew Wilcox 	u16	debug;
51919c65091SMatthew Wilcox 	u8	burst_max;
52019c65091SMatthew Wilcox 	u8	led_pin;
52119c65091SMatthew Wilcox 	u8	max_wide;
52219c65091SMatthew Wilcox 	u8	settle_delay;
52319c65091SMatthew Wilcox 	u8	diff_support;
52419c65091SMatthew Wilcox 	u8	irqm;
52519c65091SMatthew Wilcox 	u8	bus_check;
52619c65091SMatthew Wilcox 	u8	optimize;
52719c65091SMatthew Wilcox 	u8	recovery;
52819c65091SMatthew Wilcox 	u8	host_id;
52919c65091SMatthew Wilcox 	u16	iarb;
53019c65091SMatthew Wilcox 	u32	excludes[SCSI_NCR_MAX_EXCLUDES];
53119c65091SMatthew Wilcox 	char	tag_ctrl[100];
53219c65091SMatthew Wilcox };
53319c65091SMatthew Wilcox 
53419c65091SMatthew Wilcox /*
53519c65091SMatthew Wilcox **	Initial setup.
5360779bf2dSMatt LaPlante **	Can be overridden at startup by a command line.
53719c65091SMatthew Wilcox */
53819c65091SMatthew Wilcox #define SCSI_NCR_DRIVER_SETUP			\
53919c65091SMatthew Wilcox {						\
54019c65091SMatthew Wilcox 	SCSI_NCR_SETUP_MASTER_PARITY,		\
54119c65091SMatthew Wilcox 	SCSI_NCR_SETUP_SCSI_PARITY,		\
54219c65091SMatthew Wilcox 	SCSI_NCR_SETUP_DISCONNECTION,		\
54319c65091SMatthew Wilcox 	SCSI_NCR_SETUP_SPECIAL_FEATURES,	\
54419c65091SMatthew Wilcox 	SCSI_NCR_SETUP_FORCE_SYNC_NEGO,		\
54519c65091SMatthew Wilcox 	0,					\
54619c65091SMatthew Wilcox 	0,					\
54719c65091SMatthew Wilcox 	1,					\
54819c65091SMatthew Wilcox 	0,					\
54919c65091SMatthew Wilcox 	SCSI_NCR_SETUP_DEFAULT_TAGS,		\
55019c65091SMatthew Wilcox 	SCSI_NCR_SETUP_DEFAULT_SYNC,		\
55119c65091SMatthew Wilcox 	0x00,					\
55219c65091SMatthew Wilcox 	7,					\
55319c65091SMatthew Wilcox 	0,					\
55419c65091SMatthew Wilcox 	1,					\
55519c65091SMatthew Wilcox 	SCSI_NCR_SETUP_SETTLE_TIME,		\
55619c65091SMatthew Wilcox 	0,					\
55719c65091SMatthew Wilcox 	0,					\
55819c65091SMatthew Wilcox 	1,					\
55919c65091SMatthew Wilcox 	0,					\
56019c65091SMatthew Wilcox 	0,					\
56119c65091SMatthew Wilcox 	255,					\
56219c65091SMatthew Wilcox 	0x00					\
56319c65091SMatthew Wilcox }
56419c65091SMatthew Wilcox 
56519c65091SMatthew Wilcox /*
56619c65091SMatthew Wilcox **	Boot fail safe setup.
56719c65091SMatthew Wilcox **	Override initial setup from boot command line:
56819c65091SMatthew Wilcox **	ncr53c8xx=safe:y
56919c65091SMatthew Wilcox */
57019c65091SMatthew Wilcox #define SCSI_NCR_DRIVER_SAFE_SETUP		\
57119c65091SMatthew Wilcox {						\
57219c65091SMatthew Wilcox 	0,					\
57319c65091SMatthew Wilcox 	1,					\
57419c65091SMatthew Wilcox 	0,					\
57519c65091SMatthew Wilcox 	0,					\
57619c65091SMatthew Wilcox 	0,					\
57719c65091SMatthew Wilcox 	0,					\
57819c65091SMatthew Wilcox 	0,					\
57919c65091SMatthew Wilcox 	1,					\
58019c65091SMatthew Wilcox 	2,					\
58119c65091SMatthew Wilcox 	0,					\
58219c65091SMatthew Wilcox 	255,					\
58319c65091SMatthew Wilcox 	0x00,					\
58419c65091SMatthew Wilcox 	255,					\
58519c65091SMatthew Wilcox 	0,					\
58619c65091SMatthew Wilcox 	0,					\
58719c65091SMatthew Wilcox 	10,					\
58819c65091SMatthew Wilcox 	1,					\
58919c65091SMatthew Wilcox 	1,					\
59019c65091SMatthew Wilcox 	1,					\
59119c65091SMatthew Wilcox 	0,					\
59219c65091SMatthew Wilcox 	0,					\
59319c65091SMatthew Wilcox 	255					\
59419c65091SMatthew Wilcox }
59519c65091SMatthew Wilcox 
59619c65091SMatthew Wilcox /**************** ORIGINAL CONTENT of ncrreg.h from FreeBSD ******************/
59719c65091SMatthew Wilcox 
59819c65091SMatthew Wilcox /*-----------------------------------------------------------------
59919c65091SMatthew Wilcox **
60019c65091SMatthew Wilcox **	The ncr 53c810 register structure.
60119c65091SMatthew Wilcox **
60219c65091SMatthew Wilcox **-----------------------------------------------------------------
60319c65091SMatthew Wilcox */
60419c65091SMatthew Wilcox 
60519c65091SMatthew Wilcox struct ncr_reg {
60619c65091SMatthew Wilcox /*00*/  u8	nc_scntl0;    /* full arb., ena parity, par->ATN  */
60719c65091SMatthew Wilcox 
60819c65091SMatthew Wilcox /*01*/  u8	nc_scntl1;    /* no reset                         */
60919c65091SMatthew Wilcox         #define   ISCON   0x10  /* connected to scsi		    */
61019c65091SMatthew Wilcox         #define   CRST    0x08  /* force reset                      */
61119c65091SMatthew Wilcox         #define   IARB    0x02  /* immediate arbitration            */
61219c65091SMatthew Wilcox 
61319c65091SMatthew Wilcox /*02*/  u8	nc_scntl2;    /* no disconnect expected           */
61419c65091SMatthew Wilcox 	#define   SDU     0x80  /* cmd: disconnect will raise error */
61519c65091SMatthew Wilcox 	#define   CHM     0x40  /* sta: chained mode                */
61619c65091SMatthew Wilcox 	#define   WSS     0x08  /* sta: wide scsi send           [W]*/
61719c65091SMatthew Wilcox 	#define   WSR     0x01  /* sta: wide scsi received       [W]*/
61819c65091SMatthew Wilcox 
61919c65091SMatthew Wilcox /*03*/  u8	nc_scntl3;    /* cnf system clock dependent       */
62019c65091SMatthew Wilcox 	#define   EWS     0x08  /* cmd: enable wide scsi         [W]*/
62119c65091SMatthew Wilcox 	#define   ULTRA   0x80  /* cmd: ULTRA enable                */
62219c65091SMatthew Wilcox 				/* bits 0-2, 7 rsvd for C1010       */
62319c65091SMatthew Wilcox 
62419c65091SMatthew Wilcox /*04*/  u8	nc_scid;	/* cnf host adapter scsi address    */
62519c65091SMatthew Wilcox 	#define   RRE     0x40  /* r/w:e enable response to resel.  */
62619c65091SMatthew Wilcox 	#define   SRE     0x20  /* r/w:e enable response to select  */
62719c65091SMatthew Wilcox 
62819c65091SMatthew Wilcox /*05*/  u8	nc_sxfer;	/* ### Sync speed and count         */
62919c65091SMatthew Wilcox 				/* bits 6-7 rsvd for C1010          */
63019c65091SMatthew Wilcox 
63119c65091SMatthew Wilcox /*06*/  u8	nc_sdid;	/* ### Destination-ID               */
63219c65091SMatthew Wilcox 
63319c65091SMatthew Wilcox /*07*/  u8	nc_gpreg;	/* ??? IO-Pins                      */
63419c65091SMatthew Wilcox 
63519c65091SMatthew Wilcox /*08*/  u8	nc_sfbr;	/* ### First byte in phase          */
63619c65091SMatthew Wilcox 
63719c65091SMatthew Wilcox /*09*/  u8	nc_socl;
63819c65091SMatthew Wilcox 	#define   CREQ	  0x80	/* r/w: SCSI-REQ                    */
63919c65091SMatthew Wilcox 	#define   CACK	  0x40	/* r/w: SCSI-ACK                    */
64019c65091SMatthew Wilcox 	#define   CBSY	  0x20	/* r/w: SCSI-BSY                    */
64119c65091SMatthew Wilcox 	#define   CSEL	  0x10	/* r/w: SCSI-SEL                    */
64219c65091SMatthew Wilcox 	#define   CATN	  0x08	/* r/w: SCSI-ATN                    */
64319c65091SMatthew Wilcox 	#define   CMSG	  0x04	/* r/w: SCSI-MSG                    */
64419c65091SMatthew Wilcox 	#define   CC_D	  0x02	/* r/w: SCSI-C_D                    */
64519c65091SMatthew Wilcox 	#define   CI_O	  0x01	/* r/w: SCSI-I_O                    */
64619c65091SMatthew Wilcox 
64719c65091SMatthew Wilcox /*0a*/  u8	nc_ssid;
64819c65091SMatthew Wilcox 
64919c65091SMatthew Wilcox /*0b*/  u8	nc_sbcl;
65019c65091SMatthew Wilcox 
65119c65091SMatthew Wilcox /*0c*/  u8	nc_dstat;
65219c65091SMatthew Wilcox         #define   DFE     0x80  /* sta: dma fifo empty              */
65319c65091SMatthew Wilcox         #define   MDPE    0x40  /* int: master data parity error    */
65419c65091SMatthew Wilcox         #define   BF      0x20  /* int: script: bus fault           */
65519c65091SMatthew Wilcox         #define   ABRT    0x10  /* int: script: command aborted     */
65619c65091SMatthew Wilcox         #define   SSI     0x08  /* int: script: single step         */
65719c65091SMatthew Wilcox         #define   SIR     0x04  /* int: script: interrupt instruct. */
65819c65091SMatthew Wilcox         #define   IID     0x01  /* int: script: illegal instruct.   */
65919c65091SMatthew Wilcox 
66019c65091SMatthew Wilcox /*0d*/  u8	nc_sstat0;
66119c65091SMatthew Wilcox         #define   ILF     0x80  /* sta: data in SIDL register lsb   */
66219c65091SMatthew Wilcox         #define   ORF     0x40  /* sta: data in SODR register lsb   */
66319c65091SMatthew Wilcox         #define   OLF     0x20  /* sta: data in SODL register lsb   */
66419c65091SMatthew Wilcox         #define   AIP     0x10  /* sta: arbitration in progress     */
66519c65091SMatthew Wilcox         #define   LOA     0x08  /* sta: arbitration lost            */
66619c65091SMatthew Wilcox         #define   WOA     0x04  /* sta: arbitration won             */
66719c65091SMatthew Wilcox         #define   IRST    0x02  /* sta: scsi reset signal           */
66819c65091SMatthew Wilcox         #define   SDP     0x01  /* sta: scsi parity signal          */
66919c65091SMatthew Wilcox 
67019c65091SMatthew Wilcox /*0e*/  u8	nc_sstat1;
67119c65091SMatthew Wilcox 	#define   FF3210  0xf0	/* sta: bytes in the scsi fifo      */
67219c65091SMatthew Wilcox 
67319c65091SMatthew Wilcox /*0f*/  u8	nc_sstat2;
67419c65091SMatthew Wilcox         #define   ILF1    0x80  /* sta: data in SIDL register msb[W]*/
67519c65091SMatthew Wilcox         #define   ORF1    0x40  /* sta: data in SODR register msb[W]*/
67619c65091SMatthew Wilcox         #define   OLF1    0x20  /* sta: data in SODL register msb[W]*/
67719c65091SMatthew Wilcox         #define   DM      0x04  /* sta: DIFFSENS mismatch (895/6 only) */
67819c65091SMatthew Wilcox         #define   LDSC    0x02  /* sta: disconnect & reconnect      */
67919c65091SMatthew Wilcox 
68019c65091SMatthew Wilcox /*10*/  u8	nc_dsa;	/* --> Base page                    */
68119c65091SMatthew Wilcox /*11*/  u8	nc_dsa1;
68219c65091SMatthew Wilcox /*12*/  u8	nc_dsa2;
68319c65091SMatthew Wilcox /*13*/  u8	nc_dsa3;
68419c65091SMatthew Wilcox 
68519c65091SMatthew Wilcox /*14*/  u8	nc_istat;	/* --> Main Command and status      */
68619c65091SMatthew Wilcox         #define   CABRT   0x80  /* cmd: abort current operation     */
68719c65091SMatthew Wilcox         #define   SRST    0x40  /* mod: reset chip                  */
68819c65091SMatthew Wilcox         #define   SIGP    0x20  /* r/w: message from host to ncr    */
68919c65091SMatthew Wilcox         #define   SEM     0x10  /* r/w: message between host + ncr  */
69019c65091SMatthew Wilcox         #define   CON     0x08  /* sta: connected to scsi           */
69119c65091SMatthew Wilcox         #define   INTF    0x04  /* sta: int on the fly (reset by wr)*/
69219c65091SMatthew Wilcox         #define   SIP     0x02  /* sta: scsi-interrupt              */
69319c65091SMatthew Wilcox         #define   DIP     0x01  /* sta: host/script interrupt       */
69419c65091SMatthew Wilcox 
69519c65091SMatthew Wilcox /*15*/  u8	nc_istat1;	/* 896 and later cores only */
69619c65091SMatthew Wilcox         #define   FLSH    0x04  /* sta: chip is flushing            */
69719c65091SMatthew Wilcox         #define   SRUN    0x02  /* sta: scripts are running         */
69819c65091SMatthew Wilcox         #define   SIRQD   0x01  /* r/w: disable INT pin             */
69919c65091SMatthew Wilcox 
70019c65091SMatthew Wilcox /*16*/  u8	nc_mbox0;	/* 896 and later cores only */
70119c65091SMatthew Wilcox /*17*/  u8	nc_mbox1;	/* 896 and later cores only */
70219c65091SMatthew Wilcox 
70319c65091SMatthew Wilcox /*18*/	u8	nc_ctest0;
70419c65091SMatthew Wilcox 	#define   EHP     0x04	/* 720 even host parity             */
70519c65091SMatthew Wilcox /*19*/  u8	nc_ctest1;
70619c65091SMatthew Wilcox 
70719c65091SMatthew Wilcox /*1a*/  u8	nc_ctest2;
70819c65091SMatthew Wilcox 	#define   CSIGP   0x40
70919c65091SMatthew Wilcox 				/* bits 0-2,7 rsvd for C1010        */
71019c65091SMatthew Wilcox 
71119c65091SMatthew Wilcox /*1b*/  u8	nc_ctest3;
71219c65091SMatthew Wilcox 	#define   FLF     0x08  /* cmd: flush dma fifo              */
71319c65091SMatthew Wilcox 	#define   CLF	  0x04	/* cmd: clear dma fifo		    */
71419c65091SMatthew Wilcox 	#define   FM      0x02  /* mod: fetch pin mode              */
71519c65091SMatthew Wilcox 	#define   WRIE    0x01  /* mod: write and invalidate enable */
71619c65091SMatthew Wilcox 				/* bits 4-7 rsvd for C1010          */
71719c65091SMatthew Wilcox 
71819c65091SMatthew Wilcox /*1c*/  u32    nc_temp;	/* ### Temporary stack              */
71919c65091SMatthew Wilcox 
72019c65091SMatthew Wilcox /*20*/	u8	nc_dfifo;
72119c65091SMatthew Wilcox /*21*/  u8	nc_ctest4;
72219c65091SMatthew Wilcox 	#define   MUX     0x80  /* 720 host bus multiplex mode      */
72319c65091SMatthew Wilcox 	#define   BDIS    0x80  /* mod: burst disable               */
72419c65091SMatthew Wilcox 	#define   MPEE    0x08  /* mod: master parity error enable  */
72519c65091SMatthew Wilcox 
72619c65091SMatthew Wilcox /*22*/  u8	nc_ctest5;
72719c65091SMatthew Wilcox 	#define   DFS     0x20  /* mod: dma fifo size               */
72819c65091SMatthew Wilcox 				/* bits 0-1, 3-7 rsvd for C1010          */
72919c65091SMatthew Wilcox /*23*/  u8	nc_ctest6;
73019c65091SMatthew Wilcox 
73119c65091SMatthew Wilcox /*24*/  u32    nc_dbc;	/* ### Byte count and command       */
73219c65091SMatthew Wilcox /*28*/  u32    nc_dnad;	/* ### Next command register        */
73319c65091SMatthew Wilcox /*2c*/  u32    nc_dsp;	/* --> Script Pointer               */
73419c65091SMatthew Wilcox /*30*/  u32    nc_dsps;	/* --> Script pointer save/opcode#2 */
73519c65091SMatthew Wilcox 
73619c65091SMatthew Wilcox /*34*/  u8	nc_scratcha;  /* Temporary register a            */
73719c65091SMatthew Wilcox /*35*/  u8	nc_scratcha1;
73819c65091SMatthew Wilcox /*36*/  u8	nc_scratcha2;
73919c65091SMatthew Wilcox /*37*/  u8	nc_scratcha3;
74019c65091SMatthew Wilcox 
74119c65091SMatthew Wilcox /*38*/  u8	nc_dmode;
74219c65091SMatthew Wilcox 	#define   BL_2    0x80  /* mod: burst length shift value +2 */
74319c65091SMatthew Wilcox 	#define   BL_1    0x40  /* mod: burst length shift value +1 */
74419c65091SMatthew Wilcox 	#define   ERL     0x08  /* mod: enable read line            */
74519c65091SMatthew Wilcox 	#define   ERMP    0x04  /* mod: enable read multiple        */
74619c65091SMatthew Wilcox 	#define   BOF     0x02  /* mod: burst op code fetch         */
74719c65091SMatthew Wilcox 
74819c65091SMatthew Wilcox /*39*/  u8	nc_dien;
74919c65091SMatthew Wilcox /*3a*/  u8	nc_sbr;
75019c65091SMatthew Wilcox 
75119c65091SMatthew Wilcox /*3b*/  u8	nc_dcntl;	/* --> Script execution control     */
75219c65091SMatthew Wilcox 	#define   CLSE    0x80  /* mod: cache line size enable      */
75319c65091SMatthew Wilcox 	#define   PFF     0x40  /* cmd: pre-fetch flush             */
75419c65091SMatthew Wilcox 	#define   PFEN    0x20  /* mod: pre-fetch enable            */
75519c65091SMatthew Wilcox 	#define   EA      0x20  /* mod: 720 enable-ack              */
75619c65091SMatthew Wilcox 	#define   SSM     0x10  /* mod: single step mode            */
75719c65091SMatthew Wilcox 	#define   IRQM    0x08  /* mod: irq mode (1 = totem pole !) */
75819c65091SMatthew Wilcox 	#define   STD     0x04  /* cmd: start dma mode              */
75919c65091SMatthew Wilcox 	#define   IRQD    0x02  /* mod: irq disable                 */
76019c65091SMatthew Wilcox  	#define	  NOCOM   0x01	/* cmd: protect sfbr while reselect */
76119c65091SMatthew Wilcox 				/* bits 0-1 rsvd for C1010          */
76219c65091SMatthew Wilcox 
76319c65091SMatthew Wilcox /*3c*/  u32	nc_adder;
76419c65091SMatthew Wilcox 
76519c65091SMatthew Wilcox /*40*/  u16	nc_sien;	/* -->: interrupt enable            */
76619c65091SMatthew Wilcox /*42*/  u16	nc_sist;	/* <--: interrupt status            */
76719c65091SMatthew Wilcox         #define   SBMC    0x1000/* sta: SCSI Bus Mode Change (895/6 only) */
76819c65091SMatthew Wilcox         #define   STO     0x0400/* sta: timeout (select)            */
76919c65091SMatthew Wilcox         #define   GEN     0x0200/* sta: timeout (general)           */
77019c65091SMatthew Wilcox         #define   HTH     0x0100/* sta: timeout (handshake)         */
77119c65091SMatthew Wilcox         #define   MA      0x80  /* sta: phase mismatch              */
77219c65091SMatthew Wilcox         #define   CMP     0x40  /* sta: arbitration complete        */
77319c65091SMatthew Wilcox         #define   SEL     0x20  /* sta: selected by another device  */
77419c65091SMatthew Wilcox         #define   RSL     0x10  /* sta: reselected by another device*/
77519c65091SMatthew Wilcox         #define   SGE     0x08  /* sta: gross error (over/underflow)*/
77619c65091SMatthew Wilcox         #define   UDC     0x04  /* sta: unexpected disconnect       */
77719c65091SMatthew Wilcox         #define   RST     0x02  /* sta: scsi bus reset detected     */
77819c65091SMatthew Wilcox         #define   PAR     0x01  /* sta: scsi parity error           */
77919c65091SMatthew Wilcox 
78019c65091SMatthew Wilcox /*44*/  u8	nc_slpar;
78119c65091SMatthew Wilcox /*45*/  u8	nc_swide;
78219c65091SMatthew Wilcox /*46*/  u8	nc_macntl;
78319c65091SMatthew Wilcox /*47*/  u8	nc_gpcntl;
78419c65091SMatthew Wilcox /*48*/  u8	nc_stime0;    /* cmd: timeout for select&handshake*/
78519c65091SMatthew Wilcox /*49*/  u8	nc_stime1;    /* cmd: timeout user defined        */
78619c65091SMatthew Wilcox /*4a*/  u16   nc_respid;    /* sta: Reselect-IDs                */
78719c65091SMatthew Wilcox 
78819c65091SMatthew Wilcox /*4c*/  u8	nc_stest0;
78919c65091SMatthew Wilcox 
79019c65091SMatthew Wilcox /*4d*/  u8	nc_stest1;
79119c65091SMatthew Wilcox 	#define   SCLK    0x80	/* Use the PCI clock as SCSI clock	*/
79219c65091SMatthew Wilcox 	#define   DBLEN   0x08	/* clock doubler running		*/
79319c65091SMatthew Wilcox 	#define   DBLSEL  0x04	/* clock doubler selected		*/
79419c65091SMatthew Wilcox 
79519c65091SMatthew Wilcox 
79619c65091SMatthew Wilcox /*4e*/  u8	nc_stest2;
79719c65091SMatthew Wilcox 	#define   ROF     0x40	/* reset scsi offset (after gross error!) */
79819c65091SMatthew Wilcox 	#define   DIF     0x20  /* 720 SCSI differential mode             */
79919c65091SMatthew Wilcox 	#define   EXT     0x02  /* extended filtering                     */
80019c65091SMatthew Wilcox 
80119c65091SMatthew Wilcox /*4f*/  u8	nc_stest3;
80219c65091SMatthew Wilcox 	#define   TE     0x80	/* c: tolerAnt enable */
80319c65091SMatthew Wilcox 	#define   HSC    0x20	/* c: Halt SCSI Clock */
80419c65091SMatthew Wilcox 	#define   CSF    0x02	/* c: clear scsi fifo */
80519c65091SMatthew Wilcox 
80619c65091SMatthew Wilcox /*50*/  u16   nc_sidl;	/* Lowlevel: latched from scsi data */
80719c65091SMatthew Wilcox /*52*/  u8	nc_stest4;
80819c65091SMatthew Wilcox 	#define   SMODE  0xc0	/* SCSI bus mode      (895/6 only) */
80919c65091SMatthew Wilcox 	#define    SMODE_HVD 0x40	/* High Voltage Differential       */
81019c65091SMatthew Wilcox 	#define    SMODE_SE  0x80	/* Single Ended                    */
81119c65091SMatthew Wilcox 	#define    SMODE_LVD 0xc0	/* Low Voltage Differential        */
81219c65091SMatthew Wilcox 	#define   LCKFRQ 0x20	/* Frequency Lock (895/6 only)     */
81319c65091SMatthew Wilcox 				/* bits 0-5 rsvd for C1010          */
81419c65091SMatthew Wilcox 
81519c65091SMatthew Wilcox /*53*/  u8	nc_53_;
81619c65091SMatthew Wilcox /*54*/  u16	nc_sodl;	/* Lowlevel: data out to scsi data  */
81719c65091SMatthew Wilcox /*56*/	u8	nc_ccntl0;	/* Chip Control 0 (896)             */
81819c65091SMatthew Wilcox 	#define   ENPMJ  0x80	/* Enable Phase Mismatch Jump       */
81919c65091SMatthew Wilcox 	#define   PMJCTL 0x40	/* Phase Mismatch Jump Control      */
82019c65091SMatthew Wilcox 	#define   ENNDJ  0x20	/* Enable Non Data PM Jump          */
82119c65091SMatthew Wilcox 	#define   DISFC  0x10	/* Disable Auto FIFO Clear          */
82219c65091SMatthew Wilcox 	#define   DILS   0x02	/* Disable Internal Load/Store      */
82319c65091SMatthew Wilcox 	#define   DPR    0x01	/* Disable Pipe Req                 */
82419c65091SMatthew Wilcox 
82519c65091SMatthew Wilcox /*57*/	u8	nc_ccntl1;	/* Chip Control 1 (896)             */
82619c65091SMatthew Wilcox 	#define   ZMOD   0x80	/* High Impedance Mode              */
82719c65091SMatthew Wilcox 	#define	  DIC	 0x10	/* Disable Internal Cycles	    */
82819c65091SMatthew Wilcox 	#define   DDAC   0x08	/* Disable Dual Address Cycle       */
82919c65091SMatthew Wilcox 	#define   XTIMOD 0x04	/* 64-bit Table Ind. Indexing Mode  */
83019c65091SMatthew Wilcox 	#define   EXTIBMV 0x02	/* Enable 64-bit Table Ind. BMOV    */
83119c65091SMatthew Wilcox 	#define   EXDBMV 0x01	/* Enable 64-bit Direct BMOV        */
83219c65091SMatthew Wilcox 
83319c65091SMatthew Wilcox /*58*/  u16	nc_sbdl;	/* Lowlevel: data from scsi data    */
83419c65091SMatthew Wilcox /*5a*/  u16	nc_5a_;
83519c65091SMatthew Wilcox 
83619c65091SMatthew Wilcox /*5c*/  u8	nc_scr0;	/* Working register B               */
83719c65091SMatthew Wilcox /*5d*/  u8	nc_scr1;	/*                                  */
83819c65091SMatthew Wilcox /*5e*/  u8	nc_scr2;	/*                                  */
83919c65091SMatthew Wilcox /*5f*/  u8	nc_scr3;	/*                                  */
84019c65091SMatthew Wilcox 
84119c65091SMatthew Wilcox /*60*/  u8	nc_scrx[64];	/* Working register C-R             */
84219c65091SMatthew Wilcox /*a0*/	u32	nc_mmrs;	/* Memory Move Read Selector        */
84319c65091SMatthew Wilcox /*a4*/	u32	nc_mmws;	/* Memory Move Write Selector       */
84419c65091SMatthew Wilcox /*a8*/	u32	nc_sfs;		/* Script Fetch Selector            */
84519c65091SMatthew Wilcox /*ac*/	u32	nc_drs;		/* DSA Relative Selector            */
84619c65091SMatthew Wilcox /*b0*/	u32	nc_sbms;	/* Static Block Move Selector       */
84719c65091SMatthew Wilcox /*b4*/	u32	nc_dbms;	/* Dynamic Block Move Selector      */
84819c65091SMatthew Wilcox /*b8*/	u32	nc_dnad64;	/* DMA Next Address 64              */
84919c65091SMatthew Wilcox /*bc*/	u16	nc_scntl4;	/* C1010 only                       */
85019c65091SMatthew Wilcox 	#define   U3EN   0x80	/* Enable Ultra 3                   */
85119c65091SMatthew Wilcox 	#define   AIPEN	 0x40   /* Allow check upper byte lanes     */
85219c65091SMatthew Wilcox 	#define   XCLKH_DT 0x08 /* Extra clock of data hold on DT
85319c65091SMatthew Wilcox 					transfer edge	            */
85419c65091SMatthew Wilcox 	#define   XCLKH_ST 0x04 /* Extra clock of data hold on ST
85519c65091SMatthew Wilcox 					transfer edge	            */
85619c65091SMatthew Wilcox 
85719c65091SMatthew Wilcox /*be*/  u8	nc_aipcntl0;	/* Epat Control 1 C1010 only        */
85819c65091SMatthew Wilcox /*bf*/  u8	nc_aipcntl1;	/* AIP Control C1010_66 Only        */
85919c65091SMatthew Wilcox 
86019c65091SMatthew Wilcox /*c0*/	u32	nc_pmjad1;	/* Phase Mismatch Jump Address 1    */
86119c65091SMatthew Wilcox /*c4*/	u32	nc_pmjad2;	/* Phase Mismatch Jump Address 2    */
86219c65091SMatthew Wilcox /*c8*/	u8	nc_rbc;		/* Remaining Byte Count             */
86319c65091SMatthew Wilcox /*c9*/	u8	nc_rbc1;	/*                                  */
86419c65091SMatthew Wilcox /*ca*/	u8	nc_rbc2;	/*                                  */
86519c65091SMatthew Wilcox /*cb*/	u8	nc_rbc3;	/*                                  */
86619c65091SMatthew Wilcox 
86719c65091SMatthew Wilcox /*cc*/	u8	nc_ua;		/* Updated Address                  */
86819c65091SMatthew Wilcox /*cd*/	u8	nc_ua1;		/*                                  */
86919c65091SMatthew Wilcox /*ce*/	u8	nc_ua2;		/*                                  */
87019c65091SMatthew Wilcox /*cf*/	u8	nc_ua3;		/*                                  */
87119c65091SMatthew Wilcox /*d0*/	u32	nc_esa;		/* Entry Storage Address            */
87219c65091SMatthew Wilcox /*d4*/	u8	nc_ia;		/* Instruction Address              */
87319c65091SMatthew Wilcox /*d5*/	u8	nc_ia1;
87419c65091SMatthew Wilcox /*d6*/	u8	nc_ia2;
87519c65091SMatthew Wilcox /*d7*/	u8	nc_ia3;
87619c65091SMatthew Wilcox /*d8*/	u32	nc_sbc;		/* SCSI Byte Count (3 bytes only)   */
87719c65091SMatthew Wilcox /*dc*/	u32	nc_csbc;	/* Cumulative SCSI Byte Count       */
87819c65091SMatthew Wilcox 
87919c65091SMatthew Wilcox 				/* Following for C1010 only         */
88019c65091SMatthew Wilcox /*e0*/  u16	nc_crcpad;	/* CRC Value                        */
88119c65091SMatthew Wilcox /*e2*/  u8	nc_crccntl0;	/* CRC control register             */
88219c65091SMatthew Wilcox 	#define   SNDCRC  0x10	/* Send CRC Request                 */
88319c65091SMatthew Wilcox /*e3*/  u8	nc_crccntl1;	/* CRC control register             */
88419c65091SMatthew Wilcox /*e4*/  u32	nc_crcdata;	/* CRC data register                */
88519c65091SMatthew Wilcox /*e8*/  u32	nc_e8_;		/* rsvd 			    */
88619c65091SMatthew Wilcox /*ec*/  u32	nc_ec_;		/* rsvd 			    */
88719c65091SMatthew Wilcox /*f0*/  u16	nc_dfbc;	/* DMA FIFO byte count              */
88819c65091SMatthew Wilcox 
88919c65091SMatthew Wilcox };
89019c65091SMatthew Wilcox 
89119c65091SMatthew Wilcox /*-----------------------------------------------------------
89219c65091SMatthew Wilcox **
89319c65091SMatthew Wilcox **	Utility macros for the script.
89419c65091SMatthew Wilcox **
89519c65091SMatthew Wilcox **-----------------------------------------------------------
89619c65091SMatthew Wilcox */
89719c65091SMatthew Wilcox 
89819c65091SMatthew Wilcox #define REGJ(p,r) (offsetof(struct ncr_reg, p ## r))
89919c65091SMatthew Wilcox #define REG(r) REGJ (nc_, r)
90019c65091SMatthew Wilcox 
90119c65091SMatthew Wilcox typedef u32 ncrcmd;
90219c65091SMatthew Wilcox 
90319c65091SMatthew Wilcox /*-----------------------------------------------------------
90419c65091SMatthew Wilcox **
90519c65091SMatthew Wilcox **	SCSI phases
90619c65091SMatthew Wilcox **
90719c65091SMatthew Wilcox **	DT phases illegal for ncr driver.
90819c65091SMatthew Wilcox **
90919c65091SMatthew Wilcox **-----------------------------------------------------------
91019c65091SMatthew Wilcox */
91119c65091SMatthew Wilcox 
91219c65091SMatthew Wilcox #define	SCR_DATA_OUT	0x00000000
91319c65091SMatthew Wilcox #define	SCR_DATA_IN	0x01000000
91419c65091SMatthew Wilcox #define	SCR_COMMAND	0x02000000
91519c65091SMatthew Wilcox #define	SCR_STATUS	0x03000000
91619c65091SMatthew Wilcox #define SCR_DT_DATA_OUT	0x04000000
91719c65091SMatthew Wilcox #define SCR_DT_DATA_IN	0x05000000
91819c65091SMatthew Wilcox #define SCR_MSG_OUT	0x06000000
91919c65091SMatthew Wilcox #define SCR_MSG_IN      0x07000000
92019c65091SMatthew Wilcox 
92119c65091SMatthew Wilcox #define SCR_ILG_OUT	0x04000000
92219c65091SMatthew Wilcox #define SCR_ILG_IN	0x05000000
92319c65091SMatthew Wilcox 
92419c65091SMatthew Wilcox /*-----------------------------------------------------------
92519c65091SMatthew Wilcox **
92619c65091SMatthew Wilcox **	Data transfer via SCSI.
92719c65091SMatthew Wilcox **
92819c65091SMatthew Wilcox **-----------------------------------------------------------
92919c65091SMatthew Wilcox **
93019c65091SMatthew Wilcox **	MOVE_ABS (LEN)
93119c65091SMatthew Wilcox **	<<start address>>
93219c65091SMatthew Wilcox **
93319c65091SMatthew Wilcox **	MOVE_IND (LEN)
93419c65091SMatthew Wilcox **	<<dnad_offset>>
93519c65091SMatthew Wilcox **
93619c65091SMatthew Wilcox **	MOVE_TBL
93719c65091SMatthew Wilcox **	<<dnad_offset>>
93819c65091SMatthew Wilcox **
93919c65091SMatthew Wilcox **-----------------------------------------------------------
94019c65091SMatthew Wilcox */
94119c65091SMatthew Wilcox 
94219c65091SMatthew Wilcox #define OPC_MOVE          0x08000000
94319c65091SMatthew Wilcox 
94419c65091SMatthew Wilcox #define SCR_MOVE_ABS(l) ((0x00000000 | OPC_MOVE) | (l))
94519c65091SMatthew Wilcox #define SCR_MOVE_IND(l) ((0x20000000 | OPC_MOVE) | (l))
94619c65091SMatthew Wilcox #define SCR_MOVE_TBL     (0x10000000 | OPC_MOVE)
94719c65091SMatthew Wilcox 
94819c65091SMatthew Wilcox #define SCR_CHMOV_ABS(l) ((0x00000000) | (l))
94919c65091SMatthew Wilcox #define SCR_CHMOV_IND(l) ((0x20000000) | (l))
95019c65091SMatthew Wilcox #define SCR_CHMOV_TBL     (0x10000000)
95119c65091SMatthew Wilcox 
95219c65091SMatthew Wilcox struct scr_tblmove {
95319c65091SMatthew Wilcox         u32  size;
95419c65091SMatthew Wilcox         u32  addr;
95519c65091SMatthew Wilcox };
95619c65091SMatthew Wilcox 
95719c65091SMatthew Wilcox /*-----------------------------------------------------------
95819c65091SMatthew Wilcox **
95919c65091SMatthew Wilcox **	Selection
96019c65091SMatthew Wilcox **
96119c65091SMatthew Wilcox **-----------------------------------------------------------
96219c65091SMatthew Wilcox **
96319c65091SMatthew Wilcox **	SEL_ABS | SCR_ID (0..15)    [ | REL_JMP]
96419c65091SMatthew Wilcox **	<<alternate_address>>
96519c65091SMatthew Wilcox **
96619c65091SMatthew Wilcox **	SEL_TBL | << dnad_offset>>  [ | REL_JMP]
96719c65091SMatthew Wilcox **	<<alternate_address>>
96819c65091SMatthew Wilcox **
96919c65091SMatthew Wilcox **-----------------------------------------------------------
97019c65091SMatthew Wilcox */
97119c65091SMatthew Wilcox 
97219c65091SMatthew Wilcox #define	SCR_SEL_ABS	0x40000000
97319c65091SMatthew Wilcox #define	SCR_SEL_ABS_ATN	0x41000000
97419c65091SMatthew Wilcox #define	SCR_SEL_TBL	0x42000000
97519c65091SMatthew Wilcox #define	SCR_SEL_TBL_ATN	0x43000000
97619c65091SMatthew Wilcox 
97719c65091SMatthew Wilcox 
97819c65091SMatthew Wilcox #ifdef SCSI_NCR_BIG_ENDIAN
97919c65091SMatthew Wilcox struct scr_tblsel {
98019c65091SMatthew Wilcox         u8	sel_scntl3;
98119c65091SMatthew Wilcox         u8	sel_id;
98219c65091SMatthew Wilcox         u8	sel_sxfer;
98319c65091SMatthew Wilcox         u8	sel_scntl4;
98419c65091SMatthew Wilcox };
98519c65091SMatthew Wilcox #else
98619c65091SMatthew Wilcox struct scr_tblsel {
98719c65091SMatthew Wilcox         u8	sel_scntl4;
98819c65091SMatthew Wilcox         u8	sel_sxfer;
98919c65091SMatthew Wilcox         u8	sel_id;
99019c65091SMatthew Wilcox         u8	sel_scntl3;
99119c65091SMatthew Wilcox };
99219c65091SMatthew Wilcox #endif
99319c65091SMatthew Wilcox 
99419c65091SMatthew Wilcox #define SCR_JMP_REL     0x04000000
99519c65091SMatthew Wilcox #define SCR_ID(id)	(((u32)(id)) << 16)
99619c65091SMatthew Wilcox 
99719c65091SMatthew Wilcox /*-----------------------------------------------------------
99819c65091SMatthew Wilcox **
99919c65091SMatthew Wilcox **	Waiting for Disconnect or Reselect
100019c65091SMatthew Wilcox **
100119c65091SMatthew Wilcox **-----------------------------------------------------------
100219c65091SMatthew Wilcox **
100319c65091SMatthew Wilcox **	WAIT_DISC
100419c65091SMatthew Wilcox **	dummy: <<alternate_address>>
100519c65091SMatthew Wilcox **
100619c65091SMatthew Wilcox **	WAIT_RESEL
100719c65091SMatthew Wilcox **	<<alternate_address>>
100819c65091SMatthew Wilcox **
100919c65091SMatthew Wilcox **-----------------------------------------------------------
101019c65091SMatthew Wilcox */
101119c65091SMatthew Wilcox 
101219c65091SMatthew Wilcox #define	SCR_WAIT_DISC	0x48000000
101319c65091SMatthew Wilcox #define SCR_WAIT_RESEL  0x50000000
101419c65091SMatthew Wilcox 
101519c65091SMatthew Wilcox /*-----------------------------------------------------------
101619c65091SMatthew Wilcox **
101719c65091SMatthew Wilcox **	Bit Set / Reset
101819c65091SMatthew Wilcox **
101919c65091SMatthew Wilcox **-----------------------------------------------------------
102019c65091SMatthew Wilcox **
102119c65091SMatthew Wilcox **	SET (flags {|.. })
102219c65091SMatthew Wilcox **
102319c65091SMatthew Wilcox **	CLR (flags {|.. })
102419c65091SMatthew Wilcox **
102519c65091SMatthew Wilcox **-----------------------------------------------------------
102619c65091SMatthew Wilcox */
102719c65091SMatthew Wilcox 
102819c65091SMatthew Wilcox #define SCR_SET(f)     (0x58000000 | (f))
102919c65091SMatthew Wilcox #define SCR_CLR(f)     (0x60000000 | (f))
103019c65091SMatthew Wilcox 
103119c65091SMatthew Wilcox #define	SCR_CARRY	0x00000400
103219c65091SMatthew Wilcox #define	SCR_TRG		0x00000200
103319c65091SMatthew Wilcox #define	SCR_ACK		0x00000040
103419c65091SMatthew Wilcox #define	SCR_ATN		0x00000008
103519c65091SMatthew Wilcox 
103619c65091SMatthew Wilcox 
103719c65091SMatthew Wilcox 
103819c65091SMatthew Wilcox 
103919c65091SMatthew Wilcox /*-----------------------------------------------------------
104019c65091SMatthew Wilcox **
104119c65091SMatthew Wilcox **	Memory to memory move
104219c65091SMatthew Wilcox **
104319c65091SMatthew Wilcox **-----------------------------------------------------------
104419c65091SMatthew Wilcox **
104519c65091SMatthew Wilcox **	COPY (bytecount)
104619c65091SMatthew Wilcox **	<< source_address >>
104719c65091SMatthew Wilcox **	<< destination_address >>
104819c65091SMatthew Wilcox **
104919c65091SMatthew Wilcox **	SCR_COPY   sets the NO FLUSH option by default.
105019c65091SMatthew Wilcox **	SCR_COPY_F does not set this option.
105119c65091SMatthew Wilcox **
105219c65091SMatthew Wilcox **	For chips which do not support this option,
105319c65091SMatthew Wilcox **	ncr_copy_and_bind() will remove this bit.
105419c65091SMatthew Wilcox **-----------------------------------------------------------
105519c65091SMatthew Wilcox */
105619c65091SMatthew Wilcox 
105719c65091SMatthew Wilcox #define SCR_NO_FLUSH 0x01000000
105819c65091SMatthew Wilcox 
105919c65091SMatthew Wilcox #define SCR_COPY(n) (0xc0000000 | SCR_NO_FLUSH | (n))
106019c65091SMatthew Wilcox #define SCR_COPY_F(n) (0xc0000000 | (n))
106119c65091SMatthew Wilcox 
106219c65091SMatthew Wilcox /*-----------------------------------------------------------
106319c65091SMatthew Wilcox **
106419c65091SMatthew Wilcox **	Register move and binary operations
106519c65091SMatthew Wilcox **
106619c65091SMatthew Wilcox **-----------------------------------------------------------
106719c65091SMatthew Wilcox **
106819c65091SMatthew Wilcox **	SFBR_REG (reg, op, data)        reg  = SFBR op data
106919c65091SMatthew Wilcox **	<< 0 >>
107019c65091SMatthew Wilcox **
107119c65091SMatthew Wilcox **	REG_SFBR (reg, op, data)        SFBR = reg op data
107219c65091SMatthew Wilcox **	<< 0 >>
107319c65091SMatthew Wilcox **
107419c65091SMatthew Wilcox **	REG_REG  (reg, op, data)        reg  = reg op data
107519c65091SMatthew Wilcox **	<< 0 >>
107619c65091SMatthew Wilcox **
107719c65091SMatthew Wilcox **-----------------------------------------------------------
107819c65091SMatthew Wilcox **	On 810A, 860, 825A, 875, 895 and 896 chips the content
107919c65091SMatthew Wilcox **	of SFBR register can be used as data (SCR_SFBR_DATA).
10800779bf2dSMatt LaPlante **	The 896 has additional IO registers starting at
108119c65091SMatthew Wilcox **	offset 0x80. Bit 7 of register offset is stored in
108219c65091SMatthew Wilcox **	bit 7 of the SCRIPTS instruction first DWORD.
108319c65091SMatthew Wilcox **-----------------------------------------------------------
108419c65091SMatthew Wilcox */
108519c65091SMatthew Wilcox 
108619c65091SMatthew Wilcox #define SCR_REG_OFS(ofs) ((((ofs) & 0x7f) << 16ul) + ((ofs) & 0x80))
108719c65091SMatthew Wilcox 
108819c65091SMatthew Wilcox #define SCR_SFBR_REG(reg,op,data) \
108919c65091SMatthew Wilcox         (0x68000000 | (SCR_REG_OFS(REG(reg))) | (op) | (((data)&0xff)<<8ul))
109019c65091SMatthew Wilcox 
109119c65091SMatthew Wilcox #define SCR_REG_SFBR(reg,op,data) \
109219c65091SMatthew Wilcox         (0x70000000 | (SCR_REG_OFS(REG(reg))) | (op) | (((data)&0xff)<<8ul))
109319c65091SMatthew Wilcox 
109419c65091SMatthew Wilcox #define SCR_REG_REG(reg,op,data) \
109519c65091SMatthew Wilcox         (0x78000000 | (SCR_REG_OFS(REG(reg))) | (op) | (((data)&0xff)<<8ul))
109619c65091SMatthew Wilcox 
109719c65091SMatthew Wilcox 
109819c65091SMatthew Wilcox #define      SCR_LOAD   0x00000000
109919c65091SMatthew Wilcox #define      SCR_SHL    0x01000000
110019c65091SMatthew Wilcox #define      SCR_OR     0x02000000
110119c65091SMatthew Wilcox #define      SCR_XOR    0x03000000
110219c65091SMatthew Wilcox #define      SCR_AND    0x04000000
110319c65091SMatthew Wilcox #define      SCR_SHR    0x05000000
110419c65091SMatthew Wilcox #define      SCR_ADD    0x06000000
110519c65091SMatthew Wilcox #define      SCR_ADDC   0x07000000
110619c65091SMatthew Wilcox 
110719c65091SMatthew Wilcox #define      SCR_SFBR_DATA   (0x00800000>>8ul)	/* Use SFBR as data */
110819c65091SMatthew Wilcox 
110919c65091SMatthew Wilcox /*-----------------------------------------------------------
111019c65091SMatthew Wilcox **
111119c65091SMatthew Wilcox **	FROM_REG (reg)		  SFBR = reg
111219c65091SMatthew Wilcox **	<< 0 >>
111319c65091SMatthew Wilcox **
111419c65091SMatthew Wilcox **	TO_REG	 (reg)		  reg  = SFBR
111519c65091SMatthew Wilcox **	<< 0 >>
111619c65091SMatthew Wilcox **
111719c65091SMatthew Wilcox **	LOAD_REG (reg, data)	  reg  = <data>
111819c65091SMatthew Wilcox **	<< 0 >>
111919c65091SMatthew Wilcox **
112019c65091SMatthew Wilcox **	LOAD_SFBR(data) 	  SFBR = <data>
112119c65091SMatthew Wilcox **	<< 0 >>
112219c65091SMatthew Wilcox **
112319c65091SMatthew Wilcox **-----------------------------------------------------------
112419c65091SMatthew Wilcox */
112519c65091SMatthew Wilcox 
112619c65091SMatthew Wilcox #define	SCR_FROM_REG(reg) \
112719c65091SMatthew Wilcox 	SCR_REG_SFBR(reg,SCR_OR,0)
112819c65091SMatthew Wilcox 
112919c65091SMatthew Wilcox #define	SCR_TO_REG(reg) \
113019c65091SMatthew Wilcox 	SCR_SFBR_REG(reg,SCR_OR,0)
113119c65091SMatthew Wilcox 
113219c65091SMatthew Wilcox #define	SCR_LOAD_REG(reg,data) \
113319c65091SMatthew Wilcox 	SCR_REG_REG(reg,SCR_LOAD,data)
113419c65091SMatthew Wilcox 
113519c65091SMatthew Wilcox #define SCR_LOAD_SFBR(data) \
113619c65091SMatthew Wilcox         (SCR_REG_SFBR (gpreg, SCR_LOAD, data))
113719c65091SMatthew Wilcox 
113819c65091SMatthew Wilcox /*-----------------------------------------------------------
113919c65091SMatthew Wilcox **
114019c65091SMatthew Wilcox **	LOAD  from memory   to register.
114119c65091SMatthew Wilcox **	STORE from register to memory.
114219c65091SMatthew Wilcox **
114319c65091SMatthew Wilcox **	Only supported by 810A, 860, 825A, 875, 895 and 896.
114419c65091SMatthew Wilcox **
114519c65091SMatthew Wilcox **-----------------------------------------------------------
114619c65091SMatthew Wilcox **
114719c65091SMatthew Wilcox **	LOAD_ABS (LEN)
114819c65091SMatthew Wilcox **	<<start address>>
114919c65091SMatthew Wilcox **
115019c65091SMatthew Wilcox **	LOAD_REL (LEN)        (DSA relative)
115119c65091SMatthew Wilcox **	<<dsa_offset>>
115219c65091SMatthew Wilcox **
115319c65091SMatthew Wilcox **-----------------------------------------------------------
115419c65091SMatthew Wilcox */
115519c65091SMatthew Wilcox 
115619c65091SMatthew Wilcox #define SCR_REG_OFS2(ofs) (((ofs) & 0xff) << 16ul)
115719c65091SMatthew Wilcox #define SCR_NO_FLUSH2	0x02000000
115819c65091SMatthew Wilcox #define SCR_DSA_REL2	0x10000000
115919c65091SMatthew Wilcox 
116019c65091SMatthew Wilcox #define SCR_LOAD_R(reg, how, n) \
116119c65091SMatthew Wilcox         (0xe1000000 | how | (SCR_REG_OFS2(REG(reg))) | (n))
116219c65091SMatthew Wilcox 
116319c65091SMatthew Wilcox #define SCR_STORE_R(reg, how, n) \
116419c65091SMatthew Wilcox         (0xe0000000 | how | (SCR_REG_OFS2(REG(reg))) | (n))
116519c65091SMatthew Wilcox 
116619c65091SMatthew Wilcox #define SCR_LOAD_ABS(reg, n)	SCR_LOAD_R(reg, SCR_NO_FLUSH2, n)
116719c65091SMatthew Wilcox #define SCR_LOAD_REL(reg, n)	SCR_LOAD_R(reg, SCR_NO_FLUSH2|SCR_DSA_REL2, n)
116819c65091SMatthew Wilcox #define SCR_LOAD_ABS_F(reg, n)	SCR_LOAD_R(reg, 0, n)
116919c65091SMatthew Wilcox #define SCR_LOAD_REL_F(reg, n)	SCR_LOAD_R(reg, SCR_DSA_REL2, n)
117019c65091SMatthew Wilcox 
117119c65091SMatthew Wilcox #define SCR_STORE_ABS(reg, n)	SCR_STORE_R(reg, SCR_NO_FLUSH2, n)
117219c65091SMatthew Wilcox #define SCR_STORE_REL(reg, n)	SCR_STORE_R(reg, SCR_NO_FLUSH2|SCR_DSA_REL2,n)
117319c65091SMatthew Wilcox #define SCR_STORE_ABS_F(reg, n)	SCR_STORE_R(reg, 0, n)
117419c65091SMatthew Wilcox #define SCR_STORE_REL_F(reg, n)	SCR_STORE_R(reg, SCR_DSA_REL2, n)
117519c65091SMatthew Wilcox 
117619c65091SMatthew Wilcox 
117719c65091SMatthew Wilcox /*-----------------------------------------------------------
117819c65091SMatthew Wilcox **
117919c65091SMatthew Wilcox **	Waiting for Disconnect or Reselect
118019c65091SMatthew Wilcox **
118119c65091SMatthew Wilcox **-----------------------------------------------------------
118219c65091SMatthew Wilcox **
118319c65091SMatthew Wilcox **	JUMP            [ | IFTRUE/IFFALSE ( ... ) ]
118419c65091SMatthew Wilcox **	<<address>>
118519c65091SMatthew Wilcox **
118619c65091SMatthew Wilcox **	JUMPR           [ | IFTRUE/IFFALSE ( ... ) ]
118719c65091SMatthew Wilcox **	<<distance>>
118819c65091SMatthew Wilcox **
118919c65091SMatthew Wilcox **	CALL            [ | IFTRUE/IFFALSE ( ... ) ]
119019c65091SMatthew Wilcox **	<<address>>
119119c65091SMatthew Wilcox **
119219c65091SMatthew Wilcox **	CALLR           [ | IFTRUE/IFFALSE ( ... ) ]
119319c65091SMatthew Wilcox **	<<distance>>
119419c65091SMatthew Wilcox **
119519c65091SMatthew Wilcox **	RETURN          [ | IFTRUE/IFFALSE ( ... ) ]
119619c65091SMatthew Wilcox **	<<dummy>>
119719c65091SMatthew Wilcox **
119819c65091SMatthew Wilcox **	INT             [ | IFTRUE/IFFALSE ( ... ) ]
119919c65091SMatthew Wilcox **	<<ident>>
120019c65091SMatthew Wilcox **
120119c65091SMatthew Wilcox **	INT_FLY         [ | IFTRUE/IFFALSE ( ... ) ]
120219c65091SMatthew Wilcox **	<<ident>>
120319c65091SMatthew Wilcox **
120419c65091SMatthew Wilcox **	Conditions:
120519c65091SMatthew Wilcox **	     WHEN (phase)
120619c65091SMatthew Wilcox **	     IF   (phase)
120719c65091SMatthew Wilcox **	     CARRYSET
120819c65091SMatthew Wilcox **	     DATA (data, mask)
120919c65091SMatthew Wilcox **
121019c65091SMatthew Wilcox **-----------------------------------------------------------
121119c65091SMatthew Wilcox */
121219c65091SMatthew Wilcox 
121319c65091SMatthew Wilcox #define SCR_NO_OP       0x80000000
121419c65091SMatthew Wilcox #define SCR_JUMP        0x80080000
121519c65091SMatthew Wilcox #define SCR_JUMP64      0x80480000
121619c65091SMatthew Wilcox #define SCR_JUMPR       0x80880000
121719c65091SMatthew Wilcox #define SCR_CALL        0x88080000
121819c65091SMatthew Wilcox #define SCR_CALLR       0x88880000
121919c65091SMatthew Wilcox #define SCR_RETURN      0x90080000
122019c65091SMatthew Wilcox #define SCR_INT         0x98080000
122119c65091SMatthew Wilcox #define SCR_INT_FLY     0x98180000
122219c65091SMatthew Wilcox 
122319c65091SMatthew Wilcox #define IFFALSE(arg)   (0x00080000 | (arg))
122419c65091SMatthew Wilcox #define IFTRUE(arg)    (0x00000000 | (arg))
122519c65091SMatthew Wilcox 
122619c65091SMatthew Wilcox #define WHEN(phase)    (0x00030000 | (phase))
122719c65091SMatthew Wilcox #define IF(phase)      (0x00020000 | (phase))
122819c65091SMatthew Wilcox 
122919c65091SMatthew Wilcox #define DATA(D)        (0x00040000 | ((D) & 0xff))
123019c65091SMatthew Wilcox #define MASK(D,M)      (0x00040000 | (((M ^ 0xff) & 0xff) << 8ul)|((D) & 0xff))
123119c65091SMatthew Wilcox 
123219c65091SMatthew Wilcox #define CARRYSET       (0x00200000)
123319c65091SMatthew Wilcox 
123419c65091SMatthew Wilcox /*-----------------------------------------------------------
123519c65091SMatthew Wilcox **
123619c65091SMatthew Wilcox **	SCSI  constants.
123719c65091SMatthew Wilcox **
123819c65091SMatthew Wilcox **-----------------------------------------------------------
123919c65091SMatthew Wilcox */
124019c65091SMatthew Wilcox 
124119c65091SMatthew Wilcox /*
124219c65091SMatthew Wilcox  * End of ncrreg from FreeBSD
124319c65091SMatthew Wilcox  */
12441da177e4SLinus Torvalds 
12451da177e4SLinus Torvalds /*
12461da177e4SLinus Torvalds 	Build a scatter/gather entry.
12471da177e4SLinus Torvalds 	see sym53c8xx_2/sym_hipd.h for more detailed sym_build_sge()
12481da177e4SLinus Torvalds 	implementation ;)
12491da177e4SLinus Torvalds  */
12501da177e4SLinus Torvalds 
12511da177e4SLinus Torvalds #define ncr_build_sge(np, data, badd, len)	\
12521da177e4SLinus Torvalds do {						\
12531da177e4SLinus Torvalds 	(data)->addr = cpu_to_scr(badd);	\
12541da177e4SLinus Torvalds 	(data)->size = cpu_to_scr(len);		\
12551da177e4SLinus Torvalds } while (0)
12561da177e4SLinus Torvalds 
12571da177e4SLinus Torvalds /*==========================================================
12581da177e4SLinus Torvalds **
12591da177e4SLinus Torvalds **	Structures used by the detection routine to transmit
12601da177e4SLinus Torvalds **	device configuration to the attach function.
12611da177e4SLinus Torvalds **
12621da177e4SLinus Torvalds **==========================================================
12631da177e4SLinus Torvalds */
12641da177e4SLinus Torvalds struct ncr_slot {
12651da177e4SLinus Torvalds 	u_long	base;
12661da177e4SLinus Torvalds 	u_long	base_2;
12671da177e4SLinus Torvalds 	u_long	base_c;
12681da177e4SLinus Torvalds 	u_long	base_2_c;
12691da177e4SLinus Torvalds 	void __iomem *base_v;
12701da177e4SLinus Torvalds 	void __iomem *base_2_v;
12711da177e4SLinus Torvalds 	int	irq;
12721da177e4SLinus Torvalds /* port and reg fields to use INB, OUTB macros */
12731da177e4SLinus Torvalds 	volatile struct ncr_reg	__iomem *reg;
12741da177e4SLinus Torvalds };
12751da177e4SLinus Torvalds 
12761da177e4SLinus Torvalds /*==========================================================
12771da177e4SLinus Torvalds **
12781da177e4SLinus Torvalds **	Structure used by detection routine to save data on
12791da177e4SLinus Torvalds **	each detected board for attach.
12801da177e4SLinus Torvalds **
12811da177e4SLinus Torvalds **==========================================================
12821da177e4SLinus Torvalds */
12831da177e4SLinus Torvalds struct ncr_device {
12841da177e4SLinus Torvalds 	struct device  *dev;
12851da177e4SLinus Torvalds 	struct ncr_slot  slot;
12861da177e4SLinus Torvalds 	struct ncr_chip  chip;
12871da177e4SLinus Torvalds 	u_char host_id;
12881da177e4SLinus Torvalds 	u8 differential;
12891da177e4SLinus Torvalds };
12901da177e4SLinus Torvalds 
1291*31160bd3SBart Van Assche /* To keep track of the dma mapping (sg/single) that has been set */
1292*31160bd3SBart Van Assche struct ncr_cmd_priv {
1293*31160bd3SBart Van Assche 	int	data_mapped;
1294*31160bd3SBart Van Assche 	int	data_mapping;
1295*31160bd3SBart Van Assche };
1296*31160bd3SBart Van Assche 
12971da177e4SLinus Torvalds extern struct Scsi_Host *ncr_attach(struct scsi_host_template *tpnt, int unit, struct ncr_device *device);
1298dffe807cSMatthew Wilcox extern void ncr53c8xx_release(struct Scsi_Host *host);
12997d12e780SDavid Howells irqreturn_t ncr53c8xx_intr(int irq, void *dev_id);
13001da177e4SLinus Torvalds extern int ncr53c8xx_init(void);
13011da177e4SLinus Torvalds extern void ncr53c8xx_exit(void);
13021da177e4SLinus Torvalds 
13031da177e4SLinus Torvalds #endif /* NCR53C8XX_H */
1304