In common-buffer bus master DMA, the device transfers data to or from a contiguous nonpaged pool buffer, using a DMA controller that is part of the device itself. Frequently, this kind of hardware treats the common buffer as a mailbox for exchanging control and status messages with the driver. How Common-Buffer Bus Master DMA WorksThe exact operation of a common-buffer bus master driver will depend on the physical device. The description that follows is based on the typical architecture. It assumes the device uses one mailbox for commands and another to return status information. Figure 12.7 illustrates this arrangement. Figure 12.7. Common buffer implementation of message exchangeIRP_MN_START_DEVICE HANDLERThis handler must now perform the following tasks:
START I/O ROUTINETo send a command to the device, the Start I/O routine performs the following:
In response to the notification bit being set, the device begins processing the command in the common buffer. INTERRUPT SERVICE ROUTINEWhen the device has finished processing the command in the common buffer, it puts a message in the status mailbox and generates an interrupt. In response to this interrupt, the driver's Interrupt Service Routine does the following:
IRP_MN_STOP_DEVICE HANDLERWhen the device is stopped, a driver should quiet the device. The Stop handler calls FreeCommonBuffer to release the memory associated with the buffer.
|