Specifications
Writing FDT Routines
Note that FDT support routines and FDT completion routines return status to
their callers. Each FDT routine that participates in the processing of an I/O
function should examine the status value returned to it by any routine it calls
and should reflect this status to the routine that called it.
5.1 Context of Driver FDT Processing
The $QIO system service executes in the context of the process that issues the
I/O request, but in kernel mode and at IPL$_ASTDEL. Process context allows the
$QIO system service and driver FDT routines to access process address space.
Because the $QIO system service expects FDT routines to preserve this context,
an FDT routine observes the following conventions:
• An FDT routine must not call system services or OpenVMS RMS routines.
• It must not lower IPL below IPL$_ASTDEL. If an FDT routine raises IPL,
it must obtain any appropriate spinlock, and it must lower IPL to IPL$_
ASTDEL before exiting, releasing any acquired spin lock.
• It should not access device registers because the device might be active.
• It should exercise caution when modifying the UCB. Routines usually
access the UCB while holding the associated fork lock at driver fork IPL
to synchronize modifications, and FDT routines do not execute with such
synchronization. Drivers containing FDT routines that access device registers
or carelessly modify the UCB risk unpredictable operation or a system failure.
5.2 Upper-Level FDT Action Routines
An OpenVMS AXP device driver provides a single upper-level FDT routine for
each I/O function code it processes. The $QIO system service uses the low-order
six bits of the I/O function code as an index into the FDT action routine vector.
As described in Chapter 4, any vector slots corresponding to a driver-supported
function contain the procedure value of either a system or driver-provided upper-
level FDT action routine. Those which correspond to unsupported functions
contain the procedure value of the system upper-level FDT action routine
EXE$ILLIOFUNC.
The $QIO system service transfers control to an upper-level FDT action routine
using the following interface:
status = driver_FDT_routine(irp,pcb,ucb,ccb)
The parameters include the addresses of:
• the I/O request packet (IRP) for the current I/O request
• the process control block (PCB) of the current process
• the unit control block (UCB) of the device assigned to the process-I/O channel
specified as an argument to the $QIO request
• the channel control block (CCB) that describes the process-I/O channel
An upper-level FDT action routine must return SS$_FDT_COMPL status to its
caller, the FDT dispatching code in the $QIO system service.
An OpenVMS AXP driver obtains the contents of the function-dependent
arguments from IRP$L_QIO_Pn, where n is a parameter number from 1 through
6.
5–2










