don't know what reg points to, but it's not an mblok
[unix-history] / usr / src / sys / tahoe / vba / vbavar.h
CommitLineData
ef2ed459 1/* vbavar.h 1.6 87/04/01 */
e67951b3
SL
2
3/*
4 * This file contains definitions related to the kernel structures
87c4412d 5 * for dealing with the VERSAbus adapters.
e67951b3 6 *
87c4412d
SL
7 * Each VERSAbus has a vba_hd structure.
8 * Each VERSAbus controller which is not a device has a vba_ctlr structure.
9 * Each VERSAbus device has a vba_device structure.
e67951b3
SL
10 */
11
e67951b3 12#ifndef LOCORE
336ca318
SL
13/*
14 * Per-vba structure.
15 */
16struct vba_hd {
17 int vh_lastiv; /* last interrupt vector assigned */
18};
19
e67951b3
SL
20/*
21 * Per-controller structure.
22 * (E.g. one for each disk and tape controller, and other things
23 * which use and release buffered data paths.)
24 *
25 * If a controller has devices attached, then there are
26 * cross-referenced vba_drive structures.
87c4412d
SL
27 * This structure is the one which is queued in VERSAbus resource wait,
28 * and saves the information about VERSAbus resources which are used.
e67951b3
SL
29 * The queue of devices waiting to transfer is also attached here.
30 */
31struct vba_ctlr {
32 struct vba_driver *um_driver;
33 short um_ctlr; /* controller index in driver */
34 short um_vbanum; /* the vba it is on */
35 short um_alive; /* controller exists */
36 int (**um_intr)(); /* interrupt handler(s) */
37 caddr_t um_addr; /* address of device in i/o space */
336ca318 38 struct vba_hd *um_hd;
e67951b3
SL
39/* the driver saves the prototype command here for use in its go routine */
40 int um_cmd; /* communication to dgo() */
87c4412d 41 int um_vbinfo; /* save VERSAbus registers, etc */
e67951b3
SL
42 struct buf um_tab; /* queue of devices for this controller */
43};
44
45/*
46 * Per ``device'' structure.
47 * (A controller has devices or uses and releases buffered data paths).
48 * (Everything else is a ``device''.)
49 *
50 * If a controller has many drives attached, then there will
51 * be several vba_device structures associated with a single vba_ctlr
52 * structure.
53 *
54 * This structure contains all the information necessary to run
87c4412d
SL
55 * a VERSAbus device. It also contains information
56 * for slaves of VERSAbus controllers as to which device on the slave
e67951b3 57 * this is. A flags field here can also be given in the system specification
87c4412d 58 * and is used to tell which tty lines are hard wired or other device
e67951b3
SL
59 * specific parameters.
60 */
61struct vba_device {
62 struct vba_driver *ui_driver;
63 short ui_unit; /* unit number on the system */
64 short ui_ctlr; /* mass ctlr number; -1 if none */
65 short ui_vbanum; /* the vba it is on */
66 short ui_slave; /* slave on controller */
67 int (**ui_intr)(); /* interrupt handler(s) */
68 caddr_t ui_addr; /* address of device in i/o space */
69 short ui_dk; /* if init 1 set to number for iostat */
87c4412d 70 long ui_flags; /* parameter from system specification */
e67951b3
SL
71 short ui_alive; /* device exists */
72 short ui_type; /* driver specific type information */
73 caddr_t ui_physaddr; /* phys addr, for standalone (dump) code */
74/* this is the forward link in a list of devices on a controller */
75 struct vba_device *ui_forw;
76/* if the device is connected to a controller, this is the controller */
77 struct vba_ctlr *ui_mi;
336ca318 78 struct vba_hd *ui_hd;
e67951b3
SL
79};
80#endif
81
82/*
83 * Per-driver structure.
84 *
87c4412d 85 * Each VERSAbus driver defines entries for a set of routines
e67951b3
SL
86 * as well as an array of types which are acceptable to it.
87 * These are used at boot time by the configuration program.
88 */
89struct vba_driver {
90 int (*ud_probe)(); /* see if a driver is really there */
91 int (*ud_slave)(); /* see if a slave is there */
92 int (*ud_attach)(); /* setup driver for a slave */
93 int (*ud_dgo)(); /* fill csr/ba to start transfer */
94 long *ud_addr; /* device csr addresses */
95 char *ud_dname; /* name of a device */
96 struct vba_device **ud_dinfo; /* backpointers to vbdinit structs */
97 char *ud_mname; /* name of a controller */
98 struct vba_ctlr **ud_minfo; /* backpointers to vbminit structs */
e67951b3
SL
99};
100
1f9a1539
MK
101/*
102 * Common state for Versabus driver I/O resources,
103 * including memory for intermediate buffer and page map,
104 * allocated by vbainit.
105 */
106struct vb_buf {
107 /* these fields set up once by vbainit */
108 int vb_flags; /* device parameters */
109 struct pte *vb_map; /* private page entries */
110 caddr_t vb_utl; /* virtual addresses mapped by vb_map */
111 caddr_t vb_rawbuf; /* intermediate buffer */
112 u_long vb_physbuf; /* phys addr of intermediate buffer */
ef2ed459 113 u_long vb_bufsize; /* intermediate buffer size */
1f9a1539
MK
114 u_long vb_maxphys; /* physical address limit */
115 /* remaining fields apply to current transfer: */
116 int vb_copy; /* copy to/from intermediate buffer */
117 int vb_iskernel; /* is to/from kernel address space */
118};
119
120/*
121 * flags to vbainit
122 */
123#define VB_32BIT 0x00 /* device uses 32-bit addressing */
124#define VB_24BIT 0x01 /* device uses 24-bit addressing */
125#define VB_20BIT 0x02 /* device uses 20-bit addressing */
126#define VB_SCATTER 0x04 /* device does scatter-gather */
127
128/*
129 * hardware addressing limits
130 */
131#define VB_MAXADDR20 0x000fffff /* highest addr for 20-bit */
132#define VB_MAXADDR24 0x007fffff /* highest addr for 23/24-bit */
133#define VB_MAXADDR32 0x3effffff /* highest addr for 32-bit */
134
135/*
136 * Statistics on vba operations.
137 */
138struct vbastat {
ef2ed459
MK
139 u_long k_raw; /* to/from contiguous kernel DMA buffer */
140 u_long u_raw; /* to/from contiguous user DMA buffer */
141 u_long k_copy; /* copied to/from kernel */
142 u_long u_copy; /* copied to/from user */
143 u_long k_sg; /* scatter-gather to/from kernel */
144 u_long u_sg; /* scatter-gather to/from user */
1f9a1539
MK
145};
146
e67951b3
SL
147#ifndef LOCORE
148#ifdef KERNEL
149/*
150 * VBA related kernel variables
151 */
336ca318
SL
152int numvba; /* number of uba's */
153struct vba_hd vba_hd[];
1f9a1539 154struct vbastat vbastat;
e67951b3
SL
155
156/*
157 * Vbminit and vbdinit initialize the mass storage controller and
158 * device tables specifying possible devices.
159 */
160extern struct vba_ctlr vbminit[];
161extern struct vba_device vbdinit[];
162
163/*
87c4412d
SL
164 * VERSAbus device address space is mapped by VMEMmap
165 * into virtual address vmem[][].
e67951b3
SL
166 */
167extern struct pte VMEMmap[]; /* vba device addr pte's */
9d61b7ff 168extern caddr_t vmem; /* vba device addr space */
1f9a1539 169u_long vbasetup();
e67951b3
SL
170#endif KERNEL
171#endif !LOCORE