RPi4B's: 13.* boot "'failed to allocate bus number" message vs. main's [so: 14's] lack of such, also related Device Tree content

Mark Millard <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
# uname -apKU
FreeBSD generic 13.1-STABLE FreeBSD 13.1-STABLE #0 stable/13-n253304-461210143fbb: Fri Dec 23 23:25:49 UTC 2022     [email protected]:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64 aarch64 1301510 1301510

boot -v output (to give more context):

. . .
pcib0: <BCM2838-compatible PCI-express controller> mem 0x7d500000-0x7d50930f irq 80,81 on simplebus2
pcib0: parsing FDT for ECAM0:
pcib0:  PCI addr: 0xc0000000, CPU addr: 0x600000000, Size: 0x40000000
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0:  PCI addr: 0x0, CPU addr: 0x0, Size: 0x0
pcib0: Bus is not cache-coherent
pcib0: hardware identifies as revision 0x304.
pcib0: note: reported link speed is 5.0 GT/s.
pci1: <PCI bus> on pcib0
pci1: domain=0, physical bus=0
found-> vendor=0x14e4, dev=0x2711, revid=0x00
        domain=0, bus=0, slot=0, func=0
        class=06-04-00, hdrtype=0x01, mfdev=0
        cmdreg=0x0000, statreg=0x0010, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=0
        powerspec 3  supports D0 D3  current D0
        secbus=1, subbus=1
pcib1: <PCI-PCI bridge> irq 91 at device 0.0 on pci1
pcib0: rman_reserve_resource: start=0xc0000000, end=0xc00fffff, count=0x100000
pcib1:   domain            0
pcib1:   secondary bus     1
pcib1:   subordinate bus   1
pcib1:   memory decode     0xc0000000-0xc00fffff
pci2: <PCI bus> on pcib1
pcib1: allocated bus range (1-1) for rid 0 of pci2
pci2: domain=0, physical bus=1
found-> vendor=0x1106, dev=0x3483, revid=0x01
        domain=0, bus=1, slot=0, func=0
        class=0c-03-30, hdrtype=0x00, mfdev=0
        cmdreg=0x0000, statreg=0x0010, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=0
        powerspec 3  supports D0 D3  current D0
        MSI supports 4 messages, 64 bit
        map[10]: type Memory, range 64, base 0, size 12, memory disabled
pcib1: slot 0 INTA is routed to irq 92
bcm_xhci0: <VL805 USB 3.0 controller (on the Raspberry Pi 4b)> irq 92 at device 0.0 on pci2
bcm_xhci0: note: xhci firmware not found.
bcm_xhci0: note: installing xhci firmware.
bcm_xhci0: note: xhci firmware detected; firmware is revision 138a1.
pcib1: allocated memory range (0xc0000000-0xc0000fff) for rid 10 of bcm_xhci0
bcm_xhci0: Lazy allocation of 0x1000 bytes rid 0x10 type 3 at 0xc0000000
bcm_xhci0: 32 bytes context size, 64-bit DMA
bcm_xhci0: attempting to allocate 1 MSI vectors (4 supported)
bcm_xhci0: using IRQ 93 for MSI
bcm_xhci0: MSI enabled
bcm_xhci0: (New XHCI DeviceId=0x34831106)
usbus0 on bcm_xhci0
bcm_xhci0: usbpf: Attached
bcm_xhci0: note: switched to 32-bit DMA.
pci0: <PCI bus> on pcib0
pci0: failed to allocate bus number
device_attach: pci0 attach returned 6
genet0: <RPi4 Gigabit Ethernet> mem 0x7d580000-0x7d58ffff irq 82,83 on simplebus2
. . .


But this goes back to releng/13.0 (and, likely, beyond),
including in main after stable/13 .

Higlighting what is different vs. main . . .

First note pci1: vs. pci0: (and main's "OFW") in . . .

pcib0: Bus is not cache-coherent
pcib0: hardware identifies as revision 0x304.
pcib0: note: reported link speed is 5.0 GT/s.
pci1: <PCI bus> on pcib0
pci1: domain=0, physical bus=0
vs.
pcib0: Bus is not cache-coherent
pcib0: hardware identifies as revision 0x304.
pcib0: note: reported link speed is 5.0 GT/s.
pci0: <OFW PCI bus> on pcib0
pci0: domain=0, physical bus=0

Again, later . . .

pcib1: <PCI-PCI bridge> irq 91 at device 0.0 on pci1
vs.
pcib1: <PCI-PCI bridge> irq 91 at device 0.0 on pci0

Note pci2 vs pci1 later (and, again main has "OFW") . . .

pci2: <PCI bus> on pcib1
pcib1: allocated bus range (1-1) for rid 0 of pci2
pci2: domain=0, physical bus=1
vs.
pci1: <OFW PCI bus> on pcib1
pcib1: allocated bus range (1-1) for rid 0 of pci1
pci1: domain=0, physical bus=1

Again, later . . .

bcm_xhci0: <VL805 USB 3.0 controller (on the Raspberry Pi 4b)> irq 92 at device 0.0 on pci2
vs.
bcm_xhci0: <VL805 USB 3.0 controller (on the Raspberry Pi 4b)> irq 92 at device 0.0 on pci1

Finally the error report vs. not . . ..

bcm_xhci0: note: switched to 32-bit DMA.
pci0: <PCI bus> on pcib0
pci0: failed to allocate bus number
device_attach: pci0 attach returned 6
genet0: <RPi4 Gigabit Ethernet> mem 0x7d580000-0x7d58ffff irq 82,83 on simplebus2
vs.
bcm_xhci0: note: switched to 32-bit DMA.
genet0: <RPi4 Gigabit Ethernet> mem 0x7d580000-0x7d58ffff irq 82,83 on simplebus2


The rest of main's output text for the block I first quoted
is the same.


An FYI about later RPi* firmware updates and the .dts/.dtb
content that is related (two separate changes). . .

https://github.com/raspberrypi/linux/commit/13dbc954b3c9a9de0ad5b7279e8d3b708d31068b

reports (2021-Oct-12):

QUOTE
ARM: dts: bcm2711-rpi-4-b: Fix pcie0's unit address formatting

dtbs_check currently complains that:

arch/arm/boot/dts/bcm2711-rpi-4-b.dts:220.10-231.4: Warning
(pci_device_reg): /scb/pcie@7d500000/pci@1,0: PCI unit address format
error, expected "0,0"

Unsurprisingly pci@0,0 is the right address, as illustrated by its reg
property:

    &pcie0 {
	    pci@0,0 {
		    /*
		     * As defined in the IEEE Std 1275-1994 document,
		     * reg is a five-cell address encoded as (phys.hi
		     * phys.mid phys.lo size.hi size.lo). phys.hi
		     * should contain the device's BDF as 0b00000000
		     * bbbbbbbb dddddfff 00000000. The other cells
		     * should be zero.
		     */
		    reg = <0 0 0 0 0>;
	    };
    };

The device is clearly 0. So fix it.

Also add a missing 'device_type = "pci"'.

Fixes: 258f92d ("ARM: dts: bcm2711: Add reset controller to xHCI node")
Suggested-by: Rob Herring <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Nicolas Saenz Julienne <[email protected]>
END QUOTE

The diff shows (leading whitespace possibly
not preserved):


&pcie0 {
-	pci@1,0 {
+	pci@0,0 {
+	device_type = "pci";
 	#address-cells = <3>;
 	#size-cells = <2>;
 	ranges;

There is also (same day):

https://github.com/raspberrypi/linux/commit/3f32472854614d6f53b09b4812372dba9fc5c7de

that reports:

QUOTE
ARM: dts: bcm2711-rpi-4-b: Fix usb's unit address

The unit address is supposed to represent '<device>,<function>'. Which
are both 0 for RPi4b's XHCI controller. On top of that although
OpenFirmware states bus number goes in the high part of the last reg
parameter, FDT doesn't seem to care for it[1], so remove it.

[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/#24414633
Fixes: 258f92d ("ARM: dts: bcm2711: Add reset controller to xHCI node")
Suggested-by: Rob Herring <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Nicolas Saenz Julienne <[email protected]>
END QUOTE

The diff shows (leading whitespace possibly
not preserved):

 	reg = <0 0 0 0 0>;
 
-	usb@1,0 {
-		reg = <0x10000 0 0 0 0>;
+		usb@0,0 {
+		reg = <0 0 0 0 0>;
 		resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
 	};
 };


===
Mark Millard
marklmi at yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.