Source-Changes-HG archive

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

[src/netbsd-1-5]: src Pullup approved by thorpej --



details:   https://anonhg.NetBSD.org/src/rev/23e078f26f87
branches:  netbsd-1-5
changeset: 488905:23e078f26f87
user:      briggs <briggs%NetBSD.org@localhost>
date:      Sun Aug 06 12:56:17 2000 +0000

description:
Pullup approved by thorpej --
Add nubus-based SMC91cxx ethernet support for the mac68k.

diffstat:

 distrib/notes/mac68k/hardware       |    5 +-
 sys/arch/mac68k/conf/GENERIC        |    7 +-
 sys/arch/mac68k/conf/INSTALL        |    5 +-
 sys/arch/mac68k/conf/files.mac68k   |   10 ++-
 sys/arch/mac68k/nubus/if_ae_nubus.c |   10 +--
 sys/arch/mac68k/nubus/if_sm_nubus.c |  161 ++++++++++++++++++++++++++++++++++++
 6 files changed, 184 insertions(+), 14 deletions(-)

diffs (truncated from 307 to 300 lines):

diff -r 07050f572920 -r 23e078f26f87 distrib/notes/mac68k/hardware
--- a/distrib/notes/mac68k/hardware     Sun Aug 06 04:32:24 2000 +0000
+++ b/distrib/notes/mac68k/hardware     Sun Aug 06 12:56:17 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: hardware,v 1.15 1999/05/07 03:30:44 ender Exp $        
+.\"    $NetBSD: hardware,v 1.15.8.1 2000/08/06 12:56:17 briggs Exp $   
 NetBSD/mac68k \*V runs on several of the older Macintosh computers.
 About 4MB of RAM might be sufficient to boot, and the system can probably
 be squeezed onto a 40MB hard disk by leaving off an unnecessary set or two.
@@ -52,6 +52,9 @@
 (Asante, Apple, and a few others--problems still
 with Ethernet and many NuBus video cards)
 .It
+Ethernet cards based on the SMC 91c92 and 91c100 (FEAST) chips.
+This includes the AsanteFAST 10/100 cards
+.It
 Onboard Ethernet based on the SONIC chip for Quadra-series Macs
 .It
 Onboard Ethernet based on the MACE (Am79C940) chip for the Quadra
diff -r 07050f572920 -r 23e078f26f87 sys/arch/mac68k/conf/GENERIC
--- a/sys/arch/mac68k/conf/GENERIC      Sun Aug 06 04:32:24 2000 +0000
+++ b/sys/arch/mac68k/conf/GENERIC      Sun Aug 06 12:56:17 2000 +0000
@@ -1,10 +1,10 @@
-#      $NetBSD: GENERIC,v 1.102.2.2 2000/07/06 14:10:35 sommerfeld Exp $
+#      $NetBSD: GENERIC,v 1.102.2.3 2000/08/06 12:56:18 briggs Exp $
 #
 # GENERIC
 
 include        "arch/mac68k/conf/std.mac68k"
 
-#ident                 "GENERIC-$Revision: 1.102.2.2 $"
+#ident                 "GENERIC-$Revision: 1.102.2.3 $"
 
 maxusers       16              # estimated number of users
 
@@ -220,7 +220,10 @@
 # NuBus Ethernet controllers
 ae*    at nubus?                       # DP8390-based
 sn*    at nubus?                       # SONIC-based (DP83932, DP83916)
+sm*    at nubus?                       # SMC 91cxx-based
 
+nsphy* at mii? phy ?
+ukphy* at mii? phy ?
 
 # Audio Devices
 
diff -r 07050f572920 -r 23e078f26f87 sys/arch/mac68k/conf/INSTALL
--- a/sys/arch/mac68k/conf/INSTALL      Sun Aug 06 04:32:24 2000 +0000
+++ b/sys/arch/mac68k/conf/INSTALL      Sun Aug 06 12:56:17 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALL,v 1.5 2000/06/10 02:33:59 scottr Exp $
+#      $NetBSD: INSTALL,v 1.5.2.1 2000/08/06 12:56:18 briggs Exp $
 #
 # INSTALL
 
@@ -155,7 +155,10 @@
 # NuBus Ethernet controllers
 ae*    at nubus?                       # DP8390-based
 sn*    at nubus?                       # SONIC-based (DP83932, DP83916)
+sm*    at nubus?                       # SMC-based
 
+nsphy* at mii? phy ?
+ukphy* at mii? phy ?
 
 # Audio Devices
 
diff -r 07050f572920 -r 23e078f26f87 sys/arch/mac68k/conf/files.mac68k
--- a/sys/arch/mac68k/conf/files.mac68k Sun Aug 06 04:32:24 2000 +0000
+++ b/sys/arch/mac68k/conf/files.mac68k Sun Aug 06 12:56:17 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.mac68k,v 1.95 2000/03/27 21:47:46 scottr Exp $
+#      $NetBSD: files.mac68k,v 1.95.4.1 2000/08/06 12:56:18 briggs Exp $
 
 # mac68k-specific configuration info
 
@@ -18,6 +18,7 @@
 attach mainbus at root
 
 include "dev/wscons/files.wscons"
+include "dev/mii/files.mii"
 
 define obio_norm { [addr = -1], ["no drq" = -1], ["no hsk" = -1] }
 define obio_scsi5380 { [addr = -1], [drq = -1], [hsk = -1] }
@@ -90,6 +91,9 @@
 file   arch/mac68k/obio/if_sn_obio.c   sn_obio
 file   arch/mac68k/nubus/if_sn_nubus.c sn_nubus
 
+attach sm at nubus with sm_nubus
+file   arch/mac68k/nubus/if_sm_nubus.c sm_nubus
+
 # Sony floppy disk controller
 device iwm { drive = -1 }
 attach iwm at obio_norm
@@ -115,6 +119,10 @@
 attach esp at obio_norm
 file   arch/mac68k/obio/esp.c          esp
 
+#device        qsc: scsi, ncr53c9x
+#attach        qsc at nubus
+#file  arch/mac68k/nubus/qsc.c         qsc
+
 device zsc { channel = -1 }
 attach zsc at obio_norm
 file   arch/mac68k/dev/zs.c            zsc needs-flag
diff -r 07050f572920 -r 23e078f26f87 sys/arch/mac68k/nubus/if_ae_nubus.c
--- a/sys/arch/mac68k/nubus/if_ae_nubus.c       Sun Aug 06 04:32:24 2000 +0000
+++ b/sys/arch/mac68k/nubus/if_ae_nubus.c       Sun Aug 06 12:56:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ae_nubus.c,v 1.29 1999/09/29 06:04:51 scottr Exp $  */
+/*     $NetBSD: if_ae_nubus.c,v 1.29.12.1 2000/08/06 12:56:19 briggs Exp $     */
 
 /*
  * Copyright (C) 1997 Scott Reynolds
@@ -105,7 +105,6 @@
                        rv = 1;
                        break;
                case DP8390_VENDOR_DAYNA:
-               case DP8390_VENDOR_FOCUS:
                        rv = UNSUPP;
                        break;
                default:
@@ -261,10 +260,6 @@
                success = 1;
                break;
 
-       case DP8390_VENDOR_FOCUS:
-               printf(": unsupported Focus hardware\n");
-               break;
-
        case DP8390_VENDOR_INTERLAN:
                /* Map register offsets */
                for (i = 0; i < 16; i++) /* normal order, longword aligned */
@@ -438,9 +433,6 @@
        case NUBUS_DRSW_FARALLON:
                vendor = DP8390_VENDOR_FARALLON;
                break;
-       case NUBUS_DRSW_FOCUS:
-               vendor = DP8390_VENDOR_FOCUS;
-               break;
        case NUBUS_DRSW_GATOR:
                switch (na->drhw) {
                default:
diff -r 07050f572920 -r 23e078f26f87 sys/arch/mac68k/nubus/if_sm_nubus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/mac68k/nubus/if_sm_nubus.c       Sun Aug 06 12:56:17 2000 +0000
@@ -0,0 +1,161 @@
+/*     $NetBSD: if_sm_nubus.c,v 1.2.2.2 2000/08/06 12:56:19 briggs Exp $       */
+
+/*
+ * Copyright (c) 2000 Allen Briggs.
+ * 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, 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
+ */
+
+#include "opt_inet.h"
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+
+#include <machine/bus.h>
+#include <machine/viareg.h>
+
+#include <dev/mii/mii.h>
+#include <dev/mii/miivar.h>
+
+#include <dev/ic/smc91cxxreg.h>
+#include <dev/ic/smc91cxxvar.h>
+
+#include <mac68k/nubus/nubus.h>
+
+static int     sm_nubus_match __P((struct device *, struct cfdata *, void *));
+static void    sm_nubus_attach __P((struct device *, struct device *, void *));
+
+struct cfattach sm_nubus_ca = {
+       sizeof(struct smc91cxx_softc), sm_nubus_match, sm_nubus_attach
+};
+
+static int
+sm_nubus_match(parent, cf, aux)
+       struct device *parent;
+       struct cfdata *cf;
+       void *aux;
+{
+       struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
+       bus_space_handle_t bsh;
+       int rv;
+
+       if (bus_space_map(na->na_tag,
+           NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &bsh))
+               return (0);
+
+       rv = 0;
+
+       if (na->category == NUBUS_CATEGORY_NETWORK &&
+           na->type == NUBUS_TYPE_ETHERNET) {
+               switch (na->drsw) {
+               case NUBUS_DRSW_FOCUS:
+               case NUBUS_DRSW_ASANTEF:
+                       rv = 1;
+                       break;
+               default:
+                       rv = 0;
+                       break;
+               }
+       }
+
+       bus_space_unmap(na->na_tag, bsh, NBMEMSIZE);
+
+       return rv;
+}
+
+/*
+ * Install interface into kernel networking data structures
+ */
+static void
+sm_nubus_attach(parent, self, aux)
+       struct device *parent, *self;
+       void   *aux;
+{
+       struct smc91cxx_softc *smc = (struct smc91cxx_softc *) self;
+       struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
+       bus_space_tag_t bst = na->na_tag;
+       bus_space_handle_t bsh, prom_bsh;
+       u_int8_t myaddr[ETHER_ADDR_LEN];
+       int i, success;
+       char *cardtype;
+
+       bst = na->na_tag;
+       if (bus_space_map(bst, NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &bsh)) {
+               printf(": failed to map memory space.\n");
+               return;
+       }
+
+       mac68k_bus_space_handle_swapped(bst, &bsh);
+
+       smc->sc_bst = bst;
+       smc->sc_bsh = bsh;
+
+       cardtype = nubus_get_card_name(bst, bsh, na->fmt);
+
+       success = 0;
+
+       switch (na->drsw) {
+       case NUBUS_DRSW_FOCUS:
+               if (bus_space_subregion(bst, bsh, 0xFF8000, 0x20, &prom_bsh)) {
+                       printf(": failed to map EEPROM space.\n");
+                       break;
+               }
+
+               success = 1;
+               break;
+       case NUBUS_DRSW_ASANTEF:
+               if (bus_space_subregion(bst, bsh, 0xFE0000, 0x20, &prom_bsh)) {
+                       printf(": failed to map EEPROM space.\n");
+                       break;
+               }
+
+               success = 1;
+               break;
+       }
+
+       if (!success) {
+               bus_space_unmap(bst, bsh, NBMEMSIZE);
+               return;
+       }
+       for (i=0 ; i<6 ; i++) {
+               myaddr[i] = bus_space_read_1(bst, prom_bsh, i*4);
+       }
+
+       smc->sc_flags |= SMC_FLAGS_ENABLED;



Home | Main Index | Thread Index | Old Index