From owner-freebsd-ppc@freebsd.org Sun Apr 14 02:44:07 2019 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F7571589ED8 for ; Sun, 14 Apr 2019 02:44:07 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic314-15.consmr.mail.bf2.yahoo.com (sonic314-15.consmr.mail.bf2.yahoo.com [74.6.132.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B668876471 for ; Sun, 14 Apr 2019 02:44:05 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: Df8_IU4VM1lJiVWEV8HRZlUxmwI4uJAkovMvstCX8.knYTPzfYtXhafCb7MedvX uLAWI.oXQZNXoXMSJGtamvL9YdJqnpVpzFm4NKvvL0JByGeqV2ynBjxytPQIs9skIYev_l8H5vOz P8RMaf6tQMSil89KASFwTWz5MscvhQ8Y6u3cGcs80CYfFr9HkyoowyJOjI8clS21U501GQqozNwA 581bMePoz48rf2k7.Kxkt7vgJMbJvgNbjhtoAy_yO7yZvyY0CP0qIPcwtnaor0ZgNpk3igrJvhqn Y1yjv0cRus5PGxbQmldaNlS6kxhVCnndbVximSHsIjBVRlD869oHqqDbpvfRYZW0A8oM71gJ9p8h v9OTJ5tPbosBh2vJLAKyg9Ie_2aD.Bd8pCbnnbew3ifXnrNdHPre6L6UurEKN2uKGpJEk6DPZMbc JGqQPRucH2oW9d_EL.nNBHvY97W_93AzxcGT34YB5r0MOXi2OhZNzjBGusnx275u4ch9T9hd9A0H BGFU2CgYYrUKROdnueO9rEnoPYUMqaWgNQMyI3xqCt6dfW4wH9lx6hlMEHb4jYU9BEGcr5_k1GVl tE1KjEXgPzHVqZkL32PeJObn5qQ8eFhxd_lHgLclUZrMpCw6wuAiYR4EjC.6TvLLOSVMlj_OKVLC BaERoE5.1JxHH.VV_CQaraVtX.n4iy76ENfxpiwdSUo0d7D.U50v.Xtvs2BbsfHpgSJg2pT96wmA StmsD83pH8J0.iHZyHFIFztqrc4WA.w8n_wT6mlm5c9Qk5YP1EJ7LkE1Ig5T98lCHrmxP4w.XY5Y slZ4ra2H05pJbNZTuzcTu0mx4hwH7y6eG2DBEizOmpzPvAk1N9vHB9UvGLe916ovxeM6lmlLZqUJ .EiOKEcRNMcqnWgq8Xuhj86h0cRamA.YB2oQQKkMM80dfDNZsJLX0lxKLT6zbDT72HFCHK8as_vt D.3KMpwOwEpjSpv8EcxpLqvsxF3Xa4yVYlLvuNX2unPgPjMBUENsxWS2ZYlR.MZaYCCfdgxJDyei XGK682XgHgoK.JMCSEFkt_eBR1whTACSsmqlT32VN71cbvTpwXCP0DrsIc3P1JLlWpCP8qk0MAHX GuwDc9ZmW8w-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.bf2.yahoo.com with HTTP; Sun, 14 Apr 2019 02:44:04 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp401.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7aaece546f95b04bb9e9aa8d7632e71a; Sun, 14 Apr 2019 02:44:02 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) 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> Date: Sat, 13 Apr 2019 19:44:00 -0700 To: FreeBSD PowerPC ML , Justin Hibbits X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: B668876471 X-Spamd-Bar: + X-Spamd-Result: default: False [1.97 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:26101, ipnet:74.6.128.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.80)[0.805,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.37)[ip: (4.02), ipnet: 74.6.128.0/21(1.59), asn: 26101(1.28), country: US(-0.06)]; NEURAL_SPAM_MEDIUM(0.10)[0.103,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.21)[0.206,0]; RCVD_IN_DNSWL_NONE(0.00)[125.132.6.74.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2019 02:44:07 -0000 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)