BSD daemon

NetBSD Documentation:

How SCSI DMA works

Last night I compiled a short story about SCSI DMA machinery. It was originally made for the guy in the Southern Hemisphere at 41S 175E who is working with the R3000 Magnum, but I found it valuable also for the general public. It's slightly incomplete and possibly will be added to in the future. Enjoy.

Tohru Nishimura
Nara Institute of Science and Technology

How SCSI DMA works


How SCSI DMA works


Notes on SCSI DMA (top)

Any DMA transfer poses address constraints as well as minimum and maximum size of transfers. DMA transfer is done in blocks and transfer size must be the multiple of the block size. DMA transaction might not be allowed to run across a particular address boundary because some designs are not flexible enough to cover the arbitrary range of entire address space with given combination of block base address and block counter. It's necessary to take care about the fractional data less than transferring block size. Either of the starting address or ending address is quite likely not aligned to block boundary. The fractional transfer is managed by DMA pointer and special register(s) which hold the residue for alignment fixup task.

Case study 1. DECstation IOASIC (top)

DECstation IOASIC DMA channel poses 8B constraint for starting and ending addresses. Fractional data can be managed with a pair of 32bit registers, SDR0 and SDR1, which is considered concatenated to hold 8B of fractional data to be transferred. Fractions are counted in 2B quantity and indicated in SCR register.

Case study 2. DEC3000 TCDS (top)

DEC3000 TCDS DMA channel poses 4B constraint. Because Alpha processor enforces 4B alignment on any memory references, it's mostly unnecessary to worry about unaligned DMA starting address. Address is likely comfortably aligned for DMA. The hard case which would matter is that pullup transfers from SCSI device might start at unaligned address or end up with leaving fractional residue less than 4B.

Two registers, DUD0 and DUD1, hold 4B quantity respectively. They consist with 1B size indication and 3B worth of fractional data. DUD0 is for unaligned starting address while DUD1 is for unaligned ending address. DUD0 may have an indication at the least significant byte telling which byte of remaining 3B holds fractional residues to be written to memory. As DMA driver knows the starting address of DMA transfer, it's easy to synthesize the destination with fractionals in DUD0. DUD1 may have an indication at the most significant byte telling which byte of remaining 3B holds the fractional residue left unwritten to memory when DMA transaction has stopped. In this case SDA register indicates the address of 4B block yet to have the residue. DMA driver must fixup the transfer tail by synthesizing the destination 4B with fractional residue in DUD1.

Case study 3. Magnum 3000 RAMBO ASIC (top)

RAMBO DMA channel poses 64B constraint. The DMA takes block base address and block count in pair to start DMA transfer. RAMBO DMA manages physically contiguous section of memory. 64B worth of DMA FIFO buffer is designed to handle unaligned DMA starting address and unaligned ending address.

Case study 4. SPARCstation LSI64854 ASIC (top)

XXX

Case study 5. DEC3000 TC SG DMA (top)

High end models of DEC3000 have DMA channel can handle transfers of data populated not contiguously in physical address. Such design is commonly called "scatter-gather DMA." TC SGMAP is the array store to hold physical addresses, or page frame numbers indeed, of given memory object. DMA driver must fill and prepare the SGMAP array adequately for virtually addressed DMA transfer range prior to DMA operations. Then DMA channel starts and continues transferring looking at SGMAP array entries in sequence. The SGMAP design was inherited by descent generations of Digital models.

Case study 6. ARCS ASIC (top)

This design is unique because the DMA channel can manage virtually addressed DMA transfer. Traditional DMA design can work with physically addressed memory objects because it has no knowledge about address translation scheme of virtually addressed memory objects. In that case DMA driver is in charge of resolving virtually addressed transfer address into physical address prior to DMA operations.

ARCS DMA channel runs virtually addressed DMA transfer by looking at the copy of TLB entries in an array which describes the transferring range to resolve the corresponding physical addresses.


Up to NetBSD Documentation: Kernel
Home page
Documentation top level

(Contact us) $NetBSD: scsidma.html,v 1.13 2005/09/28 17:24:21 mishka Exp $
Copyright © 1994-2005 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.
NetBSD® is a registered trademark of The NetBSD Foundation, Inc.