Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 2003 13:42:11 -0500
From:      Hiten Pandya <hiten@unixdaemons.com>
To:        Scott Long <scott_long@btc.adaptec.com>
Cc:        arch@FreeBSD.ORG
Subject:   Re: bus_dmamem_alloc_size()
Message-ID:  <20030129184211.GA70010@unixdaemons.com>
In-Reply-To: <3E35DE8E.2080706@btc.adaptec.com>
References:  <3E35DE8E.2080706@btc.adaptec.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 27, 2003 at 06:36:14PM -0700, Scott Long wrote the words in effect of:
> All,
> 
> With the ongoing effort to convert all of our drivers to busdma, it's
> becoming painfully apparrent that bus_dmamem_alloc() needs to
> be able to specify the size of the buffer to create, and not just
> default to the max_size field of the dma tag.  The reason is that a
> lot of simple hardware out there do understand scatter-gather lists,
> so any data passed to them must be physically contiguous in a
> single segment.  This in turn means that drivers need to allocate a
> single segment buffer via busdma and copy their i/o contents
> into/out of it when talking to the card.  These i/o lengths are often
> extremely variable in size.  Without the ability to allocate variable
> sized buffers, you're forced to either create a custom dma tag per
> i/o transaction, or pre-allocate a huge chunk up front and do your
> own sub allocations out of it.  Both are rather tedious and
> inefficient.
> 
> So, how about adding a method called bus_dmamem_alloc_size()
> that takes the normal arguments of bus_dmamem_alloc(), plus an
> allocation size.  Driver writers would still be encouraged to be smart
> about memory management since contigmalloc() would still be the
> underlying allocator, and contigmalloc rounds all requests up
> PAGE_SIZE.
> 
> Patches to do this are trivial and can be provided on request.  If
> I don't hear any arguments against this, I'll commit it this week.
> In case anyone cares, the my motivation for this comes from trying
> to convert the usb driver to busdma.

NetBSD had added a size parameter to their bus_dmamem_alloc() at some
point.  It was merged from thorpej's branch.  We should probably do the
same, but I think this will be a harder/tedious task.

JFYI.
Cheers.

-- 
Hiten Pandya (hiten@unixdaemons.com, hiten@uk.FreeBSD.org)
http://www.unixdaemons.com/~hiten/

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




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