[U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc
Stefan Roese
sr at denx.de
Thu Aug 23 10:12:42 CEST 2012
This patch enables the SPL framework to be used on powerpc platforms
and not only ARM.
Signed-off-by: Stefan Roese <sr at denx.de>
---
common/spl/spl.c | 45 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 4c0135e..7a8f2a8 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -25,7 +25,6 @@
#include <common.h>
#include <spl.h>
#include <asm/u-boot.h>
-#include <asm/utils.h>
#include <nand.h>
#include <fat.h>
#include <version.h>
@@ -36,11 +35,17 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifndef CONFIG_SYS_UBOOT_START
+#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
+#endif
+
u32 *boot_params_ptr = NULL;
struct spl_image_info spl_image;
+#ifdef CONFIG_ARM
/* Define global data structure pointer to it*/
gd_t gdata __attribute__ ((section(".data")));
+#endif
static bd_t bdata __attribute__ ((section(".data")));
inline void hang(void)
@@ -50,6 +55,7 @@ inline void hang(void)
;
}
+#ifdef CONFIG_ARM
void __weak board_init_f(ulong dummy)
{
/*
@@ -61,6 +67,17 @@ void __weak board_init_f(ulong dummy)
debug(">>board_init_f()\n");
relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE);
}
+#endif
+
+/*
+ * Weak default function for board specific cleanup/preparation before
+ * Linux boot. Some boards/platforms might now need it, so just provide
+ * an empty stub here.
+ */
+__weak void spl_board_prepare_for_linux(void)
+{
+ /* Nothing to do! */
+}
/*
* Default function to determine if u-boot or the OS should
@@ -89,7 +106,11 @@ void spl_parse_image_header(const struct image_header *header)
spl_image.size = __be32_to_cpu(header->ih_size) + header_size;
spl_image.entry_point = __be32_to_cpu(header->ih_load);
/* Load including the header */
+#ifdef CONFIG_ARM
spl_image.load_addr = spl_image.entry_point - header_size;
+#else
+ spl_image.load_addr = __be32_to_cpu(header->ih_load);
+#endif
spl_image.os = header->ih_os;
spl_image.name = (const char *)&header->ih_name;
debug("spl: payload image: %s load addr: 0x%x size: %d\n",
@@ -101,7 +122,7 @@ void spl_parse_image_header(const struct image_header *header)
header->ih_magic);
/* Let's assume U-Boot will not be more than 200 KB */
spl_image.size = 200 * 1024;
- spl_image.entry_point = CONFIG_SYS_TEXT_BASE;
+ spl_image.entry_point = CONFIG_SYS_UBOOT_START;
spl_image.load_addr = CONFIG_SYS_TEXT_BASE;
spl_image.os = IH_OS_U_BOOT;
spl_image.name = "U-Boot";
@@ -114,6 +135,7 @@ void spl_parse_image_header(const struct image_header *header)
* arg: Pointer to paramter image in RAM
*/
#ifdef CONFIG_SPL_OS_BOOT
+#ifdef CONFIG_ARM
static void __noreturn jump_to_image_linux(void *arg)
{
debug("Entering kernel arg pointer: 0x%p\n", arg);
@@ -124,7 +146,22 @@ static void __noreturn jump_to_image_linux(void *arg)
cleanup_before_linux();
image_entry(0, CONFIG_MACH_TYPE, arg);
}
-#endif
+#endif /* CONFIG_ARM */
+
+#ifdef CONFIG_PPC
+static void __noreturn jump_to_image_linux(void *arg)
+{
+ debug("Entering kernel arg pointer: 0x%p\n", arg);
+ typedef void (*image_entry_arg_t)(void *, ulong r4, ulong r5, ulong r6,
+ ulong r7, ulong r8, ulong r9)
+ __attribute__ ((noreturn));
+ image_entry_arg_t image_entry =
+ (image_entry_arg_t)spl_image.entry_point;
+
+ image_entry(arg, 0, 0, EPAPR_MAGIC, CONFIG_SYS_BOOTMAPSZ, 0, 0);
+}
+#endif /* CONFIG_PPC */
+#endif /* CONFIG_SPL_OS_BOOT */
static void __noreturn jump_to_image_no_args(void)
{
@@ -213,7 +250,9 @@ void board_init_r(gd_t *id, ulong dummy)
/* This requires UART clocks to be enabled */
void preloader_console_init(void)
{
+#ifdef CONFIG_ARM
gd = &gdata;
+#endif
gd->bd = &bdata;
gd->flags |= GD_FLG_RELOC;
gd->baudrate = CONFIG_BAUDRATE;
--
1.7.12
More information about the U-Boot
mailing list