diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-06-23 16:53:09 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-06-23 16:53:09 +0000 |
commit | a37dbcd2ced8b343e4563bd46353a3c4b4e548db (patch) | |
tree | 8684142f4354d93820dd8c9d324494f81bc299df /sys | |
parent | d28ec3966301e814d9c63030a3afc07ea45eb8a3 (diff) |
Implement PCMCIA event polling. This will either complement interrupt-driven
event notification from the pcic (if an interrupt is available) or allow the
insertion and removal of PCMCIA devices even if there is no IRQ for the pcic.
Each socket is checked for status change every 0.5 seconds using art's timeout
code. Insertion and removal events should no longer ever go unnoticed.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/i82365.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/i82365var.h | 8 | ||||
-rw-r--r-- | sys/dev/isa/i82365_isa.c | 14 |
3 files changed, 36 insertions, 6 deletions
diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c index 910f35fc92f..92546233e4d 100644 --- a/sys/dev/ic/i82365.c +++ b/sys/dev/ic/i82365.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365.c,v 1.13 2000/04/19 07:52:45 fgsch Exp $ */ +/* $OpenBSD: i82365.c,v 1.14 2000/06/23 16:53:07 aaron Exp $ */ /* $NetBSD: i82365.c,v 1.10 1998/06/09 07:36:55 thorpej Exp $ */ /* @@ -664,6 +664,23 @@ pcic_intr(arg) return (ret ? 1 : 0); } +void +pcic_poll_intr(arg) + void *arg; +{ + struct pcic_softc *sc = arg; + int i, s; + + s = spltty(); + + for (i = 0; i < PCIC_NSLOTS; i++) + if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) + pcic_intr_socket(&sc->handle[i]); + + timeout_add(&sc->poll_timeout, hz / 2 ); + splx(s); +} + int pcic_intr_socket(h) struct pcic_handle *h; @@ -755,7 +772,6 @@ pcic_attach_card(h) panic("pcic_attach_card: already attached"); /* call the MI attach function */ - pcmcia_card_attach(h->pcmcia); h->flags |= PCIC_FLAG_CARDP; diff --git a/sys/dev/ic/i82365var.h b/sys/dev/ic/i82365var.h index 4758d925da7..e152b09bf1c 100644 --- a/sys/dev/ic/i82365var.h +++ b/sys/dev/ic/i82365var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365var.h,v 1.7 2000/04/19 07:27:43 fgsch Exp $ */ +/* $OpenBSD: i82365var.h,v 1.8 2000/06/23 16:53:08 aaron Exp $ */ /* $NetBSD: i82365var.h,v 1.4 1998/05/23 18:32:29 matt Exp $ */ /* @@ -31,6 +31,7 @@ */ #include <sys/device.h> +#include <sys/timeout.h> #include <dev/pcmcia/pcmciareg.h> #include <dev/pcmcia/pcmciachip.h> @@ -140,6 +141,10 @@ struct pcic_softc { int irq; void *ih; + /* used by socket event polling */ + struct timeout poll_timeout; + int poll_established; + struct pcic_handle handle[PCIC_NSLOTS]; }; @@ -150,6 +155,7 @@ int pcic_vendor __P((struct pcic_handle *)); void pcic_attach __P((struct pcic_softc *)); void pcic_attach_sockets __P((struct pcic_softc *)); int pcic_intr __P((void *arg)); +void pcic_poll_intr __P((void *arg)); int pcic_chip_mem_alloc __P((pcmcia_chipset_handle_t, bus_size_t, struct pcmcia_mem_handle *)); diff --git a/sys/dev/isa/i82365_isa.c b/sys/dev/isa/i82365_isa.c index 9939c36c1d9..5ef310aa130 100644 --- a/sys/dev/isa/i82365_isa.c +++ b/sys/dev/isa/i82365_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365_isa.c,v 1.9 1999/08/11 12:02:07 niklas Exp $ */ +/* $OpenBSD: i82365_isa.c,v 1.10 2000/06/23 16:53:08 aaron Exp $ */ /* $NetBSD: i82365_isa.c,v 1.11 1998/06/09 07:25:00 thorpej Exp $ */ /* @@ -33,6 +33,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/kernel.h> #include <sys/device.h> #include <sys/extent.h> #include <sys/malloc.h> @@ -208,7 +209,7 @@ pcic_isa_attach(parent, self, aux) sc->irq = irq; if (irq) { - printf("%s: irq %d\n", sc->dev.dv_xname, irq); + printf("%s: irq %d, ", sc->dev.dv_xname, irq); /* Set up the pcic to interrupt on card detect. */ for (i = 0; i < PCIC_NSLOTS; i++) { @@ -220,5 +221,12 @@ pcic_isa_attach(parent, self, aux) } } } else - printf("%s: no irq\n", sc->dev.dv_xname); + printf("%s: no irq, "); + + printf("polling enabled\n", sc->dev.dv_xname); + if (sc->poll_established == 0) { + timeout_set(&sc->poll_timeout, pcic_poll_intr, sc); + timeout_add(&sc->poll_timeout, hz / 2); + sc->poll_established = 1; + } } |