Re: RPi4b 8GB 13.0-Current, XHCI broken, wrong U-Boot ?
Mark Millard via freebsd-arm <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.arm |
|---|---|
| Message-ID | <[email protected]> |
On 2021-Jan-1, at 10:24, Kyle Evans <kevans at freebsd.org> wrote: > On Fri, Jan 1, 2021 at 11:05 AM Robert Crowston via freebsd-arm > <[email protected]> wrote: >> >> The u-boot output is not a smoking gun; the u-boot version packaged up there did not have the driver in it. The freebsd driver is separate and does not depend on u-boot. >> >> As I recall, that warning indicates that we tried, but failed to load the firmware, which I haven’t seen in the wild before. Could you try booting in verbose mode? >> >> Do you know what version of USB firmware is installed on the Pi? Alternatively, when did you purchase this hardware? (My suspicion is that the Pi foundation moved the goalposts again ...) >> >> You say this works fine with the UEFI boot? If you can use boot with that one, it would be good to see if it works. >> >> Re: state of the pi 4, I guess we should bundle up a proper image of it, either for USB drive or SD Card, instead of telling users to perform all this surgery. >> > > What surgery are you referring to here? The -RPI image OP tried from > the 24th is one that should boot as-is on all arm64 RPi variants > without modification using the upstream U-Boot rpi arm64 config and a > consolidated config.txt that conditionally does what's needed for the > RPi4. I'm not aware of any unpatched version of u-boot for FreeBSD yet that has bdinfo showing u-boot itself reserving all the RAM required for armstub8-gic.bin and its operation --so that u-boot guarantees to not touch that RAM. This is a different issue from the one of keeping the FreeBSD kernel from touching RAM it should not touch. In essence armstub_rsrvd is not being respected because it is ignored. (I might misremember the terminology but the wording is suggestive.) An example from u-boot bdinfo output is: lmb_dump_all: memory.cnt = 0x3 memory.size = 0x0 memory.reg[0x0].base = 0x0 .size = 0x3e000000 memory.reg[0x1].base = 0x40000000 .size = 0xbc000000 memory.reg[0x2].base = 0x100000000 .size = 0x100000000 reserved.cnt = 0x2 reserved.size = 0x0 reserved.reg[0x0].base = 0x0 .size = 0x1000 reserved.reg[0x1].base = 0x3db4bb30 .size = 0x4b44d0 I reported the above as a hypothesis for something that might have been involved in the fairly early "Synchronous Abort" crashes that I reported on the lists sometime around 2020-Dec-17 or so for my attempt to use /usr/local/share/u-boot/u-boot-rpi-arm64/u-boot.bin to set up a 8GiByte RPi4B. (My initial report confused the u-boot vs. FreeBSD kernel issue and I later replied noting that mistake.) Back in mid 2020-Oct I had written and posted patches for this lack of reservation but I was unsure about its upstream viability: QUOTE (There may be whitespace issues.) I doubt that the patches below are appropriate to upstream in some respects. It is more targeted at being a sysutils/u-boot-rpi[34] patch because what armstub8*.bin supplies in x1 seems specific to the armstub8*.bin FreeBSD uses. . . . # more /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__lowlevel_init.S --- board/raspberrypi/rpi/lowlevel_init.S.orig 2020-10-05 08:15:32.000000000 -0700 +++ board/raspberrypi/rpi/lowlevel_init.S 2020-10-13 11:33:39.273950000 -0700 @@ -18,9 +18,22 @@ #ifdef CONFIG_ARM64 adr x8, fw_dtb_pointer str x0, [x8] +#if defined(CONFIG_EFI_LOADER) + /* Setup to allow reserving the stack and such that is */ + /* after the likes of FreeBSD armstub8-gic.bin in RAM. */ + adr x8, armstub_rsrvd + str x1, [x8] +#endif #else ldr r8, =fw_dtb_pointer str r2, [r8] +#if defined(CONFIG_EFI_LOADER) +#error "Before aarch64 does not use armstub*.bin files" + /* Setup to allow reserving the stack and such that is */ + /* after the likes of a armstub*.bin in RAM. */ + ldr r8, =armstub_rsrvd + str r3, [r8] +#endif #endif /* Returns */ # more /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__rpi.c --- board/raspberrypi/rpi/rpi.c.orig 2020-10-05 08:15:32.000000000 -0700 +++ board/raspberrypi/rpi/rpi.c 2020-10-13 11:02:15.582706000 -0700 @@ -12,6 +12,7 @@ #include <fdt_simplefb.h> #include <init.h> #include <lcd.h> +#include <lmb.h> #include <memalign.h> #include <mmc.h> #include <asm/gpio.h> @@ -33,6 +34,7 @@ * does not get cleared later. */ unsigned long __section(".data") fw_dtb_pointer; +unsigned long __section(".data") armstub_rsrvd; /* TODO([email protected]): Move these to the msg.c file */ struct msg_get_arm_mem { @@ -494,4 +496,29 @@ #endif return 0; +} + +void board_lmb_reserve(struct lmb *lmb) +{ +#ifdef CONFIG_EFI_LOADER + /* + * NOTE: lmb_reserve (and more) does not deal with overlaps with + * pre-existing reservations. + * But board_lmb_reserve is called before the original + * first-page is added. So use knowledge of what will happen + * later to avoid overlaps. + */ + + phys_addr_t base = 0x0u; + phys_addr_t size = CONFIG_RPI_EFI_NR_SPIN_PAGES << EFI_PAGE_SHIFT; + if (size < armstub_rsrvd) size = armstub_rsrvd; + + if (size <= EFI_PAGE_SIZE) return; + + /* Avoid future overlap */ + base += EFI_PAGE_SIZE; + size -= EFI_PAGE_SIZE; + + lmb_reserve(lmb, base, size); +#endif } ENDQUOTE === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-arm To unsubscribe, send any mail to "[email protected]"