Split SMC chipset ARCnet driver into

- machine independent chip driver, in dev/ic/smc90cx6.c/...reg.h,...var.h,
  using bus_space methods
- ZBUS frontend in arch/amiga/dev/if_bah_zbus.c
- added IPL_SOFTNET to arch/amiga/include/intr.h, for this
Implementing the ISA bus frontend is left as an exercise to the reader.
This commit is contained in:
is 1998-09-02 22:32:06 +00:00
parent 016aaad0ba
commit a3ee69c87a
8 changed files with 538 additions and 1814 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.amiga,v 1.75 1998/08/10 18:53:31 is Exp $
# $NetBSD: files.amiga,v 1.76 1998/09/02 22:32:08 is Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@ -153,9 +153,8 @@ attach ed at zbus with ed_zbus
file arch/amiga/dev/if_ed.c ed_zbus needs-flag
# C=/Ameristar A2060 / 560
device bah: ifnet, arc, arp
attach bah at zbus with bah_zbus
file arch/amiga/dev/if_bah.c bah_zbus needs-flag
file arch/amiga/dev/if_bah_zbus.c bah_zbus
# CEI A4066 EthernetPLUS
device es: ifnet, ether, arp

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,152 @@
/* $NetBSD: if_bah_zbus.c,v 1.1 1998/09/02 22:32:06 is Exp $ */
/*
* Copyright (c) 1994, 1995, 1998 Ignatios Souvatzis
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Ignatios Souvatzis
* for the NetBSD Project.
* 4. 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.
*/
/*
* Driver frontend for the Commodore Busines Machines and the
* Ameristar ARCnet card.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
#include <net/if.h>
#include <net/route.h>
#include <net/if_arc.h>
#include <amiga/amiga/device.h>
#include <amiga/dev/zbusvar.h>
#include <dev/ic/smc90cx6var.h>
/*
* A2060 software status per interface
*/
struct bah_zbus_softc {
struct bah_softc sc_bah;
struct bus_space_tag sc_bst;
struct isr sc_isr;
};
int bah_zbus_match __P((struct device *, struct cfdata *, void *));
void bah_zbus_attach __P((struct device *, struct device *, void *));
void bah_zbus_reset __P((struct bah_softc *, int));
struct cfattach bah_zbus_ca = {
sizeof(struct bah_zbus_softc), bah_zbus_match, bah_zbus_attach
};
int
bah_zbus_match(parent, cfp, aux)
struct device *parent;
struct cfdata *cfp;
void *aux;
{
struct zbus_args *zap = aux;
if ((zap->manid == 514 || zap->manid == 1053) && zap->prodid == 9)
return (1);
return (0);
}
void
bah_zbus_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct bah_zbus_softc *bsc = (void *)self;
struct bah_softc *sc = &bsc->sc_bah;
struct zbus_args *zap = aux;
#if (defined(BAH_DEBUG) && (BAH_DEBUG > 2))
printf("\n%s: attach(0x%x, 0x%x, 0x%x)\n",
sc->sc_dev.dv_xname, parent, self, aux);
#endif
bsc->sc_bst.base = (bus_addr_t)zap->va;
bsc->sc_bst.stride = 1;
sc->sc_bst_r = &bsc->sc_bst;
sc->sc_regs = bsc->sc_bst.base + 0x4000;
sc->sc_bst_m = &bsc->sc_bst;
sc->sc_mem = bsc->sc_bst.base + 0x8000;
sc->sc_reset = bah_zbus_reset;
bah_attach_subr(sc);
bsc->sc_isr.isr_intr = bahintr;
bsc->sc_isr.isr_arg = sc;
bsc->sc_isr.isr_ipl = 2;
add_isr(&bsc->sc_isr);
}
void
bah_zbus_reset(sc, onoff)
struct bah_softc *sc;
int onoff;
{
struct bah_zbus_softc *bsc;
volatile u_int8_t *p;
bsc = (struct bah_zbus_softc *)sc;
p = (volatile u_int8_t *)bsc->sc_bst.base;
p[0x0000] = 0; /* A2060 reset flipflop */
p[0xc000] = 0; /* A560 reset flipflop */
p[12228] = 0; /* unknown magic */
if (!onoff)
return;
DELAY(200);
p[0x0000] = 0xff;
p[0xc000] = 0xff;
p[12228] = 0xff;
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.5 1998/07/18 21:27:27 is Exp $ */
/* $NetBSD: intr.h,v 1.6 1998/09/02 22:32:07 is Exp $ */
/*
* Copyright (c) 1997 Ignatios Souvatzis.
@ -47,6 +47,7 @@
#define __GENERIC_SOFT_INTERRUPTS
#define IPL_SOFTSERIAL 1
#define IPL_SOFTNET 1
#ifdef splaudio
#undef splaudio

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.241 1998/09/02 18:15:20 drochner Exp $
# $NetBSD: files,v 1.242 1998/09/02 22:32:09 is Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -276,6 +276,10 @@ define i2c_eeprom
device esh: hippi, ifnet
file dev/ic/rrunner.c esh
# SMC 90c26, SMC 90C56 (and 90C66 if in compat mode) chip driver
device bah: ifnet, arc, arp
file dev/ic/smc90cx6.c bah
# OPL2/OPL3 FM synth driver
device opl: midibus, midisyn
file dev/ic/opl.c opl

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* $NetBSD: smc90cx6reg.h,v 1.4 1995/06/07 00:16:59 cgd Exp $ */
/* $NetBSD: smc90cx6reg.h,v 1.5 1998/09/02 22:32:08 is Exp $ */
/*
* Copyright (c) 1994, 1995 Ignatios Souvatzis
* Copyright (c) 1994, 1995, 1998 Ignatios Souvatzis
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,51 +32,32 @@
*/
/*
* The A2060/A560 card use the SMC COM90C26 Arcnet chipset.
* First or last 16k segment, resp., write a fifo which drives the reset line.
* 2nd 16k segment contains the registers.
* 3rd 16k segment contains the buffer RAM.
* All are only accessible at even addresses.
* chip offsets and bits for the SMC Arcnet chipset.
*/
/* CBM Arcnet board */
#define MANUFACTURER_1 514
#define PRODUCT_1 9
#ifndef _SMC90CXVAR_H_
#define _SMC90CXVAR_H_
/* Ameristar board */
#define MANUFACTURER_2 1053
#define PRODUCT_2 9
/* register offsets */
struct a2060 {
volatile u_int8_t kick1;
u_int8_t pad1[16383];
volatile u_int8_t status; /* also intmask */
u_int8_t pad2;
volatile u_int8_t command;
u_int8_t pad3[16381];
volatile u_int8_t buffers[4096]; /* even bytes only */
u_int8_t pad4[12228];
volatile u_int8_t kick2;
u_int8_t pad5[16383];
};
#define BAHSTAT 0
#define BAHCMD 1
#define checkbyte buffers[0]
#define dipswitches buffers[2]
/* memory offsets */
#define BAHCHECKBYTE 0
#define BAHMACOFF 1
/* calculate address for board b, buffer no n and offset o */
#define BUFPTR(b,n,o) (&(b)->buffers[(n)*512+(o)*2])
#define BAH_TXDIS 0x01
#define BAH_RXDIS 0x02
#define BAH_TX(x) (0x03 | ((x)<<3))
#define BAH_RX(x) (0x04 | ((x)<<3))
#define BAH_RXBC(x) (0x84 | ((x)<<3))
#define ARC_TXDIS 0x01
#define ARC_RXDIS 0x02
#define ARC_TX(x) (0x03 | ((x)<<3))
#define ARC_RX(x) (0x04 | ((x)<<3))
#define ARC_RXBC(x) (0x84 | ((x)<<3))
#define ARC_CONF(x) (0x05 | (x))
#define BAH_CONF(x) (0x05 | (x))
#define CLR_POR 0x08
#define CLR_RECONFIG 0x10
#define ARC_CLR(x) (0x06 | (x))
#define BAH_CLR(x) (0x06 | (x))
#define CONF_LONG 0x08
#define CONF_SHORT 0x00
@ -85,15 +66,17 @@ struct a2060 {
* packet driver by Philippe Prindeville and Russel Nelson.
*/
#define ARC_LDTST(x) (0x07 | (x))
#define BAH_LDTST(x) (0x07 | (x))
#define TEST_ON 0x08
#define TEST_OFF 0x00
#define ARC_TA 1 /* int mask also */
#define ARC_TMA 2
#define ARC_RECON 4 /* int mask also */
#define ARC_TEST 8 /* not in the COM90C65 docs (see above) */
#define ARC_POR 0x10 /* non maskable interrupt */
#define ARC_ET1 0x20 /* timeout value bits, normally 1 */
#define ARC_ET2 0x40 /* timeout value bits, normally 1 */
#define ARC_RI 0x80 /* int mask also */
#define BAH_TA 1 /* int mask also */
#define BAH_TMA 2
#define BAH_RECON 4 /* int mask also */
#define BAH_TEST 8 /* not in the COM90C65 docs (see above) */
#define BAH_POR 0x10 /* non maskable interrupt */
#define BAH_ET1 0x20 /* timeout value bits, normally 1 */
#define BAH_ET2 0x40 /* timeout value bits, normally 1 */
#define BAH_RI 0x80 /* int mask also */
#endif

74
sys/dev/ic/smc90cx6var.h Normal file
View File

@ -0,0 +1,74 @@
/* $NetBSD: smc90cx6var.h,v 1.1 1998/09/02 22:32:08 is Exp $ */
/*
* Copyright (c) 1994, 1995, 1998 Ignatios Souvatzis
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Ignatios Souvatzis
* for the NetBSD project.
* 4. 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.
*/
/*
* BAH (SMC 8bit ARCnet chipset) k/dpi
*
* The SMC 8bit ARCnet chip family uses a register and a memory window, which
* we get passed via bus_space_tags and bus_space_handles.
*
* As the reset functionality differs between the Amiga boards (using the
* 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have
* a sc_reset callback function in the softc, which does a stop function
* (reset and leave dead) or a reset function depending on wether the 2nd
* parameter is 0 or 1.
*/
#ifndef _SMC90CX6VAR_H_
#define _SMC90CX6VAR_H_
struct bah_softc {
struct device sc_dev;
struct arccom sc_arccom; /* Common arcnet structures */
bus_space_tag_t sc_bst_r, sc_bst_m;
bus_space_handle_t sc_regs, sc_mem;
void (*sc_reset)(struct bah_softc *, int);
void *sc_softcookie;
u_long sc_recontime; /* seconds only, I'm lazy */
u_long sc_reconcount; /* for the above */
u_long sc_reconcount_excessive; /* for the above */
#define ARC_EXCESSIVE_RECONS 20
#define ARC_EXCESSIVE_RECONS_REWARN 400
u_char sc_intmask;
u_char sc_rx_act; /* 2..3 */
u_char sc_tx_act; /* 0..1 */
u_char sc_rx_fillcount;
u_char sc_tx_fillcount;
u_char sc_broadcast[2]; /* is it a broadcast packet? */
u_char sc_retransmits[2]; /* unused at the moment */
};
void bah_attach_subr __P((struct bah_softc *));
int bahintr __P((void *));
#endif