summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-03-03 11:17:49 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-03-03 11:17:49 +0000
commit4099dde713a48bd641ab9efc20045f56a166994f (patch)
tree6c0cd85f0a9da03e66f2684b91f363cb614ae7db
parent2ce42d5b5b4331975d7252f0f1b0e5415b2a7ef9 (diff)
instead of establishing the interrupt in the mounthook, move it back
to the attach function and set a flag in the mounthook to start accepting interrupts (there are possible problems with establishing interrupts after the ioapics are enabled in i386 GENERIC.MP). also suggested by kettenis tested by mcbride, me, and some others ok dlg@
-rw-r--r--sys/dev/pci/if_bnx.c25
-rw-r--r--sys/dev/pci/if_bnxreg.h3
2 files changed, 17 insertions, 11 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index 7bbcab5c092..8944d7517b3 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.46 2007/03/03 03:46:12 todd Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.47 2007/03/03 11:17:48 reyk Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -738,6 +738,15 @@ bnx_attach(struct device *parent, struct device *self, void *aux)
printf(": %s\n", intrstr);
+ /* Hookup IRQ last. */
+ sc->bnx_intrhand = pci_intr_establish(pc, sc->bnx_ih, IPL_NET,
+ bnx_intr, sc, sc->bnx_dev.dv_xname);
+ if (sc->bnx_intrhand == NULL) {
+ printf("%s: couldn't establish interrupt\n",
+ sc->bnx_dev.dv_xname);
+ goto bnx_attach_fail;
+ }
+
mountroothook_establish(bnx_attachhook, sc);
return;
@@ -751,7 +760,6 @@ bnx_attachhook(void *xsc)
{
struct bnx_softc *sc = xsc;
struct pci_attach_args *pa = &sc->bnx_pa;
- pci_chipset_tag_t pc = pa->pa_pc;
struct ifnet *ifp;
u_int32_t val;
int error;
@@ -914,14 +922,8 @@ bnx_attachhook(void *xsc)
/* Get the firmware running so ASF still works. */
bnx_mgmt_init(sc);
- /* Hookup IRQ last. */
- sc->bnx_intrhand = pci_intr_establish(pc, sc->bnx_ih, IPL_NET,
- bnx_intr, sc, sc->bnx_dev.dv_xname);
- if (sc->bnx_intrhand == NULL) {
- printf("%s: couldn't establish interrupt\n",
- sc->bnx_dev.dv_xname);
- goto bnx_attach_fail;
- }
+ /* Handle interrupts */
+ sc->bnx_flags |= BNX_ACTIVE_FLAG;
goto bnx_attach_exit;
@@ -4656,6 +4658,9 @@ bnx_intr(void *xsc)
u_int32_t status_attn_bits;
sc = xsc;
+ if ((sc->bnx_flags & BNX_ACTIVE_FLAG) == 0)
+ return (0);
+
ifp = &sc->arpcom.ac_if;
DBRUNIF(1, sc->interrupts_generated++);
diff --git a/sys/dev/pci/if_bnxreg.h b/sys/dev/pci/if_bnxreg.h
index 958c5febdd8..044a995b372 100644
--- a/sys/dev/pci/if_bnxreg.h
+++ b/sys/dev/pci/if_bnxreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnxreg.h,v 1.18 2007/01/20 00:36:08 dlg Exp $ */
+/* $OpenBSD: if_bnxreg.h,v 1.19 2007/03/03 11:17:48 reyk Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -4613,6 +4613,7 @@ struct bnx_softc
#define BNX_USING_DAC_FLAG 0x10
#define BNX_USING_MSI_FLAG 0x20
#define BNX_MFW_ENABLE_FLAG 0x40
+#define BNX_ACTIVE_FLAG 0x80
/* PHY specific flags. */
u_int32_t bnx_phy_flags;