diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/boot/Makefile | 21 | ||||
-rw-r--r-- | arch/powerpc/boot/ps3-head.S | 80 | ||||
-rw-r--r-- | arch/powerpc/boot/ps3-hvcall.S | 184 | ||||
-rw-r--r-- | arch/powerpc/boot/ps3.c | 161 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 55 | ||||
-rw-r--r-- | arch/powerpc/boot/zImage.ps3.lds.S | 50 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/mm.c | 2 |
7 files changed, 542 insertions, 11 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 5b2c59b1b2a6..396821cfaad0 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -46,7 +46,8 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ | |||
46 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ | 46 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ |
47 | 44x.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c | 47 | 44x.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c |
48 | src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ | 48 | src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ |
49 | cuboot-ebony.c treeboot-ebony.c prpmc2800.c | 49 | cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ |
50 | ps3-head.S ps3-hvcall.S ps3.c | ||
50 | src-boot := $(src-wlib) $(src-plat) empty.c | 51 | src-boot := $(src-wlib) $(src-plat) empty.c |
51 | 52 | ||
52 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 53 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
@@ -75,11 +76,11 @@ $(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% | |||
75 | $(obj)/empty.c: | 76 | $(obj)/empty.c: |
76 | @touch $@ | 77 | @touch $@ |
77 | 78 | ||
78 | $(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S | 79 | $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S |
79 | @cp $< $@ | 80 | @cp $< $@ |
80 | 81 | ||
81 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ | 82 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ |
82 | empty.c zImage.coff.lds zImage.lds | 83 | empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds |
83 | 84 | ||
84 | quiet_cmd_bootcc = BOOTCC $@ | 85 | quiet_cmd_bootcc = BOOTCC $@ |
85 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< | 86 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< |
@@ -102,7 +103,7 @@ hostprogs-y := addnote addRamDisk hack-coff mktree | |||
102 | 103 | ||
103 | targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) | 104 | targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) |
104 | extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ | 105 | extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ |
105 | $(obj)/zImage.lds $(obj)/zImage.coff.lds | 106 | $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds |
106 | 107 | ||
107 | wrapper :=$(srctree)/$(src)/wrapper | 108 | wrapper :=$(srctree)/$(src)/wrapper |
108 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ | 109 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ |
@@ -179,11 +180,12 @@ $(obj)/zImage.%: vmlinux $(wrapperbits) $(dts) | |||
179 | $(obj)/zImage.iseries: vmlinux | 180 | $(obj)/zImage.iseries: vmlinux |
180 | $(STRIP) -s -R .comment $< -o $@ | 181 | $(STRIP) -s -R .comment $< -o $@ |
181 | 182 | ||
182 | $(obj)/zImage.ps3: vmlinux | 183 | $(obj)/zImage.ps3: vmlinux $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts |
183 | $(STRIP) -s -R .comment $< -o $@ | 184 | $(STRIP) -s -R .comment $< -o vmlinux.strip |
185 | $(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,) | ||
184 | 186 | ||
185 | $(obj)/zImage.initrd.ps3: vmlinux | 187 | $(obj)/zImage.initrd.ps3: vmlinux $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts $(obj)/ramdisk.image.gz |
186 | @echo " WARNING zImage.initrd.ps3 not supported (yet)" | 188 | $(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz) |
187 | 189 | ||
188 | $(obj)/uImage: vmlinux $(wrapperbits) | 190 | $(obj)/uImage: vmlinux $(wrapperbits) |
189 | $(call if_changed,wrap,uboot) | 191 | $(call if_changed,wrap,uboot) |
@@ -206,7 +208,8 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) | |||
206 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< | 208 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< |
207 | 209 | ||
208 | # anything not in $(targets) | 210 | # anything not in $(targets) |
209 | clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* | 211 | clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* \ |
212 | otheros.bld | ||
210 | 213 | ||
211 | # clean up files cached by wrapper | 214 | # clean up files cached by wrapper |
212 | clean-kernel := vmlinux.strip vmlinux.bin | 215 | clean-kernel := vmlinux.strip vmlinux.bin |
diff --git a/arch/powerpc/boot/ps3-head.S b/arch/powerpc/boot/ps3-head.S new file mode 100644 index 000000000000..1a6d64a68df5 --- /dev/null +++ b/arch/powerpc/boot/ps3-head.S | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * PS3 bootwrapper entry. | ||
3 | * | ||
4 | * Copyright (C) 2007 Sony Computer Entertainment Inc. | ||
5 | * Copyright 2007 Sony Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include "ppc_asm.h" | ||
22 | |||
23 | .text | ||
24 | |||
25 | /* | ||
26 | * __system_reset_overlay - The PS3 first stage entry. | ||
27 | * | ||
28 | * The bootwraper build script copies the 0x100 bytes at symbol | ||
29 | * __system_reset_overlay to offset 0x100 of the rom image. | ||
30 | * | ||
31 | * The PS3 has a single processor with two threads. | ||
32 | */ | ||
33 | |||
34 | .globl __system_reset_overlay | ||
35 | __system_reset_overlay: | ||
36 | |||
37 | /* Switch to 32-bit mode. */ | ||
38 | |||
39 | mfmsr r9 | ||
40 | clrldi r9,r9,1 | ||
41 | mtmsrd r9 | ||
42 | nop | ||
43 | |||
44 | /* Get thread number in r3 and branch. */ | ||
45 | |||
46 | mfspr r3, 0x88 | ||
47 | cntlzw. r3, r3 | ||
48 | li r4, 0 | ||
49 | li r5, 0 | ||
50 | beq 1f | ||
51 | |||
52 | /* Secondary goes to __secondary_hold in kernel. */ | ||
53 | |||
54 | li r4, 0x60 | ||
55 | mtctr r4 | ||
56 | bctr | ||
57 | |||
58 | /* Primary delays then goes to _zimage_start in wrapper. */ | ||
59 | 1: | ||
60 | or 31, 31, 31 /* db16cyc */ | ||
61 | or 31, 31, 31 /* db16cyc */ | ||
62 | |||
63 | lis r4, _zimage_start@ha | ||
64 | addi r4, r4, _zimage_start@l | ||
65 | mtctr r4 | ||
66 | bctr | ||
67 | |||
68 | /* | ||
69 | * __system_reset_kernel - Place holder for the kernel reset vector. | ||
70 | * | ||
71 | * The bootwrapper build script copies 0x100 bytes from offset 0x100 | ||
72 | * of the rom image to the symbol __system_reset_kernel. At runtime | ||
73 | * the bootwrapper program copies the 0x100 bytes at __system_reset_kernel | ||
74 | * to ram address 0x100. This symbol must occupy 0x100 bytes. | ||
75 | */ | ||
76 | |||
77 | .globl __system_reset_kernel | ||
78 | __system_reset_kernel: | ||
79 | |||
80 | . = __system_reset_kernel + 0x100 | ||
diff --git a/arch/powerpc/boot/ps3-hvcall.S b/arch/powerpc/boot/ps3-hvcall.S new file mode 100644 index 000000000000..c8b7df3210d1 --- /dev/null +++ b/arch/powerpc/boot/ps3-hvcall.S | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | * PS3 bootwrapper hvcalls. | ||
3 | * | ||
4 | * Copyright (C) 2007 Sony Computer Entertainment Inc. | ||
5 | * Copyright 2007 Sony Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include "ppc_asm.h" | ||
22 | |||
23 | /* | ||
24 | * The PS3 hypervisor uses a 64 bit "C" language calling convention. | ||
25 | * The routines here marshal arguments between the 32 bit wrapper | ||
26 | * program and the 64 bit hvcalls. | ||
27 | * | ||
28 | * wrapper lv1 | ||
29 | * 32-bit (h,l) 64-bit | ||
30 | * | ||
31 | * 1: r3,r4 <-> r3 | ||
32 | * 2: r5,r6 <-> r4 | ||
33 | * 3: r7,r8 <-> r5 | ||
34 | * 4: r9,r10 <-> r6 | ||
35 | * 5: 8(r1),12(r1) <-> r7 | ||
36 | * 6: 16(r1),20(r1) <-> r8 | ||
37 | * 7: 24(r1),28(r1) <-> r9 | ||
38 | * 8: 32(r1),36(r1) <-> r10 | ||
39 | * | ||
40 | */ | ||
41 | |||
42 | .macro GLOBAL name | ||
43 | .section ".text" | ||
44 | .balign 4 | ||
45 | .globl \name | ||
46 | \name: | ||
47 | .endm | ||
48 | |||
49 | .macro NO_SUPPORT name | ||
50 | GLOBAL \name | ||
51 | b ps3_no_support | ||
52 | .endm | ||
53 | |||
54 | .macro HVCALL num | ||
55 | li r11, \num | ||
56 | .long 0x44000022 | ||
57 | extsw r3, r3 | ||
58 | .endm | ||
59 | |||
60 | .macro SAVE_LR offset=4 | ||
61 | mflr r0 | ||
62 | stw r0, \offset(r1) | ||
63 | .endm | ||
64 | |||
65 | .macro LOAD_LR offset=4 | ||
66 | lwz r0, \offset(r1) | ||
67 | mtlr r0 | ||
68 | .endm | ||
69 | |||
70 | .macro LOAD_64_REG target,high,low | ||
71 | sldi r11, \high, 32 | ||
72 | or \target, r11, \low | ||
73 | .endm | ||
74 | |||
75 | .macro LOAD_64_STACK target,offset | ||
76 | ld \target, \offset(r1) | ||
77 | .endm | ||
78 | |||
79 | .macro LOAD_R3 | ||
80 | LOAD_64_REG r3,r3,r4 | ||
81 | .endm | ||
82 | |||
83 | .macro LOAD_R4 | ||
84 | LOAD_64_REG r4,r5,r6 | ||
85 | .endm | ||
86 | |||
87 | .macro LOAD_R5 | ||
88 | LOAD_64_REG r5,r7,r8 | ||
89 | .endm | ||
90 | |||
91 | .macro LOAD_R6 | ||
92 | LOAD_64_REG r6,r9,r10 | ||
93 | .endm | ||
94 | |||
95 | .macro LOAD_R7 | ||
96 | LOAD_64_STACK r7,8 | ||
97 | .endm | ||
98 | |||
99 | .macro LOAD_R8 | ||
100 | LOAD_64_STACK r8,16 | ||
101 | .endm | ||
102 | |||
103 | .macro LOAD_R9 | ||
104 | LOAD_64_STACK r9,24 | ||
105 | .endm | ||
106 | |||
107 | .macro LOAD_R10 | ||
108 | LOAD_64_STACK r10,32 | ||
109 | .endm | ||
110 | |||
111 | .macro LOAD_REGS_0 | ||
112 | stwu 1,-16(1) | ||
113 | stw 3, 8(1) | ||
114 | .endm | ||
115 | |||
116 | .macro LOAD_REGS_5 | ||
117 | LOAD_R3 | ||
118 | LOAD_R4 | ||
119 | LOAD_R5 | ||
120 | LOAD_R6 | ||
121 | LOAD_R7 | ||
122 | .endm | ||
123 | |||
124 | .macro LOAD_REGS_6 | ||
125 | LOAD_REGS_5 | ||
126 | LOAD_R8 | ||
127 | .endm | ||
128 | |||
129 | .macro LOAD_REGS_8 | ||
130 | LOAD_REGS_6 | ||
131 | LOAD_R9 | ||
132 | LOAD_R10 | ||
133 | .endm | ||
134 | |||
135 | .macro STORE_REGS_0_1 | ||
136 | lwz r11, 8(r1) | ||
137 | std r4, 0(r11) | ||
138 | mr r4, r3 | ||
139 | li r3, 0 | ||
140 | addi r1,r1,16 | ||
141 | .endm | ||
142 | |||
143 | .macro STORE_REGS_5_2 | ||
144 | lwz r11, 16(r1) | ||
145 | std r4, 0(r11) | ||
146 | lwz r11, 24(r1) | ||
147 | std r5, 0(r11) | ||
148 | .endm | ||
149 | |||
150 | .macro STORE_REGS_6_1 | ||
151 | lwz r11, 24(r1) | ||
152 | std r4, 0(r11) | ||
153 | .endm | ||
154 | |||
155 | GLOBAL lv1_get_logical_ppe_id | ||
156 | SAVE_LR | ||
157 | LOAD_REGS_0 | ||
158 | HVCALL 69 | ||
159 | STORE_REGS_0_1 | ||
160 | LOAD_LR | ||
161 | blr | ||
162 | |||
163 | GLOBAL lv1_get_logical_partition_id | ||
164 | SAVE_LR | ||
165 | LOAD_REGS_0 | ||
166 | HVCALL 74 | ||
167 | STORE_REGS_0_1 | ||
168 | LOAD_LR | ||
169 | blr | ||
170 | |||
171 | GLOBAL lv1_get_repository_node_value | ||
172 | SAVE_LR | ||
173 | LOAD_REGS_5 | ||
174 | HVCALL 91 | ||
175 | STORE_REGS_5_2 | ||
176 | LOAD_LR | ||
177 | blr | ||
178 | |||
179 | GLOBAL lv1_panic | ||
180 | SAVE_LR | ||
181 | LOAD_REGS_8 | ||
182 | HVCALL 255 | ||
183 | LOAD_LR | ||
184 | blr | ||
diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c new file mode 100644 index 000000000000..893d59339c26 --- /dev/null +++ b/arch/powerpc/boot/ps3.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * PS3 bootwrapper support. | ||
3 | * | ||
4 | * Copyright (C) 2007 Sony Computer Entertainment Inc. | ||
5 | * Copyright 2007 Sony Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <stdarg.h> | ||
22 | #include <stddef.h> | ||
23 | #include "types.h" | ||
24 | #include "elf.h" | ||
25 | #include "string.h" | ||
26 | #include "stdio.h" | ||
27 | #include "page.h" | ||
28 | #include "ops.h" | ||
29 | |||
30 | extern s64 lv1_panic(u64 in_1); | ||
31 | extern s64 lv1_get_logical_partition_id(u64 *out_1); | ||
32 | extern s64 lv1_get_logical_ppe_id(u64 *out_1); | ||
33 | extern s64 lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3, | ||
34 | u64 in_4, u64 in_5, u64 *out_1, u64 *out_2); | ||
35 | |||
36 | #ifdef DEBUG | ||
37 | #define DBG(fmt...) printf(fmt) | ||
38 | #else | ||
39 | static inline int __attribute__ ((format (printf, 1, 2))) DBG( | ||
40 | const char *fmt, ...) {return 0;} | ||
41 | #endif | ||
42 | |||
43 | BSS_STACK(4096); | ||
44 | |||
45 | /* A buffer that may be edited by tools operating on a zImage binary so as to | ||
46 | * edit the command line passed to vmlinux (by setting /chosen/bootargs). | ||
47 | * The buffer is put in it's own section so that tools may locate it easier. | ||
48 | */ | ||
49 | static char cmdline[COMMAND_LINE_SIZE] | ||
50 | __attribute__((__section__("__builtin_cmdline"))); | ||
51 | |||
52 | static void prep_cmdline(void *chosen) | ||
53 | { | ||
54 | if (cmdline[0] == '\0') | ||
55 | getprop(chosen, "bootargs", cmdline, COMMAND_LINE_SIZE-1); | ||
56 | else | ||
57 | setprop_str(chosen, "bootargs", cmdline); | ||
58 | |||
59 | printf("cmdline: '%s'\n", cmdline); | ||
60 | } | ||
61 | |||
62 | static void ps3_console_write(const char *buf, int len) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | static void ps3_exit(void) | ||
67 | { | ||
68 | printf("ps3_exit\n"); | ||
69 | |||
70 | /* lv1_panic will shutdown the lpar. */ | ||
71 | |||
72 | lv1_panic(0); /* zero = do not reboot */ | ||
73 | while (1); | ||
74 | } | ||
75 | |||
76 | static int ps3_repository_read_rm_size(u64 *rm_size) | ||
77 | { | ||
78 | s64 result; | ||
79 | u64 lpar_id; | ||
80 | u64 ppe_id; | ||
81 | u64 v2; | ||
82 | |||
83 | result = lv1_get_logical_partition_id(&lpar_id); | ||
84 | |||
85 | if (result) | ||
86 | return -1; | ||
87 | |||
88 | result = lv1_get_logical_ppe_id(&ppe_id); | ||
89 | |||
90 | if (result) | ||
91 | return -1; | ||
92 | |||
93 | /* | ||
94 | * n1: 0000000062690000 : ....bi.. | ||
95 | * n2: 7075000000000000 : pu...... | ||
96 | * n3: 0000000000000001 : ........ | ||
97 | * n4: 726d5f73697a6500 : rm_size. | ||
98 | */ | ||
99 | |||
100 | result = lv1_get_repository_node_value(lpar_id, 0x0000000062690000ULL, | ||
101 | 0x7075000000000000ULL, ppe_id, 0x726d5f73697a6500ULL, rm_size, | ||
102 | &v2); | ||
103 | |||
104 | printf("%s:%d: ppe_id %lu \n", __func__, __LINE__, | ||
105 | (unsigned long)ppe_id); | ||
106 | printf("%s:%d: lpar_id %lu \n", __func__, __LINE__, | ||
107 | (unsigned long)lpar_id); | ||
108 | printf("%s:%d: rm_size %llxh \n", __func__, __LINE__, *rm_size); | ||
109 | |||
110 | return result ? -1 : 0; | ||
111 | } | ||
112 | |||
113 | void ps3_copy_vectors(void) | ||
114 | { | ||
115 | extern char __system_reset_kernel[]; | ||
116 | |||
117 | memcpy((void *)0x100, __system_reset_kernel, 0x100); | ||
118 | flush_cache((void *)0x100, 0x100); | ||
119 | } | ||
120 | |||
121 | void platform_init(void) | ||
122 | { | ||
123 | extern char _end[]; | ||
124 | extern char _dtb_start[]; | ||
125 | extern char _initrd_start[]; | ||
126 | extern char _initrd_end[]; | ||
127 | const u32 heapsize = 0x1000000 - (u32)_end; /* 16MiB */ | ||
128 | void *chosen; | ||
129 | unsigned long ft_addr; | ||
130 | u64 rm_size; | ||
131 | |||
132 | console_ops.write = ps3_console_write; | ||
133 | platform_ops.exit = ps3_exit; | ||
134 | |||
135 | printf("\n-- PS3 bootwrapper --\n"); | ||
136 | |||
137 | simple_alloc_init(_end, heapsize, 32, 64); | ||
138 | ft_init(_dtb_start, 0, 4); | ||
139 | |||
140 | chosen = finddevice("/chosen"); | ||
141 | |||
142 | ps3_repository_read_rm_size(&rm_size); | ||
143 | dt_fixup_memory(0, rm_size); | ||
144 | |||
145 | if (_initrd_end > _initrd_start) { | ||
146 | setprop_val(chosen, "linux,initrd-start", (u32)(_initrd_start)); | ||
147 | setprop_val(chosen, "linux,initrd-end", (u32)(_initrd_end)); | ||
148 | } | ||
149 | |||
150 | prep_cmdline(chosen); | ||
151 | |||
152 | ft_addr = dt_ops.finalize(); | ||
153 | |||
154 | ps3_copy_vectors(); | ||
155 | |||
156 | printf(" flat tree at 0x%lx\n\r", ft_addr); | ||
157 | |||
158 | ((kernel_entry_t)0)(ft_addr, 0, NULL); | ||
159 | |||
160 | ps3_exit(); | ||
161 | } | ||
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index da77adc73078..65f685479175 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -144,6 +144,15 @@ miboot|uboot) | |||
144 | cuboot*) | 144 | cuboot*) |
145 | gzip= | 145 | gzip= |
146 | ;; | 146 | ;; |
147 | ps3) | ||
148 | platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" | ||
149 | lds=$object/zImage.ps3.lds | ||
150 | gzip= | ||
151 | ext=bin | ||
152 | objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" | ||
153 | ksection=.kernel:vmlinux.bin | ||
154 | isection=.kernel:initrd | ||
155 | ;; | ||
147 | esac | 156 | esac |
148 | 157 | ||
149 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" | 158 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" |
@@ -239,4 +248,50 @@ treeboot*) | |||
239 | fi | 248 | fi |
240 | exit 0 | 249 | exit 0 |
241 | ;; | 250 | ;; |
251 | ps3) | ||
252 | # The ps3's loader supports loading gzipped binary images from flash | ||
253 | # rom to addr zero. The loader enters the image at addr 0x100. A | ||
254 | # bootwrapper overlay is use to arrange for the kernel to be loaded | ||
255 | # to addr zero and to have a suitable bootwrapper entry at 0x100. | ||
256 | # To construct the rom image, 0x100 bytes from offset 0x100 in the | ||
257 | # kernel is copied to the bootwrapper symbol __system_reset_kernel. | ||
258 | # The 0x100 bytes at the bootwrapper symbol __system_reset_overlay is | ||
259 | # then copied to offset 0x100. At runtime the bootwrapper program | ||
260 | # copies the 0x100 bytes at __system_reset_kernel to addr 0x100. | ||
261 | |||
262 | system_reset_overlay=0x`${CROSS}nm "$ofile" \ | ||
263 | | grep ' __system_reset_overlay$' \ | ||
264 | | cut -d' ' -f1` | ||
265 | system_reset_overlay=`printf "%d" $system_reset_overlay` | ||
266 | system_reset_kernel=0x`${CROSS}nm "$ofile" \ | ||
267 | | grep ' __system_reset_kernel$' \ | ||
268 | | cut -d' ' -f1` | ||
269 | system_reset_kernel=`printf "%d" $system_reset_kernel` | ||
270 | overlay_dest="256" | ||
271 | overlay_size="256" | ||
272 | |||
273 | rm -f "$object/otheros.bld" | ||
274 | |||
275 | ${CROSS}objcopy -O binary "$ofile" "$ofile.bin" | ||
276 | |||
277 | msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ | ||
278 | skip=$overlay_dest seek=$system_reset_kernel \ | ||
279 | count=$overlay_size bs=1 2>&1) | ||
280 | |||
281 | if [ $? -ne "0" ]; then | ||
282 | echo $msg | ||
283 | exit 1 | ||
284 | fi | ||
285 | |||
286 | msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ | ||
287 | skip=$system_reset_overlay seek=$overlay_dest \ | ||
288 | count=$overlay_size bs=1 2>&1) | ||
289 | |||
290 | if [ $? -ne "0" ]; then | ||
291 | echo $msg | ||
292 | exit 2 | ||
293 | fi | ||
294 | |||
295 | gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld" | ||
296 | ;; | ||
242 | esac | 297 | esac |
diff --git a/arch/powerpc/boot/zImage.ps3.lds.S b/arch/powerpc/boot/zImage.ps3.lds.S new file mode 100644 index 000000000000..aaa469c1e60d --- /dev/null +++ b/arch/powerpc/boot/zImage.ps3.lds.S | |||
@@ -0,0 +1,50 @@ | |||
1 | OUTPUT_ARCH(powerpc:common) | ||
2 | ENTRY(_zimage_start) | ||
3 | EXTERN(_zimage_start) | ||
4 | SECTIONS | ||
5 | { | ||
6 | _vmlinux_start = .; | ||
7 | .kernel:vmlinux.bin : { *(.kernel:vmlinux.bin) } | ||
8 | _vmlinux_end = .; | ||
9 | |||
10 | . = ALIGN(4096); | ||
11 | _dtb_start = .; | ||
12 | .kernel:dtb : { *(.kernel:dtb) } | ||
13 | _dtb_end = .; | ||
14 | |||
15 | . = ALIGN(4096); | ||
16 | _initrd_start = .; | ||
17 | .kernel:initrd : { *(.kernel:initrd) } | ||
18 | _initrd_end = .; | ||
19 | |||
20 | _start = .; | ||
21 | .text : | ||
22 | { | ||
23 | *(.text) | ||
24 | *(.fixup) | ||
25 | } | ||
26 | _etext = .; | ||
27 | . = ALIGN(4096); | ||
28 | .data : | ||
29 | { | ||
30 | *(.rodata*) | ||
31 | *(.data*) | ||
32 | *(.sdata*) | ||
33 | __got2_start = .; | ||
34 | *(.got2) | ||
35 | __got2_end = .; | ||
36 | } | ||
37 | |||
38 | . = ALIGN(4096); | ||
39 | _edata = .; | ||
40 | |||
41 | . = ALIGN(4096); | ||
42 | __bss_start = .; | ||
43 | .bss : | ||
44 | { | ||
45 | *(.sbss) | ||
46 | *(.bss) | ||
47 | } | ||
48 | . = ALIGN(4096); | ||
49 | _end = . ; | ||
50 | } | ||
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 56d47a7a022c..7bb3e1620974 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -1213,8 +1213,6 @@ void __init ps3_mm_init(void) | |||
1213 | BUG_ON(map.rm.base); | 1213 | BUG_ON(map.rm.base); |
1214 | BUG_ON(!map.rm.size); | 1214 | BUG_ON(!map.rm.size); |
1215 | 1215 | ||
1216 | lmb_add(map.rm.base, map.rm.size); | ||
1217 | lmb_analyze(); | ||
1218 | 1216 | ||
1219 | /* arrange to do this in ps3_mm_add_memory */ | 1217 | /* arrange to do this in ps3_mm_add_memory */ |
1220 | ps3_mm_region_create(&map.r1, map.total - map.rm.size); | 1218 | ps3_mm_region_create(&map.r1, map.total - map.rm.size); |