nhpib.c revision 1.29 1 /* $NetBSD: nhpib.c,v 1.29 2003/08/07 16:27:33 agc Exp $ */
2
3 /*-
4 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * Copyright (c) 1982, 1990, 1993
41 * The Regents of the University of California. All rights reserved.
42 *
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 * 3. Neither the name of the University nor the names of its contributors
52 * may be used to endorse or promote products derived from this software
53 * without specific prior written permission.
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 * SUCH DAMAGE.
66 *
67 * @(#)nhpib.c 8.2 (Berkeley) 1/12/94
68 */
69
70 /*
71 * Internal/98624 HPIB driver
72 */
73
74 #include <sys/cdefs.h>
75 __KERNEL_RCSID(0, "$NetBSD: nhpib.c,v 1.29 2003/08/07 16:27:33 agc Exp $");
76
77 #include <sys/param.h>
78 #include <sys/systm.h>
79 #include <sys/callout.h>
80 #include <sys/kernel.h>
81 #include <sys/buf.h>
82 #include <sys/device.h>
83
84 #include <machine/bus.h>
85
86 #include <hp300/dev/intiovar.h>
87 #include <hp300/dev/diovar.h>
88 #include <hp300/dev/diodevs.h>
89 #include <hp300/dev/dmavar.h>
90
91 #include <hp300/dev/nhpibreg.h>
92 #include <hp300/dev/hpibvar.h>
93
94 /*
95 * ODD parity table for listen and talk addresses and secondary commands.
96 * The TI9914A doesn't produce the parity bit.
97 */
98 static u_char listnr_par[] = {
99 0040,0241,0242,0043,0244,0045,0046,0247,
100 0250,0051,0052,0253,0054,0255,0256,0057,
101 0260,0061,0062,0263,0064,0265,0266,0067,
102 0070,0271,0272,0073,0274,0075,0076,0277,
103 };
104 static u_char talker_par[] = {
105 0100,0301,0302,0103,0304,0105,0106,0307,
106 0310,0111,0112,0313,0114,0315,0316,0117,
107 0320,0121,0122,0323,0124,0325,0326,0127,
108 0130,0331,0332,0133,0334,0135,0136,0337,
109 };
110 static u_char sec_par[] = {
111 0340,0141,0142,0343,0144,0345,0346,0147,
112 0150,0351,0352,0153,0354,0155,0156,0357,
113 0160,0361,0362,0163,0364,0165,0166,0367,
114 0370,0171,0172,0373,0174,0375,0376,0177
115 };
116
117 void nhpibifc __P((struct nhpibdevice *));
118 void nhpibreadtimo __P((void *));
119 int nhpibwait __P((struct nhpibdevice *, int));
120
121 void nhpibreset __P((struct hpibbus_softc *));
122 int nhpibsend __P((struct hpibbus_softc *, int, int, void *, int));
123 int nhpibrecv __P((struct hpibbus_softc *, int, int, void *, int));
124 int nhpibppoll __P((struct hpibbus_softc *));
125 void nhpibppwatch __P((void *));
126 void nhpibgo __P((struct hpibbus_softc *, int, int, void *, int, int, int));
127 void nhpibdone __P((struct hpibbus_softc *));
128 int nhpibintr __P((void *));
129
130 /*
131 * Our controller ops structure.
132 */
133 struct hpib_controller nhpib_controller = {
134 nhpibreset,
135 nhpibsend,
136 nhpibrecv,
137 nhpibppoll,
138 nhpibppwatch,
139 nhpibgo,
140 nhpibdone,
141 nhpibintr
142 };
143
144 struct nhpib_softc {
145 struct device sc_dev; /* generic device glue */
146
147 bus_space_tag_t sc_bst;
148 bus_space_handle_t sc_bsh;
149
150 struct nhpibdevice *sc_regs; /* device registers */
151 struct hpibbus_softc *sc_hpibbus; /* XXX */
152
153 int sc_myaddr;
154 int sc_type;
155
156 struct callout sc_read_ch;
157 struct callout sc_ppwatch_ch;
158 };
159
160 int nhpib_dio_match __P((struct device *, struct cfdata *, void *));
161 void nhpib_dio_attach __P((struct device *, struct device *, void *));
162 int nhpib_intio_match __P((struct device *, struct cfdata *, void *));
163 void nhpib_intio_attach __P((struct device *, struct device *, void *));
164
165 void nhpib_common_attach(struct nhpib_softc *, const char *);
166
167 CFATTACH_DECL(nhpib_dio, sizeof(struct nhpib_softc),
168 nhpib_dio_match, nhpib_dio_attach, NULL, NULL);
169
170 CFATTACH_DECL(nhpib_intio, sizeof(struct nhpib_softc),
171 nhpib_intio_match, nhpib_intio_attach, NULL, NULL);
172
173 int
174 nhpib_intio_match(parent, match, aux)
175 struct device *parent;
176 struct cfdata *match;
177 void *aux;
178 {
179 struct intio_attach_args *ia = aux;
180
181 if (strcmp("hpib", ia->ia_modname) == 0)
182 return (1);
183
184 return (0);
185 }
186
187 int
188 nhpib_dio_match(parent, match, aux)
189 struct device *parent;
190 struct cfdata *match;
191 void *aux;
192 {
193 struct dio_attach_args *da = aux;
194
195 if (da->da_id == DIO_DEVICE_ID_NHPIB)
196 return (1);
197
198 return (0);
199 }
200
201 void
202 nhpib_intio_attach(parent, self, aux)
203 struct device *parent, *self;
204 void *aux;
205 {
206 struct nhpib_softc *sc = (struct nhpib_softc *)self;
207 struct intio_attach_args *ia = aux;
208 bus_space_tag_t bst = ia->ia_bst;
209 const char *desc = "internal HP-IB";
210
211 if (bus_space_map(bst, ia->ia_iobase, INTIO_DEVSIZE, 0, &sc->sc_bsh)) {
212 printf(": can't map registers\n");
213 return;
214 }
215
216 sc->sc_bst = bst;
217 sc->sc_myaddr = HPIBA_BA;
218 sc->sc_type = HPIBA;
219
220 nhpib_common_attach(sc, desc);
221
222 /* establish the interrupt handler */
223 (void) intio_intr_establish(nhpibintr, sc, ia->ia_ipl, IPL_BIO);
224 }
225
226 void
227 nhpib_dio_attach(parent, self, aux)
228 struct device *parent, *self;
229 void *aux;
230 {
231 struct nhpib_softc *sc = (struct nhpib_softc *)self;
232 struct dio_attach_args *da = aux;
233 bus_space_tag_t bst = da->da_bst;
234 const char *desc = DIO_DEVICE_DESC_NHPIB;
235
236 if (bus_space_map(bst, da->da_addr, da->da_size, 0, &sc->sc_bsh)) {
237 printf(": can't map registers\n");
238 return;
239 }
240
241 sc->sc_bst = bst;
242 /* read address off switches */
243 sc->sc_myaddr = bus_space_read_1(sc->sc_bst, sc->sc_bsh, 5);
244 sc->sc_type = HPIBB;
245
246 nhpib_common_attach(sc, desc);
247
248 /* establish the interrupt handler */
249 (void)dio_intr_establish(nhpibintr, sc, da->da_ipl, IPL_BIO);
250 }
251
252 void
253 nhpib_common_attach(sc, desc)
254 struct nhpib_softc *sc;
255 const char *desc;
256 {
257 struct hpibdev_attach_args ha;
258
259 printf(": %s\n", desc);
260
261 sc->sc_regs = (struct nhpibdevice *)bus_space_vaddr(sc->sc_bst,
262 sc->sc_bsh);
263
264 callout_init(&sc->sc_read_ch);
265 callout_init(&sc->sc_ppwatch_ch);
266
267 ha.ha_ops = &nhpib_controller;
268 ha.ha_type = sc->sc_type; /* XXX */
269 ha.ha_ba = sc->sc_myaddr;
270 ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
271 (void)config_found((void *)sc, &ha, hpibdevprint);
272 }
273
274 void
275 nhpibreset(hs)
276 struct hpibbus_softc *hs;
277 {
278 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
279 struct nhpibdevice *hd = sc->sc_regs;
280
281 hd->hpib_acr = AUX_SSWRST;
282 hd->hpib_ar = hs->sc_ba;
283 hd->hpib_lim = LIS_ERR;
284 hd->hpib_mim = 0;
285 hd->hpib_acr = AUX_CDAI;
286 hd->hpib_acr = AUX_CSHDW;
287 hd->hpib_acr = AUX_SSTD1;
288 hd->hpib_acr = AUX_SVSTD1;
289 hd->hpib_acr = AUX_CPP;
290 hd->hpib_acr = AUX_CHDFA;
291 hd->hpib_acr = AUX_CHDFE;
292 hd->hpib_acr = AUX_RHDF;
293 hd->hpib_acr = AUX_CSWRST;
294 nhpibifc(hd);
295 hd->hpib_ie = IDS_IE;
296 hd->hpib_data = C_DCL_P;
297 DELAY(100000);
298 }
299
300 void
301 nhpibifc(hd)
302 struct nhpibdevice *hd;
303 {
304 hd->hpib_acr = AUX_TCA;
305 hd->hpib_acr = AUX_CSRE;
306 hd->hpib_acr = AUX_SSIC;
307 DELAY(100);
308 hd->hpib_acr = AUX_CSIC;
309 hd->hpib_acr = AUX_SSRE;
310 }
311
312 int
313 nhpibsend(hs, slave, sec, ptr, origcnt)
314 struct hpibbus_softc *hs;
315 int slave, sec, origcnt;
316 void *ptr;
317 {
318 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
319 struct nhpibdevice *hd = sc->sc_regs;
320 int cnt = origcnt;
321 char *addr = ptr;
322
323 hd->hpib_acr = AUX_TCA;
324 hd->hpib_data = C_UNL_P;
325 if (nhpibwait(hd, MIS_BO))
326 goto senderror;
327 hd->hpib_data = talker_par[hs->sc_ba];
328 hd->hpib_acr = AUX_STON;
329 if (nhpibwait(hd, MIS_BO))
330 goto senderror;
331 hd->hpib_data = listnr_par[slave];
332 if (nhpibwait(hd, MIS_BO))
333 goto senderror;
334 if (sec >= 0 || sec == -2) {
335 if (sec == -2) /* selected device clear KLUDGE */
336 hd->hpib_data = C_SDC_P;
337 else
338 hd->hpib_data = sec_par[sec];
339 if (nhpibwait(hd, MIS_BO))
340 goto senderror;
341 }
342 hd->hpib_acr = AUX_GTS;
343 if (cnt) {
344 while (--cnt > 0) {
345 hd->hpib_data = *addr++;
346 if (nhpibwait(hd, MIS_BO))
347 goto senderror;
348 }
349 hd->hpib_acr = AUX_EOI;
350 hd->hpib_data = *addr;
351 if (nhpibwait(hd, MIS_BO))
352 goto senderror;
353 hd->hpib_acr = AUX_TCA;
354 #if 0
355 /*
356 * May be causing 345 disks to hang due to interference
357 * with PPOLL mechanism.
358 */
359 hd->hpib_data = C_UNL_P;
360 (void) nhpibwait(hd, MIS_BO);
361 #endif
362 }
363 return(origcnt);
364
365 senderror:
366 nhpibifc(hd);
367 return(origcnt - cnt - 1);
368 }
369
370 int
371 nhpibrecv(hs, slave, sec, ptr, origcnt)
372 struct hpibbus_softc *hs;
373 int slave, sec, origcnt;
374 void *ptr;
375 {
376 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
377 struct nhpibdevice *hd = sc->sc_regs;
378 int cnt = origcnt;
379 char *addr = ptr;
380
381 /*
382 * Slave < 0 implies continuation of a previous receive
383 * that probably timed out.
384 */
385 if (slave >= 0) {
386 hd->hpib_acr = AUX_TCA;
387 hd->hpib_data = C_UNL_P;
388 if (nhpibwait(hd, MIS_BO))
389 goto recverror;
390 hd->hpib_data = listnr_par[hs->sc_ba];
391 hd->hpib_acr = AUX_SLON;
392 if (nhpibwait(hd, MIS_BO))
393 goto recverror;
394 hd->hpib_data = talker_par[slave];
395 if (nhpibwait(hd, MIS_BO))
396 goto recverror;
397 if (sec >= 0) {
398 hd->hpib_data = sec_par[sec];
399 if (nhpibwait(hd, MIS_BO))
400 goto recverror;
401 }
402 hd->hpib_acr = AUX_RHDF;
403 hd->hpib_acr = AUX_GTS;
404 }
405 if (cnt) {
406 while (--cnt >= 0) {
407 if (nhpibwait(hd, MIS_BI))
408 goto recvbyteserror;
409 *addr++ = hd->hpib_data;
410 }
411 hd->hpib_acr = AUX_TCA;
412 hd->hpib_data = (slave == 31) ? C_UNA_P : C_UNT_P;
413 (void) nhpibwait(hd, MIS_BO);
414 }
415 return(origcnt);
416
417 recverror:
418 nhpibifc(hd);
419 recvbyteserror:
420 return(origcnt - cnt - 1);
421 }
422
423 void
424 nhpibgo(hs, slave, sec, ptr, count, rw, timo)
425 struct hpibbus_softc *hs;
426 int slave, sec, count, rw, timo;
427 void *ptr;
428 {
429 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
430 struct nhpibdevice *hd = sc->sc_regs;
431 char *addr = ptr;
432
433 hs->sc_flags |= HPIBF_IO;
434 if (timo)
435 hs->sc_flags |= HPIBF_TIMO;
436 if (rw == B_READ)
437 hs->sc_flags |= HPIBF_READ;
438 #ifdef DEBUG
439 else if (hs->sc_flags & HPIBF_READ) {
440 printf("nhpibgo: HPIBF_READ still set\n");
441 hs->sc_flags &= ~HPIBF_READ;
442 }
443 #endif
444 hs->sc_count = count;
445 hs->sc_addr = addr;
446 if (hs->sc_flags & HPIBF_READ) {
447 hs->sc_curcnt = count;
448 dmago(hs->sc_dq->dq_chan, addr, count, DMAGO_BYTE|DMAGO_READ);
449 nhpibrecv(hs, slave, sec, 0, 0);
450 hd->hpib_mim = MIS_END;
451 } else {
452 hd->hpib_mim = 0;
453 if (count < hpibdmathresh) {
454 hs->sc_curcnt = count;
455 nhpibsend(hs, slave, sec, addr, count);
456 nhpibdone(hs);
457 return;
458 }
459 hs->sc_curcnt = --count;
460 dmago(hs->sc_dq->dq_chan, addr, count, DMAGO_BYTE);
461 nhpibsend(hs, slave, sec, 0, 0);
462 }
463 hd->hpib_ie = IDS_IE | IDS_DMA(hs->sc_dq->dq_chan);
464 }
465
466 /*
467 * This timeout can only happen if a DMA read finishes DMAing with the read
468 * still pending (more data in read transaction than the driver was prepared
469 * to accept). At the moment, variable-record tape drives are the only things
470 * capabale of doing this. We repeat the necessary code from nhpibintr() -
471 * easier and quicker than calling nhpibintr() for this special case.
472 */
473 void
474 nhpibreadtimo(arg)
475 void *arg;
476 {
477 struct hpibbus_softc *hs = arg;
478 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
479 int s = splbio();
480
481 if (hs->sc_flags & HPIBF_IO) {
482 struct nhpibdevice *hd = sc->sc_regs;
483 struct hpibqueue *hq;
484
485 hd->hpib_mim = 0;
486 hd->hpib_acr = AUX_TCA;
487 hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
488 dmafree(hs->sc_dq);
489
490 hq = hs->sc_queue.tqh_first;
491 (hq->hq_intr)(hq->hq_softc);
492 }
493 splx(s);
494 }
495
496 void
497 nhpibdone(hs)
498 struct hpibbus_softc *hs;
499 {
500 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
501 struct nhpibdevice *hd = sc->sc_regs;
502 int cnt;
503
504 cnt = hs->sc_curcnt;
505 hs->sc_addr += cnt;
506 hs->sc_count -= cnt;
507 hs->sc_flags |= HPIBF_DONE;
508 hd->hpib_ie = IDS_IE;
509 if (hs->sc_flags & HPIBF_READ) {
510 if ((hs->sc_flags & HPIBF_TIMO) &&
511 (hd->hpib_ids & IDS_IR) == 0)
512 callout_reset(&sc->sc_read_ch, hz >> 2,
513 nhpibreadtimo, hs);
514 } else {
515 if (hs->sc_count == 1) {
516 (void) nhpibwait(hd, MIS_BO);
517 hd->hpib_acr = AUX_EOI;
518 hd->hpib_data = *hs->sc_addr;
519 hd->hpib_mim = MIS_BO;
520 }
521 #ifdef DEBUG
522 else if (hs->sc_count)
523 panic("nhpibdone");
524 #endif
525 }
526 }
527
528 int
529 nhpibintr(arg)
530 void *arg;
531 {
532 struct nhpib_softc *sc = arg;
533 struct hpibbus_softc *hs = sc->sc_hpibbus;
534 struct nhpibdevice *hd = sc->sc_regs;
535 struct hpibqueue *hq;
536 int stat0;
537 int stat1;
538
539 #ifdef lint
540 if (stat1 = unit) return(1);
541 #endif
542 if ((hd->hpib_ids & IDS_IR) == 0)
543 return(0);
544 stat0 = hd->hpib_mis;
545 stat1 = hd->hpib_lis;
546
547 hq = hs->sc_queue.tqh_first;
548
549 if (hs->sc_flags & HPIBF_IO) {
550 hd->hpib_mim = 0;
551 if ((hs->sc_flags & HPIBF_DONE) == 0) {
552 hs->sc_flags &= ~HPIBF_TIMO;
553 dmastop(hs->sc_dq->dq_chan);
554 } else if (hs->sc_flags & HPIBF_TIMO)
555 callout_stop(&sc->sc_read_ch);
556 hd->hpib_acr = AUX_TCA;
557 hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
558
559 dmafree(hs->sc_dq);
560 (hq->hq_intr)(hq->hq_softc);
561 } else if (hs->sc_flags & HPIBF_PPOLL) {
562 hd->hpib_mim = 0;
563 stat0 = nhpibppoll(hs);
564 if (stat0 & (0x80 >> hq->hq_slave)) {
565 hs->sc_flags &= ~HPIBF_PPOLL;
566 (hq->hq_intr)(hq->hq_softc);
567 }
568 #ifdef DEBUG
569 else
570 printf("%s: PPOLL intr bad status %x\n",
571 hs->sc_dev.dv_xname, stat0);
572 #endif
573 }
574 return(1);
575 }
576
577 int
578 nhpibppoll(hs)
579 struct hpibbus_softc *hs;
580 {
581 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
582 struct nhpibdevice *hd = sc->sc_regs;
583 int ppoll;
584
585 hd->hpib_acr = AUX_SPP;
586 DELAY(25);
587 ppoll = hd->hpib_cpt;
588 hd->hpib_acr = AUX_CPP;
589 return(ppoll);
590 }
591
592 #ifdef DEBUG
593 int nhpibreporttimo = 0;
594 #endif
595
596 int
597 nhpibwait(hd, x)
598 struct nhpibdevice *hd;
599 int x;
600 {
601 int timo = hpibtimeout;
602
603 while ((hd->hpib_mis & x) == 0 && --timo)
604 DELAY(1);
605 if (timo == 0) {
606 #ifdef DEBUG
607 if (nhpibreporttimo)
608 printf("hpib0: %s timo\n", x==MIS_BO?"OUT":"IN");
609 #endif
610 return(-1);
611 }
612 return(0);
613 }
614
615 void
616 nhpibppwatch(arg)
617 void *arg;
618 {
619 struct hpibbus_softc *hs = arg;
620 struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
621
622 if ((hs->sc_flags & HPIBF_PPOLL) == 0)
623 return;
624 again:
625 if (nhpibppoll(hs) & (0x80 >> hs->sc_queue.tqh_first->hq_slave))
626 sc->sc_regs->hpib_mim = MIS_BO;
627 else if (cold)
628 /* timeouts not working yet */
629 goto again;
630 else
631 callout_reset(&sc->sc_ppwatch_ch, 1, nhpibppwatch, hs);
632 }
633