diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-05-19 04:05:41 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-05-19 04:05:41 +0000 |
commit | 8661516cee45ffa7f32e2d931e2ba26e8003285d (patch) | |
tree | 8f4c21475cbfe89f6c141b908f8741179a003f04 | |
parent | 7d6ed300566328aa308dc9e8f6021fad4d97272c (diff) |
hook up interrupts, but a little different to what i usually do. this maps
the interrupt before the bus independant code is attached, and establishes
the interrupt after that.
-rw-r--r-- | sys/dev/ic/sli.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/slivar.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/sli_pci.c | 19 |
3 files changed, 28 insertions, 3 deletions
diff --git a/sys/dev/ic/sli.c b/sys/dev/ic/sli.c index 8d621ae5a7a..81bb94ddbd2 100644 --- a/sys/dev/ic/sli.c +++ b/sys/dev/ic/sli.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sli.c,v 1.1 2007/05/15 01:00:15 dlg Exp $ */ +/* $OpenBSD: sli.c,v 1.2 2007/05/19 04:05:40 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -49,3 +49,9 @@ sli_detach(struct sli_softc *sc, int flags) { return (0); } + +int +sli_intr(void *arg) +{ + return (0); +} diff --git a/sys/dev/ic/slivar.h b/sys/dev/ic/slivar.h index 723418e740e..a9327f4c007 100644 --- a/sys/dev/ic/slivar.h +++ b/sys/dev/ic/slivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: slivar.h,v 1.2 2007/05/16 04:33:57 dlg Exp $ */ +/* $OpenBSD: slivar.h,v 1.3 2007/05/19 04:05:40 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -31,3 +31,5 @@ struct sli_softc { int sli_attach(struct sli_softc *); int sli_detach(struct sli_softc *, int); + +int sli_intr(void *); diff --git a/sys/dev/pci/sli_pci.c b/sys/dev/pci/sli_pci.c index 29846462829..e3ef7472b97 100644 --- a/sys/dev/pci/sli_pci.c +++ b/sys/dev/pci/sli_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sli_pci.c,v 1.2 2007/05/16 04:33:57 dlg Exp $ */ +/* $OpenBSD: sli_pci.c,v 1.3 2007/05/19 04:05:40 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -72,9 +72,11 @@ sli_pci_attach(struct device *parent, struct device *self, void *aux) struct sli_softc *sc = &psc->psc_sli; struct pci_attach_args *pa = aux; pcireg_t memtype; + pci_intr_handle_t ih; psc->psc_pc = pa->pa_pc; psc->psc_tag = pa->pa_tag; + psc->psc_ih = NULL; sc->sc_ios_slim = 0; sc->sc_ios_reg = 0; @@ -96,13 +98,28 @@ sli_pci_attach(struct device *parent, struct device *self, void *aux) goto unmap_slim; } + if (pci_intr_map(pa, &ih)) { + printf(": unable to map interrupt\n"); + goto unmap_reg; + } + printf(": %s", pci_intr_string(psc->psc_pc, ih)); + if (sli_attach(sc) != 0) { /* error already printed by sli_attach() */ goto unmap_reg; } + psc->psc_ih = pci_intr_establish(psc->psc_pc, ih, IPL_BIO, + sli_intr, sc, DEVNAME(sc)); + if (psc->psc_ih == NULL) { + printf("%s: unable to establish interrupt\n"); + goto detach; + } + return; +detach: + sli_detach(sc, DETACH_FORCE|DETACH_QUIET); unmap_reg: bus_space_unmap(sc->sc_iot_reg, sc->sc_ioh_reg, sc->sc_ios_reg); sc->sc_ios_reg = 0; |