Writing Device Drivers

DMA

The HBA driver must describe the attributes of its DMA engine by properly initializing the ddi_dma_attr_t structure.

static ddi_dma_attr_t isp_dma_attr = {
         DMA_ATTR_V0,        /* ddi_dma_attr version */
         0,                  /* low address */
         0xffffffff,         /* high address */
         0x00ffffff,         /* counter upper bound */
         1,                  /* alignment requirements */
         0x3f,               /* burst sizes */
         1,                  /* minimum DMA access */
         0xffffffff,         /* maximum DMA access */
         (1<<24)-1,          /* segment boundary restrictions */
         1,                  /* scatter/gather list length */
         512,                /* device granularity */
         0                   /* DMA flags */
};

The driver, if providing DMA, should also check that its hardware is installed in a DMA-capable slot:

        if (ddi_slaveonly(dip) == DDI_SUCCESS) {
             return (DDI_FAILURE);
         }