summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/pseries
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-10-26 04:01:57 +0000
committerian <ian@FreeBSD.org>2014-10-26 04:01:57 +0000
commit8526d66c636337d8a561fa54ed24f881c8ad347a (patch)
treed30aae75ed4f574bdf983f60ce365f26ac1f52c7 /sys/powerpc/pseries
parent14eb39a57df6f6895c77b2d794c3b6a68e73542f (diff)
downloadFreeBSD-src-8526d66c636337d8a561fa54ed24f881c8ad347a.zip
FreeBSD-src-8526d66c636337d8a561fa54ed24f881c8ad347a.tar.gz
MFC r272109, r272181:
Replace multiple nearly-identical copies of code to walk through an FDT node's interrupts=<...> property creating resource list entries with a single common implementation. This change makes ofw_bus_intr_to_rl() the one true copy of that code and removes the copies of it from other places. This also adds handling of the interrupts-extended property.
Diffstat (limited to 'sys/powerpc/pseries')
-rw-r--r--sys/powerpc/pseries/vdevice.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/sys/powerpc/pseries/vdevice.c b/sys/powerpc/pseries/vdevice.c
index d2c399b..8dadd63 100644
--- a/sys/powerpc/pseries/vdevice.c
+++ b/sys/powerpc/pseries/vdevice.c
@@ -128,8 +128,6 @@ 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);
@@ -144,25 +142,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) {
OpenPOWER on IntegriCloud