From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 27 01:58:51 2004 Return-Path: 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 A6C5F16A4CF for ; Tue, 27 Jul 2004 01:58:51 +0000 (GMT) Received: from msgbas1x.cos.agilent.com (msgbas1x.cos.agilent.com [192.25.240.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6651B43D55 for ; Tue, 27 Jul 2004 01:58:51 +0000 (GMT) (envelope-from chuck_tuffli@agilent.com) Received: from enccos4.cos.agilent.com (enccos4.cos.agilent.com [130.29.152.93]) by msgbas1x.cos.agilent.com (Postfix) with SMTP id E1E5926EC9 for ; Mon, 26 Jul 2004 19:58:50 -0600 (MDT) Received: from relcos2.cos.agilent.com (130.29.152.237) by enccos4.cos.agilent.com (Sigaba Gateway v3.83) with ESMTP id 16825207; Mon, 26 Jul 2004 19:59:16 -0600 Received: from rtl.rose.agilent.com (rtl.rose.agilent.com [130.30.179.189]) by relcos2.cos.agilent.com (Postfix) with ESMTP id 93AEA5E4 for ; Mon, 26 Jul 2004 19:58:50 -0600 (MDT) Received: from cre85086tuf.rose.agilent.com (cre85086tuf [130.30.174.150]) ESMTP id SAA09932 for ; Mon, 26 Jul 2004 18:58:49 -0700 (PDT) Received: by cre85086tuf.rose.agilent.com (Postfix, from userid 1001) id 62B2319E2B6; Mon, 26 Jul 2004 18:59:24 -0700 (PDT) Date: Mon, 26 Jul 2004 18:59:24 -0700 From: Chuck Tuffli To: hackers@freebsd.org Message-ID: <20040727015923.GA63284@cre85086tuf.rose.agilent.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Subject: bus_alloc_resource question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2004 01:58:51 -0000 I'm having some trouble adding a bus resource and am hoping someone can point out where I goofed. The host bus to a new x86 chipset has a memory mapped region in PCI space that provides access to status and control registers. For a driver to get access to this region, I figured it should call bus_alloc_resource() the same as for any other memory mapped region. This currently doesn't "just work" as the region is not a part of any device's BARs. To add this region as a resource, I used bus_set_resource() device_t dev; uint32_t e_mem = 0xe0000000; struct resource *ecfg_res; dev = pci_find_device(PCI_VENDOR_INTEL, ...); bus_set_resource(dev, SYS_RES_MEMORY, e_mem, 0xe0000000, 0x10000000); but a subsequent call to bus_alloc_resource() returns NULL ecfg_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &e_mem, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); A call to bus_get_resource() shows that the resource did get set as the call returns the correct starting address and count. Is there something else that needs to happen between the set and the alloc? Is this even the correct approach? Thanks in advance! -- Chuck Tuffli Agilent Technologies, Storage Area Networking