Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Oct 2020 11:19:50 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Kyle Evans <kevans@FreeBSD.org>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   RPi4B: an example of what RAM u-boot reserves during operation (not necessarily matching what it reports to the next stage) vs. armstub8-gic.bin
Message-ID:  <A0293335-6DE2-452F-B179-0CCAFE5076BB@yahoo.com>
References:  <A0293335-6DE2-452F-B179-0CCAFE5076BB.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
U-Boot> bdinfo
boot_params =3D 0x0000000000000100
. . .
lmb_dump_all:
    memory.cnt             =3D 0x2
    memory.size            =3D 0x0
    memory.reg[0x0].base   =3D 0x0
                   .size   =3D 0x3e000000
    memory.reg[0x1].base   =3D 0x40000000
                   .size   =3D 0xbc000000

    reserved.cnt           =3D 0x2
    reserved.size          =3D 0x0
    reserved.reg[0x0].base =3D 0x0
                     .size =3D 0x1000
    reserved.reg[0x1].base =3D 0x3db47b30
                     .size =3D 0x4b84d0
. . .

That:

    reserved.reg[0x0].base =3D 0x0
                     .size =3D 0x1000

means that armstub8-gic.bin is not fully
protected at this point in u-boot's execution.

Basically boot_fdt_add_mem_rsv_regions is all that
is used currently and it does not take into account
CONFIG_RPI_EFI_NR_SPIN_PAGES=3D2 :

/**
 * boot_fdt_add_mem_rsv_regions - Mark the memreserve and =
reserved-memory
 * sections as unusable
 * @lmb: pointer to lmb handle, will be used for memory mgmt
 * @fdt_blob: pointer to fdt blob base address
 *
 * Adds the and reserved-memorymemreserve regions in the dtb to the lmb =
block.
 * Adding the memreserve regions prevents u-boot from using them to =
store the
 * initrd or the fdt blob.
 */
void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob)
{
        uint64_t addr, size;
        int i, total, ret;
        int nodeoffset, subnode;
        struct fdt_resource res;

        if (fdt_check_header(fdt_blob) !=3D 0)
                return;

        /* process memreserve sections */
        total =3D fdt_num_mem_rsv(fdt_blob);
        for (i =3D 0; i < total; i++) {
                if (fdt_get_mem_rsv(fdt_blob, i, &addr, &size) !=3D 0)
                        continue;
                boot_fdt_reserve_region(lmb, addr, size);
        }

        /* process reserved-memory */
        nodeoffset =3D fdt_subnode_offset(fdt_blob, 0, =
"reserved-memory");
        if (nodeoffset >=3D 0) {
                subnode =3D fdt_first_subnode(fdt_blob, nodeoffset);
                while (subnode >=3D 0) {
                        /* check if this subnode has a reg property */
                        ret =3D fdt_get_resource(fdt_blob, subnode, =
"reg", 0,
                                               &res);
                        if (!ret && fdtdec_get_is_enabled(fdt_blob, =
subnode)) {
                                addr =3D res.start;
                                size =3D res.end - res.start + 1;
                                boot_fdt_reserve_region(lmb, addr, =
size);
                        }

                        subnode =3D fdt_next_subnode(fdt_blob, subnode);
                }
        }
}


=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?A0293335-6DE2-452F-B179-0CCAFE5076BB>