From owner-cvs-src@FreeBSD.ORG Thu Aug 12 01:09:21 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3467F16A4D1 for ; Thu, 12 Aug 2004 01:09:21 +0000 (GMT) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 2EDBE43D46 for ; Thu, 12 Aug 2004 01:09:20 +0000 (GMT) (envelope-from tmoestl@gmx.net) Received: (qmail 10666 invoked by uid 65534); 12 Aug 2004 01:09:18 -0000 Received: from p509076EC.dip.t-dialin.net (EHLO timesink.dyndns.org) (80.144.118.236) by mail.gmx.net (mp007) with SMTP; 12 Aug 2004 03:09:18 +0200 X-Authenticated: #5374206 Received: by abel (Postfix, from userid 1001) id B350E56E; Thu, 12 Aug 2004 03:10:10 +0200 (CEST) Date: Thu, 12 Aug 2004 03:10:10 +0200 From: Thomas Moestl To: John-Mark Gurney Message-ID: <20040812011010.GA4799@timesink.dyndns.org> References: <200408111452.i7BEqXg8071621@repoman.freebsd.org> <20040811150458.GU991@funkthat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline In-Reply-To: <20040811150458.GU991@funkthat.com> User-Agent: Mutt/1.5.6i cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/share/man/man9 bus_dma.9 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2004 01:09:21 -0000 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, 2004/08/11 at 08:04:58 -0700, John-Mark Gurney wrote: > John-Mark Gurney wrote this message on Wed, Aug 11, 2004 at 14:52 +0000: > > jmg 2004-08-11 14:52:33 UTC > > > > FreeBSD src repository > > > > Modified files: > > share/man/man9 bus_dma.9 > > Log: > > fix description of the macros for BUS_DMASYNC opertions. It's from the CPU's > > point of view... Add a reference to a better description of what the ops > > do... > > If you were previously confused (and even if you thought you knew what > they were) on what BUS_DMASYNC_ ops to us, please reread the manpage > and review any drivers written using them. Hmmm. It seems to me that the text the new reference points to is wrong, or at least ambiguous: bus_dmamap_sync() is the method used to ensure that CPU and device DMA access to shared memory is coherent. For example, the CPU might be used to setup the contents of a buffer that is to be DMA'ed into a device. To ensure that the data are visible via the device's mapping of that memory, the buffer must be loaded and a dma sync operation of BUS_DMASYNC_PREREAD must be performed. Additional sync operations must be performed after every CPU write to this memory if additional DMA reads are to be performed. Conversely, for the DMA write case, the buffer must be loaded, and a dma sync operation of BUS_DMASYNC_PREWRITE must be performed. The CPU will only be able to see the results of this DMA write once the DMA has completed and a BUS_DMASYNC_POSTWRITE operation has been performed. When the CPU sets up data to be DMAed into the device from memory, it needs to use a PREWRITE, not POSTREAD, sync before starting the DMA operation. Likewise, after DMAing data out of the device and into memory, a POSTREAD is required. This is quickly evident when looking into the busdma implementations, for example the way the i386 one deals with bounce buffers on syncs. The best way to memorize the flags (and probably their origin) is to imagine a disk controller; a write to disk will need the *WRITE flags (but it reads from memory), and vice versa. NetBSD has a nice clarification: Synchronization operations are expressed from the perspective of the host RAM, e.g., a device -> memory operation is a READ and a memory -> device operation is a WRITE. I think that something of that variety is required, since there are always the two opposite meanings of "reading from" and "reading into". - Thomas -- Thomas Moestl http://www.tu-bs.de/~y0015675/ http://people.FreeBSD.org/~tmm/ OpenPGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (FreeBSD) iD8DBQFBGsNxH+ZPHUGcd2wRAjROAJ0bUw+nWaErxnmVu/yKfbt14tNBhACgvgu8 Uk+uVmuLYeTGEXZt2SuTnm0= =gldJ -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J--