Re: correct use of bus_dmamap_sync

From: John Baldwin (jhb_at_freebsd.org)
Date: 10/25/05

  • Next message: Ruslan Ermilov: "Re: correct use of bus_dmamap_sync"
    To: Dinesh Nair <dinesh@alphaque.com>
    Date: Tue, 25 Oct 2005 16:10:52 -0400
    
    

    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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
    "Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: Ruslan Ermilov: "Re: correct use of bus_dmamap_sync"

    Relevant Pages

    • [PATCH] spelling fixes: arch/arm/
      ... copy data to/from buffers located outside the DMA region. ... the remainder of memory is at the top and the DMA memory ... Peers on the PCI bus running ... - * devices are controlles by different NPUs on the same bus, ...
      (Linux-Kernel)
    • [PATCH] [0/13] General DMA zone rework
      ... Traditionally it was designed only for ISA dma which is limited to ... On 32bit i386 with its limited virtual memory space the next zone is ... cannot actually be used for ISA or any other device with <32bit DMA mask. ... I chose to implement a new "maskable memory" allocator to solve these ...
      (Linux-Kernel)
    • Re: Trying to DMA data from PCI bus to IDE
      ... and then use the regular Linux functions to write it to the ... > hdparm has nothing to do with the kernel's in memory caching of disk ... It's still creating a buffer stack somewhere (even ... DMA it directly to the drive by setting the IO ports and registers. ...
      (comp.os.linux.development.system)
    • Re: driver: ddi_dma_alloc_handle issue
      ... and lock down in memory. ... >scatter-gather DMA but needs buffers a lot larger than a single ... >Or, if it's random kernel virtual memory (i.e., memory your driver didn't ... It is a user level process that directly controls the hardware. ...
      (comp.unix.solaris)
    • Re: use/cause of ide=nodma boot parameter?
      ... Some drives do not work reliable with DMA. ... Various chip sets manage memory and cache differently. ... For some chip sets the DMA engines are shared and if the DMA engine is ...
      (Fedora)