Specifications
2-1
2
Chapter 2Understanding Device Drivers
2
2
2
This chapter explains what a device driver is and how a driver differs from an application.
It describes the different types of devices and device driver interfaces. It also introduces
driver entry points and kernel utilities and describes the driver environment.
What Is a Device Driver? 2
The UNIX operating system kernel consists of two logical parts: the first part manages the
file systems, processes, and memory, and the second part manages physical devices, such
as terminals, disks, tape drives, and network media. To simplify the terminology, this
chapter refers to the first part as “the kernel” (although strictly speaking, drivers are also
part of the kernel), and refers to the second part, which contains the drivers, as “the I/O
subsystem.”
Associated with each physical device is a piece of code, called a device driver, which man-
ages the device hardware. The device driver brings the device into and out of service, sets
hardware parameters in the device, transmits data from the kernel to the device, receives
data from the device and passes it back to the kernel, and handles device errors.
To most application programmers using PowerMAX OS, a device driver is simply part of
the operating system. The application programmer is usually concerned only with opening
and closing files and reading and writing data. Standard system calls from a high-level lan-
guage usually do these tasks. The system call gives the application program access to the
kernel, which identifies the device containing the file and the type of I/O request. The ker-
nel then executes the device driver routine provided to perform that function.
Device drivers isolate low-level, device-specific details from the system calls, which can
remain general and uncomplicated. Because each device differs so, kernels cannot practi-
cally handle all the possibilities. Instead, each configured device plugs a device driver into
the kernel. To add a new device or capability to the system, just plug in its driver.
Figure 2-1 shows how a driver links the user level to the hardware level. By issuing system
calls from the user level, a program accesses the file and process control subsystems,
which access the device driver. The driver provides and manages a path to exchange data
with the device and receive service interrupts from the device's controller.