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