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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to