summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_vic.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-10-23 07:15:19 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-10-23 07:15:19 +0000
commit0d4c75d9ead0c3dc2bcd83ae0e19133b97ff877d (patch)
tree8b8a8e0d7b164612cb123f6e1c7c29954eb2e185 /sys/dev/pci/if_vic.c
parentab9d35bdaa2e2c43fea75d23bac90f033e92a916 (diff)
shrink dmesg output to one line that shows irq and the ethernet address.
the vmxnet id never changes. ok reyk@
Diffstat (limited to 'sys/dev/pci/if_vic.c')
-rw-r--r--sys/dev/pci/if_vic.c93
1 files changed, 37 insertions, 56 deletions
diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c
index b47d12c3d21..2bae772dc6d 100644
--- a/sys/dev/pci/if_vic.c
+++ b/sys/dev/pci/if_vic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vic.c,v 1.49 2007/06/15 02:29:50 dlg Exp $ */
+/* $OpenBSD: if_vic.c,v 1.50 2007/10/23 07:15:18 dlg Exp $ */
/*
* Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org>
@@ -304,7 +304,6 @@ struct cfattach vic_ca = {
int vic_intr(void *);
void vic_shutdown(void *);
-int vic_map_pci(struct vic_softc *, struct pci_attach_args *);
int vic_query(struct vic_softc *);
int vic_alloc_data(struct vic_softc *);
int vic_init_data(struct vic_softc *sc);
@@ -355,21 +354,41 @@ vic_attach(struct device *parent, struct device *self, void *aux)
{
struct vic_softc *sc = (struct vic_softc *)self;
struct pci_attach_args *pa = aux;
+ pcireg_t memtype;
+ pci_intr_handle_t ih;
struct ifnet *ifp;
- if (vic_map_pci(sc, pa) != 0) {
- /* error printed by vic_map_pci */
+ sc->sc_pc = pa->pa_pc;
+ sc->sc_tag = pa->pa_tag;
+ sc->sc_dmat = pa->pa_dmat;
+
+ memtype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, VIC_PCI_BAR);
+ if (pci_mapreg_map(pa, VIC_PCI_BAR, memtype, 0, &sc->sc_iot,
+ &sc->sc_ioh, NULL, &sc->sc_ios, 0) != 0) {
+ printf(": unable to map system interface register\n");
return;
}
+ if (pci_intr_map(pa, &ih) != 0) {
+ printf(": unable to map interrupt\n");
+ goto unmap;
+ }
+
+ sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET,
+ vic_intr, sc, DEVNAME(sc));
+ if (sc->sc_ih == NULL) {
+ printf(": unable to establish interrupt\n");
+ goto unmap;
+ }
+
if (vic_query(sc) != 0) {
/* error printed by vic_query */
- return;
+ goto unmap;
}
if (vic_alloc_data(sc) != 0) {
/* error printed by vic_alloc */
- return;
+ goto unmap;
}
timeout_set(&sc->sc_tick, vic_tick, sc);
@@ -405,49 +424,19 @@ vic_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
- return;
-}
-
-int
-vic_map_pci(struct vic_softc *sc, struct pci_attach_args *pa)
-{
- pcireg_t memtype;
- pci_intr_handle_t ih;
- const char *intrstr;
-
- sc->sc_pc = pa->pa_pc;
- sc->sc_tag = pa->pa_tag;
- sc->sc_dmat = pa->pa_dmat;
+ printf(": %s, address %s\n", pci_intr_string(pa->pa_pc, ih),
+ ether_sprintf(sc->sc_lladdr));
- memtype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, VIC_PCI_BAR);
- if (pci_mapreg_map(pa, VIC_PCI_BAR, memtype, 0, &sc->sc_iot,
- &sc->sc_ioh, NULL, &sc->sc_ios, 0) != 0) {
- printf(": unable to map system interface register\n");
- return (1);
- }
-
- if (pci_intr_map(pa, &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,
- vic_intr, sc, DEVNAME(sc));
- if (sc->sc_ih == NULL) {
- printf(": unable to map interrupt%s%s\n",
- intrstr == NULL ? "" : " at ",
- intrstr == NULL ? "" : intrstr);
- goto unmap;
- }
- printf(": %s\n", intrstr);
+#ifdef VIC_DEBUG
+ printf("%s: feature 0x%8x, cap 0x%8x, rx/txbuf %d/%d\n", DEVNAME(sc),
+ sc->sc_feature, sc->sc_cap, sc->sc_nrxbuf, sc->sc_ntxbuf);
+#endif
- return (0);
+ return;
unmap:
bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
sc->sc_ios = 0;
- return (1);
}
int
@@ -461,12 +450,12 @@ vic_query(struct vic_softc *sc)
/* Check for a supported version */
if ((major & VIC_VERSION_MAJOR_M) !=
(VIC_MAGIC & VIC_VERSION_MAJOR_M)) {
- printf("%s: magic mismatch\n", DEVNAME(sc));
+ printf(": magic mismatch\n");
return (1);
}
if (VIC_MAGIC > major || VIC_MAGIC < minor) {
- printf("%s: unsupported version (%X)\n", DEVNAME(sc),
+ printf(": unsupported version (%X)\n",
major & ~VIC_VERSION_MAJOR_M);
return (1);
}
@@ -478,14 +467,6 @@ vic_query(struct vic_softc *sc)
vic_getlladdr(sc);
- printf("%s: VMXnet %04X, address %s\n", DEVNAME(sc),
- major & ~VIC_VERSION_MAJOR_M, ether_sprintf(sc->sc_lladdr));
-
-#ifdef VIC_DEBUG
- printf("%s: feature 0x%8x, cap 0x%8x, rx/txbuf %d/%d\n", DEVNAME(sc),
- sc->sc_feature, sc->sc_cap, sc->sc_nrxbuf, sc->sc_ntxbuf);
-#endif
-
if (sc->sc_nrxbuf > VIC_NBUF_MAX || sc->sc_nrxbuf == 0)
sc->sc_nrxbuf = VIC_NBUF;
if (sc->sc_ntxbuf > VIC_NBUF_MAX || sc->sc_ntxbuf == 0)
@@ -505,14 +486,14 @@ vic_alloc_data(struct vic_softc *sc)
sc->sc_rxbuf = malloc(sizeof(struct vic_rxbuf) * sc->sc_nrxbuf,
M_NOWAIT, M_DEVBUF);
if (sc->sc_rxbuf == NULL) {
- printf("%s: unable to allocate rxbuf\n", DEVNAME(sc));
+ printf(": unable to allocate rxbuf\n");
goto err;
}
sc->sc_txbuf = malloc(sizeof(struct vic_txbuf) * sc->sc_ntxbuf,
M_NOWAIT, M_DEVBUF);
if (sc->sc_txbuf == NULL) {
- printf("%s: unable to allocate txbuf\n", DEVNAME(sc));
+ printf(": unable to allocate txbuf\n");
goto freerx;
}
@@ -521,7 +502,7 @@ vic_alloc_data(struct vic_softc *sc)
sc->sc_ntxbuf * sizeof(struct vic_txdesc);
if (vic_alloc_dmamem(sc) != 0) {
- printf("%s: unable to allocate dma region\n", DEVNAME(sc));
+ printf(": unable to allocate dma region\n");
goto freetx;
}
kva = VIC_DMA_KVA(sc);