mscp_subr.c revision 1.31 1 1.31 thorpej /* $NetBSD: mscp_subr.c,v 1.31 2006/03/25 23:20:18 thorpej Exp $ */
2 1.1 ragge /*
3 1.1 ragge * Copyright (c) 1988 Regents of the University of California.
4 1.1 ragge * All rights reserved.
5 1.1 ragge *
6 1.1 ragge * This code is derived from software contributed to Berkeley by
7 1.1 ragge * Chris Torek.
8 1.1 ragge *
9 1.1 ragge * Redistribution and use in source and binary forms, with or without
10 1.1 ragge * modification, are permitted provided that the following conditions
11 1.1 ragge * are met:
12 1.1 ragge * 1. Redistributions of source code must retain the above copyright
13 1.1 ragge * notice, this list of conditions and the following disclaimer.
14 1.1 ragge * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 ragge * notice, this list of conditions and the following disclaimer in the
16 1.1 ragge * documentation and/or other materials provided with the distribution.
17 1.24 agc * 3. Neither the name of the University nor the names of its contributors
18 1.24 agc * may be used to endorse or promote products derived from this software
19 1.24 agc * without specific prior written permission.
20 1.24 agc *
21 1.24 agc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.24 agc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.24 agc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.24 agc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.24 agc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.24 agc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.24 agc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.24 agc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.24 agc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.24 agc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.24 agc * SUCH DAMAGE.
32 1.24 agc *
33 1.24 agc * @(#)mscp.c 7.5 (Berkeley) 12/16/90
34 1.24 agc */
35 1.24 agc
36 1.24 agc /*
37 1.24 agc * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
38 1.24 agc *
39 1.24 agc * This code is derived from software contributed to Berkeley by
40 1.24 agc * Chris Torek.
41 1.24 agc *
42 1.24 agc * Redistribution and use in source and binary forms, with or without
43 1.24 agc * modification, are permitted provided that the following conditions
44 1.24 agc * are met:
45 1.24 agc * 1. Redistributions of source code must retain the above copyright
46 1.24 agc * notice, this list of conditions and the following disclaimer.
47 1.24 agc * 2. Redistributions in binary form must reproduce the above copyright
48 1.24 agc * notice, this list of conditions and the following disclaimer in the
49 1.24 agc * documentation and/or other materials provided with the distribution.
50 1.1 ragge * 3. All advertising materials mentioning features or use of this software
51 1.1 ragge * must display the following acknowledgement:
52 1.1 ragge * This product includes software developed by the University of
53 1.1 ragge * California, Berkeley and its contributors.
54 1.1 ragge * 4. Neither the name of the University nor the names of its contributors
55 1.1 ragge * may be used to endorse or promote products derived from this software
56 1.1 ragge * without specific prior written permission.
57 1.1 ragge *
58 1.1 ragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59 1.1 ragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 1.1 ragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 1.1 ragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 1.1 ragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 1.1 ragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 1.1 ragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 1.1 ragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 1.1 ragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 1.1 ragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 1.1 ragge * SUCH DAMAGE.
69 1.1 ragge *
70 1.1 ragge * @(#)mscp.c 7.5 (Berkeley) 12/16/90
71 1.1 ragge */
72 1.1 ragge
73 1.1 ragge /*
74 1.1 ragge * MSCP generic driver routines
75 1.1 ragge */
76 1.18 lukem
77 1.18 lukem #include <sys/cdefs.h>
78 1.31 thorpej __KERNEL_RCSID(0, "$NetBSD: mscp_subr.c,v 1.31 2006/03/25 23:20:18 thorpej Exp $");
79 1.1 ragge
80 1.1 ragge #include <sys/param.h>
81 1.2 ragge #include <sys/device.h>
82 1.1 ragge #include <sys/buf.h>
83 1.25 yamt #include <sys/bufq.h>
84 1.6 ragge #include <sys/systm.h>
85 1.6 ragge #include <sys/proc.h>
86 1.1 ragge
87 1.12 ragge #include <machine/bus.h>
88 1.1 ragge #include <machine/sid.h>
89 1.1 ragge
90 1.12 ragge #include <dev/mscp/mscp.h>
91 1.12 ragge #include <dev/mscp/mscpreg.h>
92 1.12 ragge #include <dev/mscp/mscpvar.h>
93 1.1 ragge
94 1.1 ragge #include "ra.h"
95 1.2 ragge #include "mt.h"
96 1.1 ragge
97 1.9 ragge #define b_forw b_hash.le_next
98 1.1 ragge
99 1.26 perry int mscp_match(struct device *, struct cfdata *, void *);
100 1.26 perry void mscp_attach(struct device *, struct device *, void *);
101 1.26 perry void mscp_start(struct mscp_softc *);
102 1.26 perry int mscp_init(struct mscp_softc *);
103 1.26 perry void mscp_initds(struct mscp_softc *);
104 1.26 perry int mscp_waitstep(struct mscp_softc *, int, int);
105 1.1 ragge
106 1.21 thorpej CFATTACH_DECL(mscpbus, sizeof(struct mscp_softc),
107 1.22 thorpej mscp_match, mscp_attach, NULL, NULL);
108 1.1 ragge
109 1.12 ragge #define READ_SA (bus_space_read_2(mi->mi_iot, mi->mi_sah, 0))
110 1.12 ragge #define READ_IP (bus_space_read_2(mi->mi_iot, mi->mi_iph, 0))
111 1.12 ragge #define WRITE_IP(x) bus_space_write_2(mi->mi_iot, mi->mi_iph, 0, (x))
112 1.12 ragge #define WRITE_SW(x) bus_space_write_2(mi->mi_iot, mi->mi_swh, 0, (x))
113 1.12 ragge
114 1.1 ragge struct mscp slavereply;
115 1.1 ragge
116 1.1 ragge /*
117 1.1 ragge * This function is for delay during init. Some MSCP clone card (Dilog)
118 1.1 ragge * can't handle fast read from its registers, and therefore need
119 1.1 ragge * a delay between them.
120 1.1 ragge */
121 1.1 ragge
122 1.1 ragge #define DELAYTEN 1000
123 1.1 ragge int
124 1.1 ragge mscp_waitstep(mi, mask, result)
125 1.1 ragge struct mscp_softc *mi;
126 1.1 ragge int mask, result;
127 1.1 ragge {
128 1.1 ragge int status = 1;
129 1.1 ragge
130 1.12 ragge if ((READ_SA & mask) != result) {
131 1.1 ragge volatile int count = 0;
132 1.12 ragge while ((READ_SA & mask) != result) {
133 1.1 ragge DELAY(10000);
134 1.1 ragge count += 1;
135 1.1 ragge if (count > DELAYTEN)
136 1.1 ragge break;
137 1.1 ragge }
138 1.1 ragge if (count > DELAYTEN)
139 1.1 ragge status = 0;
140 1.1 ragge }
141 1.1 ragge return status;
142 1.1 ragge }
143 1.1 ragge
144 1.1 ragge int
145 1.1 ragge mscp_match(parent, match, aux)
146 1.1 ragge struct device *parent;
147 1.8 ragge struct cfdata *match;
148 1.8 ragge void *aux;
149 1.1 ragge {
150 1.1 ragge struct mscp_attach_args *ma = aux;
151 1.1 ragge
152 1.9 ragge #if NRA || NRX
153 1.1 ragge if (ma->ma_type & MSCPBUS_DISK)
154 1.1 ragge return 1;
155 1.1 ragge #endif
156 1.1 ragge #if NMT
157 1.1 ragge if (ma->ma_type & MSCPBUS_TAPE)
158 1.1 ragge return 1;
159 1.1 ragge #endif
160 1.1 ragge return 0;
161 1.1 ragge };
162 1.1 ragge
163 1.1 ragge void
164 1.1 ragge mscp_attach(parent, self, aux)
165 1.1 ragge struct device *parent, *self;
166 1.1 ragge void *aux;
167 1.1 ragge {
168 1.1 ragge struct mscp_attach_args *ma = aux;
169 1.1 ragge struct mscp_softc *mi = (void *)self;
170 1.28 ragge struct mscp *mp2;
171 1.9 ragge volatile struct mscp *mp;
172 1.1 ragge volatile int i;
173 1.1 ragge int timeout, next = 0;
174 1.1 ragge
175 1.1 ragge mi->mi_mc = ma->ma_mc;
176 1.1 ragge mi->mi_me = NULL;
177 1.1 ragge mi->mi_type = ma->ma_type;
178 1.1 ragge mi->mi_uda = ma->ma_uda;
179 1.12 ragge mi->mi_dmat = ma->ma_dmat;
180 1.12 ragge mi->mi_dmam = ma->ma_dmam;
181 1.12 ragge mi->mi_iot = ma->ma_iot;
182 1.12 ragge mi->mi_iph = ma->ma_iph;
183 1.12 ragge mi->mi_sah = ma->ma_sah;
184 1.12 ragge mi->mi_swh = ma->ma_swh;
185 1.1 ragge mi->mi_ivec = ma->ma_ivec;
186 1.3 ragge mi->mi_adapnr = ma->ma_adapnr;
187 1.3 ragge mi->mi_ctlrnr = ma->ma_ctlrnr;
188 1.1 ragge *ma->ma_softc = mi;
189 1.1 ragge /*
190 1.1 ragge * Go out to init the bus, so that we can give commands
191 1.1 ragge * to its devices.
192 1.1 ragge */
193 1.9 ragge mi->mi_cmd.mri_size = NCMD;
194 1.9 ragge mi->mi_cmd.mri_desc = mi->mi_uda->mp_ca.ca_cmddsc;
195 1.9 ragge mi->mi_cmd.mri_ring = mi->mi_uda->mp_cmd;
196 1.9 ragge mi->mi_rsp.mri_size = NRSP;
197 1.9 ragge mi->mi_rsp.mri_desc = mi->mi_uda->mp_ca.ca_rspdsc;
198 1.9 ragge mi->mi_rsp.mri_ring = mi->mi_uda->mp_rsp;
199 1.29 yamt bufq_alloc(&mi->mi_resq, "fcfs", 0);
200 1.1 ragge
201 1.1 ragge if (mscp_init(mi)) {
202 1.5 christos printf("%s: can't init, controller hung\n",
203 1.1 ragge mi->mi_dev.dv_xname);
204 1.1 ragge return;
205 1.1 ragge }
206 1.12 ragge for (i = 0; i < NCMD; i++) {
207 1.12 ragge mi->mi_mxiuse |= (1 << i);
208 1.14 ragge if (bus_dmamap_create(mi->mi_dmat, (64*1024), 16, (64*1024),
209 1.12 ragge 0, BUS_DMA_NOWAIT, &mi->mi_xi[i].mxi_dmam)) {
210 1.12 ragge printf("Couldn't alloc dmamap %d\n", i);
211 1.12 ragge return;
212 1.12 ragge }
213 1.12 ragge }
214 1.27 perry
215 1.1 ragge
216 1.1 ragge #if NRA
217 1.1 ragge if (ma->ma_type & MSCPBUS_DISK) {
218 1.1 ragge extern struct mscp_device ra_device;
219 1.1 ragge
220 1.1 ragge mi->mi_me = &ra_device;
221 1.1 ragge }
222 1.1 ragge #endif
223 1.1 ragge #if NMT
224 1.1 ragge if (ma->ma_type & MSCPBUS_TAPE) {
225 1.1 ragge extern struct mscp_device mt_device;
226 1.1 ragge
227 1.1 ragge mi->mi_me = &mt_device;
228 1.1 ragge }
229 1.1 ragge #endif
230 1.1 ragge /*
231 1.1 ragge * Go out and search for sub-units on this MSCP bus,
232 1.1 ragge * and call config_found for each found.
233 1.1 ragge */
234 1.1 ragge findunit:
235 1.1 ragge mp = mscp_getcp(mi, MSCP_DONTWAIT);
236 1.1 ragge if (mp == NULL)
237 1.1 ragge panic("mscpattach: no packets");
238 1.1 ragge mp->mscp_opcode = M_OP_GETUNITST;
239 1.1 ragge mp->mscp_unit = next;
240 1.1 ragge mp->mscp_modifier = M_GUM_NEXTUNIT;
241 1.1 ragge *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
242 1.1 ragge slavereply.mscp_opcode = 0;
243 1.1 ragge
244 1.12 ragge i = bus_space_read_2(mi->mi_iot, mi->mi_iph, 0);
245 1.1 ragge mp = &slavereply;
246 1.1 ragge timeout = 1000;
247 1.1 ragge while (timeout-- > 0) {
248 1.1 ragge DELAY(10000);
249 1.1 ragge if (mp->mscp_opcode)
250 1.1 ragge goto gotit;
251 1.1 ragge }
252 1.5 christos printf("%s: no response to Get Unit Status request\n",
253 1.1 ragge mi->mi_dev.dv_xname);
254 1.1 ragge return;
255 1.1 ragge
256 1.1 ragge gotit: /*
257 1.1 ragge * Got a slave response. If the unit is there, use it.
258 1.1 ragge */
259 1.1 ragge switch (mp->mscp_status & M_ST_MASK) {
260 1.1 ragge
261 1.9 ragge case M_ST_SUCCESS: /* worked */
262 1.9 ragge case M_ST_AVAILABLE: /* found another drive */
263 1.9 ragge break; /* use it */
264 1.1 ragge
265 1.1 ragge case M_ST_OFFLINE:
266 1.1 ragge /*
267 1.1 ragge * Figure out why it is off line. It may be because
268 1.9 ragge * it is nonexistent, or because it is spun down, or
269 1.9 ragge * for some other reason.
270 1.9 ragge */
271 1.9 ragge switch (mp->mscp_status & ~M_ST_MASK) {
272 1.9 ragge
273 1.9 ragge case M_OFFLINE_UNKNOWN:
274 1.9 ragge /*
275 1.9 ragge * No such drive, and there are none with
276 1.9 ragge * higher unit numbers either, if we are
277 1.9 ragge * using M_GUM_NEXTUNIT.
278 1.9 ragge */
279 1.2 ragge mi->mi_ierr = 3;
280 1.9 ragge return;
281 1.9 ragge
282 1.9 ragge case M_OFFLINE_UNMOUNTED:
283 1.9 ragge /*
284 1.9 ragge * The drive is not spun up. Use it anyway.
285 1.9 ragge *
286 1.9 ragge * N.B.: this seems to be a common occurrance
287 1.9 ragge * after a power failure. The first attempt
288 1.9 ragge * to bring it on line seems to spin it up
289 1.9 ragge * (and thus takes several minutes). Perhaps
290 1.9 ragge * we should note here that the on-line may
291 1.9 ragge * take longer than usual.
292 1.9 ragge */
293 1.9 ragge break;
294 1.1 ragge
295 1.9 ragge default:
296 1.9 ragge /*
297 1.9 ragge * In service, or something else equally unusable.
298 1.9 ragge */
299 1.9 ragge printf("%s: unit %d off line: ", mi->mi_dev.dv_xname,
300 1.9 ragge mp->mscp_unit);
301 1.28 ragge mp2 = __UNVOLATILE(mp);
302 1.28 ragge mscp_printevent(mp2);
303 1.1 ragge next++;
304 1.9 ragge goto findunit;
305 1.9 ragge }
306 1.9 ragge break;
307 1.1 ragge
308 1.9 ragge default:
309 1.9 ragge printf("%s: unable to get unit status: ", mi->mi_dev.dv_xname);
310 1.28 ragge mscp_printevent(__UNVOLATILE(mp));
311 1.9 ragge return;
312 1.9 ragge }
313 1.9 ragge
314 1.9 ragge /*
315 1.9 ragge * If we get a lower number, we have circulated around all
316 1.1 ragge * devices and are finished, otherwise try to find next unit.
317 1.2 ragge * We shouldn't ever get this, it's a workaround.
318 1.9 ragge */
319 1.9 ragge if (mp->mscp_unit < next)
320 1.9 ragge return;
321 1.1 ragge
322 1.1 ragge next = mp->mscp_unit + 1;
323 1.1 ragge goto findunit;
324 1.1 ragge }
325 1.1 ragge
326 1.1 ragge
327 1.1 ragge /*
328 1.27 perry * The ctlr gets initialised, normally after boot but may also be
329 1.1 ragge * done if the ctlr gets in an unknown state. Returns 1 if init
330 1.1 ragge * fails, 0 otherwise.
331 1.1 ragge */
332 1.1 ragge int
333 1.1 ragge mscp_init(mi)
334 1.1 ragge struct mscp_softc *mi;
335 1.1 ragge {
336 1.1 ragge struct mscp *mp;
337 1.1 ragge volatile int i;
338 1.1 ragge int status, count;
339 1.6 ragge unsigned int j = 0;
340 1.1 ragge
341 1.9 ragge /*
342 1.9 ragge * While we are thinking about it, reset the next command
343 1.9 ragge * and response indicies.
344 1.9 ragge */
345 1.1 ragge mi->mi_cmd.mri_next = 0;
346 1.1 ragge mi->mi_rsp.mri_next = 0;
347 1.1 ragge
348 1.1 ragge mi->mi_flags |= MSC_IGNOREINTR;
349 1.6 ragge
350 1.6 ragge if ((mi->mi_type & MSCPBUS_KDB) == 0)
351 1.12 ragge WRITE_IP(0); /* Kick off */;
352 1.6 ragge
353 1.1 ragge status = mscp_waitstep(mi, MP_STEP1, MP_STEP1);/* Wait to it wakes up */
354 1.1 ragge if (status == 0)
355 1.1 ragge return 1; /* Init failed */
356 1.12 ragge if (READ_SA & MP_ERR) {
357 1.31 thorpej (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0);
358 1.1 ragge return 1;
359 1.1 ragge }
360 1.1 ragge
361 1.1 ragge /* step1 */
362 1.12 ragge WRITE_SW(MP_ERR | (NCMDL2 << 11) | (NRSPL2 << 8) |
363 1.12 ragge MP_IE | (mi->mi_ivec >> 2));
364 1.1 ragge status = mscp_waitstep(mi, STEP1MASK, STEP1GOOD);
365 1.1 ragge if (status == 0) {
366 1.31 thorpej (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0);
367 1.1 ragge return 1;
368 1.1 ragge }
369 1.1 ragge
370 1.1 ragge /* step2 */
371 1.27 perry WRITE_SW(((mi->mi_dmam->dm_segs[0].ds_addr & 0xffff) +
372 1.12 ragge offsetof(struct mscp_pack, mp_ca.ca_rspdsc[0])) |
373 1.12 ragge (vax_cputype == VAX_780 || vax_cputype == VAX_8600 ? MP_PI : 0));
374 1.1 ragge status = mscp_waitstep(mi, STEP2MASK, STEP2GOOD(mi->mi_ivec >> 2));
375 1.9 ragge if (status == 0) {
376 1.31 thorpej (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0);
377 1.9 ragge return 1;
378 1.9 ragge }
379 1.1 ragge
380 1.1 ragge /* step3 */
381 1.12 ragge WRITE_SW((mi->mi_dmam->dm_segs[0].ds_addr >> 16));
382 1.1 ragge status = mscp_waitstep(mi, STEP3MASK, STEP3GOOD);
383 1.27 perry if (status == 0) {
384 1.31 thorpej (*mi->mi_mc->mc_saerror)(device_parent(&mi->mi_dev), 0);
385 1.9 ragge return 1;
386 1.9 ragge }
387 1.12 ragge i = READ_SA & 0377;
388 1.5 christos printf(": version %d model %d\n", i & 15, i >> 4);
389 1.1 ragge
390 1.9 ragge #define BURST 4 /* XXX */
391 1.1 ragge if (mi->mi_type & MSCPBUS_UDA) {
392 1.12 ragge WRITE_SW(MP_GO | (BURST - 1) << 2);
393 1.27 perry printf("%s: DMA burst size set to %d\n",
394 1.1 ragge mi->mi_dev.dv_xname, BURST);
395 1.1 ragge }
396 1.12 ragge WRITE_SW(MP_GO);
397 1.1 ragge
398 1.1 ragge mscp_initds(mi);
399 1.1 ragge mi->mi_flags &= ~MSC_IGNOREINTR;
400 1.1 ragge
401 1.1 ragge /*
402 1.1 ragge * Set up all necessary info in the bus softc struct, get a
403 1.1 ragge * mscp packet and set characteristics for this controller.
404 1.1 ragge */
405 1.1 ragge mi->mi_credits = MSCP_MINCREDITS + 1;
406 1.1 ragge mp = mscp_getcp(mi, MSCP_DONTWAIT);
407 1.2 ragge
408 1.1 ragge mi->mi_credits = 0;
409 1.1 ragge mp->mscp_opcode = M_OP_SETCTLRC;
410 1.2 ragge mp->mscp_unit = mp->mscp_modifier = mp->mscp_flags =
411 1.27 perry mp->mscp_sccc.sccc_version = mp->mscp_sccc.sccc_hosttimo =
412 1.2 ragge mp->mscp_sccc.sccc_time = mp->mscp_sccc.sccc_time1 =
413 1.2 ragge mp->mscp_sccc.sccc_errlgfl = 0;
414 1.1 ragge mp->mscp_sccc.sccc_ctlrflags = M_CF_ATTN | M_CF_MISC | M_CF_THIS;
415 1.1 ragge *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
416 1.12 ragge i = READ_IP;
417 1.1 ragge
418 1.9 ragge count = 0;
419 1.9 ragge while (count < DELAYTEN) {
420 1.10 ragge if (((volatile int)mi->mi_flags & MSC_READY) != 0)
421 1.9 ragge break;
422 1.12 ragge if ((j = READ_SA) & MP_ERR)
423 1.2 ragge goto out;
424 1.9 ragge DELAY(10000);
425 1.9 ragge count += 1;
426 1.9 ragge }
427 1.1 ragge if (count == DELAYTEN) {
428 1.2 ragge out:
429 1.27 perry printf("%s: couldn't set ctlr characteristics, sa=%x\n",
430 1.2 ragge mi->mi_dev.dv_xname, j);
431 1.1 ragge return 1;
432 1.1 ragge }
433 1.1 ragge return 0;
434 1.1 ragge }
435 1.1 ragge
436 1.1 ragge /*
437 1.1 ragge * Initialise the various data structures that control the mscp protocol.
438 1.1 ragge */
439 1.1 ragge void
440 1.1 ragge mscp_initds(mi)
441 1.1 ragge struct mscp_softc *mi;
442 1.1 ragge {
443 1.1 ragge struct mscp_pack *ud = mi->mi_uda;
444 1.1 ragge struct mscp *mp;
445 1.1 ragge int i;
446 1.1 ragge
447 1.1 ragge for (i = 0, mp = ud->mp_rsp; i < NRSP; i++, mp++) {
448 1.1 ragge ud->mp_ca.ca_rspdsc[i] = MSCP_OWN | MSCP_INT |
449 1.12 ragge (mi->mi_dmam->dm_segs[0].ds_addr +
450 1.12 ragge offsetof(struct mscp_pack, mp_rsp[i].mscp_cmdref));
451 1.1 ragge mp->mscp_addr = &ud->mp_ca.ca_rspdsc[i];
452 1.1 ragge mp->mscp_msglen = MSCP_MSGLEN;
453 1.1 ragge }
454 1.1 ragge for (i = 0, mp = ud->mp_cmd; i < NCMD; i++, mp++) {
455 1.1 ragge ud->mp_ca.ca_cmddsc[i] = MSCP_INT |
456 1.12 ragge (mi->mi_dmam->dm_segs[0].ds_addr +
457 1.12 ragge offsetof(struct mscp_pack, mp_cmd[i].mscp_cmdref));
458 1.1 ragge mp->mscp_addr = &ud->mp_ca.ca_cmddsc[i];
459 1.1 ragge mp->mscp_msglen = MSCP_MSGLEN;
460 1.2 ragge if (mi->mi_type & MSCPBUS_TAPE)
461 1.2 ragge mp->mscp_vcid = 1;
462 1.1 ragge }
463 1.1 ragge }
464 1.1 ragge
465 1.12 ragge static void mscp_kickaway(struct mscp_softc *);
466 1.12 ragge
467 1.1 ragge void
468 1.1 ragge mscp_intr(mi)
469 1.1 ragge struct mscp_softc *mi;
470 1.1 ragge {
471 1.1 ragge struct mscp_pack *ud = mi->mi_uda;
472 1.1 ragge
473 1.1 ragge if (mi->mi_flags & MSC_IGNOREINTR)
474 1.1 ragge return;
475 1.9 ragge /*
476 1.9 ragge * Check for response and command ring transitions.
477 1.9 ragge */
478 1.9 ragge if (ud->mp_ca.ca_rspint) {
479 1.9 ragge ud->mp_ca.ca_rspint = 0;
480 1.9 ragge mscp_dorsp(mi);
481 1.9 ragge }
482 1.9 ragge if (ud->mp_ca.ca_cmdint) {
483 1.9 ragge ud->mp_ca.ca_cmdint = 0;
484 1.9 ragge MSCP_DOCMD(mi);
485 1.9 ragge }
486 1.6 ragge
487 1.6 ragge /*
488 1.12 ragge * If there are any not-yet-handled request, try them now.
489 1.6 ragge */
490 1.29 yamt if (BUFQ_PEEK(mi->mi_resq))
491 1.12 ragge mscp_kickaway(mi);
492 1.1 ragge }
493 1.1 ragge
494 1.1 ragge int
495 1.1 ragge mscp_print(aux, name)
496 1.1 ragge void *aux;
497 1.6 ragge const char *name;
498 1.1 ragge {
499 1.9 ragge struct drive_attach_args *da = aux;
500 1.9 ragge struct mscp *mp = da->da_mp;
501 1.9 ragge int type = mp->mscp_guse.guse_mediaid;
502 1.9 ragge
503 1.9 ragge if (name) {
504 1.23 thorpej aprint_normal("%c%c", MSCP_MID_CHAR(2, type),
505 1.23 thorpej MSCP_MID_CHAR(1, type));
506 1.9 ragge if (MSCP_MID_ECH(0, type))
507 1.23 thorpej aprint_normal("%c", MSCP_MID_CHAR(0, type));
508 1.23 thorpej aprint_normal("%d at %s drive %d", MSCP_MID_NUM(type), name,
509 1.9 ragge mp->mscp_unit);
510 1.9 ragge }
511 1.1 ragge return UNCONF;
512 1.1 ragge }
513 1.1 ragge
514 1.1 ragge /*
515 1.1 ragge * common strategy routine for all types of MSCP devices.
516 1.1 ragge */
517 1.1 ragge void
518 1.6 ragge mscp_strategy(bp, usc)
519 1.6 ragge struct buf *bp;
520 1.1 ragge struct device *usc;
521 1.1 ragge {
522 1.1 ragge struct mscp_softc *mi = (void *)usc;
523 1.17 thorpej int s = spluba();
524 1.12 ragge
525 1.29 yamt BUFQ_PUT(mi->mi_resq, bp);
526 1.12 ragge mscp_kickaway(mi);
527 1.12 ragge splx(s);
528 1.12 ragge }
529 1.12 ragge
530 1.12 ragge
531 1.12 ragge void
532 1.12 ragge mscp_kickaway(mi)
533 1.12 ragge struct mscp_softc *mi;
534 1.12 ragge {
535 1.12 ragge struct buf *bp;
536 1.1 ragge struct mscp *mp;
537 1.12 ragge int next;
538 1.1 ragge
539 1.29 yamt while ((bp = BUFQ_PEEK(mi->mi_resq)) != NULL) {
540 1.12 ragge /*
541 1.12 ragge * Ok; we are ready to try to start a xfer. Get a MSCP packet
542 1.12 ragge * and try to start...
543 1.12 ragge */
544 1.12 ragge if ((mp = mscp_getcp(mi, MSCP_DONTWAIT)) == NULL) {
545 1.12 ragge if (mi->mi_credits > MSCP_MINCREDITS)
546 1.12 ragge printf("%s: command ring too small\n",
547 1.31 thorpej device_parent(&mi->mi_dev)->dv_xname);
548 1.12 ragge /*
549 1.12 ragge * By some (strange) reason we didn't get a MSCP packet.
550 1.12 ragge * Just return and wait for free packets.
551 1.12 ragge */
552 1.12 ragge return;
553 1.12 ragge }
554 1.27 perry
555 1.12 ragge if ((next = (ffs(mi->mi_mxiuse) - 1)) < 0)
556 1.12 ragge panic("no mxi buffers");
557 1.12 ragge mi->mi_mxiuse &= ~(1 << next);
558 1.12 ragge if (mi->mi_xi[next].mxi_inuse)
559 1.12 ragge panic("mxi inuse");
560 1.6 ragge /*
561 1.12 ragge * Set up the MSCP packet and ask the ctlr to start.
562 1.6 ragge */
563 1.12 ragge mp->mscp_opcode =
564 1.12 ragge (bp->b_flags & B_READ) ? M_OP_READ : M_OP_WRITE;
565 1.12 ragge mp->mscp_cmdref = next;
566 1.12 ragge mi->mi_xi[next].mxi_bp = bp;
567 1.12 ragge mi->mi_xi[next].mxi_mp = mp;
568 1.12 ragge mi->mi_xi[next].mxi_inuse = 1;
569 1.12 ragge bp->b_resid = next;
570 1.12 ragge (*mi->mi_me->me_fillin)(bp, mp);
571 1.31 thorpej (*mi->mi_mc->mc_go)(device_parent(&mi->mi_dev),
572 1.31 thorpej &mi->mi_xi[next]);
573 1.29 yamt (void)BUFQ_GET(mi->mi_resq);
574 1.1 ragge }
575 1.1 ragge }
576 1.1 ragge
577 1.1 ragge void
578 1.12 ragge mscp_dgo(mi, mxi)
579 1.1 ragge struct mscp_softc *mi;
580 1.12 ragge struct mscp_xi *mxi;
581 1.1 ragge {
582 1.1 ragge volatile int i;
583 1.1 ragge struct mscp *mp;
584 1.1 ragge
585 1.9 ragge /*
586 1.9 ragge * Fill in the MSCP packet and move the buffer to the I/O wait queue.
587 1.9 ragge */
588 1.12 ragge mp = mxi->mxi_mp;
589 1.12 ragge mp->mscp_seq.seq_buffer = mxi->mxi_dmam->dm_segs[0].ds_addr;
590 1.1 ragge
591 1.6 ragge *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
592 1.12 ragge i = READ_IP;
593 1.1 ragge }
594 1.1 ragge
595 1.6 ragge #ifdef DIAGNOSTIC
596 1.1 ragge /*
597 1.1 ragge * Dump the entire contents of an MSCP packet in hex. Mainly useful
598 1.1 ragge * for debugging....
599 1.1 ragge */
600 1.1 ragge void
601 1.1 ragge mscp_hexdump(mp)
602 1.15 augustss struct mscp *mp;
603 1.1 ragge {
604 1.15 augustss long *p = (long *) mp;
605 1.15 augustss int i = mp->mscp_msglen;
606 1.1 ragge
607 1.1 ragge if (i > 256) /* sanity */
608 1.1 ragge i = 256;
609 1.1 ragge i /= sizeof (*p); /* ASSUMES MULTIPLE OF sizeof(long) */
610 1.1 ragge while (--i >= 0)
611 1.5 christos printf("0x%x ", (int)*p++);
612 1.5 christos printf("\n");
613 1.1 ragge }
614 1.6 ragge #endif
615 1.1 ragge
616 1.1 ragge /*
617 1.1 ragge * MSCP error reporting
618 1.1 ragge */
619 1.1 ragge
620 1.1 ragge /*
621 1.1 ragge * Messages for the various subcodes.
622 1.1 ragge */
623 1.1 ragge static char unknown_msg[] = "unknown subcode";
624 1.1 ragge
625 1.1 ragge /*
626 1.1 ragge * Subcodes for Success (0)
627 1.1 ragge */
628 1.28 ragge static const char *succ_msgs[] = {
629 1.1 ragge "normal", /* 0 */
630 1.1 ragge "spin down ignored", /* 1 = Spin-Down Ignored */
631 1.1 ragge "still connected", /* 2 = Still Connected */
632 1.1 ragge unknown_msg,
633 1.1 ragge "dup. unit #", /* 4 = Duplicate Unit Number */
634 1.1 ragge unknown_msg,
635 1.1 ragge unknown_msg,
636 1.1 ragge unknown_msg,
637 1.1 ragge "already online", /* 8 = Already Online */
638 1.1 ragge unknown_msg,
639 1.1 ragge unknown_msg,
640 1.1 ragge unknown_msg,
641 1.1 ragge unknown_msg,
642 1.1 ragge unknown_msg,
643 1.1 ragge unknown_msg,
644 1.1 ragge unknown_msg,
645 1.1 ragge "still online", /* 16 = Still Online */
646 1.1 ragge };
647 1.1 ragge
648 1.1 ragge /*
649 1.1 ragge * Subcodes for Invalid Command (1)
650 1.1 ragge */
651 1.28 ragge static const char *icmd_msgs[] = {
652 1.1 ragge "invalid msg length", /* 0 = Invalid Message Length */
653 1.1 ragge };
654 1.1 ragge
655 1.1 ragge /*
656 1.1 ragge * Subcodes for Command Aborted (2)
657 1.1 ragge */
658 1.1 ragge /* none known */
659 1.1 ragge
660 1.1 ragge /*
661 1.1 ragge * Subcodes for Unit Offline (3)
662 1.1 ragge */
663 1.28 ragge static const char *offl_msgs[] = {
664 1.1 ragge "unknown drive", /* 0 = Unknown, or online to other ctlr */
665 1.1 ragge "not mounted", /* 1 = Unmounted, or RUN/STOP at STOP */
666 1.1 ragge "inoperative", /* 2 = Unit Inoperative */
667 1.1 ragge unknown_msg,
668 1.1 ragge "duplicate", /* 4 = Duplicate Unit Number */
669 1.1 ragge unknown_msg,
670 1.1 ragge unknown_msg,
671 1.1 ragge unknown_msg,
672 1.1 ragge "in diagnosis", /* 8 = Disabled by FS or diagnostic */
673 1.1 ragge };
674 1.1 ragge
675 1.1 ragge /*
676 1.1 ragge * Subcodes for Unit Available (4)
677 1.1 ragge */
678 1.1 ragge /* none known */
679 1.1 ragge
680 1.1 ragge /*
681 1.1 ragge * Subcodes for Media Format Error (5)
682 1.1 ragge */
683 1.28 ragge static const char *media_fmt_msgs[] = {
684 1.1 ragge "fct unread - edc", /* 0 = FCT unreadable */
685 1.1 ragge "invalid sector header",/* 1 = Invalid Sector Header */
686 1.1 ragge "not 512 sectors", /* 2 = Not 512 Byte Sectors */
687 1.1 ragge "not formatted", /* 3 = Not Formatted */
688 1.1 ragge "fct ecc", /* 4 = FCT ECC */
689 1.1 ragge };
690 1.1 ragge
691 1.1 ragge /*
692 1.1 ragge * Subcodes for Write Protected (6)
693 1.1 ragge * N.B.: Code 6 subcodes are 7 bits higher than other subcodes
694 1.1 ragge * (i.e., bits 12-15).
695 1.1 ragge */
696 1.28 ragge static const char *wrprot_msgs[] = {
697 1.1 ragge unknown_msg,
698 1.1 ragge "software", /* 1 = Software Write Protect */
699 1.1 ragge "hardware", /* 2 = Hardware Write Protect */
700 1.1 ragge };
701 1.1 ragge
702 1.1 ragge /*
703 1.1 ragge * Subcodes for Compare Error (7)
704 1.1 ragge */
705 1.1 ragge /* none known */
706 1.1 ragge
707 1.1 ragge /*
708 1.1 ragge * Subcodes for Data Error (8)
709 1.1 ragge */
710 1.28 ragge static const char *data_msgs[] = {
711 1.1 ragge "forced error", /* 0 = Forced Error (software) */
712 1.1 ragge unknown_msg,
713 1.1 ragge "header compare", /* 2 = Header Compare Error */
714 1.1 ragge "sync timeout", /* 3 = Sync Timeout Error */
715 1.1 ragge unknown_msg,
716 1.1 ragge unknown_msg,
717 1.1 ragge unknown_msg,
718 1.1 ragge "uncorrectable ecc", /* 7 = Uncorrectable ECC */
719 1.1 ragge "1 symbol ecc", /* 8 = 1 bit ECC */
720 1.1 ragge "2 symbol ecc", /* 9 = 2 bit ECC */
721 1.1 ragge "3 symbol ecc", /* 10 = 3 bit ECC */
722 1.1 ragge "4 symbol ecc", /* 11 = 4 bit ECC */
723 1.1 ragge "5 symbol ecc", /* 12 = 5 bit ECC */
724 1.1 ragge "6 symbol ecc", /* 13 = 6 bit ECC */
725 1.1 ragge "7 symbol ecc", /* 14 = 7 bit ECC */
726 1.1 ragge "8 symbol ecc", /* 15 = 8 bit ECC */
727 1.1 ragge };
728 1.1 ragge
729 1.1 ragge /*
730 1.1 ragge * Subcodes for Host Buffer Access Error (9)
731 1.1 ragge */
732 1.28 ragge static const char *host_buffer_msgs[] = {
733 1.1 ragge unknown_msg,
734 1.1 ragge "odd xfer addr", /* 1 = Odd Transfer Address */
735 1.1 ragge "odd xfer count", /* 2 = Odd Transfer Count */
736 1.1 ragge "non-exist. memory", /* 3 = Non-Existent Memory */
737 1.1 ragge "memory parity", /* 4 = Memory Parity Error */
738 1.1 ragge };
739 1.1 ragge
740 1.1 ragge /*
741 1.1 ragge * Subcodes for Controller Error (10)
742 1.1 ragge */
743 1.28 ragge static const char *cntlr_msgs[] = {
744 1.1 ragge unknown_msg,
745 1.1 ragge "serdes overrun", /* 1 = Serialiser/Deserialiser Overrun */
746 1.1 ragge "edc", /* 2 = Error Detection Code? */
747 1.1 ragge "inconsistant internal data struct",/* 3 = Internal Error */
748 1.1 ragge };
749 1.1 ragge
750 1.1 ragge /*
751 1.1 ragge * Subcodes for Drive Error (11)
752 1.1 ragge */
753 1.28 ragge static const char *drive_msgs[] = {
754 1.1 ragge unknown_msg,
755 1.1 ragge "sdi command timeout", /* 1 = SDI Command Timeout */
756 1.1 ragge "ctlr detected protocol",/* 2 = Controller Detected Protocol Error */
757 1.1 ragge "positioner", /* 3 = Positioner Error */
758 1.1 ragge "lost rd/wr ready", /* 4 = Lost R/W Ready Error */
759 1.1 ragge "drive clock dropout", /* 5 = Lost Drive Clock */
760 1.1 ragge "lost recvr ready", /* 6 = Lost Receiver Ready */
761 1.9 ragge "drive detected error", /* 7 = Drive Error */
762 1.1 ragge "ctlr detected pulse or parity",/* 8 = Pulse or Parity Error */
763 1.1 ragge };
764 1.1 ragge
765 1.1 ragge /*
766 1.1 ragge * The following table correlates message codes with the
767 1.1 ragge * decoding strings.
768 1.1 ragge */
769 1.1 ragge struct code_decode {
770 1.28 ragge const char *cdc_msg;
771 1.1 ragge int cdc_nsubcodes;
772 1.28 ragge const char **cdc_submsgs;
773 1.1 ragge } code_decode[] = {
774 1.9 ragge #define SC(m) sizeof (m) / sizeof (m[0]), m
775 1.1 ragge {"success", SC(succ_msgs)},
776 1.1 ragge {"invalid command", SC(icmd_msgs)},
777 1.1 ragge {"command aborted", 0, 0},
778 1.1 ragge {"unit offline", SC(offl_msgs)},
779 1.1 ragge {"unit available", 0, 0},
780 1.1 ragge {"media format error", SC(media_fmt_msgs)},
781 1.1 ragge {"write protected", SC(wrprot_msgs)},
782 1.1 ragge {"compare error", 0, 0},
783 1.1 ragge {"data error", SC(data_msgs)},
784 1.1 ragge {"host buffer access error", SC(host_buffer_msgs)},
785 1.1 ragge {"controller error", SC(cntlr_msgs)},
786 1.1 ragge {"drive error", SC(drive_msgs)},
787 1.1 ragge #undef SC
788 1.1 ragge };
789 1.1 ragge
790 1.1 ragge /*
791 1.1 ragge * Print the decoded error event from an MSCP error datagram.
792 1.1 ragge */
793 1.1 ragge void
794 1.1 ragge mscp_printevent(mp)
795 1.1 ragge struct mscp *mp;
796 1.1 ragge {
797 1.15 augustss int event = mp->mscp_event;
798 1.15 augustss struct code_decode *cdc;
799 1.1 ragge int c, sc;
800 1.28 ragge const char *cm, *scm;
801 1.1 ragge
802 1.1 ragge /*
803 1.1 ragge * The code is the lower six bits of the event number (aka
804 1.1 ragge * status). If that is 6 (write protect), the subcode is in
805 1.1 ragge * bits 12-15; otherwise, it is in bits 5-11.
806 1.1 ragge * I WONDER WHAT THE OTHER BITS ARE FOR. IT SURE WOULD BE
807 1.1 ragge * NICE IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
808 1.1 ragge */
809 1.1 ragge c = event & M_ST_MASK;
810 1.1 ragge sc = (c != 6 ? event >> 5 : event >> 12) & 0x7ff;
811 1.1 ragge if (c >= sizeof code_decode / sizeof code_decode[0])
812 1.1 ragge cm = "- unknown code", scm = "??";
813 1.1 ragge else {
814 1.1 ragge cdc = &code_decode[c];
815 1.1 ragge cm = cdc->cdc_msg;
816 1.1 ragge if (sc >= cdc->cdc_nsubcodes)
817 1.1 ragge scm = unknown_msg;
818 1.1 ragge else
819 1.1 ragge scm = cdc->cdc_submsgs[sc];
820 1.1 ragge }
821 1.5 christos printf(" %s (%s) (code %d, subcode %d)\n", cm, scm, c, sc);
822 1.1 ragge }
823 1.1 ragge
824 1.28 ragge static const char *codemsg[16] = {
825 1.2 ragge "lbn", "code 1", "code 2", "code 3",
826 1.2 ragge "code 4", "code 5", "rbn", "code 7",
827 1.2 ragge "code 8", "code 9", "code 10", "code 11",
828 1.2 ragge "code 12", "code 13", "code 14", "code 15"
829 1.2 ragge };
830 1.1 ragge /*
831 1.1 ragge * Print the code and logical block number for an error packet.
832 1.1 ragge * THIS IS PROBABLY PECULIAR TO DISK DRIVES. IT SURE WOULD BE
833 1.1 ragge * NICE IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
834 1.1 ragge */
835 1.2 ragge int
836 1.2 ragge mscp_decodeerror(name, mp, mi)
837 1.28 ragge const char *name;
838 1.15 augustss struct mscp *mp;
839 1.2 ragge struct mscp_softc *mi;
840 1.1 ragge {
841 1.2 ragge int issoft;
842 1.27 perry /*
843 1.2 ragge * We will get three sdi errors of type 11 after autoconfig
844 1.2 ragge * is finished; depending of searching for non-existing units.
845 1.2 ragge * How can we avoid this???
846 1.2 ragge */
847 1.2 ragge if (((mp->mscp_event & M_ST_MASK) == 11) && (mi->mi_ierr++ < 3))
848 1.2 ragge return 1;
849 1.1 ragge /*
850 1.1 ragge * For bad blocks, mp->mscp_erd.erd_hdr identifies a code and
851 1.1 ragge * the logical block number. Code 0 is a regular block; code 6
852 1.1 ragge * is a replacement block. The remaining codes are currently
853 1.1 ragge * undefined. The code is in the upper four bits of the header
854 1.1 ragge * (bits 0-27 are the lbn).
855 1.1 ragge */
856 1.2 ragge issoft = mp->mscp_flags & (M_LF_SUCC | M_LF_CONT);
857 1.1 ragge #define BADCODE(h) (codemsg[(unsigned)(h) >> 28])
858 1.1 ragge #define BADLBN(h) ((h) & 0xfffffff)
859 1.1 ragge
860 1.5 christos printf("%s: drive %d %s error datagram%s:", name, mp->mscp_unit,
861 1.1 ragge issoft ? "soft" : "hard",
862 1.1 ragge mp->mscp_flags & M_LF_CONT ? " (continuing)" : "");
863 1.1 ragge switch (mp->mscp_format & 0377) {
864 1.1 ragge
865 1.1 ragge case M_FM_CTLRERR: /* controller error */
866 1.1 ragge break;
867 1.1 ragge
868 1.1 ragge case M_FM_BUSADDR: /* host memory access error */
869 1.5 christos printf(" memory addr 0x%x:", (int)mp->mscp_erd.erd_busaddr);
870 1.1 ragge break;
871 1.1 ragge
872 1.1 ragge case M_FM_DISKTRN:
873 1.5 christos printf(" unit %d: level %d retry %d, %s %d:",
874 1.1 ragge mp->mscp_unit,
875 1.1 ragge mp->mscp_erd.erd_level, mp->mscp_erd.erd_retry,
876 1.1 ragge BADCODE(mp->mscp_erd.erd_hdr),
877 1.1 ragge (int)BADLBN(mp->mscp_erd.erd_hdr));
878 1.1 ragge break;
879 1.1 ragge
880 1.1 ragge case M_FM_SDI:
881 1.5 christos printf(" unit %d: %s %d:", mp->mscp_unit,
882 1.1 ragge BADCODE(mp->mscp_erd.erd_hdr),
883 1.1 ragge (int)BADLBN(mp->mscp_erd.erd_hdr));
884 1.1 ragge break;
885 1.1 ragge
886 1.1 ragge case M_FM_SMLDSK:
887 1.5 christos printf(" unit %d: small disk error, cyl %d:",
888 1.1 ragge mp->mscp_unit, mp->mscp_erd.erd_sdecyl);
889 1.1 ragge break;
890 1.1 ragge
891 1.2 ragge case M_FM_TAPETRN:
892 1.5 christos printf(" unit %d: tape transfer error, grp 0x%x event 0%o:",
893 1.2 ragge mp->mscp_unit, mp->mscp_erd.erd_sdecyl, mp->mscp_event);
894 1.2 ragge break;
895 1.2 ragge
896 1.2 ragge case M_FM_STIERR:
897 1.5 christos printf(" unit %d: STI error, event 0%o:", mp->mscp_unit,
898 1.2 ragge mp->mscp_event);
899 1.2 ragge break;
900 1.2 ragge
901 1.1 ragge default:
902 1.5 christos printf(" unit %d: unknown error, format 0x%x:",
903 1.1 ragge mp->mscp_unit, mp->mscp_format);
904 1.1 ragge }
905 1.1 ragge mscp_printevent(mp);
906 1.2 ragge return 0;
907 1.1 ragge #undef BADCODE
908 1.1 ragge #undef BADLBN
909 1.1 ragge }
910