summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Borleis <jbe@pengutronix.de>2017-05-09 09:51:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-11 08:17:41 +0200
commit35f3890d2b724c6adb79281413fe6f60c552ca20 (patch)
treec2192ac1ff0bf6042846b4467342e6eb130776d9
parentcad99b5ed7dca004b311a26d0fcad25ae27ec26c (diff)
downloadbarebox-35f3890d2b724c6adb79281413fe6f60c552ca20.tar.gz
barebox-35f3890d2b724c6adb79281413fe6f60c552ca20.tar.xz
PPC: request a consistent memory layout
Using the memory test command will crash barebox, because it tests the area where the stack is located for the PPC architecture. On PPC the stack is below the barebox binary. Below the stack the malloc area is located. Until this change some routines used the macros from 'memory_layout.h', some other calculated their values by their own - which resulted into an unrequested and unprotected stack area. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/ppc/mach-mpc5xxx/Kconfig1
-rw-r--r--arch/ppc/mach-mpc5xxx/cpu.c18
2 files changed, 18 insertions, 1 deletions
diff --git a/arch/ppc/mach-mpc5xxx/Kconfig b/arch/ppc/mach-mpc5xxx/Kconfig
index 1ecce3a56c..180aa32ad1 100644
--- a/arch/ppc/mach-mpc5xxx/Kconfig
+++ b/arch/ppc/mach-mpc5xxx/Kconfig
@@ -32,7 +32,6 @@ config ARCH_MPC5200
config MPC5xxx
bool
depends on MACH_PHYCORE_MPC5200B_TINY
- select HAVE_CONFIGURABLE_MEMORY_LAYOUT
default y
menu "Board specific settings"
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index 42ced9ac54..ab58967aa4 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -33,6 +33,8 @@
#include <of.h>
#include <restart.h>
#include <mach/clock.h>
+#include <asm-generic/memory_layout.h>
+#include <memory.h>
int checkcpu (void)
{
@@ -60,6 +62,22 @@ int checkcpu (void)
/* ------------------------------------------------------------------------- */
+static int mpc5xxx_reserve_region(void)
+{
+ struct resource *r;
+
+ /* keep this in sync with the assembler routines setting up the stack */
+ r = request_sdram_region("stack", _text_base - STACK_SIZE, STACK_SIZE);
+ if (r == NULL) {
+ pr_err("Failed to request stack region at: 0x%08lx/0x%08lx\n",
+ _text_base - STACK_SIZE, _text_base - 1);
+ return -EBUSY;
+ }
+
+ return 0;
+}
+coredevice_initcall(mpc5xxx_reserve_region);
+
static void __noreturn mpc5xxx_restart_soc(struct restart_handler *rst)
{
ulong msr;