for (i=0; i<(sizeof(struct w3_eeprom)/2); i++) { WRITE_ECR(sc, ECR_READ+i);

DELAY(1000);

*ed = READ_EDR(sc); ed++;

}

}

for (i=0; i<3; i++) { 4

j = sc->eeprom.addr[i]; sc->is_addr[(i*2)] = (j>>8) & 0xff; sc->is_addr[(i*2)+1] = (j) & 0xff;

}

sc->lm_media_mode = LAN_MODE_AUTOSENSE; 5 sc->lm_media_state = LAN_MEDIA_STATE_SENSING; 6 sc->lm_media = LAN_MEDIA_UTP; 7 sc->autosense_thread = kernel_thread_w_arg(first_task, 8

el_autosense_thread, (void *)sc);

if (sc->autosense_thread == NULL) { 9

printf("el%d: Can’t create autosense thread.\n", unit); if (sc->ispcmcia) 10

pcmcia_unregister_event_callback(card_infop->socket_vnum,

CARD_REMOVAL_EVENT, (caddr_t)el_card_remove);

if_dealloc(sc->is_ed); 11 lan_ehm_free(&sc->ehm); 12 FREE(sc, M_DEVBUF); 13 return(0); 14

}

1

2

3

4

5

6

7

Determines whether the device has already been probed, which indicates that the device is operating on a PCMCIA bus and that the user has put the card back into the slot. In this case, the driver does not need to redo much of the initial probe work and will skip to the code shown in Section 5.1.10.

If this is a multifunction card, reads the EEPROM data and saves it in sc->eeprom. If this is a multifunction PC card, the EEPROM data is located in the card information data structure.

If this is not a multifunction PC card, the EEPROM data is read directly from the card and saved in the el_softc data structure.

Saves the 48-bit physical address of the device into the is_addr member of the el_softc data structure for this 3Com 3C5x9 device.

Sets the media mode to the constant LAN_MODE_AUTOSENSE. This constant indicates that the driver hardware determines the media automatically.

Sets the media state to the constant LAN_MEDIA_STATE_SENSING. This constant indicates that the media is currently in the autosensing state.

Sets the currently set media to the constant LAN_MEDIA_UTP. This constant indicates that the mode for the media is unshielded twisted-pair cable.

Implementing the Autoconfiguration Support Section (probe) 5–11

Page 69
Image 69
Compaq AA-RNG2A-TE manual Implementing the Autoconfiguration Support Section probe