xref: /csrg-svn/sys/tahoe/vba/vbavar.h (revision 25857)
1*25857Ssam /*	vbavar.h	1.2	86/01/12	*/
223998Ssam 
323998Ssam /*
423998Ssam  * This file contains definitions related to the kernel structures
523998Ssam  * for dealing with the Versabus adapters.
623998Ssam  *
7*25857Ssam  * Each Versabus has a vba_hd structure.
823998Ssam  * Each Versabus controller which is not a device has a vba_ctlr structure.
923998Ssam  * Each Versabus device has a vba_device structure.
1023998Ssam  */
1123998Ssam 
1223998Ssam #ifndef LOCORE
1323998Ssam /*
14*25857Ssam  * Per-vba structure.
15*25857Ssam  */
16*25857Ssam struct	vba_hd {
17*25857Ssam 	int	vh_lastiv;		/* last interrupt vector assigned */
18*25857Ssam };
19*25857Ssam 
20*25857Ssam /*
2123998Ssam  * Per-controller structure.
2223998Ssam  * (E.g. one for each disk and tape controller, and other things
2323998Ssam  * which use and release buffered data paths.)
2423998Ssam  *
2523998Ssam  * If a controller has devices attached, then there are
2623998Ssam  * cross-referenced vba_drive structures.
2723998Ssam  * This structure is the one which is queued in Versabus resource wait,
2823998Ssam  * and saves the information about Versabus resources which are used.
2923998Ssam  * The queue of devices waiting to transfer is also attached here.
3023998Ssam  */
3123998Ssam struct vba_ctlr {
3223998Ssam 	struct	vba_driver *um_driver;
3323998Ssam 	short	um_ctlr;	/* controller index in driver */
3423998Ssam 	short	um_vbanum;	/* the vba it is on */
3523998Ssam 	short	um_alive;	/* controller exists */
3623998Ssam 	int	(**um_intr)();	/* interrupt handler(s) */
3723998Ssam 	caddr_t	um_addr;	/* address of device in i/o space */
38*25857Ssam 	struct	vba_hd *um_hd;
3923998Ssam /* the driver saves the prototype command here for use in its go routine */
4023998Ssam 	int	um_cmd;		/* communication to dgo() */
4123998Ssam 	int	um_vbinfo;	/* save Versabus registers, etc */
4223998Ssam 	struct	buf um_tab;	/* queue of devices for this controller */
4323998Ssam };
4423998Ssam 
4523998Ssam /*
4623998Ssam  * Per ``device'' structure.
4723998Ssam  * (A controller has devices or uses and releases buffered data paths).
4823998Ssam  * (Everything else is a ``device''.)
4923998Ssam  *
5023998Ssam  * If a controller has many drives attached, then there will
5123998Ssam  * be several vba_device structures associated with a single vba_ctlr
5223998Ssam  * structure.
5323998Ssam  *
5423998Ssam  * This structure contains all the information necessary to run
5523998Ssam  * a Versabus device.  It also contains information
5623998Ssam  * for slaves of Versabus controllers as to which device on the slave
5723998Ssam  * this is.  A flags field here can also be given in the system specification
5823998Ssam  * and is used to tell which vcx lines are hard wired or other device
5923998Ssam  * specific parameters.
6023998Ssam  */
6123998Ssam struct vba_device {
6223998Ssam 	struct	vba_driver *ui_driver;
6323998Ssam 	short	ui_unit;	/* unit number on the system */
6423998Ssam 	short	ui_ctlr;	/* mass ctlr number; -1 if none */
6523998Ssam 	short	ui_vbanum;	/* the vba it is on */
6623998Ssam 	short	ui_slave;	/* slave on controller */
6723998Ssam 	int	(**ui_intr)();	/* interrupt handler(s) */
6823998Ssam 	caddr_t	ui_addr;	/* address of device in i/o space */
6923998Ssam 	short	ui_dk;		/* if init 1 set to number for iostat */
7023998Ssam 	short	ui_flags;	/* parameter from system specification */
7123998Ssam 	short	ui_alive;	/* device exists */
7223998Ssam 	short	ui_type;	/* driver specific type information */
7323998Ssam 	caddr_t	ui_physaddr;	/* phys addr, for standalone (dump) code */
7423998Ssam /* this is the forward link in a list of devices on a controller */
7523998Ssam 	struct	vba_device *ui_forw;
7623998Ssam /* if the device is connected to a controller, this is the controller */
7723998Ssam 	struct	vba_ctlr *ui_mi;
78*25857Ssam 	struct	vba_hd *ui_hd;
7923998Ssam };
8023998Ssam #endif
8123998Ssam 
8223998Ssam /*
8323998Ssam  * Per-driver structure.
8423998Ssam  *
8523998Ssam  * Each Versabus driver defines entries for a set of routines
8623998Ssam  * as well as an array of types which are acceptable to it.
8723998Ssam  * These are used at boot time by the configuration program.
8823998Ssam  */
8923998Ssam struct vba_driver {
9023998Ssam 	int	(*ud_probe)();		/* see if a driver is really there */
9123998Ssam 	int	(*ud_slave)();		/* see if a slave is there */
9223998Ssam 	int	(*ud_attach)();		/* setup driver for a slave */
9323998Ssam 	int	(*ud_dgo)();		/* fill csr/ba to start transfer */
9423998Ssam 	long	*ud_addr;		/* device csr addresses */
9523998Ssam 	char	*ud_dname;		/* name of a device */
9623998Ssam 	struct	vba_device **ud_dinfo;	/* backpointers to vbdinit structs */
9723998Ssam 	char	*ud_mname;		/* name of a controller */
9823998Ssam 	struct	vba_ctlr **ud_minfo;	/* backpointers to vbminit structs */
9923998Ssam };
10023998Ssam 
10123998Ssam #ifndef LOCORE
10223998Ssam #ifdef KERNEL
10323998Ssam /*
10423998Ssam  * VBA related kernel variables
10523998Ssam  */
106*25857Ssam int	numvba;					/* number of uba's */
107*25857Ssam struct	vba_hd vba_hd[];
10823998Ssam 
10923998Ssam /*
11023998Ssam  * Vbminit and vbdinit initialize the mass storage controller and
11123998Ssam  * device tables specifying possible devices.
11223998Ssam  */
11323998Ssam extern	struct	vba_ctlr vbminit[];
11423998Ssam extern	struct	vba_device vbdinit[];
11523998Ssam 
11623998Ssam /*
11723998Ssam  * Versabus device address space is mapped by VMEMmap
11823998Ssam  * into virtual address umem[][].
11923998Ssam  */
12023998Ssam extern	struct pte VMEMmap[];	/* vba device addr pte's */
12123998Ssam extern	char vmem[];		/* vba device addr space */
12223998Ssam 
12323998Ssam #endif KERNEL
12423998Ssam #endif !LOCORE
125