summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-03-08 18:29:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-03-08 18:29:34 +0000
commita8f747218ef7b92511b875df290dfa93fddbbdb4 (patch)
treec4e39661eb860af60fe6047e494ffa2c1bbe9eaa /sys/arch/alpha
parent333876df415802df1ceee048a2e4426103c9ed85 (diff)
Stop defining __NO_ISA_INTR_CHECK and add a real isa_intr_check() function.
Allows pcic to attach and correctly pick a suitable interrupt on Multia.
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/isa/isa_machdep.h7
-rw-r--r--sys/arch/alpha/pci/sio.c4
-rw-r--r--sys/arch/alpha/pci/sio_pic.c31
3 files changed, 36 insertions, 6 deletions
diff --git a/sys/arch/alpha/isa/isa_machdep.h b/sys/arch/alpha/isa/isa_machdep.h
index c72c63b93ba..c0ca49e8490 100644
--- a/sys/arch/alpha/isa/isa_machdep.h
+++ b/sys/arch/alpha/isa/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.h,v 1.13 2009/08/22 02:54:50 mk Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.14 2013/03/08 18:29:33 miod Exp $ */
/* $NetBSD: isa_machdep.h,v 1.3 1996/11/19 04:53:07 cgd Exp $ */
/*
@@ -42,6 +42,7 @@ struct alpha_isa_chipset {
int (*)(void *), void *, const char *);
void (*ic_intr_disestablish)(void *, void *);
int (*ic_intr_alloc)(isa_chipset_tag_t *, int, int, int *);
+ int (*ic_intr_check)(isa_chipset_tag_t *, int, int);
};
/*
@@ -55,8 +56,8 @@ struct alpha_isa_chipset {
(*(c)->ic_intr_disestablish)((c)->ic_v, (h))
#define isa_intr_alloc(c, m, t, i) \
(*(c)->ic_intr_alloc)((c)->ic_v, (m), (t), (i))
-
-#define __NO_ISA_INTR_CHECK
+#define isa_intr_check(c, i, t) \
+ (*(c)->ic_intr_check)((c)->ic_v, (i), (t))
/*
* alpha-specific ISA functions.
diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c
index bffe3e3aa63..9d41887b6ac 100644
--- a/sys/arch/alpha/pci/sio.c
+++ b/sys/arch/alpha/pci/sio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio.c,v 1.36 2010/06/06 11:26:11 miod Exp $ */
+/* $OpenBSD: sio.c,v 1.37 2013/03/08 18:29:33 miod Exp $ */
/* $NetBSD: sio.c,v 1.15 1996/12/05 01:39:36 cgd Exp $ */
/*
@@ -60,6 +60,7 @@ int siomatch(struct device *, void *, void *);
void sioattach(struct device *, struct device *, void *);
extern int sio_intr_alloc(isa_chipset_tag_t *, int, int, int *);
+extern int sio_intr_check(isa_chipset_tag_t *, int, int);
struct cfattach sio_ca = {
@@ -187,6 +188,7 @@ sio_bridge_callback(self)
ic.ic_intr_establish = sio_intr_establish;
ic.ic_intr_disestablish = sio_intr_disestablish;
ic.ic_intr_alloc = sio_intr_alloc;
+ ic.ic_intr_check = sio_intr_check;
sa.sa_iba.iba_busname = "isa";
sa.sa_iba.iba_iot = sc->sc_iot;
diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c
index 855020961eb..d8e9dca1362 100644
--- a/sys/arch/alpha/pci/sio_pic.c
+++ b/sys/arch/alpha/pci/sio_pic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_pic.c,v 1.34 2013/03/02 22:54:29 miod Exp $ */
+/* $OpenBSD: sio_pic.c,v 1.35 2013/03/08 18:29:33 miod Exp $ */
/* $NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $ */
/*-
@@ -118,6 +118,7 @@ u_int8_t initial_elcr[2];
void sio_setirqstat(int, int, int);
int sio_intr_alloc(void *, int, int, int *);
+int sio_intr_check(void *, int, int);
u_int8_t (*sio_read_elcr)(int);
void (*sio_write_elcr)(int, u_int8_t);
@@ -580,7 +581,7 @@ sio_intr_alloc(v, mask, type, irq)
if (LEGAL_IRQ(i) == 0 || (mask & (1<<i)) == 0)
continue;
- switch(sio_intr[i].intr_sharetype) {
+ switch (sio_intr[i].intr_sharetype) {
case IST_NONE:
/*
* if nothing's using the irq, just return it
@@ -626,6 +627,32 @@ sio_intr_alloc(v, mask, type, irq)
return (0);
}
+/*
+ * Just check to see if an IRQ is available/can be shared.
+ * 0 = interrupt not available
+ * 1 = interrupt shareable
+ * 2 = interrupt all to ourself
+ */
+int
+sio_intr_check(void *v, int irq, int type)
+{
+ if (type == IST_NONE)
+ return (0);
+
+ switch (sio_intr[irq].intr_sharetype) {
+ case IST_NONE:
+ return (2);
+ case IST_EDGE:
+ case IST_LEVEL:
+ if (type == sio_intr[irq].intr_sharetype)
+ return (1);
+ /* FALLTHROUGH */
+ default:
+ case IST_PULSE:
+ return (0);
+ }
+}
+
static void
specific_eoi(irq)
int irq;