From owner-freebsd-hackers@FreeBSD.ORG Tue May 9 18:44:12 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 10D3216A470 for ; Tue, 9 May 2006 18:44:12 +0000 (UTC) (envelope-from pm940@yahoo.com) Received: from web54008.mail.yahoo.com (web54008.mail.yahoo.com [206.190.36.232]) by mx1.FreeBSD.org (Postfix) with SMTP id 78D3743D45 for ; Tue, 9 May 2006 18:44:11 +0000 (GMT) (envelope-from pm940@yahoo.com) Received: (qmail 1517 invoked by uid 60001); 9 May 2006 18:44:10 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=omJcmItMWfj/2sJT8JPOMauiwH1CMB9QqWZ/MDZC0w9DIcn+xSVwSgKGkyPHV4Fm6BkLEO9X7+vg6dXqO0PVIO628MvDR0cB7GQ0sMvxq3jihECUBc9nfYgPSwlwtNRuo99h7QdeRVCwoMdqbk7zuZveVVf8Mx7Uog1ZUIhJzV8= ; Message-ID: <20060509184410.1515.qmail@web54008.mail.yahoo.com> Received: from [71.140.186.33] by web54008.mail.yahoo.com via HTTP; Tue, 09 May 2006 11:44:10 PDT Date: Tue, 9 May 2006 11:44:10 -0700 (PDT) From: Paul Marciano To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 09 May 2006 21:24:37 +0000 Subject: Question regarding bus_dma_tag_create(). 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, 09 May 2006 18:44:17 -0000 I posted this onto freebsd-questions a couple of days ago but received no reply. Hopefully this is a more appropriate audience. The man page for bus_dma_map_create() says this about the "nsegments" parameter: Number of discontinuities (scatter/gather seg- ments) allowed in a DMA mapped region. If there is no restriction, BUS_SPACE_UNRESTRICTED may be specified. BUS_SPACE_UNRESTRICTED is #defined as (~0). Then, in busdma_map_create() and busdma_mem_alloc(): if (dmat->segments == NULL) { dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, M_NOWAIT); ... } I don't understand how this works when BUS_SPACE_UNRESTRICTED is specified. The malloc will be fed a -8 (or -12 with PAE) on i386. I'm reviewing a driver at work that specifies nsegments = 0, which I think is invalid, but in reading the man page I came across this ~0 option, which I've also seen in other FreeBSD drivers and I just don't get it. I hope someone can clue me in. Thanks, Paul. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com