Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jan 2021 12:59:45 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        Robert Crowston <crowston@protonmail.com>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: RPi4b 8GB 13.0-Current, XHCI broken, wrong U-Boot ?
Message-ID:  <B614F8AE-6716-47A6-9959-DA638443F4CF@yahoo.com>
In-Reply-To: <CACNAnaE4pxrLnoLXhFdsh3bOunMXTCD7dkgLwUR3PzPJrrwz9A@mail.gmail.com>
References:  <007c8658-b7b6-6852-536c-9c36af64506b@ip-ether.net> <I-CLJQ3juHKI37Ycc1N5UiyJg_Myb0FH92x22onzCJlqGS2nOIOGc-Zy7EbBQWaB0n3IqSnu9QsCGIfnUsjr5gcET6_fnufZlJhnilDq6cM=@protonmail.com> <CACNAnaE4pxrLnoLXhFdsh3bOunMXTCD7dkgLwUR3PzPJrrwz9A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


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
> <freebsd-arm@freebsd.org> wrote:
>>=20
>> 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.
>>=20
>> As I recall, that warning indicates that we tried, but failed to load =
the firmware, which I haven=E2=80=99t seen in the wild before. Could you =
try booting in verbose mode?
>>=20
>> 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 ...)
>>=20
>> 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.
>>=20
>> 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.
>>=20
>=20
> 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             =3D 0x3
   memory.size            =3D 0x0
   memory.reg[0x0].base   =3D 0x0
                  .size   =3D 0x3e000000
   memory.reg[0x1].base   =3D 0x40000000
                  .size   =3D 0xbc000000
   memory.reg[0x2].base   =3D 0x100000000
                  .size   =3D 0x100000000

   reserved.cnt           =3D 0x2
   reserved.size          =3D 0x0
   reserved.reg[0x0].base =3D 0x0
                    .size =3D 0x1000
   reserved.reg[0x1].base =3D 0x3db4bb30
                    .size =3D 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__lowle=
vel_init.S=20
--- 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, =3Dfw_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, =3Darmstub_rsrvd
+       str     r3, [r8]
+#endif
#endif

       /* Returns */


# more =
/usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__rpi.c=
=20
--- 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(sjg@chromium.org): 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 =3D 0x0u;
+       phys_addr_t size =3D CONFIG_RPI_EFI_NR_SPIN_PAGES << =
EFI_PAGE_SHIFT;
+       if (size < armstub_rsrvd) size =3D armstub_rsrvd;
+
+       if (size <=3D EFI_PAGE_SIZE) return;
+
+       /* Avoid future overlap */
+       base +=3D EFI_PAGE_SIZE;
+       size -=3D EFI_PAGE_SIZE;
+
+       lmb_reserve(lmb, base, size);
+#endif
}


ENDQUOTE

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B614F8AE-6716-47A6-9959-DA638443F4CF>