/* Probe for TDK LAK-AX031, which is an SSi 78Q8377A based board. */ static int fe_probe_ssi(device_t dev) { struct fe_softc *sc = device_get_softc(dev); u_long iobase, irq; u_char eeprom [SSI_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { { FE_DLCR2, 0x08, 0x00 }, { FE_DLCR4, 0x08, 0x00 }, { 0 } }; /* See if the specified I/O address is possible for 78Q8377A. */ if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) return ENXIO; if ((iobase & ~0x3F0) != 0x000) return ENXIO; /* We have 16 registers. */ if (fe_alloc_port(dev, 16)) return ENXIO; /* Fill the softc struct with default values. */ fe_softc_defaults(sc); /* See if the card is on its address. */ if (!fe_simple_probe(sc, probe_table)) return ENXIO; /* We now have to read the config EEPROM. We should be very careful, since doing so destroys a register. (Remember, we are not yet sure we have a LAK-AX031 board here.) Don't remember to select BMPRs bofore reading EEPROM, since other register bank may be selected before the probe() is called. */ fe_read_eeprom_ssi(sc, eeprom); /* Make sure the Ethernet (MAC) station address is of TDK's. */ if (!fe_valid_Ether_p(eeprom+FE_SSI_EEP_ADDR, 0x008098)) return ENXIO; bcopy(eeprom + FE_SSI_EEP_ADDR, sc->enaddr, ETHER_ADDR_LEN); /* This looks like a TDK-AX031 board. It requires an explicit IRQ setting in config, since we currently don't know how we can find the IRQ value assigned by ISA PnP manager. */ if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { fe_irq_failure("LAK-AX031", sc->sc_unit, NO_IRQ, NULL); return ENXIO; } /* Fill softc struct accordingly. */ sc->type = FE_TYPE_SSI; sc->typestr = "LAK-AX031"; sc->mbitmap = MB_HT; sc->defmedia = MB_HT; return 0; }
/* * Probe for Contec C-NET(98)P2 series. * (Logitec LAN-98TP/LAN-98T25P - parhaps) */ static int fe_probe_ssi(device_t dev) { struct fe_softc *sc = device_get_softc(dev); rman_res_t iobase, irq; u_char eeprom [SSI_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { { FE_DLCR2, 0x08, 0x00 }, { FE_DLCR4, 0x08, 0x00 }, { 0 } }; static u_short const irqmap[] = { /* INT0 INT1 INT2 */ NO_IRQ, NO_IRQ, NO_IRQ, 3, NO_IRQ, 5, 6, NO_IRQ, NO_IRQ, 9, 10, NO_IRQ, 12, 13, NO_IRQ, NO_IRQ, /* INT3 INT41 INT5 INT6 */ }; /* See if the specified I/O address is possible for 78Q8377A. */ /* [0-D]3D0 are allowed. */ if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) return ENXIO; if ((iobase & 0xFFF) != 0x3D0) return ENXIO; if (fe98_alloc_port(dev, FE_TYPE_SSI)) return ENXIO; /* Fill the softc struct with default values. */ fe_softc_defaults(sc); /* See if the card is on its address. */ if (!fe_simple_probe(sc, probe_table)) return ENXIO; /* We now have to read the config EEPROM. We should be very careful, since doing so destroys a register. (Remember, we are not yet sure we have a C-NET(98)P2 board here.) Don't remember to select BMPRs bofore reading EEPROM, since other register bank may be selected before the probe() is called. */ fe_read_eeprom_ssi(sc, eeprom); /* Make sure the Ethernet (MAC) station address is of Contec's. */ if (!fe_valid_Ether_p(eeprom + FE_SSI_EEP_ADDR, 0x00804C)) return ENXIO; bcopy(eeprom + FE_SSI_EEP_ADDR, sc->enaddr, ETHER_ADDR_LEN); /* Setup the board type. */ sc->typestr = "C-NET(98)P2"; /* Non-PnP mode, set static resource from eeprom. */ if (!isa_get_vendorid(dev)) { /* Get IRQ configuration from EEPROM. */ irq = irqmap[eeprom[FE_SSI_EEP_IRQ]]; if (irq == NO_IRQ) { fe_irq_failure(sc->typestr, sc->sc_unit, irq, "3/5/6/9/10/12/13"); return ENXIO; } bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); } /* Get Duplex-mode configuration from EEPROM. */ sc->proto_dlcr4 |= (eeprom[FE_SSI_EEP_DUPLEX] & FE_D4_DSC); /* Fill softc struct accordingly. */ sc->mbitmap = MB_HT; sc->defmedia = MB_HT; return 0; }