From owner-freebsd-questions@FreeBSD.ORG Sun May 7 04:03:49 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C321816A401 for ; Sun, 7 May 2006 04:03:49 +0000 (UTC) (envelope-from pm940@yahoo.com) Received: from web54007.mail.yahoo.com (web54007.mail.yahoo.com [206.190.36.231]) by mx1.FreeBSD.org (Postfix) with SMTP id 3E7FE43D45 for ; Sun, 7 May 2006 04:03:49 +0000 (GMT) (envelope-from pm940@yahoo.com) Received: (qmail 73579 invoked by uid 60001); 7 May 2006 04:03:48 -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=xaCRRo3E+F+C+UeB48ONDa1yvrjLZ+xu4q9Eb9sbBV3k6FMIXH8L3pLiMRqrh2kyJtI7pnDMiOfuYMs8Di3g0Kr05PeA/4/fxfgrsUojCe/qHppN+PHcIxOKOMUZgU0SpGUiFp984NW5GgLzi/oqZgg7V+2jvRszfph3UIi0HL0= ; Message-ID: <20060507040348.73577.qmail@web54007.mail.yahoo.com> Received: from [71.140.186.33] by web54007.mail.yahoo.com via HTTP; Sat, 06 May 2006 21:03:48 PDT Date: Sat, 6 May 2006 21:03:48 -0700 (PDT) From: Paul Marciano To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Question regarding bus_dma_tag_create() . X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 May 2006 04:03:49 -0000 Hi. 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