Writing Device Drivers

Third-Party DMA

In general, the driver should perform these steps for third-party DMA.

  1. Allocate a DMA channel.


  3. Lock the DMA object in memory (see physio(9F)).

    Note -

    This step is not necessary in block drivers for buffers coming from the file system, as the file system has already locked the data in memory.

  4. Allocate DMA resources for the object.

  5. Program the system DMA engine to perform the transfer with ddi_dmae_prog(9F).

  6. Perform any required object synchronizations.

  7. Stop the DMA engine with ddi_dmae_stop(9F).

  8. Release the DMA resources.

  9. Deallocate the DMA channel.

  10. Free the DMA handle.

Certain hardware platforms may restrict DMA capabilities in a bus-specific way. Drivers should use ddi_slaveonly(9F) to determine if the device is in a slot in which DMA is possible. For an example, see "attach()".