Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
Hi Hannes I had the same problem. http://patchwork.ozlabs.org/patch/579391/ fixed it. Regards, Matthias 2016-02-08 15:01 GMT+01:00 Hannes Schmelzer: > > > On 18.12.2015 06:17, Masahiro Yamada wrote: >> >> Currently, this function returns wrong size if "bootm_low" is defined, >> but "bootm_size" is not. >> >> Signed-off-by: Masahiro Yamada >> --- >> >> common/image.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/common/image.c b/common/image.c >> index d63d9e0..f4a1dc8 100644 >> --- a/common/image.c >> +++ b/common/image.c >> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void) >> #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) >> - return gd->bd->bi_dram[0].size - tmp; >> + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); >> #else >> - return gd->bd->bi_memsize - tmp; >> + return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); >> #endif >> } > > Hi Masahiro, > > your commit has been merged on 19.1. this year. > Today i ran a test on my tseries board with most current u-boot/master. > > I ran into trouble booting my linux kernel: > > --- > Kernel image @ 0x8020 [ 0x00 - 0x222720 ] > ## Loading init Ramdisk from Legacy Image at 80a0 ... >Image Name: >Image Type: ARM Linux RAMDisk Image (uncompressed) >Data Size:12452646 Bytes = 11.9 MiB >Load Address: >Entry Point: > ## Flattened Device Tree blob at 8010 >Booting using the fdt blob at 0x8010 > ERROR: Failed to allocate 0xbe0326 bytes below 0x1000. > ramdisk - allocation error > FDT creation failed! hanging...### ERROR ### Please RESET the board ### > --- > > I debugged bit am came to the conclusio, that the line > > + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); > > brings me into trouble. > > On my board DRAM is configured as follows: > U-Boot (BuR V2.0)# bdinfo > arch_number = 0x > boot_params = 0x8100 > DRAM bank = 0x > *-> start= 0x8000** > **-> size = 0x1000** > * > so size minus start would give a negative number. > I tried local revert of this commit and everything works as before. > > more correct would be > > + return gd->bd->bi_dram[0].start - (tmp - gd->bd->bi_dram[0].size); > > > whats your thinking about? > > best regards, > Hannes > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
On 08.02.2016 15:11, Matthias Weißer wrote: Hi Hannes I had the same problem. http://patchwork.ozlabs.org/patch/579391/ fixed it. Regards, Matthias 2016-02-08 15:01 GMT+01:00 Hannes Schmelzer: On 18.12.2015 06:17, Masahiro Yamada wrote: Currently, this function returns wrong size if "bootm_low" is defined, but "bootm_size" is not. Signed-off-by: Masahiro Yamada --- common/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/image.c b/common/image.c index d63d9e0..f4a1dc8 100644 --- a/common/image.c +++ b/common/image.c @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void) #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) - return gd->bd->bi_dram[0].size - tmp; + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); #else - return gd->bd->bi_memsize - tmp; + return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); #endif } Hi Masahiro, your commit has been merged on 19.1. this year. Today i ran a test on my tseries board with most current u-boot/master. I ran into trouble booting my linux kernel: --- Kernel image @ 0x8020 [ 0x00 - 0x222720 ] ## Loading init Ramdisk from Legacy Image at 80a0 ... Image Name: Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size:12452646 Bytes = 11.9 MiB Load Address: Entry Point: ## Flattened Device Tree blob at 8010 Booting using the fdt blob at 0x8010 ERROR: Failed to allocate 0xbe0326 bytes below 0x1000. ramdisk - allocation error FDT creation failed! hanging...### ERROR ### Please RESET the board ### --- I debugged bit am came to the conclusio, that the line + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); brings me into trouble. On my board DRAM is configured as follows: U-Boot (BuR V2.0)# bdinfo arch_number = 0x boot_params = 0x8100 DRAM bank = 0x *-> start= 0x8000** **-> size = 0x1000** * so size minus start would give a negative number. I tried local revert of this commit and everything works as before. more correct would be + return gd->bd->bi_dram[0].start - (tmp - gd->bd->bi_dram[0].size); whats your thinking about? best regards, Hannes ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot Hi Matthias, this also fixes my problem. many thanks! best regards, Hannes ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
On 18.12.2015 06:17, Masahiro Yamada wrote: Currently, this function returns wrong size if "bootm_low" is defined, but "bootm_size" is not. Signed-off-by: Masahiro Yamada--- common/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/image.c b/common/image.c index d63d9e0..f4a1dc8 100644 --- a/common/image.c +++ b/common/image.c @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void) #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) - return gd->bd->bi_dram[0].size - tmp; + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); #else - return gd->bd->bi_memsize - tmp; + return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); #endif } Hi Masahiro, your commit has been merged on 19.1. this year. Today i ran a test on my tseries board with most current u-boot/master. I ran into trouble booting my linux kernel: --- Kernel image @ 0x8020 [ 0x00 - 0x222720 ] ## Loading init Ramdisk from Legacy Image at 80a0 ... Image Name: Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size:12452646 Bytes = 11.9 MiB Load Address: Entry Point: ## Flattened Device Tree blob at 8010 Booting using the fdt blob at 0x8010 ERROR: Failed to allocate 0xbe0326 bytes below 0x1000. ramdisk - allocation error FDT creation failed! hanging...### ERROR ### Please RESET the board ### --- I debugged bit am came to the conclusio, that the line + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); brings me into trouble. On my board DRAM is configured as follows: U-Boot (BuR V2.0)# bdinfo arch_number = 0x boot_params = 0x8100 DRAM bank = 0x *-> start= 0x8000** **-> size = 0x1000** * so size minus start would give a negative number. I tried local revert of this commit and everything works as before. more correct would be + return gd->bd->bi_dram[0].start - (tmp - gd->bd->bi_dram[0].size); whats your thinking about? best regards, Hannes ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function again
On 05.02.2016 08:12, Masahiro Yamada wrote: Commit 9c11135ce053 ("image: fix getenv_bootm_size() function") fixed the case where "bootm_low" is defined, but "bootm_size" is not. Instead, it broke the case where neither "bootm_low" nor "bootm_size" is defined. Fix this function again. Fixes: 9c11135ce053 ("image: fix getenv_bootm_size() function") Signed-off-by: Masahiro Yamada--- common/image.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/common/image.c b/common/image.c index f4a1dc8..82ace38 100644 --- a/common/image.c +++ b/common/image.c @@ -458,24 +458,29 @@ ulong getenv_bootm_low(void) phys_size_t getenv_bootm_size(void) { - phys_size_t tmp; + phys_size_t tmp, size; + phys_addr_t start; char *s = getenv("bootm_size"); if (s) { tmp = (phys_size_t)simple_strtoull(s, NULL, 16); return tmp; } + +#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) + start = gd->bd->bi_dram[0].start; + size = gd->bd->bi_dram[0].size; +#else + start = gd->bd->bi_memstart; + size = gd->bd->bi_memsize; +#endif + s = getenv("bootm_low"); if (s) tmp = (phys_size_t)simple_strtoull(s, NULL, 16); else - tmp = 0; - + tmp = start; -#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) - return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); -#else - return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); -#endif + return size - (tmp - start); } phys_size_t getenv_bootm_mapsize(void) Tested-by: Hannes Schmelzer ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function again
Hi Masahiro 2016-02-05 8:12 GMT+01:00 Masahiro Yamada: > Commit 9c11135ce053 ("image: fix getenv_bootm_size() function") fixed > the case where "bootm_low" is defined, but "bootm_size" is not. > Instead, it broke the case where neither "bootm_low" nor "bootm_size" > is defined. Fix this function again. > > Fixes: 9c11135ce053 ("image: fix getenv_bootm_size() function") > Signed-off-by: Masahiro Yamada This fixes the problem for me. Thanks a lot. Tested-by: Matthias Weisser 2016-02-05 8:12 GMT+01:00 Masahiro Yamada : > Commit 9c11135ce053 ("image: fix getenv_bootm_size() function") fixed > the case where "bootm_low" is defined, but "bootm_size" is not. > Instead, it broke the case where neither "bootm_low" nor "bootm_size" > is defined. Fix this function again. > > Fixes: 9c11135ce053 ("image: fix getenv_bootm_size() function") > Signed-off-by: Masahiro Yamada > --- > > common/image.c | 21 + > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/common/image.c b/common/image.c > index f4a1dc8..82ace38 100644 > --- a/common/image.c > +++ b/common/image.c > @@ -458,24 +458,29 @@ ulong getenv_bootm_low(void) > > phys_size_t getenv_bootm_size(void) > { > - phys_size_t tmp; > + phys_size_t tmp, size; > + phys_addr_t start; > char *s = getenv("bootm_size"); > if (s) { > tmp = (phys_size_t)simple_strtoull(s, NULL, 16); > return tmp; > } > + > +#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) > + start = gd->bd->bi_dram[0].start; > + size = gd->bd->bi_dram[0].size; > +#else > + start = gd->bd->bi_memstart; > + size = gd->bd->bi_memsize; > +#endif > + > s = getenv("bootm_low"); > if (s) > tmp = (phys_size_t)simple_strtoull(s, NULL, 16); > else > - tmp = 0; > - > + tmp = start; > > -#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) > - return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); > -#else > - return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); > -#endif > + return size - (tmp - start); > } > > phys_size_t getenv_bootm_mapsize(void) > -- > 1.9.1 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
Tom, This patch is a bug-fix and still keeping me from using bootm_low on my boards. Please apply! -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
Hi Masahiro, On 13 January 2016 at 22:50, Masahiro Yamadawrote: > Hi Simon, > > > 2016-01-08 12:33 GMT+09:00 Simon Glass : >> Hi Masahiro, >> >> On 17 December 2015 at 22:17, Masahiro Yamada >> wrote: >>> Currently, this function returns wrong size if "bootm_low" is defined, >>> but "bootm_size" is not. >>> >>> Signed-off-by: Masahiro Yamada >>> --- >>> >>> common/image.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/common/image.c b/common/image.c >>> index d63d9e0..f4a1dc8 100644 >>> --- a/common/image.c >>> +++ b/common/image.c >>> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void) >>> >>> >>> #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) >>> - return gd->bd->bi_dram[0].size - tmp; >>> + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); >>> #else >>> - return gd->bd->bi_memsize - tmp; >>> + return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); >>> #endif >>> } >>> >>> -- >>> 1.9.1 >>> >> >> Reviewed-by: Simon Glass >> >> But can you please add a comment to the image.h header file as to what >> this function is supposed to do? > > > This patch is a bug-fix and self-contained. > > > I assume you suggested the additional comment be a separate work. That's OK with me. It takes ages to understand what the function does so a comment would really help. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
Hi Simon, 2016-01-08 12:33 GMT+09:00 Simon Glass: > Hi Masahiro, > > On 17 December 2015 at 22:17, Masahiro Yamada > wrote: >> Currently, this function returns wrong size if "bootm_low" is defined, >> but "bootm_size" is not. >> >> Signed-off-by: Masahiro Yamada >> --- >> >> common/image.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/common/image.c b/common/image.c >> index d63d9e0..f4a1dc8 100644 >> --- a/common/image.c >> +++ b/common/image.c >> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void) >> >> >> #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) >> - return gd->bd->bi_dram[0].size - tmp; >> + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); >> #else >> - return gd->bd->bi_memsize - tmp; >> + return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); >> #endif >> } >> >> -- >> 1.9.1 >> > > Reviewed-by: Simon Glass > > But can you please add a comment to the image.h header file as to what > this function is supposed to do? This patch is a bug-fix and self-contained. I assume you suggested the additional comment be a separate work. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
Hi Masahiro, On 17 December 2015 at 22:17, Masahiro Yamadawrote: > Currently, this function returns wrong size if "bootm_low" is defined, > but "bootm_size" is not. > > Signed-off-by: Masahiro Yamada > --- > > common/image.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/common/image.c b/common/image.c > index d63d9e0..f4a1dc8 100644 > --- a/common/image.c > +++ b/common/image.c > @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void) > > > #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) > - return gd->bd->bi_dram[0].size - tmp; > + return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); > #else > - return gd->bd->bi_memsize - tmp; > + return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); > #endif > } > > -- > 1.9.1 > Reviewed-by: Simon Glass But can you please add a comment to the image.h header file as to what this function is supposed to do? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot