Specifications

1
Introduction
An OpenVMS device driver is a set of routines and tables that the operating
system uses to process an I/O request for a particular device such as disks, tapes,
and network controllers.
The operating system’s approach to I/O is that the system should perform as
much of the processing of an I/O request as possible and that drivers should limit
themselves to the device-specific aspects of I/O processing. To accomplish this,
the operating system provides drivers with the following services:
A Queue I/O request ($QIO) system service that preprocesses an I/O request
by performing those functions and checks that are common to all devices; for
example, validating those arguments of the I/O request that are not device
specific
Many operating system routines that drivers can call to perform I/O
preprocessing, allocate and deallocate resources, and synchronize driver
execution
A system I/O postprocessing routine that performs device-independent I/O
postprocessing for all I/O requests
Thus, drivers can leave the device-independent I/O processing to the operating
system and can concentrate on servicing those aspects of an I/O operation that
vary from device type to device type. In addition, drivers can call system routines
to perform many functions that are common to several, but not all, devices.
A device driver does not run sequentially from beginning to end. Rather, the
operating system uses driver tables and other information maintained by itself
and the driver to determine which driver routines to activate and when they
should be activated. Because little sequential processing of driver code occurs,
the operating system must assume the responsibility for synchronizing the
execution of the various driver routines, as well as the execution of all drivers in
the system.
This chapter defines the general functions and purposes of a device driver. It
then introduces concepts crucial to an understanding of how device drivers work
within the operating system and integral to the process of successfully writing
one. It concludes with a brief description of the flow of driver activity in servicing
an I/O request.
1.1 Driver Functions
A system utility loads a device driver into system virtual address space and
creates its associated data structures. Once loaded, a device driver controls I/O
operations on a peripheral device by performing the following functions:
Defining the peripheral device for the rest of the operating system
1–1