split header files in 2 and rename structures for sanity
[unix-history] / usr / src / sys / vax / mba / mbavar.h
CommitLineData
8c5204cc 1/* mbavar.h 4.13 81/03/08 */
3ed87cd4
BJ
2
3/*
8c5204cc
BJ
4 * This file contains definitions related to the kernel structures
5 * for dealing with the massbus adapters.
6 *
7 * Each mba has a mba_hd structure.
8 * Each massbus device has a mba_device structure.
9 * Each massbus slave has a mba_slave structure.
10 *
11 * At boot time we prowl the structures and fill in the pointers
12 * for devices which we find.
3ed87cd4
BJ
13 */
14
97fedd9e 15/*
8c5204cc
BJ
16 * Per-mba structure.
17 *
18 * The initialization routine uses the information in the mbdinit table
19 * to initialize the what is attached to each massbus slot information.
20 * It counts the number of devices on each mba (to see if bothering to
21 * search/seek is appropriate).
22 *
23 * During normal operation, the devices attached to the mba which wish
24 * to transfer are queued on the mh_act? links.
97fedd9e 25 */
8c5204cc
BJ
26struct mba_hd {
27 short mh_active; /* set if mba is active */
28 short mh_ndrive; /* number of devices, to avoid seeks */
29 struct mba_regs *mh_mba; /* virt addr of mba */
30 struct mba_regs *mh_physmba; /* phys addr of mba */
31 struct mba_device *mh_mbip[8]; /* what is attached to each dev */
32 struct mba_device *mh_actf; /* head of queue to transfer */
33 struct mba_device *mh_actl; /* tail of queue to transfer */
34};
4d9e9e73
BJ
35
36/*
8c5204cc
BJ
37 * Per-device structure
38 * (one for each RM/RP disk, and one for each tape formatter).
39 *
40 * This structure is used by the device driver as its argument
41 * to the massbus driver, and by the massbus driver to locate
42 * the device driver for a particular massbus slot.
43 *
44 * The device drivers hang ready buffers on this structure,
45 * and the massbus driver will start i/o on the first such buffer
46 * when appropriate.
4d9e9e73 47 */
8c5204cc 48struct mba_device {
97fedd9e 49 struct mba_driver *mi_driver;
97fedd9e
BJ
50 short mi_unit; /* unit number to the system */
51 short mi_mbanum; /* the mba it is on */
52 short mi_drive; /* controller on mba */
6a2942e9 53 short mi_dk; /* driver number for iostat */
97fedd9e
BJ
54 short mi_alive; /* device exists */
55 short mi_type; /* driver specific unit type */
97fedd9e 56 struct buf mi_tab; /* head of queue for this device */
8c5204cc 57 struct mba_device *mi_forw;
97fedd9e
BJ
58/* we could compute these every time, but hereby save time */
59 struct mba_regs *mi_mba;
60 struct mba_drv *mi_drv;
61 struct mba_hd *mi_hd;
3ed87cd4
BJ
62};
63
97fedd9e 64/*
8c5204cc
BJ
65 * Tape formatter slaves are specified by
66 * the following information which is used
67 * at boot time to initialize the tape driver
68 * internal tables.
97fedd9e 69 */
8c5204cc
BJ
70struct mba_slave {
71 struct mba_driver *ms_driver;
72 short ms_ctlr; /* which of several formatters */
73 short ms_unit; /* which unit to system */
74 short ms_slave; /* which slave to formatter */
75 short ms_alive;
9feb5e5d 76};
3ed87cd4 77
97fedd9e 78/*
8c5204cc
BJ
79 * Per device-type structure.
80 *
81 * Each massbus driver defines entries for a set of routines used
82 * by the massbus driver, as well as an array of types which are
83 * acceptable to it.
97fedd9e
BJ
84 */
85struct mba_driver {
8c5204cc
BJ
86 int (*md_attach)(); /* attach a device */
87 int (*md_slave)(); /* attach a slave */
97fedd9e
BJ
88 int (*md_ustart)(); /* unit start routine */
89 int (*md_start)(); /* setup a data transfer */
90 int (*md_dtint)(); /* data transfer complete */
91 int (*md_ndint)(); /* non-data transfer interrupt */
92 short *md_type; /* array of drive type codes */
8c5204cc
BJ
93 char *md_dname, *md_sname; /* device, slave names */
94 struct mba_device **md_info; /* backpointers to mbinit structs */
97fedd9e 95};
3ed87cd4 96
97fedd9e
BJ
97/*
98 * Possible return values from unit start routines.
99 */
100#define MBU_NEXT 0 /* skip to next operation */
101#define MBU_BUSY 1 /* dual port busy; wait for intr */
102#define MBU_STARTED 2 /* non-data transfer started */
103#define MBU_DODATA 3 /* data transfer ready; start mba */
3ed87cd4 104
97fedd9e
BJ
105/*
106 * Possible return values from data transfer interrupt handling routines
107 */
108#define MBD_DONE 0 /* data transfer complete */
109#define MBD_RETRY 1 /* error occurred, please retry */
110#define MBD_RESTARTED 2 /* driver restarted i/o itself */
3ed87cd4 111
97fedd9e
BJ
112/*
113 * Possible return values from non-data-transfer interrupt handling routines
114 */
115#define MBN_DONE 0 /* non-data transfer complete */
116#define MBN_RETRY 1 /* failed; retry the operation */
8c5204cc
BJ
117#define MBN_SKIP 2 /* don't do anything */
118#define MBN_CONT 3 /* operation continues */
d75b699b 119
97fedd9e 120/*
8c5204cc 121 * Clear attention status for specified device.
97fedd9e
BJ
122 */
123#define mbclrattn(mi) ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
6a2942e9
BJ
124
125/*
126 * Kernel definitions related to mba.
127 */
128#ifdef KERNEL
b9b45ab9 129#if NMBA > 0
9feb5e5d 130struct mba_hd mba_hd[NMBA];
6a2942e9 131extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
8c5204cc
BJ
132
133extern struct mba_device mbdinit[];
134extern struct mba_slave mbsinit[];
6a2942e9
BJ
135int nummba;
136#endif
b9b45ab9 137#endif