Specifications
D
evice Driver Programming
2-8
• System calls by applications
• Interrupts by devices.
The process of initializing the system creates several tables so the system can activate the
correct driver routine. Because the system uses these tables to determine which driver rou-
tines to enter, common practice refers to the routines as driver entry points. Each table cor-
responds to a specific set of entry-point routines:
• Initialization tables correspond with either init(D2) or start(D2)
routines.
• System calls for character drivers use switch tables that correspond with
the open(D2), close(D2), read(D2), write(D2),and
ioctl(D2) routines.
System calls for block drivers use switch tables that correspond with the
open(D2), close(D2), and strategy(D2) routines.
System calls for STREAMS drivers indirectly access the open(D2),
close(D2), put(D2),and srv(D2) routines through a chain of
pointers to other structures. Since some of these reside in the driver, they
loosely resemble entry points. Therefore, the programming community
finds it both common and convenient to refer to them as such.
• Interrupt vector tables associate device interrupts with their interrupt han-
dling routines; the entry point is the intr(D2) routine.
Initialization Entry Points 2
When the system starts, it executes both kinds of driver initialization routines (init and
start). It calls the routines and uses a subset of the information from the driver's config-
uration files to initialize the drivers. Much of the information is irrelevant to initializing
drivers, such as the major/minor numbers and driver type. (The system does not differenti-
ate between character- and block-access drivers when running the initialization routines.)
Some drivers don’t need initialization routines.
During the boot sequence, the system initializes driver routines in the following order:
1. init routines
2. interrupts
3. start routines
4. other driver entry points.
The system calls the init and start routines of multiple drivers in no set order. If the
order needs setting, adjust the order field in the drivers’ Master(4) configuration file.
Switch Table Entry Points 2
I/O system calls activate switch table entry-point routines for character and block drivers
using the following procedure: