diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-28 01:29:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-28 01:29:06 +0000 |
commit | a7c8e752e5b8d1597a5938edc012958093ea9c0d (patch) | |
tree | b50dae46693cf87cd65ddc3d58472570c8c52aa8 | |
parent | 2fc929187ba1806af5419803795db46991e7aaa2 (diff) |
first attempt at SMC EtherEZ (8416) on isapnp
-rw-r--r-- | sys/dev/isa/files.isa | 6 | ||||
-rw-r--r-- | sys/dev/isa/files.isapnp | 4 | ||||
-rw-r--r-- | sys/dev/isa/if_we.c | 58 |
3 files changed, 42 insertions, 26 deletions
diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa index ae8390bf79c..5df61fa8fc3 100644 --- a/sys/dev/isa/files.isa +++ b/sys/dev/isa/files.isa @@ -1,4 +1,4 @@ -# $OpenBSD: files.isa,v 1.46 1998/11/06 06:32:15 fgsch Exp $ +# $OpenBSD: files.isa,v 1.47 1998/11/28 01:29:05 deraadt Exp $ # $NetBSD: files.isa,v 1.21 1996/05/16 03:45:55 mycroft Exp $ # # Config.new file and device description for machine-independent ISA code. @@ -143,8 +143,8 @@ file dev/isa/wt.c wt needs-flag # MUST be first: probe is non invasive, and registers are clobbered # by other drivers's probe device we: ether, ifnet, dp8390nic, ifmedia -attach we at isa -file dev/isa/if_we.c we +attach we at isa with we_isa +file dev/isa/if_we.c we & (we_isa | we_isapnp) needs-flag # 3Com common probe code define elink diff --git a/sys/dev/isa/files.isapnp b/sys/dev/isa/files.isapnp index 548511d4d89..056584eb61b 100644 --- a/sys/dev/isa/files.isapnp +++ b/sys/dev/isa/files.isapnp @@ -1,4 +1,4 @@ -# $OpenBSD: files.isapnp,v 1.9 1998/11/06 06:32:15 fgsch Exp $ +# $OpenBSD: files.isapnp,v 1.10 1998/11/28 01:29:05 deraadt Exp $ # $NetBSD: files.isapnp,v 1.7 1997/10/16 17:16:36 matt Exp $ # # Config file and device description for machine-independent ISAPnP code. @@ -33,6 +33,8 @@ file dev/isa/if_ep_isapnp.c ep_isapnp attach ne at isapnp with ne_isapnp: rtl80x9 file dev/isa/if_ne_isapnp.c ne_isapnp +attach we at isapnp with we_isapnp + # Yamaha OPL3-SA3 device ym: audio, isa_dma, ad1848, auconv attach ym at isapnp with ym_isapnp diff --git a/sys/dev/isa/if_we.c b/sys/dev/isa/if_we.c index ed164e66bb1..648ef48edfe 100644 --- a/sys/dev/isa/if_we.c +++ b/sys/dev/isa/if_we.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_we.c,v 1.2 1998/10/04 22:28:14 niklas Exp $ */ +/* $OpenBSD: if_we.c,v 1.3 1998/11/28 01:29:05 deraadt Exp $ */ /* $NetBSD: if_we.c,v 1.11 1998/07/05 06:49:14 jonathan Exp $ */ /*- @@ -57,7 +57,9 @@ */ #include "bpfilter.h" +#include "we.h" +#define WE_DEBUG #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> @@ -132,10 +134,16 @@ struct we_softc { int we_probe __P((struct device *, void *, void *)); void we_attach __P((struct device *, struct device *, void *)); -struct cfattach we_ca = { +struct cfattach we_isa_ca = { sizeof(struct we_softc), we_probe, we_attach }; +#if NWE_ISAPNP +struct cfattach we_isapnp_ca = { + sizeof(struct we_softc), we_probe, we_attach +}; +#endif /* NWE_ISAPNP */ + #ifdef __NetBSD__ extern struct cfdriver we_cd; #else @@ -235,9 +243,13 @@ we_probe(parent, match, aux) return (0); /* Attempt to map the device. */ - if (bus_space_map(asict, ia->ia_iobase, WE_NPORTS, 0, &asich)) - goto out; - asich_valid = 1; + if (ia->ia_ioh) + asich = ia->ia_ioh; + else { + if (bus_space_map(asict, ia->ia_iobase, WE_NPORTS, 0, &asich)) + goto out; + asich_valid = 1; + } #ifdef TOSH_ETHER bus_space_write_1(asict, asich, WE_MSR, WE_MSR_POW); @@ -291,9 +303,13 @@ we_probe(parent, match, aux) memsize = ia->ia_msize; /* Attempt to map the memory space. */ - if (bus_space_map(memt, ia->ia_maddr, memsize, 0, &memh)) - goto out; - memh_valid = 1; + if (ia->ia_memh) + memh = ia->ia_memh; + else { + if (bus_space_map(memt, ia->ia_maddr, memsize, 0, &memh)) + goto out; + memh_valid = 1; + } /* * If possible, get the assigned interrupt number from the card @@ -358,29 +374,27 @@ we_attach(parent, self, aux) u_int8_t x; int i; - printf("\n"); - nict = asict = ia->ia_iot; memt = ia->ia_memt; /* Map the device. */ - if (bus_space_map(asict, ia->ia_iobase, WE_NPORTS, 0, &asich)) { - printf("%s: can't map nic i/o space\n", - sc->sc_dev.dv_xname); + if (ia->ia_ioh) + asich = ia->ia_ioh; + else if (bus_space_map(asict, ia->ia_iobase, WE_NPORTS, 0, &asich)) { + printf(": can't map nic i/o space\n"); return; } if (bus_space_subregion(asict, asich, WE_NIC_OFFSET, WE_NIC_NPORTS, &nich)) { - printf("%s: can't subregion i/o space\n", - sc->sc_dev.dv_xname); + printf(": can't subregion i/o space\n"); return; } typestr = we_params(asict, asich, &wsc->sc_type, NULL, &wsc->sc_16bitp, &sc->is790); if (typestr == NULL) { - printf("%s: where did the card go?\n", sc->sc_dev.dv_xname); + printf(": where did the card go?\n"); return; } @@ -388,9 +402,10 @@ we_attach(parent, self, aux) * Map memory space. Note we use the size that might have * been overridden by the user. */ - if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) { - printf("%s: can't map shared memory\n", - sc->sc_dev.dv_xname); + if (ia->ia_memh) + memh = ia->ia_memh; + else if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) { + printf(": can't map shared memory\n"); return; } @@ -420,8 +435,7 @@ we_attach(parent, self, aux) /* Now we can use the NIC_{GET,PUT}() macros. */ - printf("%s: %s Ethernet (%s-bit)\n", sc->sc_dev.dv_xname, - typestr, wsc->sc_16bitp ? "16" : "8"); + printf(": %s (%s-bit)\n", typestr, wsc->sc_16bitp ? "16" : "8"); /* Get station address from EEPROM. */ for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -429,7 +443,7 @@ we_attach(parent, self, aux) sc->sc_enaddr[i] = bus_space_read_1(asict, asich, WE_PROM + i); #else sc->sc_arpcom.ac_enaddr[i] = - bus_space_read_1(asict, asich, WE_PROM + i); + bus_space_read_1(asict, asich, WE_PROM + i); #endif /* |