Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Oct 2000 12:19:48 -0500 (CDT)
From:      mark tinguely <tinguely@hookie.cs.ndsu.NoDak.edu>
To:        freebsd-hackers@FreeBSD.ORG, ptacek@technologist.com
Subject:   Re: DMA in drivers?
Message-ID:  <200010231719.MAA50727@hookie.cs.ndsu.NoDak.edu>
In-Reply-To: <NEBBKLFHMJGHPAEKCHJJEEHNCCAA.ptacek@technologist.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>  "This register is used to establish the PCI address for data moving from the
>  the Host Computer Memory to the card. It consists of a 30 bit counter with
>  the low-order 2 bits hardwired as zeros. The address stored may be any
>  nonzero byte length that is a multiple of 8, since 8 bytes are required to
>  make up a DES encryption block.  The Source Address Register is continually
>  updated during the transfer process and will always be pointing to the next
>  unwritten location."
>
>  What do I need to do to get a memory address for the source and destination
>  data for the DMA transfers? It sounds as if these memory addresses must have
>  the last three bits zeros, will this happen automatically?  Right now I am
>  stuck on how this DMA stuff is working and any help would be appreciated.
>  Oh yeah, I am targeting this driver for a FreeBSD 3.x system.

sounds to be that it wants the buffers to be long-word aligned (multiple of
4 bytes) and not greater than 1 GB (address & 0x3ffffffc). the source data
must be null padded so that the length is a multiple of 8 bytes.

other gotchas, the addresses you specified must be the PHYSICAL address, not
the kernel virtual address. use the vtophys(mtr->bigbuf) routine to get
the physical address. The physical page should be wired down, so it
does not get paged out to swap between the time you set up the DMA and
the DMA finish. be sure the data does not cross into another physical page
unless the two pages are contiguous.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010231719.MAA50727>