* [PATCH] ARM bootz: use request_sdram_region
@ 2012-10-15 19:21 Sascha Hauer
2012-10-16 7:22 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-10-15 19:21 UTC (permalink / raw)
To: barebox
We now have request_sdram_region to request a region. Use
it instead of a comparison with MALLOC_BASE.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib/bootz.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
index f394a6b..f069127 100644
--- a/arch/arm/lib/bootz.c
+++ b/arch/arm/lib/bootz.c
@@ -30,6 +30,7 @@ static int do_bootz(int argc, char *argv[])
u32 end;
int usemap = 0;
struct memory_bank *bank = list_first_entry(&memory_banks, struct memory_bank, list);
+ struct resource *res = NULL;
if (argc != 2)
return COMMAND_ERROR_USAGE;
@@ -83,8 +84,10 @@ static int do_bootz(int argc, char *argv[])
zimage = xmalloc(end);
} else {
zimage = (void *)bank->start + SZ_8M;
- if (bank->start + SZ_8M + end >= MALLOC_BASE) {
- printf("won't overwrite malloc space with image\n");
+ res = request_sdram_region("zimage",
+ bank->start + SZ_8M, end);
+ if (!res) {
+ printf("can't request region for kernel\n");
goto err_out1;
}
}
@@ -94,7 +97,7 @@ static int do_bootz(int argc, char *argv[])
ret = read(fd, zimage + sizeof(*header), end - sizeof(*header));
if (ret < end - sizeof(*header)) {
printf("could not read %s\n", argv[1]);
- goto err_out1;
+ goto err_out2;
}
}
@@ -113,6 +116,9 @@ static int do_bootz(int argc, char *argv[])
return 0;
+err_out2:
+ if (res)
+ release_sdram_region(res);
err_out1:
free(zimage);
err_out:
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM bootz: use request_sdram_region
2012-10-15 19:21 [PATCH] ARM bootz: use request_sdram_region Sascha Hauer
@ 2012-10-16 7:22 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 7:30 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-16 7:22 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 21:21 Mon 15 Oct , Sascha Hauer wrote:
> We now have request_sdram_region to request a region. Use
> it instead of a comparison with MALLOC_BASE.
>
do we really need to keep bootz??
Best Regards,
J.
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/lib/bootz.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
> index f394a6b..f069127 100644
> --- a/arch/arm/lib/bootz.c
> +++ b/arch/arm/lib/bootz.c
> @@ -30,6 +30,7 @@ static int do_bootz(int argc, char *argv[])
> u32 end;
> int usemap = 0;
> struct memory_bank *bank = list_first_entry(&memory_banks, struct memory_bank, list);
> + struct resource *res = NULL;
>
> if (argc != 2)
> return COMMAND_ERROR_USAGE;
> @@ -83,8 +84,10 @@ static int do_bootz(int argc, char *argv[])
> zimage = xmalloc(end);
> } else {
> zimage = (void *)bank->start + SZ_8M;
> - if (bank->start + SZ_8M + end >= MALLOC_BASE) {
> - printf("won't overwrite malloc space with image\n");
> + res = request_sdram_region("zimage",
> + bank->start + SZ_8M, end);
> + if (!res) {
> + printf("can't request region for kernel\n");
> goto err_out1;
> }
> }
> @@ -94,7 +97,7 @@ static int do_bootz(int argc, char *argv[])
> ret = read(fd, zimage + sizeof(*header), end - sizeof(*header));
> if (ret < end - sizeof(*header)) {
> printf("could not read %s\n", argv[1]);
> - goto err_out1;
> + goto err_out2;
> }
> }
>
> @@ -113,6 +116,9 @@ static int do_bootz(int argc, char *argv[])
>
> return 0;
>
> +err_out2:
> + if (res)
> + release_sdram_region(res);
> err_out1:
> free(zimage);
> err_out:
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM bootz: use request_sdram_region
2012-10-16 7:22 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-16 7:30 ` Sascha Hauer
2012-10-16 8:47 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-10-16 7:30 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Tue, Oct 16, 2012 at 09:22:48AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 21:21 Mon 15 Oct , Sascha Hauer wrote:
> > We now have request_sdram_region to request a region. Use
> > it instead of a comparison with MALLOC_BASE.
> >
> do we really need to keep bootz??
As long as it does not cause a real maintenance burden we can keep it.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM bootz: use request_sdram_region
2012-10-16 7:30 ` Sascha Hauer
@ 2012-10-16 8:47 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 20:30 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-16 8:47 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:30 Tue 16 Oct , Sascha Hauer wrote:
> On Tue, Oct 16, 2012 at 09:22:48AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 21:21 Mon 15 Oct , Sascha Hauer wrote:
> > > We now have request_sdram_region to request a region. Use
> > > it instead of a comparison with MALLOC_BASE.
> > >
> > do we really need to keep bootz??
>
> As long as it does not cause a real maintenance burden we can keep it.
bootm do the same job
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ARM bootz: use request_sdram_region
2012-10-16 8:47 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-16 20:30 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-10-16 20:30 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Tue, Oct 16, 2012 at 10:47:34AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:30 Tue 16 Oct , Sascha Hauer wrote:
> > On Tue, Oct 16, 2012 at 09:22:48AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 21:21 Mon 15 Oct , Sascha Hauer wrote:
> > > > We now have request_sdram_region to request a region. Use
> > > > it instead of a comparison with MALLOC_BASE.
> > > >
> > > do we really need to keep bootz??
> >
> > As long as it does not cause a real maintenance burden we can keep it.
> bootm do the same job
Yes, but bootz is smaller. It is no problem to keep it. When it becomes
a problem, we can remove it. I see no reason though to do it now.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-16 20:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-15 19:21 [PATCH] ARM bootz: use request_sdram_region Sascha Hauer
2012-10-16 7:22 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 7:30 ` Sascha Hauer
2012-10-16 8:47 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-16 20:30 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox