diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-04-22 20:15:56 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-04-22 20:15:56 +0000 |
commit | b1e71f76aa853f2f2ae8141e4875a638b8ddee2e (patch) | |
tree | 569d9e00eedbe78b36d1662f1a54a9d05dd207c1 /sys/arch | |
parent | 5b7fdfe02063091cb1aeb4610e515af2a5c6b506 (diff) |
Bring several stability and performance fixes from NetBSD, as well as
more hardware support.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 8 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn_nubus.c | 54 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn_obio.c | 57 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_snvar.h | 9 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/nubus.h | 3 |
5 files changed, 104 insertions, 27 deletions
diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index 6f6aff4d7b2..2abd21dd1ef 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.31 2002/03/14 01:26:35 millert Exp $ */ +/* $OpenBSD: if_sn.c,v 1.32 2002/04/22 20:15:55 miod Exp $ */ /* $NetBSD: if_sn.c,v 1.13 1997/04/25 03:40:10 briggs Exp $ */ /* @@ -237,7 +237,7 @@ snsetup(sc, lladdr) #ifdef SNDEBUG camdump(sc); #endif - printf(" address %s\n", ether_sprintf(lladdr)); + printf("address %s\n", ether_sprintf(lladdr)); #ifdef SNDEBUG printf("%s: buffers: rra=%p cda=%p rda=%p tda=%p\n", @@ -430,7 +430,7 @@ sninit(sc) s = splnet(); - NIC_PUT(sc, SNR_CR, CR_RST); /* DCR only accessable in reset mode! */ + NIC_PUT(sc, SNR_CR, CR_RST); /* DCR only accessible in reset mode! */ /* config it */ NIC_PUT(sc, SNR_DCR, (sc->snr_dcr | @@ -1171,7 +1171,7 @@ sonic_get(sc, eh, datalen) if (top) m_freem(top); return (0); } - len = MLEN; + len = MCLBYTES; } m->m_len = len = min(datalen, len); diff --git a/sys/arch/mac68k/dev/if_sn_nubus.c b/sys/arch/mac68k/dev/if_sn_nubus.c index cf19ebb7c17..c05b8de97e3 100644 --- a/sys/arch/mac68k/dev/if_sn_nubus.c +++ b/sys/arch/mac68k/dev/if_sn_nubus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn_nubus.c,v 1.14 2002/03/14 01:26:35 millert Exp $ */ +/* $OpenBSD: if_sn_nubus.c,v 1.15 2002/04/22 20:15:55 miod Exp $ */ /* $NetBSD: if_sn_nubus.c,v 1.13 1997/05/11 19:11:34 scottr Exp $ */ /* * Copyright (C) 1997 Allen Briggs @@ -48,9 +48,11 @@ #include <machine/bus.h> #include <machine/viareg.h> -#include "nubus.h" -#include "if_snreg.h" -#include "if_snvar.h" +#include <mac68k/dev/nubus.h> +#include <mac68k/dev/if_snreg.h> +#include <mac68k/dev/if_snvar.h> + +#define INTERFACE_NAME_LEN 32 static int sn_nubus_match(struct device *, void *, void *); static void sn_nubus_attach(struct device *, struct device *, void *); @@ -85,8 +87,9 @@ sn_nubus_match(parent, cf, aux) break; case SN_VENDOR_APPLE: - case SN_VENDOR_DAYNA: case SN_VENDOR_APPLE16: + case SN_VENDOR_ASANTELC: + case SN_VENDOR_DAYNA: rv = 1; break; } @@ -111,6 +114,7 @@ sn_nubus_attach(parent, self, aux) bus_space_tag_t bst; bus_space_handle_t bsh, tmp_bsh; u_int8_t myaddr[ETHER_ADDR_LEN]; + char cardtype[INTERFACE_NAME_LEN]; /* type string */ (void)(&offset); /* Work around lame gcc initialization bug */ @@ -122,6 +126,9 @@ sn_nubus_attach(parent, self, aux) sc->sc_regt = bst; + strncpy(cardtype, nubus_get_card_name(na->fmt), + INTERFACE_NAME_LEN); + success = 0; sc->slotno = na->slot; @@ -199,6 +206,30 @@ sn_nubus_attach(parent, self, aux) success = 1; break; + case SN_VENDOR_ASANTELC: /* Macintosh LC Ethernet Adapter */ + sc->snr_dcr = DCR_ASYNC | DCR_WAIT0 | + DCR_DMABLOCK | DCR_PO1 | DCR_RFT16 | DCR_TFT16; + sc->snr_dcr2 = 0; + sc->bitmode = 0; /* 16 bit card */ + + if (bus_space_subregion(bst, bsh, + 0x0, SN_REGSIZE, &sc->sc_regh)) { + printf(": failed to map register space.\n"); + break; + } + + if (bus_space_subregion(bst, bsh, + 0x400000, ETHER_ADDR_LEN, &tmp_bsh)) { + printf(": failed to map ROM space.\n"); + break; + } + + sn_get_enaddr(bst, tmp_bsh, 0, myaddr); + + offset = 0; + success = 1; + break; + default: /* * You can't actually get this default, the snmatch @@ -223,6 +254,8 @@ sn_nubus_attach(parent, self, aux) sc->sc_reg_map[i] = (bus_size_t)((i * 4) + offset); } + printf(": %s, ", cardtype); + /* snsetup returns 1 if something fails */ if (snsetup(sc, myaddr)) { bus_space_unmap(bst, bsh, NBMEMSIZE); @@ -230,8 +263,6 @@ sn_nubus_attach(parent, self, aux) } add_nubus_intr(sc->slotno, snintr, (void *)sc); - - return; } static int @@ -244,12 +275,17 @@ sn_nb_card_vendor(bst, bsh, na) switch (na->drsw) { case NUBUS_DRSW_3COM: - if (na->drhw == NUBUS_DRHW_APPLE_SN) + if (na->drhw == NUBUS_DRHW_APPLE_SNT) vendor = SN_VENDOR_APPLE; - else if (na->drhw == NUBUS_DRHW_APPLE_SNT) + else if (na->drhw == NUBUS_DRHW_APPLE_SN) vendor = SN_VENDOR_APPLE16; break; case NUBUS_DRSW_APPLE: + if (na->drhw == NUBUS_DRHW_ASANTE_LC) + vendor = SN_VENDOR_ASANTELC; + else + vendor = SN_VENDOR_APPLE; + break; case NUBUS_DRSW_TECHWORKS: vendor = SN_VENDOR_APPLE; break; diff --git a/sys/arch/mac68k/dev/if_sn_obio.c b/sys/arch/mac68k/dev/if_sn_obio.c index a42f319965c..2ec0f5981a2 100644 --- a/sys/arch/mac68k/dev/if_sn_obio.c +++ b/sys/arch/mac68k/dev/if_sn_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn_obio.c,v 1.18 2002/03/14 01:26:35 millert Exp $ */ +/* $OpenBSD: if_sn_obio.c,v 1.19 2002/04/22 20:15:55 miod Exp $ */ /* $NetBSD: if_sn_obio.c,v 1.9 1997/04/22 20:56:15 scottr Exp $ */ /* @@ -47,9 +47,9 @@ #include <machine/cpu.h> #include <machine/viareg.h> -#include "obiovar.h" -#include "if_snreg.h" -#include "if_snvar.h" +#include <mac68k/dev/obiovar.h> +#include <mac68k/dev/if_snreg.h> +#include <mac68k/dev/if_snvar.h> #define SONIC_REG_BASE 0x50F0A000 #define SONIC_PROM_BASE 0x50F08000 @@ -69,10 +69,23 @@ sn_obio_match(parent, cf, aux) void *cf; void *aux; { - if (mac68k_machine.sonic) - return 1; + struct obio_attach_args *oa = (struct obio_attach_args *)aux; + bus_space_handle_t bsh; + int found = 0; - return 0; + if (!mac68k_machine.sonic) + return 0; + + if (bus_space_map(oa->oa_tag, + SONIC_REG_BASE, SN_REGSIZE, 0, &bsh)) + return 0; + + if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0, 4)) + found = 1; + + bus_space_unmap(oa->oa_tag, bsh, SN_REGSIZE); + + return found; } /* @@ -91,6 +104,8 @@ sn_obio_attach(parent, self, aux) sc->snr_dcr = DCR_WAIT0 | DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16; sc->snr_dcr2 = 0; + sc->slotno = 9; + switch (current_mac_model->machineid) { case MACH_MACC610: case MACH_MACC650: @@ -104,6 +119,11 @@ sn_obio_attach(parent, self, aux) sc->bitmode = 1; break; + case MACH_MACLC575: + case MACH_MACP580: + case MACH_MACQ630: + break; + case MACH_MACPB500: sc->snr_dcr |= DCR_SYNC | DCR_LBR; sc->bitmode = 0; /* 16 bit interface */ @@ -122,13 +142,30 @@ sn_obio_attach(parent, self, aux) return; } - sc->slotno = 9; - /* regs are addressed as words, big-endian. */ for (i = 0; i < SN_NREGS; i++) { sc->sc_reg_map[i] = (bus_size_t)((i * 4) + 2); } + /* + * Kind of kludge this. Comm-slot cards do not really + * have a visible type, as far as I can tell at this time, + * so assume that MacOS had it properly configured and use + * that configuration. + */ + switch (current_mac_model->machineid) { + case MACH_MACLC575: + case MACH_MACP580: + case MACH_MACQ630: + NIC_PUT(sc, SNR_CR, CR_RST); wbflush(); + i = NIC_GET(sc, SNR_DCR); + sc->snr_dcr |= (i & 0xfff0); + sc->bitmode = (i & DCR_DW) ? 1 : 0; + break; + default: + break; + } + if (sn_obio_getaddr(sc, myaddr) && sn_obio_getaddr_kludge(sc, myaddr)) { /* XXX kludge for PB */ printf(": failed to get MAC address.\n"); @@ -136,6 +173,8 @@ sn_obio_attach(parent, self, aux) return; } + printf(": integrated ethernet adapter, "); + /* snsetup returns 1 if something fails */ if (snsetup(sc, myaddr)) { bus_space_unmap(sc->sc_regt, sc->sc_regh, SN_REGSIZE); diff --git a/sys/arch/mac68k/dev/if_snvar.h b/sys/arch/mac68k/dev/if_snvar.h index 7c418932a81..7e8b43eb24b 100644 --- a/sys/arch/mac68k/dev/if_snvar.h +++ b/sys/arch/mac68k/dev/if_snvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_snvar.h,v 1.10 2002/03/14 01:26:35 millert Exp $ */ +/* $OpenBSD: if_snvar.h,v 1.11 2002/04/22 20:15:55 miod Exp $ */ /* $NetBSD: if_snvar.h,v 1.8 1997/04/25 03:40:09 briggs Exp $ */ /* @@ -18,6 +18,7 @@ #define SN_VENDOR_APPLE 0x00 /* Apple Computer/compatible */ #define SN_VENDOR_DAYNA 0x01 /* Dayna/Kinetics EtherPort */ #define SN_VENDOR_APPLE16 0x02 /* Apple Twisted Pair Ether NB */ +#define SN_VENDOR_ASANTELC 0x09 /* Asante Macintosh LC Ethernet */ /* * Memory access macros. Since we handle SONIC in 16 bit mode (PB5X0) @@ -63,10 +64,10 @@ extern int kvtop(caddr_t addr); * total space in page 0 = NTDA * 92 + NRRA * 16 + NRDA * 28 + 68 */ -#define NRBA 8 /* # receive buffers < NRRA */ +#define NRBA 32 /* # receive buffers < NRRA */ #define RBAMASK (NRBA-1) -#define NTDA 8 /* # transmit descriptors */ -#define NRRA 16 /* # receive resource descriptors */ +#define NTDA 16 /* # transmit descriptors */ +#define NRRA 64 /* # receive resource descriptors */ #define RRAMASK (NRRA-1) /* the reason why NRRA must be power of two */ #define FCSSIZE 4 /* size of FCS appended to packets */ diff --git a/sys/arch/mac68k/dev/nubus.h b/sys/arch/mac68k/dev/nubus.h index d83d7b61745..ecb043ab39c 100644 --- a/sys/arch/mac68k/dev/nubus.h +++ b/sys/arch/mac68k/dev/nubus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nubus.h,v 1.17 2002/03/14 01:26:35 millert Exp $ */ +/* $OpenBSD: nubus.h,v 1.18 2002/04/22 20:15:55 miod Exp $ */ /* $NetBSD: nubus.h,v 1.25 1997/05/02 00:54:28 briggs Exp $ */ /* @@ -80,6 +80,7 @@ #define NUBUS_DRHW_INTERLAN 0x0100 #define NUBUS_DRHW_KINETICS 0x0106 #define NUBUS_DRHW_CABLETRON 0x0109 +#define NUBUS_DRHW_ASANTE_LC 0x010F #define NUBUS_DRHW_SONIC 0x0110 #define NUBUS_DRHW_APPLE_SNT 0x0118 #define NUBUS_DRHW_APPLE_SN 0x0119 |