diff options
| author | tsutsui <tsutsui@NetBSD.org> | 2002-10-04 16:16:32 +0000 |
|---|---|---|
| committer | tsutsui <tsutsui@NetBSD.org> | 2002-10-04 16:16:32 +0000 |
| commit | af5d007edeffda3a847c9f7af7967a3f9c5aef36 (patch) | |
| tree | befc67493007f7ea21f19e1f942f89633fae2b58 /sys/dev | |
| parent | b449802f9316a0f1a679fd1e4c8faf3c6201dca8 (diff) | |
- Merge if_levar.h into if_le_isapnp.c since it is included only by
if_le_isapnp.c.
- Rename struct le_softc -> le_isapnp_softc
- Fix some messages on attachment.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/isapnp/if_le_isapnp.c | 65 | ||||
| -rw-r--r-- | sys/dev/isapnp/if_levar.h | 59 |
2 files changed, 40 insertions, 84 deletions
diff --git a/sys/dev/isapnp/if_le_isapnp.c b/sys/dev/isapnp/if_le_isapnp.c index 00e32bd6c25..33e32f1424f 100644 --- a/sys/dev/isapnp/if_le_isapnp.c +++ b/sys/dev/isapnp/if_le_isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_isapnp.c,v 1.23 2002/10/02 16:34:01 thorpej Exp $ */ +/* $NetBSD: if_le_isapnp.c,v 1.24 2002/10/04 16:16:32 tsutsui Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_le_isapnp.c,v 1.23 2002/10/02 16:34:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_isapnp.c,v 1.24 2002/10/04 16:16:32 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -102,27 +102,47 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_isapnp.c,v 1.23 2002/10/02 16:34:01 thorpej Ex #include <dev/ic/lancevar.h> #include <dev/ic/am7990reg.h> #include <dev/ic/am7990var.h> -#include <dev/isapnp/if_levar.h> + +#define LE_ISAPNP_MEMSIZE 16384 + +#define PCNET_SAPROM 0x00 +#define PCNET_RDP 0x10 +#define PCNET_RAP 0x12 + +/* + * Ethernet software status per interface. + * + * Each interface is referenced by a network interface structure, + * ethercom.ec_if, which the routing code uses to locate the interface. + * This structure contains the output queue for the interface, its address, ... + */ +struct le_isapnp_softc { + struct am7990_softc sc_am7990; /* glue to MI code */ + + void *sc_ih; + bus_space_tag_t sc_iot; /* space cookie */ + bus_space_handle_t sc_ioh; /* bus space handle */ + bus_dma_tag_t sc_dmat; /* bus dma tag */ + bus_dmamap_t sc_dmam; /* bus dma map */ + int sc_rap, sc_rdp; /* offsets to LANCE registers */ +}; int le_isapnp_match __P((struct device *, struct cfdata *, void *)); void le_isapnp_attach __P((struct device *, struct device *, void *)); -CFATTACH_DECL(le_isapnp, sizeof(struct le_softc), +CFATTACH_DECL(le_isapnp, sizeof(struct le_isapnp_softc), le_isapnp_match, le_isapnp_attach, NULL, NULL); int le_isapnp_intredge __P((void *)); static void le_isapnp_wrcsr __P((struct lance_softc *, u_int16_t, u_int16_t)); static u_int16_t le_isapnp_rdcsr __P((struct lance_softc *, u_int16_t)); - -#define LE_ISAPNP_MEMSIZE 16384 - static void le_isapnp_wrcsr(sc, port, val) struct lance_softc *sc; u_int16_t port, val; { - struct le_softc *lesc = (struct le_softc *)sc; + struct le_isapnp_softc *lesc = (struct le_isapnp_softc *)sc; bus_space_tag_t iot = lesc->sc_iot; bus_space_handle_t ioh = lesc->sc_ioh; @@ -135,7 +155,7 @@ le_isapnp_rdcsr(sc, port) struct lance_softc *sc; u_int16_t port; { - struct le_softc *lesc = (struct le_softc *)sc; + struct le_isapnp_softc *lesc = (struct le_isapnp_softc *)sc; bus_space_tag_t iot = lesc->sc_iot; bus_space_handle_t ioh = lesc->sc_ioh; u_int16_t val; @@ -164,7 +184,7 @@ le_isapnp_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct le_softc *lesc = (void *)self; + struct le_isapnp_softc *lesc = (struct le_isapnp_softc *)self; struct lance_softc *sc = &lesc->sc_am7990.lsc; struct isapnp_attach_args *ipa = aux; bus_space_tag_t iot; @@ -174,8 +194,7 @@ le_isapnp_attach(parent, self, aux) int i, rseg, error; if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { - printf("%s: error in region allocation\n", - sc->sc_dev.dv_xname); + printf(": error in region allocation\n"); return; } @@ -190,21 +209,19 @@ le_isapnp_attach(parent, self, aux) * Extract the physical MAC address from the ROM. */ for (i = 0; i < sizeof(sc->sc_enaddr); i++) - sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, PCNET_SAPROM+i); + sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, PCNET_SAPROM + i); /* * Allocate a DMA area for the card. */ if (bus_dmamem_alloc(dmat, LE_ISAPNP_MEMSIZE, PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) { - printf("%s: couldn't allocate memory for card\n", - sc->sc_dev.dv_xname); + printf(": couldn't allocate memory for card\n"); return; } if (bus_dmamem_map(dmat, &seg, rseg, LE_ISAPNP_MEMSIZE, (caddr_t *)&sc->sc_mem, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) { - printf("%s: couldn't map memory for card\n", - sc->sc_dev.dv_xname); + printf(": couldn't map memory for card\n"); return; } @@ -213,15 +230,13 @@ le_isapnp_attach(parent, self, aux) */ if (bus_dmamap_create(dmat, LE_ISAPNP_MEMSIZE, 1, LE_ISAPNP_MEMSIZE, 0, BUS_DMA_NOWAIT, &lesc->sc_dmam)) { - printf("%s: couldn't create DMA map\n", - sc->sc_dev.dv_xname); + printf(": couldn't create DMA map\n"); bus_dmamem_free(dmat, &seg, rseg); return; } if (bus_dmamap_load(dmat, lesc->sc_dmam, sc->sc_mem, LE_ISAPNP_MEMSIZE, NULL, BUS_DMA_NOWAIT)) { - printf("%s: coundn't load DMA map\n", - sc->sc_dev.dv_xname); + printf(": coundn't load DMA map\n"); bus_dmamem_free(dmat, &seg, rseg); return; } @@ -243,8 +258,7 @@ le_isapnp_attach(parent, self, aux) if (ipa->ipa_ndrq > 0) { if ((error = isa_dmacascade(ipa->ipa_ic, ipa->ipa_drq[0].num)) != 0) { - printf("%s: unable to cascade DRQ, error = %d\n", - sc->sc_dev.dv_xname, error); + printf(": unable to cascade DRQ, error = %d\n", error); return; } } @@ -252,8 +266,9 @@ le_isapnp_attach(parent, self, aux) lesc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num, ipa->ipa_irq[0].type, IPL_NET, le_isapnp_intredge, sc); - printf("%s: %s %s\n", sc->sc_dev.dv_xname, ipa->ipa_devident, - ipa->ipa_devclass); + printf(": %s %s\n", ipa->ipa_devident, ipa->ipa_devclass); + + printf("%s", sc->sc_dev.dv_xname); am7990_config(&lesc->sc_am7990); } diff --git a/sys/dev/isapnp/if_levar.h b/sys/dev/isapnp/if_levar.h deleted file mode 100644 index 3e057800020..00000000000 --- a/sys/dev/isapnp/if_levar.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: if_levar.h,v 1.3 1998/08/15 10:51:19 mycroft Exp $ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define PCNET_SAPROM 0x00 -#define PCNET_RDP 0x10 -#define PCNET_RAP 0x12 - -/* - * Ethernet software status per interface. - * - * Each interface is referenced by a network interface structure, - * ethercom.ec_if, which the routing code uses to locate the interface. - * This structure contains the output queue for the interface, its address, ... - */ -struct le_softc { - struct am7990_softc sc_am7990; /* glue to MI code */ - - void *sc_ih; - bus_space_tag_t sc_iot; /* space cookie */ - bus_space_handle_t sc_ioh; /* bus space handle */ - bus_dma_tag_t sc_dmat; /* bus dma tag */ - bus_dmamap_t sc_dmam; /* bus dma map */ - int sc_rap, sc_rdp; /* offsets to LANCE registers */ -}; |
