From nobody Sun Dec 25 03:15:43 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NfmJv6wWZz1J0GK for ; Sun, 25 Dec 2022 03:15:59 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic307-8.consmr.mail.gq1.yahoo.com (sonic307-8.consmr.mail.gq1.yahoo.com [98.137.64.32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4NfmJt4tzPz3w13 for ; Sun, 25 Dec 2022 03:15:58 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b="SA9QFj/D"; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.64.32 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1671938156; bh=tW2j8CnDPeAGkayjXj1c8HvBS0XEqwTMOD/x/cyznMg=; h=From:Subject:Date:To:References:From:Subject:Reply-To; b=SA9QFj/D6l4xowsKCoeLJhW2Cwt3xsQhNtvBwt+TyqZGg3cIFcta+p8QMk6vF821K8NP8IqRxQ+P6ktJBs1SJ3LnLZBzMrjiOMHgb5t8K9mwfQdMPoGFEuJ4wfwFHVMurETrVt/6+uJsd0aqeHTl/6FK0H6yqDfVtwuyKNO9b9C9pvbYXcrxTSHLHw5nsb8EyzF7miOCJK1nK9CRPPWAlCyWo2Tp4v5ITqh71sUXZp+1mt6/4rM85mF6DMIXiW2EiZ9EMS2cvtPOa0nOPoI1IOLEBQFeIBgpbQFOOVT4erTGsg4oIe35cNmbk1VJLe/EWzglJvA1Z3CSyp/9HhXrfg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1671938156; bh=st4WIr/QemW1d9HLIj/aEyppqqekkAnJQJMyDDN72nb=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=H0hdK5JiyZjpSCd6ZnGq803UT9MEjYhqASF+nO1mtMNBjmqXXqvnndgXBLdavxKbgz4Gj7vmE6N5ASL1qh+oJJOP0N9iwEAJg2q8PxtQREsexbd0MiIJqLJjn+mttDdvzD/rBBD5wA0/cnuziUef3x2BmU13OjoxK4M46ptslbDCKYR9jtSPERA5Rf36Hl0xQK+gEOwcViFth6CLqJ2DK/Wh4A22wUKHDJHH1UyJtfF84UGwpOdQ2O57MG3D7B6YAZOkajUJ2u9hdiqI+aRSRQ/S+bkv73HkkZg+132ZGddFRSBz2S/6enbYQ2VIETB7MyVRN8iWsYmfjEMFDxZpLA== X-YMail-OSG: azTER9kVM1mywro46pkp6QiFRrp5N.AwZa7_F1XVXd.dkRbc1ctfDOrgvufdyoH DVciuEFA_lFDUVV0HB5b4sqBWxeOEMq6H79MM2VzeVWJ3DeUx67l9WQdoI_W5jVZeMLNrDmsQVX5 jz3wWQdBK6..3DcGfvCg1xi5e65Gvt2t6qUyMPiX5sqRiTC0SxJdClL9p26tDQEisikt6NMtUMLD 5HuNTMKlody.Va7CWbO1_y.ZtVSMTGE9NntkO_u5GvqbsroqH1_SJLcILJxuWAEMZ8xxnuMeaOB. NKgF8GDgseL8SvoccelvDUOvihrVSt31Uttg5FeOe4y5lfqE9MVV.JgGEfxDMpXufHfX4cJgeKtd KSA2yQy5rK24ycXVUCiirGKveehX04O1XcB0OQZekWdHgiI14wiDN_GESQy0vcnVQsmTnaU2ZNuH HvELpkexd_OpZy.GdnZSiFkF7bMtmUaILwn56cN9rqKyZUnnwenJ.BmRUUSeg6altXwvb9FTuOOs xzxk89NaI_kyj5gqAX7kVjywfH9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1Bgv.UTS8Gr2nUKMHpVpuupXhpSVpR9fEyT2_0yY1JZ8k EU1xP2uklY8DE165YBUyYF83jHQf3aZV2.zy6s3ZcaoK.IP5KMfpz6vRpeqSz79K3aGCokG2jpRS D0fa4RjCH8eurFAsRhJbn2KP3R9Rw41LH3xbW6cWHWVUH6vUHH7fXH4YD.BD1hWti612M5OLGFq0 xuebN6bwTCCVcgtJlvGoeuSQLXxSkrNdsdpPaCjSozqrn2GPKtfN3UukdXekHXdiIhGEPgg9T2vp BzYXddgbK6KXjgXIAGWBlSrYGDmBbHADy6Ex3aIxWwTPAeBLEgWe5o5NfPCJqf3gU9cBk7ioEUJZ xYpzKLrTS4eiPb337d9ICE.ix6JzuZ3u70E3lgub2fsRwf2Ll86C0IB4nQj2WoTKK7STTdM3OXfT 9VYvvdt6ynrnjlHuPjZX516f7DH4WmggZvJKF4NuJ7ZooYJ.YgjKb4DkZZFG5mc4yj6raAm1W9VA JdA4GcnARwnmNgfrZqNtVznYR8dT7lr5tlyY0k0l4s7gsS0yjM8KM6Tvar8Z8yjZdwyUdc7g4LRQ PC1kgMLU0sojm11XDWWmnL0PWmOzYCH5EjK.sin8OjzqdMtvMMbJMUS8G6OwpAyRKWhkOcJsQGzo wtyKUBlYEgWXWKqZNtg_kSBx8tYsXBlVOuBhMGkmQsNlt_2D5UGa7MslSFrTW X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.gq1.yahoo.com with HTTP; Sun, 25 Dec 2022 03:15:56 +0000 Received: by hermes--production-bf1-5458f64d4-tg4jl (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 4b5a8f5d8f9e5f2e2ee2eb1adb9d9270; Sun, 25 Dec 2022 03:15:55 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: How to make FreeBSD's kernel boot a RPi4B with modern RPi* firmware Message-Id: <9C037D3F-A440-4708-993D-117F313691BB@yahoo.com> Date: Sat, 24 Dec 2022 19:15:43 -0800 To: freebsd-arm X-Mailer: Apple Mail (2.3731.300.101.1.3) References: <9C037D3F-A440-4708-993D-117F313691BB.ref@yahoo.com> X-Spamd-Result: default: False [-3.37 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.87)[-0.867]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.32:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[yahoo.com]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.32:from] X-Rspamd-Queue-Id: 4NfmJt4tzPz3w13 X-Spamd-Bar: --- X-ThisMailContainsUnwantedMimeParts: N I finally ran into EARLY_DRIVER_MODULE, BUS_PASS_RESOURCE, BUS_PASS_ORDER_MIDDLE and the like and they allow being sure that the brcm,bcm2835-dma related setup has been done before any use of it is made, despite the order in the Device Tree: use an earlier pass for brcm,bcm2835-dma related attach. This avoids the kernel crashing during boot. The example context used below has: serial console with USB3 SSD boot media (not requiring a usb_pgood_delay setting), booting a stable/13. The RPI4B is a C0T one (no 3 GiByte limitation, for example: the PCIe wrapper logic has been corrected). stable/13's source code changes ( similarly for releng/13.1 ): diff --git a/sys/arm/broadcom/bcm2835/bcm2835_dma.c = b/sys/arm/broadcom/bcm2835/bcm2835_dma.c index cab8639bb607..d8b49acfe332 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_dma.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_dma.c @@ -766,5 +766,6 @@ static driver_t bcm_dma_driver =3D { =20 static devclass_t bcm_dma_devclass; =20 -DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, bcm_dma_devclass, 0, = 0); +EARLY_DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, = bcm_dma_devclass, + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(bcm_dma, 1); For reference, a 13S snapshot with my kernel build replacing the snapshot's kernel, was booted with: # strings /boot/msdos/start4.elf | grep VC_BUILD_ID_ VC_BUILD_ID_USER: dom VC_BUILD_ID_TIME: 11:09:05 VC_BUILD_ID_VARIANT: start VC_BUILD_ID_TIME: Oct 26 2022 VC_BUILD_ID_BRANCH: bcm2711_2 VC_BUILD_ID_HOSTNAME: buildbot VC_BUILD_ID_PLATFORM: raspberrypi_linux VC_BUILD_ID_VERSION: c72ad6b26ff40c91ef776b847436094ee63fabee (clean) There are new things present that FreeBSD reports but ignores, producing messages like: clk_fixed4: disabled on ofwbus0 clk_fixed4: Cannot FDT parameters. device_attach: clk_fixed4 attach returned 6 over and over during part of the boot. It seems to retry as it goes and thus produce so many messages. There was also: fb0: on simplebus0 fb0: changing fb bpp from 0 to 24 mbox0: mbox response error fb0: bcm2835_mbox_fb_init failed, err=3D5 device_attach: fb0 attach returned 6 genet0 is working. I've not checked if the microsd card slot can be used. I used the normal FreeBSD U-Boot since I was not booting the NVM3 media that requires extra time (usb_pgood_delay would be assigned in my own U-Boot builds). For reference, I used my typical sort of config.txt : # more /boot/msdos/config.txt [all] arm_64bit=3D1 dtparam=3Daudio=3Don,i2c_arm=3Don,spi=3Don dtoverlay=3Dmmc dtoverlay=3Ddisable-bt device_tree_address=3D0x4000 kernel=3Du-boot.bin [pi4] hdmi_safe=3D1 armstub=3Darmstub8-gic.bin # [all] # # Local addition that avoids USB3 SSD boot failures that look like: # uhub_reattach_port: port ? reset failed, error=3DUSB_ERR_TIMEOUT # uhub_reattach_port: device problem (USB_ERR_TIMEOUT), disabling port = ? initial_turbo=3D60 # U-Boot that has, for example, a built-in usb_pgood_delay assignment # for a media specific issue added: #kernel=3Du-boot.bin.2022.10.arm64 # # Local additions: enable_uart=3D1 uart_2ndstage=3D1 dtdebug=3D1 disable_commandline_tags=3D1 disable_overscan=3D1 #gpu_mem_1024=3D32 # #program_usb_boot_mode=3D1 #program_usb_boot_timeout=3D1 # Old RPi3's/RPi2Bv1.2's may ignore [pi4] and the like. # That would make the below inappropriate for such contexts. [pi4] # Locally avoid hdmi_safe's dislay scaling: hdmi_safe=3D0 # armstub=3Darmstub8-gic.bin # # Local additions: over_voltage=3D6 arm_freq=3D2000 sdram_freq_min=3D3200 force_turbo=3D1 # #total_mem=3D1024 #total_mem=3D991 [all] [pi3]=20 armstub=3Darmstub8.bin dtoverlay=3Dpwm audio_pwm_mode=3D0 [all] As for main [so: 14], the devclass_t use is gone, thus the source code changes are: diff --git a/sys/arm/broadcom/bcm2835/bcm2835_dma.c = b/sys/arm/broadcom/bcm2835/bcm2835_dma.c index 5f9ecb0b7981..83c4c493a66b 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_dma.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_dma.c @@ -764,5 +764,6 @@ static driver_t bcm_dma_driver =3D { sizeof(struct bcm_dma_softc), }; =20 -DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, 0, 0); +EARLY_DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, 0, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(bcm_dma, 1); =3D=3D=3D Mark Millard marklmi at yahoo.com