diff options
author | Albert Herranz <albert_herranz@yahoo.es> | 2009-12-12 01:31:36 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-12-13 00:24:26 -0500 |
commit | b68a24bc783e9ed76549d738907c45d4799e6cb7 (patch) | |
tree | 30ebe67c76a5b73ea493eae49c520c4ff67f63ee | |
parent | 86ad53f8aa051f5cf8783e28a804adc3ebc391f7 (diff) |
powerpc: gamecube: bootwrapper bits
Add support for the Nintendo GameCube video game console to the powerpc
bootwrapper.
dtbImage.gamecube is a wrapped image that contains a flat device tree,
an entry point compatible with SDload, and an optional initrd.
Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r-- | arch/powerpc/boot/Makefile | 4 | ||||
-rw-r--r-- | arch/powerpc/boot/gamecube-head.S | 111 | ||||
-rw-r--r-- | arch/powerpc/boot/gamecube.c | 35 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 4 |
4 files changed, 153 insertions, 1 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 44bce21d3ae2..3e70aabf6778 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -76,7 +76,8 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c | |||
76 | cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ | 76 | cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ |
77 | cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ | 77 | cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ |
78 | virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ | 78 | virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ |
79 | cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c | 79 | cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \ |
80 | gamecube-head.S gamecube.c | ||
80 | src-boot := $(src-wlib) $(src-plat) empty.c | 81 | src-boot := $(src-wlib) $(src-plat) empty.c |
81 | 82 | ||
82 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 83 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
@@ -254,6 +255,7 @@ image-$(CONFIG_KSI8560) += cuImage.ksi8560 | |||
254 | image-$(CONFIG_STORCENTER) += cuImage.storcenter | 255 | image-$(CONFIG_STORCENTER) += cuImage.storcenter |
255 | image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2 | 256 | image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2 |
256 | image-$(CONFIG_PPC_C2K) += cuImage.c2k | 257 | image-$(CONFIG_PPC_C2K) += cuImage.c2k |
258 | image-$(CONFIG_GAMECUBE) += dtbImage.gamecube | ||
257 | 259 | ||
258 | # Board port in arch/powerpc/platform/amigaone/Kconfig | 260 | # Board port in arch/powerpc/platform/amigaone/Kconfig |
259 | image-$(CONFIG_AMIGAONE) += cuImage.amigaone | 261 | image-$(CONFIG_AMIGAONE) += cuImage.amigaone |
diff --git a/arch/powerpc/boot/gamecube-head.S b/arch/powerpc/boot/gamecube-head.S new file mode 100644 index 000000000000..65a9b2a3bf33 --- /dev/null +++ b/arch/powerpc/boot/gamecube-head.S | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * arch/powerpc/boot/gamecube-head.S | ||
3 | * | ||
4 | * Nintendo GameCube bootwrapper entry. | ||
5 | * Copyright (C) 2004-2009 The GameCube Linux Team | ||
6 | * Copyright (C) 2008,2009 Albert Herranz | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include "ppc_asm.h" | ||
16 | |||
17 | /* | ||
18 | * The entry code does no assumptions regarding: | ||
19 | * - if the data and instruction caches are enabled or not | ||
20 | * - if the MMU is enabled or not | ||
21 | * | ||
22 | * We enable the caches if not already enabled, enable the MMU with an | ||
23 | * identity mapping scheme and jump to the start code. | ||
24 | */ | ||
25 | |||
26 | .text | ||
27 | |||
28 | .globl _zimage_start | ||
29 | _zimage_start: | ||
30 | |||
31 | /* turn the MMU off */ | ||
32 | mfmsr 9 | ||
33 | rlwinm 9, 9, 0, ~((1<<4)|(1<<5)) /* MSR_DR|MSR_IR */ | ||
34 | bcl 20, 31, 1f | ||
35 | 1: | ||
36 | mflr 8 | ||
37 | clrlwi 8, 8, 3 /* convert to a real address */ | ||
38 | addi 8, 8, _mmu_off - 1b | ||
39 | mtsrr0 8 | ||
40 | mtsrr1 9 | ||
41 | rfi | ||
42 | _mmu_off: | ||
43 | /* MMU disabled */ | ||
44 | |||
45 | /* setup BATs */ | ||
46 | isync | ||
47 | li 8, 0 | ||
48 | mtspr 0x210, 8 /* IBAT0U */ | ||
49 | mtspr 0x212, 8 /* IBAT1U */ | ||
50 | mtspr 0x214, 8 /* IBAT2U */ | ||
51 | mtspr 0x216, 8 /* IBAT3U */ | ||
52 | mtspr 0x218, 8 /* DBAT0U */ | ||
53 | mtspr 0x21a, 8 /* DBAT1U */ | ||
54 | mtspr 0x21c, 8 /* DBAT2U */ | ||
55 | mtspr 0x21e, 8 /* DBAT3U */ | ||
56 | |||
57 | li 8, 0x01ff /* first 16MiB */ | ||
58 | li 9, 0x0002 /* rw */ | ||
59 | mtspr 0x211, 9 /* IBAT0L */ | ||
60 | mtspr 0x210, 8 /* IBAT0U */ | ||
61 | mtspr 0x219, 9 /* DBAT0L */ | ||
62 | mtspr 0x218, 8 /* DBAT0U */ | ||
63 | |||
64 | lis 8, 0x0c00 /* I/O mem */ | ||
65 | ori 8, 8, 0x3ff /* 32MiB */ | ||
66 | lis 9, 0x0c00 | ||
67 | ori 9, 9, 0x002a /* uncached, guarded, rw */ | ||
68 | mtspr 0x21b, 9 /* DBAT1L */ | ||
69 | mtspr 0x21a, 8 /* DBAT1U */ | ||
70 | |||
71 | lis 8, 0x0100 /* next 8MiB */ | ||
72 | ori 8, 8, 0x00ff /* 8MiB */ | ||
73 | lis 9, 0x0100 | ||
74 | ori 9, 9, 0x0002 /* rw */ | ||
75 | mtspr 0x215, 9 /* IBAT2L */ | ||
76 | mtspr 0x214, 8 /* IBAT2U */ | ||
77 | mtspr 0x21d, 9 /* DBAT2L */ | ||
78 | mtspr 0x21c, 8 /* DBAT2U */ | ||
79 | |||
80 | /* enable and invalidate the caches if not already enabled */ | ||
81 | mfspr 8, 0x3f0 /* HID0 */ | ||
82 | andi. 0, 8, (1<<15) /* HID0_ICE */ | ||
83 | bne 1f | ||
84 | ori 8, 8, (1<<15)|(1<<11) /* HID0_ICE|HID0_ICFI*/ | ||
85 | 1: | ||
86 | andi. 0, 8, (1<<14) /* HID0_DCE */ | ||
87 | bne 1f | ||
88 | ori 8, 8, (1<<14)|(1<<10) /* HID0_DCE|HID0_DCFI*/ | ||
89 | 1: | ||
90 | mtspr 0x3f0, 8 /* HID0 */ | ||
91 | isync | ||
92 | |||
93 | /* initialize arguments */ | ||
94 | li 3, 0 | ||
95 | li 4, 0 | ||
96 | li 5, 0 | ||
97 | |||
98 | /* turn the MMU on */ | ||
99 | bcl 20, 31, 1f | ||
100 | 1: | ||
101 | mflr 8 | ||
102 | addi 8, 8, _mmu_on - 1b | ||
103 | mfmsr 9 | ||
104 | ori 9, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */ | ||
105 | mtsrr0 8 | ||
106 | mtsrr1 9 | ||
107 | sync | ||
108 | rfi | ||
109 | _mmu_on: | ||
110 | b _zimage_start_lib | ||
111 | |||
diff --git a/arch/powerpc/boot/gamecube.c b/arch/powerpc/boot/gamecube.c new file mode 100644 index 000000000000..28ae7057be5e --- /dev/null +++ b/arch/powerpc/boot/gamecube.c | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * arch/powerpc/boot/gamecube.c | ||
3 | * | ||
4 | * Nintendo GameCube bootwrapper support | ||
5 | * Copyright (C) 2004-2009 The GameCube Linux Team | ||
6 | * Copyright (C) 2008,2009 Albert Herranz | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <stddef.h> | ||
16 | #include "stdio.h" | ||
17 | #include "types.h" | ||
18 | #include "io.h" | ||
19 | #include "ops.h" | ||
20 | |||
21 | #include "ugecon.h" | ||
22 | |||
23 | BSS_STACK(8192); | ||
24 | |||
25 | void platform_init(unsigned long r3, unsigned long r4, unsigned long r5) | ||
26 | { | ||
27 | u32 heapsize = 16*1024*1024 - (u32)_end; | ||
28 | |||
29 | simple_alloc_init(_end, heapsize, 32, 64); | ||
30 | fdt_init(_dtb_start); | ||
31 | |||
32 | if (ug_probe()) | ||
33 | console_ops.write = ug_console_write; | ||
34 | } | ||
35 | |||
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index ac9e9a58b2b0..5b9206f45552 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -230,6 +230,10 @@ xpedite52*) | |||
230 | link_address='0x1400000' | 230 | link_address='0x1400000' |
231 | platformo=$object/cuboot-85xx.o | 231 | platformo=$object/cuboot-85xx.o |
232 | ;; | 232 | ;; |
233 | gamecube) | ||
234 | link_address='0x600000' | ||
235 | platformo="$object/$platform-head.o $object/$platform.o" | ||
236 | ;; | ||
233 | esac | 237 | esac |
234 | 238 | ||
235 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" | 239 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" |