diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-12-30 21:26:00 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-12-30 21:26:00 +0000 |
commit | 2ed697547073dec8aea87c7a3af2d1fbdca542cf (patch) | |
tree | b433fb3d2d79c0a3df2c782afe25a67844f03eef /sys | |
parent | 4d47f7dde4343a1b90cd53d39aa77b3e7b09313c (diff) |
Add support for all six Motorola-supported configurations of MVME376
cards. The original code would only work with the first configuration,
as the etherbuf addresses grow _downwards_ from 0xfd6c0000 with Motorola's
jumper configuration.
Reference: MVME376 Ethernet Communication Controller User's Manual (MVME376/D1)
While there, do not panic() on failure to attach, but simply print an
error message and return.
XXX Proper care of the memory mapping still needs to be written, as the memory
XXX space of the MVME376 is always outside extio.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mvme68k/dev/if_le.c | 58 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/if_lereg.h | 5 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_le.c | 42 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_lereg.h | 5 |
4 files changed, 73 insertions, 37 deletions
diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c index 9c32e6ca765..d86e2781723 100644 --- a/sys/arch/mvme68k/dev/if_le.c +++ b/sys/arch/mvme68k/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.24 2003/10/14 19:23:11 miod Exp $ */ +/* $OpenBSD: if_le.c,v 1.25 2003/12/30 21:25:58 miod Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -299,6 +299,7 @@ leattach(parent, self, aux) int pri = ca->ca_ipl; extern void *etherbuf; caddr_t addr; + int card; /* XXX the following declarations should be elsewhere */ extern void myetheraddr(u_char *); @@ -312,37 +313,55 @@ leattach(parent, self, aux) switch (lebustype) { case BUS_VMES: /* - * get the first available etherbuf. MVME376 uses its own dual-ported - * RAM for etherbuf. It is set by dip switches on board. We support - * the four Motorola address locations, however, the board can be set up - * at any other address. We must map this space into the extio map. - * XXX-smurph. + * get the first available etherbuf. MVME376 uses its own + * dual-ported RAM for etherbuf. It is set by dip switches + * on board. We support the six Motorola address locations, + * however, the board can be set up at any other address. + * XXX These physical addresses should be mapped in extio!!! */ switch ((int)ca->ca_paddr) { - case 0xFFFF1200: - addr = (caddr_t)0xFD6C0000; + case 0xffff1200: + card = 0; break; - case 0xFFFF1400: - addr = (caddr_t)0xFD700000; + case 0xffff1400: + card = 1; break; - case 0xFFFF1600: - addr = (caddr_t)0xFD740000; + case 0xffff1600: + card = 2; break; - case 0xFFFFD200: - addr = (caddr_t)0xFD780000; + case 0xffff5400: + card = 3; + break; + case 0xffff5600: + card = 4; + break; + case 0xffffa400: + card = 5; break; default: - panic("le: invalid address"); + printf(": unsupported address\n"); + return; } + + addr = (caddr_t)(VLEMEMBASE - (card * VLEMEMSIZE)); + sc->sc_mem = (void *)mapiodev(addr, VLEMEMSIZE); - if (sc->sc_mem == NULL) - panic("le: no more memory in external I/O map"); + if (sc->sc_mem == NULL) { + printf("\n%s: no more memory in external I/O map\n", + sc->sc_dev.dv_xname); + return; + } + sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); + if (sc->sc_addr == 0L) { + printf("\n%s: kvtop() failed!\n", sc->sc_dev.dv_xname); + return; + } + lesc->sc_r1 = (void *)ca->ca_vaddr; lesc->sc_ipl = ca->ca_ipl; lesc->sc_vec = ca->ca_vec; sc->sc_memsize = VLEMEMSIZE; sc->sc_conf3 = LE_C3_BSWP; - sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); sc->sc_hwreset = vlereset; sc->sc_rdcsr = vlerdcsr; sc->sc_wrcsr = vlewrcsr; @@ -374,7 +393,8 @@ leattach(parent, self, aux) myetheraddr(sc->sc_arpcom.ac_enaddr); break; default: - panic("le: unknown bus type."); + printf(": unknown bus type\n"); + return; } evcnt_attach(&sc->sc_dev, "intr", &lesc->sc_intrcnt); evcnt_attach(&sc->sc_dev, "errs", &lesc->sc_errcnt); diff --git a/sys/arch/mvme68k/dev/if_lereg.h b/sys/arch/mvme68k/dev/if_lereg.h index df93aae91d6..d6b1f49832d 100644 --- a/sys/arch/mvme68k/dev/if_lereg.h +++ b/sys/arch/mvme68k/dev/if_lereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lereg.h,v 1.7 2003/06/02 23:27:50 millert Exp $ */ +/* $OpenBSD: if_lereg.h,v 1.8 2003/12/30 21:25:58 miod Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -41,7 +41,8 @@ struct lereg1 { volatile u_int16_t ler1_rap; /* register select port */ }; -#define VLEMEMSIZE 0x40000 +#define VLEMEMSIZE 0x00040000 +#define VLEMEMBASE 0xfd6c0000 /* * LANCE registers for MVME376 diff --git a/sys/arch/mvme88k/dev/if_le.c b/sys/arch/mvme88k/dev/if_le.c index 767935a62f2..b2da2aeeaa2 100644 --- a/sys/arch/mvme88k/dev/if_le.c +++ b/sys/arch/mvme88k/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.2 2003/12/28 19:43:35 miod Exp $ */ +/* $OpenBSD: if_le.c,v 1.3 2003/12/30 21:25:59 miod Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -265,6 +265,7 @@ leattach(parent, self, aux) struct am7990_softc *sc = &lesc->sc_am7990; struct confargs *ca = aux; caddr_t addr; + int card; /* Are we the boot device? */ if (ca->ca_paddr == bootaddr) @@ -273,32 +274,46 @@ leattach(parent, self, aux) /* * get the first available etherbuf. MVME376 uses its own dual-ported * RAM for etherbuf. It is set by dip switches on board. We support - * the four Motorola address locations, however, the board can be set up - * at any other address. We must map this space into the extio map. - * XXX-smurph. + * the six Motorola address locations, however, the board can be set up + * at any other address. + * XXX These physical addresses should be mapped in extio!!! */ switch ((int)ca->ca_paddr) { - case 0xFFFF1200: - addr = (caddr_t)0xFD6C0000; + case 0xffff1200: + card = 0; break; - case 0xFFFF1400: - addr = (caddr_t)0xFD700000; + case 0xffff1400: + card = 1; break; - case 0xFFFF1600: - addr = (caddr_t)0xFD740000; + case 0xffff1600: + card = 2; break; - case 0xFFFFD200: - addr = (caddr_t)0xFD780000; + case 0xffff5400: + card = 3; + break; + case 0xffff5600: + card = 4; + break; + case 0xffffa400: + card = 5; break; default: printf(": unsupported address\n"); return; } + addr = (caddr_t)(VLEMEMBASE - (card * VLEMEMSIZE)); + sc->sc_mem = (void *)mapiodev(addr, VLEMEMSIZE); if (sc->sc_mem == NULL) { - printf("\n%s: no more memory in external I/O map", + printf("\n%s: no more memory in external I/O map\n", sc->sc_dev.dv_xname); + return; + } + sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); + if (sc->sc_addr == 0L) { + printf("\n%s: kvtop() failed!\n", sc->sc_dev.dv_xname); + return; } lesc->sc_r1 = (void *)ca->ca_vaddr; @@ -306,7 +321,6 @@ leattach(parent, self, aux) lesc->sc_vec = ca->ca_vec; sc->sc_memsize = VLEMEMSIZE; sc->sc_conf3 = LE_C3_BSWP; - sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); sc->sc_hwreset = vlereset; sc->sc_rdcsr = vlerdcsr; sc->sc_wrcsr = vlewrcsr; diff --git a/sys/arch/mvme88k/dev/if_lereg.h b/sys/arch/mvme88k/dev/if_lereg.h index a32b25b9368..360a1810430 100644 --- a/sys/arch/mvme88k/dev/if_lereg.h +++ b/sys/arch/mvme88k/dev/if_lereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lereg.h,v 1.1 2003/12/27 23:58:11 miod Exp $ */ +/* $OpenBSD: if_lereg.h,v 1.2 2003/12/30 21:25:59 miod Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -31,7 +31,8 @@ * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 */ -#define VLEMEMSIZE 0x40000 +#define VLEMEMSIZE 0x00040000 +#define VLEMEMBASE 0xfd6c0000 /* * LANCE registers for MVME376 |