From owner-freebsd-ppc@freebsd.org Wed Apr 10 09:30:56 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 E4574157D689 for ; Wed, 10 Apr 2019 09:30:55 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic313-19.consmr.mail.gq1.yahoo.com (sonic313-19.consmr.mail.gq1.yahoo.com [98.137.65.82]) (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 A15D397878 for ; Wed, 10 Apr 2019 09:30:54 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 1DYotEYVM1nmMIj9QaxGST9bZt0ZbgsyirAj_mQXjSADGDgoH2xlDlp8SzIgS2k 3ARy.tp2XpwR.tpCLq86zNPKiHLqEUto04oMb5z0HdWCSspvIR5BW3kJhlPKbrHmsHUG.5cez21. xDnoTTewMZtKLiBact.hMjB2d1JIw6KoT1JftCgbzg4rt53nAGnnulUGRvwsCYWfUcVB_mEMdj62 yBdqIE51UcoZCSGljUNMfU06Iixk_ugSdGZPbnuaGCZMP56BHQaN.IaJLHDLJah1_NnUnWlCi8Al BcBwf4WwRcIUL..hPd864z1N2v1wPlxSGZ00KwinNoamGS3tepSHbsrY_4Q9dv.5gr1enaZNK9ly ZLYXzvYGyjCotqCS3MSS3ahiu2mwNzLi_aAvGE3Duh_AkJJnQRh9z.oBd7Ak5kbKu7wVyxsyVviw dvoDv.o9gD96OsTb37MaNpNKhBOIT1XKKlD5uLzV5kGByTbO.7wYxesALpF_dmINAKLbEikJlOsj jkJuF4w95sWBnICz2exc8_cBNUpjy4.kzOXxYTi7kSDAj0SGkyG2nOUSItiigS.uVo3rmLEPWiLb f7ajBE49H0SAYegGVYWLO1BcLalu2Nt7uFEy0rmxlJUSFE9rE1zlAk96_mQtDCqN9iUXvsXz7Imq kY3ljqOEHHe3TlEbvp5A8guCC21C.WbK7ZhYMj.w964YCUo8G2BOQBfaLnmJJ5ZgIiqde7fIDKCz KLChMKdU.x11d1YppX56aRVXU1XTJaZ8vouNTZQO0MgO53d1X_ICSZT1KSQudheR2qfkh.0mtEl7 h3KuJE_w7V3XmgJ3_917c4WyFFMrRD8pIGVJVbx2WcgfbijVrDqlncVyHB_Rz9CNAm_OouSz0mBm lxeDWhMIn6suvNsdDIfOZXne.7HQPf0k86y7lNliADuogVoot5iXWcjYPnCqMaf0d8LMnjlHgQTO XPV.BeNIAZSDm0H1TIqAQm1d9bYrZOcsN3gLEMg8YL7vvBEEAvud9w968JwLE3TSBlAic19.xFkQ gbGlO7OHUbK_DD7wPRfOtoDiuTPz.mt8xX.G_i6NeQd._t03vrugZV15g0bWWeyd.Snq8lzDwm9p xpWUyUw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Wed, 10 Apr 2019 09:30:46 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp426.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID f038fc6665de68e80d50787235cafb67; Wed, 10 Apr 2019 09:30:46 +0000 (UTC) Content-Type: text/plain; charset=utf-8 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 *fully* identified] From: Mark Millard In-Reply-To: <5A26E6F0-13FB-4177-B284-45DA6FBED78E@yahoo.com> Date: Wed, 10 Apr 2019 02:30:45 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <98A19824-3C07-4ED6-A848-5A634F95E1CF@yahoo.com> <9A2F72B7-A25C-478C-B1AD-0661278F0B46@yahoo.com> <88C954A4-6D5A-4AB9-AA26-0ACD6D298605@yahoo.com> <5A26E6F0-13FB-4177-B284-45DA6FBED78E@yahoo.com> To: FreeBSD PowerPC ML , Justin Hibbits X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: A15D397878 X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.64 / 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)[]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DKIM_TRACE(0.00)[yahoo.com:+]; 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:36647, ipnet:98.137.64.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.84)[0.842,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.48)[ip: (5.75), ipnet: 98.137.64.0/21(0.94), asn: 36647(0.75), country: US(-0.06)]; NEURAL_SPAM_MEDIUM(0.18)[0.183,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.64)[0.645,0]; RCVD_IN_DNSWL_NONE(0.00)[82.65.137.98.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: Wed, 10 Apr 2019 09:30:56 -0000 On 2019-Apr-9, at 19:44, Mark Millard wrote: > . . . I discovered a specific PowerMac11,2 vs. PowerMac7,2/PowerMac3,6 difference that is involved: The difference is where nulls are vs. are not . . . I found a linux comment (after the later path evidence was observed): /* Fixup an Apple bug where they have bogus \0 chars in = the * middle of the path in some properties, and extract * the unit name (everything after the last '/'). */ This was in the context of package-to-path use. I have evidence of this (though not from OF_package_to_path use but ofw_getprop_alloc use) . . . The PowerMac11,2 has, for example, in the notation of my dumping tool for looking at diff's of the (sorted) dumps: /device-tree/cpus/PowerPC,G5/cpu-version: hex_bytes_line# 0: 00 44 01 01 /device-tree/cpus/PowerPC,G5/cpu-version: txt_bytes_line# 0: \000D\^A\^A /device-tree/cpus/PowerPC,G5/cpu-version: hex_bytes_line# 0: 00 44 01 01 /device-tree/cpus/PowerPC,G5/cpu-version: txt_bytes_line# 0: \000D\^A\^A /device-tree/cpus/PowerPC,G5/cpu-version: hex_bytes_line# 0: 00 44 01 01 /device-tree/cpus/PowerPC,G5/cpu-version: txt_bytes_line# 0: \000D\^A\^A /device-tree/cpus/PowerPC,G5/cpu-version: hex_bytes_line# 0: 00 44 01 01 /device-tree/cpus/PowerPC,G5/cpu-version: txt_bytes_line# 0: \000D\^A\^A But the PowerMac7,2 and PowerMac3,6 have a null character in the = analogous prefix (produced by the same criteria), here shown with ^@: /device-tree/cpus/PowerPC,970^@/cpu-version: hex_bytes_line# 0: 00 39 02 = 02 /device-tree/cpus/PowerPC,970^@/cpu-version: txt_bytes_line# 0: = \0009\^B\^B /device-tree/cpus/PowerPC,970^@/cpu-version: hex_bytes_line# 0: 00 39 02 = 02 /device-tree/cpus/PowerPC,970^@/cpu-version: txt_bytes_line# 0: = \0009\^B\^B /device-tree/cpus/PowerPC,G4^@/cpu-version: hex_bytes_line# 0: 80 01 03 = 03 /device-tree/cpus/PowerPC,G4^@/cpu-version: txt_bytes_line# 0: = \M^@\^A\^C\^C /device-tree/cpus/PowerPC,G4^@/cpu-version: hex_bytes_line# 0: 80 01 03 = 03 /device-tree/cpus/PowerPC,G4^@/cpu-version: txt_bytes_line# 0: = \M^@\^A\^C\^C The code that produces a name for a ofw node, as shown after a / above, is (C++17 notation): auto name_for_ofw_node=3D [&ofw_fd](auto ofw_nd) -> auto { std::string nd_id_text{}; void* name_buf=3D nullptr; int name_buf_len=3D 0; auto const name_len=3D = ofw_getprop_alloc(ofw_fd,ofw_nd,"name",&name_buf,&name_buf_len,1); if (0(name_buf), static_cast(name_len-1)}; else { . . . (does not happen) . . . } return nd_id_text; }; [With name_len instead of name_len-1 there would be one more '\0' character in each such name after a / (before the first ":"): the terminating null character would be included.] If such a before-the-end-of-path ^@ shows up in the likes of add_node_to_fdt via its use of OF_package_to_path: char name[255], *lastprop, *subname; . . . 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; } then the strrchr will not work as intended and the error message will result (as it does for PowerMac7,2/PowerMac3,6). I'll note that the return value of OF_package_to_path is ignored above but the description I find is: QUOTE package-to-path IN: phandle, [address] buf, buflen OUT: length Returns the fully qualified pathname corresponding to the node = identifier phandle, storing, at most, buflen bytes as a null-terminated = string in the memory buffer starting at the address buf. If the length = of the null- terminated pathname is greater than buflen, the trailing = characters and the null terminator are not stored. Length is the length = of the fully qualified pathname excluding any null terminator, or =E2=80=93= 1 if phandle is invalid. END QUOTE The linux code does use the return value in order to not be fooled by null characters in the middle of the path. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)