From owner-freebsd-drivers@FreeBSD.ORG Fri Apr 7 23:44:17 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 68FF216A402 for ; Fri, 7 Apr 2006 23:44:17 +0000 (UTC) (envelope-from dave@randomparity.com) Received: from fed1rmmtao08.cox.net (fed1rmmtao08.cox.net [68.230.241.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0963A43D55 for ; Fri, 7 Apr 2006 23:44:16 +0000 (GMT) (envelope-from dave@randomparity.com) Received: from gateway.randomparity.com ([68.4.169.57]) by fed1rmmtao08.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407234415.OIIT26964.fed1rmmtao08.cox.net@gateway.randomparity.com> for ; Fri, 7 Apr 2006 19:44:15 -0400 Received: by gateway.randomparity.com (Postfix, from userid 429) id 9CDC731BC83; Fri, 7 Apr 2006 14:21:39 -0700 (PDT) Received: from snoopy.randomparity.com (snoopy.randomparity.com [10.1.1.4]) by gateway.randomparity.com (Postfix) with ESMTP id 6649831BBEB for ; Fri, 7 Apr 2006 14:21:36 -0700 (PDT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Date: Fri, 7 Apr 2006 16:43:59 -0700 Message-ID: <22C21BFBEB52B340A1F422CB0D88F5872E17@snoopy.randomparity.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How Do I Allocate Less Than the Entire BAR for a PCI Device? Thread-Index: AcZanSRE5zPkULDlQFG7cwwpCMElqw== From: "David Christensen" To: X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on gateway.randomparity.com X-Spam-Level: X-Spam-Status: No, score=-2.3 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Subject: How Do I Allocate Less Than the Entire BAR for a PCI Device? X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 23:44:17 -0000 The Ethernet driver I'm working on has a very large PCI BAR mapping=20 for memory (32MB), but I only need 128KB of that BAR memory for use by the driver. How can I map only the amount of memory I need with bus_alloc_resource()? It looks like I can specify the size if I also know the BAR starting address, but I'm not sure how to find that. Has anyone done this or know of any existing code that does this? All of the examples I looked at used all of BAR mapped memory. David Christensen