Re: yet another error

From: Mark Millard via freebsd-ppc <freebsd-ppc_at_freebsd.org>
Date: Sun, 01 Aug 2021 20:48:00 UTC
[Part of a personal point for this Email reply is seeing
what the list does with it. I'd sent in an unsubscribe
for freebsd-ppc on 2021-Jul-28 but still got this Email
from the list. I no longer have access to operational
powerpc/power systems and never had access to one that
involved U-Boot in its operation: just old PowerMacs.]

On 2021-Aug-1, at 12:31, Al <al at datazap.net> wrote:

> Hello,
> 
> It is loading the kernel now, but there is a USB error:
> 
> U-Boot 2014.04 (Oct 17 2016 - 08:22:22)
> 
> CPU0:  P5020, Version: 2.0, (0x82200020)
> Core:  e5500, Version: 1.2, (0x80240012)
> Clock Configuration:
>       CPU0:1995 MHz, CPU1:1995 MHz,
>       CCB:798  MHz,
>       DDR:665  MHz (1330 MT/s data rate) (Asynchronous), LBC:49.875 MHz
>       FMAN1: 498.750 MHz
>       QMAN:  399 MHz
>       PME:   399 MHz
> L1:    D-cache 32 KiB enabled
>       I-cache 32 KiB enabled
> Reset Configuration Word (RCW):
>       00000000: 0c540000 00000000 1e1e0000 00000000
>       00000010: 44808c00 ff002000 68000000 45000000
>       00000020: 00000000 00000000 00000000 0003000f
>       00000030: a0000000 00000000 00000000 00000000
> Board: CYRUS
> 36-bit Addressing
> I2C:   ready
> SPI:   ready
> DRAM:  Initializing....using SPD
> Detected UDIMM KHX1600C10D3/8G
> Detected UDIMM KHX1600C10D3/8G
> 14 GiB left unmapped
> 16 GiB (DDR3, 64-bit, CL=9, ECC off)
>       DDR Controller Interleaving Mode: cache line
>       DDR Chip-Select Interleaving Mode: CS0+CS1
> 
> Local Bus Controller Registers
> BR0     0xE0001001      OR0     0xFFF00010
> BR1     0xE1001001      OR1     0xFFF00010
> BR2     0x00000000      OR2     0x00000000
> BR3     0x00000000      OR3     0x00000000
> BR4     0x00000000      OR4     0x00000000
> BR5     0x00000000      OR5     0x00000000
> BR6     0x00000000      OR6     0x00000000
> BR7     0x00000000      OR7     0x00000000
> LBCR    0x40000000      LCRR    0x80010004
> L2:    512 KiB enabled
> Corenet Platform Cache: 2 MiB enabled
> SERDES: bank 2 disabled
> MMC:  FSL_SDHC: 0
> EEPROM: NXID v0
> PCIe1: Root Complex, x4 gen1, regs @ 0xfe200000
>  01:00.0     - 1002:6759 - Display controller
>  01:00.1     - 1002:aa90 - Multimedia device
> PCIe1: Bus 00 - 01
> PCIe2: Root Complex, x4 gen2, regs @ 0xfe201000
>  03:00.0     - 111d:8092 - Bridge device
>   04:01.0    - 111d:8092 - Bridge device
>    05:00.0   - 12d8:e111 - Bridge device
>   04:02.0    - 111d:8092 - Bridge device
>   04:03.0    - 111d:8092 - Bridge device
>    08:00.0   - 8086:10d3 - Network controller
>   04:08.0    - 111d:8092 - Bridge device
>   04:10.0    - 111d:8092 - Bridge device
> PCIe2: Bus 02 - 0a
> PCIe3: disabled
> PCIe4: disabled
> Looking for VGA
> PINS: 0xfc000808
> videoboot: Booting PCI video card bus 1, function 0, device 0
> Begin BIOS POST
> End BIOS POST
> Setting VESA Mode
> Found required VESA mode
> About to set mode 279
> About to get mode
> Got mode 49431 (0xc117)
> OK
> XSize = 1024 YSize = 768 Base =0xe0000000
> mmio_base = 0x80000000
> bgx = 0xad55ad55 fgx = 0x0
> In:    serial
> Out:   serial
> Err:   serial
> ID: NXID v0
> SN: 116330081
> UID: 4429431001910051c47da080a0800000
> Errata: Q
> Build date: 2015/07/06 14:51:17
> CRC: eb5fb57a
> SCSI:  scanning bus for devices...
> Found 0 device(s).
> Net:   Initializing Fman
> 
> MMC read: dev # 0, block # 1130, count 128 ...
> Fman1: Uploading microcode version 106.1.0
> Tuning PHY @ 3
> Tuning PHY @ 7
> FM1@DTSEC4 [PRIME], FM1@DTSEC5
> 
> MMC read: dev # 0, block # 1280, count 512 ... 512 blocks read: OK
> 
> MMC read: dev # 0, block # 65536, count 131072 ... 131072 blocks read: OK
> USB0:   USB EHCI 1.00
> scanning bus 0 for devices... ERROR: Invalid USB EP length (9)

This message is from U-Boot, not FreeBSD. It is not FreeBSD's
kernel's problem: this is still before the FreeBSD kernel being
involved. (It is not even loaded yet.)

https://github.com/ARM-software/u-boot/blob/master/common/usb.c
shows for modern code:

		case USB_DT_ENDPOINT:
			if (head->bLength != USB_DT_ENDPOINT_SIZE &&
			    head->bLength != USB_DT_ENDPOINT_AUDIO_SIZE) {
				printf("ERROR: Invalid USB EP length (%d)\n",
					head->bLength);
				break;
			}


For reference:
USB_DT_ENDPOINT_SIZE is 7
USB_DT_ENDPOINT_AUDIO_SIZE is 9

In looking around on the Web I've seen code without the:

QUOTE
 &&
			    head->bLength != USB_DT_ENDPOINT_AUDIO_SIZE
END QUOTE

text. Without that extra test, an audio endpoint will
cause the message and the "break;" and its consequences.

You could either remove all audio endpoints (presuming
such is possible) or use a variant of U-Boot that has
the extra test and any related code. (As far as I can
tell anyway.)

Note: I'm not a U-Boot expert. I just looked up the
"Invalid USB EP length" message on the Web and the above
is what I found.

> Hit [Enter] to boot immediately, or any other key for command prompt.
> Booting [/boot/kernel/kernel]...
> Using DTB provided by U-Boot at address 0xc00000.
> Kernel args: (null)devices... 4 USB Device(s) found
> GDB: no debug ports present
> KDB: debugger backends: ddb
> KDB: current backend: ddb..
> ---<<BOOT>>---(s).
> Copyright (c) 1992-2021 The FreeBSD Project.
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
> X5000> fThe Regents of the University of California. All rights reserved.
> FreeBSD is a registered trademark of The FreeBSD Foundation.
> FreeBSD 14.0-CURRENT #4 main-n248384-d0d631d5f44: Fri Jul 30 18:08:34 EDT 2021
> 
> al@test.imagehostplus.com:/usr/obj/usr/src/powerpc.powerpc64/sys/AMIGAX5000 powerpc
> FreeBSD clang version 11.0.0 (git@github.com:llvm/llvm-project.git llvmorg-11.0.0-0-g176249bd673)
> VT: init without driver.s (2 MiB/s)
> cpu0: Freescale e5500 core revision 1.2, 1995.00 MHz
> cpu0: Features cc009100<PPC32,PPC64,FPU,MMU,BOOKE,ARCH205,ARCH206>
> cpu0: Features2 8000000<ISEL>
> cpu0: HID0 c0000000<EMCP,EN_L2MMU_MHD>...
> real memory  = 16570585088 (15802 MB)
> avail memory = 16520658944 (15755 MB) @0x7fe2efd8
> FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
> arc4random: WARNING: initial seeding bypassed the cryptographic random device because it was not yet seeded and the knob 'bypass_before_seedi.
> random: entropy device external interfacegehostplus.com)
> kbd0 at kbdmux0
> ofwbus0: <Open Firmware Device Tree> on nexus0
> simplebus0: <Flattened device tree simple bus> on ofwbus0
> bman-portals0: <Freescale Buffer Manager - Portals> on ofwbus0
> qman-portals0: <Freescale Queue Manager - Portals> on ofwbus0
> simplebus1: <Flattened device tree simple bus> mem 0xffe000000-0xffe000fff on ofwbus0
> fman0: <Freescale Frame Manager> mem 0x400000-0x4fffff irq 96,16 on simplebus1
>> INFO (__ERR_MODULE__) [CPU00, 
> /usr/src/sys/contrib/ncsw/Peripherals/FM/fm_ncsw.c:470 LoadFmanCtrlCode]: FMan-Controller code (ver 101.0.8) .
> fman0: Hardware version: 3.0.
> rcpm0: <QorIQ Run control and power management> mem 0xe2000-0xe2fff on simplebus1
> lbc0: <Freescale Local Bus Controller> mem 0xffe124000-0xffe124fff irq 25 on ofwbus0
> pcib0: <Freescale Integrated PCI/PCI-E Controller> mem 0xffe200000-0xffe200fff irq 16 on ofwbus0
> pci0: <OFW PCI bus> on pcib0
> pcib1: <MPC85xx Root Complex bridge> irq 16 at device 0.0 numa-domain 0 on pci0
> pci1: <OFW PCI bus> numa-domain 0 on pcib1
> pcib2: <Freescale Integrated PCI/PCI-E Controller> mem 0xffe201000-0xffe201fff irq 16 on ofwbus0
> pci2: <OFW PCI bus> on pcib2
> pcib3: <MPC85xx Root Complex bridge> irq 16 at device 0.0 numa-domain 0 on pci2
> pci3: <OFW PCI bus> numa-domain 0 on pcib3
> pcib4: <PCI-PCI bridge> at device 0.0 numa-domain 0 on pci3
> pci4: <PCI bus> numa-domain 0 on pcib4
> pcib5: <PCI-PCI bridge> at device 1.0 numa-domain 0 on pci4
> pci5: <PCI bus> numa-domain 0 on pcib5
> pcib6: <PCI-PCI bridge> irq 5 at device 0.0 numa-domain 0 on pci5
> pcib6: allocating 1 bus failed
> pcib6: allocating 1 bus failed
> pcib6: failed to allocate initial memory window: 0-0xfffff
> pcib2: failed to reserve resource for pcib3
> pcib6: failed to allocate initial prefetch window: 0-0xfffff
> pcib7: <PCI-PCI bridge> at device 2.0 numa-domain 0 on pci4
> pci6: <PCI bus> numa-domain 0 on pcib7
> pcib8: <PCI-PCI bridge> at device 3.0 numa-domain 0 on pci4
> pci7: <PCI bus> numa-domain 0 on pcib8
> pcib9: <PCI-PCI bridge> at device 8.0 numa-domain 0 on pci4
> pci8: <PCI bus> numa-domain 0 on pcib9
> pcib10: <PCI-PCI bridge> at device 16.0 numa-domain 0 on pci4
> pci9: <PCI bus> numa-domain 0 on pcib10
> gpio0: <Freescale QorIQ GPIO driver> mem 0x130000-0x130fff irq 55 on simplebus1
> gpiobus0: <GPIO bus> on gpio0
> openpic0: <OpenPIC Interrupt Controller> mem 0x40000-0x7ffff on simplebus1
> fsl_msi0: <Freescale MSI> mem 0x41600-0x417ff,0x44140-0x44143 irq 224,225,226,227,228,229,230,231 on simplebus1
> fsl_msi1: <Freescale MSI> mem 0x41800-0x419ff,0x45140-0x45143 irq 232,233,234,235,236,237,238,239 on simplebus1
> fsl_msi2: <Freescale MSI> mem 0x41a00-0x41bff,0x46140-0x46143 irq 240,241,242,243,244,245,246,247 on simplebus1
> qman0: <Freescale Queue Manager> mem 0x318000-0x318fff irq 16 on simplebus1
> qman0: Hardware version: 1.2.
> bman0: <Freescale Buffer Manager> mem 0x31a000-0x31afff irq 16 on simplebus1
> bman0: Hardware version: 1.0.
> cpulist0: <Open Firmware CPU Group> on ofwbus0
> cpu0: <Open Firmware CPU> on cpulist0
> cpu1: <Open Firmware CPU> on cpulist0
> spi0: <Freescale eSPI controller> mem 0x110000-0x110fff irq 53 on simplebus1
> spibus0: <OFW SPI bus> on spi0
> iichb0: <I2C bus controller> mem 0x118100-0x1181ff irq 38 on simplebus1
> iicbus0: <OFW I2C bus> on iichb0
> iic0: <I2C generic I/O> on iicbus0
> iichb1: <I2C bus controller> mem 0x119100-0x1191ff irq 39 on simplebus1
> iicbus1: <OFW I2C bus> on iichb1
> iic1: <I2C generic I/O> on iicbus1
> ds13070: <Microchip MCP7941x RTC> at addr 0xde on iicbus1
> pq_mdio0: <Freescale QorIQ MDIO> mem 0xe1120-0xe1fff irq 100 on fman0
> dtsec0: <Freescale Data Path Triple Speed Ethernet Controller> mem 0xe6000-0xe6fff on fman0
> dtsec0: Configured for regular mode.
> miibus0: <MII bus> on dtsec0
> micphy0: <Micrel KSZ9021 10/100/1000 PHY> PHY 3 on miibus0
> micphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto
> dtsec0: Ethernet address: 00:80:10:fa:ce:01
> dtsec1: <Freescale Data Path Triple Speed Ethernet Controller> mem 0xe8000-0xe8fff on fman0
> dtsec1: Configured for regular mode.
> miibus1: <MII bus> on dtsec1
> micphy1: <Micrel KSZ9021 10/100/1000 PHY> PHY 7 on miibus1
> micphy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto
> dtsec1: Ethernet address: 00:80:10:fa:ce:02
> dtsec2: <Freescale Data Path Triple Speed Ethernet Controller> mem 0xe0000-0xe0fff on fman0
> dtsec2: Could not load local-mac-addr property from DTS
> device_attach: dtsec2 attach returned 6
> dtsec2: <Freescale Data Path Triple Speed Ethernet Controller> mem 0xe2000-0xe2fff on fman0
> dtsec2: Could not load local-mac-addr property from DTS
> device_attach: dtsec2 attach returned 6
> pq_mdio1: <Freescale QorIQ MDIO> mem 0xe3120-0xe3fff on fman0
> dtsec2: <Freescale Data Path Triple Speed Ethernet Controller> mem 0xe4000-0xe4fff on fman0
> dtsec2: Could not load local-mac-addr property from DTS
> device_attach: dtsec2 attach returned 6
> pq_mdio2: <Freescale QorIQ MDIO> mem 0xe5120-0xe5fff on fman0
> pq_mdio3: <Freescale QorIQ MDIO> mem 0xe7120-0xe7fff on fman0
> pq_mdio4: <Freescale QorIQ MDIO> mem 0xe9120-0xe9fff on fman0
> dtsec2: <Freescale Data Path Triple Speed Ethernet Controller> mem 0xf0000-0xf0fff on fman0
> dtsec2: Could not load local-mac-addr property from DTS
> device_attach: dtsec2 attach returned 6
> sdhci_fsl0: <Freescale eSDHC controller> mem 0x114000-0x114fff irq 48 on simplebus1
> mmc0: <MMC/SD bus> on sdhci_fsl0
> iichb2: <I2C bus controller> mem 0x118000-0x1180ff irq 38 on simplebus1
> iicbus2: <OFW I2C bus> on iichb2
> iic2: <I2C generic I/O> on iicbus2
> iichb3: <I2C bus controller> mem 0x119000-0x1190ff irq 39 on simplebus1
> iicbus3: <OFW I2C bus> on iichb3
> iic3: <I2C generic I/O> on iicbus3
> uart0: <16550 or compatible> mem 0x11c500-0x11c5ff irq 36 on simplebus1
> uart0: console (115451,n,8,1)
> uart1: <16550 or compatible> mem 0x11c600-0x11c6ff irq 36 on simplebus1
> uart2: <16550 or compatible> mem 0x11d500-0x11d5ff irq 37 on simplebus1
> uart3: <16550 or compatible> mem 0x11d600-0x11d6ff irq 37 on simplebus1
> gpioc0: <GPIO controller> on gpio0
> ehci0: <Freescale integrated EHCI controller> mem 0x210000-0x210fff irq 44 on simplebus1
> usbus0: EHCI version 1.0
> usbus0 on ehci0
> ehci1: <Freescale integrated EHCI controller> mem 0x211000-0x211fff irq 45 on simplebus1
> usbus1: EHCI version 1.0
> usbus1 on ehci1
> fslsata0: <Freescale Integrated SATA Controller> mem 0x220000-0x220fff irq 68 on simplebus1
> fslsata1: <Freescale Integrated SATA Controller> mem 0x221000-0x221fff irq 69 on simplebus1
> vgapci0: <VGA-compatible display> at device 0.0 numa-domain 0 on pci1
> pci1: <multimedia, HDA> at device 0.1 (no driver attached)
> em0: <Intel(R) Gigabit CT 82574L> irq 7 at device 0.0 numa-domain 0 on pci7
> em0: Using 1024 TX descriptors and 1024 RX descriptors
> em0: Using 2 RX queues 2 TX queues
> em0: Using MSI-X interrupts with 3 vectors
> em0: Ethernet address: 68:05:ca:24:42:f7
> gpiopower0: <GPIO poweroff control> on ofwbus0
> gpiopower1: <GPIO restart control> on ofwbus0
> Timecounter "timebase" frequency 24937500 Hz quality 1000
> Event timer "decrementer" frequency 24937500 Hz quality 1000
> Timecounters tick every 1.000 msec
> ds13070: registered as a time-of-day clock, resolution 1.000000s
> usbus0: 480Mbps High Speed USB v2.0
> usbus1: 480Mbps High Speed USB v2.0
> ugen0.1: <Freescale EHCI root HUB> at usbus0
> uhub0 on usbus0
> uhub0: <Freescale EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
> ugen1.1: <Freescale EHCI root HUB> at usbus1
> uhub1 on usbus1
> uhub1: <Freescale EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
> uhub0: 1 port with 1 removable, self powered
> uhub1: 1 port with 1 removable, self powered
> mmcsd0: 4GB <SDHC USD   0.2 SN 4A9B353D MFG 05/2015 by 116 J`> at mmc0 49.8MHz/4bit/65535-block
> Launching APs: 1
> ada0 at fslsata0 bus 0 scbus0 target 0 lun 0
> ada0: <SanDisk SSD PLUS 240GB UF5000RL> ACS-2 ATA SATA 3.x device
> ada0: Serial Number 191078805013
> ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 512bytes)
> ada0: Command Queueing enabled
> ada0: 228944MB (468877312 512 byte sectors)
> Trying to mount root from ufs:/dev/ada0s2a [rw]...
> random: unblocking device.
> ugen0.2: <vendor 0x0424 product 0x2514> at usbus0
> uhub2 on uhub0
> uhub2: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 2> on usbus0
> uhub2: MTT enabled
> ugen1.2: <vendor 0x0424 product 0x2514> at usbus1
> uhub3 on uhub1
> uhub3: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 2> on usbus1
> uhub3: MTT enabled
> uhub2: 4 ports with 4 removable, self powered
> uhub3: 4 ports with 4 removable, self powered
> ugen0.3: <Hewlett-Packard hp LaserJet 1012> at usbus0
> ugen1.3: <vendor 0x04d9 USB Keyboard> at usbus1
> ukbd0 on uhub3
> ukbd0: <vendor 0x04d9 USB Keyboard, class 0/0, rev 1.10/1.01, addr 3> on usbus1
> kbd1 at ukbd0
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1
> ums0 on uhub3
> ums0: <vendor 0x17ef Lenovo Optical Mouse, class 0/0, rev 1.10/1.00, addr 4> on usbus1
> ums0: 3 buttons and [XYZ] coordinates ID=0
> ugen0.4: <GeneralPlus USB Audio Device> at usbus0
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1 (disconnected)
> ums0: at uhub3, port 2, addr 4 (disconnected)
> ums0: detached
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1
> ums0 on uhub3
> ums0: <vendor 0x17ef Lenovo Optical Mouse, class 0/0, rev 1.10/1.00, addr 4> on usbus1
> ums0: 3 buttons and [XYZ] coordinates ID=0
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1 (disconnected)
> ums0: at uhub3, port 2, addr 4 (disconnected)
> ums0: detached
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1
> ums0 on uhub3
> ums0: <vendor 0x17ef Lenovo Optical Mouse, class 0/0, rev 1.10/1.00, addr 4> on usbus1
> ums0: 3 buttons and [XYZ] coordinates ID=0
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1 (disconnected)
> ums0: at uhub3, port 2, addr 4 (disconnected)
> ums0: detached
> ugen1.4: <vendor 0x17ef Lenovo Optical Mouse> at usbus1
> ums0 on uhub3
> ums0: <vendor 0x17ef Lenovo Optical Mouse, class 0/0, rev 1.10/1.00, addr 4> on usbus1
> ums0: 3 buttons and [XYZ] coordinates ID=0
> 
> 
> I believe the issue starts here: scanning bus 0 for devices... ERROR: Invalid USB EP length (9)

Again: that message is from before FreeBSD's kernel is
involved and is from U-Boot and indicates U-Boot
changing its behavior because of an audio endpoint
(that the U-Boot in use is not set up to handle).

> Also, it goes back up to the top on the screen before loading the kernel, so something are written over.
> 
> This I believe is with the latest source with git.
> 
> I don't know why this is failing.
> 
> Here is my kernel config:
> 
> #
> # Custom kernel for Freescale MPC85XX development boards like the CDS etc.
> #
> # $FreeBSD: head/sys/powerpc/conf/MPC85XX 277254 2015-01-16 17:41:21Z nwhitehorn $
> #
> 
> ident           AMIGAX5000
> 
> include         QORIQ64
> 
> #options        BUS_DEBUG
> #options        DEBUG
> #options        EARLY_PRINTF
> #options        MPC85XX_UART_PA=0xffe11c000ull
> #options        KTR
> #options        KTR_COMPILE=(KTR_PMAP)
> #options        KTR_MASK=(KTR_PMAP)
> #options        KTR_ENTRIES=8192
> #options        KTR_VERBOSE
> 
> options         PREEMPTION              # Enable kernel thread preemption
> #options         GEOM_PART_EBR           # Extended Boot Records
> #options         GEOM_PART_EBR_COMPAT    # Backward compatible partition names
> options         GEOM_PART_APM           # Apple Partition Maps.
> #options         ZFS
> 
> device          ukbd
> device          ums
> 
> # For SAS RAID
> #device          pci
> #device          aacraid
> 
> # For Video
> device          vt
> device          fbd
> device          kbdmux
> options         KBD_INSTALL_CDEV
> 
> # No Netboot
> nooptions       BOOTP
> nooptions       BOOTP_NFSROOT
> 
> # For Alex
> #device         nvme
> nooptions       INVARIANTS
> nooptions       INVARIANT_SUPPORT
> nooptions       WITNESS
> nooptions       WITNESS_SKIPSPIN
> 
> 
> Please let me know if you need more information. I would really like to get past this issue.
> 
> Kind Regards,
> Al

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)