Hi Jerry & Wolfgang,
The following series fixes a bug in the device tree code and eliminates the CONFIG_OF_LIBFDT dependency on CONFIG_SYS_BOOTMAPSZ. It also adds parsing of the reserved mem regions so that U-Boot doesn't decide to use a regions set aside for another purpose.
Finally, the last patch adds CONFIG_OF_LIBFDT to a bunch of boards. I'm not expecting the last patch to be picked up in mainline (yet), but it will be picked up into the Linaro tree for the 11.05 release.
John, this same series applies cleanly on the linaro-stable u-boot tree. Can you pick them up please? Or would you prefer me to send you a pull request?
g.
---
Grant Likely (6): Stop passing around bootmem_base value. Default to bootm_size() when CONFIG_SYS_BOOTMAPSZ is not defined Remove device tree booting dependency on CONFIG_SYS_BOOTMAPSZ Fix off-by-one error in passing initrd end address via device tree Respect memreserve regions specified in the device tree Add CONFIG_OF_LIBFDT to more boards.
README | 16 ++++++++- arch/arm/lib/bootm.c | 5 ++- arch/m68k/lib/bootm.c | 7 +--- arch/powerpc/lib/bootm.c | 19 +++++----- common/cmd_bootm.c | 7 ++-- common/fdt_support.c | 2 + common/image.c | 72 +++++++++++++++++++++++++++++---------- include/configs/ca9x4_ct_vxp.h | 2 + include/configs/devkit8000.h | 2 + include/configs/efikamx.h | 2 + include/configs/igep0020.h | 2 + include/configs/igep0030.h | 2 + include/configs/mx51evk.h | 2 + include/configs/mx53evk.h | 2 + include/configs/omap3_beagle.h | 7 ---- include/configs/omap3_overo.h | 2 + include/configs/omap3_pandora.h | 2 + include/configs/omap3_sdp3430.h | 2 + include/configs/omap3_zoom1.h | 2 + include/configs/omap3_zoom2.h | 2 + include/configs/omap4_panda.h | 2 + include/configs/omap4_sdp4430.h | 2 + include/configs/tegra2-common.h | 1 + include/image.h | 10 +++-- 24 files changed, 122 insertions(+), 52 deletions(-)
From: Grant Likely grant.likely@linaro.org
For the calls to boot_relocate_fdt(), boot_get_cmdline(), and boot_get_kbd(), the value of bootmem_base is always obtained by calling getenv_bootm_low(). Since the value always comes from the same source, the calling signature for those functions can be simplified by making them call getenv_bootm_low() directly.
Signed-off-by: Grant Likely grant.likely@linaro.org --- arch/arm/lib/bootm.c | 3 +-- arch/m68k/lib/bootm.c | 7 ++----- arch/powerpc/lib/bootm.c | 9 +++------ common/cmd_bootm.c | 3 +-- common/image.c | 25 +++++++++---------------- include/image.h | 8 +++----- 6 files changed, 19 insertions(+), 36 deletions(-)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 7734953..aba13f4 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -178,7 +178,6 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images) { ulong rd_len; void (*kernel_entry)(int zero, int dt_machid, void *dtblob); - ulong bootmap_base = getenv_bootm_low(); ulong of_size = images->ft_len; char **of_flat_tree = &images->ft_addr; ulong *initrd_start = &images->initrd_start; @@ -194,7 +193,7 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images) if (ret) return ret;
- ret = boot_relocate_fdt(lmb, bootmap_base, of_flat_tree, &of_size); + ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size); if (ret) return ret;
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c index 76a2fb2..1229ac7 100644 --- a/arch/m68k/lib/bootm.c +++ b/arch/m68k/lib/bootm.c @@ -71,7 +71,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima int ret;
ulong cmd_start, cmd_end; - ulong bootmap_base; bd_t *kbd; void (*kernel) (bd_t *, ulong, ulong, ulong, ulong); struct lmb *lmb = &images->lmb; @@ -79,17 +78,15 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1;
- bootmap_base = getenv_bootm_low(); - /* allocate space and init command line */ - ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base); + ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end); if (ret) { puts("ERROR with allocation of cmdline\n"); goto error; }
/* allocate space for kernel copy of board info */ - ret = boot_get_kbd (lmb, &kbd, bootmap_base); + ret = boot_get_kbd (lmb, &kbd); if (ret) { puts("ERROR with allocation of kernel bd\n"); goto error; diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 116d81b..11a574a 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -181,7 +181,6 @@ static void boot_prep_linux(void)
static int boot_cmdline_linux(bootm_headers_t *images) { - ulong bootmap_base = getenv_bootm_low(); ulong of_size = images->ft_len; struct lmb *lmb = &images->lmb; ulong *cmd_start = &images->cmdline_start; @@ -191,7 +190,7 @@ static int boot_cmdline_linux(bootm_headers_t *images)
if (!of_size) { /* allocate space and init command line */ - ret = boot_get_cmdline (lmb, cmd_start, cmd_end, bootmap_base); + ret = boot_get_cmdline (lmb, cmd_start, cmd_end); if (ret) { puts("ERROR with allocation of cmdline\n"); return ret; @@ -203,7 +202,6 @@ static int boot_cmdline_linux(bootm_headers_t *images)
static int boot_bd_t_linux(bootm_headers_t *images) { - ulong bootmap_base = getenv_bootm_low(); ulong of_size = images->ft_len; struct lmb *lmb = &images->lmb; bd_t **kbd = &images->kbd; @@ -212,7 +210,7 @@ static int boot_bd_t_linux(bootm_headers_t *images)
if (!of_size) { /* allocate space for kernel copy of board info */ - ret = boot_get_kbd (lmb, kbd, bootmap_base); + ret = boot_get_kbd (lmb, kbd); if (ret) { puts("ERROR with allocation of kernel bd\n"); return ret; @@ -230,7 +228,6 @@ static int boot_body_linux(bootm_headers_t *images) ulong *initrd_start = &images->initrd_start; ulong *initrd_end = &images->initrd_end; #if defined(CONFIG_OF_LIBFDT) - ulong bootmap_base = getenv_bootm_low(); ulong of_size = images->ft_len; char **of_flat_tree = &images->ft_addr; #endif @@ -253,7 +250,7 @@ static int boot_body_linux(bootm_headers_t *images) return ret;
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_SYS_BOOTMAPSZ) - ret = boot_relocate_fdt(lmb, bootmap_base, of_flat_tree, &of_size); + ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size); if (ret) return ret;
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 18019d6..a5c275f 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -547,8 +547,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_SYS_BOOTMAPSZ) case BOOTM_STATE_FDT: { - ulong bootmap_base = getenv_bootm_low(); - ret = boot_relocate_fdt(&images.lmb, bootmap_base, + ret = boot_relocate_fdt(&images.lmb, &images.ft_addr, &images.ft_len); break; } diff --git a/common/image.c b/common/image.c index f63a2ff..c86b86f 100644 --- a/common/image.c +++ b/common/image.c @@ -1172,7 +1172,6 @@ static int fit_check_fdt (const void *fit, int fdt_noffset, int verify) /** * boot_relocate_fdt - relocate flat device tree * @lmb: pointer to lmb handle, will be used for memory mgmt - * @bootmap_base: base address of the bootmap region * @of_flat_tree: pointer to a char* variable, will hold fdt start address * @of_size: pointer to a ulong variable, will hold fdt length * @@ -1188,8 +1187,7 @@ static int fit_check_fdt (const void *fit, int fdt_noffset, int verify) * 1 - failure */ #if defined(CONFIG_SYS_BOOTMAPSZ) -int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, - char **of_flat_tree, ulong *of_size) +int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) { void *fdt_blob = *of_flat_tree; void *of_start = 0; @@ -1209,7 +1207,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, /* Pad the FDT by a specified amount */ of_len = *of_size + CONFIG_SYS_FDT_PAD; of_start = (void *)(unsigned long)lmb_alloc_base(lmb, of_len, 0x1000, - (CONFIG_SYS_BOOTMAPSZ + bootmap_base)); + CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low());
if (of_start == 0) { puts("device tree - allocation error\n"); @@ -1567,11 +1565,9 @@ error: * @lmb: pointer to lmb handle, will be used for memory mgmt * @cmd_start: pointer to a ulong variable, will hold cmdline start * @cmd_end: pointer to a ulong variable, will hold cmdline end - * @bootmap_base: ulong variable, holds offset in physical memory to - * base of bootmap * * boot_get_cmdline() allocates space for kernel command line below - * BOOTMAPSZ + bootmap_base address. If "bootargs" U-boot environemnt + * BOOTMAPSZ + getenv_bootm_low() address. If "bootargs" U-boot environemnt * variable is present its contents is copied to allocated kernel * command line. * @@ -1579,14 +1575,13 @@ error: * 0 - success * -1 - failure */ -int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end, - ulong bootmap_base) +int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end) { char *cmdline; char *s;
cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf, - CONFIG_SYS_BOOTMAPSZ + bootmap_base); + CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low());
if (cmdline == NULL) return -1; @@ -1610,21 +1605,19 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end, * boot_get_kbd - allocate and initialize kernel copy of board info * @lmb: pointer to lmb handle, will be used for memory mgmt * @kbd: double pointer to board info data - * @bootmap_base: ulong variable, holds offset in physical memory to - * base of bootmap * * boot_get_kbd() allocates space for kernel copy of board info data below - * BOOTMAPSZ + bootmap_base address and kernel board info is initialized with - * the current u-boot board info data. + * BOOTMAPSZ + getenv_bootm_low() address and kernel board info is initialized + * with the current u-boot board info data. * * returns: * 0 - success * -1 - failure */ -int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base) +int boot_get_kbd (struct lmb *lmb, bd_t **kbd) { *kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf, - CONFIG_SYS_BOOTMAPSZ + bootmap_base); + CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); if (*kbd == NULL) return -1;
diff --git a/include/image.h b/include/image.h index 005e0d2..aa1d7df 100644 --- a/include/image.h +++ b/include/image.h @@ -336,8 +336,7 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images, #ifdef CONFIG_OF_LIBFDT int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *images, char **of_flat_tree, ulong *of_size); -int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, - char **of_flat_tree, ulong *of_size); +int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size); #endif
#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH @@ -345,11 +344,10 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len, ulong *initrd_start, ulong *initrd_end); #endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */ #ifdef CONFIG_SYS_BOOT_GET_CMDLINE -int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end, - ulong bootmap_base); +int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end) #endif /* CONFIG_SYS_BOOT_GET_CMDLINE */ #ifdef CONFIG_SYS_BOOT_GET_KBD -int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base); +int boot_get_kbd (struct lmb *lmb, bd_t **kbd); #endif /* CONFIG_SYS_BOOT_GET_KBD */ #endif /* !USE_HOSTCC */
From: Grant Likely grant.likely@linaro.org
This patch adds a function getenv_bootm_mapsize() for obtaining the size of the early mapped region accessible by the kernel during early boot. It defaults to CONFIG_SYS_BOOTMAPSZ, or if not defined, defaults to getenv_bootm_size(), which in turn defaults to the size of RAM.
getenv_bootm_mapsize() can also be overridden with a "bootm_mapsize" environmental variable.
Signed-off-by: Grant Likely grant.likely@linaro.org --- README | 16 ++++++++++++++-- arch/powerpc/lib/bootm.c | 2 +- common/image.c | 22 +++++++++++++++++++--- include/image.h | 1 + 4 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/README b/README index 21cd71b..b8c1833 100644 --- a/README +++ b/README @@ -2311,7 +2311,10 @@ Configuration Settings: used) must be put below this limit, unless "bootm_low" enviroment variable is defined and non-zero. In such case all data for the Linux kernel must be between "bootm_low" - and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. + and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. The environment + variable "bootm_mapsize" will override the value of + CONFIG_SYS_BOOTMAPSZ. If CONFIG_SYS_BOOTMAPSZ is undefined, + then the value in "bootm_size" will be used instead.
- CONFIG_SYS_BOOT_RAMDISK_HIGH: Enable initrd_high functionality. If defined then the @@ -3147,7 +3150,16 @@ List of environment variables (most likely not complete): for use by the bootm command. See also "bootm_size" environment variable. Address defined by "bootm_low" is also the base of the initial memory mapping for the Linux - kernel -- see the description of CONFIG_SYS_BOOTMAPSZ. + kernel -- see the description of CONFIG_SYS_BOOTMAPSZ and + bootm_mapsize. + + bootm_mapsize - Size of the initial memory mapping for the Linux kernel. + This variable is given as a hexadecimal number and it + defines the size of the memory region starting at base + address bootm_low that is accessible by the Linux kernel + during early boot. If unset, CONFIG_SYS_BOOTMAPSZ is used + as the default value if it is defined, and bootm_size is + used otherwise.
bootm_size - Memory range available for image processing in the bootm command can be restricted. This variable is given as diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 11a574a..1ee4f79 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -95,7 +95,7 @@ static void boot_jump_linux(bootm_headers_t *images) debug (" Booting using OF flat tree...\n"); WATCHDOG_RESET (); (*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC, - CONFIG_SYS_BOOTMAPSZ, 0, 0); + getenv_bootm_mapsize(), 0, 0); /* does not return */ } else #endif diff --git a/common/image.c b/common/image.c index c86b86f..a6247d8 100644 --- a/common/image.c +++ b/common/image.c @@ -454,6 +454,22 @@ phys_size_t getenv_bootm_size(void) #endif }
+phys_size_t getenv_bootm_mapsize(void) +{ + phys_size_t tmp; + char *s = getenv ("bootm_mapsize"); + if (s) { + tmp = (phys_size_t)simple_strtoull (s, NULL, 16); + return tmp; + } + +#if defined(CONFIG_SYS_BOOTMAPSZ) + return CONFIG_SYS_BOOTMAPSZ; +#else + return getenv_bootm_size(); +#endif +} + void memmove_wd (void *to, void *from, size_t len, ulong chunksz) { if (to == from) @@ -1207,7 +1223,7 @@ int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) /* Pad the FDT by a specified amount */ of_len = *of_size + CONFIG_SYS_FDT_PAD; of_start = (void *)(unsigned long)lmb_alloc_base(lmb, of_len, 0x1000, - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); + getenv_bootm_mapsize() + getenv_bootm_low());
if (of_start == 0) { puts("device tree - allocation error\n"); @@ -1581,7 +1597,7 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end) char *s;
cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf, - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); + getenv_bootm_mapsize() + getenv_bootm_base());
if (cmdline == NULL) return -1; @@ -1617,7 +1633,7 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end) int boot_get_kbd (struct lmb *lmb, bd_t **kbd) { *kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf, - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); + getenv_bootm_mapsize() + getenv_bootm_low()); if (*kbd == NULL) return -1;
diff --git a/include/image.h b/include/image.h index aa1d7df..b77cb79 100644 --- a/include/image.h +++ b/include/image.h @@ -451,6 +451,7 @@ int image_check_dcrc (const image_header_t *hdr); int getenv_yesno (char *var); ulong getenv_bootm_low(void); phys_size_t getenv_bootm_size(void); +phys_size_t getenv_bootm_mapsize(void); void memmove_wd (void *to, void *from, size_t len, ulong chunksz); #endif
From: Grant Likely grant.likely@linaro.org
The previous patch makes u-boot use the full accessible size of ram as the default boot mapped size if CONFIG_SYS_BOOTMAPSZ is not defined, which means boot_relocate_fdt() can be changed to depend solely on CONFIG_OF_LIBFDT.
Signed-off-by: Grant Likely grant.likely@linaro.org --- arch/powerpc/lib/bootm.c | 4 ++-- common/cmd_bootm.c | 2 +- common/image.c | 4 ++-- include/configs/omap3_beagle.h | 7 ------- 4 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 1ee4f79..180ee30 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -249,7 +249,7 @@ static int boot_body_linux(bootm_headers_t *images) if (ret) return ret;
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_SYS_BOOTMAPSZ) +#if defined(CONFIG_OF_LIBFDT) ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size); if (ret) return ret; @@ -288,7 +288,7 @@ static int boot_body_linux(bootm_headers_t *images) if (*initrd_start && *initrd_end) fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1); } -#endif /* CONFIG_OF_LIBFDT && CONFIG_SYS_BOOTMAPSZ */ +#endif /* CONFIG_OF_LIBFDT */ return 0; }
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index a5c275f..8a0a99e 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -544,7 +544,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv } break; #endif -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_SYS_BOOTMAPSZ) +#if defined(CONFIG_OF_LIBFDT) case BOOTM_STATE_FDT: { ret = boot_relocate_fdt(&images.lmb, diff --git a/common/image.c b/common/image.c index a6247d8..127eda2 100644 --- a/common/image.c +++ b/common/image.c @@ -1202,7 +1202,7 @@ static int fit_check_fdt (const void *fit, int fdt_noffset, int verify) * 0 - success * 1 - failure */ -#if defined(CONFIG_SYS_BOOTMAPSZ) +#if defined(CONFIG_OF_LIBFDT) int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) { void *fdt_blob = *of_flat_tree; @@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) error: return 1; } -#endif /* CONFIG_SYS_BOOTMAPSZ */ +#endif /* CONFIG_OF_LIBFDT */
/** * boot_get_fdt - main fdt handling routine diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 5cfa4cb..a0f6829 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -56,13 +56,6 @@ #define CONFIG_MISC_INIT_R
#define CONFIG_OF_LIBFDT 1 -/* - * The early kernel mapping on ARM currently only maps from the base of DRAM - * to the end of the kernel image. The kernel is loaded at DRAM base + 0x8000. - * The early kernel pagetable uses DRAM base + 0x4000 to DRAM base + 0x8000, - * so that leaves DRAM base to DRAM base + 0x4000 available. - */ -#define CONFIG_SYS_BOOTMAPSZ 0x4000
#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS 1
From: Grant Likely grant.likely@linaro.org
The initrd_end variable contains the address immediately *after* the initrd blob, not the last address containing data. This patch fixes an inadvertent off-by-one when setting up the initrd reserved map.
Signed-off-by: Grant Likely grant.likely@linaro.org --- common/fdt_support.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c index 6c98e5b..1b5f9c8 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -183,7 +183,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force) } }
- err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start + 1); + err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start); if (err < 0) { printf("fdt_initrd: %s\n", fdt_strerror(err)); return err;
From: Grant Likely grant.likely@linaro.org
If a regions is reserved in the fdt, then it should not be used. Add the memreserve regions to the lmb so that u-boot doesn't use them to store the initrd.
Signed-off-by: Grant Likely grant.likely@linaro.org --- arch/arm/lib/bootm.c | 2 ++ arch/powerpc/lib/bootm.c | 4 ++++ common/cmd_bootm.c | 2 ++ common/image.c | 29 ++++++++++++++++++++++++++++- include/image.h | 1 + 5 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index aba13f4..802e833 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -187,6 +187,8 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images)
kernel_entry = (void (*)(int, int, void *))images->ep;
+ boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree); + rd_len = images->rd_end - images->rd_start; ret = boot_ramdisk_high(lmb, images->rd_start, rd_len, initrd_start, initrd_end); diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 180ee30..4744313 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -234,6 +234,10 @@ static int boot_body_linux(bootm_headers_t *images)
int ret;
+#if defined(CONFIG_OF_LIBFDT) + boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree); +#endif + /* allocate space and init command line */ ret = boot_cmdline_linux(images); if (ret) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 8a0a99e..8729852 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -547,6 +547,8 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv #if defined(CONFIG_OF_LIBFDT) case BOOTM_STATE_FDT: { + boot_fdt_add_mem_rsv_regions(&images.lmb, + images.ft_addr); ret = boot_relocate_fdt(&images.lmb, &images.ft_addr, &images.ft_len); break; diff --git a/common/image.c b/common/image.c index 127eda2..d783808 100644 --- a/common/image.c +++ b/common/image.c @@ -1185,6 +1185,34 @@ static int fit_check_fdt (const void *fit, int fdt_noffset, int verify) #define CONFIG_SYS_FDT_PAD 0x3000 #endif
+#if defined(CONFIG_OF_LIBFDT) +/** + * boot_fdt_add_mem_rsv_regions - Mark the memreserve sections as unusable + * @lmb: pointer to lmb handle, will be used for memory mgmt + * @fdt_blob: pointer to fdt blob base address + * + * Adds the memreserve 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; + + if (fdt_check_header (fdt_blob) != 0) + return; + + total = fdt_num_mem_rsv(fdt_blob); + for (i = 0; i < total; i++) { + if (fdt_get_mem_rsv(fdt_blob, i, &addr, &size) != 0) + continue; + printf(" reserving fdt memory region: addr=%llx size=%llx\n", + (unsigned long long)addr, (unsigned long long)size); + lmb_reserve(lmb, addr, size); + } +} + /** * boot_relocate_fdt - relocate flat device tree * @lmb: pointer to lmb handle, will be used for memory mgmt @@ -1202,7 +1230,6 @@ static int fit_check_fdt (const void *fit, int fdt_noffset, int verify) * 0 - success * 1 - failure */ -#if defined(CONFIG_OF_LIBFDT) int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) { void *fdt_blob = *of_flat_tree; diff --git a/include/image.h b/include/image.h index b77cb79..43e6ab6 100644 --- a/include/image.h +++ b/include/image.h @@ -336,6 +336,7 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images, #ifdef CONFIG_OF_LIBFDT int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *images, char **of_flat_tree, ulong *of_size); +void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob); int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size); #endif
From: Grant Likely grant.likely@linaro.org
The following boards gain device tree support with this patch:
ca9x4_ct_vxp - Versatile Express
i.mx5 boards: efikamx mx51evk mx53evk
OMAP boards: devkit8000 igep0020 igep0030 omap3_overo omap3_pandora omap4_sdp3430 omap3_zoom1 omap3_zoom2 omap4_panda omap4_sdp4430
Tegra boards: Harmony
Signed-off-by: Grant Likely grant.likely@linaro.org --- include/configs/ca9x4_ct_vxp.h | 2 ++ include/configs/devkit8000.h | 2 ++ include/configs/efikamx.h | 2 ++ include/configs/igep0020.h | 2 ++ include/configs/igep0030.h | 2 ++ include/configs/mx51evk.h | 2 ++ include/configs/mx53evk.h | 2 ++ include/configs/omap3_overo.h | 2 ++ include/configs/omap3_pandora.h | 2 ++ include/configs/omap3_sdp3430.h | 2 ++ include/configs/omap3_zoom1.h | 2 ++ include/configs/omap3_zoom2.h | 2 ++ include/configs/omap4_panda.h | 2 ++ include/configs/omap4_sdp4430.h | 2 ++ include/configs/tegra2-common.h | 1 + 15 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/include/configs/ca9x4_ct_vxp.h b/include/configs/ca9x4_ct_vxp.h index 63f003d..8f52961 100644 --- a/include/configs/ca9x4_ct_vxp.h +++ b/include/configs/ca9x4_ct_vxp.h @@ -43,6 +43,8 @@ #define CONFIG_L2_OFF 1 #define CONFIG_INITRD_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024)
diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index d898b77..a8f5350 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -61,6 +61,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* Size of malloc() pool */ #define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ /* Sector */ diff --git a/include/configs/efikamx.h b/include/configs/efikamx.h index 1424347..571c3cb 100644 --- a/include/configs/efikamx.h +++ b/include/configs/efikamx.h @@ -66,6 +66,8 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool */ diff --git a/include/configs/igep0020.h b/include/configs/igep0020.h index c19ecc0..930d50c 100644 --- a/include/configs/igep0020.h +++ b/include/configs/igep0020.h @@ -53,6 +53,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * NS16550 Configuration */ diff --git a/include/configs/igep0030.h b/include/configs/igep0030.h index 1325bfa..dfccffc 100644 --- a/include/configs/igep0030.h +++ b/include/configs/igep0030.h @@ -53,6 +53,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * NS16550 Configuration */ diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index 591d6e1..e9d06af 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -46,6 +46,8 @@ #define CONFIG_SETUP_MEMORY_TAGS 1 #define CONFIG_INITRD_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool */ diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h index f2a5752..78122a7 100644 --- a/include/configs/mx53evk.h +++ b/include/configs/mx53evk.h @@ -38,6 +38,8 @@ #define CONFIG_SETUP_MEMORY_TAGS 1 #define CONFIG_INITRD_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h index 1b3d439..4b91b73 100644 --- a/include/configs/omap3_overo.h +++ b/include/configs/omap3_overo.h @@ -52,6 +52,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool */ diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h index 72b0cc2..b4f08c8 100644 --- a/include/configs/omap3_pandora.h +++ b/include/configs/omap3_pandora.h @@ -55,6 +55,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool */ diff --git a/include/configs/omap3_sdp3430.h b/include/configs/omap3_sdp3430.h index 4708981..91354a9 100644 --- a/include/configs/omap3_sdp3430.h +++ b/include/configs/omap3_sdp3430.h @@ -71,6 +71,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool * Total Size Environment - 256k diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h index f7d0652..d74ff5b 100644 --- a/include/configs/omap3_zoom1.h +++ b/include/configs/omap3_zoom1.h @@ -61,6 +61,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool */ diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h index 7377933..e2fd057 100644 --- a/include/configs/omap3_zoom2.h +++ b/include/configs/omap3_zoom2.h @@ -62,6 +62,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool */ diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h index 2b03b0f..ffcc9aa 100644 --- a/include/configs/omap4_panda.h +++ b/include/configs/omap4_panda.h @@ -60,6 +60,8 @@ #define CONFIG_INITRD_TAG 1 #define CONFIG_REVISION_TAG 1
+#define CONFIG_OF_LIBFDT 1 + /* * Size of malloc() pool * Total Size Environment - 256k diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index 9a8bb73..8d04d07 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -56,6 +56,8 @@ #undef CONFIG_USE_IRQ /* no support for IRQs */ #define CONFIG_MISC_INIT_R
+#define CONFIG_OF_LIBFDT 1 + #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS 1 #define CONFIG_INITRD_TAG 1 diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h index 4f4374a..4fcd8bb 100644 --- a/include/configs/tegra2-common.h +++ b/include/configs/tegra2-common.h @@ -45,6 +45,7 @@ #define CONFIG_SKIP_LOWLEVEL_INIT
#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ +#define CONFIG_OF_LIBFDT /* enable passing of devicetree */
/* Environment */ #define CONFIG_ENV_IS_NOWHERE
Dear Albert,
In message 20110328195906.10235.68517.stgit@ponder Grant Likely wrote:
From: Grant Likely grant.likely@linaro.org
The following boards gain device tree support with this patch:
ca9x4_ct_vxp - Versatile Express
i.mx5 boards: efikamx mx51evk mx53evk
OMAP boards: devkit8000 igep0020 igep0030 omap3_overo omap3_pandora omap4_sdp3430 omap3_zoom1 omap3_zoom2 omap4_panda omap4_sdp4430
Tegra boards: Harmony
Signed-off-by: Grant Likely grant.likely@linaro.org
Could you please pull this through your tree (or ACK that I do this) ?
Thanks.
Best regards,
Wolfgang Denk
Hi Wolfgang,
Le 28/04/2011 00:44, Wolfgang Denk a écrit :
Dear Albert,
In message20110328195906.10235.68517.stgit@ponder Grant Likely wrote:
From: Grant Likelygrant.likely@linaro.org
The following boards gain device tree support with this patch:
ca9x4_ct_vxp - Versatile Express
i.mx5 boards: efikamx mx51evk mx53evk
OMAP boards: devkit8000 igep0020 igep0030 omap3_overo omap3_pandora omap4_sdp3430 omap3_zoom1 omap3_zoom2 omap4_panda omap4_sdp4430
Tegra boards: Harmony
Signed-off-by: Grant Likelygrant.likely@linaro.org
Could you please pull this through your tree (or ACK that I do this) ?
I'll pull this and send a new pull request with it and Po-Yu Chuang's fixes today.
Thanks.
Best regards,
Wolfgang Denk
Amicalement,
Hi Grant,
Le 28/03/2011 21:59, Grant Likely a écrit :
From: Grant Likelygrant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
The following boards gain device tree support with this patch:
ca9x4_ct_vxp - Versatile Express
i.mx5 boards: efikamx mx51evk mx53evk
OMAP boards: devkit8000 igep0020 igep0030 omap3_overo omap3_pandora omap4_sdp3430 omap3_zoom1 omap3_zoom2 omap4_panda omap4_sdp4430
Tegra boards: Harmony
Signed-off-by: Grant Likelygrant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
include/configs/ca9x4_ct_vxp.h | 2 ++ include/configs/devkit8000.h | 2 ++ include/configs/efikamx.h | 2 ++ include/configs/igep0020.h | 2 ++ include/configs/igep0030.h | 2 ++ include/configs/mx51evk.h | 2 ++ include/configs/mx53evk.h | 2 ++ include/configs/omap3_overo.h | 2 ++ include/configs/omap3_pandora.h | 2 ++ include/configs/omap3_sdp3430.h | 2 ++ include/configs/omap3_zoom1.h | 2 ++ include/configs/omap3_zoom2.h | 2 ++ include/configs/omap4_panda.h | 2 ++ include/configs/omap4_sdp4430.h | 2 ++ include/configs/tegra2-common.h | 1 + 15 files changed, 29 insertions(+), 0 deletions(-)
Applied to u-boot-arm/master, thanks.
Amicalement,
On Mon, Mar 28, 2011 at 01:58:25PM -0600, Grant Likely wrote:
Hi Jerry & Wolfgang,
The following series fixes a bug in the device tree code and eliminates the CONFIG_OF_LIBFDT dependency on CONFIG_SYS_BOOTMAPSZ. It also adds parsing of the reserved mem regions so that U-Boot doesn't decide to use a regions set aside for another purpose.
Finally, the last patch adds CONFIG_OF_LIBFDT to a bunch of boards. I'm not expecting the last patch to be picked up in mainline (yet), but it will be picked up into the Linaro tree for the 11.05 release.
John, this same series applies cleanly on the linaro-stable u-boot tree. Can you pick them up please? Or would you prefer me to send you a pull request?
g.
Grant Likely (6): Stop passing around bootmem_base value. Default to bootm_size() when CONFIG_SYS_BOOTMAPSZ is not defined Remove device tree booting dependency on CONFIG_SYS_BOOTMAPSZ Fix off-by-one error in passing initrd end address via device tree Respect memreserve regions specified in the device tree Add CONFIG_OF_LIBFDT to more boards.
On mx51evk (babbage) board:
Tested-by: Shawn Guo shawn.guo@linaro.org
Since the following commit, definition CONFIG_SYS_BOOTMAPSZ is not needed any more.
7a02a39babb44f2ca2777db9b3a93be79111bba8 Remove device tree booting dependency on CONFIG_SYS_BOOTMAPSZ
Signed-off-by: Shawn Guo shawn.guo@linaro.org --- include/configs/mx51evk.h | 1 - include/configs/mx53evk.h | 1 - include/configs/mx53loco.h | 1 - 3 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index 6a785f8..febe8d8 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -227,6 +227,5 @@ #define CONFIG_SYS_MMC_ENV_DEV 0
#define CONFIG_OF_LIBFDT -#define CONFIG_SYS_BOOTMAPSZ 0x800000
#endif diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h index 5749a08..74aee89 100644 --- a/include/configs/mx53evk.h +++ b/include/configs/mx53evk.h @@ -193,6 +193,5 @@ #define CONFIG_SYS_MMC_ENV_DEV 0
#define CONFIG_OF_LIBFDT -#define CONFIG_SYS_BOOTMAPSZ 0x800000
#endif /* __CONFIG_H */ diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h index 9c7dcc9..884b36b 100644 --- a/include/configs/mx53loco.h +++ b/include/configs/mx53loco.h @@ -194,6 +194,5 @@ #define CONFIG_SYS_MMC_ENV_DEV 0
#define CONFIG_OF_LIBFDT -#define CONFIG_SYS_BOOTMAPSZ 0x800000
#endif /* __CONFIG_H */
With the following commit, CONFIG_OF_LIBFDT was redefined.
a8f88eedb2c4df472e512db58dfcaafd82c68b86 Add CONFIG_OF_LIBFDT to more boards.
Remove the duplicated definition to fix CONFIG_OF_LIBFDT redefined warning.
Signed-off-by: Shawn Guo shawn.guo@linaro.org --- include/configs/mx51evk.h | 2 -- include/configs/mx53evk.h | 2 -- 2 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index febe8d8..207b20c 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -226,6 +226,4 @@ #define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_OF_LIBFDT - #endif diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h index 74aee89..78122a7 100644 --- a/include/configs/mx53evk.h +++ b/include/configs/mx53evk.h @@ -192,6 +192,4 @@ #define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_OF_LIBFDT - #endif /* __CONFIG_H */
linaro-kernel@lists.linaro.org