Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Dec 2007 14:31:56 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        powerpc@freebsd.org
Subject:   Only set bus tag/handles in activate_resource() methods
Message-ID:  <200712201431.56657.jhb@freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712201431.56657.jhb>