xref: /csrg-svn/sys/vax/mba/mbavar.h (revision 3066)
1*3066Swnj /*	mbavar.h	4.13	81/03/08	*/
260Sbill 
360Sbill /*
4*3066Swnj  * This file contains definitions related to the kernel structures
5*3066Swnj  * for dealing with the massbus adapters.
6*3066Swnj  *
7*3066Swnj  * Each mba has a mba_hd structure.
8*3066Swnj  * Each massbus device has a mba_device structure.
9*3066Swnj  * Each massbus slave has a mba_slave structure.
10*3066Swnj  *
11*3066Swnj  * At boot time we prowl the structures and fill in the pointers
12*3066Swnj  * for devices which we find.
1360Sbill  */
1460Sbill 
152332Swnj /*
16*3066Swnj  * Per-mba structure.
17*3066Swnj  *
18*3066Swnj  * The initialization routine uses the information in the mbdinit table
19*3066Swnj  * to initialize the what is attached to each massbus slot information.
20*3066Swnj  * It counts the number of devices on each mba (to see if bothering to
21*3066Swnj  * search/seek is appropriate).
22*3066Swnj  *
23*3066Swnj  * During normal operation, the devices attached to the mba which wish
24*3066Swnj  * to transfer are queued on the mh_act? links.
252332Swnj  */
26*3066Swnj struct	mba_hd {
27*3066Swnj 	short	mh_active;		/* set if mba is active */
28*3066Swnj 	short	mh_ndrive;		/* number of devices, to avoid seeks */
29*3066Swnj 	struct	mba_regs *mh_mba;	/* virt addr of mba */
30*3066Swnj 	struct	mba_regs *mh_physmba;	/* phys addr of mba */
31*3066Swnj 	struct	mba_device *mh_mbip[8];	/* what is attached to each dev */
32*3066Swnj 	struct	mba_device *mh_actf;	/* head of queue to transfer */
33*3066Swnj 	struct	mba_device *mh_actl;	/* tail of queue to transfer */
34*3066Swnj };
352388Swnj 
362388Swnj /*
37*3066Swnj  * Per-device structure
38*3066Swnj  * (one for each RM/RP disk, and one for each tape formatter).
39*3066Swnj  *
40*3066Swnj  * This structure is used by the device driver as its argument
41*3066Swnj  * to the massbus driver, and by the massbus driver to locate
42*3066Swnj  * the device driver for a particular massbus slot.
43*3066Swnj  *
44*3066Swnj  * The device drivers hang ready buffers on this structure,
45*3066Swnj  * and the massbus driver will start i/o on the first such buffer
46*3066Swnj  * when appropriate.
472388Swnj  */
48*3066Swnj 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 */
57*3066Swnj 	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 /*
65*3066Swnj  * Tape formatter slaves are specified by
66*3066Swnj  * the following information which is used
67*3066Swnj  * at boot time to initialize the tape driver
68*3066Swnj  * internal tables.
692388Swnj  */
70*3066Swnj struct	mba_slave {
71*3066Swnj 	struct	mba_driver *ms_driver;
72*3066Swnj 	short	ms_ctlr;		/* which of several formatters */
73*3066Swnj 	short	ms_unit;		/* which unit to system */
74*3066Swnj 	short	ms_slave;		/* which slave to formatter */
75*3066Swnj 	short	ms_alive;
762736Swnj };
772332Swnj 
782388Swnj /*
79*3066Swnj  * Per device-type structure.
80*3066Swnj  *
81*3066Swnj  * Each massbus driver defines entries for a set of routines used
82*3066Swnj  * by the massbus driver, as well as an array of types which are
83*3066Swnj  * acceptable to it.
842388Swnj  */
852388Swnj struct mba_driver {
86*3066Swnj 	int	(*md_attach)();		/* attach a device */
87*3066Swnj 	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 */
93*3066Swnj 	char	*md_dname, *md_sname;	/* device, slave names */
94*3066Swnj 	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 */
117*3066Swnj #define	MBN_SKIP	2		/* don't do anything */
118*3066Swnj #define	MBN_CONT	3		/* operation continues */
11960Sbill 
1202388Swnj /*
121*3066Swnj  * Clear attention status for specified device.
1222388Swnj  */
1232388Swnj #define	mbclrattn(mi)	((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
1242547Swnj 
1252547Swnj /*
1262547Swnj  * Kernel definitions related to mba.
1272547Swnj  */
1282547Swnj #ifdef KERNEL
1292727Swnj #if NMBA > 0
1302736Swnj struct	mba_hd mba_hd[NMBA];
1312547Swnj extern	Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
132*3066Swnj 
133*3066Swnj extern	struct	mba_device mbdinit[];
134*3066Swnj extern	struct	mba_slave mbsinit[];
1352547Swnj int	nummba;
1362547Swnj #endif
1372727Swnj #endif
138