From a06ec9b134371326423e7de42efca710ca11e017 Mon Sep 17 00:00:00 2001 From: niklas Date: Thu, 9 May 1996 22:42:53 +0000 Subject: [PATCH] From NetBSD: Make the MI LANCE driver standalone, and use cfattach to resolve naming conflicts between bus attachments on ports that can have multiple instances of the LANCE. --- sys/arch/amiga/conf/files.amiga | 6 ++-- sys/arch/amiga/dev/if_le.c | 62 ++++++++++++++------------------- sys/arch/amiga/dev/if_le_zbus.c | 62 ++++++++++++++------------------- 3 files changed, 57 insertions(+), 73 deletions(-) diff --git a/sys/arch/amiga/conf/files.amiga b/sys/arch/amiga/conf/files.amiga index 7bf5f71a63e..0d3bfe2f193 100644 --- a/sys/arch/amiga/conf/files.amiga +++ b/sys/arch/amiga/conf/files.amiga @@ -1,5 +1,5 @@ -# $OpenBSD: files.amiga,v 1.12 1996/05/02 07:31:53 niklas Exp $ -# $NetBSD: files.amiga,v 1.44 1996/04/27 20:51:08 veego Exp $ +# $OpenBSD: files.amiga,v 1.13 1996/05/09 22:42:53 niklas Exp $ +# $NetBSD: files.amiga,v 1.45 1996/05/07 00:34:17 thorpej Exp $ # maxpartitions must be first item in files.${ARCH} maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! @@ -115,7 +115,7 @@ device gvpbus {} attach gvpbus at zbus file arch/amiga/dev/gvpbus.c gvpbus -device le: ifnet, ether +# device defined in sys/conf/files attach le at zbus with le_zbus file arch/amiga/dev/if_le.c le_zbus needs-flag diff --git a/sys/arch/amiga/dev/if_le.c b/sys/arch/amiga/dev/if_le.c index 39316f21869..7aaa51848be 100644 --- a/sys/arch/amiga/dev/if_le.c +++ b/sys/arch/amiga/dev/if_le.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_le.c,v 1.4 1996/05/02 06:44:06 niklas Exp $ */ -/* $NetBSD: if_le.c,v 1.20 1996/04/22 02:33:08 christos Exp $ */ +/* $OpenBSD: if_le.c,v 1.5 1996/05/09 22:43:24 niklas Exp $ */ +/* $NetBSD: if_le.c,v 1.21 1996/05/07 00:35:07 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -61,53 +61,43 @@ #include #include -#include -#include + #include -#define LE_NEED_BUF_CONTIG #include +#include +#include + /* offsets for: ID, REGS, MEM */ int lestd[] = { 0, 0x4000, 0x8000 }; -#define LE_SOFTC(unit) le_cd.cd_devs[unit] -#define LE_DELAY(x) DELAY(x) - int le_zbus_match __P((struct device *, void *, void *)); void le_zbus_attach __P((struct device *, struct device *, void *)); -int leintr __P((void *)); struct cfattach le_zbus_ca = { sizeof(struct le_softc), le_zbus_match, le_zbus_attach }; -struct cfdriver le_cd = { - NULL, "le", DV_IFNET -}; - -integrate void -lehwinit(sc) - struct le_softc *sc; -{ -} +hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t)); +hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t)); -integrate void +hide void lewrcsr(sc, port, val) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port, val; { - struct lereg1 *ler1 = sc->sc_r1; + struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; ler1->ler1_rap = port; ler1->ler1_rdp = val; } -integrate u_int16_t +hide u_int16_t lerdcsr(sc, port) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port; { - struct lereg1 *ler1 = sc->sc_r1; + struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; u_int16_t val; ler1->ler1_rap = port; @@ -138,11 +128,12 @@ le_zbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct le_softc *sc = (void *)self; + struct le_softc *lesc = (struct le_softc *)self; + struct am7990_softc *sc = &lesc->sc_am7990; struct zbus_args *zap = aux; u_long ser; - sc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va); + lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va); sc->sc_mem = (void *)(lestd[2] + (int)zap->va); sc->sc_copytodesc = am7990_copytobuf_contig; @@ -151,6 +142,10 @@ le_zbus_attach(parent, self, aux) sc->sc_copyfrombuf = am7990_copyfrombuf_contig; sc->sc_zerobuf = am7990_zerobuf_contig; + sc->sc_rdcsr = lerdcsr; + sc->sc_wrcsr = lewrcsr; + sc->sc_hwinit = NULL; + sc->sc_conf3 = LE_C3_BSWP; sc->sc_addr = 0x8000; @@ -175,7 +170,7 @@ le_zbus_attach(parent, self, aux) break; default: - panic("leattach: bad manid"); + panic("le_zbus_attach: bad manid"); } /* @@ -186,13 +181,10 @@ le_zbus_attach(parent, self, aux) sc->sc_arpcom.ac_enaddr[4] = (ser >> 8) & 0xff; sc->sc_arpcom.ac_enaddr[5] = (ser ) & 0xff; - sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; - leconfig(sc); + am7990_config(sc); - sc->sc_isr.isr_intr = leintr; - sc->sc_isr.isr_arg = sc; - sc->sc_isr.isr_ipl = 2; - add_isr(&sc->sc_isr); + lesc->sc_isr.isr_intr = am7990_intr; + lesc->sc_isr.isr_arg = sc; + lesc->sc_isr.isr_ipl = 2; + add_isr(&lesc->sc_isr); } - -#include diff --git a/sys/arch/amiga/dev/if_le_zbus.c b/sys/arch/amiga/dev/if_le_zbus.c index 8d65f391e63..97dc943520d 100644 --- a/sys/arch/amiga/dev/if_le_zbus.c +++ b/sys/arch/amiga/dev/if_le_zbus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_le_zbus.c,v 1.4 1996/05/02 06:44:06 niklas Exp $ */ -/* $NetBSD: if_le.c,v 1.20 1996/04/22 02:33:08 christos Exp $ */ +/* $OpenBSD: if_le_zbus.c,v 1.5 1996/05/09 22:43:24 niklas Exp $ */ +/* $NetBSD: if_le.c,v 1.21 1996/05/07 00:35:07 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -61,53 +61,43 @@ #include #include -#include -#include + #include -#define LE_NEED_BUF_CONTIG #include +#include +#include + /* offsets for: ID, REGS, MEM */ int lestd[] = { 0, 0x4000, 0x8000 }; -#define LE_SOFTC(unit) le_cd.cd_devs[unit] -#define LE_DELAY(x) DELAY(x) - int le_zbus_match __P((struct device *, void *, void *)); void le_zbus_attach __P((struct device *, struct device *, void *)); -int leintr __P((void *)); struct cfattach le_zbus_ca = { sizeof(struct le_softc), le_zbus_match, le_zbus_attach }; -struct cfdriver le_cd = { - NULL, "le", DV_IFNET -}; - -integrate void -lehwinit(sc) - struct le_softc *sc; -{ -} +hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t)); +hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t)); -integrate void +hide void lewrcsr(sc, port, val) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port, val; { - struct lereg1 *ler1 = sc->sc_r1; + struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; ler1->ler1_rap = port; ler1->ler1_rdp = val; } -integrate u_int16_t +hide u_int16_t lerdcsr(sc, port) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port; { - struct lereg1 *ler1 = sc->sc_r1; + struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; u_int16_t val; ler1->ler1_rap = port; @@ -138,11 +128,12 @@ le_zbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct le_softc *sc = (void *)self; + struct le_softc *lesc = (struct le_softc *)self; + struct am7990_softc *sc = &lesc->sc_am7990; struct zbus_args *zap = aux; u_long ser; - sc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va); + lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va); sc->sc_mem = (void *)(lestd[2] + (int)zap->va); sc->sc_copytodesc = am7990_copytobuf_contig; @@ -151,6 +142,10 @@ le_zbus_attach(parent, self, aux) sc->sc_copyfrombuf = am7990_copyfrombuf_contig; sc->sc_zerobuf = am7990_zerobuf_contig; + sc->sc_rdcsr = lerdcsr; + sc->sc_wrcsr = lewrcsr; + sc->sc_hwinit = NULL; + sc->sc_conf3 = LE_C3_BSWP; sc->sc_addr = 0x8000; @@ -175,7 +170,7 @@ le_zbus_attach(parent, self, aux) break; default: - panic("leattach: bad manid"); + panic("le_zbus_attach: bad manid"); } /* @@ -186,13 +181,10 @@ le_zbus_attach(parent, self, aux) sc->sc_arpcom.ac_enaddr[4] = (ser >> 8) & 0xff; sc->sc_arpcom.ac_enaddr[5] = (ser ) & 0xff; - sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; - leconfig(sc); + am7990_config(sc); - sc->sc_isr.isr_intr = leintr; - sc->sc_isr.isr_arg = sc; - sc->sc_isr.isr_ipl = 2; - add_isr(&sc->sc_isr); + lesc->sc_isr.isr_intr = am7990_intr; + lesc->sc_isr.isr_arg = sc; + lesc->sc_isr.isr_ipl = 2; + add_isr(&lesc->sc_isr); } - -#include -- 2.20.1