diff options
Diffstat (limited to 'arch/powerpc/platforms/ps3/setup.c')
-rw-r--r-- | arch/powerpc/platforms/ps3/setup.c | 105 |
1 files changed, 62 insertions, 43 deletions
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index 935396766621..aa05288de64e 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c | |||
@@ -37,27 +37,35 @@ | |||
37 | #include "platform.h" | 37 | #include "platform.h" |
38 | 38 | ||
39 | #if defined(DEBUG) | 39 | #if defined(DEBUG) |
40 | #define DBG(fmt...) udbg_printf(fmt) | 40 | #define DBG udbg_printf |
41 | #else | 41 | #else |
42 | #define DBG(fmt...) do{if(0)printk(fmt);}while(0) | 42 | #define DBG pr_debug |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #if !defined(CONFIG_SMP) | 45 | #if !defined(CONFIG_SMP) |
46 | static void smp_send_stop(void) {} | 46 | static void smp_send_stop(void) {} |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | int ps3_get_firmware_version(union ps3_firmware_version *v) | 49 | static union ps3_firmware_version ps3_firmware_version; |
50 | |||
51 | void ps3_get_firmware_version(union ps3_firmware_version *v) | ||
50 | { | 52 | { |
51 | int result = lv1_get_version_info(&v->raw); | 53 | *v = ps3_firmware_version; |
54 | } | ||
55 | EXPORT_SYMBOL_GPL(ps3_get_firmware_version); | ||
52 | 56 | ||
53 | if (result) { | 57 | int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev) |
54 | v->raw = 0; | 58 | { |
55 | return -1; | 59 | union ps3_firmware_version x; |
56 | } | 60 | |
61 | x.pad = 0; | ||
62 | x.major = major; | ||
63 | x.minor = minor; | ||
64 | x.rev = rev; | ||
57 | 65 | ||
58 | return result; | 66 | return (ps3_firmware_version.raw - x.raw); |
59 | } | 67 | } |
60 | EXPORT_SYMBOL_GPL(ps3_get_firmware_version); | 68 | EXPORT_SYMBOL_GPL(ps3_compare_firmware_version); |
61 | 69 | ||
62 | static void ps3_power_save(void) | 70 | static void ps3_power_save(void) |
63 | { | 71 | { |
@@ -99,7 +107,8 @@ static void ps3_panic(char *str) | |||
99 | while(1); | 107 | while(1); |
100 | } | 108 | } |
101 | 109 | ||
102 | #ifdef CONFIG_FB_PS3 | 110 | #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ |
111 | defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) | ||
103 | static void prealloc(struct ps3_prealloc *p) | 112 | static void prealloc(struct ps3_prealloc *p) |
104 | { | 113 | { |
105 | if (!p->size) | 114 | if (!p->size) |
@@ -115,12 +124,15 @@ static void prealloc(struct ps3_prealloc *p) | |||
115 | printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size, | 124 | printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size, |
116 | p->address); | 125 | p->address); |
117 | } | 126 | } |
127 | #endif | ||
118 | 128 | ||
129 | #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) | ||
119 | struct ps3_prealloc ps3fb_videomemory = { | 130 | struct ps3_prealloc ps3fb_videomemory = { |
120 | .name = "ps3fb videomemory", | 131 | .name = "ps3fb videomemory", |
121 | .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024, | 132 | .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024, |
122 | .align = 1024*1024 /* the GPU requires 1 MiB alignment */ | 133 | .align = 1024*1024 /* the GPU requires 1 MiB alignment */ |
123 | }; | 134 | }; |
135 | EXPORT_SYMBOL_GPL(ps3fb_videomemory); | ||
124 | #define prealloc_ps3fb_videomemory() prealloc(&ps3fb_videomemory) | 136 | #define prealloc_ps3fb_videomemory() prealloc(&ps3fb_videomemory) |
125 | 137 | ||
126 | static int __init early_parse_ps3fb(char *p) | 138 | static int __init early_parse_ps3fb(char *p) |
@@ -137,6 +149,30 @@ early_param("ps3fb", early_parse_ps3fb); | |||
137 | #define prealloc_ps3fb_videomemory() do { } while (0) | 149 | #define prealloc_ps3fb_videomemory() do { } while (0) |
138 | #endif | 150 | #endif |
139 | 151 | ||
152 | #if defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) | ||
153 | struct ps3_prealloc ps3flash_bounce_buffer = { | ||
154 | .name = "ps3flash bounce buffer", | ||
155 | .size = 256*1024, | ||
156 | .align = 256*1024 | ||
157 | }; | ||
158 | EXPORT_SYMBOL_GPL(ps3flash_bounce_buffer); | ||
159 | #define prealloc_ps3flash_bounce_buffer() prealloc(&ps3flash_bounce_buffer) | ||
160 | |||
161 | static int __init early_parse_ps3flash(char *p) | ||
162 | { | ||
163 | if (!p) | ||
164 | return 1; | ||
165 | |||
166 | if (!strcmp(p, "off")) | ||
167 | ps3flash_bounce_buffer.size = 0; | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | early_param("ps3flash", early_parse_ps3flash); | ||
172 | #else | ||
173 | #define prealloc_ps3flash_bounce_buffer() do { } while (0) | ||
174 | #endif | ||
175 | |||
140 | static int ps3_set_dabr(u64 dabr) | 176 | static int ps3_set_dabr(u64 dabr) |
141 | { | 177 | { |
142 | enum {DABR_USER = 1, DABR_KERNEL = 2,}; | 178 | enum {DABR_USER = 1, DABR_KERNEL = 2,}; |
@@ -146,13 +182,13 @@ static int ps3_set_dabr(u64 dabr) | |||
146 | 182 | ||
147 | static void __init ps3_setup_arch(void) | 183 | static void __init ps3_setup_arch(void) |
148 | { | 184 | { |
149 | union ps3_firmware_version v; | ||
150 | 185 | ||
151 | DBG(" -> %s:%d\n", __func__, __LINE__); | 186 | DBG(" -> %s:%d\n", __func__, __LINE__); |
152 | 187 | ||
153 | ps3_get_firmware_version(&v); | 188 | lv1_get_version_info(&ps3_firmware_version.raw); |
154 | printk(KERN_INFO "PS3 firmware version %u.%u.%u\n", v.major, v.minor, | 189 | printk(KERN_INFO "PS3 firmware version %u.%u.%u\n", |
155 | v.rev); | 190 | ps3_firmware_version.major, ps3_firmware_version.minor, |
191 | ps3_firmware_version.rev); | ||
156 | 192 | ||
157 | ps3_spu_set_platform(); | 193 | ps3_spu_set_platform(); |
158 | ps3_map_htab(); | 194 | ps3_map_htab(); |
@@ -166,6 +202,8 @@ static void __init ps3_setup_arch(void) | |||
166 | #endif | 202 | #endif |
167 | 203 | ||
168 | prealloc_ps3fb_videomemory(); | 204 | prealloc_ps3fb_videomemory(); |
205 | prealloc_ps3flash_bounce_buffer(); | ||
206 | |||
169 | ppc_md.power_save = ps3_power_save; | 207 | ppc_md.power_save = ps3_power_save; |
170 | 208 | ||
171 | DBG(" <- %s:%d\n", __func__, __LINE__); | 209 | DBG(" <- %s:%d\n", __func__, __LINE__); |
@@ -184,7 +222,7 @@ static int __init ps3_probe(void) | |||
184 | DBG(" -> %s:%d\n", __func__, __LINE__); | 222 | DBG(" -> %s:%d\n", __func__, __LINE__); |
185 | 223 | ||
186 | dt_root = of_get_flat_dt_root(); | 224 | dt_root = of_get_flat_dt_root(); |
187 | if (!of_flat_dt_is_compatible(dt_root, "PS3")) | 225 | if (!of_flat_dt_is_compatible(dt_root, "sony,ps3")) |
188 | return 0; | 226 | return 0; |
189 | 227 | ||
190 | powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE; | 228 | powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE; |
@@ -201,31 +239,12 @@ static int __init ps3_probe(void) | |||
201 | #if defined(CONFIG_KEXEC) | 239 | #if defined(CONFIG_KEXEC) |
202 | static void ps3_kexec_cpu_down(int crash_shutdown, int secondary) | 240 | static void ps3_kexec_cpu_down(int crash_shutdown, int secondary) |
203 | { | 241 | { |
204 | DBG(" -> %s:%d\n", __func__, __LINE__); | 242 | int cpu = smp_processor_id(); |
205 | |||
206 | if (secondary) { | ||
207 | int cpu; | ||
208 | for_each_online_cpu(cpu) | ||
209 | if (cpu) | ||
210 | ps3_smp_cleanup_cpu(cpu); | ||
211 | } else | ||
212 | ps3_smp_cleanup_cpu(0); | ||
213 | |||
214 | DBG(" <- %s:%d\n", __func__, __LINE__); | ||
215 | } | ||
216 | |||
217 | static void ps3_machine_kexec(struct kimage *image) | ||
218 | { | ||
219 | unsigned long ppe_id; | ||
220 | |||
221 | DBG(" -> %s:%d\n", __func__, __LINE__); | ||
222 | 243 | ||
223 | lv1_get_logical_ppe_id(&ppe_id); | 244 | DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu); |
224 | lv1_configure_irq_state_bitmap(ppe_id, 0, 0); | ||
225 | ps3_mm_shutdown(); | ||
226 | ps3_mm_vas_destroy(); | ||
227 | 245 | ||
228 | default_machine_kexec(image); | 246 | ps3_smp_cleanup_cpu(cpu); |
247 | ps3_shutdown_IRQ(cpu); | ||
229 | 248 | ||
230 | DBG(" <- %s:%d\n", __func__, __LINE__); | 249 | DBG(" <- %s:%d\n", __func__, __LINE__); |
231 | } | 250 | } |
@@ -247,7 +266,7 @@ define_machine(ps3) { | |||
247 | .power_off = ps3_power_off, | 266 | .power_off = ps3_power_off, |
248 | #if defined(CONFIG_KEXEC) | 267 | #if defined(CONFIG_KEXEC) |
249 | .kexec_cpu_down = ps3_kexec_cpu_down, | 268 | .kexec_cpu_down = ps3_kexec_cpu_down, |
250 | .machine_kexec = ps3_machine_kexec, | 269 | .machine_kexec = default_machine_kexec, |
251 | .machine_kexec_prepare = default_machine_kexec_prepare, | 270 | .machine_kexec_prepare = default_machine_kexec_prepare, |
252 | .machine_crash_shutdown = default_machine_crash_shutdown, | 271 | .machine_crash_shutdown = default_machine_crash_shutdown, |
253 | #endif | 272 | #endif |