The pdiag_dd_dma_complete() function unpins and detaches the user space DMA buffer. If the handle's dds.bus_type is set for the Micro Channel, this function also calls the d_complete() kernel service, which checks for detected IOCC errors, flushes the IOCC buffer (unhides it if necessary) and sets the page table 'modified' bit if the information was modified.
#include <sys/pdiagex_dds.h> int32 pdiag_dd_dma_complete( handle, daddr, operation ) pdiag_info_handle_t handle; pdiag_addr_t daddr; uint32 operation;
The following is performed by the pdiag_dd_dma_complete depending on the bus type and operation:
Where bus type = BUS_MICRO_CHANNEL and operation is PDIAG_DMA_MASTER or PDIAG_DMA_SLAVE
This function utilizes the D_UNMAP_PAGE macro to unmap the specified address.
This function utilizes the D_UNMAP_SLAVE macro to unmap the specified address.
The pdiag_dd_dma_complete() function can be called from the process or the interrupt environment on a BUS_MICRO_CHANNEL system. The function can only be called from the process environment on a BUS_BID system.
handle | Points to pdiag_info_handle_t structure which is returned from pdiag_open(). |
daddr | The offset into the user's physical DMA address. This is returned by pdiag_dd_dma_setup () routine. For DMA slave completes, this should be set to 0. |
operation | Type of operation to perform: |
The pdiag_dd_dma_complete function returns one of the following values:
DGX_OK | The operation was successful. The errno is not set. |
DGX_INVALID_HANDLE | Specified handle has been closed or was not generated by the pdiag_open() call. The errno is not set. |
DGX_BADVAL_FAIL | daddr value was not valid. The errno is not set. |
DGX_DCOMPLETE_FAIL | Application received a DMA error detected by the system hardware. The errno is set to the d_complete() return code. |
DGX_UNPINU_FAIL | Application could not unpin the specified user buffer. The errno is set to the unpinu() return code. |
DGX_XMDETACH_FAIL | Application could not detach user space from the physical address. The errno is set to the xmdetach() return code. |
pdiag_dd_dma_setup() and pdiag_dd_dma_enable() functions.