OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Aaron Campbell (aaronmonkey.org)
Date: Sat Mar 17 2001 - 14:23:17 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    On Fri, 16 Mar 2001, George Nelson wrote:

    > I remember some talk about adding support for fa410 in current. Has this
    > been committed yet?

    No, but in the meantime, the following patch will do. However you still
    have to configure media on the card manually, i.e., ifconfig ne3 media
    10baseT.

    Index: sys/conf/files
    ===================================================================
    RCS file: /cvs/src/sys/conf/files,v
    retrieving revision 1.190
    diff -u -r1.190 files
    --- sys/conf/files 2001/03/11 02:48:19 1.190
    +++ sys/conf/files 2001/03/17 17:30:57
    -43,6 +43,7
     define pdq # DEC FDDI chipset
     define dp8390nic # 8390-family Ethernet controllers
     define rtl80x9 # RealTek 8019/8029 NE2000-compatible
    +define dl10019 # DL10019/10022-family Ethernet controllers
     
     # a wscons output device; used later, but needs to be near the top for
     # common file (e.g. vga) definitions.
    -177,8 +178,11
     
     # Novell NE2000-compatible Ethernet cards, based on the
     # National Semiconductor DS8390.
    -device ne: ether, ifnet, dp8390nic, ifmedia
    +device ne: ether, ifnet, dp8390nic, ifmedia, mii
     file dev/ic/ne2000.c ne
    +
    +# D-Link DL10019/10022 NE2000-compatible network interface subroutines
    +file dev/ic/dl10019.c dl10019
     
     # Intel i82596/i82586 Ethernet Controller
     device ie: ether, ifnet, ifmedia
    Index: sys/dev/ic/dl10019.c
    ===================================================================
    RCS file: dl10019.c
    diff -N dl10019.c
    --- /dev/null Sat Mar 17 10:08:56 2001
    +++ dl10019.c Sat Mar 17 10:30:58 2001
    -0,0 +1,261
    +/* $OpenBSD$ */
    +/* $NetBSD$ */
    +
    +/*-
    + * Copyright (c) 2001 The NetBSD Foundation, Inc.
    + * All rights reserved.
    + *
    + * This code is derived from software contributed to The NetBSD Foundation
    + * by Jason R. Thorpe.
    + *
    + * 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.
    + */
    +
    +#include <sys/param.h>
    +#include <sys/systm.h>
    +#include <sys/device.h>
    +#include <sys/mbuf.h>
    +#include <sys/socket.h>
    +#include <sys/syslog.h>
    +
    +#include <net/if.h>
    +#include <net/if_dl.h>
    +#include <net/if_types.h>
    +#include <net/if_media.h>
    +
    +#ifdef INET
    +#include <netinet/in.h>
    +#include <netinet/in_systm.h>
    +#include <netinet/in_var.h>
    +#include <netinet/ip.h>
    +#include <netinet/if_ether.h>
    +#endif
    +
    +#include <machine/bus.h>
    +#include <machine/intr.h>
    +
    +#include <dev/mii/miivar.h>
    +#include <dev/mii/mii.h>
    +#include <dev/mii/mii_bitbang.h>
    +
    +#include <dev/ic/dp8390reg.h>
    +#include <dev/ic/dp8390var.h>
    +
    +#include <dev/ic/ne2000reg.h>
    +#include <dev/ic/ne2000var.h>
    +
    +#include <dev/ic/dl10019reg.h>
    +#include <dev/ic/dl10019var.h>
    +
    +int dl10019_mii_readreg(struct device *, int, int);
    +void dl10019_mii_writereg(struct device *, int, int, int);
    +void dl10019_mii_statchg(struct device *);
    +
    +void dl10019_mii_reset(struct dp8390_softc *);
    +
    +/*
    + * MII bit-bang glue.
    + */
    +u_int32_t dl10019_mii_bitbang_read(struct device *);
    +void dl10019_mii_bitbang_write(struct device *, u_int32_t);
    +
    +const struct mii_bitbang_ops dl10019_mii_bitbang_ops = {
    + dl10019_mii_bitbang_read,
    + dl10019_mii_bitbang_write,
    + {
    + DL0_GPIO_MII_DATAOUT, /* MII_BIT_MDO */
    + DL0_GPIO_MII_DATAIN, /* MII_BIT_MDI */
    + DL0_GPIO_MII_CLK, /* MII_BIT_MDC */
    + DL0_19_GPIO_MII_DIROUT, /* MII_BIT_DIR_HOST_PHY */
    + 0, /* MII_BIT_DIR_PHY_HOST */
    + }
    +};
    +
    +const struct mii_bitbang_ops dl10022_mii_bitbang_ops = {
    + dl10019_mii_bitbang_read,
    + dl10019_mii_bitbang_write,
    + {
    + DL0_GPIO_MII_DATAOUT, /* MII_BIT_MDO */
    + DL0_GPIO_MII_DATAIN, /* MII_BIT_MDI */
    + DL0_GPIO_MII_CLK, /* MII_BIT_MDC */
    + DL0_22_GPIO_MII_DIROUT, /* MII_BIT_DIR_HOST_PHY */
    + 0, /* MII_BIT_DIR_PHY_HOST */
    + }
    +};
    +
    +void
    +dl10019_mii_reset(struct dp8390_softc *sc)
    +{
    + struct ne2000_softc *nsc = (void *) sc;
    +
    + if (nsc->sc_type != NE2000_TYPE_DL10022)
    + return;
    +
    + bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x08);
    + DELAY(1);
    + bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x0c);
    + DELAY(1);
    + bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x08);
    + DELAY(1);
    + bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x0c);
    + bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x00);
    +}
    +
    +void
    +dl10019_media_init(struct dp8390_softc *sc)
    +{
    + struct ifnet *ifp = &sc->sc_arpcom.ac_if;
    +
    + sc->sc_mii.mii_ifp = ifp;
    + sc->sc_mii.mii_readreg = dl10019_mii_readreg;
    + sc->sc_mii.mii_writereg = dl10019_mii_writereg;
    + sc->sc_mii.mii_statchg = dl10019_mii_statchg;
    + ifmedia_init(&sc->sc_mii.mii_media, 0, dp8390_mediachange,
    + dp8390_mediastatus);
    +
    + dl10019_mii_reset(sc);
    +
    + mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
    + MII_OFFSET_ANY, 0);
    +
    + if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
    + ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
    + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE);
    + } else
    + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
    +}
    +
    +void
    +dl10019_media_fini(struct dp8390_softc *sc)
    +{
    + mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
    +}
    +
    +int
    +dl10019_mediachange(struct dp8390_softc *sc)
    +{
    + mii_mediachg(&sc->sc_mii);
    + return (0);
    +}
    +
    +void
    +dl10019_mediastatus(struct dp8390_softc *sc, struct ifmediareq *ifmr)
    +{
    + mii_pollstat(&sc->sc_mii);
    + ifmr->ifm_status = sc->sc_mii.mii_media_status;
    + ifmr->ifm_active = sc->sc_mii.mii_media_active;
    +}
    +
    +void
    +dl10019_init_card(struct dp8390_softc *sc)
    +{
    + dl10019_mii_reset(sc);
    + mii_mediachg(&sc->sc_mii);
    +}
    +
    +void
    +dl10019_stop_card(struct dp8390_softc *sc)
    +{
    + mii_down(&sc->sc_mii);
    +}
    +
    +u_int32_t
    +dl10019_mii_bitbang_read(struct device *self)
    +{
    + struct dp8390_softc *sc = (void *) self;
    +
    + /* We're already in Page 0. */
    + return (bus_space_read_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO) &
    + ~DL0_GPIO_PRESERVE);
    +}
    +
    +void
    +dl10019_mii_bitbang_write(struct device *self, u_int32_t val)
    +{
    + struct dp8390_softc *sc = (void *) self;
    + u_int8_t gpio;
    +
    + /* We're already in Page 0. */
    + gpio = bus_space_read_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO);
    + bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO,
    + (val & ~DL0_GPIO_PRESERVE) | (gpio & DL0_GPIO_PRESERVE));
    +}
    +
    +int
    +dl10019_mii_readreg(struct device *self, int phy, int reg)
    +{
    + struct ne2000_softc *nsc = (void *) self;
    + int val;
    +
    + if (nsc->sc_type == NE2000_TYPE_DL10022) {
    + val = mii_bitbang_readreg(self, &dl10022_mii_bitbang_ops,
    + phy, reg);
    + } else {
    + val = mii_bitbang_readreg(self, &dl10019_mii_bitbang_ops,
    + phy, reg);
    + }
    +
    + return (val);
    +}
    +
    +void
    +dl10019_mii_writereg(struct device *self, int phy, int reg, int val)
    +{
    + struct ne2000_softc *nsc = (void *) self;
    +
    + if (nsc->sc_type == NE2000_TYPE_DL10022) {
    + mii_bitbang_writereg(self, &dl10022_mii_bitbang_ops,
    + phy, reg, val);
    + } else {
    + mii_bitbang_writereg(self, &dl10019_mii_bitbang_ops,
    + phy, reg, val);
    + }
    +}
    +
    +void
    +dl10019_mii_statchg(struct device *self)
    +{
    + struct dp8390_softc *sc = (void *) self;
    + struct ne2000_softc *nsc = (void *) self;
    +
    + /*
    + * Disable collision detection on the DL10022 if
    + * we are on a full-duplex link.
    + */
    + if (nsc->sc_type == NE2000_TYPE_DL10022) {
    + u_int8_t diag;
    +
    + if (sc->sc_mii.mii_media_active & IFM_FDX)
    + diag = DL0_DIAG_NOCOLLDETECT;
    + else
    + diag = 0;
    + bus_space_write_1(sc->sc_regt, sc->sc_regh,
    + NEDL_DL0_DIAG, diag);
    + }
    +}
    Index: sys/dev/ic/dl10019reg.h
    ===================================================================
    RCS file: dl10019reg.h
    diff -N dl10019reg.h
    --- /dev/null Sat Mar 17 10:08:56 2001
    +++ dl10019reg.h Sat Mar 17 10:30:58 2001
    -0,0 +1,64
    +/* $OpenBSD$ */
    +/* $NetBSD$ */
    +
    +/*-
    + * Copyright (c) 2001 The NetBSD Foundation, Inc.
    + * All rights reserved.
    + *
    + * This code is derived from software contributed to The NetBSD Foundation
    + * by Jason R. Thorpe.
    + *
    + * 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.
    + */
    +
    +/*
    + * Registers on D-Link DL10019 and DL10022 NE2000-compatible Ethernet
    + * chips.
    + */
    +
    +#ifndef _DEV_IC_DL10019_REG_H_
    +#define _DEV_IC_DL10019_REG_H_
    +
    +/*
    + * Page 0 register offsets.
    + */
    +#define NEDL_DL0_GPIO 0x1c /* general purpose I/O */
    +
    +#define DL0_GPIO_MII_CLK 0x80 /* MII clock */
    +#define DL0_GPIO_MII_DATAOUT 0x40 /* MII data MAC->PHY */
    +#define DL0_22_GPIO_MII_DIROUT 0x20 /* MII direction MAC->PHY */
    +#define DL0_19_GPIO_MII_DIROUT 0x10 /* MII direction MAC->PHY */
    +#define DL0_GPIO_MII_DATAIN 0x10 /* MII data PHY->MAC */
    +#define DL0_GPIO_PRESERVE 0x0f /* must preserve these bits! */
    +
    +#define NEDL_DL0_DIAG 0x1d /* diagnostics register */
    +
    +#define DL0_DIAG_NOCOLLDETECT 0x04 /* disable collision detection */
    +
    +#endif /* _DEV_IC_DL10019_REG_H_ */
    Index: sys/dev/ic/dl10019var.h
    ===================================================================
    RCS file: dl10019var.h
    diff -N dl10019var.h
    --- /dev/null Sat Mar 17 10:08:56 2001
    +++ dl10019var.h Sat Mar 17 10:30:58 2001
    -0,0 +1,58
    +/* $OpenBSD$ */
    +/* $NetBSD$ */
    +
    +/*-
    + * Copyright (c) 2001 The NetBSD Foundation, Inc.
    + * All rights reserved.
    + *
    + * This code is derived from software contributed to The NetBSD Foundation
    + * by Jason R. Thorpe.
    + *
    + * 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.
    + */
    +
    +/*
    + * Definitions on D-Link DL10019 and DL10022 NE2000-compatible Ethernet
    + * chips.
    + */
    +
    +#ifndef _DEV_IC_DL10019_VAR_H_
    +#define _DEV_IC_DL10019_VAR_H_
    +
    +#ifdef _KERNEL
    +void dl10019_media_init(struct dp8390_softc *);
    +void dl10019_media_fini(struct dp8390_softc *);
    +
    +int dl10019_mediachange(struct dp8390_softc *);
    +void dl10019_mediastatus(struct dp8390_softc *, struct ifmediareq *ifmr);
    +void dl10019_init_card(struct dp8390_softc *);
    +void dl10019_stop_card(struct dp8390_softc *);
    +#endif /* _KERNEL */
    +
    +#endif /* _DEV_IC_DL10019_VAR_H_ */
    Index: sys/dev/ic/dp8390var.h
    ===================================================================
    RCS file: /cvs/src/sys/dev/ic/dp8390var.h,v
    retrieving revision 1.4
    diff -u -r1.4 dp8390var.h
    --- sys/dev/ic/dp8390var.h 2001/03/12 05:36:58 1.4
    +++ sys/dev/ic/dp8390var.h 2001/03/17 17:30:58
    -14,6 +14,12
      * the author assume any responsibility for damages incurred with its use.
      */
     
    +/*
    + * We include MII glue here -- some DP8390 compatible chips have
    + * MII interfaces on them (scary, isn't it...).
    + */
    +#include <dev/mii/miivar.h>
    +
     #define INTERFACE_NAME_LEN 32
     
     /*
    -25,7 +31,8
             int sc_flags; /* interface flags, from config */
     
             struct arpcom sc_arpcom; /* ethernet common */
    - struct ifmedia sc_media; /* supported media information */
    + struct mii_data sc_mii; /* MII glue */
    +#define sc_media sc_mii.mii_media /* compatibility definition */
     
             bus_space_tag_t sc_regt; /* NIC register space tag */
             bus_space_handle_t sc_regh; /* NIC register space handle */
    Index: sys/dev/ic/ne2000.c
    ===================================================================
    RCS file: /cvs/src/sys/dev/ic/ne2000.c,v
    retrieving revision 1.10
    diff -u -r1.10 ne2000.c
    --- sys/dev/ic/ne2000.c 2001/03/13 06:02:00 1.10
    +++ sys/dev/ic/ne2000.c 2001/03/17 17:30:58
    -156,6 +156,7
             for (i = 0; i < 16; i++)
                     dsc->sc_reg_map[i] = i;
     
    +printf("nsc->sc_type = %d\n", nsc->sc_type);
             /*
              * 8k of memory for NE1000, 16k otherwise.
              */
    -166,6 +167,7
             case NE2000_TYPE_NE2000:
             case NE2000_TYPE_AX88190: /* XXX really? */
             case NE2000_TYPE_DL10019:
    + case NE2000_TYPE_DL10022:
                     memsize = 8192 * 2;
                     break;
             }
    Index: sys/dev/ic/ne2000var.h
    ===================================================================
    RCS file: /cvs/src/sys/dev/ic/ne2000var.h,v
    retrieving revision 1.5
    diff -u -r1.5 ne2000var.h
    --- sys/dev/ic/ne2000var.h 2001/03/12 05:36:58 1.5
    +++ sys/dev/ic/ne2000var.h 2001/03/17 17:30:58
    -54,11 +54,13
     #define NE2000_TYPE_NE1000 1
     #define NE2000_TYPE_NE2000 2
     #define NE2000_TYPE_DL10019 3
    -#define NE2000_TYPE_AX88190 4
    +#define NE2000_TYPE_DL10022 4
    +#define NE2000_TYPE_AX88190 5
     
     #define NE2000_USE_WORD(sc) \
             (((sc)->sc_type == NE2000_TYPE_NE2000) || \
             ((sc)->sc_type == NE2000_TYPE_DL10019) || \
    + ((sc)->sc_type == NE2000_TYPE_DL10022) || \
             ((sc)->sc_type == NE2000_TYPE_AX88190))
     
     int ne2000_attach __P((struct ne2000_softc *, u_int8_t *));
    Index: sys/dev/pcmcia/files.pcmcia
    ===================================================================
    RCS file: /cvs/src/sys/dev/pcmcia/files.pcmcia,v
    retrieving revision 1.33
    diff -u -r1.33 files.pcmcia
    --- sys/dev/pcmcia/files.pcmcia 2000/08/17 16:16:31 1.33
    +++ sys/dev/pcmcia/files.pcmcia 2001/03/17 17:30:59
    -19,7 +19,7
     
     # National Semiconductor DS8390/WD83C690-based boards
     # (NE[12]000, and clones)
    -attach ne at pcmcia with ne_pcmcia: rtl80x9
    +attach ne at pcmcia with ne_pcmcia: rtl80x9, dl10019, mii_bitbang
     file dev/pcmcia/if_ne_pcmcia.c ne_pcmcia
     
     # Adaptec APA-14[56]0 / NewMedia BusToaster SCSI Host Adapter
    Index: sys/dev/pcmcia/if_ne_pcmcia.c
    ===================================================================
    RCS file: /cvs/src/sys/dev/pcmcia/if_ne_pcmcia.c,v
    retrieving revision 1.37
    diff -u -r1.37 if_ne_pcmcia.c
    --- sys/dev/pcmcia/if_ne_pcmcia.c 2001/03/13 02:31:37 1.37
    +++ sys/dev/pcmcia/if_ne_pcmcia.c 2001/03/17 17:30:59
    -49,12 +49,18
     #include <dev/pcmcia/pcmciavar.h>
     #include <dev/pcmcia/pcmciadevs.h>
     
    +#include <dev/mii/miivar.h>
    +#include <dev/mii/mii_bitbang.h>
    +
     #include <dev/ic/dp8390reg.h>
     #include <dev/ic/dp8390var.h>
     
     #include <dev/ic/ne2000reg.h>
     #include <dev/ic/ne2000var.h>
     
    +#include <dev/ic/dl10019reg.h>
    +#include <dev/ic/dl10019var.h>
    +
     #include <dev/ic/rtl80x9reg.h>
     #include <dev/ic/rtl80x9var.h>
     
    -98,7 +104,7
         int enet_maddr;
         unsigned char enet_vendor[3];
         int flags;
    -#define NE2000DVF_DL10019 0x0001 /* chip is D-Link DL10019 */
    +#define NE2000DVF_DL10019 0x0001 /* chip is D-Link DL10019 */
     #define NE2000DVF_AX88190 0x0002 /* chip is ASIX AX88190 */
     } ne2000devs[] = {
         { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    -162,6 +168,10
           0, -1, { 0x00, 0x80, 0xc6 } },
     
         { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    + PCMCIA_CIS_NETGEAR_FA410TX,
    + 0, -1, { 0x00, 0xe0, 0x98 } },
    +
    + { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
           PCMCIA_CIS_TAMARACK_NE2000,
           0, -1, { 0x00, 0x47, 0x43 } },
     
    -609,6 +619,14
                     dsc->sc_media_init = rtl80x9_media_init;
             }
     
    + if (nsc->sc_type == NE2000_TYPE_DL10019 ||
    + nsc->sc_type == NE2000_TYPE_DL10022) {
    + dsc->sc_mediachange = dl10019_mediachange;
    + dsc->sc_mediastatus = dl10019_mediastatus;
    + dsc->init_card = dl10019_init_card;
    + dsc->sc_media_init = dl10019_media_init;
    + }
    +
             /* set up the interrupt */
             psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, dp8390_intr,
                 dsc);
    -775,17 +793,27
     {
             struct ne2000_softc *nsc = &psc->sc_ne2000;
             u_int8_t sum;
    - int j;
    + int j, type;
     
    - for (j = 0, sum = 0; j < 8; j++)
    + for (j = 0, sum = 0; j < 8; j++) {
                     sum += bus_space_read_1(nsc->sc_asict, nsc->sc_asich,
                         0x04 + j);
    + }
             if (sum != 0xff)
                     return (NULL);
    - for (j = 0; j < ETHER_ADDR_LEN; j++)
    +
    + for (j = 0; j < ETHER_ADDR_LEN; j++) {
                     myea[j] = bus_space_read_1(nsc->sc_asict,
                         nsc->sc_asich, 0x04 + j);
    - nsc->sc_type = NE2000_TYPE_DL10019;
    + }
    +
    + /* XXX - magic values from Linux */
    + type = bus_space_read_1(nsc->sc_asict, nsc->sc_asich, 0x0f);
    + if (type == 0x91 || type == 0x99)
    + nsc->sc_type = NE2000_TYPE_DL10022;
    + else
    + nsc->sc_type = NE2000_TYPE_DL10019;
    +
             return (myea);
     }
     
    Index: sys/dev/pcmcia/pcmciadevs
    ===================================================================
    RCS file: /cvs/src/sys/dev/pcmcia/pcmciadevs,v
    retrieving revision 1.49
    diff -u -r1.49 pcmciadevs
    --- sys/dev/pcmcia/pcmciadevs 2001/03/13 06:44:03 1.49
    +++ sys/dev/pcmcia/pcmciadevs 2001/03/17 17:30:59
    -333,3 +333,4
     product ZOOM AIR4000 { "Zoom", "Air-4000", NULL, NULL }
     product TAMARACK NE2000 { "TAMARACK", "Ethernet", NULL, NULL }
     product SARAMNCOM NS_1100M { "NANOSPEED", "HFA384x/IEEE", NULL, NULL }
    +product NETGEAR FA410TX { "NETGEAR", "FA410TX", "Fast&spEthernet", NULL}
    Index: sys/dev/pcmcia/pcmciadevs.h
    ===================================================================
    RCS file: /cvs/src/sys/dev/pcmcia/pcmciadevs.h,v
    retrieving revision 1.54
    diff -u -r1.54 pcmciadevs.h
    --- sys/dev/pcmcia/pcmciadevs.h 2001/03/13 06:45:36 1.54
    +++ sys/dev/pcmcia/pcmciadevs.h 2001/03/17 17:30:59
    -1,4 +1,4
    -/* $OpenBSD: pcmciadevs.h,v 1.54 2001/03/13 06:45:36 mickey Exp $ */
    +/* $OpenBSD$ */
     
     /*
      * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
    -474,3 +474,5
     #define PCMCIA_PRODUCT_TAMARACK_NE2000 PCMCIA_PRODUCT_INVALID
     #define PCMCIA_CIS_SARAMNCOM_NS_1100M { "NANOSPEED", "HFA384x/IEEE", NULL, NULL }
     #define PCMCIA_PRODUCT_SARAMNCOM_NS_1100M PCMCIA_PRODUCT_INVALID
    +#define PCMCIA_CIS_NETGEAR_FA410TX { "NETGEAR", "FA410TX", "Fast Ethernet", NULL}
    +#define PCMCIA_PRODUCT_NETGEAR_FA410TX PCMCIA_PRODUCT_INVALID