From owner-freebsd-new-bus@FreeBSD.ORG Mon Oct 2 17:24:03 2006 Return-Path: X-Original-To: freebsd-new-bus@freebsd.org Delivered-To: freebsd-new-bus@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 00F3D16A4F1 for ; Mon, 2 Oct 2006 17:24:03 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6168043D6A for ; Mon, 2 Oct 2006 17:24:00 +0000 (GMT) (envelope-from john@baldwin.cx) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k92HNpC0017897 for ; Mon, 2 Oct 2006 13:23:55 -0400 (EDT) (envelope-from john@baldwin.cx) From: John Baldwin To: freebsd-new-bus@freebsd.org Date: Mon, 2 Oct 2006 13:23:50 -0400 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610021323.50997.john@baldwin.cx> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 02 Oct 2006 13:23:56 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/1973/Mon Oct 2 11:18:33 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Subject: Properly managing sub-allocations X-BeenThere: freebsd-new-bus@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD's new-bus architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2006 17:24:03 -0000 I'm trying to cleanup a few things in apci and I ran into what I think is a new-bus architecture issue. Specifically, acpi likes to allocate system resource resources from its parent, and then turn around and sub-alloc those out to children. This mostly works fine except for the bus space details of the bus tag and bus handle. Currently acpi(4) just copies the tag from the corresponding resource from the parent and sets the handle to the start of the resource. This just happens to work currently because i386 and amd64 use the start of the resource for the handle for SYS_RES_IO and overwrite the handle in nexus_activate_resource() for SYS_RES_MEMORY. This does add some ugliness though in that acpi needs to go find the parent resouce to copy the bus tag. However, it's current algorithm wouldn't work in general (PC98 needs to alloc bus handles, and it does so in nexus_alloc_resource() for example). To solve this, I think we need to stop setting bus tags and handles in bus_alloc_resource(). One solution might be to add a new bus method to set those for a resource, but I think the better solution would be to set the bus tags and handles in bus_activate_resource(). It already sort of does this for some cases (SYS_RES_MEMORY on x86 for example) and will work with the existing ACPI model (it already passes up activate_resource to the parent, so we would just have to remove the explicit setting of the bus tag and handle). I actually wonder if this isn't how things are supposed to be in the first place and that the current aberrations are just bugs? -- John Baldwin