Adapt to i386 intr changes.

This commit is contained in:
fvdl 2002-11-23 12:53:51 +00:00
parent c26f63141b
commit 4c357c783c
5 changed files with 28 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.1 2001/06/19 00:20:11 fvdl Exp $ */
/* $NetBSD: intr.h,v 1.2 2002/11/23 12:53:51 fvdl Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -72,6 +72,10 @@
/* Hack for CLKF_INTR(). */
#define IPL_TAGINTR 28
#define NUM_LEGACY_IRQS 16
#define ICU_OFFSET 32
#define IRQ_SLAVE 2
#ifndef _LOCORE
volatile int cpl, ipending, astpending;

View File

@ -1,4 +1,4 @@
/* $NetBSD: isa_machdep.c,v 1.1 2001/06/19 00:20:32 fvdl Exp $ */
/* $NetBSD: isa_machdep.c,v 1.2 2002/11/23 12:53:51 fvdl Exp $ */
#define ISA_DMA_STATS
@ -94,7 +94,6 @@
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <i386/isa/icu.h>
#include <uvm/uvm_extern.h>
@ -192,6 +191,8 @@ struct x86_64_bus_dma_tag isa_bus_dma_tag = {
_bus_dmamem_mmap,
};
extern unsigned imen;
/*
* Fill in default interrupt table (in case of spuruious interrupt
* during configuration of kernel, setup interrupt control unit
@ -202,7 +203,7 @@ isa_defaultirq()
int i;
/* icu vectors */
for (i = 0; i < ICU_LEN; i++)
for (i = 0; i < NUM_LEGACY_IRQS; i++)
setgate(&idt[ICU_OFFSET + i], IDTVEC(intr)[i], 0,
SDT_SYS386IGT, SEL_KPL);
@ -268,8 +269,8 @@ isa_strayintr(irq)
strays >= 5 ? "; stopped logging" : "");
}
int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
struct intrhand *intrhand[ICU_LEN];
int intrtype[NUM_LEGACY_IRQS], intrmask[NUM_LEGACY_IRQS], intrlevel[NUM_LEGACY_IRQS];
struct intrhand *intrhand[NUM_LEGACY_IRQS];
/*
* Recalculate the interrupt masks from scratch.
@ -285,7 +286,7 @@ intr_calculatemasks()
/* First, figure out which levels each IRQ uses. */
unusedirqs = 0xffff;
for (irq = 0; irq < ICU_LEN; irq++) {
for (irq = 0; irq < NUM_LEGACY_IRQS; irq++) {
int levels = 0;
for (q = intrhand[irq]; q; q = q->ih_next)
levels |= 1 << q->ih_level;
@ -297,7 +298,7 @@ intr_calculatemasks()
/* Then figure out which IRQs use each level. */
for (level = 0; level < NIPL; level++) {
int irqs = 0;
for (irq = 0; irq < ICU_LEN; irq++)
for (irq = 0; irq < NUM_LEGACY_IRQS; irq++)
if (intrlevel[irq] & (1 << level))
irqs |= 1 << irq;
imask[level] = irqs | unusedirqs;
@ -353,7 +354,7 @@ intr_calculatemasks()
imask[IPL_SERIAL] |= imask[IPL_HIGH];
/* And eventually calculate the complete masks. */
for (irq = 0; irq < ICU_LEN; irq++) {
for (irq = 0; irq < NUM_LEGACY_IRQS; irq++) {
int irqs = 1 << irq;
for (q = intrhand[irq]; q; q = q->ih_next)
irqs |= imask[q->ih_level];
@ -363,7 +364,7 @@ intr_calculatemasks()
/* Lastly, determine which IRQs are actually in use. */
{
int irqs = 0;
for (irq = 0; irq < ICU_LEN; irq++)
for (irq = 0; irq < NUM_LEGACY_IRQS; irq++)
if (intrhand[irq])
irqs |= 1 << irq;
if (irqs >= 0x100) /* any IRQs >= 8 in use */
@ -380,7 +381,7 @@ fakeintr(arg)
return 0;
}
#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != 2)
#define LEGAL_IRQ(x) ((x) >= 0 && (x) < NUM_LEGACY_IRQS && (x) != 2)
int
isa_intr_alloc(ic, mask, type, irq)
@ -407,7 +408,7 @@ isa_intr_alloc(ic, mask, type, irq)
*/
mask &= 0xefbf;
for (i = 0; i < ICU_LEN; i++) {
for (i = 0; i < NUM_LEGACY_IRQS; i++) {
if (LEGAL_IRQ(i) == 0 || (mask & (1<<i)) == 0)
continue;
@ -540,7 +541,8 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg)
ih->ih_irq = irq;
*p = ih;
SET_ICUS();
outb(IO_ICU1 + 1, imen);
outb(IO_ICU2 + 1, imen >> 8);
return (ih);
}
@ -572,7 +574,9 @@ isa_intr_disestablish(ic, arg)
free(ih, M_DEVBUF);
intr_calculatemasks();
SET_ICUS();
outb(IO_ICU1 + 1, imen);
outb(IO_ICU2 + 1, imen >> 8);
if (intrhand[irq] == NULL)
intrtype[irq] = IST_NONE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.2 2002/09/27 15:37:02 provos Exp $ */
/* $NetBSD: pci_machdep.c,v 1.3 2002/11/23 12:53:52 fvdl Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -94,7 +94,6 @@
#include <machine/pio.h>
#include <i386/isa/icu.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@ -501,7 +500,7 @@ pci_intr_map(pa, ihp)
printf("pci_intr_map: no mapping for pin %c\n", '@' + pin);
goto bad;
} else {
if (line >= ICU_LEN) {
if (line >= NUM_LEGACY_IRQS) {
printf("pci_intr_map: bad interrupt line %d\n", line);
goto bad;
}
@ -526,7 +525,7 @@ pci_intr_string(pc, ih)
{
static char irqstr[8]; /* 4 + 2 + NULL + sanity */
if (ih == 0 || ih >= ICU_LEN || ih == 2)
if (ih == 0 || ih >= NUM_LEGACY_IRQS || ih == 2)
panic("pci_intr_string: bogus handle 0x%x", ih);
sprintf(irqstr, "irq %d", ih);
@ -552,7 +551,7 @@ pci_intr_establish(pc, ih, level, func, arg)
void *arg;
{
if (ih == 0 || ih >= ICU_LEN || ih == 2)
if (ih == 0 || ih >= NUM_LEGACY_IRQS || ih == 2)
panic("pci_intr_establish: bogus handle 0x%x", ih);
return isa_intr_establish(NULL, ih, IST_LEVEL, level, func, arg);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu.c,v 1.2 2002/06/12 19:13:27 fvdl Exp $ */
/* $NetBSD: fpu.c,v 1.3 2002/11/23 12:53:52 fvdl Exp $ */
/*-
* Copyright (c) 1994, 1995, 1998 Charles M. Hannum. All rights reserved.
@ -65,8 +65,6 @@
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <i386/isa/icu.h>
/*
* We do lazy initialization and switching using the TS bit in cr0 and the
* MDP_USEDFPU bit in mdproc.

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.19 2002/09/25 22:21:32 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.20 2002/11/23 12:53:52 fvdl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -832,7 +832,6 @@ cpu_dumpconf()
{
const struct bdevsw *bdev;
int nblks, dumpblks; /* size of dump area */
int maj;
if (dumpdev == NODEV)
goto bad;