mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ARM bootz: use request_sdram_region
Date: Mon, 15 Oct 2012 21:21:58 +0200	[thread overview]
Message-ID: <1350328918-15383-1-git-send-email-s.hauer@pengutronix.de> (raw)

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

             reply	other threads:[~2012-10-15 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 19:21 Sascha Hauer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350328918-15383-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox