|
|||
|
Part I Designing Device Drivers for the Solaris Platform 1. Overview of Solaris Device Drivers 2. Solaris Kernel and Device Tree 5. Managing Events and Queueing Tasks 7. Device Access: Programmed I/O DMA Software Components: Handles, Windows, and Cookies 10. Mapping Device and Kernel Memory 14. Layered Driver Interface (LDI) Part II Designing Specific Kinds of Device Drivers 15. Drivers for Character Devices 18. SCSI Host Bus Adapter Drivers 19. Drivers for Network Devices Part III Building a Device Driver 21. Compiling, Loading, Packaging, and Testing Drivers 22. Debugging, Testing, and Tuning Device Drivers 23. Recommended Coding Practices B. Summary of Solaris DDI/DKI Services C. Making a Device Driver 64-Bit Ready |
DMA OperationsThe steps in a DMA transfer are similar among the types of DMA. The following sections present methods for performing DMA transfers. Note - You do not need to ensure that the DMA object is locked in memory in block drivers for buffers that come from the file system. The file system has already locked the data in memory. Performing Bus-Master DMA TransfersThe driver should perform the following steps for bus-master DMA.
Performing First-Party DMA TransfersThe driver should perform the following steps for first-party DMA.
Performing Third-Party DMA TransfersThe driver should perform these steps for third-party DMA.
Certain hardware platforms restrict DMA capabilities in a bus-specific way. Drivers should use ddi_slaveonly(9F) to determine whether the device is in a slot in which DMA is possible. DMA AttributesDMA attributes describe the attributes and limits of a DMA engine, which include:
A device driver must inform the system about any DMA engine limitations through the ddi_dma_attr(9S) structure. This action ensures that DMA resources that are allocated by the system can be accessed by the device's DMA engine. The system can impose additional restrictions on the device attributes, but the system never removes any of the driver-supplied restrictions. ddi_dma_attr StructureThe DMA attribute structure has the following members: typedef struct ddi_dma_attr {
uint_t dma_attr_version; /* version number */
uint64_t dma_attr_addr_lo; /* low DMA address range */
uint64_t dma_attr_addr_hi; /* high DMA address range */
uint64_t dma_attr_count_max; /* DMA counter register */
uint64_t dma_attr_align; /* DMA address alignment */
uint_t dma_attr_burstsizes; /* DMA burstsizes */
uint32_t dma_attr_minxfer; /* min effective DMA size */
uint64_t dma_attr_maxxfer; /* max DMA xfer size */
uint64_t dma_attr_seg; /* segment boundary */
int dma_attr_sgllen; /* s/g length */
uint32_t dma_attr_granular; /* granularity of device */
uint_t dma_attr_flags; /* Bus specific DMA flags */
} ddi_dma_attr_t;where:
SBus ExampleA DMA engine on an SBus in a SPARC machine has the following attributes:
A DMA engine on an SBus in a SPARC machine has the following attribute structure: static ddi_dma_attr_t attributes = {
DMA_ATTR_V0, /* Version number */
0xFF000000, /* low address */
0xFFFFFFFF, /* high address */
0xFFFFFFFF, /* counter register max */
1, /* byte alignment */
0x7, /* burst sizes: 0x1 | 0x2 | 0x4 */
0x1, /* minimum transfer size */
0xFFFFFFFF, /* max transfer size */
0xFFFFFFFF, /* address register max */
1, /* no scatter-gather */
512, /* device operates on sectors */
0, /* attr flag: set to 0 */
};
ISA Bus ExampleA DMA engine on an ISA bus in an x86 machine has the following attributes:
A DMA engine on an ISA bus in an x86 machine has the following attribute structure: static ddi_dma_attr_t attributes = {
DMA_ATTR_V0, /* Version number */
0x00000000, /* low address */
0x00FFFFFF, /* high address */
0xFFFF, /* counter register max */
1, /* byte alignment */
0x7, /* burst sizes */
0x1, /* minimum transfer size */
0xFFFFFFFF, /* max transfer size */
0x000FFFFF, /* address register max */
17, /* scatter-gather */
512, /* device operates on sectors */
0, /* attr flag: set to 0 */
};
|
||
|