pdiag_dd_dma_complete
Purpose
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.
Syntax
#include <sys/pdiagex_dds.h>
int32 pdiag_dd_dma_complete( handle, daddr, operation )
pdiag_info_handle_t handle;
pdiag_addr_t daddr;
uint32 operation;
Description
The following is performed by the pdiag_dd_dma_complete depending on the bus type and operation:
- Unpins the user buffer and detaches the cross-memory descriptor.
- Handles unique identifier (cookie) as created by the
pdiag_dd_open
function where:- pdiag_dd_open daddr
- pointer to physical address for DMA controller which is returned from controller and worker.
- operation
PDIAG_DMA_MASTER
andPDIAG_DMA_SLAVE
are two types of operations.
Execution Environment
The pdiag_dd_dma_complete() function can be called from the process or the interrupt environment only.
Parameters
Parameter | Description |
---|---|
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 worker completes, this should be set to 0. |
operation | Type of operation to perform:
|
Return Value
The pdiag_dd_dma_complete function returns one of the following values:
Return Value | Description |
---|---|
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. |