diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-07 07:38:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-07 07:38:52 +0000 |
commit | a18dd829375e446ca22af98dc283f34da965edbc (patch) | |
tree | 0c5bbc9a1a0ce73f792bd62db356a18c8af92e32 /sys/dev/isa/if_ed.c | |
parent | c78ff01b45ca78d491b3e8db520c2cb877a273d4 (diff) |
sync with 0504 -- prototypes and bus.h
Diffstat (limited to 'sys/dev/isa/if_ed.c')
-rw-r--r-- | sys/dev/isa/if_ed.c | 98 |
1 files changed, 44 insertions, 54 deletions
diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c index db1654fb8fb..5435c1fcdc2 100644 --- a/sys/dev/isa/if_ed.c +++ b/sys/dev/isa/if_ed.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ed.c,v 1.13 1996/05/05 13:38:19 mickey Exp $ */ -/* $NetBSD: if_ed.c,v 1.93 1996/04/11 22:28:55 cgd Exp $ */ +/* $OpenBSD: if_ed.c,v 1.14 1996/05/07 07:36:47 deraadt Exp $ */ +/* $NetBSD: if_ed.c,v 1.96 1996/05/03 19:05:30 christos Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -375,8 +375,6 @@ edprobe(parent, match, aux) void *match, *aux; { struct ed_softc *sc = match; - struct cfdata *cf = sc->sc_dev.dv_cfdata; - struct isa_attach_args *ia = aux; return (ed_find(match, sc->sc_dev.dv_cfdata, aux)); } @@ -462,6 +460,10 @@ ed_find_WD80x3(sc, cf, ia) bc = ia->ia_bc; rv = 0; + /* Set initial values for width/size. */ + memsize = 8192; + isa16bit = 0; + if (bus_io_map(bc, ia->ia_iobase, ED_WD_IO_PORTS, &ioh)) return (0); @@ -511,9 +513,6 @@ ed_find_WD80x3(sc, cf, ia) sc->vendor = ED_VENDOR_WD_SMC; sc->type = bus_io_read_1(bc, ioh, asicbase + ED_WD_CARD_ID); - /* Set initial values for width/size. */ - memsize = 8192; - isa16bit = 0; switch (sc->type) { case ED_TYPE_WD8003S: sc->type_str = "WD8003S"; @@ -750,7 +749,7 @@ ed_find_WD80x3(sc, cf, ia) (sc->type == ED_TYPE_TOSHIBA1) || (sc->type == ED_TYPE_TOSHIBA4) || #endif - (sc->type == ED_TYPE_WD8013EBT) && !sc->is790) { + ((sc->type == ED_TYPE_WD8013EBT) && !sc->is790)) { sc->wd_laar_proto = ((ia->ia_maddr >> 19) & ED_WD_LAAR_ADDRHI); @@ -867,13 +866,19 @@ ed_find_3Com(sc, cf, ia) bus_chipset_tag_t bc; bus_io_handle_t ioh; bus_mem_handle_t memh; - int i, rv, mapped_mem = 0; + int i; u_int memsize; - u_char isa16bit, sum, x; + u_char isa16bit, x; int ptr, asicbase, nicbase; + /* + * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window + * to it. + */ + memsize = 8192; + + bc = ia->ia_bc; - rv = 0; if (bus_io_map(bc, ia->ia_iobase, ED_WD_IO_PORTS, &ioh)) return (0); @@ -891,28 +896,28 @@ ed_find_3Com(sc, cf, ia) */ x = bus_io_read_1(bc, ioh, asicbase + ED_3COM_BCFR); if (x == 0 || (x & (x - 1)) != 0) - goto out; + goto err; ptr = ffs(x) - 1; if (ia->ia_iobase != IOBASEUNK) { if (ia->ia_iobase != ed_3com_iobase[ptr]) { printf("%s: %s mismatch; kernel configured %x != board configured %x\n", "iobase", sc->sc_dev.dv_xname, ia->ia_iobase, ed_3com_iobase[ptr]); - goto out; + goto err; } } else ia->ia_iobase = ed_3com_iobase[ptr]; /* XXX --thorpej */ x = bus_io_read_1(bc, ioh, asicbase + ED_3COM_PCFR); if (x == 0 || (x & (x - 1)) != 0) - goto out; + goto err; ptr = ffs(x) - 1; if (ia->ia_maddr != MADDRUNK) { if (ia->ia_maddr != ed_3com_maddr[ptr]) { printf("%s: %s mismatch; kernel configured %x != board configured %x\n", "maddr", sc->sc_dev.dv_xname, ia->ia_maddr, ed_3com_maddr[ptr]); - goto out; + goto err; } } else ia->ia_maddr = ed_3com_maddr[ptr]; @@ -928,7 +933,7 @@ ed_find_3Com(sc, cf, ia) printf("%s: irq mismatch; kernel configured %d != board configured %d\n", sc->sc_dev.dv_xname, ia->ia_irq, ed_3com_irq[ptr]); - goto out; + goto err; } } else ia->ia_irq = ed_3com_irq[ptr]; @@ -961,12 +966,6 @@ ed_find_3Com(sc, cf, ia) sc->cr_proto = ED_CR_RD2; /* - * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window - * to it. - */ - memsize = 8192; - - /* * Get station address from on-board ROM. * * First, map ethernet address PROM over the top of where the NIC @@ -1012,8 +1011,7 @@ ed_find_3Com(sc, cf, ia) ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STP); if (bus_mem_map(bc, ia->ia_maddr, memsize, 0, &memh)) - goto out; - mapped_mem = 1; + goto err; sc->mem_start = 0; /* offset */ sc->mem_size = memsize; sc->mem_end = sc->mem_start + memsize; @@ -1113,24 +1111,21 @@ ed_find_3Com(sc, cf, ia) ia->ia_msize = memsize; ia->ia_iosize = ED_3COM_IO_PORTS; - rv = 1; - out: /* * XXX Sould always unmap, but we can't yet. * XXX Need to squish "indirect" first. */ - if (rv == 0) { - bus_io_unmap(bc, ioh, ED_3COM_IO_PORTS); - if (mapped_mem) - bus_mem_unmap(bc, memh, memsize); - } else { - /* XXX this is all "indirect" brokenness */ - sc->sc_bc = bc; - sc->sc_ioh = ioh; - sc->sc_memh = memh; - } - return (rv); + sc->sc_bc = bc; + sc->sc_ioh = ioh; + sc->sc_memh = memh; + return 1; + + out: + bus_mem_unmap(bc, memh, memsize); + err: + bus_io_unmap(bc, ioh, ED_3COM_IO_PORTS); + return 0; } /* @@ -1144,15 +1139,13 @@ ed_find_Novell(sc, cf, ia) { bus_chipset_tag_t bc; bus_io_handle_t ioh; - bus_mem_handle_t memh; u_int memsize, n; - u_char romdata[16], isa16bit = 0, tmp; + u_char romdata[16], tmp; static u_char test_pattern[32] = "THIS is A memory TEST pattern"; u_char test_buffer[32]; - int rv, asicbase, nicbase; + int asicbase, nicbase; bc = ia->ia_bc; - rv = 0; if (bus_io_map(bc, ia->ia_iobase, ED_NOVELL_IO_PORTS, &ioh)) return (0); @@ -1308,7 +1301,7 @@ ed_find_Novell(sc, cf, ia) if (mstart == 0) { printf("%s: cannot find start of RAM\n", sc->sc_dev.dv_xname); - goto out; + goto err; } /* Search for the end of RAM. */ @@ -1367,22 +1360,19 @@ ed_find_Novell(sc, cf, ia) NIC_PUT(bc, ioh, nicbase, ED_P0_ISR, 0xff); ia->ia_iosize = ED_NOVELL_IO_PORTS; - rv = 1; - out: /* * XXX Sould always unmap, but we can't yet. * XXX Need to squish "indirect" first. */ - if (rv == 0) - bus_io_unmap(bc, ioh, ED_NOVELL_IO_PORTS); - else { - /* XXX this is all "indirect" brokenness */ - sc->sc_bc = bc; - sc->sc_ioh = ioh; - sc->sc_memh = memh; - } - return (rv); + sc->sc_bc = bc; + sc->sc_ioh = ioh; + /* sc_memh is not used by this driver */ + return 1; + out: + bus_io_unmap(bc, ioh, ED_NOVELL_IO_PORTS); + + return 0; } /* @@ -1751,7 +1741,7 @@ edstart(ifp) struct mbuf *m0, *m; int buffer; int asicbase = sc->asic_base; - int len, i; + int len; if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) return; |