3.6
Defining the Interrupt Handler ID . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
3–6
3.7
Defining CSR Pointer Information . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
3–6
3.8
Defining FIFO Maintenance Information .. . .. . .. . .. . . .. . .. . .. . .. .
3–7
3.9
Defining Bus-Specific Information . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
3–7
3.10
Defining the Broadcast Flag . . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
3–8
3.11
Defining the Debug Flag .. . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
3–8
3.12
Defining Interrupt and Timeout Statistics . .. . .. . .. . . .. . .. . .. . .. .
3–8
3.13
Defining Autosense Kernel Thread Context Information .. . .. .
3–9
3.14
Defining the Polling Context Flag . . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
3–9
3.15
Defining a Copy of the w3_eeprom Data Structure . . .. . .. . .. . .. .
3–10
3.16
Declaring the Simple Lock Data Structure . .. . .. . .. . . .. . .. . .. . .. .
3–10
4
Implementing the Configure Section
4.1
Declaring Configure-Related Variables and the
cfg_subsys_attr_t Data Structure . . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
4–1
4.2
Setting Up the el_configure Routine . . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
4–3
5
Implementing the Autoconfiguration Support Section (probe)
5.1
Implementing the el_probe Routine . . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–1
5.1.1
Setting Up the el_probe Routine . . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–2
5.1.2
Checking the Maximum Number of Devices That the
Driver Supports . . .. . .. . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–4
5.1.3
Performing Bus-Specific Tasks . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–4
5.1.4
Allocating Memory for the softc Data Structure .. . .. . .. . .. .
5–6
5.1.5
Allocating the ether_driver Data Structure . . .. . . .. . .. . .. . .. .
5–7
5.1.6
Initializing the Enhanced Hardware Management Data
Structure .. . . .. . .. . .. . .. . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–8
5.1.7
Computing the CSR Addresses .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–8
5.1.8
Setting Bus-Specific Data Structure Members . . .. . .. . .. . .. .
5–8
5.1.9
Handling First-Time Probe Operations . .. . .. . .. . . .. . .. . .. . .. .
5–10
5.1.10
Handling Subsequent Probe Operations . . .. . .. . . .. . .. . .. . .. .
5–12
5.1.11
Registering the Interrupt Handler . . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–14
5.1.12
Saving the controller and softc Data Structure Pointers . .
5–16
5.1.13
Trying to Allocate Another controller Data Structure .. . .. .
5–16
5.1.14
Registering the shutdown Routine . . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–17
5.2
Implementing the el_shutdown Routine . .. . .. . .. . .. . . .. . .. . .. . .. .
5–17
5.3
Implementing the el_autosense_thread Routine . .. . . .. . .. . .. . .. .
5–17
5.3.1
Setting Up the el_autosense_thread Routine .. . . .. . .. . .. . .. .
5–19
5.3.2
Blocking Until Awakened . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–19
5.3.3
Testing for the Termination Flag . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–20
5.3.4
Starting Up Statistics . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–20
iv Contents