pdiag_dd_big_dma_setup
The pdiag_dd_big_dma_setup() function initializes, pins, and cross-memory attaches a large user buffer for a DMA operation. The size can be up to DIAG_MULTIPAGESIZE (currently, this is 0x8000) bytes.
Syntax
#include <sys/pdiagex_dds.h>
#include <sys/dma.h>
int32 pdiag_dd_big_dma_setup(
handle, dma_flags, baddr, users_daddr, count, minxfer,operation )
pdiag_info_handle_t handle;
int32 dma_flags;
pdiag_addr_t baddr;
pdiag_addr_t users_daddr;
uint32 count;
uint32 minxfer;
uint32 operation;
Description
Attention:
- This function is not supported for Micro Channel or 60X bus type adapters.
- At this time, you can only use this call if the bus type is BUS_BID.
- The operation argument to this function must be PDIAG_DMA_MASTER.
The following is performed by the pdiag_dd_big_dma_setup function
depending on the bus type and operation:
- The pdiag_dd_big_dma_setup() function cross-memory attaches, pins, and maps the user buffer for DMA access by the device. The function currently allows for a transfer sizes greater than 0x1000 bytes, up to DIAG_MULTIPAGESIZE (which is 0x8000 bytes). The resulting bus addresses are mapped as a contiguous space.
- This function issues the d_map_list kernel call for the specified address. The DMA space is managed for the user.
The following are requirements that must be met in order
to use the pdiag_dd_big_dma_setup() function:
- The device-dependant structure (DDS) member maxmaster, which was previously set with pdiag_open(), must have been set to the maximum number of concurrent pdiag_dd_dma_setup()s and pdiag_dd_big_dma_setup()s to be used (that is, the maximum number of pdiag_dd_dma_setup()s and pdiag_dd_big_dma_setup()s called above the number of associated pdiag_dd_dma_complete()s and pdiag_dd_big_dma_complete()s at any given time). maxmaster must be set to at least 1 (one) for this call to pass without a DGX_BOUND_FAIL error.
- The DMA_CONTIGUOUS flag must have been set on the DDS member dma_flags, which was previously set with pdiag_open(), This function returns only a single bus address as a result of the memory mapping operation. The DMA_CONTIGUOUS flag is used to request that the mapping returns only a single address space, rather than a list of discontiguous bus memory regions.
Execution Environment
The diag_dd_big_dma_setup() function can be called from the process environment only.
Parameters
Parameter | Description |
---|---|
handle | Points to pdiag_info_handle_t structure, which is returned from pdiag_open(). |
dma_flags | Use the DMA_READ flag for transferring data from the adapter to user memory. Use 0 (zero) for transferring data from the system to the adapter. For more information on other DMA flags, see the sys/dma.h header file. |
baddr | Points to the user's read or write buffer where the DMA transfer should take place. |
users_daddr | Points to an integer to be filled with the bus memory address of baddr upon successful completion of this call. |
count | Number of bytes to be transferred. |
Return Value
The pdiag_dd_big_dma_setup 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_BOUND_FAIL | The application tried to set up a DMA outside its resources, the count is too large, the resources are currently unavailable, or maxmaster is set to zero. The errno is not set. |
DGX_BADVAL_FAIL | PDIAGEX was unable to update the specified daddr. This might be because the DMA_CONTIGUOUS flag was not set as described above, or other causes. The errno is set to the suword() return code. |
DGX_PINU_FAIL | The application could not pin the specified user buffer. The errno is set to the pinu() return code. |
DGX_XMATTACH_FAIL | The application could not attach user buffer to the physical address. The errno is set to the xmattach() return code. |
DGX_XMALLOC_FAIL | The function could not allocate necessary temporary memory. The errno is not set. |
DGX_FAIL | The user memory could not be mapped to bus memory space. The errno is set to the return code from the d_map_list() call. |