summaryrefslogtreecommitdiffstats
path: root/sys/sun4v
diff options
context:
space:
mode:
authorpiso <piso@FreeBSD.org>2007-02-23 12:19:07 +0000
committerpiso <piso@FreeBSD.org>2007-02-23 12:19:07 +0000
commit6a2ffa86e5b748ba71e36d37462a936eb9101be7 (patch)
tree10833d4edb6c0d0a5efcf7762d842a4c378404b0 /sys/sun4v
parent7b48c9d78377cdb9fc6e8bcc5406e28819aef6e3 (diff)
downloadFreeBSD-src-6a2ffa86e5b748ba71e36d37462a936eb9101be7.zip
FreeBSD-src-6a2ffa86e5b748ba71e36d37462a936eb9101be7.tar.gz
o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
Diffstat (limited to 'sys/sun4v')
-rw-r--r--sys/sun4v/include/intr_machdep.h4
-rw-r--r--sys/sun4v/sun4v/hvcons.c2
-rw-r--r--sys/sun4v/sun4v/intr_machdep.c30
-rw-r--r--sys/sun4v/sun4v/nexus.c4
-rw-r--r--sys/sun4v/sun4v/vnex.c4
5 files changed, 23 insertions, 21 deletions
diff --git a/sys/sun4v/include/intr_machdep.h b/sys/sun4v/include/intr_machdep.h
index 9788e39..e933c8a 100644
--- a/sys/sun4v/include/intr_machdep.h
+++ b/sys/sun4v/include/intr_machdep.h
@@ -80,8 +80,8 @@ extern struct intr_vector intr_vectors[];
void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
void *iva);
-int inthand_add(const char *name, int vec, void (*handler)(void *),
- void *arg, int flags, void **cookiep);
+int inthand_add(const char *name, int vec, int (*filt)(void *),
+ void (*handler)(void *), void *arg, int flags, void **cookiep);
int inthand_remove(int vec, void *cookie);
void cpu_intrq_init(void);
diff --git a/sys/sun4v/sun4v/hvcons.c b/sys/sun4v/sun4v/hvcons.c
index ca75ed6..201b22c 100644
--- a/sys/sun4v/sun4v/hvcons.c
+++ b/sys/sun4v/sun4v/hvcons.c
@@ -390,7 +390,7 @@ hvcn_dev_attach(device_t dev)
goto fail;
}
- error = bus_setup_intr(dev, hvcn_irq, INTR_TYPE_TTY, hvcn_intr, hvcn_tp,
+ error = bus_setup_intr(dev, hvcn_irq, INTR_TYPE_TTY, NULL, hvcn_intr, hvcn_tp,
hvcn_intrhand);
if (error)
diff --git a/sys/sun4v/sun4v/intr_machdep.c b/sys/sun4v/sun4v/intr_machdep.c
index 6f17a69..0596b5a 100644
--- a/sys/sun4v/sun4v/intr_machdep.c
+++ b/sys/sun4v/sun4v/intr_machdep.c
@@ -145,7 +145,7 @@ static struct mtx intr_table_lock;
static void intr_execute_handlers(void *);
static void intr_stray_level(struct trapframe *);
-static void intr_stray_vector(void *);
+static void intr_stray_vector(void *);
static int intrcnt_setname(const char *, int);
static void intrcnt_updatename(int, const char *, int);
static void cpu_intrq_alloc(void);
@@ -294,14 +294,14 @@ intr_execute_handlers(void *cookie)
thread = 0;
TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (!(ih->ih_flags & IH_FAST)) {
+ if (ih->ih_filter == NULL) {
thread = 1;
continue;
}
- MPASS(ih->ih_flags & IH_FAST && ih->ih_argument != NULL);
+ MPASS(ih->ih_filter == NULL && ih->ih_argument != NULL);
CTR3(KTR_INTR, "%s: executing handler %p(%p)", __func__,
- ih->ih_handler, ih->ih_argument);
- ih->ih_handler(ih->ih_argument);
+ ih->ih_filter, ih->ih_argument);
+ ih->ih_filter(ih->ih_argument);
}
/* Schedule a heavyweight interrupt process. */
@@ -315,7 +315,7 @@ intr_execute_handlers(void *cookie)
}
}
-static void
+static int
ithread_wrapper(void *arg)
{
struct ithread_vector_handler *ivh = (struct ithread_vector_handler *)arg;
@@ -323,12 +323,12 @@ ithread_wrapper(void *arg)
ivh->ivh_handler(ivh->ivh_arg);
/* re-enable interrupt */
hv_intr_setstate(ivh->ivh_vec, HV_INTR_IDLE_STATE);
-
+ return (FILTER_HANDLED);
}
int
-inthand_add(const char *name, int vec, void (*handler)(void *), void *arg,
- int flags, void **cookiep)
+inthand_add(const char *name, int vec, driver_filter_t *filt,
+ void (*handler)(void *), void *arg, int flags, void **cookiep)
{
struct intr_vector *iv;
struct intr_event *ie; /* descriptor for the IRQ */
@@ -336,6 +336,8 @@ inthand_add(const char *name, int vec, void (*handler)(void *), void *arg,
struct ithread_vector_handler *ivh;
int errcode, pil;
+ if (filt != NULL && handler != NULL)
+ return (EINVAL);
/*
* Work around a race where more than one CPU may be registering
* handlers on the same IRQ at the same time.
@@ -361,17 +363,17 @@ inthand_add(const char *name, int vec, void (*handler)(void *), void *arg,
}
}
- if (!(flags & INTR_FAST)) {
+ if (filt != NULL) {
ivh = (struct ithread_vector_handler *)
malloc(sizeof(struct ithread_vector_handler), M_DEVBUF, M_WAITOK);
- ivh->ivh_handler = handler;
+ ivh->ivh_handler = (driver_intr_t *)filt;
ivh->ivh_arg = arg;
ivh->ivh_vec = vec;
- errcode = intr_event_add_handler(ie, name, ithread_wrapper, ivh,
+ errcode = intr_event_add_handler(ie, name, ithread_wrapper, NULL, ivh,
intr_priority(flags), flags, cookiep);
} else {
ivh = NULL;
- errcode = intr_event_add_handler(ie, name, handler, arg,
+ errcode = intr_event_add_handler(ie, name, NULL, handler, arg,
intr_priority(flags), flags,
cookiep);
}
@@ -381,7 +383,7 @@ inthand_add(const char *name, int vec, void (*handler)(void *), void *arg,
free(ivh, M_DEVBUF);
return (errcode);
}
- pil = (flags & INTR_FAST) ? PIL_FAST : PIL_ITHREAD;
+ pil = (filt != NULL) ? PIL_FAST : PIL_ITHREAD;
intr_setup(pil, intr_fast, vec, intr_execute_handlers, iv);
diff --git a/sys/sun4v/sun4v/nexus.c b/sys/sun4v/sun4v/nexus.c
index af16e67..e100f82 100644
--- a/sys/sun4v/sun4v/nexus.c
+++ b/sys/sun4v/sun4v/nexus.c
@@ -306,7 +306,7 @@ nexus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
static int
nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
- driver_intr_t *intr, void *arg, void **cookiep)
+ driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
{
struct nexus_devinfo *ndi;
device_t ichild;
@@ -346,7 +346,7 @@ nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
goto fail;
error = inthand_add(device_get_nameunit(child), ihdl,
- intr, arg, flags, cookiep);
+ filt, intr, arg, flags, cookiep);
cpuid = 0;
if (hv_intr_settarget(ihdl, cpuid) != H_EOK) {
diff --git a/sys/sun4v/sun4v/vnex.c b/sys/sun4v/sun4v/vnex.c
index 7e8b17a..5a36e64 100644
--- a/sys/sun4v/sun4v/vnex.c
+++ b/sys/sun4v/sun4v/vnex.c
@@ -249,7 +249,7 @@ vnex_probe_nomatch(device_t dev, device_t child)
static int
vnex_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
- driver_intr_t *intr, void *arg, void **cookiep)
+ driver_filter_t *filt,driver_intr_t *intr, void *arg, void **cookiep)
{
uint64_t reg, nreg;
@@ -298,7 +298,7 @@ vnex_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
goto fail;
error = inthand_add(device_get_nameunit(child), ihdl,
- intr, arg, flags, cookiep);
+ filt, intr, arg, flags, cookiep);
printf("inthandler added\n");
fail:
OpenPOWER on IntegriCloud