Date: Sat, 13 Apr 2019 19:44:00 -0700 From: Mark Millard <marklmi@yahoo.com> To: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, Justin Hibbits <chmeeedalf@gmail.com> Subject: A usefdt boot-mode problem: openfirmware->fdt translation use vs. some existing powerpc64 or powerpc FreeBSD code, interrupt-parent examples shown Message-ID: <1E438A62-1B2F-4A1D-9537-B1135CE1C89D@yahoo.com>
next in thread | raw e-mail | index | archive | help
I'm going to use interrupt-parent as an example of the type of issue. In the below ofwdump -ap diff extractions: - is from without usefdt mode + is from with usefdt mode - Node 0xff963f60: interrupt-controller + Node 0x2767c: interrupt-controller + phandle: + ff 96 3f 60=20 Note that the Node id changes but a phandle is added hiolding the Node id that openfirmware originally had. Picking an example where interrupt-parent is in use: - Node 0xff964428: extint-gpio1 + Node 0x27800: extint-gpio1 + phandle: + ff 96 44 28=20 . . . interrupt-parent: ff 96 3f 60=20 . . . (openfirmware and fdt are no different for the value contained in the interrupt-parent property: it is the openfirmware node id, not the FDT one.) So, for fdt use, comparison to the phandle property value is is how to find/match this interrupt-controller via a interrupt-parent. Direct use of 0xff963f60 as a node id is inappropriate for usefdt mode. The above is very general and I did not try to match the specific nodes to ones the code below would be using, beyond initially sticking to interrupt-parent types of references. I find there is example code around that makes no prevision for finding the interrupt-parent via a phandle comparison. An example is in unin_chip_add_intr : if (OF_getprop(devnode, "interrupt-parent", &iparent, = sizeof(iparent)) <=3D 0) panic("Interrupt but no interrupt parent!\n"); if (OF_searchprop(iparent, "#interrupt-cells", &icells, = sizeof(icells)) <=3D 0) icells =3D 1; For usefdt mode iparent's value is an openfirmware node id, not a fdt = one. It is the phandle property value that would match. Another is in unin_chip_attach: if (OF_getprop(child, "interrupt-parent", = &iparent, sizeof(iparent)) <=3D 0) { . . . } /* Add an interrupt number 0 to the parent. */ irq =3D MAP_IRQ(iparent, 0); (It appears MAP_IRQ uses powerpc_get_irq and I do not see a stage that can involve the phandle property for matching.) Another may be macgpio_attach: OF_searchencprop(child, "interrupt-parent", = &iparent, sizeof(iparent)); resource_list_add(&dinfo->mdi_resources, = SYS_RES_IRQ, 0, MAP_IRQ(iparent, irq[0]), MAP_IRQ(iparent, irq[0]), 1); Other's besides interrupt-parent . . . There are some gpio-parent properties but I did not find code using them. (I may have just missed such.) I quit looking for code use but did find more types of references in the fdt itself . . . l2-cache in, say, a PowerPC,G4 for usefdt mode is another type of example. platform-enableclock and platform-disableclock seem to be be examples (references back to uni-n in what I looked at, but having the openfirmwire node id, not the fdt one). I may not have found all the example types of "needs phandle property value comparisons instead of direct node id use for usefdt mode". This is all from a 2-socket/1-core-each G4 PowerMac3,6 example. [Even any G5 example would be via 32-bit pweorpc FreeBSD. This is because (for a long time now) use of ofwdump -ap crashes powerpc64 PowerMac's. But I've not gone through a G5 example (yet?).] =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1E438A62-1B2F-4A1D-9537-B1135CE1C89D>