From owner-freebsd-ppc@FreeBSD.ORG Thu Dec 20 19:55:14 2007 Return-Path: Delivered-To: powerpc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70CE916A418 for ; Thu, 20 Dec 2007 19:55:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 29A9013C46A for ; Thu, 20 Dec 2007 19:55:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8q) with ESMTP id 225317993-1834499 for ; Thu, 20 Dec 2007 14:37:12 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id lBKJcx3m077488 for ; Thu, 20 Dec 2007 14:39:00 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: powerpc@freebsd.org Date: Thu, 20 Dec 2007 14:31:56 -0500 User-Agent: KMail/1.9.6 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712201431.56657.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 20 Dec 2007 14:39:00 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/5192/Thu Dec 20 12:24:15 2007 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 Cc: Subject: Only set bus tag/handles in activate_resource() methods X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 19:55:14 -0000 This patch (untested) tries to fix an issue on powerpc I fixed on the ACPI-using platforms a while back. It fixes the top-level bus drivers to activate resources (assign bus tags and handles so you can use bus_space_*()) in bus_activate_resource() methods instead of in bus_alloc_resource(). This is important for any drivers that want do what ACPI does: allocate a resource and then subdivide it to hand it out to child devices. A driver that does this can still pass the bus_activate_resource() request up the tree to actually bet bus_space setup with this fix. --- //depot/vendor/freebsd/src/sys/powerpc/powermac/grackle.c 2007/12/19 18:06:08 +++ //depot/user/jhb/acpipci/powerpc/powermac/grackle.c 2007/12/20 18:53:20 @@ -398,8 +398,6 @@ } rman_set_rid(rv, *rid); - rman_set_bustag(rv, &bs_le_tag); - rman_set_bushandle(rv, rman_get_start(rv)); if (needactivate) { if (bus_activate_resource(child, type, *rid, rv) != 0) { @@ -459,6 +457,7 @@ return (ENOMEM); rman_set_virtual(res, p); + rman_set_bustag(rv, &bs_le_tag); rman_set_bushandle(res, (u_long)p); } --- //depot/vendor/freebsd/src/sys/powerpc/powermac/macio.c 2007/12/19 18:06:08 +++ //depot/user/jhb/acpipci/powerpc/powermac/macio.c 2007/12/20 18:42:26 @@ -445,8 +445,6 @@ } rman_set_rid(rv, *rid); - rman_set_bustag(rv, &bs_le_tag); - rman_set_bushandle(rv, rman_get_start(rv)); if (needactivate) { if (bus_activate_resource(child, type, *rid, rv) != 0) { @@ -494,6 +492,7 @@ if (p == NULL) return (ENOMEM); rman_set_virtual(res, p); + rman_set_bustag(rv, &bs_le_tag); rman_set_bushandle(res, (u_long)p); } --- //depot/vendor/freebsd/src/sys/powerpc/powermac/uninorth.c 2007/12/19 18:06:08 +++ //depot/user/jhb/acpipci/powerpc/powermac/uninorth.c 2007/12/20 18:42:26 @@ -382,8 +382,6 @@ } rman_set_rid(rv, *rid); - rman_set_bustag(rv, &bs_le_tag); - rman_set_bushandle(rv, rman_get_start(rv)); if (needactivate) { if (bus_activate_resource(child, type, *rid, rv) != 0) { @@ -429,6 +427,7 @@ if (p == NULL) return (ENOMEM); rman_set_virtual(res, p); + rman_set_bustag(rv, &bs_le_tag); rman_set_bushandle(res, (u_long)p); } --- //depot/vendor/freebsd/src/sys/powerpc/psim/iobus.c 2007/12/19 18:06:08 +++ //depot/user/jhb/acpipci/powerpc/psim/iobus.c 2007/12/20 18:42:26 @@ -339,8 +339,6 @@ } rman_set_rid(rv, *rid); - rman_set_bustag(rv, &bs_le_tag); - rman_set_bushandle(rv, rman_get_start(rv)); if (needactivate) { if (bus_activate_resource(child, type, *rid, rv) != 0) { @@ -388,6 +386,7 @@ if (p == NULL) return (ENOMEM); rman_set_virtual(res, p); + rman_set_bustag(rv, &bs_le_tag); rman_set_bushandle(res, (u_long)p); } -- John Baldwin