Setting Up The El_Probe Routine - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

For subsequent probe operations, reads the EEPROM to determine if the
hardware address (and thus the adapter) has changed (Section 5.1.10)
Registers the interrupt handler (Section 5.1.11)
Saves the controller and softc data structure pointers
(Section 5.1.12)
Tries to allocate another controller data structure (Section 5.1.13)
Registers the shutdown routine (Section 5.1.14)

5.1.1 Setting Up the el_probe Routine

The following code shows how to set up the el_probe( ) routine:
static int el_probe (io_handle_t io_handle,
{
struct el_softc *sc;
int unit = ctlr->ctlr_num, i, j, isatag=0, status, multi_func_flag=0;
struct handler_intr_info el_intr_info;
ihandler_t el_ihandle;
struct card_info *card_infop = (struct card_info *)(ctlr->card_info_ptr);
io_handle_t reg;
struct e_port port_sel;
struct irq irq_sel;
unsigned short *ed;
unsigned char *ee;
struct tuple_info *tuple_infop;
struct tuple_data_info tuple_data;
struct tuple_data_info *tuple_data_infop;
Declares an argument that specifies an I/O handle that you can use to
1
reference a device register or memory that is located in bus address
space (either I/O space or memory space). This I/O handle references
the device's I/O address space for the bus where the read operation
originates (in calls to the read_io_port( ) routine) and where the
write operation occurs (in calls to the write_io_port( ) routine). The
bus configuration code passes this I/O handle to the driver's probe
interface during device autoconfiguration.
Declares a pointer to a controller data structure for this controller.
2
This data structure contains such information as the controller type,
the controller name, and the current status of the controller. The bus
configuration code passes this initialized controller data structure
to the driver's probe and attach interfaces. A device driver typically
uses the ctlr_num member of the controller data structure as an
index to identify the instance of the controller a request is for.
Declares a pointer to the el_softc data structure and calls it sc.
3
Declares a unit variable and initializes it to the controller number for
4
this controller. This controller number identifies the specific 3Com
3C5x9 controller that is being probed. The controller number is
5–2 Implementing the Autoconfiguration Support Section (probe)
1
struct controller *ctlr)
2
3
5
6
8
9
10
11
4
7

Advertisement

Table of Contents
loading

Table of Contents