Date: Thu, 6 Dec 2018 04:25:13 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341614 - head/sys/powerpc/powermac Message-ID: <201812060425.wB64PDrs045069@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Thu Dec 6 04:25:12 2018 New Revision: 341614 URL: https://svnweb.freebsd.org/changeset/base/341614 Log: 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 Modified: head/sys/powerpc/powermac/macgpio.c Modified: head/sys/powerpc/powermac/macgpio.c ============================================================================== --- head/sys/powerpc/powermac/macgpio.c Thu Dec 6 02:38:42 2018 (r341613) +++ head/sys/powerpc/powermac/macgpio.c Thu Dec 6 04:25:12 2018 (r341614) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812060425.wB64PDrs045069>