Prepares a page for direct memory access (DMA) I/O or processes a page after DMA I/O is complete.
#include <sys/types.h> #include <sys/errno.h> #include <sys/xmem.h>
unsigned long long xmemdma64 ( struct xmem *dp, caddr_t xaddr,> int flags)
|dp||Specifies a cross-memory descriptor.|
|xaddr||Identifies the address specifying the page for transfer.|
|flags|| Specifies whether to prepare a page for DMA I/O or process it after DMA
I/O is complete. Possible values are:
The xmemdma64 kernel service operates on the page specified by the xaddr parameter in the region specified by the cross-memory descriptor. If the cross-memory descriptor is for the kernel, the xaddr parameter specifies a kernel address. Otherwise, the xaddr parameter specifies the offset in the region described in the cross-memory descriptor.
The xmemdma64 kernel service is provided for machines that have processor-memory caches, but that do not perform DMA I/O through the cache. Device handlers for Micro Channel DMA devices use the d_master service and d_complete kernel service instead of the xmemdma64 kernel service.
If the flag parameter indicates XMEM_HIDE (that is, XMEM_UNHIDE is not set) and this is the first hide for the page, the xmemdma64 kernel service prepares the page for DMA I/O by flushing the cache and making the page invalid. When the XMEM_UNHIDE bit is set and this is the last unhide for the page, the following events take place:
If the page is not in pager I/O state:
The page is made not valid during DMA operations so that it is not addressable with any virtual address. This prevents any process from reading or loading any part of the page into the cache during the DMA operation.
The page specified must be in memory and must be pinned.
If the XMEM_ACC_CHK bit is set, then the xmemdma64 kernel service also verifies access permissions to the page. If the page access is read-only, then the XMEM_WRITE_ONLY bit must be set in the flag parameter.
Note: On the PowerPC platform, which is cache-consistent, the xmemdma64 kernel service does not hide or reveal the page nor does it perform any cache flushing. Instead, on the PowerPC platform, the service's primary function is for real-address translation.
The xmemdma64 kernel service can be called from either the process or interrupt environment.
On successful completion, the xmemdma64 service returns the real address corresponding to the xaddr and xp parameters.
The xmemdma64 kernel service returns a value of XMEM_FAIL if one of the following are true:
The xmemdma64 kernel service is part of Base Operating System (BOS) Runtime.
Cross Memory Kernel Services and Memory Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.
Understanding Direct Memory Access (DMA) Transfer.