dma_mapalloc(D3X)
dma_mapalloc - allocate a DMA map
Showing IRIX 6.5.30 (default release). Unchanged since IRIX 6.5.
NAME dma_mapalloc - allocate a DMA map SYNOPSIS #include "sys/types.h" #include "sys/sema.h" #include "sys/dmamap.h" dmamap_t *dma_mapalloc(int type,int adapter, int num_pages,int flags); Arguments type Must be either DMA_A32VME or DMA_A24VME depending on the transfer desired. (The DMA_SCSI type is reserved for exclusive use by the SCSI host adapter driver.) adapter Specifies the I/O adapter to use for setting up the mapping This should be set to the I/O bus adapter number to which the device doing DMA is attached to. num_pages Specifies the maximum number of mapping registers to allocate. Mapping registers are responsible for translating the addresses that appear on the I/O bus to a format that could be used internally within a system. On current Silicon Graphics systems, each mapping register is capable of mapping a page of length 4096 bytes on the I/O bus to a set of consecutive addresses on system memory. This is true regardless of the system page size. The number of bytes each mapping register is capable of mapping could change in future systems. In order to keep the device driver platform independent, use of the macro io_btoc is recommended to calculate the num_pages parameter for required length of mapping. You need to allocate an extra page for non-page aligned transfers-for example, a transfer of 4096 bytes starting at a non-aligned address actually requires two mapping registers. flags Reserved for future development. For now, you should always set it to 0. DESCRIPTION dma_mapalloc allocates DMA mapping registers on multiprocessor models and returns a pointer to a structure, of type dmamap_t, for later use by the mapping routine dma_map. You need DMA maps to access main memory through VME A24 space. In addition, because DMA maps give you the ability to perform transfers to non-contiguous physical memory, you also want them for A32 access. Use dma_mapfree to free the DMA mapping registers and other resources associated with a given map. VME adapter number to which a device is attached is available at edtinit time via e_adap field in edt structure. It is also possible to get this number by using the function vme_adapter(D3X). This call can block (it calls psema) if no maps are available, so it must never be called at interrupt time. On Challenge and Onyx systems, the maximum amount of address space that can be mapped for DMA by A32 VME devices is 64MB by default. This can be changed by modifying the systune variable nvme32_dma. The value of nvme32_dma is the maximum amount of address space (in megabytes) that may be allocated for A32 VME devices. The default value for nvme32_dma is 64 (corresponding to the standard limit of 64MB of address space). nvme32_dma must be a power of 2 and may not exceed 512 (meaning 512MB). If a value larger than 512 is specified, it will be forced back down to 512. If the value is not a power of 2, it will be rounded up to the next higher power of 2 (but not to exceed 512). Return Values dma_mapalloc returns a pointer to the DMA map structure on models that support DMA maps. On other models, dma_mapalloc returns -1 to indicate that DMA mapping is not possible on that model. See Also dma_map(D3X), dma_mapaddr(D3X), dma_mapfree(D3X), vme_adapter(D3X).