mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/4] ARM: start: Fix arm_mem_barebox_image for !CONFIG_RELOCATABLE
Date: Thu, 16 Jun 2016 15:18:19 +0200	[thread overview]
Message-ID: <1466083102-6241-1-git-send-email-s.hauer@pengutronix.de> (raw)

Fixes: 65071bd arm: Clarify memory layout calculation

arm_mem_barebox_image() shall return the beginning of the barebox
image (and thus the end of the malloc region). For relocatable
images we can return a suitable location, but for non relocatable
images we do not have a choice: We must return TEXT_BASE. If TEXT_BASE
happens to be outside the memory region between membase and endmem
we can return the base of the ramoops area.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Markus Pargmann <mpa@pengutronix.de>
---
 arch/arm/include/asm/barebox-arm.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 8e7b45c..0acdfa3 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -143,9 +143,13 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase,
 	if (IS_ENABLED(CONFIG_RELOCATABLE)) {
 		endmem -= size;
 		endmem &= ~(SZ_1M - 1);
+		return endmem;
+	} else {
+		if (TEXT_BASE >= membase && TEXT_BASE < endmem)
+			return TEXT_BASE;
+		else
+			return endmem;
 	}
-
-	return endmem;
 }
 
 #define ENTRY_FUNCTION(name, arg0, arg1, arg2)				\
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2016-06-16 13:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 13:18 Sascha Hauer [this message]
2016-06-16 13:18 ` [PATCH 2/4] ARM: start: do not change barebox_boarddata Sascha Hauer
2016-06-16 13:18 ` [PATCH 3/4] ARM: start: simplify board_data sdram allocation Sascha Hauer
2016-06-16 13:18 ` [PATCH 4/4] ARM: start: drop unnecessary variable 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=1466083102-6241-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