11.1.1 Designing Device Drivers with DriverControl Routines
Most NT drivers of DMA devices must have an AdapterControl routine:
-
Every NT driver of a DMA device that is connected to a system DMA controller
must have an AdapterControl routine.
-
Any NT driver of a busmaster DMA device must have an AdapterControl routine
unless that driver’s designer decides to use the system’s common-buffer DMA
support exclusively.
At the driver writer’s discretion, an NT device driver can have a
ControllerControl routine in order to synchronize its operations to similar
devices through a single physical controller or adapter.
The I/O Manager defines a single type (DRIVER_CONTROL) for AdapterControl and
ControllerControl routines because each is called indirectly, usually from the
StartIo routine, when a driver needs to synchronize access to a physical
device that might already be busy:
-
When a driver calls IoAllocateAdapterChannel, its AdapterControl
routine is run immediately if the system DMA controller or busmaster adapter
is available for a DMA operation. Otherwise, the AdapterControl routine is
queued until the DMA controller or busmaster adapter is free.
-
When a driver calls IoAllocateController, its ControllerControl routine
is run immediately if the hardware represented by the controller object is
available for an I/O operation. Otherwise, the ControllerControl routine is
queued until the controller is free.
For a ControllerControl routine, the input PVOID MapRegisterBase, shown
in the DRIVER_CONTROL declaration, is a system-reserved value.