Next | Prev | Up | Top | Contents | Index

Including VME Device Drivers in the Kernel

Chapter 2, "Writing a Device Driver," provides general information on adding a driver to the kernel. This section describes specifics concerning VME drivers.

To add a new kernel-level device driver, you must create your own irix.sm file that contains the appropriate directive telling lboot how to include your driver. The filename, which must end with ".sm", belongs in the directory
/var/sysgen/system. Because lboot can probe for VME devices, lboot can conditionally include a VME device driver into the kernel.

If the current system contains the VME device, lboot includes the driver; otherwise, it saves memory by leaving it out. Use the VECTOR directive to include a VME device conditionally. In addition to the module name, the VECTOR directive requires that you fill out these fields:

adapter

The adapter number identifying which VME bus out of possibly several.

bustype

This must be set to VME.

ctlr

The device number that differentiates between more than one device of the same type.

exprobe_space

This is an extended probe that can do reads and writes with compares against expected values to search for a VME device at an address. The first arg defines a sequence of reads and writes. The second arg specifies the address space. The third arg specifies the probe address. The fourth arg is the size of the probe, 1-4 bytes. The fifth arg is the expected read or write value. The last argument is a mask that the fifth arg is ANDed against.

iospace, iospace2, iospace3


This is a triple identifying a VME-bus space, address, and size. The bus space is one of A16NP, A16S, A24NP, A24S, A32NP, A32S.

ipl

The VME interrupt priority level. This must be a value from 1 to 7, as described above.

probe_space

This is a triple identifying a VME-bus space, address, and read byte count. The address specified is read by lboot to determine the existence of device. If you do not specify a probe address, the module is automatically included in the kernel.

vector

The VME interrupt vector value. This must not be used unless the VME device has hard-wired or jumpered vector values.
You must also create a master file under /var/sysgen/master.d. A master file has four sections:

The first, non-blank, non-comment line is interpreted for flags, phrases, and values. Other non-comment lines that follow, up to a line that begins with a dollar sign, specify stubs. Anything that follows the line beginning with a dollar sign is processed to interpret special characters, then compiled into the kernel.

The name of the master file is the same as the name of the object file for the driver, but the master file must not have the .o suffix. The FLAG field of the master file must include at least the character device flag c. (You do not need the s flag for VME device drivers because lboot can probe for VME devices.) See /var/sysgen/master.d/README and the master(4) man page.

Note: For network drivers, the FLAG field would blank with a "-" (hyphen). As an example, suppose you want to add a mythical VME device driver to the kernel. You must copy the driver object file vdk.o to /var/sysgen/boot, and you must add a line similar to the following to a file called vdk.sm in
/var/sysgen/system:

VECTOR: bustype=VME module=vdk ipl=1 ctlr=0 adapter=0 iospace=(A16S,0x400,0x200) iospace2=(A16S,0x800,0x100) probe_space=(A16S,0x404,2)

Note: The above lines must all be on one line in the irix.sm file. Note that the bus addresses and sizes are specified in hexadecimal format. The ctlr= value helps identify a device when more than one uses the same driver. If there is more than one device, give each a unique number, starting from zero. In the above example, lboot reads two bytes at probe address 0x404 to determine whether the device is present.

After examining /usr/include/sys/major.h, you determine that major device number 51 is available and can be used for this device. You then create a master file vdk in /var/sysgen/master.d, and enter:

*FLAG     PREFIX    SOFT      #DEV       DEPENDENCIES
 c        vdk       51        -

Next | Prev | Up | Top | Contents | Index