Commit | Line | Data |
---|---|---|
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 | * | |
3e3f9c04 | 6 | * @(#)mbavar.h 6.4 (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 |
32 | struct 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 | 54 | struct 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 | ||
3e3f9c04 MK |
70 | #define b_bdone b_bufsize /* redefinition for mi_tab XXX */ |
71 | ||
97fedd9e | 72 | /* |
8c5204cc BJ |
73 | * Tape formatter slaves are specified by |
74 | * the following information which is used | |
75 | * at boot time to initialize the tape driver | |
76 | * internal tables. | |
97fedd9e | 77 | */ |
8c5204cc BJ |
78 | struct mba_slave { |
79 | struct mba_driver *ms_driver; | |
80 | short ms_ctlr; /* which of several formatters */ | |
81 | short ms_unit; /* which unit to system */ | |
82 | short ms_slave; /* which slave to formatter */ | |
83 | short ms_alive; | |
9feb5e5d | 84 | }; |
3ed87cd4 | 85 | |
97fedd9e | 86 | /* |
8c5204cc BJ |
87 | * Per device-type structure. |
88 | * | |
89 | * Each massbus driver defines entries for a set of routines used | |
90 | * by the massbus driver, as well as an array of types which are | |
91 | * acceptable to it. | |
97fedd9e BJ |
92 | */ |
93 | struct mba_driver { | |
8c5204cc BJ |
94 | int (*md_attach)(); /* attach a device */ |
95 | int (*md_slave)(); /* attach a slave */ | |
97fedd9e BJ |
96 | int (*md_ustart)(); /* unit start routine */ |
97 | int (*md_start)(); /* setup a data transfer */ | |
98 | int (*md_dtint)(); /* data transfer complete */ | |
99 | int (*md_ndint)(); /* non-data transfer interrupt */ | |
100 | short *md_type; /* array of drive type codes */ | |
8c5204cc BJ |
101 | char *md_dname, *md_sname; /* device, slave names */ |
102 | struct mba_device **md_info; /* backpointers to mbinit structs */ | |
97fedd9e | 103 | }; |
3ed87cd4 | 104 | |
97fedd9e BJ |
105 | /* |
106 | * Possible return values from unit start routines. | |
107 | */ | |
108 | #define MBU_NEXT 0 /* skip to next operation */ | |
109 | #define MBU_BUSY 1 /* dual port busy; wait for intr */ | |
110 | #define MBU_STARTED 2 /* non-data transfer started */ | |
111 | #define MBU_DODATA 3 /* data transfer ready; start mba */ | |
3ed87cd4 | 112 | |
97fedd9e BJ |
113 | /* |
114 | * Possible return values from data transfer interrupt handling routines | |
115 | */ | |
116 | #define MBD_DONE 0 /* data transfer complete */ | |
117 | #define MBD_RETRY 1 /* error occurred, please retry */ | |
118 | #define MBD_RESTARTED 2 /* driver restarted i/o itself */ | |
5c93d6ba | 119 | #define MBD_REPOSITION 3 /* driver started unit, not transfer */ |
3ed87cd4 | 120 | |
97fedd9e BJ |
121 | /* |
122 | * Possible return values from non-data-transfer interrupt handling routines | |
123 | */ | |
124 | #define MBN_DONE 0 /* non-data transfer complete */ | |
125 | #define MBN_RETRY 1 /* failed; retry the operation */ | |
8c5204cc | 126 | #define MBN_SKIP 2 /* don't do anything */ |
d75b699b | 127 | |
97fedd9e | 128 | /* |
8c5204cc | 129 | * Clear attention status for specified device. |
97fedd9e BJ |
130 | */ |
131 | #define mbclrattn(mi) ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive) | |
6a2942e9 BJ |
132 | |
133 | /* | |
134 | * Kernel definitions related to mba. | |
135 | */ | |
136 | #ifdef KERNEL | |
55a14fbf | 137 | int nummba; |
b9b45ab9 | 138 | #if NMBA > 0 |
9feb5e5d | 139 | struct mba_hd mba_hd[NMBA]; |
6a2942e9 | 140 | extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int(); |
8c5204cc BJ |
141 | |
142 | extern struct mba_device mbdinit[]; | |
143 | extern struct mba_slave mbsinit[]; | |
6a2942e9 | 144 | #endif |
b9b45ab9 | 145 | #endif |