DMA Programming Model

This is the basic DMA programming model.

It is completely independent of:
  • System hardware
  • LPAR mode or non-LPAR mode
  • 32-bit bus/devices or 64-bit bus or devices
  • 32-bit kernel or 64-bit kernel

A device driver allocates and initializes DMA-related resources with the d_map_init service and the d_map_init_ext service and frees the resources with the d_map_clear service. Each time a DMA mapping needs to be established, the driver calls d_map_page or d_map_list service.

The d_map_page and d_map_list services map DMA buffers in the bus memory. In other words, given a set of DMA buffer addresses, a corresponding set of bus addresses is returned to the driver. The driver programs its device with the bus addresses and sets it up to start the DMA. When the DMA is complete:
  • The device generates an interrupt that is handled by the driver.
  • If no more DMA will be done to the buffers, the driver unmaps the DMA buffers with the d_unmap_page or d_unmap_list services.