Move the harvesting of the MAC address out of the generic novell probe
and into the bus front ends. For ISA and C-BUS cards, we always need to grab it. For PC Card, already committed, we need to do some sanity checking on the data that's in the ROMs before we decide that they are OK to use. The PC Card code has already been committed and is independent of this code (which also has to work on NE-1000 cards, assuming that those cards still work :-).
This commit is contained in:
parent
16c52c1000
commit
206189067d
@ -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;
|
||||
|
||||
/*
|
||||
|
@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_mib.h>
|
||||
@ -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);
|
||||
|
@ -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)];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user