Specifications
5
Writing FDT Routines
A driver performs device-specific I/O function preprocessing to validate arguments
specified in the original call to the $QIO system service, to complete certain
types of function processing such as set mode and sense mode operations, and to
prepare to service functions involving a device transaction. Driver I/O function
preprocessing on OpenVMS AXP systems often requires the cooperative efforts
of upper-level FDT action routines, FDT support routines, and FDT completion
routines.
An upper-level FDT action routine is a routine listed in a driver’s function
decision table (FDT) as a result of the driver’s invocation of the FDT_ACT macro
(see Chapter 4 for more information). FDT dispatching code in the $QIO system
service calls an upper-level FDT action routine, passing to it the addresses of the
I/O request packet (IRP), process control block (PCB), unit control block (UCB),
and channel control block (CCB). An upper-level FDT action routine must return
SS$_FDT_COMPL status to the $QIO system service.
The $QIO system service uses the FDT to determine which upper-level FDT
action routine to call to initiate driver preprocessing of a specific I/O request.
Often a driver can use one of the system-provided upper-level FDT routines, as
described in Section 5.2.1. This practice encourages the use of well debugged
routines and minimizes driver size. However, if the I/O function requires
preprocessing that is unique to the device the driver controls, the driver includes
an upper-level FDT routine that services the function in a device-dependent
manner.
An upper-level FDT action routine sometimes calls an intermediate FDT routine,
known as an FDT support routine. An FDT support routine performs some
discrete action on behalf of an upper-level action routine, such as determining
whether a user buffer is accessible, locking a user buffer in memory, and
reformatting data into buffers in the system address space. Often, an FDT
support routine calls an FDT completion routine.
There is no uniform interface for calling FDT support routines. These routines
are listed and described in the OpenVMS AXP Device Support: Reference. The
$QIO system service never calls an FDT support routine directly to process a
given I/O function.
To conclude the preprocessing of an I/O function, a driver FDT routine (either
the upper-level FDT action routine or an FDT support routine) calls a system-
provided FDT completion routine. An FDT completion routine places the
status return to the $QIO system service in the FDT context (FDT_CONTEXT)
structure and returns SS$_FDT_COMPL status to its caller. Eventually, the
driver’s upper-level FDT routine exits FDT processing by returning control to the
$QIO system service.
5–1










