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