Next | Prev | Up | Top | Contents | Index

The GBD Example

For example, to add a mythical GIO device driver to the kernel of an R4000 Indigo (IP20), you must copy the driver object file gbd.o to /usr/sysgen/boot, create a master file (as shown below), and create a system file with the following VECTOR directive:

VECTOR: bustype=GIO module=gbd vector=0x0 unit=0 
        base=PHYS_TO_K1(0x1f400000) base2=0xBF410000 
        exprobe=(r,PHYS_TO_K1(0x1f400000),4,0x75,0xff)
Note that the interrupt vector (vector=), the base addresses, and the probe address must all be specified in hexadecimal format. The base address and the address in the exprobe must agree. In the example above, lboot reads four bytes at probe address PHYS_TO_K1(0x1f400000) to determine whether the device is present in slot 0. In this example, base2 is used to point to the location of on-board memory.

In actual use, it is advisable to add a second VECTOR line to the system file, to perform a probe of the other GIO slot. If only the line above had been used and the GIO device were physically placed in slot 1 rather than slot 0 as specified in the VECTOR line, the probe would fail, and the driver would not have been included in the kernel. Using this situation as an example, the following line must be added to the system file:

VECTOR: bustype=GIO module=gbd vector=0x0 unit=0 base=0xBF600000 base2=0xBF610000 exprobe=(r,0xBF600000,4,0x75,0xff)

This ensures that a GIO device placed in either slot will be recognized.

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

*FLAG     PREFIX    SOFT      #DEV       DEPENDENCIES
 c        gbd       51        -

Next | Prev | Up | Top | Contents | Index