Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Jul 2006 14:23:53 +0100
From:      Ian Dowse <iedowse@iedowse.com>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        David Malone <dwmalone@maths.tcd.ie>, freebsd-hackers@freebsd.org
Subject:   Re: contiguous memory allocation problem 
Message-ID:  <200607021423.aa76796@nowhere.iedowse.com>
In-Reply-To: Your message of "Sun, 02 Jul 2006 14:33:30 %2B0200." <200607021433.32278.hselasky@c2i.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <200607021433.32278.hselasky@c2i.net>, Hans Petter Selasky writes:
>On Sunday 02 July 2006 14:05, Ian Dowse wrote:
>>   This data structure requires the associated data buffer to be
>>   contiguous (relative to virtual memory), but allows the physical
>>   memory pages to be non-contiguous. Seven page pointers are provided
>>   to support the expression of 8 isochronous transfers. The seven
>>   pointers allow for 3 (transactions) * 1024 (maximum packet size)
>>   * 8 (transaction records) (24576 bytes) to be moved with this
>>   data structure, regardless of the alignment offset of the first
>>   page.
>
>3 * 1024 bytes = 0xC00 bytes
>
>8 * 0xC00 = 0x6000 bytes maximum
>
>According to this you need "6" "EHCI pages", because "6 * 0x1000 = 0x6000". 
>The seventh "EHCI page" is just there to allow one to start at any page 
>offset. There is no eight "EHCI page".
>
>The only solution I see, is to have a double layer ITD. The first layer have 
>the 4 first transfers activated, and the second layer have the 4 last 
>transfers activated.
>
>A little more complicated, but not impossible.

The trick is that if the 0x6000 bytes are contiguous in virtual
memory then they never span more than 6 pages so one iTD is enough.

i.e. you can just do malloc(0x6000) and you don't need multi-page
physically contiguous buffers or extra memory-memory copies regardless
of how the virtual buffer maps to physical pages. This seems to be
the general extent of scatter-gather support offered by the various
USB host controllers (modulo various caveats such as assuming pages
are >= 4k, handling physical addresses > 4GB on non-IOMMU hardware
and UHCI's lack of support for mid-packet non-contiguous page
boundaries).

Ian



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