Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Intel i82557 driver is now split into bus and ch...



details:   https://anonhg.NetBSD.org/src/rev/d734305eab26
branches:  trunk
changeset: 473876:d734305eab26
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 20 16:35:40 1999 +0000

description:
Intel i82557 driver is now split into bus and chip bits.

diffstat:

 sys/dev/pci/files.pci    |     7 +-
 sys/dev/pci/if_fxp.c     |  1830 ----------------------------------------------
 sys/dev/pci/if_fxp_pci.c |   224 +++++
 sys/dev/pci/if_fxpreg.h  |   398 ----------
 sys/dev/pci/if_fxpvar.h  |   194 ----
 5 files changed, 227 insertions(+), 2426 deletions(-)

diffs (truncated from 2683 to 300 lines):

diff -r e9717f8012f9 -r d734305eab26 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Sun Jun 20 16:34:38 1999 +0000
+++ b/sys/dev/pci/files.pci     Sun Jun 20 16:35:40 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.55 1999/06/01 18:29:50 thorpej Exp $
+#      $NetBSD: files.pci,v 1.56 1999/06/20 16:35:40 thorpej Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -98,9 +98,8 @@
 file   dev/pci/cy_pci.c                cy_pci
 
 # Intel EtherExpress PRO 10/100B
-device fxp: ether, ifnet, arp, mii
-attach fxp at pci 
-file   dev/pci/if_fxp.c                fxp
+attach fxp at pci with fxp_pci
+file   dev/pci/if_fxp_pci.c            fxp_pci
 
 # NE2000-compatible PCI Ethernet cards
 attach ne at pci with ne_pci: rtl80x9
diff -r e9717f8012f9 -r d734305eab26 sys/dev/pci/if_fxp.c
--- a/sys/dev/pci/if_fxp.c      Sun Jun 20 16:34:38 1999 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1830 +0,0 @@
-/*     $NetBSD: if_fxp.c,v 1.34 1999/05/18 23:52:58 thorpej Exp $      */
-
-/*-
- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * 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.
- */
-
-/*
- * Copyright (c) 1995, David Greenman
- * All rights reserved.
- *
- * 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 unmodified, 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *     Id: if_fxp.c,v 1.47 1998/01/08 23:42:29 eivind Exp
- */
-
-/*
- * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
- */
-
-#include "opt_inet.h"
-#include "opt_ns.h"
-#include "bpfilter.h"
-#include "rnd.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-
-#if NRND > 0
-#include <sys/rnd.h>
-#endif
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_ether.h>
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#endif
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_inarp.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <dev/mii/miivar.h>
-
-#include <dev/pci/if_fxpreg.h>
-#include <dev/pci/if_fxpvar.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcidevs.h>
-
-/*
- * NOTE!  On the Alpha, we have an alignment constraint.  The
- * card DMAs the packet immediately following the RFA.  However,
- * the first thing in the packet is a 14-byte Ethernet header.
- * This means that the packet is misaligned.  To compensate,
- * we actually offset the RFA 2 bytes into the cluster.  This
- * alignes the packet after the Ethernet header at a 32-bit
- * boundary.  HOWEVER!  This means that the RFA is misaligned!
- */
-#define        RFA_ALIGNMENT_FUDGE     2
-
-/*
- * Template for default configuration parameters.
- * See struct fxp_cb_config for the bit definitions.
- */
-static u_int8_t fxp_cb_config_template[] = {
-       0x0, 0x0,               /* cb_status */
-       0x80, 0x2,              /* cb_command */
-       0xff, 0xff, 0xff, 0xff, /* link_addr */
-       0x16,   /*  0 */
-       0x8,    /*  1 */
-       0x0,    /*  2 */
-       0x0,    /*  3 */
-       0x0,    /*  4 */
-       0x80,   /*  5 */
-       0xb2,   /*  6 */
-       0x3,    /*  7 */
-       0x1,    /*  8 */
-       0x0,    /*  9 */
-       0x26,   /* 10 */
-       0x0,    /* 11 */
-       0x60,   /* 12 */
-       0x0,    /* 13 */
-       0xf2,   /* 14 */
-       0x48,   /* 15 */
-       0x0,    /* 16 */
-       0x40,   /* 17 */
-       0xf3,   /* 18 */
-       0x0,    /* 19 */
-       0x3f,   /* 20 */
-       0x5     /* 21 */
-};
-
-static void fxp_mii_initmedia __P((struct fxp_softc *));
-static int fxp_mii_mediachange __P((struct ifnet *));
-static void fxp_mii_mediastatus        __P((struct ifnet *, struct ifmediareq *));
-
-static void fxp_80c24_initmedia __P((struct fxp_softc *));
-static int fxp_80c24_mediachange __P((struct ifnet *));
-static void fxp_80c24_mediastatus __P((struct ifnet *, struct ifmediareq *));
-
-static inline void fxp_scb_wait        __P((struct fxp_softc *));
-static int fxp_intr            __P((void *));
-static void fxp_start          __P((struct ifnet *));
-static int fxp_ioctl           __P((struct ifnet *, u_long, caddr_t));
-static void fxp_init           __P((void *));
-static void fxp_stop           __P((struct fxp_softc *));
-static void fxp_watchdog       __P((struct ifnet *));
-static int fxp_add_rfabuf      __P((struct fxp_softc *, struct fxp_rxdesc *));
-static int fxp_mdi_read                __P((struct device *, int, int));
-static void fxp_statchg                __P((struct device *));
-static void fxp_mdi_write      __P((struct device *, int, int, int));
-static void fxp_read_eeprom    __P((struct fxp_softc *, u_int16_t *,
-                                   int, int));
-static void fxp_get_info       __P((struct fxp_softc *, u_int8_t *));
-void fxp_tick                  __P((void *));
-static void fxp_mc_setup       __P((struct fxp_softc *));
-
-struct fxp_phytype {
-       int     fp_phy;         /* type of PHY, -1 for MII at the end. */
-       void    (*fp_init) __P((struct fxp_softc *));
-} fxp_phytype_table[] = {
-       { FXP_PHY_80C24,                fxp_80c24_initmedia },
-       { -1,                           fxp_mii_initmedia },
-};
-
-/*
- * Set initial transmit threshold at 64 (512 bytes). This is
- * increased by 64 (512 bytes) at a time, to maximum of 192
- * (1536 bytes), if an underrun occurs.
- */
-static int tx_threshold = 64;
-
-/*
- * Wait for the previous command to be accepted (but not necessarily
- * completed).
- */
-static inline void
-fxp_scb_wait(sc)
-       struct fxp_softc *sc;
-{
-       int i = 10000;
-
-       while (CSR_READ_1(sc, FXP_CSR_SCB_COMMAND) && --i)
-               DELAY(1);
-       if (i == 0)
-               printf("%s: WARNING: SCB timed out!\n", sc->sc_dev.dv_xname);
-}
-
-static int fxp_match __P((struct device *, struct cfdata *, void *));
-static void fxp_attach __P((struct device *, struct device *, void *));
-
-static void    fxp_shutdown __P((void *));
-
-struct cfattach fxp_ca = {
-       sizeof(struct fxp_softc), fxp_match, fxp_attach
-};
-
-/*
- * Check if a device is an 82557.
- */
-static int
-fxp_match(parent, match, aux)
-       struct device *parent;
-       struct cfdata *match;
-       void *aux;
-{
-       struct pci_attach_args *pa = aux;
-
-       if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL)
-               return (0);
-
-       switch (PCI_PRODUCT(pa->pa_id)) {
-       case PCI_PRODUCT_INTEL_82557:
-               return (1);
-       }
-
-       return (0);
-}
-
-static void
-fxp_attach(parent, self, aux)
-       struct device *parent, *self;
-       void *aux;
-{
-       struct fxp_softc *sc = (struct fxp_softc *)self;
-       struct pci_attach_args *pa = aux;
-       pci_chipset_tag_t pc = pa->pa_pc;
-       pci_intr_handle_t ih;
-       const char *intrstr = NULL;
-       u_int8_t enaddr[6];
-       struct ifnet *ifp;
-       bus_space_tag_t iot, memt;
-       bus_space_handle_t ioh, memh;
-       bus_dma_segment_t seg;
-       int ioh_valid, memh_valid;
-       bus_addr_t addr;
-       bus_size_t size;
-       int flags, rseg, i, error, attach_stage;
-       struct fxp_phytype *fp;
-
-       /*
-        * Map control/status registers.



Home | Main Index | Thread Index | Old Index