[U-Boot] About fixup_memory_node()

Dennis Lan (dlan) dennis.yxun at gmail.com
Fri Jan 11 08:50:06 CET 2013


HI ALL:
    Also we notice that following comment in arch/arm/dts/skeleton.dtsi
it says memory info will be polulated by bootloader,
is this kind of design policy/philosophy?

/*
 * Skeleton device tree; the bare minimum needed to boot; just include and
 * add a compatible value.  The bootloader will typically populate the
memory
 * node.
 */

/ {
        #address-cells = <1>;
        #size-cells = <1>;
        chosen { };
        aliases { };
        memory { device_type = "memory"; reg = <0 0>; };
};


On Fri, Jan 11, 2013 at 3:44 PM, Dennis Lan (dlan) <dennis.yxun at gmail.com>wrote:

> HI Forks:
>   I have question about why memory info from fdt (memory size) will be
> overwritten by
>  those come from u-boot source code.
>
>  function fixup_memory_node() in bootm.c
> when CONFIG_OF_LIBFDT is defined, then memory node information will be
> updated
> says that, if I set memory 2G in fdt file, then 512M in uboot config.h,
> then final fdt info will show 512M
>  (you may wonder why we set 512M in uboot, but others in fdt file, because
> we may have differnet boards with differnet memory size)
>   Thanks
>
> fixup_memory_node() -> fdt_fixup_memory_banks()
>
> int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
> {
>        .....
>         for (bank = 0, len = 0; bank < banks; bank++) {
>                 write_cell(tmp + len, start[bank], addr_cell_len);
>                 len += addr_cell_len;
>
>                 write_cell(tmp + len, size[bank], size_cell_len);
>                 len += size_cell_len;
>         }
>
>         err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
>
>
> Dennis
>


More information about the U-Boot mailing list