From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 2 21:30:33 2006 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 A4F0C16A548 for ; Sun, 2 Jul 2006 21:30:33 +0000 (UTC) (envelope-from iedowse@iedowse.com) Received: from nowhere.iedowse.com (nowhere.iedowse.com [82.195.144.75]) by mx1.FreeBSD.org (Postfix) with SMTP id 489D3440F5 for ; Sun, 2 Jul 2006 21:03:49 +0000 (GMT) (envelope-from iedowse@iedowse.com) Received: from localhost ([127.0.0.1] helo=iedowse.com) by nowhere.iedowse.com via local-iedowse id ; 2 Jul 2006 22:03:47 +0100 (IST) To: Hans Petter Selasky In-Reply-To: Your message of "Sun, 02 Jul 2006 21:06:21 +0200." <200607022106.22935.hselasky@c2i.net> Date: Sun, 02 Jul 2006 22:03:47 +0100 From: Ian Dowse Message-ID: <200607022203.aa83223@nowhere.iedowse.com> Cc: David Malone , freebsd-hackers@freebsd.org Subject: Re: contiguous memory allocation problem 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: Sun, 02 Jul 2006 21:30:33 -0000 In message <200607022106.22935.hselasky@c2i.net>, Hans Petter Selasky writes: >Ok. So the solution to my problem is to use scatter and gather. I will see >about updating my USB system to do it like that. > >But there is one thing I do not understand yet. When you load a page that >physically resides above 4GB, because a computer has more than 4GB of memory, >how does "bus_dmamap_load()" move that page down below 4GB, so that the >32-bit USB host controllers can reach it? What should happen is that bus_dma allocates a bounce buffer and performs copies as required from within the bus_dmamap_sync() calls. This is something I haven't been able to verify yet with the USB code though, so there could easily be bugs there. BTW, as far as I know bus_dma is also missing support for multi-segment allocations, so for example if you ask it to allocate 16k in at most 4 segments below the 4GB mark, it will actually attempt a physically contiguous allocation. If this was fixed it could be used by usbd_alloc_buffer() to give directly usable buffers without contiguous allocations. Ian