registration of interrupt handlers. All network device drivers are required to register interrupt handlers.

el_intr_info.configuration_st = (caddr_t)ctlr; 1 el_intr_info.intr = el_intr; 2 el_intr_info.param = (caddr_t)unit; 3

el_intr_info.config_type = CONTROLLER_CONFIG_TYPE; 4 if (ctlr->bus_hd->bus_type == BUS_PCMCIA) 5

el_intr_info.config_type = SHARED_INTR_CAPABLE;

el_ihandle.ih_bus = ctlr->bus_hd; 6

el_ihandle.ih_bus_info = (char *)&el_intr_info;

7

sc->hid = handler_add(&el_ihandle); 8

if (sc->hid == (ihandler_id_t *)(NULL)) { 9 printf("el%d: interrrupt handler add failed\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);

}

1

2

3

4

5

6

7

8

Sets the configuration_st member of the el_intr_info data structure to the pointer to the controller data structure for this 3Com 3C5x9 device.

Sets the intr member of the el_intr_info data structure to el_intr, which is the if_el device driver’s interrupt handler.

Sets the param member of the el_intr_info data structure to the controller number for the controller data structure for this 3Com 3C5x9 device.

Sets the config_type member of the el_intr_info data structure to the constant CONTROLLER_CONFIG_TYPE, which identifies the if_el driver type as a controller driver.

If the if_el driver operates on the PCMCIA bus, indicates that the if_el driver can handle shared interrupts.

Sets the ih_bus member of the el_ihandle data structure to the bus data structure for the if_el device driver. The bus data structure is referenced through the bus_hd member of the controller data structure for this 3Com 3C5x9 device.

Sets the ih_bus_info member of the el_ihandle data structure to the address of the bus-specific information data structure, el_intr_info.

Calls the handler_add( ) routine to register the device driver’s interrupt handler and its associated ihandler_t data structure with the bus-specific interrupt-dispatching algorithm.

Implementing the Autoconfiguration Support Section (probe) 5–15

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