version 1.24.4.6, 2002/02/28 04:13:41 |
version 1.24.4.7, 2002/10/18 02:42:13 |
Line 49 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 49 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#include <dev/ic/mb86960reg.h> |
#include <dev/ic/mb86960reg.h> |
#include <dev/ic/mb86960var.h> |
#include <dev/ic/mb86960var.h> |
#include <dev/ic/ate_subr.h> |
|
|
|
#include <dev/isa/isavar.h> |
#include <dev/isa/isavar.h> |
#include <dev/isa/if_fereg.h> /* XXX */ |
|
|
|
int ate_match __P((struct device *, struct cfdata *, void *)); |
int ate_match __P((struct device *, struct cfdata *, void *)); |
void ate_attach __P((struct device *, struct device *, void *)); |
void ate_attach __P((struct device *, struct device *, void *)); |
Line 64 struct ate_softc { |
|
Line 62 struct ate_softc { |
|
void *sc_ih; /* interrupt cookie */ |
void *sc_ih; /* interrupt cookie */ |
}; |
}; |
|
|
struct cfattach ate_isa_ca = { |
CFATTACH_DECL(ate_isa, sizeof(struct ate_softc), |
sizeof(struct ate_softc), ate_match, ate_attach |
ate_match, ate_attach, NULL, NULL); |
}; |
|
|
|
#if NetBSD <= 199712 |
|
struct cfdriver ate_isa_cd = { |
|
NULL, "ate", DV_IFNET |
|
}; |
|
#endif |
|
|
|
struct fe_simple_probe_struct { |
struct fe_simple_probe_struct { |
u_char port; /* Offset from the base I/O address. */ |
u_char port; /* Offset from the base I/O address. */ |
Line 232 ate_find(iot, ioh, iobase, irq) |
|
Line 223 ate_find(iot, ioh, iobase, irq) |
|
bus_space_handle_t ioh; |
bus_space_handle_t ioh; |
int *iobase, *irq; |
int *iobase, *irq; |
{ |
{ |
u_char eeprom[FE_EEPROM_SIZE]; |
u_int8_t eeprom[FE_EEPROM_SIZE]; |
int n; |
int n; |
|
|
static int const irqmap[4][4] = { |
static int const irqmap[4][4] = { |
Line 253 ate_find(iot, ioh, iobase, irq) |
|
Line 244 ate_find(iot, ioh, iobase, irq) |
|
}; |
}; |
|
|
#if ATE_DEBUG >= 4 |
#if ATE_DEBUG >= 4 |
log(LOG_INFO, "ate_find: probe (0x%x) for ATI\n", iobase); |
log(LOG_INFO, "ate_find: probe (0x%x) for ATE\n", iobase); |
#if 0 |
#if 0 |
fe_dump(LOG_INFO, sc); |
fe_dump(LOG_INFO, sc); |
#endif |
#endif |
Line 282 ate_find(iot, ioh, iobase, irq) |
|
Line 273 ate_find(iot, ioh, iobase, irq) |
|
* at this stage, but I cannot test the presence of the chip |
* at this stage, but I cannot test the presence of the chip |
* any further without reading EEPROM. FIXME. |
* any further without reading EEPROM. FIXME. |
*/ |
*/ |
ate_read_eeprom(iot, ioh, eeprom); |
mb86965_read_eeprom(iot, ioh, eeprom); |
|
|
/* Make sure that config info in EEPROM and 86965 agree. */ |
/* Make sure that config info in EEPROM and 86965 agree. */ |
if (eeprom[FE_EEPROM_CONF] != bus_space_read_1(iot, ioh, FE_BMPR19)) { |
if (eeprom[FE_EEPROM_CONF] != bus_space_read_1(iot, ioh, FE_BMPR19)) { |
Line 330 ate_detect(iot, ioh, enaddr) |
|
Line 321 ate_detect(iot, ioh, enaddr) |
|
bus_space_handle_t ioh; |
bus_space_handle_t ioh; |
u_int8_t enaddr[ETHER_ADDR_LEN]; |
u_int8_t enaddr[ETHER_ADDR_LEN]; |
{ |
{ |
u_char eeprom[FE_EEPROM_SIZE]; |
u_int8_t eeprom[FE_EEPROM_SIZE]; |
int type; |
int type; |
|
|
/* Get our station address from EEPROM. */ |
/* Get our station address from EEPROM. */ |
ate_read_eeprom(iot, ioh, eeprom); |
mb86965_read_eeprom(iot, ioh, eeprom); |
memcpy(enaddr, eeprom + FE_ATI_EEP_ADDR, ETHER_ADDR_LEN); |
memcpy(enaddr, eeprom + FE_ATI_EEP_ADDR, ETHER_ADDR_LEN); |
|
|
/* Make sure we got a valid station address. */ |
/* Make sure we got a valid station address. */ |
if ((enaddr[0] & 0x03) != 0x00 || |
if ((enaddr[0] & 0x03) != 0x00 || |
(enaddr[0] == 0x00 && enaddr[1] == 0x00 && enaddr[2] == 0x00)) { |
(enaddr[0] == 0x00 && enaddr[1] == 0x00 && enaddr[2] == 0x00)) { |
#ifdef ATE_DEBUG |
#ifdef ATE_DEBUG |
printf("fmv_detect: invalid ethernet address\n"); |
printf("ate_detect: invalid ethernet address\n"); |
#endif |
#endif |
return (0); |
return (0); |
} |
} |
Line 363 ate_detect(iot, ioh, enaddr) |
|
Line 354 ate_detect(iot, ioh, enaddr) |
|
type = FE_TYPE_AT1700AT; |
type = FE_TYPE_AT1700AT; |
break; |
break; |
default: |
default: |
type = FE_TYPE_RE2000; |
type = FE_TYPE_AT_UNKNOWN; |
break; |
break; |
} |
} |
|
|
Line 384 ate_attach(parent, self, aux) |
|
Line 375 ate_attach(parent, self, aux) |
|
const char *typestr; |
const char *typestr; |
int type; |
int type; |
|
|
printf("\n"); |
|
|
|
/* Map i/o space. */ |
/* Map i/o space. */ |
if (bus_space_map(iot, ia->ia_io[0].ir_addr, ATE_NPORTS, 0, &ioh)) { |
if (bus_space_map(iot, ia->ia_io[0].ir_addr, ATE_NPORTS, 0, &ioh)) { |
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname); |
printf(": can't map i/o space\n"); |
return; |
return; |
} |
} |
|
|
Line 399 ate_attach(parent, self, aux) |
|
Line 388 ate_attach(parent, self, aux) |
|
type = ate_detect(iot, ioh, myea); |
type = ate_detect(iot, ioh, myea); |
switch (type) { |
switch (type) { |
case FE_TYPE_AT1700T: |
case FE_TYPE_AT1700T: |
typestr = "AT-1700T"; |
typestr = "AT-1700T/RE2001"; |
break; |
break; |
case FE_TYPE_AT1700BT: |
case FE_TYPE_AT1700BT: |
typestr = "AT-1700BT"; |
typestr = "AT-1700BT/RE2003"; |
break; |
break; |
case FE_TYPE_AT1700FT: |
case FE_TYPE_AT1700FT: |
typestr = "AT-1700FT"; |
typestr = "AT-1700FT/RE2009"; |
break; |
break; |
case FE_TYPE_AT1700AT: |
case FE_TYPE_AT1700AT: |
typestr = "AT-1700AT"; |
typestr = "AT-1700AT/RE2005"; |
break; |
break; |
case FE_TYPE_RE2000: |
case FE_TYPE_AT_UNKNOWN: |
typestr = "unknown (RE-2000?)"; |
typestr = "unknown AT-1700/RE2000"; |
break; |
break; |
|
|
default: |
default: |
/* Unknown card type: maybe a new model, but... */ |
/* Unknown card type: maybe a new model, but... */ |
printf("%s: where did the card go?!\n", sc->sc_dev.dv_xname); |
printf(": where did the card go?!\n"); |
panic("unknown card"); |
panic("unknown card"); |
} |
} |
|
|
printf("%s: %s Ethernet\n", sc->sc_dev.dv_xname, typestr); |
printf(": %s Ethernet\n", typestr); |
|
|
/* This interface is always enabled. */ |
/* This interface is always enabled. */ |
sc->sc_flags |= FE_FLAGS_ENABLED; |
sc->sc_flags |= FE_FLAGS_ENABLED; |