mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Renaud Barbier <renaud.barbier@ge.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] ppc: fix memory layout to prevent corruption during memtest
Date: Thu, 27 Feb 2014 13:46:56 +0000	[thread overview]
Message-ID: <1393508819-3693-2-git-send-email-renaud.barbier@ge.com> (raw)
In-Reply-To: <1393508819-3693-1-git-send-email-renaud.barbier@ge.com>

Memory regions on PPC boards are incorrectly defined leading to
corruption when running memory tests. This patch updates the memory
layout of PPC boards so that critical memory regions can be correctly
reserved during the memory test.

Tested on the P2020RDB and DA923RC.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
 arch/ppc/cpu-85xx/start.S           |    3 ---
 arch/ppc/lib/board.c                |    6 +-----
 arch/ppc/mach-mpc85xx/barebox.lds.S |    8 +++++---
 include/asm-generic/memory_layout.h |    4 ++++
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/ppc/cpu-85xx/start.S b/arch/ppc/cpu-85xx/start.S
index 0402cf0..57f007b 100644
--- a/arch/ppc/cpu-85xx/start.S
+++ b/arch/ppc/cpu-85xx/start.S
@@ -879,9 +879,6 @@ relocate_code:
 	sub	r3, r3, r5
 	lwz	r5,GOT(__init_end)	/* Copy to init_end only */
 	sub	r5,r5,r4
-	lis	r10, 0xffff0000@h	/* Round down to 64KB */
-	ori	r10, r10, 0xffff0000@l
-	and	r3, r3, r10		/* Destination */
 	mr	r1, r3
 	mr	r10, r3
 	li	r6,CACHELINE_SIZE
diff --git a/arch/ppc/lib/board.c b/arch/ppc/lib/board.c
index 18d2588..3f13db9 100644
--- a/arch/ppc/lib/board.c
+++ b/arch/ppc/lib/board.c
@@ -46,11 +46,7 @@ void board_init_r (ulong end_of_ram)
 	_text_base = end_of_ram;
 #endif
 
-	/*
-	 * FIXME: 128k stack size. Is this enough? should
-	 *        it be configurable?
-	 */
-	malloc_end = (_text_base - (128 << 10)) & ~(4095);
+	malloc_end = (_text_base - STACK_SIZE) & ~(4095);
 
 	debug("malloc_end: 0x%08lx\n", malloc_end);
 	debug("TEXT_BASE after relocation: 0x%08lx\n", _text_base);
diff --git a/arch/ppc/mach-mpc85xx/barebox.lds.S b/arch/ppc/mach-mpc85xx/barebox.lds.S
index 980359e..87ab7ac 100644
--- a/arch/ppc/mach-mpc85xx/barebox.lds.S
+++ b/arch/ppc/mach-mpc85xx/barebox.lds.S
@@ -32,6 +32,8 @@ PHDRS
 SECTIONS
 {
   . = TEXT_BASE;
+   _stext = .;
+   PROVIDE (stext = .);
 
   .interp        : { *(.interp)		}
   .hash          : { *(.hash)		}
@@ -96,8 +98,6 @@ SECTIONS
     *(.dynamic*)
     CONSTRUCTORS
   }
-  _edata  =  .;
-  PROVIDE (edata = .);
 
   . = .;
   __barebox_cmd_start = .;
@@ -118,6 +118,9 @@ SECTIONS
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
 
+  _edata  =  .;
+  PROVIDE (edata = .);
+
   . = ALIGN(256);
   __init_begin = .;
   .text.init : { *(.text.init) }
@@ -130,7 +133,6 @@ SECTIONS
   .bootpg RESET_VECTOR_ADDRESS - 0xffc :
   {
     _text = .;
-    _stext = .;
     arch/ppc/cpu-85xx/start.o	(.bootpg)
   } :text = 0xffff
 
diff --git a/include/asm-generic/memory_layout.h b/include/asm-generic/memory_layout.h
index 45e0ed8..7a23db1 100644
--- a/include/asm-generic/memory_layout.h
+++ b/include/asm-generic/memory_layout.h
@@ -2,9 +2,13 @@
 #define __ASM_GENERIC_MEMORY_LAYOUT_H
 
 #ifdef CONFIG_MEMORY_LAYOUT_DEFAULT
+#ifdef CONFIG_PPC
+#define STACK_BASE ((unsigned long)&_stext - CONFIG_STACK_SIZE)
+#else
 #define MALLOC_BASE (TEXT_BASE - CONFIG_MALLOC_SIZE)
 #define STACK_BASE (TEXT_BASE - CONFIG_MALLOC_SIZE - CONFIG_STACK_SIZE)
 #endif
+#endif
 
 #ifdef CONFIG_MEMORY_LAYOUT_FIXED
 #define STACK_BASE CONFIG_STACK_BASE
-- 
1.7.1


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

  reply	other threads:[~2014-02-27 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 13:46 [PATCH 0/4] ppc: memory layout and memtest Renaud Barbier
2014-02-27 13:46 ` Renaud Barbier [this message]
2014-02-27 20:09   ` [PATCH 1/4] ppc: fix memory layout to prevent corruption during memtest Sascha Hauer
2014-02-27 13:46 ` [PATCH 2/4] ppc: add support for memtest with cache disabled Renaud Barbier
2014-02-27 13:46 ` [PATCH 3/4] memtest: exclude page starting at address 0 Renaud Barbier
2014-02-27 20:44   ` Alexander Aring
2014-02-27 13:46 ` [PATCH 4/4] ppc: P2020RDB and DA923RC configuration Renaud Barbier

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=1393508819-3693-2-git-send-email-renaud.barbier@ge.com \
    --to=renaud.barbier@ge.com \
    --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