diff options
-rw-r--r-- | share/man/man4/sm.4 | 12 | ||||
-rw-r--r-- | sys/arch/mac68k/conf/GENERIC | 6 | ||||
-rw-r--r-- | sys/arch/mac68k/conf/files.mac68k | 6 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sm_nubus.c | 165 |
4 files changed, 184 insertions, 5 deletions
diff --git a/share/man/man4/sm.4 b/share/man/man4/sm.4 index a73ec52546f..4f3594346b3 100644 --- a/share/man/man4/sm.4 +++ b/share/man/man4/sm.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sm.4,v 1.11 2006/01/23 15:04:00 martin Exp $ +.\" $OpenBSD: sm.4,v 1.12 2006/01/29 15:58:20 martin Exp $ .\" $NetBSD: sm.4,v 1.3 1998/08/09 00:39:02 thorpej Exp $ .\" .\" Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -41,15 +41,16 @@ .Os .Sh NAME .Nm sm -.Nd SMC91C9x-based Ethernet driver +.Nd SMC91Cxx-based Ethernet driver .Sh SYNOPSIS .Cd "sm0 at isa? port 0x300 irq 10" .Cd "sm* at pcmcia?" +.Cd "sm* at nubus?" .Cd "nsphy* at mii?" .Sh DESCRIPTION The .Nm -device driver supports SMC91C9x-based Ethernet interfaces. +device driver supports SMC91C9x-based and SMC91C1xx-based Ethernet interfaces. .Pp The ISA attachment of the .Nm @@ -62,7 +63,12 @@ The PCMCIA attachment of the .Nm driver supports Megahertz X-JACK Ethernet cards, NewMedia BASICS Ethernet cards, and SMC EtherEZ 8020 series cards. +.Pp +The NuBus attachment of the +.Nm +driver supports SMC-based ethernet cards for mac68k. .Sh MEDIA SELECTION +The SMC91C1xx supports the MII interface. The SMC91C9x supports AUI and UTP media types. .Pp To enable the AUI media, select the diff --git a/sys/arch/mac68k/conf/GENERIC b/sys/arch/mac68k/conf/GENERIC index 00b37025e68..e1b062edfba 100644 --- a/sys/arch/mac68k/conf/GENERIC +++ b/sys/arch/mac68k/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.46 2006/01/15 00:10:22 miod Exp $ +# $OpenBSD: GENERIC,v 1.47 2006/01/29 15:58:20 martin Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -49,6 +49,10 @@ nubus0 at mainbus? ae* at nubus? # Most Apple Ethernet Cards macfb* at nubus? # NuBus video cards sn* at nubus? # SONIC-based ethernet cards +#sm* at nubus? # SMC 91cxx-based ethernet cards + +#nsphy* at mii? phy? +#ukphy* at mii? phy? # workstation console wsdisplay* at macfb? diff --git a/sys/arch/mac68k/conf/files.mac68k b/sys/arch/mac68k/conf/files.mac68k index f7d89b4dd34..826795cf295 100644 --- a/sys/arch/mac68k/conf/files.mac68k +++ b/sys/arch/mac68k/conf/files.mac68k @@ -1,4 +1,4 @@ -# $OpenBSD: files.mac68k,v 1.41 2006/01/22 13:53:16 miod Exp $ +# $OpenBSD: files.mac68k,v 1.42 2006/01/29 15:58:20 martin Exp $ # $NetBSD: files.mac68k,v 1.61 1997/03/01 20:22:16 scottr Exp $ # mac68k-specific configuration info @@ -65,7 +65,11 @@ attach mc at obio with mc_obio file arch/mac68k/dev/if_mc.c file arch/mac68k/dev/if_mc_obio.c +attach sm at nubus with sm_nubus +file arch/mac68k/dev/if_sm_nubus.c sm_nubus + include "scsi/files.scsi" +include "dev/mii/files.mii" # Option 1 for ncr5380 support device ncrscsi: scsi diff --git a/sys/arch/mac68k/dev/if_sm_nubus.c b/sys/arch/mac68k/dev/if_sm_nubus.c new file mode 100644 index 00000000000..fd8dbab67bc --- /dev/null +++ b/sys/arch/mac68k/dev/if_sm_nubus.c @@ -0,0 +1,165 @@ +/* $OpenBSD: if_sm_nubus.c,v 1.1 2006/01/29 15:58:20 martin Exp $ */ +/* $NetBSD: if_sm_nubus.c,v 1.2 2000/08/01 13:08:39 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 <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> + +#ifdef INET +#include <netinet/in.h> +#include <netinet/if_ether.h> +#endif + +#include <machine/bus.h> +#include <machine/viareg.h> + +#include <net/if_media.h> + +#include <dev/mii/mii.h> +#include <dev/mii/miivar.h> + +#include <dev/ic/smc91cxxreg.h> +#include <dev/ic/smc91cxxvar.h> + +#include <mac68k/dev/nubus.h> + +static int sm_nubus_match(struct device *, void *, void *); +static void sm_nubus_attach(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; + void *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; + + printf(": %s", cardtype); + + smc91cxx_attach(smc, myaddr); + + add_nubus_intr(na->slot, smc91cxx_intr, smc, smc->sc_dev.dv_xname); +} |