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