diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c index cd1169365d6..5805eb4f45e 100644 --- a/sys/dev/ofw/ofw_bus_subr.c +++ b/sys/dev/ofw/ofw_bus_subr.c @@ -382,9 +382,17 @@ ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl) 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_t node, struct resource_list *rl) free(intr, M_OFWPROP); return (err); } + diff --git a/sys/powerpc/pseries/vdevice.c b/sys/powerpc/pseries/vdevice.c index d2c399b9581..2ec4c3376cc 100644 --- a/sys/powerpc/pseries/vdevice.c +++ b/sys/powerpc/pseries/vdevice.c @@ -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) {