From owner-freebsd-ppc@freebsd.org Thu Apr 11 08:33:38 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 38DE2157DEDA for ; Thu, 11 Apr 2019 08:33:38 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic303-20.consmr.mail.ne1.yahoo.com (sonic303-20.consmr.mail.ne1.yahoo.com [66.163.188.146]) (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 B227984B5C for ; Thu, 11 Apr 2019 08:33:36 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: do883pEVM1k45NefVlOQupv_.RCJyFf5rJM3zFH6_oyNbfPAm692B3Y5Ewvb_sB WU0WnBZXFGfms8hLGNmUMoNcQ29cbnukjiJRv9Wz7Nhy6HuMUQi4JGwI9dIGqh0N3fiKUD_5gHS6 whm97kkthpaWLweqWZg.8JxoEDHDga9lWAzA.Yi_4MkogfQYPQgpipO1SpI0mJGCBYPuZaSkGr42 IKOFSAsjeyKlMxUASsJ6Fr.uMxyHhfiyDXzM3Dr9wUKTRdAdFF.OvloWXxDYKmhQCcbx1OOmb_XF eqWIIMNKDoh2yvfZebY08ywtx.u.5b1Pc_n5_PEpLEdPpsCSr2lMN3B1wUZpB8xHwIkadRp42g70 7YbTsAvdSUofC6WHlSrX24BZ3IbSX.RBYs_oJdWwFHZnckpCD_QjPZsJje2sLvletohMkb_n544S TqmbvuBVt54_a4i7GLmqv8crZIXjU96TumY.0HZZC_fPMHNNyz35Vl5Lmq9PoXJyuUiRwU3qEATV myS3hW56jDqbw8qTNQVPwTV0efqxmpuYqp3kRHGd63_YQKz6lDlpfEKtcS7mEST18C7kO7KkEQLd j7v2KURATvWvV4mRWzdxlyXF3HVWCbBxuVUm.M7zgf54UFDDMLJXG1L_mmSIN0D_pKHL7ihhtzsC yijD48hcQVAhhHCtgr8rPjyqbedQwmovJAWW0mCLdhX0edU8lOyG61irQculOWRFDzCi3cEVrQuL 6z6tnGObRd7Ie6IQvEIvmyS8zj0gUaO7cE9KPtS5cK7A2Qo28GHNwSRxkQGPtVBzImWqPt_xgHqi 0RPKKakt7TdIGtQgw5LFv_QxwU0_VxlCRclWke72rMlzYNVzzXEc6h3Iwp1qUmAGDSmWs8AEdvyg DUb7vMFvdaj2oDEXK4te3Ixi2rrPe_Dt7K0dws7SLTqEIHyEICPcG6Q25WFtdplV_qesDOfgBn4l apVRU8MJlEXRFV30TFl66wbTS3_BxtJYNkPc4E2Ju8lz6efyevvNR8Am8FEq7u2oUOUZlW9qMUT2 U5Zp_6pv5fFkkPWfiRdKu7.gpVdCo241oOVwDG7UIaVQW_HXLwO2ITvPjUdI- Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Thu, 11 Apr 2019 08:33:30 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp419.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 59fef32cf687b8d421dd699aa8a46259 for ; Thu, 11 Apr 2019 08:33:25 +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: add_node_to_fdt 's "Detect and correct for errors and strangeness" vs. PowerMac7,2 example's 2 huge driver,AAPL,MacOS,PowerPC properties Message-Id: <8ED03358-E57E-4720-89E2-BEA3D66672CB@yahoo.com> Date: Thu, 11 Apr 2019 01:33:24 -0700 To: FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: B227984B5C X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.30 / 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:36646, ipnet:66.163.184.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)[]; NEURAL_HAM_MEDIUM(-0.18)[-0.182,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.86)[0.859,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ppc@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(1.36)[ip: (4.24), ipnet: 66.163.184.0/21(1.44), asn: 36646(1.15), country: US(-0.06)]; NEURAL_SPAM_LONG(0.78)[0.781,0]; RCVD_IN_DNSWL_NONE(0.00)[146.188.163.66.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: Thu, 11 Apr 2019 08:33:38 -0000 What is unique to the PowerMac7,2 (2 socket, 1 core each) that might contribute to usefdt mode crashing? One point is that its OpenFirmware content is 4 times+ larger compared to some others as viewed view ofwdump -ap outputs: # ls -lTdt ~/ofwdump_*_[og]*.txt -rw-r--r-- 1 root wheel 192603 Apr 7 17:48:15 2019 = /root/ofwdump_11,2_old.txt -rw-r--r-- 1 root wheel 162390 Apr 7 15:40:23 2019 = /root/ofwdump_3,6_good.txt -rw-r--r-- 1 root wheel 818400 Apr 7 15:15:03 2019 = /root/ofwdump_7,2_good.txt It turns out that much of the size is for ATY,Rocket* content: Node 0xff96c1d8: pci Node 0xff9d1708: ATY,RocketParent Node 0xff9f4890: ATY,Rocket_A Node 0xff9f5848: ATY,Rocket_B Specifically: Node 0xff9f4890: ATY,Rocket_A . . . driver,AAPL,MacOS,PowerPC: . . . (thousands of lines, each describing 20 bytes) . . . . . . Node 0xff9f5848: ATY,Rocket_B . . . driver,AAPL,MacOS,PowerPC: . . . (thousands of lines, each describing 20 bytes) . . . This may not mix well with the add_node_to_fdt "Detect and correct for errors and strangeness" handling in: static void add_node_to_fdt(void *buffer, phandle_t node, int fdt_offset) { int i, child_offset, error; char name[255+1], *lastprop, *subname; // +1 added for always = having a trailing '\0' position. void *propbuf; ssize_t proplen; lastprop =3D NULL; while (OF_nextprop(node, lastprop, name) > 0) { proplen =3D OF_getproplen(node, name); /* Detect and correct for errors and strangeness */ if (proplen < 0) proplen =3D 0; if (proplen > 1024) proplen =3D 1024; propbuf =3D malloc(proplen); if (propbuf =3D=3D NULL) { printf("Cannot allocate memory for prop %s\n", = name); return; } OF_getprop(node, name, propbuf, proplen); error =3D fdt_setprop(buffer, fdt_offset, name, propbuf, = proplen); free(propbuf); lastprop =3D name; if (error) printf("Error %d adding property %s to " "node %d\n", error, name, fdt_offset); } . . . If either driver,AAPL,MacOS,PowerPC would ever be used, it would be corrupted by the truncation to 1024 bytes. There is also the overall size of the "buffer" if the drives were to be handled: int fdt_platform_load_dtb(void) { void *buffer; size_t buflen =3D 409600; =20 buffer =3D malloc(buflen); fdt_create_empty_tree(buffer, buflen); add_node_to_fdt(buffer, OF_peer(0), fdt_path_offset(buffer, = "/")); ofwfdt_fixups(buffer); fdt_pack(buffer); =20 fdt_load_dtb_addr(buffer); free(buffer); =20 return (0); } I'm not sure how to tell what buflen would be sufficient, including the status of the 409600 figure currently in use. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)