mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [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

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