Registering The Shutdown Routine; Implementing The El_Shutdown Routine; Implementing The El_Autosense_Thread Routine - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

5.1.14 Registering the shutdown Routine

The following code shows how the el_probe( ) routine registers its
shutdown( ) routine. The kernel calls this routine when the system shuts
down. The driver can specify an argument for the kernel to pass to the
routine at that time.
if (!sc->reprobe)
drvr_register_shutdown(el_shutdown, (void*)sc, DRVR_REGISTER);
return( ~ 0);
}
Registers the shutdown( ) routine and directs the kernel to pass
1
a pointer to the driver's softc data structure to the routine. The
shutdown( ) routine is important for those devices that perform
DMA-related operations.

5.2 Implementing the el_shutdown Routine

The driver's shutdown( ) routine shuts down the controller. The kernel
calls all registered shutdown( ) routines when the system shuts down.
The el_probe( ) routine registers a shutdown( ) routine called
el_shutdown( ). The if_el device driver implements the routine as
follows:
static void el_shutdown(struct el_softc *sc)
{
WRITE_CMD(sc, CMD_RESET);
DELAY(1000);
3
}
Specifies the argument that the kernel passes to the routine, which is a
1
pointer to the driver's el_softc data structure. The driver specifies
this argument when it registers the shutdown( ) routine in its probe
interface.
Calls the WRITE_CMD macro to write data to the command port register.
2
In this call, the el_softc data structure for this 3Com 3C5x9 device
contains the I/O handle to reference the device's command register. The
data to be written is the CMD_RESET bit, which resets the device.
Calls the DELAY macro to delay the execution of el_shutdown( ) for 1
3
millisecond before continuing execution. This gives the reset command
time to complete.

5.3 Implementing the el_autosense_thread Routine

The if_el device driver implements a driver-specific routine called
el_autosense_thread( ) to determine the mode of the network interface.
The el_probe( ) routine calls el_autosense_thread( ) during device
autoconfiguration.
1
2
Implementing the Autoconfiguration Support Section (probe) 5–17
1

Advertisement

Table of Contents
loading

Table of Contents