Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jan 2015 21:39:36 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276726 - in head/sys: dev/ofw powerpc/pseries
Message-ID:  <201501052139.t05LdaFd058332@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Mon Jan  5 21:39:35 2015
New Revision: 276726
URL: https://svnweb.freebsd.org/changeset/base/276726

Log:
  Restore use of ofw_bus_intr_to_rl() in the pseries vdevice driver after fixing
  ofw_bus_intr_to_rl() to match the spec for unspecified interrupt-parent
  properties.

Modified:
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/powerpc/pseries/vdevice.c

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==============================================================================
--- head/sys/dev/ofw/ofw_bus_subr.c	Mon Jan  5 20:50:44 2015	(r276725)
+++ head/sys/dev/ofw/ofw_bus_subr.c	Mon Jan  5 21:39:35 2015	(r276726)
@@ -382,9 +382,17 @@ ofw_bus_intr_to_rl(device_t dev, phandle
 	if (nintr > 0) {
 		if (OF_searchencprop(node, "interrupt-parent", &iparent,
 		    sizeof(iparent)) == -1) {
-			device_printf(dev, "No interrupt-parent found, "
-			    "assuming direct parent\n");
-			iparent = OF_parent(node);
+			for (iparent = node; iparent != 0;
+			    iparent = OF_parent(node)) {
+				if (OF_hasprop(iparent, "interrupt-controller"))
+					break;
+			}
+			if (iparent == 0) {
+				device_printf(dev, "No interrupt-parent found, "
+				    "assuming direct parent\n");
+				iparent = OF_parent(node);
+			}
+			iparent = OF_xref_from_node(iparent);
 		}
 		if (OF_searchencprop(OF_node_from_xref(iparent), 
 		    "#interrupt-cells", &icells, sizeof(icells)) == -1) {
@@ -430,3 +438,4 @@ ofw_bus_intr_to_rl(device_t dev, phandle
 	free(intr, M_OFWPROP);
 	return (err);
 }
+

Modified: head/sys/powerpc/pseries/vdevice.c
==============================================================================
--- head/sys/powerpc/pseries/vdevice.c	Mon Jan  5 20:50:44 2015	(r276725)
+++ head/sys/powerpc/pseries/vdevice.c	Mon Jan  5 21:39:35 2015	(r276726)
@@ -128,12 +128,14 @@ vdevice_attach(device_t dev) 
 {
 	phandle_t root, child;
 	device_t cdev;
-	int icells, i, nintr, *intr;
-	phandle_t iparent;
 	struct vdevice_devinfo *dinfo;
 
 	root = ofw_bus_get_node(dev);
 
+	/* The XICP (root PIC) will handle all our interrupts */
+	powerpc_register_pic(root_pic, OF_xref_from_node(root),
+	    1 << 24 /* 24-bit XIRR field */, 1 /* Number of IPIs */, FALSE);
+
 	for (child = OF_child(root); child != 0; child = OF_peer(child)) {
 		dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO);
 
@@ -144,25 +146,7 @@ vdevice_attach(device_t dev) 
                 }
 		resource_list_init(&dinfo->mdi_resources);
 
-		if (OF_searchprop(child, "#interrupt-cells", &icells,
-		    sizeof(icells)) <= 0)
-			icells = 2;
-		if (OF_getprop(child, "interrupt-parent", &iparent,
-		    sizeof(iparent)) <= 0)
-			iparent = -1;
-		nintr = OF_getprop_alloc(child, "interrupts", sizeof(*intr),
-		    (void **)&intr);
-		if (nintr > 0) {
-			for (i = 0; i < nintr; i += icells) {
-				u_int irq = intr[i];
-				if (iparent != -1)
-					irq = ofw_bus_map_intr(dev, iparent,
-					    icells, &intr[i]);
-
-				resource_list_add(&dinfo->mdi_resources,
-				    SYS_RES_IRQ, i, irq, irq, i);
-			}
-		}
+		ofw_bus_intr_to_rl(dev, child, &dinfo->mdi_resources);
 
                 cdev = device_add_child(dev, NULL, -1);
                 if (cdev == NULL) {



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