xref: /csrg-svn/sys/vax/mba/mbavar.h (revision 3491)
1*3491Sroot /*	mbavar.h	4.15	81/04/08	*/
260Sbill 
360Sbill /*
43066Swnj  * This file contains definitions related to the kernel structures
53066Swnj  * for dealing with the massbus adapters.
63066Swnj  *
73066Swnj  * Each mba has a mba_hd structure.
83066Swnj  * Each massbus device has a mba_device structure.
93066Swnj  * Each massbus slave has a mba_slave structure.
103066Swnj  *
113066Swnj  * At boot time we prowl the structures and fill in the pointers
123066Swnj  * for devices which we find.
1360Sbill  */
1460Sbill 
152332Swnj /*
163066Swnj  * Per-mba structure.
173066Swnj  *
183066Swnj  * The initialization routine uses the information in the mbdinit table
193066Swnj  * to initialize the what is attached to each massbus slot information.
203066Swnj  * It counts the number of devices on each mba (to see if bothering to
213066Swnj  * search/seek is appropriate).
223066Swnj  *
233066Swnj  * During normal operation, the devices attached to the mba which wish
243066Swnj  * to transfer are queued on the mh_act? links.
252332Swnj  */
263066Swnj struct	mba_hd {
273066Swnj 	short	mh_active;		/* set if mba is active */
283066Swnj 	short	mh_ndrive;		/* number of devices, to avoid seeks */
293066Swnj 	struct	mba_regs *mh_mba;	/* virt addr of mba */
303066Swnj 	struct	mba_regs *mh_physmba;	/* phys addr of mba */
313066Swnj 	struct	mba_device *mh_mbip[8];	/* what is attached to each dev */
323066Swnj 	struct	mba_device *mh_actf;	/* head of queue to transfer */
333066Swnj 	struct	mba_device *mh_actl;	/* tail of queue to transfer */
343066Swnj };
352388Swnj 
362388Swnj /*
373066Swnj  * Per-device structure
383066Swnj  * (one for each RM/RP disk, and one for each tape formatter).
393066Swnj  *
403066Swnj  * This structure is used by the device driver as its argument
413066Swnj  * to the massbus driver, and by the massbus driver to locate
423066Swnj  * the device driver for a particular massbus slot.
433066Swnj  *
443066Swnj  * The device drivers hang ready buffers on this structure,
453066Swnj  * and the massbus driver will start i/o on the first such buffer
463066Swnj  * when appropriate.
472388Swnj  */
483066Swnj struct	mba_device {
492388Swnj 	struct	mba_driver *mi_driver;
502388Swnj 	short	mi_unit;	/* unit number to the system */
512388Swnj 	short	mi_mbanum;	/* the mba it is on */
522388Swnj 	short	mi_drive;	/* controller on mba */
532547Swnj 	short	mi_dk;		/* driver number for iostat */
542388Swnj 	short	mi_alive;	/* device exists */
552388Swnj 	short	mi_type;	/* driver specific unit type */
562388Swnj 	struct	buf mi_tab;	/* head of queue for this device */
573066Swnj 	struct	mba_device *mi_forw;
582388Swnj /* we could compute these every time, but hereby save time */
592388Swnj 	struct	mba_regs *mi_mba;
602388Swnj 	struct	mba_drv *mi_drv;
612388Swnj 	struct	mba_hd *mi_hd;
622388Swnj };
632332Swnj 
642388Swnj /*
653066Swnj  * Tape formatter slaves are specified by
663066Swnj  * the following information which is used
673066Swnj  * at boot time to initialize the tape driver
683066Swnj  * internal tables.
692388Swnj  */
703066Swnj struct	mba_slave {
713066Swnj 	struct	mba_driver *ms_driver;
723066Swnj 	short	ms_ctlr;		/* which of several formatters */
733066Swnj 	short	ms_unit;		/* which unit to system */
743066Swnj 	short	ms_slave;		/* which slave to formatter */
753066Swnj 	short	ms_alive;
762736Swnj };
772332Swnj 
782388Swnj /*
793066Swnj  * Per device-type structure.
803066Swnj  *
813066Swnj  * Each massbus driver defines entries for a set of routines used
823066Swnj  * by the massbus driver, as well as an array of types which are
833066Swnj  * acceptable to it.
842388Swnj  */
852388Swnj struct mba_driver {
863066Swnj 	int	(*md_attach)();		/* attach a device */
873066Swnj 	int	(*md_slave)();		/* attach a slave */
882388Swnj 	int	(*md_ustart)();		/* unit start routine */
892388Swnj 	int	(*md_start)();		/* setup a data transfer */
902388Swnj 	int	(*md_dtint)();		/* data transfer complete */
912388Swnj 	int	(*md_ndint)();		/* non-data transfer interrupt */
922388Swnj 	short	*md_type;		/* array of drive type codes */
933066Swnj 	char	*md_dname, *md_sname;	/* device, slave names */
943066Swnj 	struct	mba_device **md_info;	/* backpointers to mbinit structs */
9560Sbill };
9660Sbill 
972388Swnj /*
982388Swnj  * Possible return values from unit start routines.
992388Swnj  */
1002388Swnj #define	MBU_NEXT	0		/* skip to next operation */
1012388Swnj #define	MBU_BUSY	1		/* dual port busy; wait for intr */
1022388Swnj #define	MBU_STARTED	2		/* non-data transfer started */
1032388Swnj #define	MBU_DODATA	3		/* data transfer ready; start mba */
10460Sbill 
1052388Swnj /*
1062388Swnj  * Possible return values from data transfer interrupt handling routines
1072388Swnj  */
1082388Swnj #define	MBD_DONE	0		/* data transfer complete */
1092388Swnj #define	MBD_RETRY	1		/* error occurred, please retry */
1102388Swnj #define	MBD_RESTARTED	2		/* driver restarted i/o itself */
11160Sbill 
1122388Swnj /*
1132388Swnj  * Possible return values from non-data-transfer interrupt handling routines
1142388Swnj  */
1152388Swnj #define	MBN_DONE	0		/* non-data transfer complete */
1162388Swnj #define	MBN_RETRY	1		/* failed; retry the operation */
1173066Swnj #define	MBN_SKIP	2		/* don't do anything */
11860Sbill 
1192388Swnj /*
1203066Swnj  * Clear attention status for specified device.
1212388Swnj  */
1222388Swnj #define	mbclrattn(mi)	((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
1232547Swnj 
1242547Swnj /*
1252547Swnj  * Kernel definitions related to mba.
1262547Swnj  */
1272547Swnj #ifdef KERNEL
128*3491Sroot int	nummba;
1292727Swnj #if NMBA > 0
1302736Swnj struct	mba_hd mba_hd[NMBA];
1312547Swnj extern	Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
1323066Swnj 
1333066Swnj extern	struct	mba_device mbdinit[];
1343066Swnj extern	struct	mba_slave mbsinit[];
1352547Swnj #endif
1362727Swnj #endif
137