diff options
author | ian <ian@FreeBSD.org> | 2014-09-25 15:02:33 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2014-09-25 15:02:33 +0000 |
commit | e2b20df1df60383594cba82c87a9e274a203c0e4 (patch) | |
tree | 8c05a95849482bf2011d96d0f963467525a2b01e /sys/dev/fdt/fdt_common.c | |
parent | 627f648fad5a4583afb310616c761bc7bd041878 (diff) | |
download | FreeBSD-src-e2b20df1df60383594cba82c87a9e274a203c0e4.zip FreeBSD-src-e2b20df1df60383594cba82c87a9e274a203c0e4.tar.gz |
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, which allows
specifying multiple interrupts for a node where each interrupt can have a
separate interrupt-parent. The bindings for this state that the property
cells contain an xref phandle to the interrupt parent followed by whatever
interrupt info that parent normally expects. This leads to having a
variable number of icells per interrupt in the property. For example you
could have <&intc1 1 &intc2 26 9 0 &intc3 9 4>.
Differential Revision: https://reviews.freebsd.org/D803
Diffstat (limited to 'sys/dev/fdt/fdt_common.c')
-rw-r--r-- | sys/dev/fdt/fdt_common.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c index 77cf8ba..9d0c0f0 100644 --- a/sys/dev/fdt/fdt_common.c +++ b/sys/dev/fdt/fdt_common.c @@ -494,46 +494,6 @@ out: } int -fdt_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl, - struct fdt_sense_level *intr_sl) -{ - phandle_t iparent; - uint32_t *intr, icells; - int nintr, i, k; - - nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), - (void **)&intr); - 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); - } - if (OF_searchencprop(OF_node_from_xref(iparent), - "#interrupt-cells", &icells, sizeof(icells)) == -1) { - device_printf(dev, "Missing #interrupt-cells property, " - "assuming <1>\n"); - icells = 1; - } - if (icells < 1 || icells > nintr) { - device_printf(dev, "Invalid #interrupt-cells property " - "value <%d>, assuming <1>\n", icells); - icells = 1; - } - for (i = 0, k = 0; i < nintr; i += icells, k++) { - intr[i] = ofw_bus_map_intr(dev, iparent, icells, - &intr[i]); - resource_list_add(rl, SYS_RES_IRQ, k, intr[i], intr[i], - 1); - } - free(intr, M_OFWPROP); - } - - return (0); -} - -int fdt_get_phyaddr(phandle_t node, device_t dev, int *phy_addr, void **phy_sc) { phandle_t phy_node; |