Writing Device Drivers

First-Party DMA

In general, the driver should perform the following steps for first-party DMA.

  1. Allocate a DMA channel.

  2. Configure the channel with ddi_dmae_1stparty(9F).

  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 DMA engine on the device and start it (this is device specific).

    When the transfer is complete, continue the bus-master operation.

  6. Perform any required object synchronizations.

  7. Release the DMA resources.

  8. Deallocate the DMA channel.

  9. Free the DMA handle.