Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia RATOC REX-R280 (another if_mbe_pcmcia card) s...



details:   https://anonhg.NetBSD.org/src/rev/27a7fd3485b4
branches:  trunk
changeset: 486035:27a7fd3485b4
user:      is <is%NetBSD.org@localhost>
date:      Thu May 11 19:24:35 2000 +0000

description:
RATOC REX-R280 (another if_mbe_pcmcia card) support by UCHIYAMA Yasushi.
Originally part of pr 6789, reworked by the submitter to fit into -current.

diffstat:

 sys/dev/pcmcia/if_mbe_pcmcia.c   |  111 ++++++++++++++++++++++++++++----------
 sys/dev/pcmcia/pcmciadevs        |    6 +-
 sys/dev/pcmcia/pcmciadevs.h      |    8 ++-
 sys/dev/pcmcia/pcmciadevs_data.h |   16 +++++-
 4 files changed, 109 insertions(+), 32 deletions(-)

diffs (262 lines):

diff -r d05f423adb62 -r 27a7fd3485b4 sys/dev/pcmcia/if_mbe_pcmcia.c
--- a/sys/dev/pcmcia/if_mbe_pcmcia.c    Thu May 11 16:49:01 2000 +0000
+++ b/sys/dev/pcmcia/if_mbe_pcmcia.c    Thu May 11 19:24:35 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mbe_pcmcia.c,v 1.17 2000/02/04 09:30:28 enami Exp $ */
+/*     $NetBSD: if_mbe_pcmcia.c,v 1.18 2000/05/11 19:24:35 is Exp $    */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -79,37 +79,45 @@
 
 struct mbe_pcmcia_get_enaddr_args {
        u_int8_t enaddr[ETHER_ADDR_LEN];
+       int maddr;
 };
-int    mbe_pcmcia_get_enaddr __P((struct pcmcia_tuple *, void *));
+int    mbe_pcmcia_get_enaddr_from_cis __P((struct pcmcia_tuple *, void *));
+int    mbe_pcmcia_get_enaddr_from_mem __P((struct mbe_pcmcia_softc *,
+                                   struct mbe_pcmcia_get_enaddr_args *));
 
 const struct mbe_pcmcia_product {
        struct pcmcia_product mpp_product;
        u_int32_t       mpp_ioalign;    /* required alignment */
+       int enet_maddr;
 } mbe_pcmcia_products[] = {
        { { PCMCIA_STR_TDK_LAK_CD021BX,         PCMCIA_VENDOR_TDK,
            PCMCIA_PRODUCT_TDK_LAK_CD021BX,     0 },
-         0 }, 
+         0, -1}, 
 
        { { PCMCIA_STR_TDK_LAK_CF010,           PCMCIA_VENDOR_TDK,
            PCMCIA_PRODUCT_TDK_LAK_CF010,       0 },
-         0 },
+         0, -1},
 #if 0 /* XXX 86960-based? */
        { { PCMCIA_STR_TDK_LAK_DFL9610,         PCMCIA_VENDOR_TDK,
            PCMCIA_PRODUCT_TDK_LAK_DFL9610,     1 },
-         0 },
+         0, -1 },
 #endif
 
        { { PCMCIA_STR_CONTEC_CNETPC,           PCMCIA_VENDOR_CONTEC,
            PCMCIA_PRODUCT_CONTEC_CNETPC,       0 },
-         0 },
+         0, -1 },
 
        { { PCMCIA_STR_FUJITSU_LA501,           PCMCIA_VENDOR_FUJITSU,
            PCMCIA_PRODUCT_FUJITSU_LA501,       0 },
-         0x20 },
+         0x20, -1 },
 
        { { PCMCIA_STR_FUJITSU_LA10S,           PCMCIA_VENDOR_FUJITSU,
            PCMCIA_PRODUCT_FUJITSU_LA10S,       0 },
-         0 },
+         0, -1 },
+
+       { { PCMCIA_STR_RATOC_REX_R280,          PCMCIA_VENDOR_RATOC,
+           PCMCIA_PRODUCT_RATOC_REX_R280,      0 },
+         0, 0x1fc },
 
        { { NULL } }
 };
@@ -188,28 +196,37 @@
 
        printf(": %s\n", mpp->mpp_product.pp_name);
 
-       /* Read station address from CIS. */
-       rv = pcmcia_scan_cis(parent, mbe_pcmcia_get_enaddr, &pgea);
-       if (rv == -1) {
-               printf("%s: Couldn't read CIS to get ethernet address\n",
-                   sc->sc_dev.dv_xname);
-               goto no_enaddr;
-       } else if (rv == 0) {
-               printf("%s: Couldn't get ethernet address from CIS\n",
-                   sc->sc_dev.dv_xname);
-               goto no_enaddr;
+       /* Read station address from mem or CIS. */
+       if (mpp->enet_maddr >= 0) {
+               pgea.maddr = mpp->enet_maddr;
+               if (mbe_pcmcia_get_enaddr_from_mem(psc, &pgea) != 0) {
+                       printf("%s: Couldn't get ethernet address "
+                              "from mem\n", sc->sc_dev.dv_xname);
+                       goto no_enaddr;
+               }
+       } else {
+               rv = pcmcia_scan_cis(parent, 
+                                    mbe_pcmcia_get_enaddr_from_cis, &pgea);
+               if (rv == -1) {
+                       printf("%s: Couldn't read CIS to get ethernet "
+                              "address\n", sc->sc_dev.dv_xname);
+                       goto no_enaddr;
+               } else if (rv == 0) {
+                       printf("%s: Couldn't get ethernet address "
+                              "from CIS\n", sc->sc_dev.dv_xname);
+                       goto no_enaddr;
+               }
+#ifdef DIAGNOSTIC
+               if (rv != 1) {
+                       printf("%s: pcmcia_scan_cis returns %d\n",
+                              sc->sc_dev.dv_xname, rv);
+                       panic("mbe_pcmcia_attach");
+               }
+               printf("%s: Ethernet address from CIS: %s\n",
+                      sc->sc_dev.dv_xname, ether_sprintf(pgea.enaddr));
+#endif
        }
 
-#ifdef DIAGNOSTIC
-       if (rv != 1) {
-               printf("%s: pcmcia_scan_cis returns %d\n", sc->sc_dev.dv_xname,
-                   rv);
-               panic("mbe_pcmcia_attach");
-       }
-       printf("%s: Ethernet address from CIS: %s\n",
-           sc->sc_dev.dv_xname, ether_sprintf(pgea.enaddr));
-#endif
-
        /* Perform generic initialization. */
        mb86960_attach(sc, MB86960_TYPE_86965, pgea.enaddr);
 
@@ -292,7 +309,7 @@
 }
 
 int
-mbe_pcmcia_get_enaddr(tuple, arg)
+mbe_pcmcia_get_enaddr_from_cis(tuple, arg)
        struct pcmcia_tuple *tuple;
        void *arg;
 {
@@ -314,3 +331,39 @@
        }
        return (0);
 }
+
+int
+mbe_pcmcia_get_enaddr_from_mem(psc, ea)
+       struct mbe_pcmcia_softc *psc;
+       struct mbe_pcmcia_get_enaddr_args *ea;
+{
+       struct mb86960_softc *sc = &psc->sc_mb86960;
+       struct pcmcia_mem_handle pcmh;
+       bus_addr_t offset;
+       int i, mwindow;
+
+       if (ea->maddr < 0)
+               return (1);
+
+       if (pcmcia_mem_alloc(psc->sc_pf, ETHER_ADDR_LEN * 2, &pcmh)) {
+               printf("%s: can't alloc mem for enet addr\n", 
+                      sc->sc_dev.dv_xname);
+               return (1);
+       }
+
+       if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_ATTR, ea->maddr,
+                          ETHER_ADDR_LEN * 2, &pcmh, &offset, &mwindow)) {
+               printf("%s: can't map mem for enet addr\n", 
+                      sc->sc_dev.dv_xname);
+               return (1);
+       }
+
+       for (i = 0; i < ETHER_ADDR_LEN; i++)
+               ea->enaddr[i] = bus_space_read_1(pcmh.memt, pcmh.memh,
+                                                offset + (i * 2));
+
+       pcmcia_mem_unmap(psc->sc_pf, mwindow);
+       pcmcia_mem_free(psc->sc_pf, &pcmh);
+
+       return (0);
+}
diff -r d05f423adb62 -r 27a7fd3485b4 sys/dev/pcmcia/pcmciadevs
--- a/sys/dev/pcmcia/pcmciadevs Thu May 11 16:49:01 2000 +0000
+++ b/sys/dev/pcmcia/pcmciadevs Thu May 11 19:24:35 2000 +0000
@@ -1,4 +1,4 @@
-$NetBSD: pcmciadevs,v 1.88 2000/04/17 12:00:35 joda Exp $
+$NetBSD: pcmciadevs,v 1.89 2000/05/11 19:24:35 is Exp $
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -75,6 +75,7 @@
 vendor COREGA                  0xc00f  Corega K.K.
 vendor ALLIEDTELESIS           0xc00f  Allied Telesis K.K.
 vendor HAGIWARASYSCOM          0xc012  Hagiwara SYS-COM
+vendor RATOC                   0xc015  RATOC System Inc.
 
 /*
  * List of known products.  Grouped by vendor.
@@ -218,6 +219,9 @@
 /* Raylink/WebGear */
 product RAYTHEON WLAN          0x0000 WLAN Adapter
 
+/* RATOC System Inc. Products */
+product RATOC REX_R280         0x1     RATOC REX-R280
+
 /* Cards we know only by their cis */
 vendor PREMAX                  -1      Premax
 vendor PLANET                  -1      Planet
diff -r d05f423adb62 -r 27a7fd3485b4 sys/dev/pcmcia/pcmciadevs.h
--- a/sys/dev/pcmcia/pcmciadevs.h       Thu May 11 16:49:01 2000 +0000
+++ b/sys/dev/pcmcia/pcmciadevs.h       Thu May 11 19:24:35 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcmciadevs.h,v 1.88 2000/04/17 12:01:20 joda Exp $     */
+/*     $NetBSD: pcmciadevs.h,v 1.89 2000/05/11 19:24:36 is Exp $       */
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -82,6 +82,7 @@
 #define        PCMCIA_VENDOR_COREGA    0xc00f  /* Corega K.K. */
 #define        PCMCIA_VENDOR_ALLIEDTELESIS     0xc00f  /* Allied Telesis K.K. */
 #define        PCMCIA_VENDOR_HAGIWARASYSCOM    0xc012  /* Hagiwara SYS-COM */
+#define        PCMCIA_VENDOR_RATOC     0xc015  /* RATOC System Inc. */
 
 /*
  * List of known products.  Grouped by vendor.
@@ -369,6 +370,11 @@
 #define        PCMCIA_PRODUCT_RAYTHEON_WLAN    0x0000
 #define        PCMCIA_STR_RAYTHEON_WLAN        "WLAN Adapter"
 
+/* RATOC System Inc. Products */
+#define        PCMCIA_CIS_RATOC_REX_R280       { NULL, NULL, NULL, NULL }
+#define        PCMCIA_PRODUCT_RATOC_REX_R280   0x1
+#define        PCMCIA_STR_RATOC_REX_R280       "RATOC REX-R280"
+
 /* Cards we know only by their cis */
 #define        PCMCIA_VENDOR_PREMAX    -1      /* Premax */
 #define        PCMCIA_VENDOR_PLANET    -1      /* Planet */
diff -r d05f423adb62 -r 27a7fd3485b4 sys/dev/pcmcia/pcmciadevs_data.h
--- a/sys/dev/pcmcia/pcmciadevs_data.h  Thu May 11 16:49:01 2000 +0000
+++ b/sys/dev/pcmcia/pcmciadevs_data.h  Thu May 11 19:24:35 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcmciadevs_data.h,v 1.88 2000/04/17 12:01:21 joda Exp $        */
+/*     $NetBSD: pcmciadevs_data.h,v 1.89 2000/05/11 19:24:36 is Exp $  */
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -549,6 +549,13 @@
            "WLAN Adapter"      },
        },
        {
+           PCMCIA_VENDOR_RATOC, PCMCIA_PRODUCT_RATOC_REX_R280,
+           PCMCIA_CIS_RATOC_REX_R280,
+           0,
+           "RATOC System Inc.",
+           "RATOC REX-R280"    },
+       },
+       {
            PCMCIA_VENDOR_UNKNOWN, PCMCIA_PRODUCT_MEGAHERTZ_XJ2288,
            PCMCIA_CIS_MEGAHERTZ_XJ2288,
            0,
@@ -1004,6 +1011,13 @@
            NULL,
        },
        {
+           PCMCIA_VENDOR_RATOC, 0,
+           PCMCIA_KNOWNDEV_NOPROD,
+           PCMCIA_CIS_INVALID,
+           "RATOC System Inc.",
+           NULL,
+       },
+       {
            PCMCIA_VENDOR_PREMAX, 0,
            PCMCIA_KNOWNDEV_NOPROD,
            PCMCIA_CIS_INVALID,



Home | Main Index | Thread Index | Old Index