Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Mar 2005 09:59:07 GMT
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 73513 for review
Message-ID:  <200503190959.j2J9x7IO097781@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=73513

Change 73513 by jmallett@jmallett_windward on 2005/03/19 09:59:07

	Hierarchical attachment.

Affected files ...

.. //depot/projects/mips/sys/dev/arcs/arcs_cpu.c#2 edit
.. //depot/projects/mips/sys/dev/arcs/arcs_dev.c#4 edit
.. //depot/projects/mips/sys/dev/arcs/arcs_fpu.c#2 edit
.. //depot/projects/mips/sys/dev/arcs/arcs_system.c#2 edit

Differences ...

==== //depot/projects/mips/sys/dev/arcs/arcs_cpu.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/mips/sys/dev/arcs/arcs_cpu.c#1 $
+ * $P4: //depot/projects/mips/sys/dev/arcs/arcs_cpu.c#2 $
  */
 
 #include <sys/param.h>
@@ -35,6 +35,7 @@
 #include <sys/limits.h>
 
 #include <dev/arcs/arcs.h>
+#include <dev/arcs/arcs_dev.h>
 
 #include <machine/bus.h>
 
@@ -60,12 +61,12 @@
 
 static devclass_t arcs_cpu_devclass;
 
-DRIVER_MODULE(arcs_cpu, arcs, arcs_cpu_driver, arcs_cpu_devclass, 0, 0);
+DRIVER_MODULE(arcs_cpu, arcs_system, arcs_cpu_driver, arcs_cpu_devclass, 0, 0);
 
 static int
 arcs_cpu_probe(device_t dev)
 {
-	struct ARCS_Component *component;
+	struct ARCS_Component *component, *child;
 
 	component = device_get_softc(dev);
 	if (component == NULL)
@@ -73,5 +74,9 @@
 	device_set_desc(dev, arcs_component_identifier(component));
 	device_printf(dev, "version %d revision %d\n",
 		      component->Version, component->Revision);
+
+	child = ARCS_GetChild(component);
+	if (child != NULL)
+		arcs_configure(dev, child);
 	return (0);
 }

==== //depot/projects/mips/sys/dev/arcs/arcs_dev.c#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/mips/sys/dev/arcs/arcs_dev.c#3 $
+ * $P4: //depot/projects/mips/sys/dev/arcs/arcs_dev.c#4 $
  */
 
 #include <sys/param.h>
@@ -35,6 +35,7 @@
 #include <sys/limits.h>
 
 #include <dev/arcs/arcs.h>
+#include <dev/arcs/arcs_dev.h>
 
 #include <machine/bus.h>
 
@@ -62,89 +63,82 @@
 
 DRIVER_MODULE(arcs, mainbus, arcs_driver, arcs_devclass, 0, 0);
 
-static void
+void
 arcs_configure(device_t parent, struct ARCS_Component *this)
 {
 	struct ARCS_Component *c;
 	device_t me;
+	const char *device;
+	int unit;
 
-	me = parent;
-	if (this != NULL) {
-		const char *device;
-		int unit;
+	device = NULL;
+	unit = this->Key;
 
-		device = NULL;
-		unit = this->Key;
-
-		switch (this->Class) {
-		case ARCS_Component_Class_SystemClass:
-			device = "arcs_system";
-			unit = 0;
+	switch (this->Class) {
+	case ARCS_Component_Class_SystemClass:
+		device = "arcs_system";
+		unit = 0;
+		break;
+	case ARCS_Component_Class_ProcessorClass:
+		switch (this->Type) {
+		case ARCS_Component_Type_Processor_CPU:
+			device = "arcs_cpu";
 			break;
-		case ARCS_Component_Class_ProcessorClass:
-			switch (this->Type) {
-			case ARCS_Component_Type_Processor_CPU:
-				device = "arcs_cpu";
-				break;
-			case ARCS_Component_Type_Processor_FPU:
-				device = "arcs_fpu";
-				break;
-			default:
-				device_printf(parent,
-					      "Unknown ARCS CPU %d\n",
-					      this->Class);
-			}
-			break;
-		case ARCS_Component_Class_CacheClass:
-			/* Not yet. */
-			break;
-		case ARCS_Component_Class_MemoryClass:
-			/* Not yet. */
-			break;
-		case ARCS_Component_Class_AdapterClass:
-			/* Not yet. */
+		case ARCS_Component_Type_Processor_FPU:
+			device = "arcs_fpu";
 			break;
-		case ARCS_Component_Class_ControllerClass:
-			/* Not yet. */
-			break;
-		case ARCS_Component_Class_PeripheralClass:
-			/* Not yet. */
-			break;
 		default:
-			device_printf(parent,
-				      "Unknown ARCS class %d\n",
+			device_printf(parent, "Unknown ARCS CPU %d\n",
 				      this->Class);
 		}
-		if (device != NULL) {
-			me = device_add_child(parent, device, unit);
-			if (me != NULL) {
-				device_set_softc(me, this);
-			}
-		} else {
-			device_printf(parent,
-				      "Not attaching ARCS device "
-				      "class %d, type %d, #%d: %s\n",
-				      this->Class, this->Type,
-				      this->Key,
-				      arcs_component_identifier(this));
-		}
-		c = ARCS_GetPeer(this);
-		if (c != NULL)
-			arcs_configure(parent, c);
+		break;
+	case ARCS_Component_Class_CacheClass:
+		/* Not yet. */
+		break;
+	case ARCS_Component_Class_MemoryClass:
+		/* Not yet. */
+		break;
+	case ARCS_Component_Class_AdapterClass:
+		/* Not yet. */
+		break;
+	case ARCS_Component_Class_ControllerClass:
+		/* Not yet. */
+		break;
+	case ARCS_Component_Class_PeripheralClass:
+		/* Not yet. */
+		break;
+	default:
+		device_printf(parent, "Unknown ARCS class %d\n",
+			      this->Class);
+	}
+	if (device != NULL) {
+		device_printf(parent, "attaching %s\n", device);
+		me = device_add_child(parent, device, unit);
+		if (me != NULL)
+			device_set_softc(me, this);
+	} else {
+		device_printf(parent,
+			      "Not attaching ARCS device "
+			      "class %d, type %d, #%d: %s\n",
+			      this->Class, this->Type, this->Key,
+			      arcs_component_identifier(this));
 	}
-
-	c = ARCS_GetChild(this);
+	c = ARCS_GetPeer(this);
 	if (c != NULL)
-		arcs_configure(me, c);
+		arcs_configure(parent, c);
 }
 
 static int
 arcs_probe(device_t dev)
 {
+	struct ARCS_Component *root;
+
 	if (device_get_unit(dev) != 0)
 		panic("can't have more than one ARCS");
 
 	device_set_desc(dev, "ARCS Component Tree");
-	arcs_configure(dev, NULL);
+	root = ARCS_GetChild(NULL);
+	if (root != NULL)
+		arcs_configure(dev, root);
 	return (0);
 }

==== //depot/projects/mips/sys/dev/arcs/arcs_fpu.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/mips/sys/dev/arcs/arcs_fpu.c#1 $
+ * $P4: //depot/projects/mips/sys/dev/arcs/arcs_fpu.c#2 $
  */
 
 #include <sys/param.h>
@@ -35,6 +35,7 @@
 #include <sys/limits.h>
 
 #include <dev/arcs/arcs.h>
+#include <dev/arcs/arcs_dev.h>
 
 #include <machine/bus.h>
 
@@ -60,12 +61,12 @@
 
 static devclass_t arcs_fpu_devclass;
 
-DRIVER_MODULE(arcs_fpu, arcs, arcs_fpu_driver, arcs_fpu_devclass, 0, 0);
+DRIVER_MODULE(arcs_fpu, arcs_cpu, arcs_fpu_driver, arcs_fpu_devclass, 0, 0);
 
 static int
 arcs_fpu_probe(device_t dev)
 {
-	struct ARCS_Component *component;
+	struct ARCS_Component *component, *child;
 
 	component = device_get_softc(dev);
 	if (component == NULL)
@@ -73,5 +74,9 @@
 	device_set_desc(dev, arcs_component_identifier(component));
 	device_printf(dev, "version %d revision %d\n",
 		      component->Version, component->Revision);
+
+	child = ARCS_GetChild(component);
+	if (child != NULL)
+		arcs_configure(dev, child);
 	return (0);
 }

==== //depot/projects/mips/sys/dev/arcs/arcs_system.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/mips/sys/dev/arcs/arcs_system.c#1 $
+ * $P4: //depot/projects/mips/sys/dev/arcs/arcs_system.c#2 $
  */
 
 #include <sys/param.h>
@@ -35,6 +35,7 @@
 #include <sys/limits.h>
 
 #include <dev/arcs/arcs.h>
+#include <dev/arcs/arcs_dev.h>
 
 #include <machine/bus.h>
 
@@ -65,7 +66,7 @@
 static int
 arcs_system_probe(device_t dev)
 {
-	struct ARCS_Component *component;
+	struct ARCS_Component *component, *child;
 
 	component = device_get_softc(dev);
 	if (component == NULL)
@@ -73,6 +74,11 @@
 	device_set_desc(dev, arcs_component_identifier(component));
 	device_printf(dev, "version %d revision %d\n",
 		      component->Version, component->Revision);
+
+	child = ARCS_GetChild(component);
+	if (child != NULL)
+		arcs_configure(dev, child);
+
 	/*
 	 * Attach busses for this system.
 	 */



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