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.
This commit is contained in:
nwhitehorn 2015-01-05 21:39:35 +00:00
parent b607899981
commit 1be9b49684
2 changed files with 17 additions and 24 deletions

View File

@ -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);
}

View File

@ -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) {