summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-04-16 16:37:54 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-04-16 16:37:54 +0000
commitcf862b65af95b979f6ed86507994081c97c3f667 (patch)
tree879529050bf9818fa13e1df81055601f35e6bba3 /sys/dev
parentfafdaa07835fff33b93135b3414bc5ce632c0a31 (diff)
establish the interrupt per port and not per board (inspired by the
tht driver)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_nx.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/sys/dev/pci/if_nx.c b/sys/dev/pci/if_nx.c
index 7698f77cebb..c0fe753cde8 100644
--- a/sys/dev/pci/if_nx.c
+++ b/sys/dev/pci/if_nx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nx.c,v 1.2 2007/04/16 16:28:39 reyk Exp $ */
+/* $OpenBSD: if_nx.c,v 1.3 2007/04/16 16:37:53 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -85,7 +85,7 @@ struct nxb_softc {
bus_size_t sc_ios;
bus_dma_tag_t sc_dmat;
- void *sc_ih;
+ pci_intr_handle_t sc_ih;
u_int32_t sc_nrxbuf;
u_int32_t sc_ntxbuf;
@@ -98,8 +98,11 @@ struct nx_softc {
struct device nx_dev;
struct arpcom nx_ac;
struct mii_data nx_mii;
+
struct nxb_softc *nx_sc; /* The nxb board */
struct nxb_port *nx_port; /* Port information */
+ void *nx_ih;
+
struct timeout nx_tick;
u_int8_t nx_lladdr[ETHER_ADDR_LEN];
};
@@ -108,7 +111,6 @@ int nxb_match(struct device *, void *, void *);
void nxb_attach(struct device *, struct device *, void *);
int nxb_query(struct nxb_softc *sc);
int nxb_map_pci(struct nxb_softc *, struct pci_attach_args *);
-int nxb_intr(void *);
int nx_match(struct device *, void *, void *);
void nx_attach(struct device *, struct device *, void *);
@@ -124,6 +126,7 @@ void nx_watchdog(struct ifnet *);
int nx_ioctl(struct ifnet *, u_long, caddr_t);
void nx_iff(struct nx_softc *);
void nx_tick(void *);
+int nx_intr(void *);
struct cfdriver nxb_cd = {
0, "nxb", DV_DULL
@@ -186,7 +189,6 @@ int
nxb_map_pci(struct nxb_softc *sc, struct pci_attach_args *pa)
{
pcireg_t memtype;
- pci_intr_handle_t ih;
const char *intrstr;
sc->sc_pc = pa->pa_pc;
@@ -208,20 +210,11 @@ nxb_map_pci(struct nxb_softc *sc, struct pci_attach_args *pa)
return (1);
}
- if (pci_intr_map(pa, &ih) != 0) {
+ if (pci_intr_map(pa, &sc->sc_ih) != 0) {
printf(": unable to map interrupt\n");
goto unmap;
}
-
- intrstr = pci_intr_string(pa->pa_pc, ih);
- sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET,
- nxb_intr, sc, sc->sc_dev.dv_xname);
- if (sc->sc_ih == NULL) {
- printf(": unable to map interrupt%s%s\n",
- intrstr == NULL ? "" : " at ",
- intrstr == NULL ? "" : intrstr);
- goto unmap;
- }
+ intrstr = pci_intr_string(pa->pa_pc, sc->sc_ih);
printf(": %s\n", intrstr);
return (0);
@@ -238,12 +231,6 @@ nxb_query(struct nxb_softc *sc)
return (0);
}
-int
-nxb_intr(void *arg)
-{
- return (0);
-}
-
/*
* Routines handling the virtual ''nx'' ports
*/
@@ -280,7 +267,16 @@ nx_attach(struct device *parent, struct device *self, void *aux)
nx->nx_port = nxp;
nxp->nxp_nx = nx;
+ nx->nx_ih = pci_intr_establish(sc->sc_pc, sc->sc_ih, IPL_NET,
+ nx_intr, nx, nx->nx_dev.dv_xname);
+ if (nx->nx_ih == NULL) {
+ printf(": unable to establish interrupt\n");
+ return;
+ }
+
nx_getlladdr(nx);
+ bcopy(nx->nx_lladdr, nx->nx_ac.ac_enaddr, ETHER_ADDR_LEN);
+ printf(" address %s\n", ether_sprintf(nx->nx_ac.ac_enaddr));
ifp = &nx->nx_ac.ac_if;
ifp->if_softc = nx;
@@ -518,3 +514,9 @@ nx_tick(void *arg)
timeout_add(&nx->nx_tick, hz);
}
+int
+nx_intr(void *arg)
+{
+ return (0);
+}
+