Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arc/jazz Remove old homegrown sonic driver since no...



details:   https://anonhg.NetBSD.org/src/rev/80b07e87eb0c
branches:  trunk
changeset: 513079:80b07e87eb0c
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Jul 23 16:40:32 2001 +0000

description:
Remove old homegrown sonic driver since now we have switched to
the MI one.

diffstat:

 sys/arch/arc/jazz/if_sn.c    |  1286 ------------------------------------------
 sys/arch/arc/jazz/if_snreg.h |   349 -----------
 2 files changed, 0 insertions(+), 1635 deletions(-)

diffs (truncated from 1643 to 300 lines):

diff -r 7dc43dbea80a -r 80b07e87eb0c sys/arch/arc/jazz/if_sn.c
--- a/sys/arch/arc/jazz/if_sn.c Mon Jul 23 16:36:37 2001 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1286 +0,0 @@
-/*     $NetBSD: if_sn.c,v 1.4 2001/06/19 12:59:14 wiz Exp $    */
-/*     $OpenBSD: if_sn.c,v 1.12 1999/05/13 15:44:48 jason Exp $        */
-
-/*
- * National Semiconductor  SONIC Driver
- * Copyright (c) 1991   Algorithmics Ltd (http://www.algor.co.uk)
- * You may use, copy, and modify this program so long as you retain the
- * copyright line.
- *
- * This driver has been substantially modified since Algorithmics donated
- * it.
- */
-
-#include "opt_inet.h"
-#include "opt_ns.h"
-#include "bpfilter.h"
-#include "rnd.h"
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-#include <sys/kcore.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_ether.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_inarp.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#if NRND > 0
-#include <sys/rnd.h>
-#endif
-
-
-#include <machine/cpu.h>
-#include <machine/bus.h>
-
-#include <mips/locore.h> /* for mips3_HitFlushDCache() */
-
-#include <arc/arc/arcbios.h>   /* arc_product_id */
-#include <arc/jazz/jazziovar.h>
-#include <arc/jazz/jazzdmatlbreg.h>
-#include <arc/jazz/dma.h>
-
-#define SONICDW 32
-#include <arc/jazz/if_snreg.h>
-
-#define SWR(a, x)      (a) = (x)
-#define SRD(a)         ((a) & 0xffff)
-
-/*
- * Statistics collected over time
- */
-struct sn_stats {
-       int     ls_opacks;      /* packets transmitted */
-       int     ls_ipacks;      /* packets received */
-       int     ls_tdr;         /* contents of tdr after collision */
-       int     ls_tdef;        /* packets where had to wait */
-       int     ls_tone;        /* packets with one retry */
-       int     ls_tmore;       /* packets with more than one retry */
-       int     ls_tbuff;       /* transmit buff errors */
-       int     ls_tuflo;       /* "      uflo  "     */
-       int     ls_tlcol;
-       int     ls_tlcar;
-       int     ls_trtry;
-       int     ls_rbuff;       /* receive buff errors */
-       int     ls_rfram;       /* framing     */
-       int     ls_roflo;       /* overflow    */
-       int     ls_rcrc;
-       int     ls_rrng;        /* rx ring sequence error */
-       int     ls_babl;        /* chip babl error */
-       int     ls_cerr;        /* collision error */
-       int     ls_miss;        /* missed packet */
-       int     ls_merr;        /* memory error */
-       int     ls_copies;      /* copies due to out of range mbufs */
-       int     ls_maxmbufs;    /* max mbufs on transmit */
-       int     ls_maxslots;    /* max ring slots on transmit */
-};
-
-struct sn_softc {
-       struct  device sc_dev;
-       struct  ethercom sc_ec;
-#define        sc_if           sc_ec.ec_if     /* network visible interface */
-
-       struct sonic_reg *sc_csr;       /* hardware pointer */
-       dma_softc_t     __dma;          /* stupid macro ... */
-       dma_softc_t     *dma;           /* dma mapper control */
-       int     sc_rxmark;              /* position in rx ring for reading buffs */
-
-       int     sc_rramark;             /* index into rra of wp */
-
-       int     sc_txhead;              /* index of first TDA passed to chip  */
-       int     sc_missed;              /* missed packet counter */
-       struct  RXpkt *sc_lrxp;         /* last RDA available to chip */
-       struct  sn_stats sc_sum;
-       short   sc_iflags;
-
-#if NRND > 0
-       rndsource_element_t rnd_source; /* random source */
-#endif
-} sn_softc;
-
-int snmatch __P((struct device *, struct cfdata *, void *));
-void snattach __P((struct device *, struct device *, void *));
-
-struct cfattach sn_ca = {
-       sizeof(struct sn_softc), snmatch, snattach
-};
-
-#undef assert
-#undef _assert
-
-#ifdef NDEBUG
-#define        assert(e)       ((void)0)
-#define        _assert(e)      ((void)0)
-#else
-#define        _assert(e)      assert(e)
-#ifdef __STDC__
-#define        assert(e)       ((e) ? (void)0 : __assert("sn ", __FILE__, __LINE__, #e))
-#else  /* PCC */
-#define        assert(e)       ((e) ? (void)0 : __assert("sn "__FILE__, __LINE__, "e"))
-#endif
-#endif
-
-int ethdebug = 0;
-
-int snintr __P((struct sn_softc *));
-int snioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-void snstart __P((struct ifnet *ifp));
-void snwatchdog __P((struct ifnet *ifp));
-void snreset __P((struct sn_softc *sc));
-
-/*
- * SONIC buffers need to be aligned 16 or 32 bit aligned.
- * These macros calculate and verify alignment.
- */
-#if SONICDW == 32
-#define SONICALIGN 4
-#else
-#define SONICALIGN 2
-#endif
-#define SOALIGN(array) (((int)array+SONICALIGN-1) & ~(SONICALIGN-1))
-#define SOALIGNED(p) (!(((uint)p)&(SONICALIGN-1)))
-
-#define UPPER(x) ((unsigned)(x) >> 16)
-#define LOWER(x) ((unsigned)(x) & 0xffff)
-
-#define NRRA   32              /* # receive resource descriptors */
-#define RRAMASK        0x1f            /* why it must be poer of two */
-
-#define NRBA   16              /* # receive buffers < NRRA */
-#define NRDA   NRBA            /* # receive descriptors */
-#define NTDA   4               /* # transmit descriptors */
-
-#define CDASIZE sizeof(struct CDA)
-#define RRASIZE (NRRA*sizeof(struct RXrsrc))
-#define RDASIZE (NRDA*sizeof(struct RXpkt))
-#define TDASIZE (NTDA*sizeof(struct TXpkt))
-
-#define FCSSIZE        4               /* size of FCS append te received packets */
-
-/*
- * maximum receive packet size plus 2 byte pad to make each
- * one aligned. 4 byte slop (required for eobc)
- */
-#define RBASIZE        (sizeof(struct ether_header) + ETHERMTU + FCSSIZE + 2 + 4)
-
-/*
- * space requiered for descriptors
- */
-#define DESC_SIZE (RRASIZE + CDASIZE + RDASIZE + TDASIZE + SONICALIGN - 1)
-
-/*
- *  This should really be 'allocated' but for now we
- *  'hardwire' it.
- */
-#define SONICBUF       0xa0190000
-
-/*
- *  Nicely aligned pointers into the sonicbuffers
- *  p_ points at physical (K1_SEG) addresses.
- *  v_ is dma viritual address used by sonic.
- */
-struct RXrsrc  *p_rra; /* receiver resource descriptors */
-struct RXrsrc  *v_rra;
-struct RXpkt   *p_rda; /* receiver desriptors */
-struct RXpkt   *v_rda;
-struct TXpkt   *p_tda; /* transmitter descriptors */
-struct TXpkt   *v_tda;
-struct CDA     *p_cda; /* CAM descriptors */
-struct CDA     *v_cda;
-char           *p_rba; /* receive buffer area base */
-char           *v_rba;
-
-/* Meta transmit descriptors */
-struct mtd {
-       struct  mtd *mtd_link;
-       struct  TXpkt *mtd_txp;
-       struct  mbuf *mtd_mbuf;
-} mtda[NTDA];
-
-struct mtd *mtdfree;           /* list of free meta transmit descriptors */
-struct mtd *mtdhead;           /* head of descriptors assigned to chip */
-struct mtd *mtdtail;           /* tail of descriptors assigned to chip */
-struct mtd *mtdnext;           /* next descriptor to give to chip */
-
-void mtd_free __P((struct mtd *));
-struct mtd *mtd_alloc __P((void));
-
-int sngetaddr __P((struct sn_softc *sc, u_int8_t *ap));
-int sninit __P((struct sn_softc *sc));
-int snstop __P((struct sn_softc *sc));
-int sonicput __P((struct sn_softc *sc, struct mbuf *m0));
-
-void camdump __P((struct sn_softc *sc));
-
-int
-snmatch(parent, match, aux)
-       struct device *parent;
-       struct cfdata *match;
-       void *aux;
-{
-       struct jazzio_attach_args *ja = aux;
-
-       /* make sure that we're looking for this type of device. */
-       if (strcmp(ja->ja_name, "sonic") != 0)
-               return (0);
-
-       return (1);
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record.  System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-snattach(parent, self, aux)
-       struct device *parent, *self;
-       void   *aux;
-{
-       struct sn_softc *sc = (void *)self;
-       struct jazzio_attach_args *ja = aux;
-       struct ifnet *ifp = &sc->sc_if;
-       int p, pp;
-       u_int8_t myaddr[ETHER_ADDR_LEN];
-
-       sc->sc_csr = (struct sonic_reg *)ja->ja_addr;   /* XXX */
-
-       sc->dma = &sc->__dma;
-       sn_dma_init(sc->dma, FRAGMAX * NTDA
-                          + (NRBA * RBASIZE / JAZZ_DMA_PAGE_SIZE) + 1
-                          + (DESC_SIZE * 2 / JAZZ_DMA_PAGE_SIZE) + 1);
-
-/*
- * because the sonic is basicly 16bit device it 'concatenates'
- * a higher buffer address to a 16 bit offset this will cause wrap
- * around problems near the end of 64k !!
- */
-       p = SONICBUF;
-       pp = SONICBUF - (FRAGMAX * NTDA * JAZZ_DMA_PAGE_SIZE);
-
-       if ((p ^ (p + TDASIZE)) & 0x10000)
-               p = (p + 0x10000) & ~0xffff;
-       p_tda = (struct TXpkt *) p;
-       v_tda = (struct TXpkt *)(p - pp + sc->dma->dma_va);



Home | Main Index | Thread Index | Old Index