1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-05 18:05:16 +00:00

powerpc/powermac: Fix macgpio(4) child interrupt resource handling

The 'interrupts' property is actually 2 words, not one, on macgpio child
nodes.  Open Firmware's getprop function might be returning the value
copied, not the total size of the property, but FDT's returns the total
size.  Prior to this patch, this would cause the SYS_RES_IRQ resource list
to not be populated when running with the 'usefdt' loader variable set, to
convert the OFW device tree to a FDT.  Since the property is always 2 words,
read both words, and ignore the second.

Tested by:	Dennis Clarke (previous attempt)
MFC after:	2 weeks
This commit is contained in:
Justin Hibbits 2018-12-06 04:25:12 +00:00
parent bdd6b77e1f
commit 7c4f1a1c5a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341614

View File

@ -160,7 +160,7 @@ macgpio_attach(device_t dev)
struct macgpio_devinfo *dinfo;
phandle_t root, child, iparent;
device_t cdev;
uint32_t irq;
uint32_t irq[2];
sc = device_get_softc(dev);
root = sc->sc_node = ofw_bus_get_node(dev);
@ -193,13 +193,13 @@ macgpio_attach(device_t dev)
resource_list_init(&dinfo->mdi_resources);
if (OF_getencprop(child, "interrupts", &irq, sizeof(irq)) ==
if (OF_getencprop(child, "interrupts", irq, sizeof(irq)) ==
sizeof(irq)) {
OF_searchencprop(child, "interrupt-parent", &iparent,
sizeof(iparent));
resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ,
0, MAP_IRQ(iparent, irq), MAP_IRQ(iparent, irq),
1);
0, MAP_IRQ(iparent, irq[0]),
MAP_IRQ(iparent, irq[0]), 1);
}
/* Fix messed-up offsets */