Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/isapnp - Merge if_levar.h into if_le_isapnp.c since ...
details: https://anonhg.NetBSD.org/src/rev/e81e7ebf21d8
branches: trunk
changeset: 537676:e81e7ebf21d8
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Oct 04 16:16:32 2002 +0000
description:
- 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:
sys/dev/isapnp/if_le_isapnp.c | 65 ++++++++++++++++++++++++++----------------
sys/dev/isapnp/if_levar.h | 59 ---------------------------------------
2 files changed, 40 insertions(+), 84 deletions(-)
diffs (228 lines):
diff -r 70c8909970c3 -r e81e7ebf21d8 sys/dev/isapnp/if_le_isapnp.c
--- a/sys/dev/isapnp/if_le_isapnp.c Fri Oct 04 15:43:37 2002 +0000
+++ b/sys/dev/isapnp/if_le_isapnp.c Fri Oct 04 16:16:32 2002 +0000
@@ -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 @@
#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 @@
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 @@
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 @@
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 @@
* 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 @@
*/
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 @@
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 @@
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 -r 70c8909970c3 -r e81e7ebf21d8 sys/dev/isapnp/if_levar.h
--- a/sys/dev/isapnp/if_levar.h Fri Oct 04 15:43:37 2002 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 */
-};
Home |
Main Index |
Thread Index |
Old Index