From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 25 20:09:19 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D7FD316A41F for ; Tue, 25 Oct 2005 20:09:19 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95A9843D49 for ; Tue, 25 Oct 2005 20:09:18 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Tue, 25 Oct 2005 16:26:02 -0400 From: John Baldwin To: Dinesh Nair Date: Tue, 25 Oct 2005 16:10:52 -0400 User-Agent: KMail/1.8.2 References: <435E3003.4050609@alphaque.com> <200510251327.59965.jhb@freebsd.org> <435E7D8C.90401@alphaque.com> In-Reply-To: <435E7D8C.90401@alphaque.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510251610.53127.jhb@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: correct use of bus_dmamap_sync X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2005 20:09:20 -0000 On Tuesday 25 October 2005 02:46 pm, Dinesh Nair wrote: > On 10/26/05 01:27 John Baldwin said the following: > > On Tuesday 25 October 2005 09:15 am, Dinesh Nair wrote: > >>(must i malloc space for them before passing them into those functions, > >> or will the call to bus_dmamem_alloc do it for me ?) > > > > bus_dmamem_alloc() will do it for you. > > thanx. > > > Probably not as the sync()'s don't really do anything with memory > > allocated via bus_dmamem_alloc(). The operations are named from the > > CPU's perspective, > > however, the man page at > http://www.freebsd.org/cgi/man.cgi?query=bus_dmamap_sync&apropos=0&sektion= >0&manpath=FreeBSD+5.4-stable&format=html says, > > "Although no explicit loading is required to access the memory referenced > by the returned map, the synchronization requirements as described in the > bus_dmamap_sync() section still apply." Yes, and on some archs the sync() operations do have memory barriers in place, but there isn't any bounce buffering with bus_dmamem_alloc() memory. > also, is bus_dmamap_load() required, since the same man page section above > says it isnt ? Well, you need it to get the physical address to pass to your device for it to do DMA against. > have things changed between freebsd 4.x (which i'm using) and freebsd 5.x ? I don't think so as far as the interface. > > thus when you send data to your device, that is a WRITE operation (even > > though your device is doing a DMA to read data), and when you get data > > back from your device, that is a READ operation (even though your device > > is doing a DMA to write the data into the buffer). > > thanx, the verbiage on the man page is slightly confusing with it's use of > CPU, giving the opposite impression. Yes, I know. :) -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org