isa.c revision 1.28.2.2 1 /*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91
37 * $Id: isa.c,v 1.28.2.2 1993/09/24 08:49:13 mycroft Exp $
38 */
39
40 /*
41 * code to manage AT bus
42 *
43 * 92/08/18 Frank P. MacLachlan (fpm (at) crash.cts.com):
44 * Fixed uninitialized variable problem and added code to deal
45 * with DMA page boundaries in isa_dmarangecheck(). Fixed word
46 * mode DMA count compution and reorganized DMA setup code in
47 * isa_dmastart()
48 */
49
50 #include "param.h"
51 #include "systm.h"
52 #include "conf.h"
53 #include "file.h"
54 #include "buf.h"
55 #include "uio.h"
56 #include "syslog.h"
57 #include "malloc.h"
58 #include "machine/cpu.h"
59 #include "machine/cpufunc.h"
60 #include "sys/device.h"
61 #include "vm/vm.h"
62 #include "i386/isa/isa.h"
63 #include "i386/isa/isavar.h"
64 #include "i386/isa/icu.h"
65 #include "i386/isa/ic/i8237.h"
66 #include "i386/isa/ic/i8042.h"
67 #include "i386/isa/timerreg.h"
68 #include "i386/isa/spkr_reg.h"
69
70 /*
71 ** Register definitions for DMA controller 1 (channels 0..3):
72 */
73 #define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */
74 #define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
75 #define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
76 #define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */
77
78 /*
79 ** Register definitions for DMA controller 2 (channels 4..7):
80 */
81 #define DMA2_CHN(c) (IO_DMA1 + 2*(2*(c))) /* addr reg for channel c */
82 #define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
83 #define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
84 #define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
85
86 isa_type isa_bustype; /* type of bus */
87
88 static int isaprobe __P((struct device *, struct cfdata *, void *));
89 static void isaattach __P((struct device *, struct device *, void *));
90 static int isasubmatch __P((struct device *, struct cfdata *, void *));
91
92 struct cfdriver isacd =
93 { NULL, "isa", isaprobe, isaattach, DV_DULL, sizeof(struct isa_softc) };
94
95 void isa_defaultirq __P((void));
96 static int isaprint __P((void *, char *));
97
98 /*
99 * We think there might be an ISA bus here. Check it out.
100 */
101 static int
102 isaprobe(parent, cf, aux)
103 struct device *parent;
104 struct cfdata *cf;
105 void *aux;
106 {
107
108 /* XXX should do a real probe */
109 isa_bustype = BUS_ISA;
110 return 1;
111 }
112
113 /*
114 * Probe succeeded, someone called config_attach. Now we have to
115 * probe the ISA bus itself in our turn.
116 */
117 static void
118 isaattach(parent, self, aux)
119 struct device *parent, *self;
120 void *aux;
121 {
122
123 /* should print ISA/EISA & bus clock frequency and anything else
124 we can figure out? */
125 printf("\n");
126
127 isa_defaultirq();
128
129 enable_intr();
130 splhigh();
131 intr_enable(IRQ_SLAVE);
132
133 /* Iterate ``isasubmatch'' over all devices configured here. */
134 (void)config_search(isasubmatch, self, (void *)NULL);
135
136 /* and the problem is... if netmask == 0, then the loopback
137 * code can do some really ugly things.
138 * workaround for this: if netmask == 0, set it to 0x8000, which
139 * is the value used by splsoftclock. this is nasty, but it
140 * should work until this interrupt system goes away. -- cgd
141 */
142 if (netmask == 0)
143 netmask = 0x8000; /* same as for softclock. XXXX */
144
145 printf("biomask %x ttymask %x netmask %x impmask %x\n",
146 biomask, ttymask, netmask, impmask);
147 splnone();
148 }
149
150 /*
151 * isaattach (above) iterates this function over all the sub-devices that
152 * were configured at the ``isa'' device. Our job is to provide defaults
153 * and do some internal/external representation conversion (some of which
154 * is scheduled to get cleaned up later), then call the device's probe
155 * function. If this says the device is there, we try to reserve ISA
156 * bus memory and ports for the device, and attach it.
157 *
158 * Note that we always return 0, but our ultimate caller (isaattach)
159 * does not care that we never `match' anything. (In fact, our return
160 * value is entirely irrelevant; this function is run entirely for its
161 * side effects.)
162 */
163 static int
164 isasubmatch(isa, cf, aux)
165 struct device *isa;
166 struct cfdata *cf;
167 void *aux;
168 {
169 struct isa_attach_args ia;
170
171 #ifdef DIAGNOSTIC
172 if (cf->cf_driver->cd_match == NULL) {
173 /* we really ought to add printf formats to panic(). */
174 printf("isasubmatch: no match function for `%s' device\n",
175 cf->cf_driver->cd_name);
176 panic("isasubmatch: no match function\n");
177 }
178 #endif
179
180 /* Init the info needed in the device probe routine. */
181 ia.ia_iobase = cf->cf_iobase;
182 ia.ia_iosize = cf->cf_iosize;
183 if (cf->cf_irq == -1)
184 ia.ia_irq = IRQUNK;
185 else
186 ia.ia_irq = 1 << cf->cf_irq;
187 ia.ia_drq = cf->cf_drq;
188 ia.ia_maddr = (caddr_t)cf->cf_maddr;
189 ia.ia_msize = cf->cf_msize;
190
191 /* If driver says it's not there, believe it. */
192 if (!cf->cf_driver->cd_match(isa, cf, &ia))
193 return 0;
194
195 /* Driver says it is there. Try to reserve ports and memory. */
196 if (isa_reserveports(ia.ia_iobase, ia.ia_iosize)) {
197 if (isa_reservemem(ia.ia_maddr, ia.ia_msize))
198 config_attach(isa, cf, &ia, isaprint); /* victory! */
199 else
200 isa_unreserveports(ia.ia_iobase, ia.ia_iosize);
201 }
202
203 /* In any case, move on to next config entry. */
204 return 0;
205 }
206
207 /*
208 * Called indirectly via config_attach (see above). Config has already
209 * printed, e.g., "wdc0 at isa0". We can ignore our ``isaname'' arg
210 * (it is always NULL, by definition) and just extend the line with
211 * the standard info (port(s), irq, drq, and iomem).
212 */
213 static int
214 isaprint(aux, isaname)
215 void *aux;
216 char *isaname;
217 {
218 struct isa_attach_args *ia = aux;
219
220 if (ia->ia_iosize)
221 printf(" port 0x%x", ia->ia_iobase);
222 if (ia->ia_iosize > 1)
223 printf("-0x%x", ia->ia_iobase + ia->ia_iosize - 1);
224 if (ia->ia_irq != IRQUNK)
225 printf(" irq %d", ffs(ia->ia_irq) - 1);
226 if (ia->ia_drq != DRQUNK)
227 printf(" drq %d", ia->ia_drq);
228 if (ia->ia_msize)
229 printf(" iomem 0x%x", ia->ia_maddr);
230 if (ia->ia_msize > 1)
231 printf("-0x%x", ia->ia_maddr + ia->ia_msize - 1);
232 /* XXXX need to print flags */
233 return QUIET; /* actually, our return value is irrelevant. */
234 }
235
236
237 #define IDTVEC(name) __CONCAT(X,name)
238 /* default interrupt vector table entries */
239 extern IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
240 IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
241 IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
242 IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
243
244 static *defvec[16] = {
245 &IDTVEC(intr0), &IDTVEC(intr1), &IDTVEC(intr2), &IDTVEC(intr3),
246 &IDTVEC(intr4), &IDTVEC(intr5), &IDTVEC(intr6), &IDTVEC(intr7),
247 &IDTVEC(intr8), &IDTVEC(intr9), &IDTVEC(intr10), &IDTVEC(intr11),
248 &IDTVEC(intr12), &IDTVEC(intr13), &IDTVEC(intr14), &IDTVEC(intr15) };
249
250 /* out of range default interrupt vector gate entry */
251 extern IDTVEC(intrdefault);
252
253 /*
254 * Fill in default interrupt table, and mask all interrupts.
255 */
256 void
257 isa_defaultirq()
258 {
259 int i;
260
261 /* icu vectors */
262 for (i = ICU_OFFSET; i < ICU_OFFSET + ICU_LEN ; i++)
263 setidt(i, defvec[i], SDT_SYS386IGT, SEL_KPL);
264
265 /* out of range vectors */
266 for (; i < NIDT; i++)
267 setidt(i, &IDTVEC(intrdefault), SDT_SYS386IGT, SEL_KPL);
268
269 /* initialize 8259's */
270 outb(IO_ICU1, 0x11); /* reset; program device, four bytes */
271 outb(IO_ICU1+1, ICU_OFFSET); /* starting at this vector index */
272 outb(IO_ICU1+1, IRQ_SLAVE);
273 #ifdef AUTO_EOI_1
274 outb(IO_ICU1+1, 2 | 1); /* auto EOI, 8086 mode */
275 #else
276 outb(IO_ICU1+1, 1); /* 8086 mode */
277 #endif
278 outb(IO_ICU1+1, 0xff); /* leave interrupts masked */
279 outb(IO_ICU1, 0x0a); /* default to IRR on read */
280 #ifdef REORDER_IRQ
281 outb(IO_ICU1, 0xc0 | (3 - 1)); /* pri order 3-7, 0-2 (com2 first) */
282 #endif
283
284 outb(IO_ICU2, 0x11); /* reset; program device, four bytes */
285 outb(IO_ICU2+1, ICU_OFFSET+8); /* staring at this vector index */
286 outb(IO_ICU2+1, ffs(IRQ_SLAVE)-1);
287 #ifdef AUTO_EOI_2
288 outb(IO_ICU2+1, 2 | 1); /* auto EOI, 8086 mode */
289 #else
290 outb(IO_ICU2+1, 1); /* 8086 mode */
291 #endif
292 outb(IO_ICU2+1, 0xff); /* leave interrupts masked */
293 outb(IO_ICU2, 0x0a); /* default to IRR on read */
294 }
295
296
297 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
298
299 int
300 config_isadev(isdp, mp)
301 struct isa_device *isdp;
302 u_int *mp;
303 {
304 if (isdp->id_irq) {
305 int intrno;
306
307 intrno = ffs(isdp->id_irq)-1;
308 setidt(ICU_OFFSET+intrno, isdp->id_intr,
309 SDT_SYS386IGT, SEL_KPL);
310 if(mp)
311 INTRMASK(*mp,isdp->id_irq);
312 INTREN(isdp->id_irq);
313 }
314 }
315
316
317 /* region of physical memory known to be contiguous */
318 vm_offset_t isaphysmem;
319 static caddr_t bouncebuf[8]; /* XXX */
320 static caddr_t bounced[8]; /* XXX */
321 static vm_size_t bouncesize[8]; /* XXX */
322 #define MAXDMASZ 512 /* XXX */
323
324 /* high byte of address is stored in this port for i-th dma channel */
325 static short dmapageport[8] =
326 { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a };
327
328 /*
329 * isa_dmacascade(): program 8237 DMA controller channel to accept
330 * external dma control by a board.
331 */
332 void
333 at_dma_cascade(chan)
334 unsigned chan;
335 {
336 #ifdef DEBUG
337 if (chan > 7)
338 panic("at_dma_cascade: impossible request");
339 #endif
340
341 /* set dma channel mode, and set dma channel mode */
342 if ((chan & 4) == 0) {
343 outb(DMA1_MODE, DMA37MD_CASCADE | chan);
344 outb(DMA1_SMSK, chan);
345 } else {
346 outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3));
347 outb(DMA2_SMSK, chan & 3);
348 }
349 }
350
351 /*
352 * at_dma(): program 8237 DMA controller channel, avoid page alignment
353 * problems by using a bounce buffer.
354 */
355 void
356 at_dma(flags, addr, nbytes, chan)
357 int read;
358 caddr_t addr;
359 vm_size_t nbytes;
360 unsigned chan;
361 {
362 vm_offset_t phys;
363 int waport;
364 caddr_t newaddr;
365
366 ppp if ( chan > 7
367 || (chan < 4 && nbytes > (1<<16))
368 || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
369 panic("isa_dmastart: impossible request");
370
371 if (at_dma_rangecheck(addr, nbytes, chan)) {
372 panic("bounce buffers don't work yet\n");
373 /* XXX totally braindead; NBPG is not enough */
374 if (bouncebuf[chan] == 0)
375 bouncebuf[chan] =
376 /*(caddr_t)malloc(MAXDMASZ, M_TEMP, M_WAITOK);*/
377 (caddr_t) isaphysmem + NBPG*chan;
378 bouncesize[chan] = nbytes;
379 newaddr = bouncebuf[chan];
380 /* copy bounce buffer on write */
381 if (!read)
382 bcopy(addr, newaddr, nbytes);
383 else
384 bounced[chan] = addr;
385 addr = newaddr;
386 }
387
388 /* translate to physical */
389 phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
390
391 if ((chan & 4) == 0) {
392 /*
393 * Program one of DMA channels 0..3. These are
394 * byte mode channels.
395 */
396 /* set dma channel mode, and reset address ff */
397 if (read)
398 outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|chan);
399 else
400 outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_READ|chan);
401 outb(DMA1_FFC, 0);
402
403 /* send start address */
404 waport = DMA1_CHN(chan);
405 outb(waport, phys);
406 outb(waport, phys>>8);
407 outb(dmapageport[chan], phys>>16);
408
409 /* send count */
410 outb(waport + 1, --nbytes);
411 outb(waport + 1, nbytes>>8);
412
413 /* unmask channel */
414 outb(DMA1_SMSK, chan);
415 } else {
416 /*
417 * Program one of DMA channels 4..7. These are
418 * word mode channels.
419 */
420 /* set dma channel mode, and reset address ff */
421 if (read)
422 outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|(chan&3));
423 else
424 outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_READ|(chan&3));
425 outb(DMA2_FFC, 0);
426
427 /* send start address */
428 waport = DMA2_CHN(chan - 4);
429 outb(waport, phys>>1);
430 outb(waport, phys>>9);
431 outb(dmapageport[chan], phys>>16);
432
433 /* send count */
434 nbytes >>= 1;
435 outb(waport + 2, --nbytes);
436 outb(waport + 2, nbytes>>8);
437
438 /* unmask channel */
439 outb(DMA2_SMSK, chan & 3);
440 }
441 }
442
443 void
444 at_dma_terminate(int flags, caddr_t addr, int nbytes, int chan)
445 {
446
447 if (bounced[chan]) {
448 bcopy(bouncebuf[chan], bounced[chan], bouncesize[chan]);
449 bounced[chan] = 0;
450 }
451 }
452
453 /*
454 * Check for problems with the address range of a DMA transfer
455 * (non-contiguous physical pages, outside of bus address space,
456 * crossing DMA page boundaries).
457 * Return true if special handling needed.
458 */
459
460 int
461 at_dma_rangecheck(caddr_t va, unsigned length, unsigned chan) {
462 vm_offset_t phys, priorpage = 0, endva;
463 u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
464
465 endva = (vm_offset_t)round_page(va + length);
466 for (; va < (caddr_t) endva ; va += NBPG) {
467 phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
468 if (phys == 0)
469 panic("isa_dmacheck: no physical page present");
470 if (phys > physmem)
471 return (1);
472 if (priorpage) {
473 if (priorpage + NBPG != phys)
474 return (1);
475 /* check if crossing a DMA page boundary */
476 if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk)
477 return (1);
478 }
479 priorpage = phys;
480 }
481 return (0);
482 }
483
484 /* head of queue waiting for physmem to become available */
485 struct buf isa_physmemq;
486
487 /* blocked waiting for resource to become free for exclusive use */
488 static isaphysmemflag;
489 /* if waited for and call requested when free (B_CALL) */
490 static void (*isaphysmemunblock)(); /* XXX needs to be a list */
491
492 /*
493 * Allocate contiguous physical memory for transfer, returning
494 * a *virtual* address to region. May block waiting for resource.
495 * (assumed to be called at splbio())
496 */
497 caddr_t
498 isa_allocphysmem(caddr_t va, unsigned length, void (*func)()) {
499
500 isaphysmemunblock = func;
501 while (isaphysmemflag & B_BUSY) {
502 isaphysmemflag |= B_WANTED;
503 sleep((caddr_t)&isaphysmemflag, PRIBIO);
504 }
505 isaphysmemflag |= B_BUSY;
506
507 return((caddr_t)isaphysmem);
508 }
509
510 /*
511 * Free contiguous physical memory used for transfer.
512 * (assumed to be called at splbio())
513 */
514 void
515 isa_freephysmem(caddr_t va, unsigned length) {
516
517 isaphysmemflag &= ~B_BUSY;
518 if (isaphysmemflag & B_WANTED) {
519 isaphysmemflag &= B_WANTED;
520 wakeup((caddr_t)&isaphysmemflag);
521 if (isaphysmemunblock)
522 (*isaphysmemunblock)();
523 }
524 }
525
526 /*
527 * Handle a NMI, possibly a machine check.
528 * return true to panic system, false to ignore.
529 */
530 int
531 isa_nmi(cd) {
532
533 log(LOG_CRIT, "\nNMI port 61 %x, port 70 %x\n", inb(0x61), inb(0x70));
534 return(0);
535 }
536
537 /*
538 * Caught a stray interrupt, notify
539 */
540 void
541 isa_strayintr(d)
542 int d;
543 {
544
545 /*
546 * Stray level 7 interrupts occur when someone raises an interrupt
547 * and then drops it before the CPU acknowledges it. This means
548 * either the device is screwed or something is cli'ing too long.
549 */
550 extern u_long intrcnt_stray;
551
552 intrcnt_stray++;
553 if (intrcnt_stray <= 5)
554 log(LOG_ERR, "stray interrupt %d\n", d);
555 if (intrcnt_stray == 5)
556 log(LOG_CRIT,"too many stray interrupts; stopped logging\n");
557 }
558
559 static beeping;
560 static void
561 sysbeepstop(int f)
562 {
563 int s = splhigh();
564
565 /* disable counter 2 */
566 disable_intr();
567 outb(PITAUX_PORT, inb(PITAUX_PORT) & ~PIT_SPKR);
568 enable_intr();
569 if (f)
570 timeout((timeout_t)sysbeepstop, (caddr_t)0, f);
571 else
572 beeping = 0;
573
574 splx(s);
575 }
576
577 void
578 sysbeep(int pitch, int period)
579 {
580 int s = splhigh();
581 static int last_pitch, last_period;
582
583 if (beeping) {
584 untimeout((timeout_t)sysbeepstop, (caddr_t)(last_period/2));
585 untimeout((timeout_t)sysbeepstop, (caddr_t)0);
586 }
587 if (!beeping || last_pitch != pitch) {
588 /*
589 * XXX - move timer stuff to clock.c.
590 */
591 disable_intr();
592 outb(TIMER_MODE, TIMER_SEL2|TIMER_16BIT|TIMER_SQWAVE);
593 outb(TIMER_CNTR2, TIMER_DIV(pitch)%256);
594 outb(TIMER_CNTR2, TIMER_DIV(pitch)/256);
595 outb(PITAUX_PORT, inb(PITAUX_PORT) | PIT_SPKR); /* enable counter 2 */
596 enable_intr();
597 }
598 last_pitch = pitch;
599 beeping = last_period = period;
600 timeout((timeout_t)sysbeepstop, (caddr_t)(period/2), period);
601
602 splx(s);
603 }
604
605 /*
606 * Pass command to keyboard controller (8042)
607 */
608 unsigned
609 kbc_8042cmd(int val)
610 {
611 while (inb(KBSTATP)&KBS_IBF);
612 if (val) outb(KBCMDP, val);
613 while (inb(KBSTATP)&KBS_IBF);
614 return (inb(KBDATAP));
615 }
616
617 /*
618 * find an ISA device in a given isa_devtab_* table, given
619 * the table to search, the expected id_driver entry, and the unit number.
620 *
621 * this function is defined in isa_device.h, and this location is debatable;
622 * i put it there because it's useless w/o, and directly operates on
623 * the other stuff in that file.
624 *
625 */
626
627 struct isa_device *find_isadev(table, driverp, unit)
628 struct isa_device *table;
629 struct isa_driver *driverp;
630 int unit;
631 {
632 if (driverp == NULL) /* sanity check */
633 return NULL;
634
635 while ((table->id_driver != driverp) || (table->id_unit != unit)) {
636 if (table->id_driver == 0)
637 return NULL;
638
639 table++;
640 }
641
642 return table;
643 }
644
645 /*
646 * Return nonzero if a (masked) irq is pending for a given device.
647 */
648 int
649 isa_irq_pending(dvp)
650 struct isa_device *dvp;
651 {
652 unsigned id_irq;
653
654 id_irq = (unsigned short) dvp->id_irq; /* XXX silly type in struct */
655 if (id_irq & 0xff)
656 return (inb(IO_ICU1) & id_irq);
657 return (inb(IO_ICU2) & (id_irq >> 8));
658 }
659