diff --git a/sys/dev/ed/if_ed_cbus.c b/sys/dev/ed/if_ed_cbus.c index 8181cb10c9b..30d49c141e4 100644 --- a/sys/dev/ed/if_ed_cbus.c +++ b/sys/dev/ed/if_ed_cbus.c @@ -124,8 +124,10 @@ ed_cbus_probe(device_t dev) * Allied Telesis CenterCom LA-98-T */ error = ed_probe_Novell(dev, 0, flags); - if (error == 0) + if (error == 0) { + ed_Novell_read_mac(sc); goto end; + } break; /* diff --git a/sys/dev/ed/if_ed_isa.c b/sys/dev/ed/if_ed_isa.c index 742789c5443..453fd1bd7b9 100644 --- a/sys/dev/ed/if_ed_isa.c +++ b/sys/dev/ed/if_ed_isa.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -65,8 +66,30 @@ static struct isa_pnp_id ed_ids[] = { }; static int -ed_isa_probe(dev) - device_t dev; +ed_isa_probe_Novell(device_t dev) +{ + struct ed_softc *sc = device_get_softc(dev); + int flags = device_get_flags(dev); + int err; + + err = ed_probe_Novell(dev, 0, flags); + if (err) + return err; + ed_Novell_read_mac(sc); + /* + * Final sanity check for Gateway Ethernet cards before + * believing that they really are Gateway AT. + */ + if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) && + (sc->arpcom.ac_enaddr[2] == 0x86)) { + sc->type_str = "Gateway AT"; + } + + return (0); +} + +static int +ed_isa_probe(device_t dev) { int flags = device_get_flags(dev); int error = 0; @@ -75,14 +98,12 @@ ed_isa_probe(dev) error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); /* If the card had a PnP ID that didn't match any we know about */ - if (error == ENXIO) { + if (error == ENXIO) goto end; - } /* If we had some other problem. */ - if (!(error == 0 || error == ENOENT)) { + if (!(error == 0 || error == ENOENT)) goto end; - } /* Heuristic probes */ @@ -104,7 +125,7 @@ ed_isa_probe(dev) goto end; ed_release_resources(dev); #endif - error = ed_probe_Novell(dev, 0, flags); + error = ed_isa_probe_Novell(dev); if (error == 0) goto end; ed_release_resources(dev); diff --git a/sys/dev/ed/if_ed_novell.c b/sys/dev/ed/if_ed_novell.c index 980ee05c19b..ff55a280d57 100644 --- a/sys/dev/ed/if_ed_novell.c +++ b/sys/dev/ed/if_ed_novell.c @@ -64,13 +64,13 @@ static int ed_probe_gwether(device_t); /* * Probe and vendor-specific initialization routine for NE1000/2000 boards */ -int +static int ed_probe_Novell_generic(device_t dev, int flags) { struct ed_softc *sc = device_get_softc(dev); - u_int memsize, n; + u_int memsize; int error; - u_char romdata[16], tmp; + u_char tmp; static char test_pattern[32] = "THIS is A memory TEST pattern"; char test_buffer[32]; @@ -192,16 +192,6 @@ ed_probe_Novell_generic(device_t dev, int flags) sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - - ed_pio_readmem(sc, 0, romdata, 16); - for (n = 0; n < ETHER_ADDR_LEN; n++) - sc->arpcom.ac_enaddr[n] = romdata[n * (sc->isa16bit + 1)]; - - if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) && - (sc->arpcom.ac_enaddr[2] == 0x86)) { - sc->type_str = "Gateway AT"; - } - /* clear any pending interrupts that might have occurred above */ ed_nic_outb(sc, ED_P0_ISR, 0xff); @@ -290,3 +280,18 @@ ed_probe_gwether(device_t dev) sc->tx_page_start = mstart / ED_PAGE_SIZE; return 0; } + +void +ed_Novell_read_mac(struct ed_softc *sc) +{ + int n; + uint8_t romdata[16]; + + /* + * Pull the MAC address out of the roms that are on the isa + * version of these cards. + */ + ed_pio_readmem(sc, 0, romdata, 16); + for (n = 0; n < ETHER_ADDR_LEN; n++) + sc->arpcom.ac_enaddr[n] = romdata[n * (sc->isa16bit + 1)]; +}