Author: nwhitehorn
Date: Mon Jan  5 18:15:16 2015
New Revision: 276713
URL: https://svnweb.freebsd.org/changeset/base/276713

Log:
  Revert r272109 locally, which is not quite equivalent in how it deals with
  missing interrupt-parent properties. A better solution will come later,
  but this restores pseries in QEMU for the time being.

Modified:
  head/sys/powerpc/pseries/vdevice.c

Modified: head/sys/powerpc/pseries/vdevice.c
==============================================================================
--- head/sys/powerpc/pseries/vdevice.c  Mon Jan  5 17:23:02 2015        
(r276712)
+++ head/sys/powerpc/pseries/vdevice.c  Mon Jan  5 18:15:16 2015        
(r276713)
@@ -128,6 +128,8 @@ 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);
@@ -142,7 +144,25 @@ vdevice_attach(device_t dev) 
                 }
                resource_list_init(&dinfo->mdi_resources);
 
-               ofw_bus_intr_to_rl(dev, child, &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);
+                       }
+               }
 
                 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