aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2008-03-18 13:07:43 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2008-04-02 21:36:11 -0400
commitd2477b5cc8ca95b8c15133ffbbebf0bd9783f560 (patch)
treebd0dd171e8614634b97fc3e02d22fe0152d308b4 /arch/powerpc/boot
parent19a74263f49dce2b96e2213f7f4c029cedbbf0ce (diff)
[POWERPC] bootwrapper: Add a firmware-independent simpleboot target.
This target produces a flat binary rather than an ELF file, fixes the entry point at the beginning of the image, and takes a complete device tree with no fixups needed. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/Makefile10
-rw-r--r--arch/powerpc/boot/simpleboot.c84
-rw-r--r--arch/powerpc/boot/virtex405-head.S30
-rwxr-xr-xarch/powerpc/boot/wrapper4
4 files changed, 127 insertions, 1 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index a31d4e12b910..7dcd9e953a98 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -40,6 +40,7 @@ $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
40$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 40$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
41$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 41$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
42$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 42$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
43$(obj)/virtex405-head.o: BOOTCFLAGS += -mcpu=405
43 44
44 45
45zlib := inffast.c inflate.c inftrees.c 46zlib := inffast.c inflate.c inftrees.c
@@ -64,7 +65,8 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c
64 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 65 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
65 fixed-head.S ep88xc.c ep405.c \ 66 fixed-head.S ep88xc.c ep405.c \
66 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 67 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
67 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c 68 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
69 virtex405-head.S
68src-boot := $(src-wlib) $(src-plat) empty.c 70src-boot := $(src-wlib) $(src-plat) empty.c
69 71
70src-boot := $(addprefix $(obj)/, $(src-boot)) 72src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -307,6 +309,12 @@ $(obj)/uImage: vmlinux $(wrapperbits)
307$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 309$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
308 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) 310 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
309 311
312$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
313 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
314
315$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
316 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
317
310$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 318$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
311 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 319 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
312 320
diff --git a/arch/powerpc/boot/simpleboot.c b/arch/powerpc/boot/simpleboot.c
new file mode 100644
index 000000000000..86cd285bccc6
--- /dev/null
+++ b/arch/powerpc/boot/simpleboot.c
@@ -0,0 +1,84 @@
1/*
2 * The simple platform -- for booting when firmware doesn't supply a device
3 * tree or any platform configuration information.
4 * All data is extracted from an embedded device tree
5 * blob.
6 *
7 * Authors: Scott Wood <scottwood@freescale.com>
8 * Grant Likely <grant.likely@secretlab.ca>
9 *
10 * Copyright (c) 2007 Freescale Semiconductor, Inc.
11 * Copyright (c) 2008 Secret Lab Technologies Ltd.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License version 2 as published
15 * by the Free Software Foundation.
16 */
17
18#include "ops.h"
19#include "types.h"
20#include "io.h"
21#include "stdio.h"
22#include "libfdt/libfdt.h"
23
24BSS_STACK(4*1024);
25
26void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
27 unsigned long r6, unsigned long r7)
28{
29 const u32 *na, *ns, *reg, *timebase;
30 u64 memsize64;
31 int node, size, i;
32
33 /* Make sure FDT blob is sane */
34 if (fdt_check_header(_dtb_start) != 0)
35 fatal("Invalid device tree blob\n");
36
37 /* Find the #address-cells and #size-cells properties */
38 node = fdt_path_offset(_dtb_start, "/");
39 if (node < 0)
40 fatal("Cannot find root node\n");
41 na = fdt_getprop(_dtb_start, node, "#address-cells", &size);
42 if (!na || (size != 4))
43 fatal("Cannot find #address-cells property");
44 ns = fdt_getprop(_dtb_start, node, "#size-cells", &size);
45 if (!ns || (size != 4))
46 fatal("Cannot find #size-cells property");
47
48 /* Find the memory range */
49 node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
50 "memory", sizeof("memory"));
51 if (node < 0)
52 fatal("Cannot find memory node\n");
53 reg = fdt_getprop(_dtb_start, node, "reg", &size);
54 if (size < (*na+*ns) * sizeof(u32))
55 fatal("cannot get memory range\n");
56
57 /* Only interested in memory based at 0 */
58 for (i = 0; i < *na; i++)
59 if (*reg++ != 0)
60 fatal("Memory range is not based at address 0\n");
61
62 /* get the memsize and trucate it to under 4G on 32 bit machines */
63 memsize64 = 0;
64 for (i = 0; i < *ns; i++)
65 memsize64 = (memsize64 << 32) | *reg++;
66 if (sizeof(void *) == 4 && memsize64 >= 0x100000000ULL)
67 memsize64 = 0xffffffff;
68
69 /* finally, setup the timebase */
70 node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
71 "cpu", sizeof("cpu"));
72 if (!node)
73 fatal("Cannot find cpu node\n");
74 timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
75 if (timebase && (size == 4))
76 timebase_period_ns = 1000000000 / *timebase;
77
78 /* Now we have the memory size; initialize the heap */
79 simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64);
80
81 /* prepare the device tree and find the console */
82 fdt_init(_dtb_start);
83 serial_console_init();
84}
diff --git a/arch/powerpc/boot/virtex405-head.S b/arch/powerpc/boot/virtex405-head.S
new file mode 100644
index 000000000000..3edb13f94669
--- /dev/null
+++ b/arch/powerpc/boot/virtex405-head.S
@@ -0,0 +1,30 @@
1#include "ppc_asm.h"
2
3 .text
4 .global _zimage_start
5_zimage_start:
6
7 /* PPC errata 213: needed by Virtex-4 FX */
8 mfccr0 0
9 oris 0,0,0x50000000@h
10 mtccr0 0
11
12 /*
13 * Invalidate the data cache if the data cache is turned off.
14 * - The 405 core does not invalidate the data cache on power-up
15 * or reset but does turn off the data cache. We cannot assume
16 * that the cache contents are valid.
17 * - If the data cache is turned on this must have been done by
18 * a bootloader and we assume that the cache contents are
19 * valid.
20 */
21 mfdccr r9
22 cmplwi r9,0
23 bne 2f
24 lis r9,0
25 li r8,256
26 mtctr r8
271: dccci r0,r9
28 addi r9,r9,0x20
29 bdnz 1b
302: b _zimage_start_lib
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 087e120e4904..14a01823ba53 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -199,6 +199,10 @@ adder875-redboot)
199 platformo="$object/fixed-head.o $object/redboot-8xx.o" 199 platformo="$object/fixed-head.o $object/redboot-8xx.o"
200 binary=y 200 binary=y
201 ;; 201 ;;
202simpleboot-virtex405-*)
203 platformo="$object/virtex405-head.o $object/simpleboot.o"
204 binary=y
205 ;;
202esac 206esac
203 207
204vmz="$tmpdir/`basename \"$kernel\"`.$ext" 208vmz="$tmpdir/`basename \"$kernel\"`.$ext"