xref: /csrg-svn/sys/tahoe/vba/drreg.h (revision 34406)
1*34406Skarels /*
2*34406Skarels  *	@(#)drreg.h	7.1 (Berkeley) 05/21/88
3*34406Skarels  */
429650Ssam 
529650Ssam /*
629650Ssam     ------------------------------------------
729650Ssam     Must include <h/types.h> and <h/buf.h>
829650Ssam     ------------------------------------------
929650Ssam */
1029650Ssam 
1129650Ssam #define	DRINTV	0x9c		/* Has to match with ml/scb.s */
1229650Ssam #define DRADDMOD 0x01		/* Addr modifier used to access TAHOE memory */
1329650Ssam #define DR_ZERO 0
1429650Ssam #define DRPRI	(PZERO+1)
1529650Ssam 
1629650Ssam #define DR_TICK 600		/* Default # of clock ticks between call
1729650Ssam 				   to local timer watchdog routine */
1829650Ssam #define	DR_TOCK	2		/* default # of calls to local watch dog
1929650Ssam 				   before an IO or wait is determined to
2029650Ssam 				   have timeout */
2129650Ssam 
2229650Ssam 
2329650Ssam struct rsdevice {
2429650Ssam     ushort dr_cstat;		/* Control & status registers */
2529650Ssam     ushort dr_data;		/* Input/Ouptut data registers */
2629650Ssam     char dr_addmod;		/* Address modifier for DMA */
2729650Ssam     char dr_intvect;		/* Interrupt vector */
2829650Ssam     ushort dr_pulse;		/* Pulse command register */
2929650Ssam     ushort dr_xx08;		/* Not used */
3029650Ssam     ushort dr_xx0A;		/* Not used */
3129650Ssam     ushort dr_xx0C;		/* Not used */
3229650Ssam     ushort dr_xx0E;		/* Not used */
3329650Ssam     ushort dr_xx10;		/* Not used */
3429650Ssam     ushort dr_walo;		/* Low DMA address register --when written-- */
3529650Ssam     ushort dr_range;		/* DMA range counter */
3629650Ssam     ushort dr_ralo;		/* Low DMA address register --when read-- */
3729650Ssam     ushort dr_xx18;		/* Not used */
3829650Ssam     ushort dr_wahi;		/* High DMA address register --when written-- */
3929650Ssam     ushort dr_xx1C;		/* Not used */
4029650Ssam     ushort dr_rahi;		/* High DMA address register --when read-- */
4129650Ssam };
4229650Ssam 
4329650Ssam 
4429650Ssam struct dr_aux {
4529650Ssam 	struct rsdevice *dr_addr; /* Physical addr of currently active DR11 */
4629650Ssam 	struct buf *dr_actf;	/* Pointers to DR11's active buffers list */
4729650Ssam 	unsigned int dr_flags;	/* State: Hold open, active,... */
4829650Ssam 	ushort dr_cmd;		/* Hold cmd placed here by ioctl
4929650Ssam 				   for later execution by rsstrategy() */
5029650Ssam 	ushort dr_op;		/* Current operation: DR_READ/DR_WRITE */
5129650Ssam 	long   dr_bycnt;	/* Total byte cnt of current operation */
5229650Ssam 				/* decremented by completion interrupt */
5329650Ssam 	caddr_t dr_oba;		/* original xfer addr, count */
5429650Ssam 	long   dr_obc;
5529650Ssam 	unsigned long
5629650Ssam 		rtimoticks,	/* No of ticks before timing out on no stall
5729650Ssam 				   read */
5829650Ssam 		wtimoticks,	/* No of ticks before timing out on no stall
5929650Ssam 				   write */
6029650Ssam 		currenttimo;	/* the number of current timeout call to
6129650Ssam 				   omrwtimo() */
6229650Ssam    	ushort dr_istat;	/* Latest interrupt status */
6329650Ssam 	struct buf dr_buf;
6429650Ssam 
6529650Ssam 	/*ushort dr_time;		/* # of ticks until timeout */
6629650Ssam 	/*ushort dr_tock;		/* # of ticks accumulated */
6729650Ssam 	/*ushort dr_cseq;		/* Current sequence number */
6829650Ssam 	/*ushort dr_lseq;		/* Last sequence number */
6929650Ssam };
7029650Ssam 
7129650Ssam /*	Command used by drioctl()
7229650Ssam */
7329650Ssam struct dr11io {
7429650Ssam 	ushort arg[8];
7529650Ssam };
7629650Ssam 
7729650Ssam #define RSADDR(unit)    ((struct rsdevice *)drinfo[unit]->ui_addr)
7829650Ssam 
7929650Ssam /*	Control register bits */
8029650Ssam #define	RDMA	0x8000		/* reset DMA end-of-range flag */
8129650Ssam #define	RATN	0x4000		/* reset attention flag */
8229650Ssam #define RPER	0x2000		/* reset device parity error flag */
8329650Ssam #define MCLR	0x1000		/* master clear board and INT device */
8429650Ssam #define CYCL	0x0100		/* forces DMA cycle if DMA enabled */
8529650Ssam #define IENB	0x0040		/* enables interrupt */
8629650Ssam #define FCN3	0x0008		/* func. bit 3 to device (FNCT3 H) */
8729650Ssam #define FCN2	0x0004		/* func. bit 2 to device (FNCT2 H) */
8829650Ssam 				/* also asserts ACLO FCNT2 H to device */
8929650Ssam #define FCN1	0x0002		/* func. bit 1 to device (FNCT1 H) */
9029650Ssam #define GO	0x0001		/* enable DMA and pulse GO to device */
9129650Ssam 
9229650Ssam /*	Status register bits */
9329650Ssam #define	DMAF	0x8000		/* indicates DMA end-of-range */
9429650Ssam #define	ATTF	0x4000		/* indicates attention false-to-true */
9529650Ssam #define ATTN	0x2000		/* current state of ATTENTION H input */
9629650Ssam #define PERR	0x1000		/* Set by external parity error */
9729650Ssam #define STTA	0x0800		/* STATUS A H input state */
9829650Ssam #define STTB	0x0400		/* STATUS B H input state */
9929650Ssam #define STTC	0x0200		/* STATUS C H input state */
10029650Ssam #define REDY	0x0080		/* board ready for cmd (dma not on) */
10129650Ssam #define IENF	0x0040		/* Interrupt enabled if on */
10229650Ssam #define BERR	0x0020		/* Set if bus error during DMA */
10329650Ssam #define TERR	0x0010		/* Set if bus timeout during DMA */
10429650Ssam #define FC3S	0x0008		/* State of FCN3 latch */
10529650Ssam #define FC2S	0x0004		/* State of FCN2 latch */
10629650Ssam #define FC1S	0x0002		/* State of FCN1 latch */
10729650Ssam #define DLFG	0x0001		/* 0 -> IKON-10083 *** 1 -> IKON-10077 */
10829650Ssam 
10929650Ssam /*	Pulse command register bits */
11029650Ssam #define SMSK	0x0040		/* pulse interrupt mask on:  Set IENB */
11129650Ssam #define RMSK	0x0020		/* pulse interrupt mask off: Reset IENB */
11229650Ssam 
11329650Ssam 
11429650Ssam /*
11529650Ssam  * 	DR11 driver's internal flags -- to be stored in dr_flags
11629650Ssam */
11729650Ssam #define DR_FMSK		0x0000E	/* function bits mask */
11829650Ssam #define	DR_OPEN		0x00001	/* This dr11 has been opened */
11929650Ssam #define DR_PRES		0x00002	/* This dr11 is present */
12029650Ssam #define DR_ACTV		0x00004	/* waiting for end-of-range */
12129650Ssam #define DR_ATWT 	0x00008	/* waiting for attention interrupt */
12229650Ssam #define DR_ATRX 	0x00010	/* attn received-resets when read */
12329650Ssam #define DR_TMDM		0x00020	/* timeout waiting for end-of-range */
12429650Ssam #define DR_TMAT		0x00040	/* timeout waiting for attention */
12529650Ssam #define DR_DMAX		0x00080	/* end-of-range interrupt received */
12629650Ssam #define DR_PCYL		0x00100	/* set cycle with next go */
12729650Ssam #define DR_DFCN 	0x00200	/* donot update function bits until next  go */
12829650Ssam #define DR_DACL		0x00400	/* defer alco pulse until go */
12929650Ssam #define DR_LOOPTST 	0x02000	/* This dr11 is in loopback test mode */
13029650Ssam #define DR_LNKMODE 	0x04000	/* This dr11 is in link mode */
13129650Ssam #define	DR_NORSTALL	0x10000	/* Device is set to no stall mode for reads. */
13229650Ssam #define	DR_NOWSTALL	0x20000	/* Device is set to no stall mode for writes. */
13329650Ssam #define	DR_TIMEDOUT	0x40000	/* The device timed out on a stall mode R/W */
13429650Ssam 
13529650Ssam /*
13629650Ssam  * 	DR11 driver's internal flags -- to be stored in dr_op
13729650Ssam */
13829650Ssam #define	DR_READ		FCN1
13929650Ssam #define DR_WRITE	0
14029650Ssam 
14129650Ssam /*
14229650Ssam  *	Ioctl commands
14329650Ssam */
14433093Sbostic #define DRWAIT		_IOWR('d',1,long)
14533093Sbostic #define	DRPIOW		_IOWR('d',2,long)
14633093Sbostic #define DRPACL		_IOWR('d',3,long)
14733093Sbostic #define DRDACL		_IOWR('d',4,long)
14833093Sbostic #define DRPCYL		_IOWR('d',5,long)
14933093Sbostic #define DRDFCN 		_IOWR('d',6,long)
15033093Sbostic #define DRRPER 		_IOWR('d',7,long)
15133093Sbostic #define DRRATN		_IOWR('d',8,long)
15233093Sbostic #define DRRDMA 		_IOWR('d',9,long)
15333093Sbostic #define DRSFCN 		_IOWR('d',10,long)
15429650Ssam 
15533093Sbostic #define	DRSETRSTALL	_IOWR('d',13,long)
15633093Sbostic #define	DRSETNORSTALL	_IOWR('d',14,long)
15733093Sbostic #define	DRGETRSTALL	_IOWR('d',15,long)
15833093Sbostic #define	DRSETRTIMEOUT	_IOWR('d',16,long)
15933093Sbostic #define	DRGETRTIMEOUT	_IOWR('d',17,long)
16033093Sbostic #define	DRSETWSTALL	_IOWR('d',18,long)
16133093Sbostic #define	DRSETNOWSTALL	_IOWR('d',19,long)
16233093Sbostic #define	DRGETWSTALL	_IOWR('d',20,long)
16333093Sbostic #define	DRSETWTIMEOUT	_IOWR('d',21,long)
16433093Sbostic #define	DRGETWTIMEOUT	_IOWR('d',22,long)
16533093Sbostic #define	DRWRITEREADY	_IOWR('d',23,long)
16633093Sbostic #define	DRREADREADY	_IOWR('d',24,long)
16733093Sbostic #define	DRBUSY		_IOWR('d',25,long)
16833093Sbostic #define	DRRESET		_IOWR('d',26,long)
16929650Ssam 
17029650Ssam /* The block size for buffering and DMA transfers. */
17129650Ssam /* OM_BLOCKSIZE must be even and <= 32768. Multiples of 512 are prefered. */
17229650Ssam #define	OM_BLOCKSIZE	32768
17329650Ssam 
17429650Ssam 
17529650Ssam /* --- Define ioctl call used by dr11 utility device --  */
17629650Ssam 
17733093Sbostic #define DR11STAT	_IOWR('d',30,struct dr11io)   /* Get status dr11, unit
17829650Ssam 						   number is dr11io.arg[0] */
17933093Sbostic #define DR11LOOP	_IOR('d',31,struct dr11io)   /* Perform loopback test */
18029650Ssam 
18129650Ssam /* ---------------------------------------------------- */
18229650Ssam 
183