From owner-freebsd-ppc@freebsd.org Sun Apr 7 21:36:43 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 B193B156BEF3 for ; Sun, 7 Apr 2019 21:36:43 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic312-21.consmr.mail.bf2.yahoo.com (sonic312-21.consmr.mail.bf2.yahoo.com [74.6.128.83]) (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 5D868738AD for ; Sun, 7 Apr 2019 21:36:42 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 2koGc0MVM1mJxy0pGOM1XsSMz_ZoOOQ07B3XTGrAYj_LcmbKBAD5laqIbatSNjS J2mknDGJFP7wZ_jLjTdeYQh57EzF_4FpBnic7391sokWnw0EQOSZLVuGfBujQ2uItdzFMnjuoP98 ThF4p2BM6yYjl9f.CPd_R6qM7fRrdiwJnJEyKdHdGF0v.aw9iSmPjc1LWmCs4FJJoUD1bOdlihIb iKN0_64BH4ogNGgCPbhaabooR4Uh3Mm.OZ1QVt7sIkbP9Q96_wOgNnWzIK7Jiy8009auHJsuRjSW rUh5xJWlyNtr.D0hxRODZKTm8Yc7xubjEIBJ3LbdNSymm8iTaZKVmXnxYVaavDYPibKJBqdCl4a0 nlg5o0y_G5Q1v0JuRQPgJ2gQDbbgcpRHKo1md3cVqSl73MTTForpQPlKrSZIOMGeVFG1s9GLXeBf kf4VUF.q4AJm3HeG49vYSzqUYvwjNXQBEzFUKiH_K.n_2CfPsseHg0m1uRlZXoMv1H1AlESEaxgM DjKOZs5Pv1sQbhGu.r0CKgBVi.SfEoi9YKHP4G1eZRtfRVTSIZDwLJcaznwFZZpdc02B86eygyDH zUpfJwOfR1q.xMUezlhtGQ7UyKOrxh8yno.YOOZ1Qpkztt.5oRBgSHpJcy6tFviH7.iHgOD2yMx_ 1X97cmkXaR7lSaTvKlBSvR1TI_jDCvbtowP.fyk8HDVdgmeBneONNfT8dbqzpKtwg3I4IP13ohWu b9wUws4GpcLrQ_8q8UbTc_l33JRVTWdpWxRovN036Mmdm9eWdSKlfqLlDSHoSdiTUP.xKsYfd.N3 u2b12Qupg1p7ufZoyOS5VzCh8unN0BZrQo3E..2yzRHG0gE6vmNu8KonpCmQ2GY1SXrbiKNlaKms 8yVASY61kq0MouGhEwi77vOywyNSZ5NY09xnJCEZ6ckURhzNlPx1WJ_1tBwgErWxXt9NLv1RmIWI 5GXCWyD.qlEpKuV.jfOGAWgFeJKQn8aDsetcW4fhuTdL_uMoSWbalgeKiP7wkJWGUh6rS1W7MCXI eIEq3SvCJmize.8oAUcu4SKWztWeCZ1AT7zSTYc_dsXXQDEbtEM33W5fJaY790ta03_y_kvFk1hj Igg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.bf2.yahoo.com with HTTP; Sun, 7 Apr 2019 21:36:40 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp426.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID d79d50990e3b7ae4a5d91964280feb6c; Sun, 07 Apr 2019 21:36:39 +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: Re: head -r345758: usefdt=1 style boot fails on PowerMac7,2 G5 (1 core per socket): Error -2 adding node /cpus/PowerpC,970 [G4 failures too, problem identified] Date: Sun, 7 Apr 2019 14:36:36 -0700 References: To: FreeBSD PowerPC ML , Justin Hibbits In-Reply-To: Message-Id: <98A19824-3C07-4ED6-A848-5A634F95E1CF@yahoo.com> X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: 5D868738AD X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.72 / 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]; RCPT_COUNT_TWO(0.00)[2]; 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)[]; NEURAL_SPAM_SHORT(0.91)[0.914,0]; NEURAL_HAM_LONG(-0.01)[-0.009,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.38)[ip: (4.05), ipnet: 74.6.128.0/21(1.62), asn: 26101(1.29), country: US(-0.06)]; NEURAL_SPAM_MEDIUM(0.95)[0.946,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[83.128.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, 07 Apr 2019 21:36:43 -0000 [The problem also exists on 32-bit powerpc, at least for a PowerMac3,6 example. In this context I was able to gather evidence for the problem, unlike for the PowerMac7,2 .] On 2019-Apr-7, at 05:14, Mark Millard wrote: > [The same SSDs boot the 2 PowerMac11,2 G5 (2-socket/2-core-per-socket) > just fine. I temporarily have access to the PowerMac7,2 and a > different 11,2 G5 that has only 12 GiBytes of RAM --but not the > 16 GiByte one. ] >=20 > Both powerpc64 FreeBSD (built via system-clang) and 32-bit powerpc > FreeBSD (built via gcc 4.2.1) fail the same way. >=20 > The failure looks like (from a picture of a powerpc64 > attempt): >=20 > Booting [/boot/kernel/kernel]. . . > Error -2 adding node /cpus/PowerPC,970 (PowerPC,970), skipping > Kernel entry at 0x100100 . . . >=20 > (and that is the end of the output). >=20 > Note: I had modified the kernel to not require an explicit usefdt=3D1 > --in fact giving not control in the other direction either. So, > always using usefdt=3D1 mode. I had intended to stick with testing > usefdt=3D1 mode. >=20 > Result: As stands I do not have media set up that can boot the > 7,2 . This means that I've not checked any contrasting cases > that do not involve usefdt=3D1 style behavior. >=20 > Thus my attribution of the problem to usefdt=3D1 style behavior is > not validated. I have temporary access to some old PowerMac G4s. So I tried booting a PowerMac3,6 1.42 GHz Dual Processor FW800 as an initial experiment. This note reports the failed results While it does not stop booting . . . It boots as a single CPU machine with no ethernet device (for an example of something else that is missing). It does briefly show messages like: Error -2 adding node /cpus/PowerPC,G4 (PowerPC,G4), skipping Error -2 adding node /pci@f2000000//mac-io@17/gpio@50/gpio5@6f = (gpio5@6f), skipping Error -2 adding node /pci@f2000000//mac-io@17/gpio@50/gpio6@70 = (gpio6@70), skipping Error -2 adding node /pci@f2000000//mac-io@17/gpio@50/gpio11@75 = (gpio11@75), skipping Error -2 adding node /pci@f2000000//mac-io@17/extint-gpio@15@67 = (extint-gpio@15@67), skipping It appears that -2 is: -FDT_ERR_EXISTS #define FDT_ERR_EXISTS 2 /* FDT_ERR_EXISTS: Attempted to create a node or property which * already exists */ The below shows my evidence that for the PowerMac3,6 in question "/cpus/PowerPC,G4" is apparently not a unique textual identification --and that needs to be handled but is not. (The PowerMac7,2 may be similar but did not boot to where I could easily explore.) [I've not gone through the details for the gpio "skipping" reports.] [On the PowerMac3.6 I did: ofwdump -ap > /root/ofwdump_bad.txt Later I looked at the drive in another machine.] ofwdump -ap reports for cpus on the PowerMac3,6: # grep -i cpus /mnt/root/ofwdump_bad.txt=20 Node 0x73d0: cpus #cpus: 'cpus' (later this will be contrasted with the PowerMac11,2 context). Looking: Node 0x73d0: cpus phandle: ff 88 34 00=20 '\M^?\M^H4' core-temp: 00 00 00 41=20 core-voltage: 00 00 00 9b=20 #cpus: 00 00 00 02=20 #size-cells: 00 00 00 00=20 #address-cells: 00 00 00 01=20 name: 63 70 75 73 00=20 'cpus' Node 0x7450: PowerPC,G4 phandle: ff 88 36 d8=20 gpio-parent: ff 96 41 d0=20 . . . But: # grep -i powerpc /mnt/root/ofwdump_bad.txt driver,AAPL,MacOS,PowerPC: Node 0x7450: PowerPC,G4 (There is only the one PowerPC,G4 Node present in the dump output --because the 2nd was treated as in error at boot.) My interpretation is that there are 2: /cpus/PowerPC,G4 /cpus/PowerPC,G4 with no textual differentiation. The Node 0x???? figures seem to be the differentiation. This looks different than on the PowerMac11,2 : # ofwdump -ap | grep -i cpus '/cpus/@3' '/cpus/@2' '/cpus/@1' '/cpus/@0' Node 0xc7f4: cpus 'cpus' # ofwdump -ap | grep -i powerpc Node 0xc864: PowerPC,G5 'PowerPC,G5' Node 0xcb4c: PowerPC,G5 'PowerPC,G5' Node 0xce34: PowerPC,G5 'PowerPC,G5' Node 0xd11c: PowerPC,G5 'PowerPC,G5' In this context /cpus/@N/PowerMacPC,G5 is unique textually without needing the 0x???? figures for the Node's. This matches up with what I see in the code: it is checking for a textual differentiation and only the PowerMac11,2 appears to have such (of what I've seen). The details of tracing the code down follow. The code that reports the failures is: static void add_node_to_fdt(void *buffer, phandle_t node, int fdt_offset) { int i, child_offset, error; char name[255], *lastprop, *subname; void *propbuf; ssize_t proplen; . . . for (node =3D OF_child(node); node > 0; node =3D OF_peer(node)) = { OF_package_to_path(node, name, sizeof(name)); subname =3D strrchr(name, '/'); subname++; child_offset =3D fdt_add_subnode(buffer, fdt_offset, = subname); if (child_offset < 0) { printf("Error %d adding node %s (%s), = skipping\n", child_offset, name, subname); continue; } add_node_to_fdt(buffer, node, child_offset); } } where: int fdt_add_subnode(void *fdt, int parentoffset, const char *name) { return fdt_add_subnode_namelen(fdt, parentoffset, name, = strlen(name)); } and: int fdt_add_subnode_namelen(void *fdt, int parentoffset, const char *name, int namelen) { struct fdt_node_header *nh; int offset, nextoffset; int nodelen; int err; uint32_t tag; fdt32_t *endtag; FDT_RW_CHECK_HEADER(fdt); offset =3D fdt_subnode_offset_namelen(fdt, parentoffset, name, = namelen); if (offset >=3D 0) return -FDT_ERR_EXISTS; . . . and: int fdt_subnode_offset_namelen(const void *fdt, int offset, const char *name, int namelen) { int depth; FDT_CHECK_HEADER(fdt); for (depth =3D 0; (offset >=3D 0) && (depth >=3D 0); offset =3D fdt_next_node(fdt, offset, &depth)) if ((depth =3D=3D 1) && fdt_nodename_eq_(fdt, offset, name, namelen)) return offset; =20 if (depth < 0) return -FDT_ERR_NOTFOUND; return offset; /* error */ } where: static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { int olen; const char *p =3D fdt_get_name(fdt, offset, &olen); =20 if (!p || olen < len) /* short match */ return 0; =20 if (memcmp(p, s, len) !=3D 0) return 0; =20 if (p[len] =3D=3D '\0') return 1; else if (!memchr(s, '@', len) && (p[len] =3D=3D '@')) return 1; else return 0; } No consideration of distinct 0x???? figures for Node are made by fdt_subnode_offset_namelen . At least for the PowerMac3,6 such a differentiation is required if usefdt=3D1 style is to work. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)