summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mac68k/dev/if_ae.c12
-rw-r--r--sys/arch/mac68k/dev/if_ae_nubus.c49
-rw-r--r--sys/arch/mac68k/dev/if_aevar.h34
3 files changed, 63 insertions, 32 deletions
diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c
index 4e7766bc0ad..c465815e18b 100644
--- a/sys/arch/mac68k/dev/if_ae.c
+++ b/sys/arch/mac68k/dev/if_ae.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_ae.c,v 1.10 1997/03/08 16:16:52 briggs Exp $ */
-/* $NetBSD: if_ae.c,v 1.57 1997/03/04 15:12:04 scottr Exp $ */
+/* $OpenBSD: if_ae.c,v 1.11 1997/03/25 04:58:43 briggs Exp $ */
+/* $NetBSD: if_ae.c,v 1.60 1997/03/19 08:04:38 scottr Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -12,9 +12,6 @@
* the above copyright and these terms are retained. Under no circumstances is
* the author responsible for the proper functioning of this software, nor does
* the author assume any responsibility for damages incurred with its use.
- *
- * Adapted for MacBSD by Brad Parker <brad@fcr.com>.
- *
*/
#include "bpfilter.h"
@@ -66,13 +63,12 @@ static inline int ae_ring_copy __P(( struct ae_softc *, int, caddr_t, int));
#define ETHER_ADDR_LEN 6
-#define REG_MAP(sc, reg) ((sc)->regs_rev ? (0x0f-(reg))<<2 : (reg)<<2)
#define NIC_GET(sc, reg) (bus_space_read_1((sc)->sc_regt, \
(sc)->sc_regh, \
- (REG_MAP(sc, reg))))
+ ((sc)->sc_reg_map[reg])))
#define NIC_PUT(sc, reg, val) (bus_space_write_1((sc)->sc_regt, \
(sc)->sc_regh, \
- (REG_MAP(sc, reg)), (val)))
+ ((sc)->sc_reg_map[reg]), (val)))
struct cfdriver ae_cd = {
NULL, "ae", DV_IFNET
diff --git a/sys/arch/mac68k/dev/if_ae_nubus.c b/sys/arch/mac68k/dev/if_ae_nubus.c
index 9c65f228056..856057d9847 100644
--- a/sys/arch/mac68k/dev/if_ae_nubus.c
+++ b/sys/arch/mac68k/dev/if_ae_nubus.c
@@ -1,5 +1,5 @@
-/* $NetBSD: if_ae_nubus.c,v 1.9 1997/03/17 20:26:01 scottr Exp $ */
-/* $OpenBSD: if_ae_nubus.c,v 1.3 1997/03/18 01:02:50 briggs Exp $ */
+/* $NetBSD: if_ae_nubus.c,v 1.11 1997/03/19 08:04:39 scottr Exp $ */
+/* $OpenBSD: if_ae_nubus.c,v 1.4 1997/03/25 04:58:43 briggs Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@@ -31,6 +31,18 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * Some parts are derived from code adapted for MacBSD by Brad Parker
+ * <brad@fcr.com>.
+ *
+ * Currently supports:
+ * Apple NB Ethernet Card
+ * Apple NB Ethernet Card II
+ * Interlan A310 NuBus Ethernet card
+ * Cayman Systems GatorCard
+ * Asante MacCon II/E
+ * Kinetics EtherPort SE/30
+ */
#include <sys/param.h>
#include <sys/device.h>
@@ -59,7 +71,9 @@ static int ae_nubus_match __P((struct device *, void *, void *));
static void ae_nubus_attach __P((struct device *, struct device *, void *));
static int ae_nb_card_vendor __P((struct nubus_attach_args *));
static int ae_nb_get_enaddr __P((struct nubus_attach_args *, u_int8_t *));
+#ifdef DEBUG
static void ae_nb_watchdog __P((struct ifnet *));
+#endif
struct cfattach ae_nubus_ca = {
sizeof(struct ae_softc), ae_nubus_match, ae_nubus_attach
@@ -115,7 +129,9 @@ ae_nubus_attach(parent, self, aux)
{
struct ae_softc *sc = (struct ae_softc *) self;
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
+#ifdef DEBUG
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+#endif
bus_space_tag_t bst;
bus_space_handle_t bsh;
int i,success;
@@ -129,7 +145,6 @@ ae_nubus_attach(parent, self, aux)
sc->sc_regt = sc->sc_buft = bst;
sc->sc_flags = self->dv_cfdata->cf_flags;
- sc->regs_rev = 0;
sc->use16bit = 1;
sc->vendor = ae_nb_card_vendor(na);
strncpy(sc->type_str, nubus_get_card_name(na->fmt),
@@ -142,7 +157,10 @@ ae_nubus_attach(parent, self, aux)
switch (sc->vendor) {
case AE_VENDOR_APPLE: /* Apple-compatible cards */
case AE_VENDOR_ASANTE:
- sc->regs_rev = 1;
+ /* Map register offsets */
+ for (i = 0; i < 16; i++) /* reverse order, longword aligned */
+ sc->sc_reg_map[i] = (15 - i) << 2;
+
if (bus_space_subregion(bst, bsh,
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
@@ -174,6 +192,10 @@ ae_nubus_attach(parent, self, aux)
break;
case AE_VENDOR_DAYNA:
+ /* Map register offsets */
+ for (i = 0; i < 16; i++) /* normal order, longword aligned */
+ sc->sc_reg_map[i] = i << 2;
+
if (bus_space_subregion(bst, bsh,
DP_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
@@ -201,7 +223,10 @@ ae_nubus_attach(parent, self, aux)
break;
case AE_VENDOR_FARALLON:
- sc->regs_rev = 1;
+ /* Map register offsets */
+ for (i = 0; i < 16; i++) /* reverse order, longword aligned */
+ sc->sc_reg_map[i] = (15 - i) << 2;
+
if (bus_space_subregion(bst, bsh,
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
@@ -232,6 +257,10 @@ ae_nubus_attach(parent, self, aux)
break;
case AE_VENDOR_INTERLAN:
+ /* Map register offsets */
+ for (i = 0; i < 16; i++) /* normal order, longword aligned */
+ sc->sc_reg_map[i] = i << 2;
+
if (bus_space_subregion(bst, bsh,
GC_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
@@ -263,6 +292,10 @@ ae_nubus_attach(parent, self, aux)
break;
case AE_VENDOR_KINETICS:
+ /* Map register offsets */
+ for (i = 0; i < 16; i++) /* normal order, longword aligned */
+ sc->sc_reg_map[i] = i << 2;
+
sc->use16bit = 0;
if (bus_space_subregion(bst, bsh,
KE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
@@ -296,7 +329,9 @@ ae_nubus_attach(parent, self, aux)
return;
}
+#ifdef DEBUG
ifp->if_watchdog = ae_nb_watchdog; /* Override watchdog */
+#endif
if (aesetup(sc)) {
bus_space_unmap(bst, bsh, NBMEMSIZE);
return;
@@ -376,23 +411,23 @@ ae_nb_get_enaddr(na, ep)
return 0;
}
+#ifdef DEBUG
static void
ae_nb_watchdog(ifp)
struct ifnet *ifp;
{
struct ae_softc *sc = ifp->if_softc;
-#if 1
/*
* This is a kludge! The via code seems to miss slot interrupts
* sometimes. This kludges around that by calling the handler
* by hand if the watchdog is activated. -- XXX (akb)
*/
(*via2itab[1])((void *) 1);
-#endif
log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
++sc->sc_arpcom.ac_if.if_oerrors;
aereset(sc);
}
+#endif
diff --git a/sys/arch/mac68k/dev/if_aevar.h b/sys/arch/mac68k/dev/if_aevar.h
index 2edf6c690a1..1db6ecc1c7c 100644
--- a/sys/arch/mac68k/dev/if_aevar.h
+++ b/sys/arch/mac68k/dev/if_aevar.h
@@ -1,4 +1,5 @@
-/* $NetBSD: if_aevar.h,v 1.5 1997/02/28 08:56:07 scottr Exp $ */
+/* $NetBSD: if_aevar.h,v 1.7 1997/03/19 08:04:40 scottr Exp $ */
+/* $OpenBSD: if_aevar.h,v 1.2 1997/03/25 04:58:44 briggs Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -27,32 +28,31 @@ struct ae_softc {
bus_space_tag_t sc_buft; /* Buffer space tag */
bus_space_handle_t sc_bufh; /* Buffer space handle */
+ bus_size_t sc_reg_map[16]; /* register map (offsets) */
+
/* struct intrhand sc_ih; */
struct arpcom sc_arpcom;/* ethernet common */
int sc_flags; /* interface flags, from config */
char type_str[INTERFACE_NAME_LEN]; /* type string */
- u_short type; /* interface type code */
- u_char vendor; /* interface vendor */
- u_char regs_rev; /* registers are reversed */
- u_char use16bit; /* use word-width transfers */
-
- u_char cr_proto; /* values always set in CR */
+ u_int type; /* interface type code */
+ u_int vendor; /* interface vendor */
+ u_int use16bit; /* use word-width transfers */
+ u_int8_t cr_proto; /* values always set in CR */
int mem_size; /* total shared memory size */
int mem_ring; /* start of RX ring-buffer (in smem) */
- u_char txb_cnt; /* Number of transmit buffers */
- u_char txb_inuse; /* number of transmit buffers active */
-
- u_char txb_new; /* pointer to where new buffer will be added */
- u_char txb_next_tx; /* pointer to next buffer ready to xmit */
- u_short txb_len[8]; /* buffered xmit buffer lengths */
- u_char tx_page_start; /* first page of TX buffer area */
- u_char rec_page_start; /* first page of RX ring-buffer */
- u_char rec_page_stop; /* last page of RX ring-buffer */
- u_char next_packet; /* pointer to next unread RX packet */
+ u_short txb_cnt; /* Number of transmit buffers */
+ u_short txb_inuse; /* Number of transmit buffers active */
+ u_short txb_new; /* pointer to where new buffer will be added */
+ u_short txb_next_tx; /* pointer to next buffer ready to xmit */
+ u_short txb_len[8]; /* buffered xmit buffer lengths */
+ u_short tx_page_start; /* first page of TX buffer area */
+ u_short rec_page_start; /* first page of RX ring-buffer */
+ u_short rec_page_stop; /* last page of RX ring-buffer */
+ u_short next_packet; /* pointer to next unread RX packet */
};
int ae_size_card_memory __P((