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