5.1.9 Handling First-Time Probe Operations
If the device has not already been probed, the
el_probe( )
routine performs
the following tasks:
•
Reads the EEPROM and saves it to a temporary data structure
•
Reads and saves the device’s physical address
•
Starts the autosense thread to determine the media type
The following code shows how the
el_probe( )
routine performs these
tasks:
if (!sc->reprobe) {
1
if (multi_func_flag) {
2
bzero((caddr_t)&tuple_data, sizeof(struct tuple_data_info));
tuple_data_infop = &tuple_data;
tuple_infop = (struct tuple_info *)&tuple_data;
tuple_infop->socket = (short) card_infop->socket_vnum;
tuple_infop->attributes = 0;
tuple_infop->DesiredTuple = 0x88;
status = GetFirstTuple(tuple_infop);
if (status == SUCCESS) {
tuple_data_infop->TupleOffset = 0;
tuple_data_infop->TupleDataMax = (u_short)TUPLE_DATA_MAX;
status = GetTupleData(tuple_data_infop);
if (status == SUCCESS) {
ee = (unsigned char *)&sc->eeprom;
for (i = 0; i < (sizeof(struct w3_eeprom)); i++) {
*ee = tuple_data_infop->TupleData[i];
ee++;
}
} else {
printf("el%d: Can’t read multifunction card’s eeprom.\n",
unit);
if (sc->ispcmcia)
pcmcia_unregister_event_callback(card_infop->socket_vnum,
CARD_REMOVAL_EVENT,
(caddr_t)el_card_remove);
if_dealloc(sc->is_ed);
lan_ehm_free(&sc->ehm);
FREE(sc, M_DEVBUF);
return(0);
}
} else {
printf("el%d: Can’t read multifunction card’s eeprom.\n",
unit);
if (sc->ispcmcia)
pcmcia_unregister_event_callback(card_infop->socket_vnum,
CARD_REMOVAL_EVENT,
(caddr_t)el_card_remove);
if_dealloc(sc->is_ed);
lan_ehm_free(&sc->ehm);
FREE(sc, M_DEVBUF);
return(0);
}
} else {
3
ed = (unsigned short *)&sc->eeprom;
5–10 Implementing the Autoconfiguration Support Section (probe)