Writing Device Drivers

Performing Third-Party DMA Transfers

The driver should perform these steps for third-party DMA.

  1. Allocate a DMA channel.

  2. Retrieve the system's DMA engine attributes with ddi_dmae_getattr(9F).

  3. Lock the DMA object in memory. See the physio(9F) or ddi_umem_lock(9F) man page.

  4. Allocate DMA resources for the object.

  5. Use ddi_dmae_prog(9F) to program the system DMA engine to perform the transfer.

  6. Perform any required object synchronizations.

  7. Use ddi_dmae_stop(9F) to stop the DMA engine.

  8. Release the DMA resources.

  9. Deallocate the DMA channel.

Certain hardware platforms restrict DMA capabilities in a bus-specific way. Drivers should use ddi_slaveonly(9F) to determine whether the device is in a slot in which DMA is possible.