From owner-freebsd-arm@freebsd.org Wed Mar 18 20:36:09 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFE4626C08B for ; Wed, 18 Mar 2020 20:36:09 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic314-21.consmr.mail.ne1.yahoo.com (sonic314-21.consmr.mail.ne1.yahoo.com [66.163.189.147]) (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 48jMJ84ZY6z4Cpp for ; Wed, 18 Mar 2020 20:36:08 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: dKsfGqAVM1mHrPT2roOjZzFz_9pFwrDaojQJ3nk48kShpifP17PdUNx.tood9JX 3XRnu8PktC0ZWbS.y5TJP_ZnbozHpjeGzcb56oDMdcZ6vWDNNUhkjJKDasUko3bpqZLF6nzut0OS Iv524BXkErqDLMGB.8TQSBvUZ0gccmqhvZVg9YunAHxX0x5yBND_WmO_Ci4r8hA0bivT9KeqLZO4 YeTb9jlUuUCMgcDnS8OX.vHvPmbgKln3jgXOqlZEqx7iDVVvmx8527gKJKxFit1jFB2g2MSomuMX 9n.cocTLpHpLOhZzQhTcEGIbEKbF41uz8FpRkfuEO21jY9Gbvb90EbgamT7f058BkmieBYQpwNfG 9IoB0eaFTcv_eRbvbuoyKItgASSKjumsxpl4Q.2TiGFZSOXj.RwoRkIypW7_4FBUgTmC1vZiHBfD B.gisWXQeLvRfQun7xMAr7Q.ftGX2wdsyIK0L61cn4BD9Fsm9wYbY9JsJshthf9ebGiBxox5CPDA D3IrGHNUx5FD4lBzxVdyRyoWxGbYv38GChPjNq.PJ9jQdC8BckYKZns0pHXQIZBrLDSkmdQ_AOVp _VkTycNnZYo8fatk29ZK3C30Jq9J5XFt9FxWLVlGxBcH9lhwN_uq1Bo3q3uXChzOWd.S4wzSEHEe u0ISOgjgksoJz2QL4IODBFF9eVhuenjAUXOtGUOIBfvBW9hTJZzxsF29l.cO3aSrU3fnwA33rSXV V2O__wujejb4k1EbgAI3tWYGuTmRg6eXWWHthFxhlpaIe9owNjSXAINPEZAU.auHuGb9OiQLNVsB OW9UPqcD2rRD0HvzNjGQCjtdpPWp9F7gfsXNbTgtWD4wYnMn1mfF2JohvQ8GF9NFe.N7sHD3MuQW f.HQhHl8arw25jb4UD6lc2iHFeW6botfr3zz0WjeCXwBxm8nb3amdQvzaZTfyHOI5zln3UgHFqKU qtzUJacqGKTnv9bE6ipnrDll1PW97P129O96g156FMA65xz2pP51maTCBhmrvKCnTZTURHwdtzwq Z5BNZQqdR3bWaFPf6IKL3nFGsDt.bzYvGXHmVa3BbO3pdGI6il6gtRlrNGbdMiQEGFjpqKNrgv6I rOi3h4tmijT1EexfqMVKAdtsV6pPiQmvbHNP3BzCM1j7.pffte5jLXVaijsH4KnXDk7.VTg5WlHy kopbGKW8HYlKZrwTS4ThyHP8RkvWM0NfwWW.PvDuTZxC7Of1aOkSwDrAy5.X34VUtKw2rvzPX1Ch ieMzAQSywtdziJzJKYI0mNJyc.0SXtjHHcEOkHyi2vAcAA5d0_R0o1GJu8Xqdk6Vkk_YSRDXf3Cm ef7a8yHptmGtXv.GnyLZCGtCuJksMPPqcY8ErqG3X7TMMlKP2H5yyUmfUfrceShm2fMr_ltGjs0z A5EemOJdeBPh57xybn577ghomQ_5K3gvvhfDDM3yi5zrrV952XDrXPUtaFWw- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ne1.yahoo.com with HTTP; Wed, 18 Mar 2020 20:36:06 +0000 Received: by smtp404.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ae191b1f03707104a6da5e9c2253e209; Wed, 18 Mar 2020 20:36:04 +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 13.0 \(3608.60.0.2.5\)) Subject: head -r538966 on OrangePi+ 2ed: boot loader crashes when USB drive is present at power-on/boot Message-Id: <863312E1-4216-49BA-A623-CAC85F123655@yahoo.com> Date: Wed, 18 Mar 2020 13:36:02 -0700 To: freebsd-arm , FreeBSD Current X-Mailer: Apple Mail (2.3608.60.0.2.5) References: <863312E1-4216-49BA-A623-CAC85F123655.ref@yahoo.com> X-Rspamd-Queue-Id: 48jMJ84ZY6z4Cpp X-Spamd-Bar: + X-Spamd-Result: default: False [1.48 / 15.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; NEURAL_SPAM_MEDIUM(0.99)[0.995,0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[147.189.163.66.list.dnswl.org : 127.0.5.0]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_TLS_LAST(0.00)[]; NEURAL_SPAM_LONG(0.99)[0.987,0]; FROM_EQ_ENVFROM(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)[]; IP_SCORE(0.00)[ip: (4.56), ipnet: 66.163.184.0/21(1.18), asn: 36646(0.94), country: US(-0.05)]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2020 20:36:10 -0000 Without a USB drive present at power-on or boot, the OPi+2e boots fine. (The USB drives involved have a partition holding a ufs file system and a partition holding a swap/aging space.) In all cases below, /boot/ is from the microsd card. But the intended configuration is for vfs.root.mountfrom to be used to direct the stages after kernel-booting to the USB drive. The output sequence related to the crash when the USB drive is present looks like: QUOTE U-Boot SPL 2019.07 (Aug 02 2019 - 11:19:36 +0000) DRAM: 2048 MiB Trying to boot from MMC1 U-Boot 2019.07 (Aug 02 2019 - 11:19:36 +0000) Allwinner Technology CPU: Allwinner H3 (SUN8I 1680) Model: Xunlong Orange Pi Plus 2E DRAM: 2 GiB MMC: Device 'mmc@1c11000': seq 1 is in use by 'mmc@1c10000' mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1 Loading Environment from FAT... Unable to use mmc 1:1... In: serial Out: serial Err: serial Net: phy interface7 eth0: ethernet@1c30000 starting USB... Bus usb@1c1a000: USB EHCI 1.00 Bus usb@1c1a400: USB OHCI 1.0 Bus usb@1c1b000: USB EHCI 1.00 Bus usb@1c1b400: USB OHCI 1.0 Bus usb@1c1c000: USB EHCI 1.00 Bus usb@1c1c400: USB OHCI 1.0 Bus usb@1c1d000: USB EHCI 1.00 Bus usb@1c1d400: USB OHCI 1.0 scanning bus usb@1c1a000 for devices... 1 USB Device(s) found scanning bus usb@1c1a400 for devices... 1 USB Device(s) found scanning bus usb@1c1b000 for devices... 1 USB Device(s) found scanning bus usb@1c1b400 for devices... 1 USB Device(s) found scanning bus usb@1c1c000 for devices... 1 USB Device(s) found scanning bus usb@1c1c400 for devices... 1 USB Device(s) found scanning bus usb@1c1d000 for devices... 2 USB Device(s) found scanning bus usb@1c1d400 for devices... 1 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found Hit any key to stop autoboot: 0=20 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found U-Boot script /boot.scr 199 bytes read in 1 ms (194.3 KiB/s) ## Executing script at 43100000 384312 bytes read in 19 ms (19.3 MiB/s) ## Starting application at 0x42000000 ... Consoles: U-Boot console =20 Compatible U-Boot API signature found @0xb9f6ea60FreeBSD/armv7 U-Boot = loader, Revision 1.3 DRAM: 2048MB Number of U-Boot devices: 2 U-Boot env: loaderdev not set, will probe all devices. Found U-Boot device: disk Probing all devices... Checking unit=3D0 slice=3D partition=3D...data abort pc : [<42009068>] lr : [<420603f8>] reloc pc : [] lr : [] sp : b9f649f8 ip : 42062900 fp : b9f64a28 r10: b9f64a58 r9 : 42062640 r8 : 420623c0 r7 : 420626c0 r6 : 00000000 r5 : 42062650 r4 : 420626c0 r3 : 00000000 r2 : 00000980 r1 : 00000000 r0 : 000000ee Flags: nZCv IRQs off FIQs off Mode SVC_32 Code: e3500080 1afffefb e5d801c2 e35000ee (059821c6)=20 Resetting CPU ... resetting ... END QUOTE Stopping it earlier and using: setenv loaderdev mmc 0 boot avoids the problem because it avoids "probing" the USB drive at the stage indicated above. But the boot then actually uses: vfs.root.mountfrom=3D"ufs:/dev/gpt/BPIM3root" in the /boot/loader.conf on the microsd card. ufs:/dev/gpt/BPIM3root is a reference to the ufs partition on the USB media. (With the mountfrom commented out the microsd card is bootable by itself.) So later the USB drive is put to use successfully when the initial probing is avoided. Looking in the /usr/src/stand/uboot/common/main.c code shows: static int probe_disks(int devidx, int load_type, int load_unit, int load_slice, int load_partition) { . . . if (load_unit =3D=3D -1) { printf(" Probing all %s devices...\n", = device_typename(load_type)); /* Try each disk of given type in succession until one = works. */ for (unit =3D 0; unit < UB_MAX_DEV; unit++) { currdev.dd.d_unit =3D = uboot_diskgetunit(load_type, unit); if (currdev.dd.d_unit =3D=3D -1) break; print_disk_probe_info(); open_result =3D devsw[devidx]->dv_open(&f, = &currdev); if (open_result =3D=3D 0) { printf(" good.\n"); return (0); } printf("\n"); } return (-1); } . . . } So it appears that the crash is during the code involved for the line: open_result =3D devsw[devidx]->dv_open(&f, &currdev); Note that the boot attempt reported "Probing all devices..." so device_typename(load_type) came up with "". (I've no clue if that is significant to the issue or not.) It appeared that /usr/src/stand/usb/storage/umass_loader.c and its umass_disk_open and umass_disk_open_sub might be involved and then code from the likes of: /usr/src/sys/dev/usb/ --such as from usb_msctest.c for usb_msc_read_capacity. (I stopped looking around there: well outside areas I know how to interpret.) For reference, I used the OPi+2e u-boot material from my poudriere-devel based port builds: # ls -ldT /usr/local/share/u-boot/u-boot-orangepi-plus-2e/* -rw-r--r-- 1 root wheel 503 Oct 26 19:12:16 2019 = /usr/local/share/u-boot/u-boot-orangepi-plus-2e/README -rw-r--r-- 1 root wheel 199 Oct 26 19:12:16 2019 = /usr/local/share/u-boot/u-boot-orangepi-plus-2e/boot.scr -rw-r--r-- 1 root wheel 66 Oct 26 19:12:16 2019 = /usr/local/share/u-boot/u-boot-orangepi-plus-2e/metadata -rw-r--r-- 1 root wheel 471250 Oct 26 19:12:16 2019 = /usr/local/share/u-boot/u-boot-orangepi-plus-2e/u-boot-sunxi-with-spl.bin (The USB drives are USB SSDs.) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)