summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-09-13 18:33:25 +0000
committerjhb <jhb@FreeBSD.org>2000-09-13 18:33:25 +0000
commit7013b8322587468516f271030ba6f1e1e8ad2505 (patch)
tree094e936b4c4d7213d8c6c9ada2d1b54c3631a970
parent2bef2cffd4590e0d732ee9af20c3fc37217d6b52 (diff)
downloadFreeBSD-src-7013b8322587468516f271030ba6f1e1e8ad2505.zip
FreeBSD-src-7013b8322587468516f271030ba6f1e1e8ad2505.tar.gz
- Remove the inthand2_t type and use the equivalent driver_intr_t type from
newbus for referencing device interrupt handlers. - Move the 'struct intrec' type which describes interrupt sources into sys/interrupt.h instead of making it just be a x86 structure. - Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd' and 'struct intrec' - Move the code to translate new-bus interrupt flags into an interrupt thread priority out of the x86 nexus code and into a MI ithread_priority() function in sys/kern/kern_intr.c. - Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and sys/pci/pci_compat.c.
-rw-r--r--sys/alpha/alpha/ipl_funcs.c1
-rw-r--r--sys/alpha/include/types.h3
-rw-r--r--sys/amd64/amd64/legacy.c30
-rw-r--r--sys/amd64/amd64/nexus.c30
-rw-r--r--sys/amd64/amd64/tsc.c14
-rw-r--r--sys/amd64/isa/clock.c14
-rw-r--r--sys/amd64/isa/intr_machdep.c29
-rw-r--r--sys/amd64/isa/intr_machdep.h29
-rw-r--r--sys/amd64/isa/ithread.c16
-rw-r--r--sys/amd64/isa/nmi.c29
-rw-r--r--sys/cam/cam_xpt.c2
-rw-r--r--sys/dev/ata/ata-all.c6
-rw-r--r--sys/dev/sio/sio.c1
-rw-r--r--sys/i386/i386/legacy.c30
-rw-r--r--sys/i386/i386/nexus.c30
-rw-r--r--sys/i386/i386/tsc.c14
-rw-r--r--sys/i386/include/types.h1
-rw-r--r--sys/i386/isa/clock.c14
-rw-r--r--sys/i386/isa/intr_machdep.c29
-rw-r--r--sys/i386/isa/intr_machdep.h29
-rw-r--r--sys/i386/isa/isa_device.h2
-rw-r--r--sys/i386/isa/ithread.c16
-rw-r--r--sys/i386/isa/nmi.c29
-rw-r--r--sys/i4b/layer1/i4b_avm_fritz_pnp.c5
-rw-r--r--sys/isa/atrtc.c14
-rw-r--r--sys/isa/sio.c1
-rw-r--r--sys/kern/kern_intr.c39
-rw-r--r--sys/kern/subr_taskqueue.c1
-rw-r--r--sys/pccard/pcic.c3
-rw-r--r--sys/pci/pci_compat.c9
-rw-r--r--sys/sys/interrupt.h19
-rw-r--r--sys/sys/proc.h4
32 files changed, 208 insertions, 285 deletions
diff --git a/sys/alpha/alpha/ipl_funcs.c b/sys/alpha/alpha/ipl_funcs.c
index 6642bce..afe0bb4 100644
--- a/sys/alpha/alpha/ipl_funcs.c
+++ b/sys/alpha/alpha/ipl_funcs.c
@@ -27,6 +27,7 @@
*/
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
diff --git a/sys/alpha/include/types.h b/sys/alpha/include/types.h
index ccb7793..087c175 100644
--- a/sys/alpha/include/types.h
+++ b/sys/alpha/include/types.h
@@ -67,7 +67,4 @@ typedef unsigned long uintfptr_t;
/* Interrupt mask (spl, xxx_imask, etc) */
typedef __uint32_t intrmask_t;
-/* Interrupt handler function type */
-typedef void inthand2_t(void *);
-
#endif /* _MACHTYPES_H_ */
diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c
index 5b6cdbc..6413abd 100644
--- a/sys/amd64/amd64/legacy.c
+++ b/sys/amd64/amd64/legacy.c
@@ -50,6 +50,7 @@
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <sys/interrupt.h>
#include <machine/vmparam.h>
#include <vm/vm.h>
@@ -415,34 +416,9 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
icflags = INTR_EXCL;
driver = device_get_driver(child);
- switch (flags) {
- case INTR_TYPE_TTY: /* keyboard or parallel port */
- pri = PI_TTYLOW;
- break;
- case (INTR_TYPE_TTY | INTR_FAST): /* sio */
- pri = PI_TTYHIGH;
+ pri = ithread_priority(flags);
+ if (flags & INTR_FAST)
icflags |= INTR_FAST;
- break;
- case INTR_TYPE_BIO:
- /*
- * XXX We need to refine this. BSD/OS distinguishes
- * between tape and disk priorities.
- */
- pri = PI_DISK;
- break;
- case INTR_TYPE_NET:
- pri = PI_NET;
- break;
- case INTR_TYPE_CAM:
- pri = PI_DISK; /* XXX or PI_CAM? */
- break;
- case INTR_TYPE_MISC:
- pri = PI_DULL; /* don't care */
- break;
- /* We didn't specify an interrupt level. */
- default:
- panic("nexus_setup_intr: no interrupt type in flags");
- }
/*
* We depend here on rman_activate_resource() being idempotent.
diff --git a/sys/amd64/amd64/nexus.c b/sys/amd64/amd64/nexus.c
index 5b6cdbc..6413abd 100644
--- a/sys/amd64/amd64/nexus.c
+++ b/sys/amd64/amd64/nexus.c
@@ -50,6 +50,7 @@
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <sys/interrupt.h>
#include <machine/vmparam.h>
#include <vm/vm.h>
@@ -415,34 +416,9 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
icflags = INTR_EXCL;
driver = device_get_driver(child);
- switch (flags) {
- case INTR_TYPE_TTY: /* keyboard or parallel port */
- pri = PI_TTYLOW;
- break;
- case (INTR_TYPE_TTY | INTR_FAST): /* sio */
- pri = PI_TTYHIGH;
+ pri = ithread_priority(flags);
+ if (flags & INTR_FAST)
icflags |= INTR_FAST;
- break;
- case INTR_TYPE_BIO:
- /*
- * XXX We need to refine this. BSD/OS distinguishes
- * between tape and disk priorities.
- */
- pri = PI_DISK;
- break;
- case INTR_TYPE_NET:
- pri = PI_NET;
- break;
- case INTR_TYPE_CAM:
- pri = PI_DISK; /* XXX or PI_CAM? */
- break;
- case INTR_TYPE_MISC:
- pri = PI_DULL; /* don't care */
- break;
- /* We didn't specify an interrupt level. */
- default:
- panic("nexus_setup_intr: no interrupt type in flags");
- }
/*
* We depend here on rman_activate_resource() being idempotent.
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c
index 724f3c2..0e2c098 100644
--- a/sys/amd64/amd64/tsc.c
+++ b/sys/amd64/amd64/tsc.c
@@ -1037,7 +1037,7 @@ cpu_initclocks()
* 19 July 2000).
*/
/* Setup the PIC clk handler. The APIC handler is setup later */
- inthand_add("clk", 0, (inthand2_t *)clkintr, NULL, PI_REALTIME,
+ inthand_add("clk", 0, (driver_intr_t *)clkintr, NULL, PI_REALTIME,
INTR_EXCL);
INTREN(IRQ0);
@@ -1054,8 +1054,8 @@ cpu_initclocks()
* XXX - if statclock is disabled, don't attempt the APIC
* trial. Not sure this is sane for APIC_IO.
*/
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
- PI_REALTIME, INTR_EXCL);
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr,
+ NULL, PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif /* APIC_IO */
return;
@@ -1075,10 +1075,10 @@ cpu_initclocks()
* interrupts.
*/
clkdesc = inthand_add("clk", apic_8254_intr,
- (inthand2_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
+ (driver_intr_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
INTREN(1 << apic_8254_intr);
- rtcdesc = inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL,
+ rtcdesc = inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL,
PI_REALTIME, INTR_FAST); /* XXX */
INTREN(APIC_IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
@@ -1128,12 +1128,12 @@ cpu_initclocks()
}
/* Finally, setup the real clock handlers */
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr, NULL,
PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif
- inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL, PI_REALTIME,
+ inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL, PI_REALTIME,
INTR_EXCL);
#ifdef APIC_IO
INTREN(APIC_IRQ8);
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 724f3c2..0e2c098 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -1037,7 +1037,7 @@ cpu_initclocks()
* 19 July 2000).
*/
/* Setup the PIC clk handler. The APIC handler is setup later */
- inthand_add("clk", 0, (inthand2_t *)clkintr, NULL, PI_REALTIME,
+ inthand_add("clk", 0, (driver_intr_t *)clkintr, NULL, PI_REALTIME,
INTR_EXCL);
INTREN(IRQ0);
@@ -1054,8 +1054,8 @@ cpu_initclocks()
* XXX - if statclock is disabled, don't attempt the APIC
* trial. Not sure this is sane for APIC_IO.
*/
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
- PI_REALTIME, INTR_EXCL);
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr,
+ NULL, PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif /* APIC_IO */
return;
@@ -1075,10 +1075,10 @@ cpu_initclocks()
* interrupts.
*/
clkdesc = inthand_add("clk", apic_8254_intr,
- (inthand2_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
+ (driver_intr_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
INTREN(1 << apic_8254_intr);
- rtcdesc = inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL,
+ rtcdesc = inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL,
PI_REALTIME, INTR_FAST); /* XXX */
INTREN(APIC_IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
@@ -1128,12 +1128,12 @@ cpu_initclocks()
}
/* Finally, setup the real clock handlers */
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr, NULL,
PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif
- inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL, PI_REALTIME,
+ inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL, PI_REALTIME,
INTR_EXCL);
#ifdef APIC_IO
INTREN(APIC_IRQ8);
diff --git a/sys/amd64/isa/intr_machdep.c b/sys/amd64/isa/intr_machdep.c
index 870760e..4506c05 100644
--- a/sys/amd64/isa/intr_machdep.c
+++ b/sys/amd64/isa/intr_machdep.c
@@ -42,6 +42,7 @@
#include "isa.h"
#include <sys/param.h>
+#include <sys/bus.h>
#ifndef SMP
#include <machine/lock.h>
#endif
@@ -93,8 +94,8 @@
* case, so these arrays have NHWI + NSWI entries, not ICU_LEN.
*/
u_long *intr_countp[NHWI + NSWI]; /* pointers to interrupt counters */
-inthand2_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
-ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
+driver_intr_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
+struct ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
void *intr_unit[NHWI + NSWI];
static inthand_t *fastintr[ICU_LEN] = {
@@ -125,7 +126,7 @@ static inthand_t *slowintr[ICU_LEN] = {
#endif /* APIC_IO */
};
-static inthand2_t isa_strayintr;
+static driver_intr_t isa_strayintr;
#ifdef PC98
#define NMI_PARITY 0x04
@@ -284,7 +285,7 @@ isa_defaultirq()
/* icu vectors */
for (i = 0; i < ICU_LEN; i++)
- icu_unset(i, (inthand2_t *)NULL);
+ icu_unset(i, (driver_intr_t *)NULL);
/* initialize 8259's */
#if NMCA > 0
@@ -431,7 +432,7 @@ found:
}
int
-icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
+icu_setup(int intr, driver_intr_t *handler, void *arg, int flags)
{
#ifdef FAST_HI
int select; /* the select register is 8 bits */
@@ -502,7 +503,7 @@ icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
int
icu_unset(intr, handler)
int intr;
- inthand2_t *handler;
+ driver_intr_t *handler;
{
u_long ef;
@@ -530,13 +531,13 @@ icu_unset(intr, handler)
return (0);
}
-intrec *
-inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
+struct intrec *
+inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
int pri, int flags)
{
- ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
- intrec *head; /* chain of handlers for IRQ */
- intrec *idesc; /* descriptor for this handler */
+ struct ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
+ struct intrec *head; /* chain of handlers for IRQ */
+ struct intrec *idesc; /* descriptor for this handler */
struct proc *p; /* interrupt thread */
int errcode = 0;
@@ -669,10 +670,10 @@ inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
*/
int
-inthand_remove(intrec *idesc)
+inthand_remove(struct intrec *idesc)
{
- ithd *ithd; /* descriptor for the IRQ */
- intrec *ih; /* chain of handlers */
+ struct ithd *ithd; /* descriptor for the IRQ */
+ struct intrec *ih; /* chain of handlers */
if (idesc == NULL)
return (-1);
diff --git a/sys/amd64/isa/intr_machdep.h b/sys/amd64/isa/intr_machdep.h
index 87c97a3..5d9d9d2 100644
--- a/sys/amd64/isa/intr_machdep.h
+++ b/sys/amd64/isa/intr_machdep.h
@@ -143,10 +143,10 @@ extern char eintrnames[]; /* end of intrnames[] */
extern u_long intrcnt[]; /* counts for for each device and stray */
extern char intrnames[]; /* string table containing device names */
extern u_long *intr_countp[]; /* pointers into intrcnt[] */
-extern inthand2_t *intr_handler[]; /* C entry points of intr handlers */
-extern ithd *ithds[];
+extern driver_intr_t *intr_handler[]; /* C entry points of intr handlers */
+extern struct ithd *ithds[];
extern void *intr_unit[]; /* cookies to pass to intr handlers */
-extern ithd softinterrupt; /* soft interrupt thread */
+extern struct ithd softinterrupt; /* soft interrupt thread */
inthand_t
IDTVEC(fastintr0), IDTVEC(fastintr1),
@@ -210,34 +210,17 @@ inthand_t
void isa_defaultirq __P((void));
int isa_nmi __P((int cd));
-int icu_setup __P((int intr, inthand2_t *func, void *arg,
+int icu_setup __P((int intr, driver_intr_t *func, void *arg,
int flags));
-int icu_unset __P((int intr, inthand2_t *handler));
+int icu_unset __P((int intr, driver_intr_t *handler));
intrmask_t splq __P((intrmask_t mask));
/*
- * Describe a hardware interrupt handler. These structures are
- * accessed via the array intreclist, which contains one pointer per
- * hardware interrupt.
- *
- * Multiple interrupt handlers for a specific IRQ can be chained
- * together via the 'next' pointer.
- */
-typedef struct intrec {
- inthand2_t *handler; /* code address of handler */
- void *argument; /* argument to pass to handler */
- enum intr_type flags; /* flag bits (sys/bus.h) */
- char *name; /* name of handler */
- ithd *ithd; /* handler we're connected to */
- struct intrec *next; /* next handler for this irq */
-} intrec;
-
-/*
* WARNING: These are internal functions and not to be used by device drivers!
* They are subject to change without notice.
*/
-struct intrec *inthand_add(const char *name, int irq, inthand2_t handler,
+struct intrec *inthand_add(const char *name, int irq, driver_intr_t handler,
void *arg, int pri, int flags);
int inthand_remove(struct intrec *idesc);
void sched_ithd(void *);
diff --git a/sys/amd64/isa/ithread.c b/sys/amd64/isa/ithread.c
index 9bc66dc..2712353 100644
--- a/sys/amd64/isa/ithread.c
+++ b/sys/amd64/isa/ithread.c
@@ -36,6 +36,7 @@
#include "isa.h"
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/rtprio.h> /* change this name XXX */
#ifndef SMP
#include <machine/lock.h>
@@ -53,7 +54,6 @@
#include <machine/ipl.h>
#include <machine/md_var.h>
#include <machine/segments.h>
-#include <sys/bus.h>
#if defined(APIC_IO)
#include <machine/smp.h>
@@ -103,7 +103,7 @@ void
sched_ithd(void *cookie)
{
int irq = (int) cookie; /* IRQ we're handling */
- ithd *ir = ithds[irq]; /* and the process that does it */
+ struct ithd *ir = ithds[irq]; /* and the process that does it */
/* This used to be in icu_vector.s */
/*
@@ -127,7 +127,7 @@ sched_ithd(void *cookie)
* go away once we have light-weight interrupt handlers.
*/
if (db_active) {
- intrec *ih; /* and our interrupt handler chain */
+ struct intrec *ih; /* and our interrupt handler chain */
#if 0
membar_unlock(); /* push out "it_need=0" */
#endif
@@ -183,8 +183,8 @@ if (irq < NHWI && (irq & 7) != 0)
void
ithd_loop(void *dummy)
{
- ithd *me; /* our thread context */
- intrec *ih; /* and our interrupt handler chain */
+ struct ithd *me; /* our thread context */
+ struct intrec *ih; /* and our interrupt handler chain */
me = curproc->p_ithd; /* point to myself */
@@ -254,8 +254,8 @@ start_softintr(void *dummy)
{
int error;
struct proc *p;
- ithd *softintr; /* descriptor for the "IRQ" */
- intrec *idesc; /* descriptor for this handler */
+ struct ithd *softintr; /* descriptor for the "IRQ" */
+ struct intrec *idesc; /* descriptor for this handler */
char *name = "sintr"; /* name for idesc */
int i;
@@ -304,7 +304,7 @@ void
intr_soft(void *dummy)
{
int i;
- ithd *me; /* our thread context */
+ struct ithd *me; /* our thread context */
me = curproc->p_ithd; /* point to myself */
diff --git a/sys/amd64/isa/nmi.c b/sys/amd64/isa/nmi.c
index 870760e..4506c05 100644
--- a/sys/amd64/isa/nmi.c
+++ b/sys/amd64/isa/nmi.c
@@ -42,6 +42,7 @@
#include "isa.h"
#include <sys/param.h>
+#include <sys/bus.h>
#ifndef SMP
#include <machine/lock.h>
#endif
@@ -93,8 +94,8 @@
* case, so these arrays have NHWI + NSWI entries, not ICU_LEN.
*/
u_long *intr_countp[NHWI + NSWI]; /* pointers to interrupt counters */
-inthand2_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
-ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
+driver_intr_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
+struct ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
void *intr_unit[NHWI + NSWI];
static inthand_t *fastintr[ICU_LEN] = {
@@ -125,7 +126,7 @@ static inthand_t *slowintr[ICU_LEN] = {
#endif /* APIC_IO */
};
-static inthand2_t isa_strayintr;
+static driver_intr_t isa_strayintr;
#ifdef PC98
#define NMI_PARITY 0x04
@@ -284,7 +285,7 @@ isa_defaultirq()
/* icu vectors */
for (i = 0; i < ICU_LEN; i++)
- icu_unset(i, (inthand2_t *)NULL);
+ icu_unset(i, (driver_intr_t *)NULL);
/* initialize 8259's */
#if NMCA > 0
@@ -431,7 +432,7 @@ found:
}
int
-icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
+icu_setup(int intr, driver_intr_t *handler, void *arg, int flags)
{
#ifdef FAST_HI
int select; /* the select register is 8 bits */
@@ -502,7 +503,7 @@ icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
int
icu_unset(intr, handler)
int intr;
- inthand2_t *handler;
+ driver_intr_t *handler;
{
u_long ef;
@@ -530,13 +531,13 @@ icu_unset(intr, handler)
return (0);
}
-intrec *
-inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
+struct intrec *
+inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
int pri, int flags)
{
- ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
- intrec *head; /* chain of handlers for IRQ */
- intrec *idesc; /* descriptor for this handler */
+ struct ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
+ struct intrec *head; /* chain of handlers for IRQ */
+ struct intrec *idesc; /* descriptor for this handler */
struct proc *p; /* interrupt thread */
int errcode = 0;
@@ -669,10 +670,10 @@ inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
*/
int
-inthand_remove(intrec *idesc)
+inthand_remove(struct intrec *idesc)
{
- ithd *ithd; /* descriptor for the IRQ */
- intrec *ih; /* chain of handlers */
+ struct ithd *ithd; /* descriptor for the IRQ */
+ struct intrec *ih; /* chain of handlers */
if (idesc == NULL)
return (-1);
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index b5fe1c4..986db94 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/malloc.h>
@@ -39,7 +40,6 @@
#include <sys/md5.h>
#include <sys/devicestat.h>
#include <sys/interrupt.h>
-#include <sys/bus.h>
#ifdef PC98
#include <pc98/pc98/pc98_machdep.h> /* geometry translation */
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 17aff9e..68782d5 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -61,12 +61,6 @@
#include <isa/isavar.h>
#include <isa/isareg.h>
#include <machine/clock.h>
-#ifdef __i386__
-#include <machine/smp.h>
-#include <sys/proc.h>
-#include <i386/isa/icu.h>
-#include <i386/isa/intr_machdep.h>
-#endif
#ifdef __alpha__
#include <machine/md_var.h>
#endif
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 8826c41..2dbccdc 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -53,6 +53,7 @@
* - Added PC-Card driver table and handlers
*/
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/reboot.h>
#include <sys/malloc.h>
diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c
index 5b6cdbc..6413abd 100644
--- a/sys/i386/i386/legacy.c
+++ b/sys/i386/i386/legacy.c
@@ -50,6 +50,7 @@
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <sys/interrupt.h>
#include <machine/vmparam.h>
#include <vm/vm.h>
@@ -415,34 +416,9 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
icflags = INTR_EXCL;
driver = device_get_driver(child);
- switch (flags) {
- case INTR_TYPE_TTY: /* keyboard or parallel port */
- pri = PI_TTYLOW;
- break;
- case (INTR_TYPE_TTY | INTR_FAST): /* sio */
- pri = PI_TTYHIGH;
+ pri = ithread_priority(flags);
+ if (flags & INTR_FAST)
icflags |= INTR_FAST;
- break;
- case INTR_TYPE_BIO:
- /*
- * XXX We need to refine this. BSD/OS distinguishes
- * between tape and disk priorities.
- */
- pri = PI_DISK;
- break;
- case INTR_TYPE_NET:
- pri = PI_NET;
- break;
- case INTR_TYPE_CAM:
- pri = PI_DISK; /* XXX or PI_CAM? */
- break;
- case INTR_TYPE_MISC:
- pri = PI_DULL; /* don't care */
- break;
- /* We didn't specify an interrupt level. */
- default:
- panic("nexus_setup_intr: no interrupt type in flags");
- }
/*
* We depend here on rman_activate_resource() being idempotent.
diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c
index 5b6cdbc..6413abd 100644
--- a/sys/i386/i386/nexus.c
+++ b/sys/i386/i386/nexus.c
@@ -50,6 +50,7 @@
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <sys/interrupt.h>
#include <machine/vmparam.h>
#include <vm/vm.h>
@@ -415,34 +416,9 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
icflags = INTR_EXCL;
driver = device_get_driver(child);
- switch (flags) {
- case INTR_TYPE_TTY: /* keyboard or parallel port */
- pri = PI_TTYLOW;
- break;
- case (INTR_TYPE_TTY | INTR_FAST): /* sio */
- pri = PI_TTYHIGH;
+ pri = ithread_priority(flags);
+ if (flags & INTR_FAST)
icflags |= INTR_FAST;
- break;
- case INTR_TYPE_BIO:
- /*
- * XXX We need to refine this. BSD/OS distinguishes
- * between tape and disk priorities.
- */
- pri = PI_DISK;
- break;
- case INTR_TYPE_NET:
- pri = PI_NET;
- break;
- case INTR_TYPE_CAM:
- pri = PI_DISK; /* XXX or PI_CAM? */
- break;
- case INTR_TYPE_MISC:
- pri = PI_DULL; /* don't care */
- break;
- /* We didn't specify an interrupt level. */
- default:
- panic("nexus_setup_intr: no interrupt type in flags");
- }
/*
* We depend here on rman_activate_resource() being idempotent.
diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c
index 724f3c2..0e2c098 100644
--- a/sys/i386/i386/tsc.c
+++ b/sys/i386/i386/tsc.c
@@ -1037,7 +1037,7 @@ cpu_initclocks()
* 19 July 2000).
*/
/* Setup the PIC clk handler. The APIC handler is setup later */
- inthand_add("clk", 0, (inthand2_t *)clkintr, NULL, PI_REALTIME,
+ inthand_add("clk", 0, (driver_intr_t *)clkintr, NULL, PI_REALTIME,
INTR_EXCL);
INTREN(IRQ0);
@@ -1054,8 +1054,8 @@ cpu_initclocks()
* XXX - if statclock is disabled, don't attempt the APIC
* trial. Not sure this is sane for APIC_IO.
*/
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
- PI_REALTIME, INTR_EXCL);
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr,
+ NULL, PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif /* APIC_IO */
return;
@@ -1075,10 +1075,10 @@ cpu_initclocks()
* interrupts.
*/
clkdesc = inthand_add("clk", apic_8254_intr,
- (inthand2_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
+ (driver_intr_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
INTREN(1 << apic_8254_intr);
- rtcdesc = inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL,
+ rtcdesc = inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL,
PI_REALTIME, INTR_FAST); /* XXX */
INTREN(APIC_IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
@@ -1128,12 +1128,12 @@ cpu_initclocks()
}
/* Finally, setup the real clock handlers */
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr, NULL,
PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif
- inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL, PI_REALTIME,
+ inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL, PI_REALTIME,
INTR_EXCL);
#ifdef APIC_IO
INTREN(APIC_IRQ8);
diff --git a/sys/i386/include/types.h b/sys/i386/include/types.h
index f2c5760..91428c6 100644
--- a/sys/i386/include/types.h
+++ b/sys/i386/include/types.h
@@ -64,7 +64,6 @@ typedef unsigned int uintfptr_t;
typedef __uint32_t intrmask_t;
/* Interrupt handler function type. */
-typedef void inthand2_t __P((void *_cookie));
typedef void ointhand2_t __P((int _device_id));
#endif /* !_MACHINE_TYPES_H_ */
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 724f3c2..0e2c098 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -1037,7 +1037,7 @@ cpu_initclocks()
* 19 July 2000).
*/
/* Setup the PIC clk handler. The APIC handler is setup later */
- inthand_add("clk", 0, (inthand2_t *)clkintr, NULL, PI_REALTIME,
+ inthand_add("clk", 0, (driver_intr_t *)clkintr, NULL, PI_REALTIME,
INTR_EXCL);
INTREN(IRQ0);
@@ -1054,8 +1054,8 @@ cpu_initclocks()
* XXX - if statclock is disabled, don't attempt the APIC
* trial. Not sure this is sane for APIC_IO.
*/
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
- PI_REALTIME, INTR_EXCL);
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr,
+ NULL, PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif /* APIC_IO */
return;
@@ -1075,10 +1075,10 @@ cpu_initclocks()
* interrupts.
*/
clkdesc = inthand_add("clk", apic_8254_intr,
- (inthand2_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
+ (driver_intr_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
INTREN(1 << apic_8254_intr);
- rtcdesc = inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL,
+ rtcdesc = inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL,
PI_REALTIME, INTR_FAST); /* XXX */
INTREN(APIC_IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
@@ -1128,12 +1128,12 @@ cpu_initclocks()
}
/* Finally, setup the real clock handlers */
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr, NULL,
PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif
- inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL, PI_REALTIME,
+ inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL, PI_REALTIME,
INTR_EXCL);
#ifdef APIC_IO
INTREN(APIC_IRQ8);
diff --git a/sys/i386/isa/intr_machdep.c b/sys/i386/isa/intr_machdep.c
index 870760e..4506c05 100644
--- a/sys/i386/isa/intr_machdep.c
+++ b/sys/i386/isa/intr_machdep.c
@@ -42,6 +42,7 @@
#include "isa.h"
#include <sys/param.h>
+#include <sys/bus.h>
#ifndef SMP
#include <machine/lock.h>
#endif
@@ -93,8 +94,8 @@
* case, so these arrays have NHWI + NSWI entries, not ICU_LEN.
*/
u_long *intr_countp[NHWI + NSWI]; /* pointers to interrupt counters */
-inthand2_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
-ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
+driver_intr_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
+struct ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
void *intr_unit[NHWI + NSWI];
static inthand_t *fastintr[ICU_LEN] = {
@@ -125,7 +126,7 @@ static inthand_t *slowintr[ICU_LEN] = {
#endif /* APIC_IO */
};
-static inthand2_t isa_strayintr;
+static driver_intr_t isa_strayintr;
#ifdef PC98
#define NMI_PARITY 0x04
@@ -284,7 +285,7 @@ isa_defaultirq()
/* icu vectors */
for (i = 0; i < ICU_LEN; i++)
- icu_unset(i, (inthand2_t *)NULL);
+ icu_unset(i, (driver_intr_t *)NULL);
/* initialize 8259's */
#if NMCA > 0
@@ -431,7 +432,7 @@ found:
}
int
-icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
+icu_setup(int intr, driver_intr_t *handler, void *arg, int flags)
{
#ifdef FAST_HI
int select; /* the select register is 8 bits */
@@ -502,7 +503,7 @@ icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
int
icu_unset(intr, handler)
int intr;
- inthand2_t *handler;
+ driver_intr_t *handler;
{
u_long ef;
@@ -530,13 +531,13 @@ icu_unset(intr, handler)
return (0);
}
-intrec *
-inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
+struct intrec *
+inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
int pri, int flags)
{
- ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
- intrec *head; /* chain of handlers for IRQ */
- intrec *idesc; /* descriptor for this handler */
+ struct ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
+ struct intrec *head; /* chain of handlers for IRQ */
+ struct intrec *idesc; /* descriptor for this handler */
struct proc *p; /* interrupt thread */
int errcode = 0;
@@ -669,10 +670,10 @@ inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
*/
int
-inthand_remove(intrec *idesc)
+inthand_remove(struct intrec *idesc)
{
- ithd *ithd; /* descriptor for the IRQ */
- intrec *ih; /* chain of handlers */
+ struct ithd *ithd; /* descriptor for the IRQ */
+ struct intrec *ih; /* chain of handlers */
if (idesc == NULL)
return (-1);
diff --git a/sys/i386/isa/intr_machdep.h b/sys/i386/isa/intr_machdep.h
index 87c97a3..5d9d9d2 100644
--- a/sys/i386/isa/intr_machdep.h
+++ b/sys/i386/isa/intr_machdep.h
@@ -143,10 +143,10 @@ extern char eintrnames[]; /* end of intrnames[] */
extern u_long intrcnt[]; /* counts for for each device and stray */
extern char intrnames[]; /* string table containing device names */
extern u_long *intr_countp[]; /* pointers into intrcnt[] */
-extern inthand2_t *intr_handler[]; /* C entry points of intr handlers */
-extern ithd *ithds[];
+extern driver_intr_t *intr_handler[]; /* C entry points of intr handlers */
+extern struct ithd *ithds[];
extern void *intr_unit[]; /* cookies to pass to intr handlers */
-extern ithd softinterrupt; /* soft interrupt thread */
+extern struct ithd softinterrupt; /* soft interrupt thread */
inthand_t
IDTVEC(fastintr0), IDTVEC(fastintr1),
@@ -210,34 +210,17 @@ inthand_t
void isa_defaultirq __P((void));
int isa_nmi __P((int cd));
-int icu_setup __P((int intr, inthand2_t *func, void *arg,
+int icu_setup __P((int intr, driver_intr_t *func, void *arg,
int flags));
-int icu_unset __P((int intr, inthand2_t *handler));
+int icu_unset __P((int intr, driver_intr_t *handler));
intrmask_t splq __P((intrmask_t mask));
/*
- * Describe a hardware interrupt handler. These structures are
- * accessed via the array intreclist, which contains one pointer per
- * hardware interrupt.
- *
- * Multiple interrupt handlers for a specific IRQ can be chained
- * together via the 'next' pointer.
- */
-typedef struct intrec {
- inthand2_t *handler; /* code address of handler */
- void *argument; /* argument to pass to handler */
- enum intr_type flags; /* flag bits (sys/bus.h) */
- char *name; /* name of handler */
- ithd *ithd; /* handler we're connected to */
- struct intrec *next; /* next handler for this irq */
-} intrec;
-
-/*
* WARNING: These are internal functions and not to be used by device drivers!
* They are subject to change without notice.
*/
-struct intrec *inthand_add(const char *name, int irq, inthand2_t handler,
+struct intrec *inthand_add(const char *name, int irq, driver_intr_t handler,
void *arg, int pri, int flags);
int inthand_remove(struct intrec *idesc);
void sched_ithd(void *);
diff --git a/sys/i386/isa/isa_device.h b/sys/i386/isa/isa_device.h
index fa3ed7c..bdc16da 100644
--- a/sys/i386/isa/isa_device.h
+++ b/sys/i386/isa/isa_device.h
@@ -60,7 +60,7 @@ struct isa_device {
caddr_t id_maddr; /* physical i/o memory address on bus (if any)*/
int id_msize; /* size of i/o memory */
union {
- inthand2_t *id_i;
+ driver_intr_t *id_i;
ointhand2_t *id_oi;
} id_iu; /* interrupt interface routine */
#define id_intr id_iu.id_i
diff --git a/sys/i386/isa/ithread.c b/sys/i386/isa/ithread.c
index 9bc66dc..2712353 100644
--- a/sys/i386/isa/ithread.c
+++ b/sys/i386/isa/ithread.c
@@ -36,6 +36,7 @@
#include "isa.h"
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/rtprio.h> /* change this name XXX */
#ifndef SMP
#include <machine/lock.h>
@@ -53,7 +54,6 @@
#include <machine/ipl.h>
#include <machine/md_var.h>
#include <machine/segments.h>
-#include <sys/bus.h>
#if defined(APIC_IO)
#include <machine/smp.h>
@@ -103,7 +103,7 @@ void
sched_ithd(void *cookie)
{
int irq = (int) cookie; /* IRQ we're handling */
- ithd *ir = ithds[irq]; /* and the process that does it */
+ struct ithd *ir = ithds[irq]; /* and the process that does it */
/* This used to be in icu_vector.s */
/*
@@ -127,7 +127,7 @@ sched_ithd(void *cookie)
* go away once we have light-weight interrupt handlers.
*/
if (db_active) {
- intrec *ih; /* and our interrupt handler chain */
+ struct intrec *ih; /* and our interrupt handler chain */
#if 0
membar_unlock(); /* push out "it_need=0" */
#endif
@@ -183,8 +183,8 @@ if (irq < NHWI && (irq & 7) != 0)
void
ithd_loop(void *dummy)
{
- ithd *me; /* our thread context */
- intrec *ih; /* and our interrupt handler chain */
+ struct ithd *me; /* our thread context */
+ struct intrec *ih; /* and our interrupt handler chain */
me = curproc->p_ithd; /* point to myself */
@@ -254,8 +254,8 @@ start_softintr(void *dummy)
{
int error;
struct proc *p;
- ithd *softintr; /* descriptor for the "IRQ" */
- intrec *idesc; /* descriptor for this handler */
+ struct ithd *softintr; /* descriptor for the "IRQ" */
+ struct intrec *idesc; /* descriptor for this handler */
char *name = "sintr"; /* name for idesc */
int i;
@@ -304,7 +304,7 @@ void
intr_soft(void *dummy)
{
int i;
- ithd *me; /* our thread context */
+ struct ithd *me; /* our thread context */
me = curproc->p_ithd; /* point to myself */
diff --git a/sys/i386/isa/nmi.c b/sys/i386/isa/nmi.c
index 870760e..4506c05 100644
--- a/sys/i386/isa/nmi.c
+++ b/sys/i386/isa/nmi.c
@@ -42,6 +42,7 @@
#include "isa.h"
#include <sys/param.h>
+#include <sys/bus.h>
#ifndef SMP
#include <machine/lock.h>
#endif
@@ -93,8 +94,8 @@
* case, so these arrays have NHWI + NSWI entries, not ICU_LEN.
*/
u_long *intr_countp[NHWI + NSWI]; /* pointers to interrupt counters */
-inthand2_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
-ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
+driver_intr_t *intr_handler[NHWI + NSWI]; /* first level interrupt handler */
+struct ithd *ithds[NHWI + NSWI]; /* real interrupt handler */
void *intr_unit[NHWI + NSWI];
static inthand_t *fastintr[ICU_LEN] = {
@@ -125,7 +126,7 @@ static inthand_t *slowintr[ICU_LEN] = {
#endif /* APIC_IO */
};
-static inthand2_t isa_strayintr;
+static driver_intr_t isa_strayintr;
#ifdef PC98
#define NMI_PARITY 0x04
@@ -284,7 +285,7 @@ isa_defaultirq()
/* icu vectors */
for (i = 0; i < ICU_LEN; i++)
- icu_unset(i, (inthand2_t *)NULL);
+ icu_unset(i, (driver_intr_t *)NULL);
/* initialize 8259's */
#if NMCA > 0
@@ -431,7 +432,7 @@ found:
}
int
-icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
+icu_setup(int intr, driver_intr_t *handler, void *arg, int flags)
{
#ifdef FAST_HI
int select; /* the select register is 8 bits */
@@ -502,7 +503,7 @@ icu_setup(int intr, inthand2_t *handler, void *arg, int flags)
int
icu_unset(intr, handler)
int intr;
- inthand2_t *handler;
+ driver_intr_t *handler;
{
u_long ef;
@@ -530,13 +531,13 @@ icu_unset(intr, handler)
return (0);
}
-intrec *
-inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
+struct intrec *
+inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
int pri, int flags)
{
- ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
- intrec *head; /* chain of handlers for IRQ */
- intrec *idesc; /* descriptor for this handler */
+ struct ithd *ithd = ithds[irq]; /* descriptor for the IRQ */
+ struct intrec *head; /* chain of handlers for IRQ */
+ struct intrec *idesc; /* descriptor for this handler */
struct proc *p; /* interrupt thread */
int errcode = 0;
@@ -669,10 +670,10 @@ inthand_add(const char *name, int irq, inthand2_t handler, void *arg,
*/
int
-inthand_remove(intrec *idesc)
+inthand_remove(struct intrec *idesc)
{
- ithd *ithd; /* descriptor for the IRQ */
- intrec *ih; /* chain of handlers */
+ struct ithd *ithd; /* descriptor for the IRQ */
+ struct intrec *ih; /* chain of handlers */
if (idesc == NULL)
return (-1);
diff --git a/sys/i4b/layer1/i4b_avm_fritz_pnp.c b/sys/i4b/layer1/i4b_avm_fritz_pnp.c
index a411c8c..54db491 100644
--- a/sys/i4b/layer1/i4b_avm_fritz_pnp.c
+++ b/sys/i4b/layer1/i4b_avm_fritz_pnp.c
@@ -53,6 +53,9 @@
#include <sys/param.h>
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#include <sys/ioccom.h>
+#if __FreeBSD__ >= 5
+#include <sys/bus.h>
+#endif
#else
#include <sys/ioctl.h>
#endif
@@ -436,7 +439,7 @@ isic_probe_avm_pnp(struct isa_device *dev, unsigned int iobase2)
}
sc->sc_irq = dev->id_irq;
- dev->id_intr = (inthand2_t *) avm_pnp_intr;
+ dev->id_intr = (driver_intr_t *) avm_pnp_intr;
/* check if memory addr specified */
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 724f3c2..0e2c098 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -1037,7 +1037,7 @@ cpu_initclocks()
* 19 July 2000).
*/
/* Setup the PIC clk handler. The APIC handler is setup later */
- inthand_add("clk", 0, (inthand2_t *)clkintr, NULL, PI_REALTIME,
+ inthand_add("clk", 0, (driver_intr_t *)clkintr, NULL, PI_REALTIME,
INTR_EXCL);
INTREN(IRQ0);
@@ -1054,8 +1054,8 @@ cpu_initclocks()
* XXX - if statclock is disabled, don't attempt the APIC
* trial. Not sure this is sane for APIC_IO.
*/
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
- PI_REALTIME, INTR_EXCL);
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr,
+ NULL, PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif /* APIC_IO */
return;
@@ -1075,10 +1075,10 @@ cpu_initclocks()
* interrupts.
*/
clkdesc = inthand_add("clk", apic_8254_intr,
- (inthand2_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
+ (driver_intr_t *)clkintr, NULL, PI_REALTIME, INTR_FAST);
INTREN(1 << apic_8254_intr);
- rtcdesc = inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL,
+ rtcdesc = inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL,
PI_REALTIME, INTR_FAST); /* XXX */
INTREN(APIC_IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
@@ -1128,12 +1128,12 @@ cpu_initclocks()
}
/* Finally, setup the real clock handlers */
- inthand_add("clk", apic_8254_intr, (inthand2_t *)clkintr, NULL,
+ inthand_add("clk", apic_8254_intr, (driver_intr_t *)clkintr, NULL,
PI_REALTIME, INTR_EXCL);
INTREN(1 << apic_8254_intr);
#endif
- inthand_add("rtc", 8, (inthand2_t *)rtcintr, NULL, PI_REALTIME,
+ inthand_add("rtc", 8, (driver_intr_t *)rtcintr, NULL, PI_REALTIME,
INTR_EXCL);
#ifdef APIC_IO
INTREN(APIC_IRQ8);
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index 8826c41..2dbccdc 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/sio.c
@@ -53,6 +53,7 @@
* - Added PC-Card driver table and handlers
*/
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/reboot.h>
#include <sys/malloc.h>
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index dd4b7c9..c55b294 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -29,6 +29,8 @@
#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/rtprio.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -128,3 +130,40 @@ unregister_swi(intr, handler)
splx(s);
}
+int
+ithread_priority(flags)
+ int flags;
+{
+ int pri;
+
+ switch (flags) {
+ case INTR_TYPE_TTY: /* keyboard or parallel port */
+ pri = PI_TTYLOW;
+ break;
+ case (INTR_TYPE_TTY | INTR_FAST): /* sio */
+ pri = PI_TTYHIGH;
+ break;
+ case INTR_TYPE_BIO:
+ /*
+ * XXX We need to refine this. BSD/OS distinguishes
+ * between tape and disk priorities.
+ */
+ pri = PI_DISK;
+ break;
+ case INTR_TYPE_NET:
+ pri = PI_NET;
+ break;
+ case INTR_TYPE_CAM:
+ pri = PI_DISK; /* XXX or PI_CAM? */
+ break;
+ case INTR_TYPE_MISC:
+ pri = PI_DULL; /* don't care */
+ break;
+ /* We didn't specify an interrupt level. */
+ default:
+ panic("ithread_priority: no interrupt type in flags");
+ }
+
+ return pri;
+}
+
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c
index 6d18cb9..422fa86 100644
--- a/sys/kern/subr_taskqueue.c
+++ b/sys/kern/subr_taskqueue.c
@@ -27,6 +27,7 @@
*/
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/kernel.h>
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index 8133883..b16dbfa 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -31,6 +31,7 @@
*/
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
@@ -53,7 +54,7 @@
/*
* Prototypes for interrupt handler.
*/
-static inthand2_t pcicintr;
+static driver_intr_t pcicintr;
static int pcic_ioctl __P((struct slot *, int, caddr_t));
static int pcic_power __P((struct slot *));
static timeout_t pcic_reset;
diff --git a/sys/pci/pci_compat.c b/sys/pci/pci_compat.c
index 2e7eba5..447fc58 100644
--- a/sys/pci/pci_compat.c
+++ b/sys/pci/pci_compat.c
@@ -38,12 +38,12 @@
#include <vm/vm.h>
#include <vm/pmap.h>
-#include <sys/interrupt.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
+#include <sys/interrupt.h>
#include <sys/pciio.h>
#include <pci/pcireg.h>
@@ -53,13 +53,6 @@
#include <machine/smp.h>
#endif
-#ifdef __i386__
-#include <sys/proc.h>
-#include <i386/isa/icu.h>
-#include <i386/isa/intr_machdep.h>
-#endif
-
-
/* ------------------------------------------------------------------------- */
u_long
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index 01b45cb..b27fc8a 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -29,6 +29,24 @@
#ifndef _SYS_INTERRUPT_H_
#define _SYS_INTERRUPT_H_
+/*
+ * Describe a hardware interrupt handler.
+ *
+ * Multiple interrupt handlers for a specific vector can be chained
+ * together via the 'next' pointer.
+ */
+
+struct ithd;
+
+struct intrec {
+ driver_intr_t *handler; /* code address of handler */
+ void *argument; /* argument to pass to handler */
+ enum intr_type flags; /* flag bits (sys/bus.h) */
+ char *name; /* name of handler */
+ struct ithd *ithd; /* handler we're connected to */
+ struct intrec *next; /* next handler for this irq */
+};
+
typedef void swihand_t __P((void));
void register_swi __P((int intr, swihand_t *handler));
@@ -36,6 +54,7 @@ void swi_dispatcher __P((int intr));
swihand_t swi_generic;
swihand_t swi_null;
void unregister_swi __P((int intr, swihand_t *handler));
+int ithread_priority __P((int flags));
extern swihand_t *ihandlers[];
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 900ac5d..edc2cd2 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -335,7 +335,7 @@ struct pcred {
* this a superset of struct proc, i.e. it_proc is the struct itself and not a
* pointer. We point in both directions, because it feels good that way.
*/
-typedef struct ithd {
+struct ithd {
struct proc *it_proc; /* interrupt process */
LIST_HEAD(ihhead, intrhand) it_ihhead;
@@ -379,7 +379,7 @@ typedef struct ithd {
int it_cnt; /* number of schedule events */
#endif
-} ithd;
+};
#ifdef _KERNEL
OpenPOWER on IntegriCloud