aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Gibson <dwg@au1.ibm.com>2011-04-14 14:29:16 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-20 02:59:21 -0400
commit6c5b59b913874cae535a324a671b7ed4f17e6397 (patch)
treeff96b53f4ee23150142a1105fbcbaf90e432d5ff
parent6975a783d7b40c79be4b7a7ea450e023ff7e5e02 (diff)
powerpc/boot: Add an ePAPR compliant boot wrapper
This is a first cut at making bootwrapper code which will produce a zImage compliant with the requirements set down by ePAPR. This is a very simple bootwrapper, taking the device tree blob supplied by the ePAPR boot program and passing it on to the kernel. It builds on the earlier patch to build a relocatable ET_DYN zImage to meet the other ePAPR image requirements. For good measure we have some paranoid checks which will generate warnings if some of the ePAPR entry condition guarantees are not met. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/Kconfig6
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--arch/powerpc/boot/epapr.c66
-rwxr-xr-xarch/powerpc/boot/wrapper4
4 files changed, 79 insertions, 1 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8f4d50b0adfa..a3128ca0fe11 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -193,6 +193,12 @@ config SYS_SUPPORTS_APM_EMULATION
193 default y if PMAC_APM_EMU 193 default y if PMAC_APM_EMU
194 bool 194 bool
195 195
196config EPAPR_BOOT
197 bool
198 help
199 Used to allow a board to specify it wants an ePAPR compliant wrapper.
200 default n
201
196config DEFAULT_UIMAGE 202config DEFAULT_UIMAGE
197 bool 203 bool
198 help 204 help
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 89178164af5e..0e2a152c3aa5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -69,7 +69,8 @@ src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \
69 cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ 69 cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
70 fsl-soc.c mpc8xx.c pq2.c ugecon.c 70 fsl-soc.c mpc8xx.c pq2.c ugecon.c
71src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \ 71src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \
72 cuboot-ebony.c cuboot-hotfoot.c treeboot-ebony.c prpmc2800.c \ 72 cuboot-ebony.c cuboot-hotfoot.c epapr.c treeboot-ebony.c \
73 prpmc2800.c \
73 ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ 74 ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
74 cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \ 75 cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \
75 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 76 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
@@ -182,6 +183,7 @@ image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
182image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 183image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800
183image-$(CONFIG_PPC_ISERIES) += zImage.iseries 184image-$(CONFIG_PPC_ISERIES) += zImage.iseries
184image-$(CONFIG_DEFAULT_UIMAGE) += uImage 185image-$(CONFIG_DEFAULT_UIMAGE) += uImage
186image-$(CONFIG_EPAPR_BOOT) += zImage.epapr
185 187
186# 188#
187# Targets which embed a device tree blob 189# Targets which embed a device tree blob
diff --git a/arch/powerpc/boot/epapr.c b/arch/powerpc/boot/epapr.c
new file mode 100644
index 000000000000..06c1961bd124
--- /dev/null
+++ b/arch/powerpc/boot/epapr.c
@@ -0,0 +1,66 @@
1/*
2 * Bootwrapper for ePAPR compliant firmwares
3 *
4 * Copyright 2010 David Gibson <david@gibson.dropbear.id.au>, IBM Corporation.
5 *
6 * Based on earlier bootwrappers by:
7 * (c) Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp,\
8 * and
9 * Scott Wood <scottwood@freescale.com>
10 * Copyright (c) 2007 Freescale Semiconductor, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published
14 * by the Free Software Foundation.
15 */
16
17#include "ops.h"
18#include "stdio.h"
19#include "io.h"
20#include <libfdt.h>
21
22BSS_STACK(4096);
23
24#define EPAPR_SMAGIC 0x65504150
25#define EPAPR_EMAGIC 0x45504150
26
27static unsigned epapr_magic;
28static unsigned long ima_size;
29static unsigned long fdt_addr;
30
31static void platform_fixups(void)
32{
33 if ((epapr_magic != EPAPR_EMAGIC)
34 && (epapr_magic != EPAPR_SMAGIC))
35 fatal("r6 contained 0x%08x instead of ePAPR magic number\n",
36 epapr_magic);
37
38 if (ima_size < (unsigned long)_end)
39 printf("WARNING: Image loaded outside IMA!"
40 " (_end=%p, ima_size=0x%lx)\n", _end, ima_size);
41 if (ima_size < fdt_addr)
42 printf("WARNING: Device tree address is outside IMA!"
43 "(fdt_addr=0x%lx, ima_size=0x%lx)\n", fdt_addr,
44 ima_size);
45 if (ima_size < fdt_addr + fdt_totalsize((void *)fdt_addr))
46 printf("WARNING: Device tree extends outside IMA!"
47 " (fdt_addr=0x%lx, size=0x%x, ima_size=0x%lx\n",
48 fdt_addr, fdt_totalsize((void *)fdt_addr), ima_size);
49}
50
51void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
52 unsigned long r6, unsigned long r7)
53{
54 epapr_magic = r6;
55 ima_size = r7;
56 fdt_addr = r3;
57
58 /* FIXME: we should process reserve entries */
59
60 simple_alloc_init(_end, ima_size - (unsigned long)_end, 32, 64);
61
62 fdt_init((void *)fdt_addr);
63
64 serial_console_init();
65 platform_ops.fixups = platform_fixups;
66}
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index fef527867811..dfa29cb0f475 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -247,6 +247,10 @@ gamecube|wii)
247treeboot-iss4xx-mpic) 247treeboot-iss4xx-mpic)
248 platformo="$object/treeboot-iss4xx.o" 248 platformo="$object/treeboot-iss4xx.o"
249 ;; 249 ;;
250epapr)
251 link_address='0x20000000'
252 pie=-pie
253 ;;
250esac 254esac
251 255
252vmz="$tmpdir/`basename \"$kernel\"`.$ext" 256vmz="$tmpdir/`basename \"$kernel\"`.$ext"