Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Oct 2020 16:10:40 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Robert Crowston <crowston@protonmail.com>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: rpi4 FreeBSD vs. ubuntu u-boot fdt print / memereserve difference (lack of reserve in FreeBSD context), 0x3b400000 vs. DMA_HIGH_LIMIT being 0x3c000000
Message-ID:  <BDA2D50C-E8C8-4BF2-8C97-C1B2516F06F3@yahoo.com>
In-Reply-To: <1A13F7B5-F8C3-4022-939C-2992E53D1DF1@yahoo.com>
References:  <1A13F7B5-F8C3-4022-939C-2992E53D1DF1@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2020-Oct-3, at 15:20, Mark Millard <marklmi at yahoo.com> wrote:

> Another FreeBSD vs. ubuntu context difference, this time in the
> fdt print / output . . .
>=20
> The ubuntu u-boot has (fdt print / output):
>=20
>        memreserve =3D <0x3b400000 0x04c00000>;
> . . . (Note: 0x3b400000+0x04c00000 =3D=3D 0x40000000) . . .
>=20
>        #address-cells =3D <0x00000002>;
>        #size-cells =3D <0x00000001>;
> . . .
>        axi {
>                vc_mem {
>                        reg =3D <0x3ec00000 0x40000000 0xc0000000>;
>                };
> Note:       "vc_mem is solely used as a mechanism for passing a couple
>            of parameters through from the firmware to vcdbg"
> End note
>        };
>=20
> . . . ( boot args has: vc_mem.mem_base=3D0x3ec00000 =
vc_mem.mem_size=3D0x40000000 ) . . .
>=20
>        reserved-memory {
>                #address-cells =3D <0x00000002>;
>                #size-cells =3D <0x00000001>;
>                ranges;
>                phandle =3D <0x0000003d>;
>                linux,cma {
>                        compatible =3D "shared-dma-pool";
>                        size =3D <0x04000000>;
>                        reusable;
>                        linux,cma-default;
>                        alloc-ranges =3D <0x00000000 0x00000000 =
0x30000000>;
>                        phandle =3D <0x0000003e>;
>                };
>        };
> . . . (I split the reg into lines below) . . .
>        memory@0 {
>                device_type =3D "memory";
>                reg =3D <0x00000000 0x00000000 0x3b400000
>                       0x00000000 0x40000000 0xbc000000
>                       0x00000001 0x00000000 0x80000000
>                       0x00000001 0x80000000 0x80000000>;
>        };
> . . . (Note: 0x40000000+0xbc000000 =3D=3D 0xFC000000) . . .
>=20
> (I've ignored gpiomem above and below.)
>=20
> It appears to be that the memreserve may be important
> to have. The above may also suggest that FreeBSD's:
>=20
> #define DMA_HIGH_LIMIT                  0x3c000000
>=20
> may be a little too large (< or <=3D 0x3b400000 ?).
>=20
> FreeBSD u-boot reports just:
>=20
> /memreserve/ 0x0 0x1000;
> . . .
>        memory@0 {
>=20
>                device_type =3D "memory";
>                reg =3D <0x0 0x0 0x0>;
>        };
>=20
> And so does not indicate anything special for either of
> (showing begin/end points):
>=20
> 0x3b400000..0x3FFFFFFF (in use by the vc?)
> 0xFC000000..0xFFFFFFFF (I/O peripheral area and such?)
>=20
> The context is an 8 GiByte RPi4 in both examples. Various
> details would vary on 1 GiByte and 2 GiByte RPi4Bs and
> some in memory@0 on the 4 GiBYTe RPi4B.

Turns out that rpi_DATA_2711_1p0.pdf 's "Figure 1. BCM2711
Address Maps" shows this "SDRAM (for the VC)" area in the
two 35-bit Address Maps, showing 0x0_4000_0000 as the
next address after the area in both diagrams --and notes
for area for each diagram:

QUOTE
Size of VC SDRAM
determined by
config.txt
END QUOTE

But ubuntu uses includes and such so overall there
are the following .txt files ( cmdline.txt being for
a different purpose ):

# ls -ld /boot/firmware/*.txt
-rwxr-xr-x 1 root root  141 Jul 31 16:48 /boot/firmware/cmdline.txt
-rwxr-xr-x 1 root root 1117 Jul 31 16:48 /boot/firmware/config.txt
-rwxr-xr-x 1 root root  327 Jul 31 16:48 /boot/firmware/syscfg.txt
-rwxr-xr-x 1 root root  251 Sep 26 22:14 /boot/firmware/usercfg.txt

config.txt includes syscfg.txt and usercfg.txt .

config.txt uses the [pi4], [pi2], [pi3], and [all] section
notation as well.

Looks like one of u-boot's jobs is to figure out the figures
that go in (base then size):

memreserve =3D <0x???????? 0x????????>;

(such that the total is 0x40000000 for the RPi4B) in order
to protect the VC SDRAM area.


The diagrams also indicate that 0xFC000000..0xFFFFFFFF is
for when "low Perioheral" mode is in use, listing ("up
to H" not including H):

ARM Local peripherals from 0x0_FF80_0000 up to 0x1_0000_0000
and:
Main peripherals      from 0x0_FC00_0000 up to 0x0_FF80_0000

Otherwise they are listed at:

ARM Local peripherals from 0x4_C000_0000 up to 0x5_0000_0000
and:
Main peripherals      from 0x4_7C00_0000 up to 0x4_8000_0000

I gather the ubuntu "fdt print /" result implies that ubuntu
is using "Low Peripheral" mode (or at least allowing for it).

There are some other "Reserved" areas and the special areas
that are "two L2 cache aliases (one allocating, one
non-allocating) which cache (only) the first 1GB of SDRAM".
if these are all counted then 0x4_0000_0000 up to
0x6_0000_0000 is all some form of special-use area in
both diagrams and 0x6_0000_0000 through 0x7_FFFF_FFFF is the
PCIe area in both diagams.


=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?BDA2D50C-E8C8-4BF2-8C97-C1B2516F06F3>