Source-Changes-HG archive

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

[src/netbsd-6]: src/sys Pull up following revision(s) (requested by phx in ti...



details:   https://anonhg.NetBSD.org/src/rev/73fa0578cdaf
branches:  netbsd-6
changeset: 775481:73fa0578cdaf
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Nov 22 00:27:54 2012 +0000

description:
Pull up following revision(s) (requested by phx in ticket #681):
        sys/arch/amiga/dev/if_edreg.h: file removal
        sys/dev/ic/dp8390reg.h: revision 1.9
        sys/arch/amiga/conf/files.amiga: revision 1.161
        sys/arch/amiga/dev/if_ed_zbus.c: revision 1.1
        sys/arch/amiga/dev/if_ed_zbus.c: revision 1.2
        sys/arch/amiga/dev/if_ed.c: file removal
New ed(4) device driver for Hydra and ASDG Zorro2 bus network cards.
This driver is based on the MI dp8390 backend.
Fixed receiving of odd-length packets. Driver works now perfectly.
Thanks to Harald Meinzer for providing me with a Hydra for a few days.
ed_ring structure is no longer needed for compatibility, as the last
device driver using it (amiga/ed(4)) has been converted now.

diffstat:

 sys/arch/amiga/conf/files.amiga |     6 +-
 sys/arch/amiga/dev/if_ed.c      |  1212 ---------------------------------------
 sys/arch/amiga/dev/if_ed_zbus.c |   343 +++++++++++
 sys/arch/amiga/dev/if_edreg.h   |    43 -
 sys/dev/ic/dp8390reg.h          |    17 +-
 5 files changed, 347 insertions(+), 1274 deletions(-)

diffs (truncated from 1661 to 300 lines):

diff -r 9f77e8160a00 -r 73fa0578cdaf sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga   Thu Nov 22 00:23:35 2012 +0000
+++ b/sys/arch/amiga/conf/files.amiga   Thu Nov 22 00:27:54 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amiga,v 1.154.2.1 2012/11/22 00:23:35 riz Exp $
+#      $NetBSD: files.amiga,v 1.154.2.2 2012/11/22 00:27:54 riz Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16                       # NOTE THAT AMIGA IS SPECIAL!
@@ -221,8 +221,8 @@
 
 # Hydra ethernet card
 device ed: ifnet, ether, arp
-attach ed at zbus with ed_zbus
-file   arch/amiga/dev/if_ed.c          ed_zbus needs-flag
+attach ed at zbus with ed_zbus: dp8390nic
+file   arch/amiga/dev/if_ed_zbus.c     ed_zbus needs-flag
 
 # C=/Ameristar A2060 / 560
 attach bah at zbus with bah_zbus
diff -r 9f77e8160a00 -r 73fa0578cdaf sys/arch/amiga/dev/if_ed.c
--- a/sys/arch/amiga/dev/if_ed.c        Thu Nov 22 00:23:35 2012 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1212 +0,0 @@
-/*     $NetBSD: if_ed.c,v 1.62 2010/04/05 07:19:29 joerg Exp $ */
-
-/*
- * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
- * adapters.
- *
- * Copyright (c) 1994, 1995 Charles M. Hannum.  All rights reserved.
- *
- * Copyright (C) 1993, David Greenman.  This software may be used, modified,
- * copied, distributed, and sold, in both source and binary form provided that
- * the above copyright and these terms are retained.  Under no circumstances is
- * the author responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with its use.
- *
- * Currently supports the Hydra Systems ethernet card.
- */
-
-#include "opt_inet.h"
-#include "opt_ns.h"
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ed.c,v 1.62 2010/04/05 07:19:29 joerg Exp $");
-
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-#include <net/if_ether.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
-
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-
-#include <machine/cpu.h>
-
-#include <amiga/amiga/device.h>
-#include <amiga/amiga/isr.h>
-#include <amiga/dev/zbusvar.h>
-#include <dev/ic/dp8390reg.h>
-#include <amiga/dev/if_edreg.h>
-
-#define HYDRA_MANID    2121
-#define HYDRA_PRODID   1
-
-#define ASDG_MANID     1023
-#define ASDG_PRODID    254
-
-/*
- * ed_softc: per line info and status
- */
-struct ed_softc {
-       struct  device sc_dev;
-       struct  isr sc_isr;
-
-       struct  ethercom sc_ethercom;   /* ethernet common */
-
-       u_char  volatile *nic_addr;     /* NIC (DS8390) I/O address */
-
-       u_char  cr_proto;       /* values always set in CR */
-
-       void *  mem_start;      /* NIC memory start address */
-       void *  mem_end;        /* NIC memory end address */
-       u_long  mem_size;       /* total NIC memory size */
-       void *  mem_ring;       /* start of RX ring-buffer (in NIC mem) */
-
-       u_char  xmit_busy;      /* transmitter is busy */
-       u_char  txb_cnt;        /* number of transmit buffers */
-       u_char  txb_inuse;      /* number of TX buffers currently in-use*/
-
-       u_char  txb_new;        /* pointer to where new buffer will be added */
-       u_char  txb_next_tx;    /* pointer to next buffer ready to xmit */
-       u_short txb_len[8];     /* buffered xmit buffer lengths */
-       u_char  tx_page_start;  /* first page of TX buffer area */
-       u_char  rec_page_start; /* first page of RX ring-buffer */
-       u_char  rec_page_stop;  /* last page of RX ring-buffer */
-       u_char  next_packet;    /* pointer to next unread RX packet */
-};
-
-int ed_zbus_match(struct device *, struct cfdata *, void *);
-void ed_zbus_attach(struct device *, struct device *, void *);
-int edintr(void *);
-int ed_ioctl(struct ifnet *, u_long, void *);
-void ed_start(struct ifnet *);
-void ed_watchdog(struct ifnet *);
-void ed_reset(struct ed_softc *);
-void ed_init(struct ed_softc *);
-void ed_stop(struct ed_softc *);
-void ed_getmcaf(struct ethercom *, u_long *);
-u_short ed_put(struct ed_softc *, struct mbuf *, void *);
-
-#define inline /* XXX for debugging porpoises */
-
-void ed_get_packet(struct ed_softc *, void *, u_short);
-static inline void ed_rint(struct ed_softc *);
-static inline void ed_xmit(struct ed_softc *);
-static inline void *ed_ring_copy(struct ed_softc *, void *, void *,
-                                       u_short);
-
-static inline void NIC_PUT(struct ed_softc *, int, u_char);
-static inline u_char NIC_GET(struct ed_softc *, int);
-static inline void word_copy(void *, void *, int);
-static inline void word_zero(void *, int);
-struct mbuf *ed_ring_to_mbuf(struct ed_softc *, void *, struct mbuf *,
-                                       u_short);
-
-CFATTACH_DECL(ed_zbus, sizeof(struct ed_softc),
-    ed_zbus_match, ed_zbus_attach, NULL, NULL);
-
-static inline void
-NIC_PUT(struct ed_softc *sc, int off, u_char val)
-{
-       sc->nic_addr[off * 2] = val;
-#ifdef not_def
-       /*
-        * This was being used to *slow* access to the bus.  I don't
-        * believe it is needed but I'll leave it around incase probelms
-        * pop-up
-        */
-       (void)ciaa.pra;
-#endif
-}
-
-static inline u_char
-NIC_GET(struct ed_softc *sc, int off)
-{
-       register u_char val;
-
-       val = sc->nic_addr[off * 2];
-#ifdef not_def
-       /*
-        * This was being used to *slow* access to the bus.  I don't
-        * believe it is needed but I'll leave it around incase probelms
-        * pop-up
-        */
-       (void)ciaa.pra;
-#endif
-       return (val);
-}
-
-/*
- * Memory copy, copies word at time.
- */
-static inline void
-word_copy(void *a, void *b, int len)
-{
-       u_short *x = (u_short *)a,
-               *y = (u_short *)b;
-
-       len >>= 1;
-       while (len--)
-               *y++ = *x++;
-}
-
-/*
- * zero memory, one word at time.
- */
-static inline void
-word_zero(void *a, int len)
-{
-       u_short *x = (u_short *)a;
-
-       len >>= 1;
-       while (len--)
-               *x++ = 0;
-}
-
-int
-ed_zbus_match(struct device *parent, struct cfdata *cfp, void *aux)
-{
-       struct zbus_args *zap = aux;
-
-       if (zap->manid == HYDRA_MANID && zap->prodid == HYDRA_PRODID)
-               return (1);
-       else if (zap->manid == ASDG_MANID && zap->prodid == ASDG_PRODID)
-               return (1);
-       return (0);
-}
-
-void
-ed_zbus_attach(struct device *parent, struct device *self, void *aux)
-{
-       struct ed_softc *sc = (void *)self;
-       struct zbus_args *zap = aux;
-       struct cfdata *cf = device_cfdata(&sc->sc_dev);
-       struct ifnet *ifp = &sc->sc_ethercom.ec_if;
-       volatile u_char *prom;
-       int i;
-       u_int8_t myaddr[ETHER_ADDR_LEN];
-
-       if (zap->manid == HYDRA_MANID) {
-               sc->mem_start = zap->va;
-               sc->mem_size = 16384;
-               sc->nic_addr = (u_char *)sc->mem_start + HYDRA_NIC_BASE;
-               prom = (u_char *)sc->mem_start + HYDRA_ADDRPROM;
-       } else {
-               sc->mem_start = (u_char *)zap->va + 0x8000;
-               sc->mem_size = 16384;
-               sc->nic_addr = (volatile u_char *)zap->va + ASDG_NIC_BASE;
-               prom = (volatile u_char *)sc->nic_addr + ASDG_ADDRPROM;
-       }
-       sc->cr_proto = ED_CR_RD2;
-       sc->tx_page_start = 0;
-
-       sc->mem_end = (u_char *)sc->mem_start + sc->mem_size;
-
-       /*
-        * Use one xmit buffer if < 16k, two buffers otherwise (if not told
-        * otherwise).
-        */
-       if ((sc->mem_size < 16384) || zap->manid == ASDG_MANID
-           || (cf->cf_flags & ED_FLAGS_NO_MULTI_BUFFERING))
-               sc->txb_cnt = 1;
-       else
-               sc->txb_cnt = 2;
-
-       sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
-       sc->rec_page_stop = sc->tx_page_start + (sc->mem_size >> ED_PAGE_SHIFT);
-
-       sc->mem_ring =
-           (u_char *)sc->mem_start + 
-               ((sc->txb_cnt * ED_TXBUF_SIZE) << ED_PAGE_SHIFT);
-
-       /*
-        * Interrupts must be inactive when reading the prom, as the interrupt
-        * line is shared with one of its address lines.
-        */
-
-       NIC_PUT(sc, ED_P0_IMR, 0x00); /* disable ints */
-       NIC_PUT(sc, ED_P0_ISR, 0xff); /* clear ints */
-
-       /*
-        * read the ethernet address from the board
-        */
-       for (i = 0; i < ETHER_ADDR_LEN; i++)
-               myaddr[i] = *(prom + 2 * i);
-
-       /* Set interface to stopped condition (reset). */
-       ed_stop(sc);
-
-       /* Initialize ifnet structure. */
-       memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
-       ifp->if_softc = sc;
-       ifp->if_start = ed_start;
-       ifp->if_ioctl = ed_ioctl;
-       ifp->if_watchdog = ed_watchdog;
-       ifp->if_flags =
-           IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-
-       /* Attach the interface. */
-       if_attach(ifp);
-       ether_ifattach(ifp, myaddr);
-
-       /* Print additional info when attached. */
-       printf(": address %s\n", ether_sprintf(myaddr));
-



Home | Main Index | Thread Index | Old Index