xref: /csrg-svn/sys/tahoe/vba/vbavar.h (revision 23998)
1*23998Ssam /*	vbavar.h	1.1	85/07/21	*/
2*23998Ssam 
3*23998Ssam /*
4*23998Ssam  * This file contains definitions related to the kernel structures
5*23998Ssam  * for dealing with the Versabus adapters.
6*23998Ssam  *
7*23998Ssam  * Each Versabus controller which is not a device has a vba_ctlr structure.
8*23998Ssam  * Each Versabus device has a vba_device structure.
9*23998Ssam  */
10*23998Ssam 
11*23998Ssam 
12*23998Ssam #ifndef LOCORE
13*23998Ssam /*
14*23998Ssam  * Per-controller structure.
15*23998Ssam  * (E.g. one for each disk and tape controller, and other things
16*23998Ssam  * which use and release buffered data paths.)
17*23998Ssam  *
18*23998Ssam  * If a controller has devices attached, then there are
19*23998Ssam  * cross-referenced vba_drive structures.
20*23998Ssam  * This structure is the one which is queued in Versabus resource wait,
21*23998Ssam  * and saves the information about Versabus resources which are used.
22*23998Ssam  * The queue of devices waiting to transfer is also attached here.
23*23998Ssam  */
24*23998Ssam struct vba_ctlr {
25*23998Ssam 	struct	vba_driver *um_driver;
26*23998Ssam 	short	um_ctlr;	/* controller index in driver */
27*23998Ssam 	short	um_vbanum;	/* the vba it is on */
28*23998Ssam 	short	um_alive;	/* controller exists */
29*23998Ssam 	int	(**um_intr)();	/* interrupt handler(s) */
30*23998Ssam 	caddr_t	um_addr;	/* address of device in i/o space */
31*23998Ssam /* the driver saves the prototype command here for use in its go routine */
32*23998Ssam 	int	um_cmd;		/* communication to dgo() */
33*23998Ssam 	int	um_vbinfo;	/* save Versabus registers, etc */
34*23998Ssam 	struct	buf um_tab;	/* queue of devices for this controller */
35*23998Ssam };
36*23998Ssam 
37*23998Ssam /*
38*23998Ssam  * Per ``device'' structure.
39*23998Ssam  * (A controller has devices or uses and releases buffered data paths).
40*23998Ssam  * (Everything else is a ``device''.)
41*23998Ssam  *
42*23998Ssam  * If a controller has many drives attached, then there will
43*23998Ssam  * be several vba_device structures associated with a single vba_ctlr
44*23998Ssam  * structure.
45*23998Ssam  *
46*23998Ssam  * This structure contains all the information necessary to run
47*23998Ssam  * a Versabus device.  It also contains information
48*23998Ssam  * for slaves of Versabus controllers as to which device on the slave
49*23998Ssam  * this is.  A flags field here can also be given in the system specification
50*23998Ssam  * and is used to tell which vcx lines are hard wired or other device
51*23998Ssam  * specific parameters.
52*23998Ssam  */
53*23998Ssam struct vba_device {
54*23998Ssam 	struct	vba_driver *ui_driver;
55*23998Ssam 	short	ui_unit;	/* unit number on the system */
56*23998Ssam 	short	ui_ctlr;	/* mass ctlr number; -1 if none */
57*23998Ssam 	short	ui_vbanum;	/* the vba it is on */
58*23998Ssam 	short	ui_slave;	/* slave on controller */
59*23998Ssam 	int	(**ui_intr)();	/* interrupt handler(s) */
60*23998Ssam 	caddr_t	ui_addr;	/* address of device in i/o space */
61*23998Ssam 	short	ui_dk;		/* if init 1 set to number for iostat */
62*23998Ssam 	short	ui_flags;	/* parameter from system specification */
63*23998Ssam 	short	ui_alive;	/* device exists */
64*23998Ssam 	short	ui_type;	/* driver specific type information */
65*23998Ssam 	caddr_t	ui_physaddr;	/* phys addr, for standalone (dump) code */
66*23998Ssam /* this is the forward link in a list of devices on a controller */
67*23998Ssam 	struct	vba_device *ui_forw;
68*23998Ssam /* if the device is connected to a controller, this is the controller */
69*23998Ssam 	struct	vba_ctlr *ui_mi;
70*23998Ssam };
71*23998Ssam #endif
72*23998Ssam 
73*23998Ssam /*
74*23998Ssam  * Per-driver structure.
75*23998Ssam  *
76*23998Ssam  * Each Versabus driver defines entries for a set of routines
77*23998Ssam  * as well as an array of types which are acceptable to it.
78*23998Ssam  * These are used at boot time by the configuration program.
79*23998Ssam  */
80*23998Ssam struct vba_driver {
81*23998Ssam 	int	(*ud_probe)();		/* see if a driver is really there */
82*23998Ssam 	int	(*ud_slave)();		/* see if a slave is there */
83*23998Ssam 	int	(*ud_attach)();		/* setup driver for a slave */
84*23998Ssam 	int	(*ud_dgo)();		/* fill csr/ba to start transfer */
85*23998Ssam 	long	*ud_addr;		/* device csr addresses */
86*23998Ssam 	char	*ud_dname;		/* name of a device */
87*23998Ssam 	struct	vba_device **ud_dinfo;	/* backpointers to vbdinit structs */
88*23998Ssam 	char	*ud_mname;		/* name of a controller */
89*23998Ssam 	struct	vba_ctlr **ud_minfo;	/* backpointers to vbminit structs */
90*23998Ssam 	short	ud_xclu;		/* want exclusive use of bdp's */
91*23998Ssam };
92*23998Ssam 
93*23998Ssam /*
94*23998Ssam  * Flags to VBA map/bdp allocation routines
95*23998Ssam  */
96*23998Ssam #define	VBA_NEEDBDP	1		/* transfer needs a bdp */
97*23998Ssam #define	VBA_CANTWAIT	2		/* don't block me */
98*23998Ssam #define	VBA_NEED16	3		/* need 16 bit addresses only */
99*23998Ssam 
100*23998Ssam #define	numvba  1				/* number of vba's */
101*23998Ssam #ifndef LOCORE
102*23998Ssam #ifdef KERNEL
103*23998Ssam /*
104*23998Ssam  * VBA related kernel variables
105*23998Ssam  */
106*23998Ssam 
107*23998Ssam /*
108*23998Ssam  * Vbminit and vbdinit initialize the mass storage controller and
109*23998Ssam  * device tables specifying possible devices.
110*23998Ssam  */
111*23998Ssam extern	struct	vba_ctlr vbminit[];
112*23998Ssam extern	struct	vba_device vbdinit[];
113*23998Ssam 
114*23998Ssam /*
115*23998Ssam  * Versabus device address space is mapped by VMEMmap
116*23998Ssam  * into virtual address umem[][].
117*23998Ssam  */
118*23998Ssam extern	struct pte VMEMmap[];	/* vba device addr pte's */
119*23998Ssam extern	char vmem[];		/* vba device addr space */
120*23998Ssam 
121*23998Ssam #endif KERNEL
122*23998Ssam #endif !LOCORE
123