summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-01-19 10:04:56 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-01-19 10:04:56 +0000
commiteb406d0a17f9f4fc5ac7a96e90dbdc24e154e29c (patch)
treec715718dde905b873c553682eab39333870706e3
parentda6674ffbb766f214c8f8d98725981437c594622 (diff)
Add isa_intr_check functionality
-rw-r--r--sys/arch/amiga/isa/cross.c35
-rw-r--r--sys/arch/amiga/isa/ggbus.c32
-rw-r--r--sys/arch/amiga/isa/isa_machdep.h9
3 files changed, 60 insertions, 16 deletions
diff --git a/sys/arch/amiga/isa/cross.c b/sys/arch/amiga/isa/cross.c
index 9414dd9f8b6..bcac336bf32 100644
--- a/sys/arch/amiga/isa/cross.c
+++ b/sys/arch/amiga/isa/cross.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cross.c,v 1.12 1998/03/01 12:53:44 niklas Exp $ */
+/* $OpenBSD: cross.c,v 1.13 1999/01/19 10:04:54 niklas Exp $ */
/*
* Copyright (c) 1994, 1996 Niklas Hallqvist, Carsten Hammer
@@ -76,6 +76,7 @@ void cross_attach_hook __P((struct device *, struct device *,
void *cross_intr_establish __P((void *, int, int, int, int (*)(void *),
void *, char *));
void cross_intr_disestablish __P((void *, void *));
+int cross_intr_check __P((void *, int, int));
int cross_pager_get_pages __P((vm_pager_t, vm_page_t *, int, boolean_t));
@@ -146,6 +147,7 @@ crossattach(parent, self, aux)
sc->sc_ic.ic_attach_hook = cross_attach_hook;
sc->sc_ic.ic_intr_establish = cross_intr_establish;
sc->sc_ic.ic_intr_disestablish = cross_intr_disestablish;
+ sc->sc_ic.ic_intr_check = cross_intr_check;
sc->sc_pager.pg_ops = &crosspagerops;
sc->sc_pager.pg_type = PG_DFLT;
@@ -326,20 +328,27 @@ cross_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
/* no point in sleeping unless someone can free memory. */
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
- if (ih == NULL)
- panic("cross_intr_establish: can't malloc handler info");
+ if (ih == NULL) {
+ printf("cross_intr_establish: can't malloc handler info");
+ return (NULL);
+ }
- if (irq > ICU_LEN || type == IST_NONE)
- panic("cross_intr_establish: bogus irq or type");
+ if (irq > ICU_LEN || type == IST_NONE) {
+ printf("cross_intr_establish: bogus irq or type");
+ return (NULL);
+ }
switch (sc->sc_intrsharetype[irq]) {
+ case IST_NONE:
+ sc->sc_intrsharetype[irq] = type;
+ break;
case IST_EDGE:
case IST_LEVEL:
if (type == sc->sc_intrsharetype[irq])
break;
case IST_PULSE:
if (type != IST_NONE)
- panic("cross_intr_establish: can't share %s with %s",
+ printf("cross_intr_establish: can't share %s with %s",
isa_intr_typename(sc->sc_intrsharetype[irq]),
isa_intr_typename(type));
break;
@@ -436,7 +445,8 @@ cross_pager_get_pages(pager, mlist, npages, sync)
vm_page_free(*mlist);
/* generate A13-A19 for correct page */
- *CROSS_HANDLE_TO_XLP_LATCH((bus_space_handle_t)sc->sc_zargs.va) =
+ *CROSS_HANDLE_TO_XLP_LATCH(
+ (bus_space_handle_t)sc->sc_zargs.va) =
object->paging_offset >> 13 | CROSS_SBHE;
vm_page_rename(&sc->sc_page[i], object, offset);
@@ -448,3 +458,14 @@ cross_pager_get_pages(pager, mlist, npages, sync)
}
return (VM_PAGER_OK);
}
+
+int
+cross_intr_check(ic, irq, type)
+ void *ic;
+ int irq;
+ int type;
+{
+ struct cross_softc *sc = (struct cross_softc *)ic;
+
+ return (__isa_intr_check(irq, type, sc->sc_intrsharetype));
+}
diff --git a/sys/arch/amiga/isa/ggbus.c b/sys/arch/amiga/isa/ggbus.c
index a3bf4ca81b0..eca6be38968 100644
--- a/sys/arch/amiga/isa/ggbus.c
+++ b/sys/arch/amiga/isa/ggbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ggbus.c,v 1.12 1998/03/01 12:53:43 niklas Exp $ */
+/* $OpenBSD: ggbus.c,v 1.13 1999/01/19 10:04:54 niklas Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Niklas Hallqvist
@@ -75,6 +75,7 @@ void ggbus_attach_hook __P((struct device *, struct device *,
void *ggbus_intr_establish __P((void *, int, int, int, int (*)(void *),
void *, char *));
void ggbus_intr_disestablish __P((void *, void *));
+int ggbus_intr_check __P((void *, int, int));
struct cfattach ggbus_ca = {
sizeof(struct ggbus_softc), ggbusmatch, ggbusattach
@@ -135,6 +136,7 @@ ggbusattach(parent, self, aux)
sc->sc_ic.ic_attach_hook = ggbus_attach_hook;
sc->sc_ic.ic_intr_establish = ggbus_intr_establish;
sc->sc_ic.ic_intr_disestablish = ggbus_intr_disestablish;
+ sc->sc_ic.ic_intr_check = ggbus_intr_check;
iba.iba_busname = "isa";
iba.iba_iot = &sc->sc_iot;
@@ -246,20 +248,27 @@ ggbus_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
/* no point in sleeping unless someone can free memory. */
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
- if (ih == NULL)
- panic("ggbus_intr_establish: can't malloc handler info");
+ if (ih == NULL) {
+ printf("ggbus_intr_establish: can't malloc handler info");
+ return (NULL);
+ }
- if (irq > ICU_LEN || type == IST_NONE)
- panic("ggbus_intr_establish: bogus irq or type");
+ if (irq > ICU_LEN || type == IST_NONE) {
+ printf("ggbus_intr_establish: bogus irq or type");
+ return (NULL);
+ }
switch (sc->sc_intrsharetype[irq]) {
+ case IST_NONE:
+ sc->sc_intrsharetype[irq] = type;
+ break;
case IST_EDGE:
case IST_LEVEL:
if (type == sc->sc_intrsharetype[irq])
break;
case IST_PULSE:
if (type != IST_NONE)
- panic("ggbus_intr_establish: can't share %s with %s",
+ printf("ggbus_intr_establish: can't share %s with %s",
isa_intr_typename(sc->sc_intrsharetype[irq]),
isa_intr_typename(type));
break;
@@ -324,3 +333,14 @@ ggbus_intr_disestablish(ic, arg)
if (sc->sc_intrsharetype[irq] == NULL)
sc->sc_intrsharetype[irq] = IST_NONE;
}
+
+int
+ggbus_intr_check(ic, irq, type)
+ void *ic;
+ int irq;
+ int type;
+{
+ struct ggbus_softc *sc = (struct ggbus_softc *)ic;
+
+ return (__isa_intr_check(irq, type, sc->sc_intrsharetype));
+}
diff --git a/sys/arch/amiga/isa/isa_machdep.h b/sys/arch/amiga/isa/isa_machdep.h
index ce8ea0d262b..a7d9c40efb9 100644
--- a/sys/arch/amiga/isa/isa_machdep.h
+++ b/sys/arch/amiga/isa/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.h,v 1.3 1998/06/29 05:47:37 downsj Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.4 1999/01/19 10:04:55 niklas Exp $ */
/*
* Copyright (c) 1995, 1996 Niklas Hallqvist
@@ -47,8 +47,11 @@ struct amiga_isa_chipset {
void *(*ic_intr_establish) __P((void *, int, int, int,
int (*)(void *), void *, char *));
void (*ic_intr_disestablish) __P((void *, void *));
+ int (*ic_intr_check) __P((void *, int, int));
};
+int __isa_intr_check __P((int, int, int *));
+
/*
* Functions provided to machine-independent ISA code.
*/
@@ -58,7 +61,7 @@ struct amiga_isa_chipset {
(*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a), (w))
#define isa_intr_disestablish(c, h) \
(*(c)->ic_intr_disestablish)((c)->ic_data, (h))
-
-#define __NO_ISA_INTR_CHECK /* FIXME */
+#define isa_intr_check(c, i, t) \
+ (*(c)->ic_intr_check)((c)->ic_data, (i), (t))
#endif