[U-Boot] About fixup_memory_node()

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


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