Source-Changes-HG archive

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

[src/trunk]: src/sys Move pmax-only if_le_ibus.c from dev/tc to arch/pmax/ibus.



details:   https://anonhg.NetBSD.org/src/rev/9fd2775aa8bf
branches:  trunk
changeset: 515668:9fd2775aa8bf
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Oct 01 11:42:17 2001 +0000

description:
Move pmax-only if_le_ibus.c from dev/tc to arch/pmax/ibus.

diffstat:

 sys/arch/pmax/conf/files.pmax   |    4 +-
 sys/arch/pmax/ibus/if_le_ibus.c |  172 ++++++++++++++++++++++++++++++++++++++++
 sys/dev/tc/if_le_ibus.c         |  172 ----------------------------------------
 3 files changed, 174 insertions(+), 174 deletions(-)

diffs (truncated from 370 to 300 lines):

diff -r 8fb618d71f6c -r 9fd2775aa8bf sys/arch/pmax/conf/files.pmax
--- a/sys/arch/pmax/conf/files.pmax     Mon Oct 01 10:31:45 2001 +0000
+++ b/sys/arch/pmax/conf/files.pmax     Mon Oct 01 11:42:17 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pmax,v 1.96 2001/10/01 10:22:43 simonb Exp $
+#      $NetBSD: files.pmax,v 1.97 2001/10/01 11:42:18 simonb Exp $
 # DECstation-specific configuration info
 
 # maxpartitions must be first item in files.${ARCH}.
@@ -129,7 +129,7 @@
 #   TC and IOASIC attachment and files in sys/dev/tc/files.tc
 
 attach le at ibus with le_pmax:                le24, le_dec_subr
-file   dev/tc/if_le_ibus.c             le_pmax
+file   arch/pmax/ibus/if_le_ibus.c     le_pmax
 
 
 # Raster operations for rcons. This isn't in the rcons section, since
diff -r 8fb618d71f6c -r 9fd2775aa8bf sys/arch/pmax/ibus/if_le_ibus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/pmax/ibus/if_le_ibus.c   Mon Oct 01 11:42:17 2001 +0000
@@ -0,0 +1,172 @@
+/*     $NetBSD: if_le_ibus.c,v 1.2 2001/10/01 11:42:18 simonb Exp $    */
+
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies.  Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose.  It is provided "as is" without
+ * express or implied warranty.
+ *
+ * This driver was contributed by Jonathan Stone.
+ */
+
+/*
+ * LANCE on Decstation kn01/kn220(?) baseboard.
+ */
+#include "opt_inet.h"
+
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+
+#ifdef INET
+#include <netinet/in.h>
+#include <netinet/if_inarp.h>
+#endif
+
+#include <dev/ic/lancevar.h>
+#include <dev/ic/am7990var.h>
+
+#include <dev/tc/if_levar.h>
+#include <pmax/ibus/ibusvar.h>
+#include <pmax/pmax/kn01.h>
+
+static void le_dec_copyfrombuf_gap2(struct lance_softc *, void *, int, int);
+static void le_dec_copytobuf_gap2(struct lance_softc *, void *, int, int);
+static void le_dec_zerobuf_gap2(struct lance_softc *, int, int);
+
+
+static int le_pmax_match(struct device *, struct cfdata *, void *);
+static void le_pmax_attach(struct device *, struct device *, void *);
+
+struct cfattach le_pmax_ca = {
+       sizeof(struct le_softc), le_pmax_match, le_pmax_attach
+};
+extern struct cfdriver ibus_cd;
+
+int
+le_pmax_match(struct device *parent, struct cfdata *match, void *aux)
+{
+       struct ibus_attach_args *d = aux;
+
+       if (parent->dv_cfdata->cf_driver != &ibus_cd)
+               return (0);
+
+       if (strcmp("lance", d->ia_name) != 0)
+               return (0);
+       return (1);
+}
+
+void
+le_pmax_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct le_softc *lesc = (void *)self;
+       struct lance_softc *sc = &lesc->sc_am7990.lsc;
+       u_char *cp;
+       struct ibus_attach_args *ia = aux;
+
+       /*
+        * It's on the baseboard, with a dedicated interrupt line.
+        */
+       lesc->sc_r1 = (struct lereg1 *)(ia->ia_addr);
+       sc->sc_mem = (void *)MIPS_PHYS_TO_KSEG1(KN01_SYS_LANCE_B_START);
+       cp = (u_char *)(MIPS_PHYS_TO_KSEG1(KN01_SYS_CLOCK) + 1);
+
+       sc->sc_copytodesc = le_dec_copytobuf_gap2;
+       sc->sc_copyfromdesc = le_dec_copyfrombuf_gap2;
+       sc->sc_copytobuf = le_dec_copytobuf_gap2;
+       sc->sc_copyfrombuf = le_dec_copyfrombuf_gap2;
+       sc->sc_zerobuf = le_dec_zerobuf_gap2;
+
+       dec_le_common_attach(&lesc->sc_am7990, cp);
+
+       ibus_intr_establish(parent, (void*)ia->ia_cookie, IPL_NET,
+           am7990_intr, sc);
+}
+
+/*
+ * gap2: two bytes of data followed by two bytes of pad.
+ *
+ * Buffers must be 4-byte aligned.  The code doesn't worry about
+ * doing an extra byte.
+ */
+
+void
+le_dec_copytobuf_gap2(struct lance_softc *sc, void *fromv, int boff, int len)
+{
+       volatile caddr_t buf = sc->sc_mem;
+       caddr_t from = fromv;
+       volatile u_int16_t *bptr;
+
+       if (boff & 0x1) {
+               /* handle unaligned first byte */
+               bptr = ((volatile u_int16_t *)buf) + (boff - 1);
+               *bptr = (*from++ << 8) | (*bptr & 0xff);
+               bptr += 2;
+               len--;
+       } else
+               bptr = ((volatile u_int16_t *)buf) + boff;
+       while (len > 1) {
+               *bptr = (from[1] << 8) | (from[0] & 0xff);
+               bptr += 2;
+               from += 2;
+               len -= 2;
+       }
+       if (len == 1)
+               *bptr = (u_int16_t)*from;
+}
+
+void
+le_dec_copyfrombuf_gap2(struct lance_softc *sc, void *tov, int boff, int len)
+{
+       volatile caddr_t buf = sc->sc_mem;
+       caddr_t to = tov;
+       volatile u_int16_t *bptr;
+       u_int16_t tmp;
+
+       if (boff & 0x1) {
+               /* handle unaligned first byte */
+               bptr = ((volatile u_int16_t *)buf) + (boff - 1);
+               *to++ = (*bptr >> 8) & 0xff;
+               bptr += 2;
+               len--;
+       } else
+               bptr = ((volatile u_int16_t *)buf) + boff;
+       while (len > 1) {
+               tmp = *bptr;
+               *to++ = tmp & 0xff;
+               *to++ = (tmp >> 8) & 0xff;
+               bptr += 2;
+               len -= 2;
+       }
+       if (len == 1)
+               *to = *bptr & 0xff;
+}
+
+static void
+le_dec_zerobuf_gap2(struct lance_softc *sc, int boff, int len)
+{
+       volatile caddr_t buf = sc->sc_mem;
+       volatile u_int16_t *bptr;
+
+       if ((unsigned)boff & 0x1) {
+               bptr = ((volatile u_int16_t *)buf) + (boff - 1);
+               *bptr &= 0xff;
+               bptr += 2;
+               len--;
+       } else
+               bptr = ((volatile u_int16_t *)buf) + boff;
+       while (len > 0) {
+               *bptr = 0;
+               bptr += 2;
+               len -= 2;
+       }
+}
diff -r 8fb618d71f6c -r 9fd2775aa8bf sys/dev/tc/if_le_ibus.c
--- a/sys/dev/tc/if_le_ibus.c   Mon Oct 01 10:31:45 2001 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*     $NetBSD: if_le_ibus.c,v 1.17 2001/09/18 12:46:33 simonb Exp $   */
-
-/*
- * Copyright 1996 The Board of Trustees of The Leland Stanford
- * Junior University. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies.  Stanford University
- * makes no representations about the suitability of this
- * software for any purpose.  It is provided "as is" without
- * express or implied warranty.
- *
- * This driver was contributed by Jonathan Stone.
- */
-
-/*
- * LANCE on Decstation kn01/kn220(?) baseboard.
- */
-#include "opt_inet.h"
-
-#include <sys/param.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_ether.h>
-#include <net/if_media.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_inarp.h>
-#endif
-
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990var.h>
-
-#include <dev/tc/if_levar.h>
-#include <pmax/ibus/ibusvar.h>
-#include <pmax/pmax/kn01.h>
-
-static void le_dec_copyfrombuf_gap2(struct lance_softc *, void *, int, int);
-static void le_dec_copytobuf_gap2(struct lance_softc *, void *, int, int);
-static void le_dec_zerobuf_gap2(struct lance_softc *, int, int);
-
-
-static int le_pmax_match(struct device *, struct cfdata *, void *);
-static void le_pmax_attach(struct device *, struct device *, void *);
-
-struct cfattach le_pmax_ca = {
-       sizeof(struct le_softc), le_pmax_match, le_pmax_attach
-};
-extern struct cfdriver ibus_cd;
-
-int
-le_pmax_match(struct device *parent, struct cfdata *match, void *aux)
-{
-       struct ibus_attach_args *d = aux;
-
-       if (parent->dv_cfdata->cf_driver != &ibus_cd)
-               return (0);
-
-       if (strcmp("lance", d->ia_name) != 0)
-               return (0);
-       return (1);
-}
-
-void
-le_pmax_attach(struct device *parent, struct device *self, void *aux)
-{
-       struct le_softc *lesc = (void *)self;
-       struct lance_softc *sc = &lesc->sc_am7990.lsc;
-       u_char *cp;
-       struct ibus_attach_args *ia = aux;
-
-       /*
-        * It's on the baseboard, with a dedicated interrupt line.
-        */
-       lesc->sc_r1 = (struct lereg1 *)(ia->ia_addr);
-       sc->sc_mem = (void *)MIPS_PHYS_TO_KSEG1(KN01_SYS_LANCE_B_START);
-       cp = (u_char *)(MIPS_PHYS_TO_KSEG1(KN01_SYS_CLOCK) + 1);
-
-       sc->sc_copytodesc = le_dec_copytobuf_gap2;
-       sc->sc_copyfromdesc = le_dec_copyfrombuf_gap2;
-       sc->sc_copytobuf = le_dec_copytobuf_gap2;
-       sc->sc_copyfrombuf = le_dec_copyfrombuf_gap2;
-       sc->sc_zerobuf = le_dec_zerobuf_gap2;
-
-       dec_le_common_attach(&lesc->sc_am7990, cp);
-
-       ibus_intr_establish(parent, (void*)ia->ia_cookie, IPL_NET,
-           am7990_intr, sc);
-}
-
-/*
- * gap2: two bytes of data followed by two bytes of pad.
- *
- * Buffers must be 4-byte aligned.  The code doesn't worry about
- * doing an extra byte.
- */
-
-void



Home | Main Index | Thread Index | Old Index