aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/hp/sim/simserial.c11
-rw-r--r--arch/ia64/kernel/fsys.S1
-rw-r--r--arch/ia64/kernel/jprobes.S27
-rw-r--r--arch/ia64/kernel/kprobes.c57
-rw-r--r--arch/ia64/kernel/mca_asm.S2
-rw-r--r--arch/ia64/kernel/salinfo.c170
-rw-r--r--arch/ia64/kernel/traps.c26
-rw-r--r--arch/ia64/mm/tlb.c2
-rw-r--r--arch/ia64/sn/include/xtalk/hubdev.h16
-rw-r--r--arch/ia64/sn/kernel/bte_error.c58
-rw-r--r--arch/ia64/sn/kernel/huberror.c9
-rw-r--r--arch/ia64/sn/kernel/io_init.c94
-rw-r--r--arch/ia64/sn/kernel/xpc.h1273
-rw-r--r--arch/ia64/sn/kernel/xpc_channel.c24
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c189
-rw-r--r--arch/ia64/sn/kernel/xpc_partition.c10
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c34
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c20
-rw-r--r--arch/powerpc/Makefile7
-rw-r--r--arch/powerpc/boot/Makefile49
-rw-r--r--arch/powerpc/boot/crt0.S21
-rw-r--r--arch/powerpc/boot/hack-coff.c84
-rw-r--r--arch/powerpc/boot/main.c46
-rw-r--r--arch/powerpc/boot/prom.c538
-rw-r--r--arch/powerpc/boot/prom.h36
-rw-r--r--arch/powerpc/boot/rs6000.h243
-rw-r--r--arch/powerpc/boot/stdio.c325
-rw-r--r--arch/powerpc/boot/stdio.h6
-rw-r--r--arch/powerpc/boot/string.S20
-rw-r--r--arch/powerpc/boot/zImage.coff.lds46
-rw-r--r--arch/powerpc/configs/mpc834x_sys_defconfig911
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/cpu_setup_power4.S4
-rw-r--r--arch/powerpc/kernel/cputable.c224
-rw-r--r--arch/powerpc/kernel/entry_32.S2
-rw-r--r--arch/powerpc/kernel/entry_64.S15
-rw-r--r--arch/powerpc/kernel/fpu.S10
-rw-r--r--arch/powerpc/kernel/head_64.S112
-rw-r--r--arch/powerpc/kernel/idle_power4.S8
-rw-r--r--arch/powerpc/kernel/irq.c12
-rw-r--r--arch/powerpc/kernel/lparcfg.c13
-rw-r--r--arch/powerpc/kernel/misc_32.S4
-rw-r--r--arch/powerpc/kernel/misc_64.S10
-rw-r--r--arch/powerpc/kernel/paca.c36
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/prom.c109
-rw-r--r--arch/powerpc/kernel/prom_parse.c3
-rw-r--r--arch/powerpc/kernel/rtas.c96
-rw-r--r--arch/powerpc/kernel/setup-common.c9
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/powerpc/lib/locks.c8
-rw-r--r--arch/powerpc/oprofile/common.c8
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c243
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.h23
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h14
-rw-r--r--arch/powerpc/platforms/83xx/pci.c99
-rw-r--r--arch/powerpc/platforms/chrp/pci.c27
-rw-r--r--arch/powerpc/platforms/chrp/setup.c7
-rw-r--r--arch/powerpc/platforms/chrp/time.c7
-rw-r--r--arch/powerpc/platforms/iseries/irq.c6
-rw-r--r--arch/powerpc/platforms/iseries/misc.S3
-rw-r--r--arch/powerpc/platforms/iseries/setup.c8
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c4
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c100
-rw-r--r--arch/powerpc/platforms/pseries/setup.c20
-rw-r--r--arch/powerpc/sysdev/Makefile1
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c317
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h8
-rw-r--r--arch/ppc/4xx_io/serial_sicc.c1
-rw-r--r--arch/ppc/kernel/head_8xx.S77
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c1
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c10
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c14
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c11
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c16
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c10
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c10
-rw-r--r--arch/ppc/platforms/85xx/tqm85xx.c16
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c10
-rw-r--r--arch/ppc/syslib/mpc85xx_devices.c10
82 files changed, 3815 insertions, 2306 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index a346e1833bf2..626cdc83668b 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -108,7 +108,6 @@ static struct async_struct *IRQ_ports[NR_IRQS];
108static struct console *console; 108static struct console *console;
109 109
110static unsigned char *tmp_buf; 110static unsigned char *tmp_buf;
111static DECLARE_MUTEX(tmp_buf_sem);
112 111
113extern struct console *console_drivers; /* from kernel/printk.c */ 112extern struct console *console_drivers; /* from kernel/printk.c */
114 113
@@ -167,15 +166,9 @@ static void receive_chars(struct tty_struct *tty, struct pt_regs *regs)
167 } 166 }
168 } 167 }
169 seen_esc = 0; 168 seen_esc = 0;
170 if (tty->flip.count >= TTY_FLIPBUF_SIZE) break;
171 169
172 *tty->flip.char_buf_ptr = ch; 170 if (tty_insert_flip_char(tty, ch, TTY_NORMAL) == 0)
173 171 break;
174 *tty->flip.flag_buf_ptr = 0;
175
176 tty->flip.flag_buf_ptr++;
177 tty->flip.char_buf_ptr++;
178 tty->flip.count++;
179 } 172 }
180 tty_flip_buffer_push(tty); 173 tty_flip_buffer_push(tty);
181} 174}
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 2ddbac6f4999..ce423910ca97 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -903,5 +903,6 @@ fsyscall_table:
903 data8 0 903 data8 0
904 data8 0 904 data8 0
905 data8 0 905 data8 0
906 data8 0 // 1280
906 907
907 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 908 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/jprobes.S b/arch/ia64/kernel/jprobes.S
index 2323377e3695..5cd6226f44f2 100644
--- a/arch/ia64/kernel/jprobes.S
+++ b/arch/ia64/kernel/jprobes.S
@@ -60,3 +60,30 @@ END(jprobe_break)
60GLOBAL_ENTRY(jprobe_inst_return) 60GLOBAL_ENTRY(jprobe_inst_return)
61 br.call.sptk.many b0=jprobe_break 61 br.call.sptk.many b0=jprobe_break
62END(jprobe_inst_return) 62END(jprobe_inst_return)
63
64GLOBAL_ENTRY(invalidate_stacked_regs)
65 movl r16=invalidate_restore_cfm
66 ;;
67 mov b6=r16
68 ;;
69 br.ret.sptk.many b6
70 ;;
71invalidate_restore_cfm:
72 mov r16=ar.rsc
73 ;;
74 mov ar.rsc=r0
75 ;;
76 loadrs
77 ;;
78 mov ar.rsc=r16
79 ;;
80 br.cond.sptk.many rp
81END(invalidate_stacked_regs)
82
83GLOBAL_ENTRY(flush_register_stack)
84 // flush dirty regs to backing store (must be first in insn group)
85 flushrs
86 ;;
87 br.ret.sptk.many rp
88END(flush_register_stack)
89
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 346fedf9ea47..50ae8c7d453d 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -766,11 +766,56 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
766 return ret; 766 return ret;
767} 767}
768 768
769struct param_bsp_cfm {
770 unsigned long ip;
771 unsigned long *bsp;
772 unsigned long cfm;
773};
774
775static void ia64_get_bsp_cfm(struct unw_frame_info *info, void *arg)
776{
777 unsigned long ip;
778 struct param_bsp_cfm *lp = arg;
779
780 do {
781 unw_get_ip(info, &ip);
782 if (ip == 0)
783 break;
784 if (ip == lp->ip) {
785 unw_get_bsp(info, (unsigned long*)&lp->bsp);
786 unw_get_cfm(info, (unsigned long*)&lp->cfm);
787 return;
788 }
789 } while (unw_unwind(info) >= 0);
790 lp->bsp = 0;
791 lp->cfm = 0;
792 return;
793}
794
769int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 795int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
770{ 796{
771 struct jprobe *jp = container_of(p, struct jprobe, kp); 797 struct jprobe *jp = container_of(p, struct jprobe, kp);
772 unsigned long addr = ((struct fnptr *)(jp->entry))->ip; 798 unsigned long addr = ((struct fnptr *)(jp->entry))->ip;
773 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 799 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
800 struct param_bsp_cfm pa;
801 int bytes;
802
803 /*
804 * Callee owns the argument space and could overwrite it, eg
805 * tail call optimization. So to be absolutely safe
806 * we save the argument space before transfering the control
807 * to instrumented jprobe function which runs in
808 * the process context
809 */
810 pa.ip = regs->cr_iip;
811 unw_init_running(ia64_get_bsp_cfm, &pa);
812 bytes = (char *)ia64_rse_skip_regs(pa.bsp, pa.cfm & 0x3f)
813 - (char *)pa.bsp;
814 memcpy( kcb->jprobes_saved_stacked_regs,
815 pa.bsp,
816 bytes );
817 kcb->bsp = pa.bsp;
818 kcb->cfm = pa.cfm;
774 819
775 /* save architectural state */ 820 /* save architectural state */
776 kcb->jprobe_saved_regs = *regs; 821 kcb->jprobe_saved_regs = *regs;
@@ -792,8 +837,20 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
792int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 837int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
793{ 838{
794 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 839 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
840 int bytes;
795 841
842 /* restoring architectural state */
796 *regs = kcb->jprobe_saved_regs; 843 *regs = kcb->jprobe_saved_regs;
844
845 /* restoring the original argument space */
846 flush_register_stack();
847 bytes = (char *)ia64_rse_skip_regs(kcb->bsp, kcb->cfm & 0x3f)
848 - (char *)kcb->bsp;
849 memcpy( kcb->bsp,
850 kcb->jprobes_saved_stacked_regs,
851 bytes );
852 invalidate_stacked_regs();
853
797 preempt_enable_no_resched(); 854 preempt_enable_no_resched();
798 return 1; 855 return 1;
799} 856}
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index db32fc1d3935..403a80a58c13 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -847,7 +847,7 @@ ia64_state_restore:
847 ;; 847 ;;
848 mov cr.iim=temp3 848 mov cr.iim=temp3
849 mov cr.iha=temp4 849 mov cr.iha=temp4
850 dep r22=0,r22,62,2 // pal_min_state, physical, uncached 850 dep r22=0,r22,62,1 // pal_min_state, physical, uncached
851 mov IA64_KR(CURRENT)=r21 851 mov IA64_KR(CURRENT)=r21
852 ld8 r8=[temp1] // os_status 852 ld8 r8=[temp1] // os_status
853 ld8 r10=[temp2] // context 853 ld8 r10=[temp2] // context
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index a87a162a3086..9d5a823479a3 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Creates entries in /proc/sal for various system features. 4 * Creates entries in /proc/sal for various system features.
5 * 5 *
6 * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (c) 2003, 2006 Silicon Graphics, Inc. All rights reserved.
7 * Copyright (c) 2003 Hewlett-Packard Co 7 * Copyright (c) 2003 Hewlett-Packard Co
8 * Bjorn Helgaas <bjorn.helgaas@hp.com> 8 * Bjorn Helgaas <bjorn.helgaas@hp.com>
9 * 9 *
@@ -27,9 +27,17 @@
27 * mca.c may not pass a buffer, a NULL buffer just indicates that a new 27 * mca.c may not pass a buffer, a NULL buffer just indicates that a new
28 * record is available in SAL. 28 * record is available in SAL.
29 * Replace some NR_CPUS by cpus_online, for hotplug cpu. 29 * Replace some NR_CPUS by cpus_online, for hotplug cpu.
30 *
31 * Jan 5 2006 kaos@sgi.com
32 * Handle hotplug cpus coming online.
33 * Handle hotplug cpus going offline while they still have outstanding records.
34 * Use the cpu_* macros consistently.
35 * Replace the counting semaphore with a mutex and a test if the cpumask is non-empty.
36 * Modify the locking to make the test for "work to do" an atomic operation.
30 */ 37 */
31 38
32#include <linux/capability.h> 39#include <linux/capability.h>
40#include <linux/cpu.h>
33#include <linux/types.h> 41#include <linux/types.h>
34#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
35#include <linux/module.h> 43#include <linux/module.h>
@@ -132,8 +140,8 @@ enum salinfo_state {
132}; 140};
133 141
134struct salinfo_data { 142struct salinfo_data {
135 volatile cpumask_t cpu_event; /* which cpus have outstanding events */ 143 cpumask_t cpu_event; /* which cpus have outstanding events */
136 struct semaphore sem; /* count of cpus with outstanding events (bits set in cpu_event) */ 144 struct semaphore mutex;
137 u8 *log_buffer; 145 u8 *log_buffer;
138 u64 log_size; 146 u64 log_size;
139 u8 *oemdata; /* decoded oem data */ 147 u8 *oemdata; /* decoded oem data */
@@ -174,6 +182,21 @@ struct salinfo_platform_oemdata_parms {
174 int ret; 182 int ret;
175}; 183};
176 184
185/* Kick the mutex that tells user space that there is work to do. Instead of
186 * trying to track the state of the mutex across multiple cpus, in user
187 * context, interrupt context, non-maskable interrupt context and hotplug cpu,
188 * it is far easier just to grab the mutex if it is free then release it.
189 *
190 * This routine must be called with data_saved_lock held, to make the down/up
191 * operation atomic.
192 */
193static void
194salinfo_work_to_do(struct salinfo_data *data)
195{
196 down_trylock(&data->mutex);
197 up(&data->mutex);
198}
199
177static void 200static void
178salinfo_platform_oemdata_cpu(void *context) 201salinfo_platform_oemdata_cpu(void *context)
179{ 202{
@@ -212,9 +235,9 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
212 235
213 BUG_ON(type >= ARRAY_SIZE(salinfo_log_name)); 236 BUG_ON(type >= ARRAY_SIZE(salinfo_log_name));
214 237
238 if (irqsafe)
239 spin_lock_irqsave(&data_saved_lock, flags);
215 if (buffer) { 240 if (buffer) {
216 if (irqsafe)
217 spin_lock_irqsave(&data_saved_lock, flags);
218 for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) { 241 for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) {
219 if (!data_saved->buffer) 242 if (!data_saved->buffer)
220 break; 243 break;
@@ -232,13 +255,11 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
232 data_saved->size = size; 255 data_saved->size = size;
233 data_saved->buffer = buffer; 256 data_saved->buffer = buffer;
234 } 257 }
235 if (irqsafe)
236 spin_unlock_irqrestore(&data_saved_lock, flags);
237 } 258 }
238 259 cpu_set(smp_processor_id(), data->cpu_event);
239 if (!test_and_set_bit(smp_processor_id(), &data->cpu_event)) { 260 if (irqsafe) {
240 if (irqsafe) 261 salinfo_work_to_do(data);
241 up(&data->sem); 262 spin_unlock_irqrestore(&data_saved_lock, flags);
242 } 263 }
243} 264}
244 265
@@ -249,20 +270,17 @@ static struct timer_list salinfo_timer;
249static void 270static void
250salinfo_timeout_check(struct salinfo_data *data) 271salinfo_timeout_check(struct salinfo_data *data)
251{ 272{
252 int i; 273 unsigned long flags;
253 if (!data->open) 274 if (!data->open)
254 return; 275 return;
255 for_each_online_cpu(i) { 276 if (!cpus_empty(data->cpu_event)) {
256 if (test_bit(i, &data->cpu_event)) { 277 spin_lock_irqsave(&data_saved_lock, flags);
257 /* double up() is not a problem, user space will see no 278 salinfo_work_to_do(data);
258 * records for the additional "events". 279 spin_unlock_irqrestore(&data_saved_lock, flags);
259 */
260 up(&data->sem);
261 }
262 } 280 }
263} 281}
264 282
265static void 283static void
266salinfo_timeout (unsigned long arg) 284salinfo_timeout (unsigned long arg)
267{ 285{
268 salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA); 286 salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA);
@@ -290,16 +308,20 @@ salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t
290 int i, n, cpu = -1; 308 int i, n, cpu = -1;
291 309
292retry: 310retry:
293 if (down_trylock(&data->sem)) { 311 if (cpus_empty(data->cpu_event) && down_trylock(&data->mutex)) {
294 if (file->f_flags & O_NONBLOCK) 312 if (file->f_flags & O_NONBLOCK)
295 return -EAGAIN; 313 return -EAGAIN;
296 if (down_interruptible(&data->sem)) 314 if (down_interruptible(&data->mutex))
297 return -EINTR; 315 return -EINTR;
298 } 316 }
299 317
300 n = data->cpu_check; 318 n = data->cpu_check;
301 for (i = 0; i < NR_CPUS; i++) { 319 for (i = 0; i < NR_CPUS; i++) {
302 if (test_bit(n, &data->cpu_event) && cpu_online(n)) { 320 if (cpu_isset(n, data->cpu_event)) {
321 if (!cpu_online(n)) {
322 cpu_clear(n, data->cpu_event);
323 continue;
324 }
303 cpu = n; 325 cpu = n;
304 break; 326 break;
305 } 327 }
@@ -310,9 +332,6 @@ retry:
310 if (cpu == -1) 332 if (cpu == -1)
311 goto retry; 333 goto retry;
312 334
313 /* events are sticky until the user says "clear" */
314 up(&data->sem);
315
316 /* for next read, start checking at next CPU */ 335 /* for next read, start checking at next CPU */
317 data->cpu_check = cpu; 336 data->cpu_check = cpu;
318 if (++data->cpu_check == NR_CPUS) 337 if (++data->cpu_check == NR_CPUS)
@@ -381,10 +400,8 @@ salinfo_log_release(struct inode *inode, struct file *file)
381static void 400static void
382call_on_cpu(int cpu, void (*fn)(void *), void *arg) 401call_on_cpu(int cpu, void (*fn)(void *), void *arg)
383{ 402{
384 cpumask_t save_cpus_allowed, new_cpus_allowed; 403 cpumask_t save_cpus_allowed = current->cpus_allowed;
385 memcpy(&save_cpus_allowed, &current->cpus_allowed, sizeof(save_cpus_allowed)); 404 cpumask_t new_cpus_allowed = cpumask_of_cpu(cpu);
386 memset(&new_cpus_allowed, 0, sizeof(new_cpus_allowed));
387 set_bit(cpu, &new_cpus_allowed);
388 set_cpus_allowed(current, new_cpus_allowed); 405 set_cpus_allowed(current, new_cpus_allowed);
389 (*fn)(arg); 406 (*fn)(arg);
390 set_cpus_allowed(current, save_cpus_allowed); 407 set_cpus_allowed(current, save_cpus_allowed);
@@ -433,10 +450,10 @@ retry:
433 if (!data->saved_num) 450 if (!data->saved_num)
434 call_on_cpu(cpu, salinfo_log_read_cpu, data); 451 call_on_cpu(cpu, salinfo_log_read_cpu, data);
435 if (!data->log_size) { 452 if (!data->log_size) {
436 data->state = STATE_NO_DATA; 453 data->state = STATE_NO_DATA;
437 clear_bit(cpu, &data->cpu_event); 454 cpu_clear(cpu, data->cpu_event);
438 } else { 455 } else {
439 data->state = STATE_LOG_RECORD; 456 data->state = STATE_LOG_RECORD;
440 } 457 }
441} 458}
442 459
@@ -473,27 +490,31 @@ static int
473salinfo_log_clear(struct salinfo_data *data, int cpu) 490salinfo_log_clear(struct salinfo_data *data, int cpu)
474{ 491{
475 sal_log_record_header_t *rh; 492 sal_log_record_header_t *rh;
493 unsigned long flags;
494 spin_lock_irqsave(&data_saved_lock, flags);
476 data->state = STATE_NO_DATA; 495 data->state = STATE_NO_DATA;
477 if (!test_bit(cpu, &data->cpu_event)) 496 if (!cpu_isset(cpu, data->cpu_event)) {
497 spin_unlock_irqrestore(&data_saved_lock, flags);
478 return 0; 498 return 0;
479 down(&data->sem); 499 }
480 clear_bit(cpu, &data->cpu_event); 500 cpu_clear(cpu, data->cpu_event);
481 if (data->saved_num) { 501 if (data->saved_num) {
482 unsigned long flags; 502 shift1_data_saved(data, data->saved_num - 1);
483 spin_lock_irqsave(&data_saved_lock, flags);
484 shift1_data_saved(data, data->saved_num - 1 );
485 data->saved_num = 0; 503 data->saved_num = 0;
486 spin_unlock_irqrestore(&data_saved_lock, flags);
487 } 504 }
505 spin_unlock_irqrestore(&data_saved_lock, flags);
488 rh = (sal_log_record_header_t *)(data->log_buffer); 506 rh = (sal_log_record_header_t *)(data->log_buffer);
489 /* Corrected errors have already been cleared from SAL */ 507 /* Corrected errors have already been cleared from SAL */
490 if (rh->severity != sal_log_severity_corrected) 508 if (rh->severity != sal_log_severity_corrected)
491 call_on_cpu(cpu, salinfo_log_clear_cpu, data); 509 call_on_cpu(cpu, salinfo_log_clear_cpu, data);
492 /* clearing a record may make a new record visible */ 510 /* clearing a record may make a new record visible */
493 salinfo_log_new_read(cpu, data); 511 salinfo_log_new_read(cpu, data);
494 if (data->state == STATE_LOG_RECORD && 512 if (data->state == STATE_LOG_RECORD) {
495 !test_and_set_bit(cpu, &data->cpu_event)) 513 spin_lock_irqsave(&data_saved_lock, flags);
496 up(&data->sem); 514 cpu_set(cpu, data->cpu_event);
515 salinfo_work_to_do(data);
516 spin_unlock_irqrestore(&data_saved_lock, flags);
517 }
497 return 0; 518 return 0;
498} 519}
499 520
@@ -550,6 +571,53 @@ static struct file_operations salinfo_data_fops = {
550 .write = salinfo_log_write, 571 .write = salinfo_log_write,
551}; 572};
552 573
574#ifdef CONFIG_HOTPLUG_CPU
575static int __devinit
576salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
577{
578 unsigned int i, cpu = (unsigned long)hcpu;
579 unsigned long flags;
580 struct salinfo_data *data;
581 switch (action) {
582 case CPU_ONLINE:
583 spin_lock_irqsave(&data_saved_lock, flags);
584 for (i = 0, data = salinfo_data;
585 i < ARRAY_SIZE(salinfo_data);
586 ++i, ++data) {
587 cpu_set(cpu, data->cpu_event);
588 salinfo_work_to_do(data);
589 }
590 spin_unlock_irqrestore(&data_saved_lock, flags);
591 break;
592 case CPU_DEAD:
593 spin_lock_irqsave(&data_saved_lock, flags);
594 for (i = 0, data = salinfo_data;
595 i < ARRAY_SIZE(salinfo_data);
596 ++i, ++data) {
597 struct salinfo_data_saved *data_saved;
598 int j;
599 for (j = ARRAY_SIZE(data->data_saved) - 1, data_saved = data->data_saved + j;
600 j >= 0;
601 --j, --data_saved) {
602 if (data_saved->buffer && data_saved->cpu == cpu) {
603 shift1_data_saved(data, j);
604 }
605 }
606 cpu_clear(cpu, data->cpu_event);
607 }
608 spin_unlock_irqrestore(&data_saved_lock, flags);
609 break;
610 }
611 return NOTIFY_OK;
612}
613
614static struct notifier_block salinfo_cpu_notifier =
615{
616 .notifier_call = salinfo_cpu_callback,
617 .priority = 0,
618};
619#endif /* CONFIG_HOTPLUG_CPU */
620
553static int __init 621static int __init
554salinfo_init(void) 622salinfo_init(void)
555{ 623{
@@ -557,7 +625,7 @@ salinfo_init(void)
557 struct proc_dir_entry **sdir = salinfo_proc_entries; /* keeps track of every entry */ 625 struct proc_dir_entry **sdir = salinfo_proc_entries; /* keeps track of every entry */
558 struct proc_dir_entry *dir, *entry; 626 struct proc_dir_entry *dir, *entry;
559 struct salinfo_data *data; 627 struct salinfo_data *data;
560 int i, j, online; 628 int i, j;
561 629
562 salinfo_dir = proc_mkdir("sal", NULL); 630 salinfo_dir = proc_mkdir("sal", NULL);
563 if (!salinfo_dir) 631 if (!salinfo_dir)
@@ -572,7 +640,7 @@ salinfo_init(void)
572 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { 640 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
573 data = salinfo_data + i; 641 data = salinfo_data + i;
574 data->type = i; 642 data->type = i;
575 sema_init(&data->sem, 0); 643 init_MUTEX(&data->mutex);
576 dir = proc_mkdir(salinfo_log_name[i], salinfo_dir); 644 dir = proc_mkdir(salinfo_log_name[i], salinfo_dir);
577 if (!dir) 645 if (!dir)
578 continue; 646 continue;
@@ -592,12 +660,8 @@ salinfo_init(void)
592 *sdir++ = entry; 660 *sdir++ = entry;
593 661
594 /* we missed any events before now */ 662 /* we missed any events before now */
595 online = 0; 663 for_each_online_cpu(j)
596 for_each_online_cpu(j) { 664 cpu_set(j, data->cpu_event);
597 set_bit(j, &data->cpu_event);
598 ++online;
599 }
600 sema_init(&data->sem, online);
601 665
602 *sdir++ = dir; 666 *sdir++ = dir;
603 } 667 }
@@ -609,6 +673,10 @@ salinfo_init(void)
609 salinfo_timer.function = &salinfo_timeout; 673 salinfo_timer.function = &salinfo_timeout;
610 add_timer(&salinfo_timer); 674 add_timer(&salinfo_timer);
611 675
676#ifdef CONFIG_HOTPLUG_CPU
677 register_cpu_notifier(&salinfo_cpu_notifier);
678#endif
679
612 return 0; 680 return 0;
613} 681}
614 682
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index d3e0ecb56d62..55391901b013 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -530,12 +530,15 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
530 if (fsys_mode(current, &regs)) { 530 if (fsys_mode(current, &regs)) {
531 extern char __kernel_syscall_via_break[]; 531 extern char __kernel_syscall_via_break[];
532 /* 532 /*
533 * Got a trap in fsys-mode: Taken Branch Trap and Single Step trap 533 * Got a trap in fsys-mode: Taken Branch Trap
534 * need special handling; Debug trap is not supposed to happen. 534 * and Single Step trap need special handling;
535 * Debug trap is ignored (we disable it here
536 * and re-enable it in the lower-privilege trap).
535 */ 537 */
536 if (unlikely(vector == 29)) { 538 if (unlikely(vector == 29)) {
537 die("Got debug trap in fsys-mode---not supposed to happen!", 539 set_thread_flag(TIF_DB_DISABLED);
538 &regs, 0); 540 ia64_psr(&regs)->db = 0;
541 ia64_psr(&regs)->lp = 1;
539 return; 542 return;
540 } 543 }
541 /* re-do the system call via break 0x100000: */ 544 /* re-do the system call via break 0x100000: */
@@ -589,10 +592,19 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
589 case 34: 592 case 34:
590 if (isr & 0x2) { 593 if (isr & 0x2) {
591 /* Lower-Privilege Transfer Trap */ 594 /* Lower-Privilege Transfer Trap */
595
596 /* If we disabled debug traps during an fsyscall,
597 * re-enable them here.
598 */
599 if (test_thread_flag(TIF_DB_DISABLED)) {
600 clear_thread_flag(TIF_DB_DISABLED);
601 ia64_psr(&regs)->db = 1;
602 }
603
592 /* 604 /*
593 * Just clear PSR.lp and then return immediately: all the 605 * Just clear PSR.lp and then return immediately:
594 * interesting work (e.g., signal delivery is done in the kernel 606 * all the interesting work (e.g., signal delivery)
595 * exit path). 607 * is done in the kernel exit path.
596 */ 608 */
597 ia64_psr(&regs)->lp = 0; 609 ia64_psr(&regs)->lp = 0;
598 return; 610 return;
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 41105d454423..6a4eec9113e8 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -90,7 +90,7 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
90{ 90{
91 static DEFINE_SPINLOCK(ptcg_lock); 91 static DEFINE_SPINLOCK(ptcg_lock);
92 92
93 if (mm != current->active_mm) { 93 if (mm != current->active_mm || !current->mm) {
94 flush_tlb_all(); 94 flush_tlb_all();
95 return; 95 return;
96 } 96 }
diff --git a/arch/ia64/sn/include/xtalk/hubdev.h b/arch/ia64/sn/include/xtalk/hubdev.h
index 71c2b271b4c6..4d417c301201 100644
--- a/arch/ia64/sn/include/xtalk/hubdev.h
+++ b/arch/ia64/sn/include/xtalk/hubdev.h
@@ -26,11 +26,14 @@
26#define IIO_NUM_ITTES 7 26#define IIO_NUM_ITTES 7
27#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1) 27#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1)
28 28
29struct sn_flush_device_list { 29/* This struct is shared between the PROM and the kernel.
30 * Changes to this struct will require corresponding changes to the kernel.
31 */
32struct sn_flush_device_common {
30 int sfdl_bus; 33 int sfdl_bus;
31 int sfdl_slot; 34 int sfdl_slot;
32 int sfdl_pin; 35 int sfdl_pin;
33 struct bar_list { 36 struct common_bar_list {
34 unsigned long start; 37 unsigned long start;
35 unsigned long end; 38 unsigned long end;
36 } sfdl_bar_list[6]; 39 } sfdl_bar_list[6];
@@ -40,14 +43,19 @@ struct sn_flush_device_list {
40 uint32_t sfdl_persistent_busnum; 43 uint32_t sfdl_persistent_busnum;
41 uint32_t sfdl_persistent_segment; 44 uint32_t sfdl_persistent_segment;
42 struct pcibus_info *sfdl_pcibus_info; 45 struct pcibus_info *sfdl_pcibus_info;
46};
47
48/* This struct is kernel only and is not used by the PROM */
49struct sn_flush_device_kernel {
43 spinlock_t sfdl_flush_lock; 50 spinlock_t sfdl_flush_lock;
51 struct sn_flush_device_common *common;
44}; 52};
45 53
46/* 54/*
47 * **widget_p - Used as an array[wid_num][device] of sn_flush_device_list. 55 * **widget_p - Used as an array[wid_num][device] of sn_flush_device_kernel.
48 */ 56 */
49struct sn_flush_nasid_entry { 57struct sn_flush_nasid_entry {
50 struct sn_flush_device_list **widget_p; /* Used as a array of wid_num */ 58 struct sn_flush_device_kernel **widget_p; // Used as an array of wid_num
51 uint64_t iio_itte[8]; 59 uint64_t iio_itte[8];
52}; 60};
53 61
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c
index fcbc748ae433..f1ec1370b3e3 100644
--- a/arch/ia64/sn/kernel/bte_error.c
+++ b/arch/ia64/sn/kernel/bte_error.c
@@ -33,7 +33,7 @@ void bte_error_handler(unsigned long);
33 * Wait until all BTE related CRBs are completed 33 * Wait until all BTE related CRBs are completed
34 * and then reset the interfaces. 34 * and then reset the interfaces.
35 */ 35 */
36void shub1_bte_error_handler(unsigned long _nodepda) 36int shub1_bte_error_handler(unsigned long _nodepda)
37{ 37{
38 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; 38 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda;
39 struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer; 39 struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer;
@@ -53,7 +53,7 @@ void shub1_bte_error_handler(unsigned long _nodepda)
53 (err_nodepda->bte_if[1].bh_error == BTE_SUCCESS)) { 53 (err_nodepda->bte_if[1].bh_error == BTE_SUCCESS)) {
54 BTE_PRINTK(("eh:%p:%d Nothing to do.\n", err_nodepda, 54 BTE_PRINTK(("eh:%p:%d Nothing to do.\n", err_nodepda,
55 smp_processor_id())); 55 smp_processor_id()));
56 return; 56 return 1;
57 } 57 }
58 58
59 /* Determine information about our hub */ 59 /* Determine information about our hub */
@@ -81,7 +81,7 @@ void shub1_bte_error_handler(unsigned long _nodepda)
81 mod_timer(recovery_timer, HZ * 5); 81 mod_timer(recovery_timer, HZ * 5);
82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
83 smp_processor_id())); 83 smp_processor_id()));
84 return; 84 return 1;
85 } 85 }
86 if (icmr.ii_icmr_fld_s.i_crb_vld != 0) { 86 if (icmr.ii_icmr_fld_s.i_crb_vld != 0) {
87 87
@@ -99,7 +99,7 @@ void shub1_bte_error_handler(unsigned long _nodepda)
99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n", 99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n",
100 err_nodepda, smp_processor_id(), 100 err_nodepda, smp_processor_id(),
101 i)); 101 i));
102 return; 102 return 1;
103 } 103 }
104 } 104 }
105 } 105 }
@@ -124,6 +124,42 @@ void shub1_bte_error_handler(unsigned long _nodepda)
124 REMOTE_HUB_S(nasid, IIO_IBCR, ibcr.ii_ibcr_regval); 124 REMOTE_HUB_S(nasid, IIO_IBCR, ibcr.ii_ibcr_regval);
125 125
126 del_timer(recovery_timer); 126 del_timer(recovery_timer);
127 return 0;
128}
129
130/*
131 * Wait until all BTE related CRBs are completed
132 * and then reset the interfaces.
133 */
134int shub2_bte_error_handler(unsigned long _nodepda)
135{
136 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda;
137 struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer;
138 struct bteinfo_s *bte;
139 nasid_t nasid;
140 u64 status;
141 int i;
142
143 nasid = cnodeid_to_nasid(err_nodepda->bte_if[0].bte_cnode);
144
145 /*
146 * Verify that all the BTEs are complete
147 */
148 for (i = 0; i < BTES_PER_NODE; i++) {
149 bte = &err_nodepda->bte_if[i];
150 status = BTE_LNSTAT_LOAD(bte);
151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY))
152 continue;
153 mod_timer(recovery_timer, HZ * 5);
154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
155 smp_processor_id()));
156 return 1;
157 }
158 if (ia64_sn_bte_recovery(nasid))
159 panic("bte_error_handler(): Fatal BTE Error");
160
161 del_timer(recovery_timer);
162 return 0;
127} 163}
128 164
129/* 165/*
@@ -135,7 +171,6 @@ void bte_error_handler(unsigned long _nodepda)
135 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; 171 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda;
136 spinlock_t *recovery_lock = &err_nodepda->bte_recovery_lock; 172 spinlock_t *recovery_lock = &err_nodepda->bte_recovery_lock;
137 int i; 173 int i;
138 nasid_t nasid;
139 unsigned long irq_flags; 174 unsigned long irq_flags;
140 volatile u64 *notify; 175 volatile u64 *notify;
141 bte_result_t bh_error; 176 bte_result_t bh_error;
@@ -160,12 +195,15 @@ void bte_error_handler(unsigned long _nodepda)
160 } 195 }
161 196
162 if (is_shub1()) { 197 if (is_shub1()) {
163 shub1_bte_error_handler(_nodepda); 198 if (shub1_bte_error_handler(_nodepda)) {
199 spin_unlock_irqrestore(recovery_lock, irq_flags);
200 return;
201 }
164 } else { 202 } else {
165 nasid = cnodeid_to_nasid(err_nodepda->bte_if[0].bte_cnode); 203 if (shub2_bte_error_handler(_nodepda)) {
166 204 spin_unlock_irqrestore(recovery_lock, irq_flags);
167 if (ia64_sn_bte_recovery(nasid)) 205 return;
168 panic("bte_error_handler(): Fatal BTE Error"); 206 }
169 } 207 }
170 208
171 for (i = 0; i < BTES_PER_NODE; i++) { 209 for (i = 0; i < BTES_PER_NODE; i++) {
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c
index 5c5eb01c50f0..56ab6bae00ee 100644
--- a/arch/ia64/sn/kernel/huberror.c
+++ b/arch/ia64/sn/kernel/huberror.c
@@ -32,13 +32,14 @@ static irqreturn_t hub_eint_handler(int irq, void *arg, struct pt_regs *ep)
32 ret_stuff.v0 = 0; 32 ret_stuff.v0 = 0;
33 hubdev_info = (struct hubdev_info *)arg; 33 hubdev_info = (struct hubdev_info *)arg;
34 nasid = hubdev_info->hdi_nasid; 34 nasid = hubdev_info->hdi_nasid;
35 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_HUB_ERROR_INTERRUPT, 35
36 if (is_shub1()) {
37 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_HUB_ERROR_INTERRUPT,
36 (u64) nasid, 0, 0, 0, 0, 0, 0); 38 (u64) nasid, 0, 0, 0, 0, 0, 0);
37 39
38 if ((int)ret_stuff.v0) 40 if ((int)ret_stuff.v0)
39 panic("hubii_eint_handler(): Fatal TIO Error"); 41 panic("hubii_eint_handler(): Fatal TIO Error");
40 42
41 if (is_shub1()) {
42 if (!(nasid & 1)) /* Not a TIO, handle CRB errors */ 43 if (!(nasid & 1)) /* Not a TIO, handle CRB errors */
43 (void)hubiio_crb_error_handler(hubdev_info); 44 (void)hubiio_crb_error_handler(hubdev_info);
44 } else 45 } else
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 318087e35b66..258d9d7aff98 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -76,11 +76,12 @@ static struct sn_pcibus_provider sn_pci_default_provider = {
76}; 76};
77 77
78/* 78/*
79 * Retrieve the DMA Flush List given nasid. This list is needed 79 * Retrieve the DMA Flush List given nasid, widget, and device.
80 * to implement the WAR - Flush DMA data on PIO Reads. 80 * This list is needed to implement the WAR - Flush DMA data on PIO Reads.
81 */ 81 */
82static inline uint64_t 82static inline u64
83sal_get_widget_dmaflush_list(u64 nasid, u64 widget_num, u64 address) 83sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
84 u64 address)
84{ 85{
85 86
86 struct ia64_sal_retval ret_stuff; 87 struct ia64_sal_retval ret_stuff;
@@ -88,17 +89,17 @@ sal_get_widget_dmaflush_list(u64 nasid, u64 widget_num, u64 address)
88 ret_stuff.v0 = 0; 89 ret_stuff.v0 = 0;
89 90
90 SAL_CALL_NOLOCK(ret_stuff, 91 SAL_CALL_NOLOCK(ret_stuff,
91 (u64) SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST, 92 (u64) SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST,
92 (u64) nasid, (u64) widget_num, (u64) address, 0, 0, 0, 93 (u64) nasid, (u64) widget_num,
93 0); 94 (u64) device_num, (u64) address, 0, 0, 0);
94 return ret_stuff.v0; 95 return ret_stuff.status;
95 96
96} 97}
97 98
98/* 99/*
99 * Retrieve the hub device info structure for the given nasid. 100 * Retrieve the hub device info structure for the given nasid.
100 */ 101 */
101static inline uint64_t sal_get_hubdev_info(u64 handle, u64 address) 102static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
102{ 103{
103 104
104 struct ia64_sal_retval ret_stuff; 105 struct ia64_sal_retval ret_stuff;
@@ -114,7 +115,7 @@ static inline uint64_t sal_get_hubdev_info(u64 handle, u64 address)
114/* 115/*
115 * Retrieve the pci bus information given the bus number. 116 * Retrieve the pci bus information given the bus number.
116 */ 117 */
117static inline uint64_t sal_get_pcibus_info(u64 segment, u64 busnum, u64 address) 118static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
118{ 119{
119 120
120 struct ia64_sal_retval ret_stuff; 121 struct ia64_sal_retval ret_stuff;
@@ -130,7 +131,7 @@ static inline uint64_t sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
130/* 131/*
131 * Retrieve the pci device information given the bus and device|function number. 132 * Retrieve the pci device information given the bus and device|function number.
132 */ 133 */
133static inline uint64_t 134static inline u64
134sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev, 135sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
135 u64 sn_irq_info) 136 u64 sn_irq_info)
136{ 137{
@@ -170,12 +171,12 @@ sn_pcidev_info_get(struct pci_dev *dev)
170 */ 171 */
171static void sn_fixup_ionodes(void) 172static void sn_fixup_ionodes(void)
172{ 173{
173 174 struct sn_flush_device_kernel *sn_flush_device_kernel;
174 struct sn_flush_device_list *sn_flush_device_list; 175 struct sn_flush_device_kernel *dev_entry;
175 struct hubdev_info *hubdev; 176 struct hubdev_info *hubdev;
176 uint64_t status; 177 u64 status;
177 uint64_t nasid; 178 u64 nasid;
178 int i, widget; 179 int i, widget, device;
179 180
180 /* 181 /*
181 * Get SGI Specific HUB chipset information. 182 * Get SGI Specific HUB chipset information.
@@ -186,7 +187,7 @@ static void sn_fixup_ionodes(void)
186 nasid = cnodeid_to_nasid(i); 187 nasid = cnodeid_to_nasid(i);
187 hubdev->max_segment_number = 0xffffffff; 188 hubdev->max_segment_number = 0xffffffff;
188 hubdev->max_pcibus_number = 0xff; 189 hubdev->max_pcibus_number = 0xff;
189 status = sal_get_hubdev_info(nasid, (uint64_t) __pa(hubdev)); 190 status = sal_get_hubdev_info(nasid, (u64) __pa(hubdev));
190 if (status) 191 if (status)
191 continue; 192 continue;
192 193
@@ -213,38 +214,49 @@ static void sn_fixup_ionodes(void)
213 214
214 hubdev->hdi_flush_nasid_list.widget_p = 215 hubdev->hdi_flush_nasid_list.widget_p =
215 kmalloc((HUB_WIDGET_ID_MAX + 1) * 216 kmalloc((HUB_WIDGET_ID_MAX + 1) *
216 sizeof(struct sn_flush_device_list *), GFP_KERNEL); 217 sizeof(struct sn_flush_device_kernel *),
217 218 GFP_KERNEL);
218 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0, 219 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
219 (HUB_WIDGET_ID_MAX + 1) * 220 (HUB_WIDGET_ID_MAX + 1) *
220 sizeof(struct sn_flush_device_list *)); 221 sizeof(struct sn_flush_device_kernel *));
221 222
222 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) { 223 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
223 sn_flush_device_list = kmalloc(DEV_PER_WIDGET * 224 sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET *
224 sizeof(struct 225 sizeof(struct
225 sn_flush_device_list), 226 sn_flush_device_kernel),
226 GFP_KERNEL); 227 GFP_KERNEL);
227 memset(sn_flush_device_list, 0x0, 228 if (!sn_flush_device_kernel)
229 BUG();
230 memset(sn_flush_device_kernel, 0x0,
228 DEV_PER_WIDGET * 231 DEV_PER_WIDGET *
229 sizeof(struct sn_flush_device_list)); 232 sizeof(struct sn_flush_device_kernel));
230 233
231 status = 234 dev_entry = sn_flush_device_kernel;
232 sal_get_widget_dmaflush_list(nasid, widget, 235 for (device = 0; device < DEV_PER_WIDGET;
233 (uint64_t) 236 device++,dev_entry++) {
234 __pa 237 dev_entry->common = kmalloc(sizeof(struct
235 (sn_flush_device_list)); 238 sn_flush_device_common),
236 if (status) { 239 GFP_KERNEL);
237 kfree(sn_flush_device_list); 240 if (!dev_entry->common)
238 continue; 241 BUG();
242 memset(dev_entry->common, 0x0, sizeof(struct
243 sn_flush_device_common));
244
245 status = sal_get_device_dmaflush_list(nasid,
246 widget,
247 device,
248 (u64)(dev_entry->common));
249 if (status)
250 BUG();
251
252 spin_lock_init(&dev_entry->sfdl_flush_lock);
239 } 253 }
240 254
241 spin_lock_init(&sn_flush_device_list->sfdl_flush_lock); 255 if (sn_flush_device_kernel)
242 hubdev->hdi_flush_nasid_list.widget_p[widget] = 256 hubdev->hdi_flush_nasid_list.widget_p[widget] =
243 sn_flush_device_list; 257 sn_flush_device_kernel;
244 } 258 }
245
246 } 259 }
247
248} 260}
249 261
250/* 262/*
diff --git a/arch/ia64/sn/kernel/xpc.h b/arch/ia64/sn/kernel/xpc.h
deleted file mode 100644
index 5483a9f227d4..000000000000
--- a/arch/ia64/sn/kernel/xpc.h
+++ /dev/null
@@ -1,1273 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9
10/*
11 * Cross Partition Communication (XPC) structures and macros.
12 */
13
14#ifndef _IA64_SN_KERNEL_XPC_H
15#define _IA64_SN_KERNEL_XPC_H
16
17
18#include <linux/config.h>
19#include <linux/interrupt.h>
20#include <linux/sysctl.h>
21#include <linux/device.h>
22#include <asm/pgtable.h>
23#include <asm/processor.h>
24#include <asm/sn/bte.h>
25#include <asm/sn/clksupport.h>
26#include <asm/sn/addrs.h>
27#include <asm/sn/mspec.h>
28#include <asm/sn/shub_mmr.h>
29#include <asm/sn/xp.h>
30
31
32/*
33 * XPC Version numbers consist of a major and minor number. XPC can always
34 * talk to versions with same major #, and never talk to versions with a
35 * different major #.
36 */
37#define _XPC_VERSION(_maj, _min) (((_maj) << 4) | ((_min) & 0xf))
38#define XPC_VERSION_MAJOR(_v) ((_v) >> 4)
39#define XPC_VERSION_MINOR(_v) ((_v) & 0xf)
40
41
42/*
43 * The next macros define word or bit representations for given
44 * C-brick nasid in either the SAL provided bit array representing
45 * nasids in the partition/machine or the AMO_t array used for
46 * inter-partition initiation communications.
47 *
48 * For SN2 machines, C-Bricks are alway even numbered NASIDs. As
49 * such, some space will be saved by insisting that nasid information
50 * passed from SAL always be packed for C-Bricks and the
51 * cross-partition interrupts use the same packing scheme.
52 */
53#define XPC_NASID_W_INDEX(_n) (((_n) / 64) / 2)
54#define XPC_NASID_B_INDEX(_n) (((_n) / 2) & (64 - 1))
55#define XPC_NASID_IN_ARRAY(_n, _p) ((_p)[XPC_NASID_W_INDEX(_n)] & \
56 (1UL << XPC_NASID_B_INDEX(_n)))
57#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2)
58
59#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */
60#define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */
61
62/* define the process name of HB checker and the CPU it is pinned to */
63#define XPC_HB_CHECK_THREAD_NAME "xpc_hb"
64#define XPC_HB_CHECK_CPU 0
65
66/* define the process name of the discovery thread */
67#define XPC_DISCOVERY_THREAD_NAME "xpc_discovery"
68
69
70/*
71 * the reserved page
72 *
73 * SAL reserves one page of memory per partition for XPC. Though a full page
74 * in length (16384 bytes), its starting address is not page aligned, but it
75 * is cacheline aligned. The reserved page consists of the following:
76 *
77 * reserved page header
78 *
79 * The first cacheline of the reserved page contains the header
80 * (struct xpc_rsvd_page). Before SAL initialization has completed,
81 * SAL has set up the following fields of the reserved page header:
82 * SAL_signature, SAL_version, partid, and nasids_size. The other
83 * fields are set up by XPC. (xpc_rsvd_page points to the local
84 * partition's reserved page.)
85 *
86 * part_nasids mask
87 * mach_nasids mask
88 *
89 * SAL also sets up two bitmaps (or masks), one that reflects the actual
90 * nasids in this partition (part_nasids), and the other that reflects
91 * the actual nasids in the entire machine (mach_nasids). We're only
92 * interested in the even numbered nasids (which contain the processors
93 * and/or memory), so we only need half as many bits to represent the
94 * nasids. The part_nasids mask is located starting at the first cacheline
95 * following the reserved page header. The mach_nasids mask follows right
96 * after the part_nasids mask. The size in bytes of each mask is reflected
97 * by the reserved page header field 'nasids_size'. (Local partition's
98 * mask pointers are xpc_part_nasids and xpc_mach_nasids.)
99 *
100 * vars
101 * vars part
102 *
103 * Immediately following the mach_nasids mask are the XPC variables
104 * required by other partitions. First are those that are generic to all
105 * partitions (vars), followed on the next available cacheline by those
106 * which are partition specific (vars part). These are setup by XPC.
107 * (Local partition's vars pointers are xpc_vars and xpc_vars_part.)
108 *
109 * Note: Until vars_pa is set, the partition XPC code has not been initialized.
110 */
111struct xpc_rsvd_page {
112 u64 SAL_signature; /* SAL: unique signature */
113 u64 SAL_version; /* SAL: version */
114 u8 partid; /* SAL: partition ID */
115 u8 version;
116 u8 pad1[6]; /* align to next u64 in cacheline */
117 volatile u64 vars_pa;
118 struct timespec stamp; /* time when reserved page was setup by XPC */
119 u64 pad2[9]; /* align to last u64 in cacheline */
120 u64 nasids_size; /* SAL: size of each nasid mask in bytes */
121};
122
123#define XPC_RP_VERSION _XPC_VERSION(1,1) /* version 1.1 of the reserved page */
124
125#define XPC_SUPPORTS_RP_STAMP(_version) \
126 (_version >= _XPC_VERSION(1,1))
127
128/*
129 * compare stamps - the return value is:
130 *
131 * < 0, if stamp1 < stamp2
132 * = 0, if stamp1 == stamp2
133 * > 0, if stamp1 > stamp2
134 */
135static inline int
136xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
137{
138 int ret;
139
140
141 if ((ret = stamp1->tv_sec - stamp2->tv_sec) == 0) {
142 ret = stamp1->tv_nsec - stamp2->tv_nsec;
143 }
144 return ret;
145}
146
147
148/*
149 * Define the structures by which XPC variables can be exported to other
150 * partitions. (There are two: struct xpc_vars and struct xpc_vars_part)
151 */
152
153/*
154 * The following structure describes the partition generic variables
155 * needed by other partitions in order to properly initialize.
156 *
157 * struct xpc_vars version number also applies to struct xpc_vars_part.
158 * Changes to either structure and/or related functionality should be
159 * reflected by incrementing either the major or minor version numbers
160 * of struct xpc_vars.
161 */
162struct xpc_vars {
163 u8 version;
164 u64 heartbeat;
165 u64 heartbeating_to_mask;
166 u64 heartbeat_offline; /* if 0, heartbeat should be changing */
167 int act_nasid;
168 int act_phys_cpuid;
169 u64 vars_part_pa;
170 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */
171 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */
172};
173
174#define XPC_V_VERSION _XPC_VERSION(3,1) /* version 3.1 of the cross vars */
175
176#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
177 (_version >= _XPC_VERSION(3,1))
178
179
180static inline int
181xpc_hb_allowed(partid_t partid, struct xpc_vars *vars)
182{
183 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
184}
185
186static inline void
187xpc_allow_hb(partid_t partid, struct xpc_vars *vars)
188{
189 u64 old_mask, new_mask;
190
191 do {
192 old_mask = vars->heartbeating_to_mask;
193 new_mask = (old_mask | (1UL << partid));
194 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
195 old_mask);
196}
197
198static inline void
199xpc_disallow_hb(partid_t partid, struct xpc_vars *vars)
200{
201 u64 old_mask, new_mask;
202
203 do {
204 old_mask = vars->heartbeating_to_mask;
205 new_mask = (old_mask & ~(1UL << partid));
206 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
207 old_mask);
208}
209
210
211/*
212 * The AMOs page consists of a number of AMO variables which are divided into
213 * four groups, The first two groups are used to identify an IRQ's sender.
214 * These two groups consist of 64 and 128 AMO variables respectively. The last
215 * two groups, consisting of just one AMO variable each, are used to identify
216 * the remote partitions that are currently engaged (from the viewpoint of
217 * the XPC running on the remote partition).
218 */
219#define XPC_NOTIFY_IRQ_AMOS 0
220#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_PARTITIONS)
221#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
222#define XPC_DISENGAGE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1)
223
224
225/*
226 * The following structure describes the per partition specific variables.
227 *
228 * An array of these structures, one per partition, will be defined. As a
229 * partition becomes active XPC will copy the array entry corresponding to
230 * itself from that partition. It is desirable that the size of this
231 * structure evenly divide into a cacheline, such that none of the entries
232 * in this array crosses a cacheline boundary. As it is now, each entry
233 * occupies half a cacheline.
234 */
235struct xpc_vars_part {
236 volatile u64 magic;
237
238 u64 openclose_args_pa; /* physical address of open and close args */
239 u64 GPs_pa; /* physical address of Get/Put values */
240
241 u64 IPI_amo_pa; /* physical address of IPI AMO_t structure */
242 int IPI_nasid; /* nasid of where to send IPIs */
243 int IPI_phys_cpuid; /* physical CPU ID of where to send IPIs */
244
245 u8 nchannels; /* #of defined channels supported */
246
247 u8 reserved[23]; /* pad to a full 64 bytes */
248};
249
250/*
251 * The vars_part MAGIC numbers play a part in the first contact protocol.
252 *
253 * MAGIC1 indicates that the per partition specific variables for a remote
254 * partition have been initialized by this partition.
255 *
256 * MAGIC2 indicates that this partition has pulled the remote partititions
257 * per partition variables that pertain to this partition.
258 */
259#define XPC_VP_MAGIC1 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */
260#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
261
262
263/* the reserved page sizes and offsets */
264
265#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
266#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars))
267
268#define XPC_RP_PART_NASIDS(_rp) (u64 *) ((u8 *) _rp + XPC_RP_HEADER_SIZE)
269#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words)
270#define XPC_RP_VARS(_rp) ((struct xpc_vars *) XPC_RP_MACH_NASIDS(_rp) + xp_nasid_mask_words)
271#define XPC_RP_VARS_PART(_rp) (struct xpc_vars_part *) ((u8 *) XPC_RP_VARS(rp) + XPC_RP_VARS_SIZE)
272
273
274/*
275 * Functions registered by add_timer() or called by kernel_thread() only
276 * allow for a single 64-bit argument. The following macros can be used to
277 * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from
278 * the passed argument.
279 */
280#define XPC_PACK_ARGS(_arg1, _arg2) \
281 ((((u64) _arg1) & 0xffffffff) | \
282 ((((u64) _arg2) & 0xffffffff) << 32))
283
284#define XPC_UNPACK_ARG1(_args) (((u64) _args) & 0xffffffff)
285#define XPC_UNPACK_ARG2(_args) ((((u64) _args) >> 32) & 0xffffffff)
286
287
288
289/*
290 * Define a Get/Put value pair (pointers) used with a message queue.
291 */
292struct xpc_gp {
293 volatile s64 get; /* Get value */
294 volatile s64 put; /* Put value */
295};
296
297#define XPC_GP_SIZE \
298 L1_CACHE_ALIGN(sizeof(struct xpc_gp) * XPC_NCHANNELS)
299
300
301
302/*
303 * Define a structure that contains arguments associated with opening and
304 * closing a channel.
305 */
306struct xpc_openclose_args {
307 u16 reason; /* reason why channel is closing */
308 u16 msg_size; /* sizeof each message entry */
309 u16 remote_nentries; /* #of message entries in remote msg queue */
310 u16 local_nentries; /* #of message entries in local msg queue */
311 u64 local_msgqueue_pa; /* physical address of local message queue */
312};
313
314#define XPC_OPENCLOSE_ARGS_SIZE \
315 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * XPC_NCHANNELS)
316
317
318
319/* struct xpc_msg flags */
320
321#define XPC_M_DONE 0x01 /* msg has been received/consumed */
322#define XPC_M_READY 0x02 /* msg is ready to be sent */
323#define XPC_M_INTERRUPT 0x04 /* send interrupt when msg consumed */
324
325
326#define XPC_MSG_ADDRESS(_payload) \
327 ((struct xpc_msg *)((u8 *)(_payload) - XPC_MSG_PAYLOAD_OFFSET))
328
329
330
331/*
332 * Defines notify entry.
333 *
334 * This is used to notify a message's sender that their message was received
335 * and consumed by the intended recipient.
336 */
337struct xpc_notify {
338 struct semaphore sema; /* notify semaphore */
339 volatile u8 type; /* type of notification */
340
341 /* the following two fields are only used if type == XPC_N_CALL */
342 xpc_notify_func func; /* user's notify function */
343 void *key; /* pointer to user's key */
344};
345
346/* struct xpc_notify type of notification */
347
348#define XPC_N_CALL 0x01 /* notify function provided by user */
349
350
351
352/*
353 * Define the structure that manages all the stuff required by a channel. In
354 * particular, they are used to manage the messages sent across the channel.
355 *
356 * This structure is private to a partition, and is NOT shared across the
357 * partition boundary.
358 *
359 * There is an array of these structures for each remote partition. It is
360 * allocated at the time a partition becomes active. The array contains one
361 * of these structures for each potential channel connection to that partition.
362 *
363 * Each of these structures manages two message queues (circular buffers).
364 * They are allocated at the time a channel connection is made. One of
365 * these message queues (local_msgqueue) holds the locally created messages
366 * that are destined for the remote partition. The other of these message
367 * queues (remote_msgqueue) is a locally cached copy of the remote partition's
368 * own local_msgqueue.
369 *
370 * The following is a description of the Get/Put pointers used to manage these
371 * two message queues. Consider the local_msgqueue to be on one partition
372 * and the remote_msgqueue to be its cached copy on another partition. A
373 * description of what each of the lettered areas contains is included.
374 *
375 *
376 * local_msgqueue remote_msgqueue
377 *
378 * |/////////| |/////////|
379 * w_remote_GP.get --> +---------+ |/////////|
380 * | F | |/////////|
381 * remote_GP.get --> +---------+ +---------+ <-- local_GP->get
382 * | | | |
383 * | | | E |
384 * | | | |
385 * | | +---------+ <-- w_local_GP.get
386 * | B | |/////////|
387 * | | |////D////|
388 * | | |/////////|
389 * | | +---------+ <-- w_remote_GP.put
390 * | | |////C////|
391 * local_GP->put --> +---------+ +---------+ <-- remote_GP.put
392 * | | |/////////|
393 * | A | |/////////|
394 * | | |/////////|
395 * w_local_GP.put --> +---------+ |/////////|
396 * |/////////| |/////////|
397 *
398 *
399 * ( remote_GP.[get|put] are cached copies of the remote
400 * partition's local_GP->[get|put], and thus their values can
401 * lag behind their counterparts on the remote partition. )
402 *
403 *
404 * A - Messages that have been allocated, but have not yet been sent to the
405 * remote partition.
406 *
407 * B - Messages that have been sent, but have not yet been acknowledged by the
408 * remote partition as having been received.
409 *
410 * C - Area that needs to be prepared for the copying of sent messages, by
411 * the clearing of the message flags of any previously received messages.
412 *
413 * D - Area into which sent messages are to be copied from the remote
414 * partition's local_msgqueue and then delivered to their intended
415 * recipients. [ To allow for a multi-message copy, another pointer
416 * (next_msg_to_pull) has been added to keep track of the next message
417 * number needing to be copied (pulled). It chases after w_remote_GP.put.
418 * Any messages lying between w_local_GP.get and next_msg_to_pull have
419 * been copied and are ready to be delivered. ]
420 *
421 * E - Messages that have been copied and delivered, but have not yet been
422 * acknowledged by the recipient as having been received.
423 *
424 * F - Messages that have been acknowledged, but XPC has not yet notified the
425 * sender that the message was received by its intended recipient.
426 * This is also an area that needs to be prepared for the allocating of
427 * new messages, by the clearing of the message flags of the acknowledged
428 * messages.
429 */
430struct xpc_channel {
431 partid_t partid; /* ID of remote partition connected */
432 spinlock_t lock; /* lock for updating this structure */
433 u32 flags; /* general flags */
434
435 enum xpc_retval reason; /* reason why channel is disconnect'g */
436 int reason_line; /* line# disconnect initiated from */
437
438 u16 number; /* channel # */
439
440 u16 msg_size; /* sizeof each msg entry */
441 u16 local_nentries; /* #of msg entries in local msg queue */
442 u16 remote_nentries; /* #of msg entries in remote msg queue*/
443
444 void *local_msgqueue_base; /* base address of kmalloc'd space */
445 struct xpc_msg *local_msgqueue; /* local message queue */
446 void *remote_msgqueue_base; /* base address of kmalloc'd space */
447 struct xpc_msg *remote_msgqueue;/* cached copy of remote partition's */
448 /* local message queue */
449 u64 remote_msgqueue_pa; /* phys addr of remote partition's */
450 /* local message queue */
451
452 atomic_t references; /* #of external references to queues */
453
454 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
455 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */
456
457 u8 delayed_IPI_flags; /* IPI flags received, but delayed */
458 /* action until channel disconnected */
459
460 /* queue of msg senders who want to be notified when msg received */
461
462 atomic_t n_to_notify; /* #of msg senders to notify */
463 struct xpc_notify *notify_queue;/* notify queue for messages sent */
464
465 xpc_channel_func func; /* user's channel function */
466 void *key; /* pointer to user's key */
467
468 struct semaphore msg_to_pull_sema; /* next msg to pull serialization */
469 struct semaphore wdisconnect_sema; /* wait for channel disconnect */
470
471 struct xpc_openclose_args *local_openclose_args; /* args passed on */
472 /* opening or closing of channel */
473
474 /* various flavors of local and remote Get/Put values */
475
476 struct xpc_gp *local_GP; /* local Get/Put values */
477 struct xpc_gp remote_GP; /* remote Get/Put values */
478 struct xpc_gp w_local_GP; /* working local Get/Put values */
479 struct xpc_gp w_remote_GP; /* working remote Get/Put values */
480 s64 next_msg_to_pull; /* Put value of next msg to pull */
481
482 /* kthread management related fields */
483
484// >>> rethink having kthreads_assigned_limit and kthreads_idle_limit; perhaps
485// >>> allow the assigned limit be unbounded and let the idle limit be dynamic
486// >>> dependent on activity over the last interval of time
487 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
488 u32 kthreads_assigned_limit; /* limit on #of kthreads assigned */
489 atomic_t kthreads_idle; /* #of kthreads idle waiting for work */
490 u32 kthreads_idle_limit; /* limit on #of kthreads idle */
491 atomic_t kthreads_active; /* #of kthreads actively working */
492 // >>> following field is temporary
493 u32 kthreads_created; /* total #of kthreads created */
494
495 wait_queue_head_t idle_wq; /* idle kthread wait queue */
496
497} ____cacheline_aligned;
498
499
500/* struct xpc_channel flags */
501
502#define XPC_C_WASCONNECTED 0x00000001 /* channel was connected */
503
504#define XPC_C_ROPENREPLY 0x00000002 /* remote open channel reply */
505#define XPC_C_OPENREPLY 0x00000004 /* local open channel reply */
506#define XPC_C_ROPENREQUEST 0x00000008 /* remote open channel request */
507#define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */
508
509#define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */
510#define XPC_C_CONNECTCALLOUT 0x00000040 /* channel connected callout made */
511#define XPC_C_CONNECTED 0x00000080 /* local channel is connected */
512#define XPC_C_CONNECTING 0x00000100 /* channel is being connected */
513
514#define XPC_C_RCLOSEREPLY 0x00000200 /* remote close channel reply */
515#define XPC_C_CLOSEREPLY 0x00000400 /* local close channel reply */
516#define XPC_C_RCLOSEREQUEST 0x00000800 /* remote close channel request */
517#define XPC_C_CLOSEREQUEST 0x00001000 /* local close channel request */
518
519#define XPC_C_DISCONNECTED 0x00002000 /* channel is disconnected */
520#define XPC_C_DISCONNECTING 0x00004000 /* channel is being disconnected */
521#define XPC_C_DISCONNECTCALLOUT 0x00008000 /* chan disconnected callout made */
522#define XPC_C_WDISCONNECT 0x00010000 /* waiting for channel disconnect */
523
524
525
526/*
527 * Manages channels on a partition basis. There is one of these structures
528 * for each partition (a partition will never utilize the structure that
529 * represents itself).
530 */
531struct xpc_partition {
532
533 /* XPC HB infrastructure */
534
535 u8 remote_rp_version; /* version# of partition's rsvd pg */
536 struct timespec remote_rp_stamp;/* time when rsvd pg was initialized */
537 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */
538 u64 remote_vars_pa; /* phys addr of partition's vars */
539 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
540 u64 last_heartbeat; /* HB at last read */
541 u64 remote_amos_page_pa; /* phys addr of partition's amos page */
542 int remote_act_nasid; /* active part's act/deact nasid */
543 int remote_act_phys_cpuid; /* active part's act/deact phys cpuid */
544 u32 act_IRQ_rcvd; /* IRQs since activation */
545 spinlock_t act_lock; /* protect updating of act_state */
546 u8 act_state; /* from XPC HB viewpoint */
547 u8 remote_vars_version; /* version# of partition's vars */
548 enum xpc_retval reason; /* reason partition is deactivating */
549 int reason_line; /* line# deactivation initiated from */
550 int reactivate_nasid; /* nasid in partition to reactivate */
551
552 unsigned long disengage_request_timeout; /* timeout in jiffies */
553 struct timer_list disengage_request_timer;
554
555
556 /* XPC infrastructure referencing and teardown control */
557
558 volatile u8 setup_state; /* infrastructure setup state */
559 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
560 atomic_t references; /* #of references to infrastructure */
561
562
563 /*
564 * NONE OF THE PRECEDING FIELDS OF THIS STRUCTURE WILL BE CLEARED WHEN
565 * XPC SETS UP THE NECESSARY INFRASTRUCTURE TO SUPPORT CROSS PARTITION
566 * COMMUNICATION. ALL OF THE FOLLOWING FIELDS WILL BE CLEARED. (THE
567 * 'nchannels' FIELD MUST BE THE FIRST OF THE FIELDS TO BE CLEARED.)
568 */
569
570
571 u8 nchannels; /* #of defined channels supported */
572 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */
573 atomic_t nchannels_engaged;/* #of channels engaged with remote part */
574 struct xpc_channel *channels;/* array of channel structures */
575
576 void *local_GPs_base; /* base address of kmalloc'd space */
577 struct xpc_gp *local_GPs; /* local Get/Put values */
578 void *remote_GPs_base; /* base address of kmalloc'd space */
579 struct xpc_gp *remote_GPs;/* copy of remote partition's local Get/Put */
580 /* values */
581 u64 remote_GPs_pa; /* phys address of remote partition's local */
582 /* Get/Put values */
583
584
585 /* fields used to pass args when opening or closing a channel */
586
587 void *local_openclose_args_base; /* base address of kmalloc'd space */
588 struct xpc_openclose_args *local_openclose_args; /* local's args */
589 void *remote_openclose_args_base; /* base address of kmalloc'd space */
590 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
591 /* args */
592 u64 remote_openclose_args_pa; /* phys addr of remote's args */
593
594
595 /* IPI sending, receiving and handling related fields */
596
597 int remote_IPI_nasid; /* nasid of where to send IPIs */
598 int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
599 AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
600
601 AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
602 u64 local_IPI_amo; /* IPI amo flags yet to be handled */
603 char IPI_owner[8]; /* IPI owner's name */
604 struct timer_list dropped_IPI_timer; /* dropped IPI timer */
605
606 spinlock_t IPI_lock; /* IPI handler lock */
607
608
609 /* channel manager related fields */
610
611 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */
612 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */
613
614} ____cacheline_aligned;
615
616
617/* struct xpc_partition act_state values (for XPC HB) */
618
619#define XPC_P_INACTIVE 0x00 /* partition is not active */
620#define XPC_P_ACTIVATION_REQ 0x01 /* created thread to activate */
621#define XPC_P_ACTIVATING 0x02 /* activation thread started */
622#define XPC_P_ACTIVE 0x03 /* xpc_partition_up() was called */
623#define XPC_P_DEACTIVATING 0x04 /* partition deactivation initiated */
624
625
626#define XPC_DEACTIVATE_PARTITION(_p, _reason) \
627 xpc_deactivate_partition(__LINE__, (_p), (_reason))
628
629
630/* struct xpc_partition setup_state values */
631
632#define XPC_P_UNSET 0x00 /* infrastructure was never setup */
633#define XPC_P_SETUP 0x01 /* infrastructure is setup */
634#define XPC_P_WTEARDOWN 0x02 /* waiting to teardown infrastructure */
635#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */
636
637
638
639/*
640 * struct xpc_partition IPI_timer #of seconds to wait before checking for
641 * dropped IPIs. These occur whenever an IPI amo write doesn't complete until
642 * after the IPI was received.
643 */
644#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ)
645
646
647/* number of seconds to wait for other partitions to disengage */
648#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT 90
649
650/* interval in seconds to print 'waiting disengagement' messages */
651#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10
652
653
654#define XPC_PARTID(_p) ((partid_t) ((_p) - &xpc_partitions[0]))
655
656
657
658/* found in xp_main.c */
659extern struct xpc_registration xpc_registrations[];
660
661
662/* found in xpc_main.c */
663extern struct device *xpc_part;
664extern struct device *xpc_chan;
665extern int xpc_disengage_request_timelimit;
666extern irqreturn_t xpc_notify_IRQ_handler(int, void *, struct pt_regs *);
667extern void xpc_dropped_IPI_check(struct xpc_partition *);
668extern void xpc_activate_partition(struct xpc_partition *);
669extern void xpc_activate_kthreads(struct xpc_channel *, int);
670extern void xpc_create_kthreads(struct xpc_channel *, int);
671extern void xpc_disconnect_wait(int);
672
673
674/* found in xpc_partition.c */
675extern int xpc_exiting;
676extern struct xpc_vars *xpc_vars;
677extern struct xpc_rsvd_page *xpc_rsvd_page;
678extern struct xpc_vars_part *xpc_vars_part;
679extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
680extern char xpc_remote_copy_buffer[];
681extern struct xpc_rsvd_page *xpc_rsvd_page_init(void);
682extern void xpc_allow_IPI_ops(void);
683extern void xpc_restrict_IPI_ops(void);
684extern int xpc_identify_act_IRQ_sender(void);
685extern int xpc_partition_disengaged(struct xpc_partition *);
686extern enum xpc_retval xpc_mark_partition_active(struct xpc_partition *);
687extern void xpc_mark_partition_inactive(struct xpc_partition *);
688extern void xpc_discovery(void);
689extern void xpc_check_remote_hb(void);
690extern void xpc_deactivate_partition(const int, struct xpc_partition *,
691 enum xpc_retval);
692extern enum xpc_retval xpc_initiate_partid_to_nasids(partid_t, void *);
693
694
695/* found in xpc_channel.c */
696extern void xpc_initiate_connect(int);
697extern void xpc_initiate_disconnect(int);
698extern enum xpc_retval xpc_initiate_allocate(partid_t, int, u32, void **);
699extern enum xpc_retval xpc_initiate_send(partid_t, int, void *);
700extern enum xpc_retval xpc_initiate_send_notify(partid_t, int, void *,
701 xpc_notify_func, void *);
702extern void xpc_initiate_received(partid_t, int, void *);
703extern enum xpc_retval xpc_setup_infrastructure(struct xpc_partition *);
704extern enum xpc_retval xpc_pull_remote_vars_part(struct xpc_partition *);
705extern void xpc_process_channel_activity(struct xpc_partition *);
706extern void xpc_connected_callout(struct xpc_channel *);
707extern void xpc_deliver_msg(struct xpc_channel *);
708extern void xpc_disconnect_channel(const int, struct xpc_channel *,
709 enum xpc_retval, unsigned long *);
710extern void xpc_disconnecting_callout(struct xpc_channel *);
711extern void xpc_partition_going_down(struct xpc_partition *, enum xpc_retval);
712extern void xpc_teardown_infrastructure(struct xpc_partition *);
713
714
715
716static inline void
717xpc_wakeup_channel_mgr(struct xpc_partition *part)
718{
719 if (atomic_inc_return(&part->channel_mgr_requests) == 1) {
720 wake_up(&part->channel_mgr_wq);
721 }
722}
723
724
725
726/*
727 * These next two inlines are used to keep us from tearing down a channel's
728 * msg queues while a thread may be referencing them.
729 */
730static inline void
731xpc_msgqueue_ref(struct xpc_channel *ch)
732{
733 atomic_inc(&ch->references);
734}
735
736static inline void
737xpc_msgqueue_deref(struct xpc_channel *ch)
738{
739 s32 refs = atomic_dec_return(&ch->references);
740
741 DBUG_ON(refs < 0);
742 if (refs == 0) {
743 xpc_wakeup_channel_mgr(&xpc_partitions[ch->partid]);
744 }
745}
746
747
748
749#define XPC_DISCONNECT_CHANNEL(_ch, _reason, _irqflgs) \
750 xpc_disconnect_channel(__LINE__, _ch, _reason, _irqflgs)
751
752
753/*
754 * These two inlines are used to keep us from tearing down a partition's
755 * setup infrastructure while a thread may be referencing it.
756 */
757static inline void
758xpc_part_deref(struct xpc_partition *part)
759{
760 s32 refs = atomic_dec_return(&part->references);
761
762
763 DBUG_ON(refs < 0);
764 if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN) {
765 wake_up(&part->teardown_wq);
766 }
767}
768
769static inline int
770xpc_part_ref(struct xpc_partition *part)
771{
772 int setup;
773
774
775 atomic_inc(&part->references);
776 setup = (part->setup_state == XPC_P_SETUP);
777 if (!setup) {
778 xpc_part_deref(part);
779 }
780 return setup;
781}
782
783
784
785/*
786 * The following macro is to be used for the setting of the reason and
787 * reason_line fields in both the struct xpc_channel and struct xpc_partition
788 * structures.
789 */
790#define XPC_SET_REASON(_p, _reason, _line) \
791 { \
792 (_p)->reason = _reason; \
793 (_p)->reason_line = _line; \
794 }
795
796
797
798/*
799 * This next set of inlines are used to keep track of when a partition is
800 * potentially engaged in accessing memory belonging to another partition.
801 */
802
803static inline void
804xpc_mark_partition_engaged(struct xpc_partition *part)
805{
806 unsigned long irq_flags;
807 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
808 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
809
810
811 local_irq_save(irq_flags);
812
813 /* set bit corresponding to our partid in remote partition's AMO */
814 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
815 (1UL << sn_partition_id));
816 /*
817 * We must always use the nofault function regardless of whether we
818 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
819 * didn't, we'd never know that the other partition is down and would
820 * keep sending IPIs and AMOs to it until the heartbeat times out.
821 */
822 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
823 variable), xp_nofault_PIOR_target));
824
825 local_irq_restore(irq_flags);
826}
827
828static inline void
829xpc_mark_partition_disengaged(struct xpc_partition *part)
830{
831 unsigned long irq_flags;
832 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
833 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
834
835
836 local_irq_save(irq_flags);
837
838 /* clear bit corresponding to our partid in remote partition's AMO */
839 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
840 ~(1UL << sn_partition_id));
841 /*
842 * We must always use the nofault function regardless of whether we
843 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
844 * didn't, we'd never know that the other partition is down and would
845 * keep sending IPIs and AMOs to it until the heartbeat times out.
846 */
847 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
848 variable), xp_nofault_PIOR_target));
849
850 local_irq_restore(irq_flags);
851}
852
853static inline void
854xpc_request_partition_disengage(struct xpc_partition *part)
855{
856 unsigned long irq_flags;
857 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
858 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
859
860
861 local_irq_save(irq_flags);
862
863 /* set bit corresponding to our partid in remote partition's AMO */
864 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
865 (1UL << sn_partition_id));
866 /*
867 * We must always use the nofault function regardless of whether we
868 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
869 * didn't, we'd never know that the other partition is down and would
870 * keep sending IPIs and AMOs to it until the heartbeat times out.
871 */
872 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
873 variable), xp_nofault_PIOR_target));
874
875 local_irq_restore(irq_flags);
876}
877
878static inline void
879xpc_cancel_partition_disengage_request(struct xpc_partition *part)
880{
881 unsigned long irq_flags;
882 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
883 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
884
885
886 local_irq_save(irq_flags);
887
888 /* clear bit corresponding to our partid in remote partition's AMO */
889 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
890 ~(1UL << sn_partition_id));
891 /*
892 * We must always use the nofault function regardless of whether we
893 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
894 * didn't, we'd never know that the other partition is down and would
895 * keep sending IPIs and AMOs to it until the heartbeat times out.
896 */
897 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
898 variable), xp_nofault_PIOR_target));
899
900 local_irq_restore(irq_flags);
901}
902
903static inline u64
904xpc_partition_engaged(u64 partid_mask)
905{
906 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
907
908
909 /* return our partition's AMO variable ANDed with partid_mask */
910 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
911 partid_mask);
912}
913
914static inline u64
915xpc_partition_disengage_requested(u64 partid_mask)
916{
917 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
918
919
920 /* return our partition's AMO variable ANDed with partid_mask */
921 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
922 partid_mask);
923}
924
925static inline void
926xpc_clear_partition_engaged(u64 partid_mask)
927{
928 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
929
930
931 /* clear bit(s) based on partid_mask in our partition's AMO */
932 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
933 ~partid_mask);
934}
935
936static inline void
937xpc_clear_partition_disengage_request(u64 partid_mask)
938{
939 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
940
941
942 /* clear bit(s) based on partid_mask in our partition's AMO */
943 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
944 ~partid_mask);
945}
946
947
948
949/*
950 * The following set of macros and inlines are used for the sending and
951 * receiving of IPIs (also known as IRQs). There are two flavors of IPIs,
952 * one that is associated with partition activity (SGI_XPC_ACTIVATE) and
953 * the other that is associated with channel activity (SGI_XPC_NOTIFY).
954 */
955
956static inline u64
957xpc_IPI_receive(AMO_t *amo)
958{
959 return FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_CLEAR);
960}
961
962
963static inline enum xpc_retval
964xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
965{
966 int ret = 0;
967 unsigned long irq_flags;
968
969
970 local_irq_save(irq_flags);
971
972 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR, flag);
973 sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
974
975 /*
976 * We must always use the nofault function regardless of whether we
977 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
978 * didn't, we'd never know that the other partition is down and would
979 * keep sending IPIs and AMOs to it until the heartbeat times out.
980 */
981 ret = xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
982 xp_nofault_PIOR_target));
983
984 local_irq_restore(irq_flags);
985
986 return ((ret == 0) ? xpcSuccess : xpcPioReadError);
987}
988
989
990/*
991 * IPIs associated with SGI_XPC_ACTIVATE IRQ.
992 */
993
994/*
995 * Flag the appropriate AMO variable and send an IPI to the specified node.
996 */
997static inline void
998xpc_activate_IRQ_send(u64 amos_page_pa, int from_nasid, int to_nasid,
999 int to_phys_cpuid)
1000{
1001 int w_index = XPC_NASID_W_INDEX(from_nasid);
1002 int b_index = XPC_NASID_B_INDEX(from_nasid);
1003 AMO_t *amos = (AMO_t *) __va(amos_page_pa +
1004 (XPC_ACTIVATE_IRQ_AMOS * sizeof(AMO_t)));
1005
1006
1007 (void) xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid,
1008 to_phys_cpuid, SGI_XPC_ACTIVATE);
1009}
1010
1011static inline void
1012xpc_IPI_send_activate(struct xpc_vars *vars)
1013{
1014 xpc_activate_IRQ_send(vars->amos_page_pa, cnodeid_to_nasid(0),
1015 vars->act_nasid, vars->act_phys_cpuid);
1016}
1017
1018static inline void
1019xpc_IPI_send_activated(struct xpc_partition *part)
1020{
1021 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1022 part->remote_act_nasid, part->remote_act_phys_cpuid);
1023}
1024
1025static inline void
1026xpc_IPI_send_reactivate(struct xpc_partition *part)
1027{
1028 xpc_activate_IRQ_send(xpc_vars->amos_page_pa, part->reactivate_nasid,
1029 xpc_vars->act_nasid, xpc_vars->act_phys_cpuid);
1030}
1031
1032static inline void
1033xpc_IPI_send_disengage(struct xpc_partition *part)
1034{
1035 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1036 part->remote_act_nasid, part->remote_act_phys_cpuid);
1037}
1038
1039
1040/*
1041 * IPIs associated with SGI_XPC_NOTIFY IRQ.
1042 */
1043
1044/*
1045 * Send an IPI to the remote partition that is associated with the
1046 * specified channel.
1047 */
1048#define XPC_NOTIFY_IRQ_SEND(_ch, _ipi_f, _irq_f) \
1049 xpc_notify_IRQ_send(_ch, _ipi_f, #_ipi_f, _irq_f)
1050
1051static inline void
1052xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
1053 unsigned long *irq_flags)
1054{
1055 struct xpc_partition *part = &xpc_partitions[ch->partid];
1056 enum xpc_retval ret;
1057
1058
1059 if (likely(part->act_state != XPC_P_DEACTIVATING)) {
1060 ret = xpc_IPI_send(part->remote_IPI_amo_va,
1061 (u64) ipi_flag << (ch->number * 8),
1062 part->remote_IPI_nasid,
1063 part->remote_IPI_phys_cpuid,
1064 SGI_XPC_NOTIFY);
1065 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
1066 ipi_flag_string, ch->partid, ch->number, ret);
1067 if (unlikely(ret != xpcSuccess)) {
1068 if (irq_flags != NULL) {
1069 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1070 }
1071 XPC_DEACTIVATE_PARTITION(part, ret);
1072 if (irq_flags != NULL) {
1073 spin_lock_irqsave(&ch->lock, *irq_flags);
1074 }
1075 }
1076 }
1077}
1078
1079
1080/*
1081 * Make it look like the remote partition, which is associated with the
1082 * specified channel, sent us an IPI. This faked IPI will be handled
1083 * by xpc_dropped_IPI_check().
1084 */
1085#define XPC_NOTIFY_IRQ_SEND_LOCAL(_ch, _ipi_f) \
1086 xpc_notify_IRQ_send_local(_ch, _ipi_f, #_ipi_f)
1087
1088static inline void
1089xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
1090 char *ipi_flag_string)
1091{
1092 struct xpc_partition *part = &xpc_partitions[ch->partid];
1093
1094
1095 FETCHOP_STORE_OP(TO_AMO((u64) &part->local_IPI_amo_va->variable),
1096 FETCHOP_OR, ((u64) ipi_flag << (ch->number * 8)));
1097 dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
1098 ipi_flag_string, ch->partid, ch->number);
1099}
1100
1101
1102/*
1103 * The sending and receiving of IPIs includes the setting of an AMO variable
1104 * to indicate the reason the IPI was sent. The 64-bit variable is divided
1105 * up into eight bytes, ordered from right to left. Byte zero pertains to
1106 * channel 0, byte one to channel 1, and so on. Each byte is described by
1107 * the following IPI flags.
1108 */
1109
1110#define XPC_IPI_CLOSEREQUEST 0x01
1111#define XPC_IPI_CLOSEREPLY 0x02
1112#define XPC_IPI_OPENREQUEST 0x04
1113#define XPC_IPI_OPENREPLY 0x08
1114#define XPC_IPI_MSGREQUEST 0x10
1115
1116
1117/* given an AMO variable and a channel#, get its associated IPI flags */
1118#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
1119#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
1120
1121#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f)
1122#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010)
1123
1124
1125static inline void
1126xpc_IPI_send_closerequest(struct xpc_channel *ch, unsigned long *irq_flags)
1127{
1128 struct xpc_openclose_args *args = ch->local_openclose_args;
1129
1130
1131 args->reason = ch->reason;
1132
1133 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREQUEST, irq_flags);
1134}
1135
1136static inline void
1137xpc_IPI_send_closereply(struct xpc_channel *ch, unsigned long *irq_flags)
1138{
1139 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREPLY, irq_flags);
1140}
1141
1142static inline void
1143xpc_IPI_send_openrequest(struct xpc_channel *ch, unsigned long *irq_flags)
1144{
1145 struct xpc_openclose_args *args = ch->local_openclose_args;
1146
1147
1148 args->msg_size = ch->msg_size;
1149 args->local_nentries = ch->local_nentries;
1150
1151 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREQUEST, irq_flags);
1152}
1153
1154static inline void
1155xpc_IPI_send_openreply(struct xpc_channel *ch, unsigned long *irq_flags)
1156{
1157 struct xpc_openclose_args *args = ch->local_openclose_args;
1158
1159
1160 args->remote_nentries = ch->remote_nentries;
1161 args->local_nentries = ch->local_nentries;
1162 args->local_msgqueue_pa = __pa(ch->local_msgqueue);
1163
1164 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREPLY, irq_flags);
1165}
1166
1167static inline void
1168xpc_IPI_send_msgrequest(struct xpc_channel *ch)
1169{
1170 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_MSGREQUEST, NULL);
1171}
1172
1173static inline void
1174xpc_IPI_send_local_msgrequest(struct xpc_channel *ch)
1175{
1176 XPC_NOTIFY_IRQ_SEND_LOCAL(ch, XPC_IPI_MSGREQUEST);
1177}
1178
1179
1180/*
1181 * Memory for XPC's AMO variables is allocated by the MSPEC driver. These
1182 * pages are located in the lowest granule. The lowest granule uses 4k pages
1183 * for cached references and an alternate TLB handler to never provide a
1184 * cacheable mapping for the entire region. This will prevent speculative
1185 * reading of cached copies of our lines from being issued which will cause
1186 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
1187 * AMO variables (based on XP_MAX_PARTITIONS) for message notification and an
1188 * additional 128 AMO variables (based on XP_NASID_MASK_WORDS) for partition
1189 * activation and 2 AMO variables for partition deactivation.
1190 */
1191static inline AMO_t *
1192xpc_IPI_init(int index)
1193{
1194 AMO_t *amo = xpc_vars->amos_page + index;
1195
1196
1197 (void) xpc_IPI_receive(amo); /* clear AMO variable */
1198 return amo;
1199}
1200
1201
1202
1203static inline enum xpc_retval
1204xpc_map_bte_errors(bte_result_t error)
1205{
1206 switch (error) {
1207 case BTE_SUCCESS: return xpcSuccess;
1208 case BTEFAIL_DIR: return xpcBteDirectoryError;
1209 case BTEFAIL_POISON: return xpcBtePoisonError;
1210 case BTEFAIL_WERR: return xpcBteWriteError;
1211 case BTEFAIL_ACCESS: return xpcBteAccessError;
1212 case BTEFAIL_PWERR: return xpcBtePWriteError;
1213 case BTEFAIL_PRERR: return xpcBtePReadError;
1214 case BTEFAIL_TOUT: return xpcBteTimeOutError;
1215 case BTEFAIL_XTERR: return xpcBteXtalkError;
1216 case BTEFAIL_NOTAVAIL: return xpcBteNotAvailable;
1217 default: return xpcBteUnmappedError;
1218 }
1219}
1220
1221
1222
1223static inline void *
1224xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
1225{
1226 /* see if kmalloc will give us cachline aligned memory by default */
1227 *base = kmalloc(size, flags);
1228 if (*base == NULL) {
1229 return NULL;
1230 }
1231 if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) {
1232 return *base;
1233 }
1234 kfree(*base);
1235
1236 /* nope, we'll have to do it ourselves */
1237 *base = kmalloc(size + L1_CACHE_BYTES, flags);
1238 if (*base == NULL) {
1239 return NULL;
1240 }
1241 return (void *) L1_CACHE_ALIGN((u64) *base);
1242}
1243
1244
1245/*
1246 * Check to see if there is any channel activity to/from the specified
1247 * partition.
1248 */
1249static inline void
1250xpc_check_for_channel_activity(struct xpc_partition *part)
1251{
1252 u64 IPI_amo;
1253 unsigned long irq_flags;
1254
1255
1256 IPI_amo = xpc_IPI_receive(part->local_IPI_amo_va);
1257 if (IPI_amo == 0) {
1258 return;
1259 }
1260
1261 spin_lock_irqsave(&part->IPI_lock, irq_flags);
1262 part->local_IPI_amo |= IPI_amo;
1263 spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
1264
1265 dev_dbg(xpc_chan, "received IPI from partid=%d, IPI_amo=0x%lx\n",
1266 XPC_PARTID(part), IPI_amo);
1267
1268 xpc_wakeup_channel_mgr(part);
1269}
1270
1271
1272#endif /* _IA64_SN_KERNEL_XPC_H */
1273
diff --git a/arch/ia64/sn/kernel/xpc_channel.c b/arch/ia64/sn/kernel/xpc_channel.c
index abf4fc2a87bb..0c0a68902409 100644
--- a/arch/ia64/sn/kernel/xpc_channel.c
+++ b/arch/ia64/sn/kernel/xpc_channel.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -24,7 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <asm/sn/bte.h> 25#include <asm/sn/bte.h>
26#include <asm/sn/sn_sal.h> 26#include <asm/sn/sn_sal.h>
27#include "xpc.h" 27#include <asm/sn/xpc.h>
28 28
29 29
30/* 30/*
@@ -779,6 +779,12 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
779 779
780 /* both sides are disconnected now */ 780 /* both sides are disconnected now */
781 781
782 if (ch->flags & XPC_C_CONNECTCALLOUT) {
783 spin_unlock_irqrestore(&ch->lock, *irq_flags);
784 xpc_disconnect_callout(ch, xpcDisconnected);
785 spin_lock_irqsave(&ch->lock, *irq_flags);
786 }
787
782 /* it's now safe to free the channel's message queues */ 788 /* it's now safe to free the channel's message queues */
783 xpc_free_msgqueues(ch); 789 xpc_free_msgqueues(ch);
784 790
@@ -1645,7 +1651,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1645 1651
1646 1652
1647void 1653void
1648xpc_disconnecting_callout(struct xpc_channel *ch) 1654xpc_disconnect_callout(struct xpc_channel *ch, enum xpc_retval reason)
1649{ 1655{
1650 /* 1656 /*
1651 * Let the channel's registerer know that the channel is being 1657 * Let the channel's registerer know that the channel is being
@@ -1654,15 +1660,13 @@ xpc_disconnecting_callout(struct xpc_channel *ch)
1654 */ 1660 */
1655 1661
1656 if (ch->func != NULL) { 1662 if (ch->func != NULL) {
1657 dev_dbg(xpc_chan, "ch->func() called, reason=xpcDisconnecting," 1663 dev_dbg(xpc_chan, "ch->func() called, reason=%d, partid=%d, "
1658 " partid=%d, channel=%d\n", ch->partid, ch->number); 1664 "channel=%d\n", reason, ch->partid, ch->number);
1659 1665
1660 ch->func(xpcDisconnecting, ch->partid, ch->number, NULL, 1666 ch->func(reason, ch->partid, ch->number, NULL, ch->key);
1661 ch->key);
1662 1667
1663 dev_dbg(xpc_chan, "ch->func() returned, reason=" 1668 dev_dbg(xpc_chan, "ch->func() returned, reason=%d, partid=%d, "
1664 "xpcDisconnecting, partid=%d, channel=%d\n", 1669 "channel=%d\n", reason, ch->partid, ch->number);
1665 ch->partid, ch->number);
1666 } 1670 }
1667} 1671}
1668 1672
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index b617236524c6..8930586e0eb4 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -59,7 +59,7 @@
59#include <asm/sn/sn_sal.h> 59#include <asm/sn/sn_sal.h>
60#include <asm/kdebug.h> 60#include <asm/kdebug.h>
61#include <asm/uaccess.h> 61#include <asm/uaccess.h>
62#include "xpc.h" 62#include <asm/sn/xpc.h>
63 63
64 64
65/* define two XPC debug device structures to be used with dev_dbg() et al */ 65/* define two XPC debug device structures to be used with dev_dbg() et al */
@@ -82,6 +82,9 @@ struct device *xpc_part = &xpc_part_dbg_subname;
82struct device *xpc_chan = &xpc_chan_dbg_subname; 82struct device *xpc_chan = &xpc_chan_dbg_subname;
83 83
84 84
85static int xpc_kdebug_ignore;
86
87
85/* systune related variables for /proc/sys directories */ 88/* systune related variables for /proc/sys directories */
86 89
87static int xpc_hb_interval = XPC_HB_DEFAULT_INTERVAL; 90static int xpc_hb_interval = XPC_HB_DEFAULT_INTERVAL;
@@ -162,6 +165,8 @@ static ctl_table xpc_sys_dir[] = {
162}; 165};
163static struct ctl_table_header *xpc_sysctl; 166static struct ctl_table_header *xpc_sysctl;
164 167
168/* non-zero if any remote partition disengage request was timed out */
169int xpc_disengage_request_timedout;
165 170
166/* #of IRQs received */ 171/* #of IRQs received */
167static atomic_t xpc_act_IRQ_rcvd; 172static atomic_t xpc_act_IRQ_rcvd;
@@ -773,7 +778,7 @@ xpc_daemonize_kthread(void *args)
773 ch->flags |= XPC_C_DISCONNECTCALLOUT; 778 ch->flags |= XPC_C_DISCONNECTCALLOUT;
774 spin_unlock_irqrestore(&ch->lock, irq_flags); 779 spin_unlock_irqrestore(&ch->lock, irq_flags);
775 780
776 xpc_disconnecting_callout(ch); 781 xpc_disconnect_callout(ch, xpcDisconnecting);
777 } else { 782 } else {
778 spin_unlock_irqrestore(&ch->lock, irq_flags); 783 spin_unlock_irqrestore(&ch->lock, irq_flags);
779 } 784 }
@@ -921,9 +926,9 @@ static void
921xpc_do_exit(enum xpc_retval reason) 926xpc_do_exit(enum xpc_retval reason)
922{ 927{
923 partid_t partid; 928 partid_t partid;
924 int active_part_count; 929 int active_part_count, printed_waiting_msg = 0;
925 struct xpc_partition *part; 930 struct xpc_partition *part;
926 unsigned long printmsg_time; 931 unsigned long printmsg_time, disengage_request_timeout = 0;
927 932
928 933
929 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */ 934 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */
@@ -953,7 +958,8 @@ xpc_do_exit(enum xpc_retval reason)
953 958
954 /* wait for all partitions to become inactive */ 959 /* wait for all partitions to become inactive */
955 960
956 printmsg_time = jiffies; 961 printmsg_time = jiffies + (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
962 xpc_disengage_request_timedout = 0;
957 963
958 do { 964 do {
959 active_part_count = 0; 965 active_part_count = 0;
@@ -969,20 +975,39 @@ xpc_do_exit(enum xpc_retval reason)
969 active_part_count++; 975 active_part_count++;
970 976
971 XPC_DEACTIVATE_PARTITION(part, reason); 977 XPC_DEACTIVATE_PARTITION(part, reason);
972 }
973 978
974 if (active_part_count == 0) { 979 if (part->disengage_request_timeout >
975 break; 980 disengage_request_timeout) {
981 disengage_request_timeout =
982 part->disengage_request_timeout;
983 }
976 } 984 }
977 985
978 if (jiffies >= printmsg_time) { 986 if (xpc_partition_engaged(-1UL)) {
979 dev_info(xpc_part, "waiting for partitions to " 987 if (time_after(jiffies, printmsg_time)) {
980 "deactivate/disengage, active count=%d, remote " 988 dev_info(xpc_part, "waiting for remote "
981 "engaged=0x%lx\n", active_part_count, 989 "partitions to disengage, timeout in "
982 xpc_partition_engaged(1UL << partid)); 990 "%ld seconds\n",
983 991 (disengage_request_timeout - jiffies)
984 printmsg_time = jiffies + 992 / HZ);
993 printmsg_time = jiffies +
985 (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ); 994 (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
995 printed_waiting_msg = 1;
996 }
997
998 } else if (active_part_count > 0) {
999 if (printed_waiting_msg) {
1000 dev_info(xpc_part, "waiting for local partition"
1001 " to disengage\n");
1002 printed_waiting_msg = 0;
1003 }
1004
1005 } else {
1006 if (!xpc_disengage_request_timedout) {
1007 dev_info(xpc_part, "all partitions have "
1008 "disengaged\n");
1009 }
1010 break;
986 } 1011 }
987 1012
988 /* sleep for a 1/3 of a second or so */ 1013 /* sleep for a 1/3 of a second or so */
@@ -1000,11 +1025,13 @@ xpc_do_exit(enum xpc_retval reason)
1000 del_timer_sync(&xpc_hb_timer); 1025 del_timer_sync(&xpc_hb_timer);
1001 DBUG_ON(xpc_vars->heartbeating_to_mask != 0); 1026 DBUG_ON(xpc_vars->heartbeating_to_mask != 0);
1002 1027
1003 /* take ourselves off of the reboot_notifier_list */ 1028 if (reason == xpcUnloading) {
1004 (void) unregister_reboot_notifier(&xpc_reboot_notifier); 1029 /* take ourselves off of the reboot_notifier_list */
1030 (void) unregister_reboot_notifier(&xpc_reboot_notifier);
1005 1031
1006 /* take ourselves off of the die_notifier list */ 1032 /* take ourselves off of the die_notifier list */
1007 (void) unregister_die_notifier(&xpc_die_notifier); 1033 (void) unregister_die_notifier(&xpc_die_notifier);
1034 }
1008 1035
1009 /* close down protections for IPI operations */ 1036 /* close down protections for IPI operations */
1010 xpc_restrict_IPI_ops(); 1037 xpc_restrict_IPI_ops();
@@ -1020,7 +1047,35 @@ xpc_do_exit(enum xpc_retval reason)
1020 1047
1021 1048
1022/* 1049/*
1023 * Called when the system is about to be either restarted or halted. 1050 * This function is called when the system is being rebooted.
1051 */
1052static int
1053xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1054{
1055 enum xpc_retval reason;
1056
1057
1058 switch (event) {
1059 case SYS_RESTART:
1060 reason = xpcSystemReboot;
1061 break;
1062 case SYS_HALT:
1063 reason = xpcSystemHalt;
1064 break;
1065 case SYS_POWER_OFF:
1066 reason = xpcSystemPoweroff;
1067 break;
1068 default:
1069 reason = xpcSystemGoingDown;
1070 }
1071
1072 xpc_do_exit(reason);
1073 return NOTIFY_DONE;
1074}
1075
1076
1077/*
1078 * Notify other partitions to disengage from all references to our memory.
1024 */ 1079 */
1025static void 1080static void
1026xpc_die_disengage(void) 1081xpc_die_disengage(void)
@@ -1028,7 +1083,7 @@ xpc_die_disengage(void)
1028 struct xpc_partition *part; 1083 struct xpc_partition *part;
1029 partid_t partid; 1084 partid_t partid;
1030 unsigned long engaged; 1085 unsigned long engaged;
1031 long time, print_time, disengage_request_timeout; 1086 long time, printmsg_time, disengage_request_timeout;
1032 1087
1033 1088
1034 /* keep xpc_hb_checker thread from doing anything (just in case) */ 1089 /* keep xpc_hb_checker thread from doing anything (just in case) */
@@ -1055,57 +1110,53 @@ xpc_die_disengage(void)
1055 } 1110 }
1056 } 1111 }
1057 1112
1058 print_time = rtc_time(); 1113 time = rtc_time();
1059 disengage_request_timeout = print_time + 1114 printmsg_time = time +
1115 (XPC_DISENGAGE_PRINTMSG_INTERVAL * sn_rtc_cycles_per_second);
1116 disengage_request_timeout = time +
1060 (xpc_disengage_request_timelimit * sn_rtc_cycles_per_second); 1117 (xpc_disengage_request_timelimit * sn_rtc_cycles_per_second);
1061 1118
1062 /* wait for all other partitions to disengage from us */ 1119 /* wait for all other partitions to disengage from us */
1063 1120
1064 while ((engaged = xpc_partition_engaged(-1UL)) && 1121 while (1) {
1065 (time = rtc_time()) < disengage_request_timeout) { 1122 engaged = xpc_partition_engaged(-1UL);
1123 if (!engaged) {
1124 dev_info(xpc_part, "all partitions have disengaged\n");
1125 break;
1126 }
1066 1127
1067 if (time >= print_time) { 1128 time = rtc_time();
1129 if (time >= disengage_request_timeout) {
1130 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
1131 if (engaged & (1UL << partid)) {
1132 dev_info(xpc_part, "disengage from "
1133 "remote partition %d timed "
1134 "out\n", partid);
1135 }
1136 }
1137 break;
1138 }
1139
1140 if (time >= printmsg_time) {
1068 dev_info(xpc_part, "waiting for remote partitions to " 1141 dev_info(xpc_part, "waiting for remote partitions to "
1069 "disengage, engaged=0x%lx\n", engaged); 1142 "disengage, timeout in %ld seconds\n",
1070 print_time = time + (XPC_DISENGAGE_PRINTMSG_INTERVAL * 1143 (disengage_request_timeout - time) /
1144 sn_rtc_cycles_per_second);
1145 printmsg_time = time +
1146 (XPC_DISENGAGE_PRINTMSG_INTERVAL *
1071 sn_rtc_cycles_per_second); 1147 sn_rtc_cycles_per_second);
1072 } 1148 }
1073 } 1149 }
1074 dev_info(xpc_part, "finished waiting for remote partitions to "
1075 "disengage, engaged=0x%lx\n", engaged);
1076}
1077
1078
1079/*
1080 * This function is called when the system is being rebooted.
1081 */
1082static int
1083xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1084{
1085 enum xpc_retval reason;
1086
1087
1088 switch (event) {
1089 case SYS_RESTART:
1090 reason = xpcSystemReboot;
1091 break;
1092 case SYS_HALT:
1093 reason = xpcSystemHalt;
1094 break;
1095 case SYS_POWER_OFF:
1096 reason = xpcSystemPoweroff;
1097 break;
1098 default:
1099 reason = xpcSystemGoingDown;
1100 }
1101
1102 xpc_do_exit(reason);
1103 return NOTIFY_DONE;
1104} 1150}
1105 1151
1106 1152
1107/* 1153/*
1108 * This function is called when the system is being rebooted. 1154 * This function is called when the system is being restarted or halted due
1155 * to some sort of system failure. If this is the case we need to notify the
1156 * other partitions to disengage from all references to our memory.
1157 * This function can also be called when our heartbeater could be offlined
1158 * for a time. In this case we need to notify other partitions to not worry
1159 * about the lack of a heartbeat.
1109 */ 1160 */
1110static int 1161static int
1111xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) 1162xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
@@ -1115,11 +1166,25 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1115 case DIE_MACHINE_HALT: 1166 case DIE_MACHINE_HALT:
1116 xpc_die_disengage(); 1167 xpc_die_disengage();
1117 break; 1168 break;
1169
1170 case DIE_KDEBUG_ENTER:
1171 /* Should lack of heartbeat be ignored by other partitions? */
1172 if (!xpc_kdebug_ignore) {
1173 break;
1174 }
1175 /* fall through */
1118 case DIE_MCA_MONARCH_ENTER: 1176 case DIE_MCA_MONARCH_ENTER:
1119 case DIE_INIT_MONARCH_ENTER: 1177 case DIE_INIT_MONARCH_ENTER:
1120 xpc_vars->heartbeat++; 1178 xpc_vars->heartbeat++;
1121 xpc_vars->heartbeat_offline = 1; 1179 xpc_vars->heartbeat_offline = 1;
1122 break; 1180 break;
1181
1182 case DIE_KDEBUG_LEAVE:
1183 /* Is lack of heartbeat being ignored by other partitions? */
1184 if (!xpc_kdebug_ignore) {
1185 break;
1186 }
1187 /* fall through */
1123 case DIE_MCA_MONARCH_LEAVE: 1188 case DIE_MCA_MONARCH_LEAVE:
1124 case DIE_INIT_MONARCH_LEAVE: 1189 case DIE_INIT_MONARCH_LEAVE:
1125 xpc_vars->heartbeat++; 1190 xpc_vars->heartbeat++;
@@ -1344,3 +1409,7 @@ module_param(xpc_disengage_request_timelimit, int, 0);
1344MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait " 1409MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait "
1345 "for disengage request to complete."); 1410 "for disengage request to complete.");
1346 1411
1412module_param(xpc_kdebug_ignore, int, 0);
1413MODULE_PARM_DESC(xpc_kdebug_ignore, "Should lack of heartbeat be ignored by "
1414 "other partitions when dropping into kdebug.");
1415
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c
index cdd6431853a1..88a730e6cfdb 100644
--- a/arch/ia64/sn/kernel/xpc_partition.c
+++ b/arch/ia64/sn/kernel/xpc_partition.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -28,7 +28,7 @@
28#include <asm/sn/sn_sal.h> 28#include <asm/sn/sn_sal.h>
29#include <asm/sn/nodepda.h> 29#include <asm/sn/nodepda.h>
30#include <asm/sn/addrs.h> 30#include <asm/sn/addrs.h>
31#include "xpc.h" 31#include <asm/sn/xpc.h>
32 32
33 33
34/* XPC is exiting flag */ 34/* XPC is exiting flag */
@@ -771,7 +771,8 @@ xpc_identify_act_IRQ_req(int nasid)
771 } 771 }
772 } 772 }
773 773
774 if (!xpc_partition_disengaged(part)) { 774 if (part->disengage_request_timeout > 0 &&
775 !xpc_partition_disengaged(part)) {
775 /* still waiting on other side to disengage from us */ 776 /* still waiting on other side to disengage from us */
776 return; 777 return;
777 } 778 }
@@ -873,6 +874,9 @@ xpc_partition_disengaged(struct xpc_partition *part)
873 * request in a timely fashion, so assume it's dead. 874 * request in a timely fashion, so assume it's dead.
874 */ 875 */
875 876
877 dev_info(xpc_part, "disengage from remote partition %d "
878 "timed out\n", partid);
879 xpc_disengage_request_timedout = 1;
876 xpc_clear_partition_engaged(1UL << partid); 880 xpc_clear_partition_engaged(1UL << partid);
877 disengaged = 1; 881 disengaged = 1;
878 } 882 }
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 34093476e965..e68332d93171 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -218,7 +218,9 @@ void sn_dma_flush(uint64_t addr)
218 uint64_t flags; 218 uint64_t flags;
219 uint64_t itte; 219 uint64_t itte;
220 struct hubdev_info *hubinfo; 220 struct hubdev_info *hubinfo;
221 volatile struct sn_flush_device_list *p; 221 volatile struct sn_flush_device_kernel *p;
222 volatile struct sn_flush_device_common *common;
223
222 struct sn_flush_nasid_entry *flush_nasid_list; 224 struct sn_flush_nasid_entry *flush_nasid_list;
223 225
224 if (!sn_ioif_inited) 226 if (!sn_ioif_inited)
@@ -268,17 +270,17 @@ void sn_dma_flush(uint64_t addr)
268 p = &flush_nasid_list->widget_p[wid_num][0]; 270 p = &flush_nasid_list->widget_p[wid_num][0];
269 271
270 /* find a matching BAR */ 272 /* find a matching BAR */
271 for (i = 0; i < DEV_PER_WIDGET; i++) { 273 for (i = 0; i < DEV_PER_WIDGET; i++,p++) {
274 common = p->common;
272 for (j = 0; j < PCI_ROM_RESOURCE; j++) { 275 for (j = 0; j < PCI_ROM_RESOURCE; j++) {
273 if (p->sfdl_bar_list[j].start == 0) 276 if (common->sfdl_bar_list[j].start == 0)
274 break; 277 break;
275 if (addr >= p->sfdl_bar_list[j].start 278 if (addr >= common->sfdl_bar_list[j].start
276 && addr <= p->sfdl_bar_list[j].end) 279 && addr <= common->sfdl_bar_list[j].end)
277 break; 280 break;
278 } 281 }
279 if (j < PCI_ROM_RESOURCE && p->sfdl_bar_list[j].start != 0) 282 if (j < PCI_ROM_RESOURCE && common->sfdl_bar_list[j].start != 0)
280 break; 283 break;
281 p++;
282 } 284 }
283 285
284 /* if no matching BAR, return without doing anything. */ 286 /* if no matching BAR, return without doing anything. */
@@ -304,24 +306,24 @@ void sn_dma_flush(uint64_t addr)
304 if ((1 << XWIDGET_PART_REV_NUM_REV(revnum)) & PV907516) { 306 if ((1 << XWIDGET_PART_REV_NUM_REV(revnum)) & PV907516) {
305 return; 307 return;
306 } else { 308 } else {
307 pcireg_wrb_flush_get(p->sfdl_pcibus_info, 309 pcireg_wrb_flush_get(common->sfdl_pcibus_info,
308 (p->sfdl_slot - 1)); 310 (common->sfdl_slot - 1));
309 } 311 }
310 } else { 312 } else {
311 spin_lock_irqsave(&((struct sn_flush_device_list *)p)-> 313 spin_lock_irqsave((spinlock_t *)&p->sfdl_flush_lock,
312 sfdl_flush_lock, flags); 314 flags);
313 315 *common->sfdl_flush_addr = 0;
314 *p->sfdl_flush_addr = 0;
315 316
316 /* force an interrupt. */ 317 /* force an interrupt. */
317 *(volatile uint32_t *)(p->sfdl_force_int_addr) = 1; 318 *(volatile uint32_t *)(common->sfdl_force_int_addr) = 1;
318 319
319 /* wait for the interrupt to come back. */ 320 /* wait for the interrupt to come back. */
320 while (*(p->sfdl_flush_addr) != 0x10f) 321 while (*(common->sfdl_flush_addr) != 0x10f)
321 cpu_relax(); 322 cpu_relax();
322 323
323 /* okay, everything is synched up. */ 324 /* okay, everything is synched up. */
324 spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock, flags); 325 spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock,
326 flags);
325 } 327 }
326 return; 328 return;
327} 329}
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 1f500c81002c..e328e948175d 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -92,7 +92,8 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
92 cnodeid_t near_cnode; 92 cnodeid_t near_cnode;
93 struct hubdev_info *hubdev_info; 93 struct hubdev_info *hubdev_info;
94 struct pcibus_info *soft; 94 struct pcibus_info *soft;
95 struct sn_flush_device_list *sn_flush_device_list; 95 struct sn_flush_device_kernel *sn_flush_device_kernel;
96 struct sn_flush_device_common *common;
96 97
97 if (! IS_PCI_BRIDGE_ASIC(prom_bussoft->bs_asic_type)) { 98 if (! IS_PCI_BRIDGE_ASIC(prom_bussoft->bs_asic_type)) {
98 return NULL; 99 return NULL;
@@ -137,20 +138,19 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
137 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo); 138 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
138 139
139 if (hubdev_info->hdi_flush_nasid_list.widget_p) { 140 if (hubdev_info->hdi_flush_nasid_list.widget_p) {
140 sn_flush_device_list = hubdev_info->hdi_flush_nasid_list. 141 sn_flush_device_kernel = hubdev_info->hdi_flush_nasid_list.
141 widget_p[(int)soft->pbi_buscommon.bs_xid]; 142 widget_p[(int)soft->pbi_buscommon.bs_xid];
142 if (sn_flush_device_list) { 143 if (sn_flush_device_kernel) {
143 for (j = 0; j < DEV_PER_WIDGET; 144 for (j = 0; j < DEV_PER_WIDGET;
144 j++, sn_flush_device_list++) { 145 j++, sn_flush_device_kernel++) {
145 if (sn_flush_device_list->sfdl_slot == -1) 146 common = sn_flush_device_kernel->common;
147 if (common->sfdl_slot == -1)
146 continue; 148 continue;
147 if ((sn_flush_device_list-> 149 if ((common->sfdl_persistent_segment ==
148 sfdl_persistent_segment ==
149 soft->pbi_buscommon.bs_persist_segment) && 150 soft->pbi_buscommon.bs_persist_segment) &&
150 (sn_flush_device_list-> 151 (common->sfdl_persistent_busnum ==
151 sfdl_persistent_busnum ==
152 soft->pbi_buscommon.bs_persist_busnum)) 152 soft->pbi_buscommon.bs_persist_busnum))
153 sn_flush_device_list->sfdl_pcibus_info = 153 common->sfdl_pcibus_info =
154 soft; 154 soft;
155 } 155 }
156 } 156 }
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index d3654a264ef7..44dd82b791d1 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -139,17 +139,14 @@ drivers-$(CONFIG_CPM2) += arch/ppc/8260_io/
139 139
140drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 140drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
141 141
142defaultimage-$(CONFIG_PPC32) := zImage 142# Default to zImage, override when needed
143defaultimage-y := zImage
143defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux 144defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
144defaultimage-$(CONFIG_PPC_PSERIES) := zImage
145KBUILD_IMAGE := $(defaultimage-y) 145KBUILD_IMAGE := $(defaultimage-y)
146all: $(KBUILD_IMAGE) 146all: $(KBUILD_IMAGE)
147 147
148CPPFLAGS_vmlinux.lds := -Upowerpc 148CPPFLAGS_vmlinux.lds := -Upowerpc
149 149
150# All the instructions talk about "make bzImage".
151bzImage: zImage
152
153BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage 150BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage
154 151
155.PHONY: $(BOOT_TARGETS) 152.PHONY: $(BOOT_TARGETS)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index b53d677f6742..788dec4c7ef3 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -25,8 +25,8 @@ HOSTCC := gcc
25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ 25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
26 $(shell $(CROSS32CC) -print-file-name=include) -fPIC 26 $(shell $(CROSS32CC) -print-file-name=include) -fPIC
27BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 27BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
28BOOTLFLAGS := -T $(srctree)/$(src)/zImage.lds
29OBJCOPYFLAGS := contents,alloc,load,readonly,data 28OBJCOPYFLAGS := contents,alloc,load,readonly,data
29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
30 30
31zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 31zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
32zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h 32zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
@@ -35,7 +35,7 @@ zliblinuxheader := zlib.h zconf.h zutil.h
35$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 35$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
36#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) 36#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
37 37
38src-boot := string.S prom.c main.c div64.S crt0.S 38src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
39src-boot += $(zlib) 39src-boot += $(zlib)
40src-boot := $(addprefix $(obj)/, $(src-boot)) 40src-boot := $(addprefix $(obj)/, $(src-boot))
41obj-boot := $(addsuffix .o, $(basename $(src-boot))) 41obj-boot := $(addsuffix .o, $(basename $(src-boot)))
@@ -70,7 +70,7 @@ quiet_cmd_bootas = BOOTAS $@
70 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 70 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
71 71
72quiet_cmd_bootld = BOOTLD $@ 72quiet_cmd_bootld = BOOTLD $@
73 cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2) 73 cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
74 74
75$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c 75$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
76 $(call if_changed_dep,bootcc) 76 $(call if_changed_dep,bootcc)
@@ -87,12 +87,14 @@ obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section)))
87src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) 87src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
88gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) 88gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
89 89
90hostprogs-y := addnote addRamDisk 90hostprogs-y := addnote addRamDisk hack-coff
91targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ 91
92 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ 92targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
93 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ 93 zImage.coff zImage.initrd.coff \
94 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ 94 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
95 vmlinux.initrd 95 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
96 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
97 vmlinux.initrd
96extra-y := initrd.o 98extra-y := initrd.o
97 99
98quiet_cmd_ramdisk = RAMDISK $@ 100quiet_cmd_ramdisk = RAMDISK $@
@@ -114,6 +116,10 @@ quiet_cmd_addsection = ADDSEC $@
114quiet_cmd_addnote = ADDNOTE $@ 116quiet_cmd_addnote = ADDNOTE $@
115 cmd_addnote = $(obj)/addnote $@ 117 cmd_addnote = $(obj)/addnote $@
116 118
119quiet_cmd_gencoff = COFF $@
120 cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \
121 $(obj)/hack-coff $@
122
117$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % 123$(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
118 $(call if_changed,gzip) 124 $(call if_changed,gzip)
119 125
@@ -127,22 +133,35 @@ $(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c
127 $(call if_changed_dep,bootcc) 133 $(call if_changed_dep,bootcc)
128 $(call cmd,addsection) 134 $(call cmd,addsection)
129 135
130$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required)) 136$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
131$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds 137$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
132 $(call cmd,bootld,$(obj-boot)) 138 $(call cmd,bootld,$(obj-boot),zImage.lds)
133 139
134$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd)) 140$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
135$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds 141$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
136 $(call cmd,bootld,$(obj-boot)) 142 $(call cmd,bootld,$(obj-boot),zImage.lds)
143
144# For 32-bit powermacs, build the COFF images as well as the ELF images.
145coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff
146coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff
137 147
138$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote 148$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y)
139 @cp -f $< $@ 149 @cp -f $< $@
140 $(call if_changed,addnote) 150 $(call if_changed,addnote)
141 151
142$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote 152$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote $(coffrdimg-y-y)
143 @cp -f $< $@ 153 @cp -f $< $@
144 $(call if_changed,addnote) 154 $(call if_changed,addnote)
145 155
156$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
157 $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
158 $(call cmd,gencoff)
159
160$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
161 $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
162 $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
163 $(call cmd,gencoff)
164
146#----------------------------------------------------------- 165#-----------------------------------------------------------
147# build u-boot images 166# build u-boot images
148#----------------------------------------------------------- 167#-----------------------------------------------------------
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index d2f2ace56cd3..e0192c26037b 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -12,17 +12,23 @@
12#include "ppc_asm.h" 12#include "ppc_asm.h"
13 13
14 .text 14 .text
15 /* a procedure descriptor used when booting this as a COFF file */
16_zimage_start_opd:
17 .long _zimage_start, 0, 0, 0
18
15 .globl _zimage_start 19 .globl _zimage_start
16_zimage_start: 20_zimage_start:
21 /* Work out the offset between the address we were linked at
22 and the address where we're running. */
17 bl 1f 23 bl 1f
18 241: mflr r0
191:
20 mflr r0
21 lis r9,1b@ha 25 lis r9,1b@ha
22 addi r9,r9,1b@l 26 addi r9,r9,1b@l
23 subf. r0,r9,r0 27 subf. r0,r9,r0
24 beq 3f 28 beq 3f /* if running at same address as linked */
25 29
30 /* The .got2 section contains a list of addresses, so add
31 the address offset onto each entry. */
26 lis r9,__got2_start@ha 32 lis r9,__got2_start@ha
27 addi r9,r9,__got2_start@l 33 addi r9,r9,__got2_start@l
28 lis r8,__got2_end@ha 34 lis r8,__got2_end@ha
@@ -32,15 +38,14 @@ _zimage_start:
32 srwi. r8,r8,2 38 srwi. r8,r8,2
33 mtctr r8 39 mtctr r8
34 add r9,r0,r9 40 add r9,r0,r9
352: 412: lwz r8,0(r9)
36 lwz r8,0(r9)
37 add r8,r8,r0 42 add r8,r8,r0
38 stw r8,0(r9) 43 stw r8,0(r9)
39 addi r9,r9,4 44 addi r9,r9,4
40 bdnz 2b 45 bdnz 2b
41 46
423: 47 /* Do a cache flush for our text, in case OF didn't */
43 lis r9,_start@h 483: lis r9,_start@h
44 add r9,r0,r9 49 add r9,r0,r9
45 lis r8,_etext@ha 50 lis r8,_etext@ha
46 addi r8,r8,_etext@l 51 addi r8,r8,_etext@l
diff --git a/arch/powerpc/boot/hack-coff.c b/arch/powerpc/boot/hack-coff.c
new file mode 100644
index 000000000000..5e5a6573a1ef
--- /dev/null
+++ b/arch/powerpc/boot/hack-coff.c
@@ -0,0 +1,84 @@
1/*
2 * hack-coff.c - hack the header of an xcoff file to fill in
3 * a few fields needed by the Open Firmware xcoff loader on
4 * Power Macs but not initialized by objcopy.
5 *
6 * Copyright (C) Paul Mackerras 1997.
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
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16#include <fcntl.h>
17#include <string.h>
18#include "rs6000.h"
19
20#define AOUT_MAGIC 0x010b
21
22#define get_16be(x) ((((unsigned char *)(x))[0] << 8) \
23 + ((unsigned char *)(x))[1])
24#define put_16be(x, v) (((unsigned char *)(x))[0] = (v) >> 8, \
25 ((unsigned char *)(x))[1] = (v) & 0xff)
26#define get_32be(x) ((((unsigned char *)(x))[0] << 24) \
27 + (((unsigned char *)(x))[1] << 16) \
28 + (((unsigned char *)(x))[2] << 8) \
29 + ((unsigned char *)(x))[3])
30
31int
32main(int ac, char **av)
33{
34 int fd;
35 int i, nsect;
36 int aoutsz;
37 struct external_filehdr fhdr;
38 AOUTHDR aout;
39 struct external_scnhdr shdr;
40
41 if (ac != 2) {
42 fprintf(stderr, "Usage: hack-coff coff-file\n");
43 exit(1);
44 }
45 if ((fd = open(av[1], 2)) == -1) {
46 perror(av[2]);
47 exit(1);
48 }
49 if (read(fd, &fhdr, sizeof(fhdr)) != sizeof(fhdr))
50 goto readerr;
51 i = get_16be(fhdr.f_magic);
52 if (i != U802TOCMAGIC && i != U802WRMAGIC && i != U802ROMAGIC) {
53 fprintf(stderr, "%s: not an xcoff file\n", av[1]);
54 exit(1);
55 }
56 aoutsz = get_16be(fhdr.f_opthdr);
57 if (read(fd, &aout, aoutsz) != aoutsz)
58 goto readerr;
59 nsect = get_16be(fhdr.f_nscns);
60 for (i = 0; i < nsect; ++i) {
61 if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr))
62 goto readerr;
63 if (strcmp(shdr.s_name, ".text") == 0) {
64 put_16be(aout.o_snentry, i+1);
65 put_16be(aout.o_sntext, i+1);
66 } else if (strcmp(shdr.s_name, ".data") == 0) {
67 put_16be(aout.o_sndata, i+1);
68 } else if (strcmp(shdr.s_name, ".bss") == 0) {
69 put_16be(aout.o_snbss, i+1);
70 }
71 }
72 put_16be(aout.magic, AOUT_MAGIC);
73 if (lseek(fd, (long) sizeof(struct external_filehdr), 0) == -1
74 || write(fd, &aout, aoutsz) != aoutsz) {
75 fprintf(stderr, "%s: write error\n", av[1]);
76 exit(1);
77 }
78 close(fd);
79 exit(0);
80
81readerr:
82 fprintf(stderr, "%s: read error or file too short\n", av[1]);
83 exit(1);
84}
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 64ec93116fa6..55ec59867250 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -21,8 +21,8 @@ extern void flush_cache(void *, unsigned long);
21 21
22 22
23/* Value picked to match that used by yaboot */ 23/* Value picked to match that used by yaboot */
24#define PROG_START 0x01400000 24#define PROG_START 0x01400000 /* only used on 64-bit systems */
25#define RAM_END (512<<20) // Fixme: use OF */ 25#define RAM_END (512<<20) /* Fixme: use OF */
26#define ONE_MB 0x100000 26#define ONE_MB 0x100000
27 27
28extern char _start[]; 28extern char _start[];
@@ -160,6 +160,17 @@ static int is_elf64(void *hdr)
160 elfoffset = (unsigned long)elf64ph->p_offset; 160 elfoffset = (unsigned long)elf64ph->p_offset;
161 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; 161 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
162 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; 162 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
163
164#if defined(PROG_START)
165 /*
166 * Maintain a "magic" minimum address. This keeps some older
167 * firmware platforms running.
168 */
169
170 if (claim_base < PROG_START)
171 claim_base = PROG_START;
172#endif
173
163 return 1; 174 return 1;
164} 175}
165 176
@@ -206,12 +217,18 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
206 exit(); 217 exit();
207 if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4) 218 if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
208 exit(); 219 exit();
209 stderr = stdout;
210 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
211 exit();
212 220
213 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp); 221 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
214 222
223 /*
224 * The first available claim_base must be above the end of the
225 * the loaded kernel wrapper file (_start to _end includes the
226 * initrd image if it is present) and rounded up to a nice
227 * 1 MB boundary for good measure.
228 */
229
230 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
231
215 vmlinuz.addr = (unsigned long)_vmlinux_start; 232 vmlinuz.addr = (unsigned long)_vmlinux_start;
216 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); 233 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
217 234
@@ -228,25 +245,6 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
228 exit(); 245 exit();
229 } 246 }
230 247
231 /*
232 * The first available claim_base must be above the end of the
233 * the loaded kernel wrapper file (_start to _end includes the
234 * initrd image if it is present) and rounded up to a nice
235 * 1 MB boundary for good measure.
236 */
237
238 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
239
240#if defined(PROG_START)
241 /*
242 * Maintain a "magic" minimum address. This keeps some older
243 * firmware platforms running.
244 */
245
246 if (claim_base < PROG_START)
247 claim_base = PROG_START;
248#endif
249
250 /* We need to claim the memsize plus the file offset since gzip 248 /* We need to claim the memsize plus the file offset since gzip
251 * will expand the header (file offset), then the kernel, then 249 * will expand the header (file offset), then the kernel, then
252 * possible rubbish we don't care about. But the kernel bss must 250 * possible rubbish we don't care about. But the kernel bss must
diff --git a/arch/powerpc/boot/prom.c b/arch/powerpc/boot/prom.c
index 4bea2f4dcb06..fa0057736f6b 100644
--- a/arch/powerpc/boot/prom.c
+++ b/arch/powerpc/boot/prom.c
@@ -13,487 +13,153 @@
13#include "prom.h" 13#include "prom.h"
14 14
15int (*prom)(void *); 15int (*prom)(void *);
16phandle chosen_handle;
17ihandle stdout;
16 18
17void *chosen_handle; 19int call_prom(const char *service, int nargs, int nret, ...)
18
19void *stdin;
20void *stdout;
21void *stderr;
22
23
24int
25write(void *handle, void *ptr, int nb)
26{
27 struct prom_args {
28 char *service;
29 int nargs;
30 int nret;
31 void *ihandle;
32 void *addr;
33 int len;
34 int actual;
35 } args;
36
37 args.service = "write";
38 args.nargs = 3;
39 args.nret = 1;
40 args.ihandle = handle;
41 args.addr = ptr;
42 args.len = nb;
43 args.actual = -1;
44 (*prom)(&args);
45 return args.actual;
46}
47
48int
49read(void *handle, void *ptr, int nb)
50{ 20{
21 int i;
51 struct prom_args { 22 struct prom_args {
52 char *service; 23 const char *service;
53 int nargs; 24 int nargs;
54 int nret; 25 int nret;
55 void *ihandle; 26 unsigned int args[12];
56 void *addr;
57 int len;
58 int actual;
59 } args;
60
61 args.service = "read";
62 args.nargs = 3;
63 args.nret = 1;
64 args.ihandle = handle;
65 args.addr = ptr;
66 args.len = nb;
67 args.actual = -1;
68 (*prom)(&args);
69 return args.actual;
70}
71
72void
73exit()
74{
75 struct prom_args {
76 char *service;
77 } args;
78
79 for (;;) {
80 args.service = "exit";
81 (*prom)(&args);
82 }
83}
84
85void
86pause(void)
87{
88 struct prom_args {
89 char *service;
90 } args; 27 } args;
28 va_list list;
91 29
92 args.service = "enter"; 30 args.service = service;
93 (*prom)(&args); 31 args.nargs = nargs;
94} 32 args.nret = nret;
95 33
96void * 34 va_start(list, nret);
97finddevice(const char *name) 35 for (i = 0; i < nargs; i++)
98{ 36 args.args[i] = va_arg(list, unsigned int);
99 struct prom_args { 37 va_end(list);
100 char *service;
101 int nargs;
102 int nret;
103 const char *devspec;
104 void *phandle;
105 } args;
106 38
107 args.service = "finddevice"; 39 for (i = 0; i < nret; i++)
108 args.nargs = 1; 40 args.args[nargs+i] = 0;
109 args.nret = 1;
110 args.devspec = name;
111 args.phandle = (void *) -1;
112 (*prom)(&args);
113 return args.phandle;
114}
115 41
116void * 42 if (prom(&args) < 0)
117claim(unsigned long virt, unsigned long size, unsigned long align) 43 return -1;
118{
119 struct prom_args {
120 char *service;
121 int nargs;
122 int nret;
123 unsigned int virt;
124 unsigned int size;
125 unsigned int align;
126 void *ret;
127 } args;
128 44
129 args.service = "claim"; 45 return (nret > 0)? args.args[nargs]: 0;
130 args.nargs = 3;
131 args.nret = 1;
132 args.virt = virt;
133 args.size = size;
134 args.align = align;
135 (*prom)(&args);
136 return args.ret;
137} 46}
138 47
139int 48int call_prom_ret(const char *service, int nargs, int nret,
140getprop(void *phandle, const char *name, void *buf, int buflen) 49 unsigned int *rets, ...)
141{ 50{
51 int i;
142 struct prom_args { 52 struct prom_args {
143 char *service; 53 const char *service;
144 int nargs; 54 int nargs;
145 int nret; 55 int nret;
146 void *phandle; 56 unsigned int args[12];
147 const char *name;
148 void *buf;
149 int buflen;
150 int size;
151 } args; 57 } args;
58 va_list list;
152 59
153 args.service = "getprop"; 60 args.service = service;
154 args.nargs = 4; 61 args.nargs = nargs;
155 args.nret = 1; 62 args.nret = nret;
156 args.phandle = phandle;
157 args.name = name;
158 args.buf = buf;
159 args.buflen = buflen;
160 args.size = -1;
161 (*prom)(&args);
162 return args.size;
163}
164 63
165int 64 va_start(list, rets);
166putc(int c, void *f) 65 for (i = 0; i < nargs; i++)
167{ 66 args.args[i] = va_arg(list, unsigned int);
168 char ch = c; 67 va_end(list);
169 68
170 if (c == '\n') 69 for (i = 0; i < nret; i++)
171 putc('\r', f); 70 args.args[nargs+i] = 0;
172 return write(f, &ch, 1) == 1? c: -1;
173}
174 71
175int 72 if (prom(&args) < 0)
176putchar(int c) 73 return -1;
177{
178 return putc(c, stdout);
179}
180 74
181int 75 if (rets != (void *) 0)
182fputs(char *str, void *f) 76 for (i = 1; i < nret; ++i)
183{ 77 rets[i-1] = args.args[nargs+i];
184 int n = strlen(str);
185 78
186 return write(f, str, n) == n? 0: -1; 79 return (nret > 0)? args.args[nargs]: 0;
187} 80}
188 81
189size_t strnlen(const char * s, size_t count) 82int write(void *handle, void *ptr, int nb)
190{ 83{
191 const char *sc; 84 return call_prom("write", 3, 1, handle, ptr, nb);
192
193 for (sc = s; count-- && *sc != '\0'; ++sc)
194 /* nothing */;
195 return sc - s;
196} 85}
197 86
198extern unsigned int __div64_32(unsigned long long *dividend, 87/*
199 unsigned int divisor); 88 * Older OF's require that when claiming a specific range of addresses,
200 89 * we claim the physical space in the /memory node and the virtual
201/* The unnecessary pointer compare is there 90 * space in the chosen mmu node, and then do a map operation to
202 * to check for type safety (n must be 64bit) 91 * map virtual to physical.
203 */ 92 */
204# define do_div(n,base) ({ \ 93static int need_map = -1;
205 unsigned int __base = (base); \ 94static ihandle chosen_mmu;
206 unsigned int __rem; \ 95static phandle memory;
207 (void)(((typeof((n)) *)0) == ((unsigned long long *)0)); \
208 if (((n) >> 32) == 0) { \
209 __rem = (unsigned int)(n) % __base; \
210 (n) = (unsigned int)(n) / __base; \
211 } else \
212 __rem = __div64_32(&(n), __base); \
213 __rem; \
214 })
215 96
216static int skip_atoi(const char **s) 97/* returns true if s2 is a prefix of s1 */
98static int string_match(const char *s1, const char *s2)
217{ 99{
218 int i, c; 100 for (; *s2; ++s2)
219 101 if (*s1++ != *s2)
220 for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s) 102 return 0;
221 i = i*10 + c - '0'; 103 return 1;
222 return i;
223} 104}
224 105
225#define ZEROPAD 1 /* pad with zero */ 106static int check_of_version(void)
226#define SIGN 2 /* unsigned/signed long */
227#define PLUS 4 /* show plus */
228#define SPACE 8 /* space if plus */
229#define LEFT 16 /* left justified */
230#define SPECIAL 32 /* 0x */
231#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
232
233static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
234{ 107{
235 char c,sign,tmp[66]; 108 phandle oprom, chosen;
236 const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; 109 char version[64];
237 int i;
238 110
239 if (type & LARGE) 111 oprom = finddevice("/openprom");
240 digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 112 if (oprom == (phandle) -1)
241 if (type & LEFT)
242 type &= ~ZEROPAD;
243 if (base < 2 || base > 36)
244 return 0; 113 return 0;
245 c = (type & ZEROPAD) ? '0' : ' '; 114 if (getprop(oprom, "model", version, sizeof(version)) <= 0)
246 sign = 0; 115 return 0;
247 if (type & SIGN) { 116 version[sizeof(version)-1] = 0;
248 if ((signed long long)num < 0) { 117 printf("OF version = '%s'\r\n", version);
249 sign = '-'; 118 if (!string_match(version, "Open Firmware, 1.")
250 num = - (signed long long)num; 119 && !string_match(version, "FirmWorks,3."))
251 size--; 120 return 0;
252 } else if (type & PLUS) { 121 chosen = finddevice("/chosen");
253 sign = '+'; 122 if (chosen == (phandle) -1) {
254 size--; 123 chosen = finddevice("/chosen@0");
255 } else if (type & SPACE) { 124 if (chosen == (phandle) -1) {
256 sign = ' '; 125 printf("no chosen\n");
257 size--; 126 return 0;
258 } 127 }
259 } 128 }
260 if (type & SPECIAL) { 129 if (getprop(chosen, "mmu", &chosen_mmu, sizeof(chosen_mmu)) <= 0) {
261 if (base == 16) 130 printf("no mmu\n");
262 size -= 2; 131 return 0;
263 else if (base == 8)
264 size--;
265 }
266 i = 0;
267 if (num == 0)
268 tmp[i++]='0';
269 else while (num != 0) {
270 tmp[i++] = digits[do_div(num, base)];
271 } 132 }
272 if (i > precision) 133 memory = (ihandle) call_prom("open", 1, 1, "/memory");
273 precision = i; 134 if (memory == (ihandle) -1) {
274 size -= precision; 135 memory = (ihandle) call_prom("open", 1, 1, "/memory@0");
275 if (!(type&(ZEROPAD+LEFT))) 136 if (memory == (ihandle) -1) {
276 while(size-->0) 137 printf("no memory node\n");
277 *str++ = ' '; 138 return 0;
278 if (sign)
279 *str++ = sign;
280 if (type & SPECIAL) {
281 if (base==8)
282 *str++ = '0';
283 else if (base==16) {
284 *str++ = '0';
285 *str++ = digits[33];
286 } 139 }
287 } 140 }
288 if (!(type & LEFT)) 141 printf("old OF detected\r\n");
289 while (size-- > 0) 142 return 1;
290 *str++ = c;
291 while (i < precision--)
292 *str++ = '0';
293 while (i-- > 0)
294 *str++ = tmp[i];
295 while (size-- > 0)
296 *str++ = ' ';
297 return str;
298} 143}
299 144
300int vsprintf(char *buf, const char *fmt, va_list args) 145void *claim(unsigned long virt, unsigned long size, unsigned long align)
301{ 146{
302 int len; 147 int ret;
303 unsigned long long num; 148 unsigned int result;
304 int i, base;
305 char * str;
306 const char *s;
307
308 int flags; /* flags to number() */
309
310 int field_width; /* width of output field */
311 int precision; /* min. # of digits for integers; max
312 number of chars for from string */
313 int qualifier; /* 'h', 'l', or 'L' for integer fields */
314 /* 'z' support added 23/7/1999 S.H. */
315 /* 'z' changed to 'Z' --davidm 1/25/99 */
316 149
150 if (need_map < 0)
151 need_map = check_of_version();
152 if (align || !need_map)
153 return (void *) call_prom("claim", 3, 1, virt, size, align);
317 154
318 for (str=buf ; *fmt ; ++fmt) { 155 ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory,
319 if (*fmt != '%') { 156 align, size, virt);
320 *str++ = *fmt; 157 if (ret != 0 || result == -1)
321 continue; 158 return (void *) -1;
322 } 159 ret = call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu,
323 160 align, size, virt);
324 /* process flags */ 161 /* 0x12 == coherent + read/write */
325 flags = 0; 162 ret = call_prom("call-method", 6, 1, "map", chosen_mmu,
326 repeat: 163 0x12, size, virt, virt);
327 ++fmt; /* this also skips first '%' */ 164 return (void *) virt;
328 switch (*fmt) {
329 case '-': flags |= LEFT; goto repeat;
330 case '+': flags |= PLUS; goto repeat;
331 case ' ': flags |= SPACE; goto repeat;
332 case '#': flags |= SPECIAL; goto repeat;
333 case '0': flags |= ZEROPAD; goto repeat;
334 }
335
336 /* get field width */
337 field_width = -1;
338 if ('0' <= *fmt && *fmt <= '9')
339 field_width = skip_atoi(&fmt);
340 else if (*fmt == '*') {
341 ++fmt;
342 /* it's the next argument */
343 field_width = va_arg(args, int);
344 if (field_width < 0) {
345 field_width = -field_width;
346 flags |= LEFT;
347 }
348 }
349
350 /* get the precision */
351 precision = -1;
352 if (*fmt == '.') {
353 ++fmt;
354 if ('0' <= *fmt && *fmt <= '9')
355 precision = skip_atoi(&fmt);
356 else if (*fmt == '*') {
357 ++fmt;
358 /* it's the next argument */
359 precision = va_arg(args, int);
360 }
361 if (precision < 0)
362 precision = 0;
363 }
364
365 /* get the conversion qualifier */
366 qualifier = -1;
367 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
368 qualifier = *fmt;
369 ++fmt;
370 }
371
372 /* default base */
373 base = 10;
374
375 switch (*fmt) {
376 case 'c':
377 if (!(flags & LEFT))
378 while (--field_width > 0)
379 *str++ = ' ';
380 *str++ = (unsigned char) va_arg(args, int);
381 while (--field_width > 0)
382 *str++ = ' ';
383 continue;
384
385 case 's':
386 s = va_arg(args, char *);
387 if (!s)
388 s = "<NULL>";
389
390 len = strnlen(s, precision);
391
392 if (!(flags & LEFT))
393 while (len < field_width--)
394 *str++ = ' ';
395 for (i = 0; i < len; ++i)
396 *str++ = *s++;
397 while (len < field_width--)
398 *str++ = ' ';
399 continue;
400
401 case 'p':
402 if (field_width == -1) {
403 field_width = 2*sizeof(void *);
404 flags |= ZEROPAD;
405 }
406 str = number(str,
407 (unsigned long) va_arg(args, void *), 16,
408 field_width, precision, flags);
409 continue;
410
411
412 case 'n':
413 if (qualifier == 'l') {
414 long * ip = va_arg(args, long *);
415 *ip = (str - buf);
416 } else if (qualifier == 'Z') {
417 size_t * ip = va_arg(args, size_t *);
418 *ip = (str - buf);
419 } else {
420 int * ip = va_arg(args, int *);
421 *ip = (str - buf);
422 }
423 continue;
424
425 case '%':
426 *str++ = '%';
427 continue;
428
429 /* integer number formats - set up the flags and "break" */
430 case 'o':
431 base = 8;
432 break;
433
434 case 'X':
435 flags |= LARGE;
436 case 'x':
437 base = 16;
438 break;
439
440 case 'd':
441 case 'i':
442 flags |= SIGN;
443 case 'u':
444 break;
445
446 default:
447 *str++ = '%';
448 if (*fmt)
449 *str++ = *fmt;
450 else
451 --fmt;
452 continue;
453 }
454 if (qualifier == 'l') {
455 num = va_arg(args, unsigned long);
456 if (flags & SIGN)
457 num = (signed long) num;
458 } else if (qualifier == 'Z') {
459 num = va_arg(args, size_t);
460 } else if (qualifier == 'h') {
461 num = (unsigned short) va_arg(args, int);
462 if (flags & SIGN)
463 num = (signed short) num;
464 } else {
465 num = va_arg(args, unsigned int);
466 if (flags & SIGN)
467 num = (signed int) num;
468 }
469 str = number(str, num, base, field_width, precision, flags);
470 }
471 *str = '\0';
472 return str-buf;
473}
474
475int sprintf(char * buf, const char *fmt, ...)
476{
477 va_list args;
478 int i;
479
480 va_start(args, fmt);
481 i=vsprintf(buf,fmt,args);
482 va_end(args);
483 return i;
484}
485
486static char sprint_buf[1024];
487
488int
489printf(const char *fmt, ...)
490{
491 va_list args;
492 int n;
493
494 va_start(args, fmt);
495 n = vsprintf(sprint_buf, fmt, args);
496 va_end(args);
497 write(stdout, sprint_buf, n);
498 return n;
499} 165}
diff --git a/arch/powerpc/boot/prom.h b/arch/powerpc/boot/prom.h
index 96ab5aec740c..3e2ddd4a5a81 100644
--- a/arch/powerpc/boot/prom.h
+++ b/arch/powerpc/boot/prom.h
@@ -1,18 +1,34 @@
1#ifndef _PPC_BOOT_PROM_H_ 1#ifndef _PPC_BOOT_PROM_H_
2#define _PPC_BOOT_PROM_H_ 2#define _PPC_BOOT_PROM_H_
3 3
4typedef void *phandle;
5typedef void *ihandle;
6
4extern int (*prom) (void *); 7extern int (*prom) (void *);
5extern void *chosen_handle; 8extern phandle chosen_handle;
9extern ihandle stdout;
6 10
7extern void *stdin; 11int call_prom(const char *service, int nargs, int nret, ...);
8extern void *stdout; 12int call_prom_ret(const char *service, int nargs, int nret,
9extern void *stderr; 13 unsigned int *rets, ...);
10 14
11extern int write(void *handle, void *ptr, int nb); 15extern int write(void *handle, void *ptr, int nb);
12extern int read(void *handle, void *ptr, int nb); 16extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);
13extern void exit(void); 17
14extern void pause(void); 18static inline void exit(void)
15extern void *finddevice(const char *); 19{
16extern void *claim(unsigned long virt, unsigned long size, unsigned long align); 20 call_prom("exit", 0, 0);
17extern int getprop(void *phandle, const char *name, void *buf, int buflen); 21}
22
23static inline phandle finddevice(const char *name)
24{
25 return (phandle) call_prom("finddevice", 1, 1, name);
26}
27
28static inline int getprop(void *phandle, const char *name,
29 void *buf, int buflen)
30{
31 return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
32}
33
18#endif /* _PPC_BOOT_PROM_H_ */ 34#endif /* _PPC_BOOT_PROM_H_ */
diff --git a/arch/powerpc/boot/rs6000.h b/arch/powerpc/boot/rs6000.h
new file mode 100644
index 000000000000..433f45084e41
--- /dev/null
+++ b/arch/powerpc/boot/rs6000.h
@@ -0,0 +1,243 @@
1/* IBM RS/6000 "XCOFF" file definitions for BFD.
2 Copyright (C) 1990, 1991 Free Software Foundation, Inc.
3 FIXME: Can someone provide a transliteration of this name into ASCII?
4 Using the following chars caused a compiler warning on HIUX (so I replaced
5 them with octal escapes), and isn't useful without an understanding of what
6 character set it is.
7 Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
8 and John Gilmore of Cygnus Support. */
9
10/********************** FILE HEADER **********************/
11
12struct external_filehdr {
13 char f_magic[2]; /* magic number */
14 char f_nscns[2]; /* number of sections */
15 char f_timdat[4]; /* time & date stamp */
16 char f_symptr[4]; /* file pointer to symtab */
17 char f_nsyms[4]; /* number of symtab entries */
18 char f_opthdr[2]; /* sizeof(optional hdr) */
19 char f_flags[2]; /* flags */
20};
21
22 /* IBM RS/6000 */
23#define U802WRMAGIC 0730 /* writeable text segments **chh** */
24#define U802ROMAGIC 0735 /* readonly sharable text segments */
25#define U802TOCMAGIC 0737 /* readonly text segments and TOC */
26
27#define BADMAG(x) \
28 ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
29 (x).f_magic != U802TOCMAGIC)
30
31#define FILHDR struct external_filehdr
32#define FILHSZ 20
33
34
35/********************** AOUT "OPTIONAL HEADER" **********************/
36
37
38typedef struct
39{
40 unsigned char magic[2]; /* type of file */
41 unsigned char vstamp[2]; /* version stamp */
42 unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */
43 unsigned char dsize[4]; /* initialized data " " */
44 unsigned char bsize[4]; /* uninitialized data " " */
45 unsigned char entry[4]; /* entry pt. */
46 unsigned char text_start[4]; /* base of text used for this file */
47 unsigned char data_start[4]; /* base of data used for this file */
48 unsigned char o_toc[4]; /* address of TOC */
49 unsigned char o_snentry[2]; /* section number of entry point */
50 unsigned char o_sntext[2]; /* section number of .text section */
51 unsigned char o_sndata[2]; /* section number of .data section */
52 unsigned char o_sntoc[2]; /* section number of TOC */
53 unsigned char o_snloader[2]; /* section number of .loader section */
54 unsigned char o_snbss[2]; /* section number of .bss section */
55 unsigned char o_algntext[2]; /* .text alignment */
56 unsigned char o_algndata[2]; /* .data alignment */
57 unsigned char o_modtype[2]; /* module type (??) */
58 unsigned char o_cputype[2]; /* cpu type */
59 unsigned char o_maxstack[4]; /* max stack size (??) */
60 unsigned char o_maxdata[4]; /* max data size (??) */
61 unsigned char o_resv2[12]; /* reserved */
62}
63AOUTHDR;
64
65#define AOUTSZ 72
66#define SMALL_AOUTSZ (28)
67#define AOUTHDRSZ 72
68
69#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
70#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
71#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
72
73
74/********************** SECTION HEADER **********************/
75
76
77struct external_scnhdr {
78 char s_name[8]; /* section name */
79 char s_paddr[4]; /* physical address, aliased s_nlib */
80 char s_vaddr[4]; /* virtual address */
81 char s_size[4]; /* section size */
82 char s_scnptr[4]; /* file ptr to raw data for section */
83 char s_relptr[4]; /* file ptr to relocation */
84 char s_lnnoptr[4]; /* file ptr to line numbers */
85 char s_nreloc[2]; /* number of relocation entries */
86 char s_nlnno[2]; /* number of line number entries*/
87 char s_flags[4]; /* flags */
88};
89
90/*
91 * names of "special" sections
92 */
93#define _TEXT ".text"
94#define _DATA ".data"
95#define _BSS ".bss"
96#define _PAD ".pad"
97#define _LOADER ".loader"
98
99#define SCNHDR struct external_scnhdr
100#define SCNHSZ 40
101
102/* XCOFF uses a special .loader section with type STYP_LOADER. */
103#define STYP_LOADER 0x1000
104
105/* XCOFF uses a special .debug section with type STYP_DEBUG. */
106#define STYP_DEBUG 0x2000
107
108/* XCOFF handles line number or relocation overflow by creating
109 another section header with STYP_OVRFLO set. */
110#define STYP_OVRFLO 0x8000
111
112/********************** LINE NUMBERS **********************/
113
114/* 1 line number entry for every "breakpointable" source line in a section.
115 * Line numbers are grouped on a per function basis; first entry in a function
116 * grouping will have l_lnno = 0 and in place of physical address will be the
117 * symbol table index of the function name.
118 */
119struct external_lineno {
120 union {
121 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
122 char l_paddr[4]; /* (physical) address of line number */
123 } l_addr;
124 char l_lnno[2]; /* line number */
125};
126
127
128#define LINENO struct external_lineno
129#define LINESZ 6
130
131
132/********************** SYMBOLS **********************/
133
134#define E_SYMNMLEN 8 /* # characters in a symbol name */
135#define E_FILNMLEN 14 /* # characters in a file name */
136#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
137
138struct external_syment
139{
140 union {
141 char e_name[E_SYMNMLEN];
142 struct {
143 char e_zeroes[4];
144 char e_offset[4];
145 } e;
146 } e;
147 char e_value[4];
148 char e_scnum[2];
149 char e_type[2];
150 char e_sclass[1];
151 char e_numaux[1];
152};
153
154
155
156#define N_BTMASK (017)
157#define N_TMASK (060)
158#define N_BTSHFT (4)
159#define N_TSHIFT (2)
160
161
162union external_auxent {
163 struct {
164 char x_tagndx[4]; /* str, un, or enum tag indx */
165 union {
166 struct {
167 char x_lnno[2]; /* declaration line number */
168 char x_size[2]; /* str/union/array size */
169 } x_lnsz;
170 char x_fsize[4]; /* size of function */
171 } x_misc;
172 union {
173 struct { /* if ISFCN, tag, or .bb */
174 char x_lnnoptr[4]; /* ptr to fcn line # */
175 char x_endndx[4]; /* entry ndx past block end */
176 } x_fcn;
177 struct { /* if ISARY, up to 4 dimen. */
178 char x_dimen[E_DIMNUM][2];
179 } x_ary;
180 } x_fcnary;
181 char x_tvndx[2]; /* tv index */
182 } x_sym;
183
184 union {
185 char x_fname[E_FILNMLEN];
186 struct {
187 char x_zeroes[4];
188 char x_offset[4];
189 } x_n;
190 } x_file;
191
192 struct {
193 char x_scnlen[4]; /* section length */
194 char x_nreloc[2]; /* # relocation entries */
195 char x_nlinno[2]; /* # line numbers */
196 } x_scn;
197
198 struct {
199 char x_tvfill[4]; /* tv fill value */
200 char x_tvlen[2]; /* length of .tv */
201 char x_tvran[2][2]; /* tv range */
202 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
203
204 struct {
205 unsigned char x_scnlen[4];
206 unsigned char x_parmhash[4];
207 unsigned char x_snhash[2];
208 unsigned char x_smtyp[1];
209 unsigned char x_smclas[1];
210 unsigned char x_stab[4];
211 unsigned char x_snstab[2];
212 } x_csect;
213
214};
215
216#define SYMENT struct external_syment
217#define SYMESZ 18
218#define AUXENT union external_auxent
219#define AUXESZ 18
220#define DBXMASK 0x80 /* for dbx storage mask */
221#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
222
223
224
225/********************** RELOCATION DIRECTIVES **********************/
226
227
228struct external_reloc {
229 char r_vaddr[4];
230 char r_symndx[4];
231 char r_size[1];
232 char r_type[1];
233};
234
235
236#define RELOC struct external_reloc
237#define RELSZ 10
238
239#define DEFAULT_DATA_SECTION_ALIGNMENT 4
240#define DEFAULT_BSS_SECTION_ALIGNMENT 4
241#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
242/* For new sections we havn't heard of before */
243#define DEFAULT_SECTION_ALIGNMENT 4
diff --git a/arch/powerpc/boot/stdio.c b/arch/powerpc/boot/stdio.c
new file mode 100644
index 000000000000..b5aa522f8b77
--- /dev/null
+++ b/arch/powerpc/boot/stdio.c
@@ -0,0 +1,325 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <stdarg.h>
10#include <stddef.h>
11#include "string.h"
12#include "stdio.h"
13#include "prom.h"
14
15size_t strnlen(const char * s, size_t count)
16{
17 const char *sc;
18
19 for (sc = s; count-- && *sc != '\0'; ++sc)
20 /* nothing */;
21 return sc - s;
22}
23
24extern unsigned int __div64_32(unsigned long long *dividend,
25 unsigned int divisor);
26
27/* The unnecessary pointer compare is there
28 * to check for type safety (n must be 64bit)
29 */
30# define do_div(n,base) ({ \
31 unsigned int __base = (base); \
32 unsigned int __rem; \
33 (void)(((typeof((n)) *)0) == ((unsigned long long *)0)); \
34 if (((n) >> 32) == 0) { \
35 __rem = (unsigned int)(n) % __base; \
36 (n) = (unsigned int)(n) / __base; \
37 } else \
38 __rem = __div64_32(&(n), __base); \
39 __rem; \
40 })
41
42static int skip_atoi(const char **s)
43{
44 int i, c;
45
46 for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s)
47 i = i*10 + c - '0';
48 return i;
49}
50
51#define ZEROPAD 1 /* pad with zero */
52#define SIGN 2 /* unsigned/signed long */
53#define PLUS 4 /* show plus */
54#define SPACE 8 /* space if plus */
55#define LEFT 16 /* left justified */
56#define SPECIAL 32 /* 0x */
57#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
58
59static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
60{
61 char c,sign,tmp[66];
62 const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
63 int i;
64
65 if (type & LARGE)
66 digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
67 if (type & LEFT)
68 type &= ~ZEROPAD;
69 if (base < 2 || base > 36)
70 return 0;
71 c = (type & ZEROPAD) ? '0' : ' ';
72 sign = 0;
73 if (type & SIGN) {
74 if ((signed long long)num < 0) {
75 sign = '-';
76 num = - (signed long long)num;
77 size--;
78 } else if (type & PLUS) {
79 sign = '+';
80 size--;
81 } else if (type & SPACE) {
82 sign = ' ';
83 size--;
84 }
85 }
86 if (type & SPECIAL) {
87 if (base == 16)
88 size -= 2;
89 else if (base == 8)
90 size--;
91 }
92 i = 0;
93 if (num == 0)
94 tmp[i++]='0';
95 else while (num != 0) {
96 tmp[i++] = digits[do_div(num, base)];
97 }
98 if (i > precision)
99 precision = i;
100 size -= precision;
101 if (!(type&(ZEROPAD+LEFT)))
102 while(size-->0)
103 *str++ = ' ';
104 if (sign)
105 *str++ = sign;
106 if (type & SPECIAL) {
107 if (base==8)
108 *str++ = '0';
109 else if (base==16) {
110 *str++ = '0';
111 *str++ = digits[33];
112 }
113 }
114 if (!(type & LEFT))
115 while (size-- > 0)
116 *str++ = c;
117 while (i < precision--)
118 *str++ = '0';
119 while (i-- > 0)
120 *str++ = tmp[i];
121 while (size-- > 0)
122 *str++ = ' ';
123 return str;
124}
125
126int vsprintf(char *buf, const char *fmt, va_list args)
127{
128 int len;
129 unsigned long long num;
130 int i, base;
131 char * str;
132 const char *s;
133
134 int flags; /* flags to number() */
135
136 int field_width; /* width of output field */
137 int precision; /* min. # of digits for integers; max
138 number of chars for from string */
139 int qualifier; /* 'h', 'l', or 'L' for integer fields */
140 /* 'z' support added 23/7/1999 S.H. */
141 /* 'z' changed to 'Z' --davidm 1/25/99 */
142
143
144 for (str=buf ; *fmt ; ++fmt) {
145 if (*fmt != '%') {
146 *str++ = *fmt;
147 continue;
148 }
149
150 /* process flags */
151 flags = 0;
152 repeat:
153 ++fmt; /* this also skips first '%' */
154 switch (*fmt) {
155 case '-': flags |= LEFT; goto repeat;
156 case '+': flags |= PLUS; goto repeat;
157 case ' ': flags |= SPACE; goto repeat;
158 case '#': flags |= SPECIAL; goto repeat;
159 case '0': flags |= ZEROPAD; goto repeat;
160 }
161
162 /* get field width */
163 field_width = -1;
164 if ('0' <= *fmt && *fmt <= '9')
165 field_width = skip_atoi(&fmt);
166 else if (*fmt == '*') {
167 ++fmt;
168 /* it's the next argument */
169 field_width = va_arg(args, int);
170 if (field_width < 0) {
171 field_width = -field_width;
172 flags |= LEFT;
173 }
174 }
175
176 /* get the precision */
177 precision = -1;
178 if (*fmt == '.') {
179 ++fmt;
180 if ('0' <= *fmt && *fmt <= '9')
181 precision = skip_atoi(&fmt);
182 else if (*fmt == '*') {
183 ++fmt;
184 /* it's the next argument */
185 precision = va_arg(args, int);
186 }
187 if (precision < 0)
188 precision = 0;
189 }
190
191 /* get the conversion qualifier */
192 qualifier = -1;
193 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
194 qualifier = *fmt;
195 ++fmt;
196 }
197
198 /* default base */
199 base = 10;
200
201 switch (*fmt) {
202 case 'c':
203 if (!(flags & LEFT))
204 while (--field_width > 0)
205 *str++ = ' ';
206 *str++ = (unsigned char) va_arg(args, int);
207 while (--field_width > 0)
208 *str++ = ' ';
209 continue;
210
211 case 's':
212 s = va_arg(args, char *);
213 if (!s)
214 s = "<NULL>";
215
216 len = strnlen(s, precision);
217
218 if (!(flags & LEFT))
219 while (len < field_width--)
220 *str++ = ' ';
221 for (i = 0; i < len; ++i)
222 *str++ = *s++;
223 while (len < field_width--)
224 *str++ = ' ';
225 continue;
226
227 case 'p':
228 if (field_width == -1) {
229 field_width = 2*sizeof(void *);
230 flags |= ZEROPAD;
231 }
232 str = number(str,
233 (unsigned long) va_arg(args, void *), 16,
234 field_width, precision, flags);
235 continue;
236
237
238 case 'n':
239 if (qualifier == 'l') {
240 long * ip = va_arg(args, long *);
241 *ip = (str - buf);
242 } else if (qualifier == 'Z') {
243 size_t * ip = va_arg(args, size_t *);
244 *ip = (str - buf);
245 } else {
246 int * ip = va_arg(args, int *);
247 *ip = (str - buf);
248 }
249 continue;
250
251 case '%':
252 *str++ = '%';
253 continue;
254
255 /* integer number formats - set up the flags and "break" */
256 case 'o':
257 base = 8;
258 break;
259
260 case 'X':
261 flags |= LARGE;
262 case 'x':
263 base = 16;
264 break;
265
266 case 'd':
267 case 'i':
268 flags |= SIGN;
269 case 'u':
270 break;
271
272 default:
273 *str++ = '%';
274 if (*fmt)
275 *str++ = *fmt;
276 else
277 --fmt;
278 continue;
279 }
280 if (qualifier == 'l') {
281 num = va_arg(args, unsigned long);
282 if (flags & SIGN)
283 num = (signed long) num;
284 } else if (qualifier == 'Z') {
285 num = va_arg(args, size_t);
286 } else if (qualifier == 'h') {
287 num = (unsigned short) va_arg(args, int);
288 if (flags & SIGN)
289 num = (signed short) num;
290 } else {
291 num = va_arg(args, unsigned int);
292 if (flags & SIGN)
293 num = (signed int) num;
294 }
295 str = number(str, num, base, field_width, precision, flags);
296 }
297 *str = '\0';
298 return str-buf;
299}
300
301int sprintf(char * buf, const char *fmt, ...)
302{
303 va_list args;
304 int i;
305
306 va_start(args, fmt);
307 i=vsprintf(buf,fmt,args);
308 va_end(args);
309 return i;
310}
311
312static char sprint_buf[1024];
313
314int
315printf(const char *fmt, ...)
316{
317 va_list args;
318 int n;
319
320 va_start(args, fmt);
321 n = vsprintf(sprint_buf, fmt, args);
322 va_end(args);
323 write(stdout, sprint_buf, n);
324 return n;
325}
diff --git a/arch/powerpc/boot/stdio.h b/arch/powerpc/boot/stdio.h
index 24bd3a8dee94..eb9e16c87aef 100644
--- a/arch/powerpc/boot/stdio.h
+++ b/arch/powerpc/boot/stdio.h
@@ -7,10 +7,4 @@ extern int sprintf(char *buf, const char *fmt, ...);
7 7
8extern int vsprintf(char *buf, const char *fmt, va_list args); 8extern int vsprintf(char *buf, const char *fmt, va_list args);
9 9
10extern int putc(int c, void *f);
11extern int putchar(int c);
12extern int getchar(void);
13
14extern int fputs(char *str, void *f);
15
16#endif /* _PPC_BOOT_STDIO_H_ */ 10#endif /* _PPC_BOOT_STDIO_H_ */
diff --git a/arch/powerpc/boot/string.S b/arch/powerpc/boot/string.S
index b1eeaed7db17..ac3d43b6a324 100644
--- a/arch/powerpc/boot/string.S
+++ b/arch/powerpc/boot/string.S
@@ -107,10 +107,12 @@ memcpy:
107 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ 107 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */
108 addi r6,r3,-4 108 addi r6,r3,-4
109 addi r4,r4,-4 109 addi r4,r4,-4
110 beq 2f /* if less than 8 bytes to do */ 110 beq 3f /* if less than 8 bytes to do */
111 andi. r0,r6,3 /* get dest word aligned */ 111 andi. r0,r6,3 /* get dest word aligned */
112 mtctr r7 112 mtctr r7
113 bne 5f 113 bne 5f
114 andi. r0,r4,3 /* check src word aligned too */
115 bne 3f
1141: lwz r7,4(r4) 1161: lwz r7,4(r4)
115 lwzu r8,8(r4) 117 lwzu r8,8(r4)
116 stw r7,4(r6) 118 stw r7,4(r6)
@@ -132,6 +134,11 @@ memcpy:
132 bdnz 4b 134 bdnz 4b
133 blr 135 blr
1345: subfic r0,r0,4 1365: subfic r0,r0,4
137 cmpw cr1,r0,r5
138 add r7,r0,r4
139 andi. r7,r7,3 /* will source be word-aligned too? */
140 ble cr1,3b
141 bne 3b /* do byte-by-byte if not */
135 mtctr r0 142 mtctr r0
1366: lbz r7,4(r4) 1436: lbz r7,4(r4)
137 addi r4,r4,1 144 addi r4,r4,1
@@ -149,10 +156,12 @@ backwards_memcpy:
149 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ 156 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */
150 add r6,r3,r5 157 add r6,r3,r5
151 add r4,r4,r5 158 add r4,r4,r5
152 beq 2f 159 beq 3f
153 andi. r0,r6,3 160 andi. r0,r6,3
154 mtctr r7 161 mtctr r7
155 bne 5f 162 bne 5f
163 andi. r0,r4,3
164 bne 3f
1561: lwz r7,-4(r4) 1651: lwz r7,-4(r4)
157 lwzu r8,-8(r4) 166 lwzu r8,-8(r4)
158 stw r7,-4(r6) 167 stw r7,-4(r6)
@@ -171,7 +180,12 @@ backwards_memcpy:
171 stbu r0,-1(r6) 180 stbu r0,-1(r6)
172 bdnz 4b 181 bdnz 4b
173 blr 182 blr
1745: mtctr r0 1835: cmpw cr1,r0,r5
184 subf r7,r0,r4
185 andi. r7,r7,3
186 ble cr1,3b
187 bne 3b
188 mtctr r0
1756: lbzu r7,-1(r4) 1896: lbzu r7,-1(r4)
176 stbu r7,-1(r6) 190 stbu r7,-1(r6)
177 bdnz 6b 191 bdnz 6b
diff --git a/arch/powerpc/boot/zImage.coff.lds b/arch/powerpc/boot/zImage.coff.lds
new file mode 100644
index 000000000000..6016251a1a2c
--- /dev/null
+++ b/arch/powerpc/boot/zImage.coff.lds
@@ -0,0 +1,46 @@
1OUTPUT_ARCH(powerpc:common)
2ENTRY(_start)
3SECTIONS
4{
5 . = (5*1024*1024);
6 _start = .;
7 .text :
8 {
9 *(.text)
10 *(.fixup)
11 }
12 _etext = .;
13 . = ALIGN(4096);
14 .data :
15 {
16 *(.rodata*)
17 *(.data*)
18 *(.sdata*)
19 __got2_start = .;
20 *(.got2)
21 __got2_end = .;
22
23 _vmlinux_start = .;
24 *(.kernel:vmlinux.strip)
25 _vmlinux_end = .;
26
27 _initrd_start = .;
28 *(.kernel:initrd)
29 _initrd_end = .;
30 }
31
32 . = ALIGN(4096);
33 _edata = .;
34 __bss_start = .;
35 .bss :
36 {
37 *(.sbss)
38 *(.bss)
39 }
40 _end = . ;
41
42 /DISCARD/ :
43 {
44 *(.comment)
45 }
46}
diff --git a/arch/powerpc/configs/mpc834x_sys_defconfig b/arch/powerpc/configs/mpc834x_sys_defconfig
new file mode 100644
index 000000000000..3bff761965c2
--- /dev/null
+++ b/arch/powerpc/configs/mpc834x_sys_defconfig
@@ -0,0 +1,911 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-g461d4edf-dirty
4# Fri Jan 13 11:01:47 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y
15CONFIG_GENERIC_NVRAM=y
16CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y
18CONFIG_PPC_OF=y
19CONFIG_PPC_UDBG_16550=y
20# CONFIG_GENERIC_TBSYNC is not set
21CONFIG_DEFAULT_UIMAGE=y
22
23#
24# Processor support
25#
26# CONFIG_CLASSIC32 is not set
27# CONFIG_PPC_52xx is not set
28# CONFIG_PPC_82xx is not set
29CONFIG_PPC_83xx=y
30# CONFIG_40x is not set
31# CONFIG_44x is not set
32# CONFIG_8xx is not set
33# CONFIG_E200 is not set
34# CONFIG_E500 is not set
35CONFIG_6xx=y
36CONFIG_83xx=y
37CONFIG_PPC_FPU=y
38CONFIG_PPC_STD_MMU=y
39CONFIG_PPC_STD_MMU_32=y
40# CONFIG_SMP is not set
41
42#
43# Code maturity level options
44#
45CONFIG_EXPERIMENTAL=y
46CONFIG_CLEAN_COMPILE=y
47CONFIG_BROKEN_ON_SMP=y
48CONFIG_INIT_ENV_ARG_LIMIT=32
49
50#
51# General setup
52#
53CONFIG_LOCALVERSION=""
54CONFIG_LOCALVERSION_AUTO=y
55CONFIG_SWAP=y
56CONFIG_SYSVIPC=y
57# CONFIG_POSIX_MQUEUE is not set
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61# CONFIG_IKCONFIG is not set
62CONFIG_INITRAMFS_SOURCE=""
63# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
64CONFIG_EMBEDDED=y
65# CONFIG_KALLSYMS is not set
66CONFIG_HOTPLUG=y
67CONFIG_PRINTK=y
68CONFIG_BUG=y
69CONFIG_ELF_CORE=y
70CONFIG_BASE_FULL=y
71CONFIG_FUTEX=y
72# CONFIG_EPOLL is not set
73CONFIG_SHMEM=y
74CONFIG_CC_ALIGN_FUNCTIONS=0
75CONFIG_CC_ALIGN_LABELS=0
76CONFIG_CC_ALIGN_LOOPS=0
77CONFIG_CC_ALIGN_JUMPS=0
78CONFIG_SLAB=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81# CONFIG_SLOB is not set
82
83#
84# Loadable module support
85#
86CONFIG_MODULES=y
87CONFIG_MODULE_UNLOAD=y
88# CONFIG_MODULE_FORCE_UNLOAD is not set
89CONFIG_OBSOLETE_MODPARM=y
90# CONFIG_MODVERSIONS is not set
91# CONFIG_MODULE_SRCVERSION_ALL is not set
92# CONFIG_KMOD is not set
93
94#
95# Block layer
96#
97# CONFIG_LBD is not set
98
99#
100# IO Schedulers
101#
102CONFIG_IOSCHED_NOOP=y
103CONFIG_IOSCHED_AS=y
104CONFIG_IOSCHED_DEADLINE=y
105CONFIG_IOSCHED_CFQ=y
106CONFIG_DEFAULT_AS=y
107# CONFIG_DEFAULT_DEADLINE is not set
108# CONFIG_DEFAULT_CFQ is not set
109# CONFIG_DEFAULT_NOOP is not set
110CONFIG_DEFAULT_IOSCHED="anticipatory"
111CONFIG_PPC_GEN550=y
112# CONFIG_WANT_EARLY_SERIAL is not set
113
114#
115# Platform support
116#
117CONFIG_MPC834x_SYS=y
118CONFIG_MPC834x=y
119
120#
121# Kernel options
122#
123# CONFIG_HIGHMEM is not set
124# CONFIG_HZ_100 is not set
125CONFIG_HZ_250=y
126# CONFIG_HZ_1000 is not set
127CONFIG_HZ=250
128CONFIG_PREEMPT_NONE=y
129# CONFIG_PREEMPT_VOLUNTARY is not set
130# CONFIG_PREEMPT is not set
131CONFIG_BINFMT_ELF=y
132# CONFIG_BINFMT_MISC is not set
133CONFIG_ARCH_FLATMEM_ENABLE=y
134CONFIG_SELECT_MEMORY_MODEL=y
135CONFIG_FLATMEM_MANUAL=y
136# CONFIG_DISCONTIGMEM_MANUAL is not set
137# CONFIG_SPARSEMEM_MANUAL is not set
138CONFIG_FLATMEM=y
139CONFIG_FLAT_NODE_MEM_MAP=y
140# CONFIG_SPARSEMEM_STATIC is not set
141CONFIG_SPLIT_PTLOCK_CPUS=4
142CONFIG_PROC_DEVICETREE=y
143# CONFIG_CMDLINE_BOOL is not set
144# CONFIG_PM is not set
145# CONFIG_SOFTWARE_SUSPEND is not set
146CONFIG_SECCOMP=y
147CONFIG_ISA_DMA_API=y
148
149#
150# Bus options
151#
152CONFIG_GENERIC_ISA_DMA=y
153# CONFIG_PPC_I8259 is not set
154CONFIG_PPC_INDIRECT_PCI=y
155CONFIG_FSL_SOC=y
156CONFIG_PCI=y
157CONFIG_PCI_DOMAINS=y
158# CONFIG_PCI_LEGACY_PROC is not set
159
160#
161# PCCARD (PCMCIA/CardBus) support
162#
163# CONFIG_PCCARD is not set
164
165#
166# PCI Hotplug Support
167#
168# CONFIG_HOTPLUG_PCI is not set
169
170#
171# Advanced setup
172#
173# CONFIG_ADVANCED_OPTIONS is not set
174
175#
176# Default settings for advanced configuration options are used
177#
178CONFIG_HIGHMEM_START=0xfe000000
179CONFIG_LOWMEM_SIZE=0x30000000
180CONFIG_KERNEL_START=0xc0000000
181CONFIG_TASK_SIZE=0x80000000
182CONFIG_BOOT_LOAD=0x00800000
183
184#
185# Networking
186#
187CONFIG_NET=y
188
189#
190# Networking options
191#
192CONFIG_PACKET=y
193# CONFIG_PACKET_MMAP is not set
194CONFIG_UNIX=y
195# CONFIG_NET_KEY is not set
196CONFIG_INET=y
197CONFIG_IP_MULTICAST=y
198# CONFIG_IP_ADVANCED_ROUTER is not set
199CONFIG_IP_FIB_HASH=y
200CONFIG_IP_PNP=y
201CONFIG_IP_PNP_DHCP=y
202CONFIG_IP_PNP_BOOTP=y
203# CONFIG_IP_PNP_RARP is not set
204# CONFIG_NET_IPIP is not set
205# CONFIG_NET_IPGRE is not set
206# CONFIG_IP_MROUTE is not set
207# CONFIG_ARPD is not set
208CONFIG_SYN_COOKIES=y
209# CONFIG_INET_AH is not set
210# CONFIG_INET_ESP is not set
211# CONFIG_INET_IPCOMP is not set
212# CONFIG_INET_TUNNEL is not set
213CONFIG_INET_DIAG=y
214CONFIG_INET_TCP_DIAG=y
215# CONFIG_TCP_CONG_ADVANCED is not set
216CONFIG_TCP_CONG_BIC=y
217# CONFIG_IPV6 is not set
218# CONFIG_NETFILTER is not set
219
220#
221# DCCP Configuration (EXPERIMENTAL)
222#
223# CONFIG_IP_DCCP is not set
224
225#
226# SCTP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_SCTP is not set
229# CONFIG_ATM is not set
230# CONFIG_BRIDGE is not set
231# CONFIG_VLAN_8021Q is not set
232# CONFIG_DECNET is not set
233# CONFIG_LLC2 is not set
234# CONFIG_IPX is not set
235# CONFIG_ATALK is not set
236# CONFIG_X25 is not set
237# CONFIG_LAPB is not set
238# CONFIG_NET_DIVERT is not set
239# CONFIG_ECONET is not set
240# CONFIG_WAN_ROUTER is not set
241
242#
243# QoS and/or fair queueing
244#
245# CONFIG_NET_SCHED is not set
246
247#
248# Network testing
249#
250# CONFIG_NET_PKTGEN is not set
251# CONFIG_HAMRADIO is not set
252# CONFIG_IRDA is not set
253# CONFIG_BT is not set
254# CONFIG_IEEE80211 is not set
255
256#
257# Device Drivers
258#
259
260#
261# Generic Driver Options
262#
263CONFIG_STANDALONE=y
264CONFIG_PREVENT_FIRMWARE_BUILD=y
265# CONFIG_FW_LOADER is not set
266
267#
268# Connector - unified userspace <-> kernelspace linker
269#
270# CONFIG_CONNECTOR is not set
271
272#
273# Memory Technology Devices (MTD)
274#
275# CONFIG_MTD is not set
276
277#
278# Parallel port support
279#
280# CONFIG_PARPORT is not set
281
282#
283# Plug and Play support
284#
285
286#
287# Block devices
288#
289# CONFIG_BLK_DEV_FD is not set
290# CONFIG_BLK_CPQ_DA is not set
291# CONFIG_BLK_CPQ_CISS_DA is not set
292# CONFIG_BLK_DEV_DAC960 is not set
293# CONFIG_BLK_DEV_UMEM is not set
294# CONFIG_BLK_DEV_COW_COMMON is not set
295CONFIG_BLK_DEV_LOOP=y
296# CONFIG_BLK_DEV_CRYPTOLOOP is not set
297# CONFIG_BLK_DEV_NBD is not set
298# CONFIG_BLK_DEV_SX8 is not set
299CONFIG_BLK_DEV_RAM=y
300CONFIG_BLK_DEV_RAM_COUNT=16
301CONFIG_BLK_DEV_RAM_SIZE=32768
302CONFIG_BLK_DEV_INITRD=y
303# CONFIG_CDROM_PKTCDVD is not set
304# CONFIG_ATA_OVER_ETH is not set
305
306#
307# ATA/ATAPI/MFM/RLL support
308#
309# CONFIG_IDE is not set
310
311#
312# SCSI device support
313#
314# CONFIG_RAID_ATTRS is not set
315# CONFIG_SCSI is not set
316
317#
318# Multi-device support (RAID and LVM)
319#
320# CONFIG_MD is not set
321
322#
323# Fusion MPT device support
324#
325# CONFIG_FUSION is not set
326
327#
328# IEEE 1394 (FireWire) support
329#
330# CONFIG_IEEE1394 is not set
331
332#
333# I2O device support
334#
335# CONFIG_I2O is not set
336
337#
338# Macintosh device drivers
339#
340# CONFIG_WINDFARM is not set
341
342#
343# Network device support
344#
345CONFIG_NETDEVICES=y
346# CONFIG_DUMMY is not set
347# CONFIG_BONDING is not set
348# CONFIG_EQUALIZER is not set
349# CONFIG_TUN is not set
350
351#
352# ARCnet devices
353#
354# CONFIG_ARCNET is not set
355
356#
357# PHY device support
358#
359CONFIG_PHYLIB=y
360
361#
362# MII PHY device drivers
363#
364CONFIG_MARVELL_PHY=y
365# CONFIG_DAVICOM_PHY is not set
366# CONFIG_QSEMI_PHY is not set
367# CONFIG_LXT_PHY is not set
368# CONFIG_CICADA_PHY is not set
369
370#
371# Ethernet (10 or 100Mbit)
372#
373CONFIG_NET_ETHERNET=y
374CONFIG_MII=y
375# CONFIG_HAPPYMEAL is not set
376# CONFIG_SUNGEM is not set
377# CONFIG_CASSINI is not set
378# CONFIG_NET_VENDOR_3COM is not set
379
380#
381# Tulip family network device support
382#
383# CONFIG_NET_TULIP is not set
384# CONFIG_HP100 is not set
385CONFIG_NET_PCI=y
386# CONFIG_PCNET32 is not set
387# CONFIG_AMD8111_ETH is not set
388# CONFIG_ADAPTEC_STARFIRE is not set
389# CONFIG_B44 is not set
390# CONFIG_FORCEDETH is not set
391# CONFIG_DGRS is not set
392# CONFIG_EEPRO100 is not set
393CONFIG_E100=y
394# CONFIG_FEALNX is not set
395# CONFIG_NATSEMI is not set
396# CONFIG_NE2K_PCI is not set
397# CONFIG_8139CP is not set
398# CONFIG_8139TOO is not set
399# CONFIG_SIS900 is not set
400# CONFIG_EPIC100 is not set
401# CONFIG_SUNDANCE is not set
402# CONFIG_TLAN is not set
403# CONFIG_VIA_RHINE is not set
404
405#
406# Ethernet (1000 Mbit)
407#
408# CONFIG_ACENIC is not set
409# CONFIG_DL2K is not set
410# CONFIG_E1000 is not set
411# CONFIG_NS83820 is not set
412# CONFIG_HAMACHI is not set
413# CONFIG_YELLOWFIN is not set
414# CONFIG_R8169 is not set
415# CONFIG_SIS190 is not set
416# CONFIG_SKGE is not set
417# CONFIG_SKY2 is not set
418# CONFIG_SK98LIN is not set
419# CONFIG_VIA_VELOCITY is not set
420# CONFIG_TIGON3 is not set
421# CONFIG_BNX2 is not set
422CONFIG_GIANFAR=y
423# CONFIG_GFAR_NAPI is not set
424
425#
426# Ethernet (10000 Mbit)
427#
428# CONFIG_CHELSIO_T1 is not set
429# CONFIG_IXGB is not set
430# CONFIG_S2IO is not set
431
432#
433# Token Ring devices
434#
435# CONFIG_TR is not set
436
437#
438# Wireless LAN (non-hamradio)
439#
440# CONFIG_NET_RADIO is not set
441
442#
443# Wan interfaces
444#
445# CONFIG_WAN is not set
446# CONFIG_FDDI is not set
447# CONFIG_HIPPI is not set
448# CONFIG_PPP is not set
449# CONFIG_SLIP is not set
450# CONFIG_SHAPER is not set
451# CONFIG_NETCONSOLE is not set
452# CONFIG_NETPOLL is not set
453# CONFIG_NET_POLL_CONTROLLER is not set
454
455#
456# ISDN subsystem
457#
458# CONFIG_ISDN is not set
459
460#
461# Telephony Support
462#
463# CONFIG_PHONE is not set
464
465#
466# Input device support
467#
468CONFIG_INPUT=y
469
470#
471# Userland interfaces
472#
473# CONFIG_INPUT_MOUSEDEV is not set
474# CONFIG_INPUT_JOYDEV is not set
475# CONFIG_INPUT_TSDEV is not set
476# CONFIG_INPUT_EVDEV is not set
477# CONFIG_INPUT_EVBUG is not set
478
479#
480# Input Device Drivers
481#
482# CONFIG_INPUT_KEYBOARD is not set
483# CONFIG_INPUT_MOUSE is not set
484# CONFIG_INPUT_JOYSTICK is not set
485# CONFIG_INPUT_TOUCHSCREEN is not set
486# CONFIG_INPUT_MISC is not set
487
488#
489# Hardware I/O ports
490#
491# CONFIG_SERIO is not set
492# CONFIG_GAMEPORT is not set
493
494#
495# Character devices
496#
497# CONFIG_VT is not set
498# CONFIG_SERIAL_NONSTANDARD is not set
499
500#
501# Serial drivers
502#
503CONFIG_SERIAL_8250=y
504CONFIG_SERIAL_8250_CONSOLE=y
505CONFIG_SERIAL_8250_NR_UARTS=4
506CONFIG_SERIAL_8250_RUNTIME_UARTS=4
507# CONFIG_SERIAL_8250_EXTENDED is not set
508
509#
510# Non-8250 serial port support
511#
512CONFIG_SERIAL_CORE=y
513CONFIG_SERIAL_CORE_CONSOLE=y
514CONFIG_UNIX98_PTYS=y
515CONFIG_LEGACY_PTYS=y
516CONFIG_LEGACY_PTY_COUNT=256
517
518#
519# IPMI
520#
521# CONFIG_IPMI_HANDLER is not set
522
523#
524# Watchdog Cards
525#
526CONFIG_WATCHDOG=y
527# CONFIG_WATCHDOG_NOWAYOUT is not set
528
529#
530# Watchdog Device Drivers
531#
532# CONFIG_SOFT_WATCHDOG is not set
533CONFIG_83xx_WDT=y
534
535#
536# PCI-based Watchdog Cards
537#
538# CONFIG_PCIPCWATCHDOG is not set
539# CONFIG_WDTPCI is not set
540# CONFIG_NVRAM is not set
541CONFIG_GEN_RTC=y
542# CONFIG_GEN_RTC_X is not set
543# CONFIG_DTLK is not set
544# CONFIG_R3964 is not set
545# CONFIG_APPLICOM is not set
546
547#
548# Ftape, the floppy tape device driver
549#
550# CONFIG_AGP is not set
551# CONFIG_DRM is not set
552# CONFIG_RAW_DRIVER is not set
553
554#
555# TPM devices
556#
557# CONFIG_TCG_TPM is not set
558# CONFIG_TELCLOCK is not set
559
560#
561# I2C support
562#
563CONFIG_I2C=y
564CONFIG_I2C_CHARDEV=y
565
566#
567# I2C Algorithms
568#
569# CONFIG_I2C_ALGOBIT is not set
570# CONFIG_I2C_ALGOPCF is not set
571# CONFIG_I2C_ALGOPCA is not set
572
573#
574# I2C Hardware Bus support
575#
576# CONFIG_I2C_ALI1535 is not set
577# CONFIG_I2C_ALI1563 is not set
578# CONFIG_I2C_ALI15X3 is not set
579# CONFIG_I2C_AMD756 is not set
580# CONFIG_I2C_AMD8111 is not set
581# CONFIG_I2C_I801 is not set
582# CONFIG_I2C_I810 is not set
583# CONFIG_I2C_PIIX4 is not set
584CONFIG_I2C_MPC=y
585# CONFIG_I2C_NFORCE2 is not set
586# CONFIG_I2C_PARPORT_LIGHT is not set
587# CONFIG_I2C_PROSAVAGE is not set
588# CONFIG_I2C_SAVAGE4 is not set
589# CONFIG_SCx200_ACB is not set
590# CONFIG_I2C_SIS5595 is not set
591# CONFIG_I2C_SIS630 is not set
592# CONFIG_I2C_SIS96X is not set
593# CONFIG_I2C_STUB is not set
594# CONFIG_I2C_VIA is not set
595# CONFIG_I2C_VIAPRO is not set
596# CONFIG_I2C_VOODOO3 is not set
597# CONFIG_I2C_PCA_ISA is not set
598
599#
600# Miscellaneous I2C Chip support
601#
602# CONFIG_SENSORS_DS1337 is not set
603# CONFIG_SENSORS_DS1374 is not set
604# CONFIG_SENSORS_EEPROM is not set
605# CONFIG_SENSORS_PCF8574 is not set
606# CONFIG_SENSORS_PCA9539 is not set
607# CONFIG_SENSORS_PCF8591 is not set
608# CONFIG_SENSORS_RTC8564 is not set
609# CONFIG_SENSORS_M41T00 is not set
610# CONFIG_SENSORS_MAX6875 is not set
611# CONFIG_RTC_X1205_I2C is not set
612# CONFIG_I2C_DEBUG_CORE is not set
613# CONFIG_I2C_DEBUG_ALGO is not set
614# CONFIG_I2C_DEBUG_BUS is not set
615# CONFIG_I2C_DEBUG_CHIP is not set
616
617#
618# Dallas's 1-wire bus
619#
620# CONFIG_W1 is not set
621
622#
623# Hardware Monitoring support
624#
625CONFIG_HWMON=y
626# CONFIG_HWMON_VID is not set
627# CONFIG_SENSORS_ADM1021 is not set
628# CONFIG_SENSORS_ADM1025 is not set
629# CONFIG_SENSORS_ADM1026 is not set
630# CONFIG_SENSORS_ADM1031 is not set
631# CONFIG_SENSORS_ADM9240 is not set
632# CONFIG_SENSORS_ASB100 is not set
633# CONFIG_SENSORS_ATXP1 is not set
634# CONFIG_SENSORS_DS1621 is not set
635# CONFIG_SENSORS_FSCHER is not set
636# CONFIG_SENSORS_FSCPOS is not set
637# CONFIG_SENSORS_GL518SM is not set
638# CONFIG_SENSORS_GL520SM is not set
639# CONFIG_SENSORS_IT87 is not set
640# CONFIG_SENSORS_LM63 is not set
641# CONFIG_SENSORS_LM75 is not set
642# CONFIG_SENSORS_LM77 is not set
643# CONFIG_SENSORS_LM78 is not set
644# CONFIG_SENSORS_LM80 is not set
645# CONFIG_SENSORS_LM83 is not set
646# CONFIG_SENSORS_LM85 is not set
647# CONFIG_SENSORS_LM87 is not set
648# CONFIG_SENSORS_LM90 is not set
649# CONFIG_SENSORS_LM92 is not set
650# CONFIG_SENSORS_MAX1619 is not set
651# CONFIG_SENSORS_PC87360 is not set
652# CONFIG_SENSORS_SIS5595 is not set
653# CONFIG_SENSORS_SMSC47M1 is not set
654# CONFIG_SENSORS_SMSC47B397 is not set
655# CONFIG_SENSORS_VIA686A is not set
656# CONFIG_SENSORS_VT8231 is not set
657# CONFIG_SENSORS_W83781D is not set
658# CONFIG_SENSORS_W83792D is not set
659# CONFIG_SENSORS_W83L785TS is not set
660# CONFIG_SENSORS_W83627HF is not set
661# CONFIG_SENSORS_W83627EHF is not set
662# CONFIG_HWMON_DEBUG_CHIP is not set
663
664#
665# Misc devices
666#
667
668#
669# Multimedia Capabilities Port drivers
670#
671
672#
673# Multimedia devices
674#
675# CONFIG_VIDEO_DEV is not set
676
677#
678# Digital Video Broadcasting Devices
679#
680# CONFIG_DVB is not set
681
682#
683# Graphics support
684#
685# CONFIG_FB is not set
686
687#
688# Sound
689#
690# CONFIG_SOUND is not set
691
692#
693# USB support
694#
695CONFIG_USB_ARCH_HAS_HCD=y
696CONFIG_USB_ARCH_HAS_OHCI=y
697# CONFIG_USB is not set
698
699#
700# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
701#
702
703#
704# USB Gadget Support
705#
706# CONFIG_USB_GADGET is not set
707
708#
709# MMC/SD Card support
710#
711# CONFIG_MMC is not set
712
713#
714# InfiniBand support
715#
716# CONFIG_INFINIBAND is not set
717
718#
719# SN Devices
720#
721
722#
723# File systems
724#
725CONFIG_EXT2_FS=y
726# CONFIG_EXT2_FS_XATTR is not set
727# CONFIG_EXT2_FS_XIP is not set
728CONFIG_EXT3_FS=y
729CONFIG_EXT3_FS_XATTR=y
730# CONFIG_EXT3_FS_POSIX_ACL is not set
731# CONFIG_EXT3_FS_SECURITY is not set
732CONFIG_JBD=y
733# CONFIG_JBD_DEBUG is not set
734CONFIG_FS_MBCACHE=y
735# CONFIG_REISERFS_FS is not set
736# CONFIG_JFS_FS is not set
737# CONFIG_FS_POSIX_ACL is not set
738# CONFIG_XFS_FS is not set
739# CONFIG_OCFS2_FS is not set
740# CONFIG_MINIX_FS is not set
741# CONFIG_ROMFS_FS is not set
742CONFIG_INOTIFY=y
743# CONFIG_QUOTA is not set
744CONFIG_DNOTIFY=y
745# CONFIG_AUTOFS_FS is not set
746# CONFIG_AUTOFS4_FS is not set
747# CONFIG_FUSE_FS is not set
748
749#
750# CD-ROM/DVD Filesystems
751#
752# CONFIG_ISO9660_FS is not set
753# CONFIG_UDF_FS is not set
754
755#
756# DOS/FAT/NT Filesystems
757#
758# CONFIG_MSDOS_FS is not set
759# CONFIG_VFAT_FS is not set
760# CONFIG_NTFS_FS is not set
761
762#
763# Pseudo filesystems
764#
765CONFIG_PROC_FS=y
766CONFIG_PROC_KCORE=y
767CONFIG_SYSFS=y
768CONFIG_TMPFS=y
769# CONFIG_HUGETLB_PAGE is not set
770CONFIG_RAMFS=y
771# CONFIG_RELAYFS_FS is not set
772# CONFIG_CONFIGFS_FS is not set
773
774#
775# Miscellaneous filesystems
776#
777# CONFIG_ADFS_FS is not set
778# CONFIG_AFFS_FS is not set
779# CONFIG_HFS_FS is not set
780# CONFIG_HFSPLUS_FS is not set
781# CONFIG_BEFS_FS is not set
782# CONFIG_BFS_FS is not set
783# CONFIG_EFS_FS is not set
784# CONFIG_CRAMFS is not set
785# CONFIG_VXFS_FS is not set
786# CONFIG_HPFS_FS is not set
787# CONFIG_QNX4FS_FS is not set
788# CONFIG_SYSV_FS is not set
789# CONFIG_UFS_FS is not set
790
791#
792# Network File Systems
793#
794CONFIG_NFS_FS=y
795CONFIG_NFS_V3=y
796# CONFIG_NFS_V3_ACL is not set
797CONFIG_NFS_V4=y
798# CONFIG_NFS_DIRECTIO is not set
799# CONFIG_NFSD is not set
800CONFIG_ROOT_NFS=y
801CONFIG_LOCKD=y
802CONFIG_LOCKD_V4=y
803CONFIG_NFS_COMMON=y
804CONFIG_SUNRPC=y
805CONFIG_SUNRPC_GSS=y
806CONFIG_RPCSEC_GSS_KRB5=y
807# CONFIG_RPCSEC_GSS_SPKM3 is not set
808# CONFIG_SMB_FS is not set
809# CONFIG_CIFS is not set
810# CONFIG_NCP_FS is not set
811# CONFIG_CODA_FS is not set
812# CONFIG_AFS_FS is not set
813# CONFIG_9P_FS is not set
814
815#
816# Partition Types
817#
818CONFIG_PARTITION_ADVANCED=y
819# CONFIG_ACORN_PARTITION is not set
820# CONFIG_OSF_PARTITION is not set
821# CONFIG_AMIGA_PARTITION is not set
822# CONFIG_ATARI_PARTITION is not set
823# CONFIG_MAC_PARTITION is not set
824# CONFIG_MSDOS_PARTITION is not set
825# CONFIG_LDM_PARTITION is not set
826# CONFIG_SGI_PARTITION is not set
827# CONFIG_ULTRIX_PARTITION is not set
828# CONFIG_SUN_PARTITION is not set
829# CONFIG_EFI_PARTITION is not set
830
831#
832# Native Language Support
833#
834# CONFIG_NLS is not set
835
836#
837# Library routines
838#
839# CONFIG_CRC_CCITT is not set
840# CONFIG_CRC16 is not set
841CONFIG_CRC32=y
842# CONFIG_LIBCRC32C is not set
843
844#
845# Instrumentation Support
846#
847# CONFIG_PROFILING is not set
848
849#
850# Kernel hacking
851#
852# CONFIG_PRINTK_TIME is not set
853# CONFIG_MAGIC_SYSRQ is not set
854# CONFIG_DEBUG_KERNEL is not set
855CONFIG_LOG_BUF_SHIFT=14
856# CONFIG_BOOTX_TEXT is not set
857# CONFIG_SERIAL_TEXT_DEBUG is not set
858# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
859# CONFIG_PPC_EARLY_DEBUG_G5 is not set
860# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
861# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
862# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
863
864#
865# Security options
866#
867# CONFIG_KEYS is not set
868# CONFIG_SECURITY is not set
869
870#
871# Cryptographic options
872#
873CONFIG_CRYPTO=y
874# CONFIG_CRYPTO_HMAC is not set
875# CONFIG_CRYPTO_NULL is not set
876# CONFIG_CRYPTO_MD4 is not set
877CONFIG_CRYPTO_MD5=y
878# CONFIG_CRYPTO_SHA1 is not set
879# CONFIG_CRYPTO_SHA256 is not set
880# CONFIG_CRYPTO_SHA512 is not set
881# CONFIG_CRYPTO_WP512 is not set
882# CONFIG_CRYPTO_TGR192 is not set
883CONFIG_CRYPTO_DES=y
884# CONFIG_CRYPTO_BLOWFISH is not set
885# CONFIG_CRYPTO_TWOFISH is not set
886# CONFIG_CRYPTO_SERPENT is not set
887# CONFIG_CRYPTO_AES is not set
888# CONFIG_CRYPTO_CAST5 is not set
889# CONFIG_CRYPTO_CAST6 is not set
890# CONFIG_CRYPTO_TEA is not set
891# CONFIG_CRYPTO_ARC4 is not set
892# CONFIG_CRYPTO_KHAZAD is not set
893# CONFIG_CRYPTO_ANUBIS is not set
894# CONFIG_CRYPTO_DEFLATE is not set
895# CONFIG_CRYPTO_MICHAEL_MIC is not set
896# CONFIG_CRYPTO_CRC32C is not set
897# CONFIG_CRYPTO_TEST is not set
898
899#
900# Hardware crypto devices
901#
902
903#
904# SEC2.x Options
905#
906CONFIG_MPC8349E_SEC2x=y
907
908#
909# SEC2.x Test Options
910#
911CONFIG_MPC8349E_SEC2xTEST=y
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 56399c5c931a..840aad43a98b 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -135,7 +135,7 @@ int main(void)
135 DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc)); 135 DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc));
136 DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb)); 136 DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb));
137 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp)); 137 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
138 DEFINE(PACALPPACA, offsetof(struct paca_struct, lppaca)); 138 DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
139 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); 139 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
140 140
141 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); 141 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S
index cca942fe6115..b61d86e7ceb6 100644
--- a/arch/powerpc/kernel/cpu_setup_power4.S
+++ b/arch/powerpc/kernel/cpu_setup_power4.S
@@ -130,7 +130,7 @@ _GLOBAL(__save_cpu_setup)
130 mfcr r7 130 mfcr r7
131 131
132 /* Get storage ptr */ 132 /* Get storage ptr */
133 LOADADDR(r5,cpu_state_storage) 133 LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
134 134
135 /* We only deal with 970 for now */ 135 /* We only deal with 970 for now */
136 mfspr r0,SPRN_PVR 136 mfspr r0,SPRN_PVR
@@ -164,7 +164,7 @@ _GLOBAL(__restore_cpu_setup)
164 /* Get storage ptr (FIXME when using anton reloc as we 164 /* Get storage ptr (FIXME when using anton reloc as we
165 * are running with translation disabled here 165 * are running with translation disabled here
166 */ 166 */
167 LOADADDR(r5,cpu_state_storage) 167 LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
168 168
169 /* We only deal with 970 for now */ 169 /* We only deal with 970 for now */
170 mfspr r0,SPRN_PVR 170 mfspr r0,SPRN_PVR
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 43c74a6b07b1..10696456a4c6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -55,7 +55,8 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
55#define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4) 55#define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
56#define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5) 56#define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5)
57#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS) 57#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS)
58 58#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
59 PPC_FEATURE_BOOKE)
59 60
60/* We only set the spe features if the kernel was compiled with 61/* We only set the spe features if the kernel was compiled with
61 * spe support 62 * spe support
@@ -79,7 +80,8 @@ struct cpu_spec cpu_specs[] = {
79 .num_pmcs = 8, 80 .num_pmcs = 8,
80 .cpu_setup = __setup_cpu_power3, 81 .cpu_setup = __setup_cpu_power3,
81 .oprofile_cpu_type = "ppc64/power3", 82 .oprofile_cpu_type = "ppc64/power3",
82 .oprofile_type = RS64, 83 .oprofile_type = PPC_OPROFILE_RS64,
84 .platform = "power3",
83 }, 85 },
84 { /* Power3+ */ 86 { /* Power3+ */
85 .pvr_mask = 0xffff0000, 87 .pvr_mask = 0xffff0000,
@@ -92,7 +94,8 @@ struct cpu_spec cpu_specs[] = {
92 .num_pmcs = 8, 94 .num_pmcs = 8,
93 .cpu_setup = __setup_cpu_power3, 95 .cpu_setup = __setup_cpu_power3,
94 .oprofile_cpu_type = "ppc64/power3", 96 .oprofile_cpu_type = "ppc64/power3",
95 .oprofile_type = RS64, 97 .oprofile_type = PPC_OPROFILE_RS64,
98 .platform = "power3",
96 }, 99 },
97 { /* Northstar */ 100 { /* Northstar */
98 .pvr_mask = 0xffff0000, 101 .pvr_mask = 0xffff0000,
@@ -105,7 +108,8 @@ struct cpu_spec cpu_specs[] = {
105 .num_pmcs = 8, 108 .num_pmcs = 8,
106 .cpu_setup = __setup_cpu_power3, 109 .cpu_setup = __setup_cpu_power3,
107 .oprofile_cpu_type = "ppc64/rs64", 110 .oprofile_cpu_type = "ppc64/rs64",
108 .oprofile_type = RS64, 111 .oprofile_type = PPC_OPROFILE_RS64,
112 .platform = "rs64",
109 }, 113 },
110 { /* Pulsar */ 114 { /* Pulsar */
111 .pvr_mask = 0xffff0000, 115 .pvr_mask = 0xffff0000,
@@ -118,7 +122,8 @@ struct cpu_spec cpu_specs[] = {
118 .num_pmcs = 8, 122 .num_pmcs = 8,
119 .cpu_setup = __setup_cpu_power3, 123 .cpu_setup = __setup_cpu_power3,
120 .oprofile_cpu_type = "ppc64/rs64", 124 .oprofile_cpu_type = "ppc64/rs64",
121 .oprofile_type = RS64, 125 .oprofile_type = PPC_OPROFILE_RS64,
126 .platform = "rs64",
122 }, 127 },
123 { /* I-star */ 128 { /* I-star */
124 .pvr_mask = 0xffff0000, 129 .pvr_mask = 0xffff0000,
@@ -131,7 +136,8 @@ struct cpu_spec cpu_specs[] = {
131 .num_pmcs = 8, 136 .num_pmcs = 8,
132 .cpu_setup = __setup_cpu_power3, 137 .cpu_setup = __setup_cpu_power3,
133 .oprofile_cpu_type = "ppc64/rs64", 138 .oprofile_cpu_type = "ppc64/rs64",
134 .oprofile_type = RS64, 139 .oprofile_type = PPC_OPROFILE_RS64,
140 .platform = "rs64",
135 }, 141 },
136 { /* S-star */ 142 { /* S-star */
137 .pvr_mask = 0xffff0000, 143 .pvr_mask = 0xffff0000,
@@ -144,7 +150,8 @@ struct cpu_spec cpu_specs[] = {
144 .num_pmcs = 8, 150 .num_pmcs = 8,
145 .cpu_setup = __setup_cpu_power3, 151 .cpu_setup = __setup_cpu_power3,
146 .oprofile_cpu_type = "ppc64/rs64", 152 .oprofile_cpu_type = "ppc64/rs64",
147 .oprofile_type = RS64, 153 .oprofile_type = PPC_OPROFILE_RS64,
154 .platform = "rs64",
148 }, 155 },
149 { /* Power4 */ 156 { /* Power4 */
150 .pvr_mask = 0xffff0000, 157 .pvr_mask = 0xffff0000,
@@ -157,7 +164,8 @@ struct cpu_spec cpu_specs[] = {
157 .num_pmcs = 8, 164 .num_pmcs = 8,
158 .cpu_setup = __setup_cpu_power4, 165 .cpu_setup = __setup_cpu_power4,
159 .oprofile_cpu_type = "ppc64/power4", 166 .oprofile_cpu_type = "ppc64/power4",
160 .oprofile_type = POWER4, 167 .oprofile_type = PPC_OPROFILE_POWER4,
168 .platform = "power4",
161 }, 169 },
162 { /* Power4+ */ 170 { /* Power4+ */
163 .pvr_mask = 0xffff0000, 171 .pvr_mask = 0xffff0000,
@@ -170,7 +178,8 @@ struct cpu_spec cpu_specs[] = {
170 .num_pmcs = 8, 178 .num_pmcs = 8,
171 .cpu_setup = __setup_cpu_power4, 179 .cpu_setup = __setup_cpu_power4,
172 .oprofile_cpu_type = "ppc64/power4", 180 .oprofile_cpu_type = "ppc64/power4",
173 .oprofile_type = POWER4, 181 .oprofile_type = PPC_OPROFILE_POWER4,
182 .platform = "power4",
174 }, 183 },
175 { /* PPC970 */ 184 { /* PPC970 */
176 .pvr_mask = 0xffff0000, 185 .pvr_mask = 0xffff0000,
@@ -184,7 +193,8 @@ struct cpu_spec cpu_specs[] = {
184 .num_pmcs = 8, 193 .num_pmcs = 8,
185 .cpu_setup = __setup_cpu_ppc970, 194 .cpu_setup = __setup_cpu_ppc970,
186 .oprofile_cpu_type = "ppc64/970", 195 .oprofile_cpu_type = "ppc64/970",
187 .oprofile_type = POWER4, 196 .oprofile_type = PPC_OPROFILE_POWER4,
197 .platform = "ppc970",
188 }, 198 },
189#endif /* CONFIG_PPC64 */ 199#endif /* CONFIG_PPC64 */
190#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4) 200#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4)
@@ -204,7 +214,8 @@ struct cpu_spec cpu_specs[] = {
204 .num_pmcs = 8, 214 .num_pmcs = 8,
205 .cpu_setup = __setup_cpu_ppc970, 215 .cpu_setup = __setup_cpu_ppc970,
206 .oprofile_cpu_type = "ppc64/970", 216 .oprofile_cpu_type = "ppc64/970",
207 .oprofile_type = POWER4, 217 .oprofile_type = PPC_OPROFILE_POWER4,
218 .platform = "ppc970",
208 }, 219 },
209#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */ 220#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */
210#ifdef CONFIG_PPC64 221#ifdef CONFIG_PPC64
@@ -219,7 +230,8 @@ struct cpu_spec cpu_specs[] = {
219 .dcache_bsize = 128, 230 .dcache_bsize = 128,
220 .cpu_setup = __setup_cpu_ppc970, 231 .cpu_setup = __setup_cpu_ppc970,
221 .oprofile_cpu_type = "ppc64/970", 232 .oprofile_cpu_type = "ppc64/970",
222 .oprofile_type = POWER4, 233 .oprofile_type = PPC_OPROFILE_POWER4,
234 .platform = "ppc970",
223 }, 235 },
224 { /* Power5 GR */ 236 { /* Power5 GR */
225 .pvr_mask = 0xffff0000, 237 .pvr_mask = 0xffff0000,
@@ -232,7 +244,8 @@ struct cpu_spec cpu_specs[] = {
232 .num_pmcs = 6, 244 .num_pmcs = 6,
233 .cpu_setup = __setup_cpu_power4, 245 .cpu_setup = __setup_cpu_power4,
234 .oprofile_cpu_type = "ppc64/power5", 246 .oprofile_cpu_type = "ppc64/power5",
235 .oprofile_type = POWER4, 247 .oprofile_type = PPC_OPROFILE_POWER4,
248 .platform = "power5",
236 }, 249 },
237 { /* Power5 GS */ 250 { /* Power5 GS */
238 .pvr_mask = 0xffff0000, 251 .pvr_mask = 0xffff0000,
@@ -245,7 +258,8 @@ struct cpu_spec cpu_specs[] = {
245 .num_pmcs = 6, 258 .num_pmcs = 6,
246 .cpu_setup = __setup_cpu_power4, 259 .cpu_setup = __setup_cpu_power4,
247 .oprofile_cpu_type = "ppc64/power5+", 260 .oprofile_cpu_type = "ppc64/power5+",
248 .oprofile_type = POWER4, 261 .oprofile_type = PPC_OPROFILE_POWER4,
262 .platform = "power5+",
249 }, 263 },
250 { /* Cell Broadband Engine */ 264 { /* Cell Broadband Engine */
251 .pvr_mask = 0xffff0000, 265 .pvr_mask = 0xffff0000,
@@ -257,6 +271,7 @@ struct cpu_spec cpu_specs[] = {
257 .icache_bsize = 128, 271 .icache_bsize = 128,
258 .dcache_bsize = 128, 272 .dcache_bsize = 128,
259 .cpu_setup = __setup_cpu_be, 273 .cpu_setup = __setup_cpu_be,
274 .platform = "ppc-cell-be",
260 }, 275 },
261 { /* default match */ 276 { /* default match */
262 .pvr_mask = 0x00000000, 277 .pvr_mask = 0x00000000,
@@ -268,6 +283,7 @@ struct cpu_spec cpu_specs[] = {
268 .dcache_bsize = 128, 283 .dcache_bsize = 128,
269 .num_pmcs = 6, 284 .num_pmcs = 6,
270 .cpu_setup = __setup_cpu_power4, 285 .cpu_setup = __setup_cpu_power4,
286 .platform = "power4",
271 } 287 }
272#endif /* CONFIG_PPC64 */ 288#endif /* CONFIG_PPC64 */
273#ifdef CONFIG_PPC32 289#ifdef CONFIG_PPC32
@@ -281,6 +297,7 @@ struct cpu_spec cpu_specs[] = {
281 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB, 297 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
282 .icache_bsize = 32, 298 .icache_bsize = 32,
283 .dcache_bsize = 32, 299 .dcache_bsize = 32,
300 .platform = "ppc601",
284 }, 301 },
285 { /* 603 */ 302 { /* 603 */
286 .pvr_mask = 0xffff0000, 303 .pvr_mask = 0xffff0000,
@@ -290,7 +307,8 @@ struct cpu_spec cpu_specs[] = {
290 .cpu_user_features = COMMON_USER, 307 .cpu_user_features = COMMON_USER,
291 .icache_bsize = 32, 308 .icache_bsize = 32,
292 .dcache_bsize = 32, 309 .dcache_bsize = 32,
293 .cpu_setup = __setup_cpu_603 310 .cpu_setup = __setup_cpu_603,
311 .platform = "ppc603",
294 }, 312 },
295 { /* 603e */ 313 { /* 603e */
296 .pvr_mask = 0xffff0000, 314 .pvr_mask = 0xffff0000,
@@ -300,7 +318,8 @@ struct cpu_spec cpu_specs[] = {
300 .cpu_user_features = COMMON_USER, 318 .cpu_user_features = COMMON_USER,
301 .icache_bsize = 32, 319 .icache_bsize = 32,
302 .dcache_bsize = 32, 320 .dcache_bsize = 32,
303 .cpu_setup = __setup_cpu_603 321 .cpu_setup = __setup_cpu_603,
322 .platform = "ppc603",
304 }, 323 },
305 { /* 603ev */ 324 { /* 603ev */
306 .pvr_mask = 0xffff0000, 325 .pvr_mask = 0xffff0000,
@@ -310,7 +329,8 @@ struct cpu_spec cpu_specs[] = {
310 .cpu_user_features = COMMON_USER, 329 .cpu_user_features = COMMON_USER,
311 .icache_bsize = 32, 330 .icache_bsize = 32,
312 .dcache_bsize = 32, 331 .dcache_bsize = 32,
313 .cpu_setup = __setup_cpu_603 332 .cpu_setup = __setup_cpu_603,
333 .platform = "ppc603",
314 }, 334 },
315 { /* 604 */ 335 { /* 604 */
316 .pvr_mask = 0xffff0000, 336 .pvr_mask = 0xffff0000,
@@ -321,7 +341,8 @@ struct cpu_spec cpu_specs[] = {
321 .icache_bsize = 32, 341 .icache_bsize = 32,
322 .dcache_bsize = 32, 342 .dcache_bsize = 32,
323 .num_pmcs = 2, 343 .num_pmcs = 2,
324 .cpu_setup = __setup_cpu_604 344 .cpu_setup = __setup_cpu_604,
345 .platform = "ppc604",
325 }, 346 },
326 { /* 604e */ 347 { /* 604e */
327 .pvr_mask = 0xfffff000, 348 .pvr_mask = 0xfffff000,
@@ -332,7 +353,8 @@ struct cpu_spec cpu_specs[] = {
332 .icache_bsize = 32, 353 .icache_bsize = 32,
333 .dcache_bsize = 32, 354 .dcache_bsize = 32,
334 .num_pmcs = 4, 355 .num_pmcs = 4,
335 .cpu_setup = __setup_cpu_604 356 .cpu_setup = __setup_cpu_604,
357 .platform = "ppc604",
336 }, 358 },
337 { /* 604r */ 359 { /* 604r */
338 .pvr_mask = 0xffff0000, 360 .pvr_mask = 0xffff0000,
@@ -343,7 +365,8 @@ struct cpu_spec cpu_specs[] = {
343 .icache_bsize = 32, 365 .icache_bsize = 32,
344 .dcache_bsize = 32, 366 .dcache_bsize = 32,
345 .num_pmcs = 4, 367 .num_pmcs = 4,
346 .cpu_setup = __setup_cpu_604 368 .cpu_setup = __setup_cpu_604,
369 .platform = "ppc604",
347 }, 370 },
348 { /* 604ev */ 371 { /* 604ev */
349 .pvr_mask = 0xffff0000, 372 .pvr_mask = 0xffff0000,
@@ -354,7 +377,8 @@ struct cpu_spec cpu_specs[] = {
354 .icache_bsize = 32, 377 .icache_bsize = 32,
355 .dcache_bsize = 32, 378 .dcache_bsize = 32,
356 .num_pmcs = 4, 379 .num_pmcs = 4,
357 .cpu_setup = __setup_cpu_604 380 .cpu_setup = __setup_cpu_604,
381 .platform = "ppc604",
358 }, 382 },
359 { /* 740/750 (0x4202, don't support TAU ?) */ 383 { /* 740/750 (0x4202, don't support TAU ?) */
360 .pvr_mask = 0xffffffff, 384 .pvr_mask = 0xffffffff,
@@ -365,7 +389,8 @@ struct cpu_spec cpu_specs[] = {
365 .icache_bsize = 32, 389 .icache_bsize = 32,
366 .dcache_bsize = 32, 390 .dcache_bsize = 32,
367 .num_pmcs = 4, 391 .num_pmcs = 4,
368 .cpu_setup = __setup_cpu_750 392 .cpu_setup = __setup_cpu_750,
393 .platform = "ppc750",
369 }, 394 },
370 { /* 750CX (80100 and 8010x?) */ 395 { /* 750CX (80100 and 8010x?) */
371 .pvr_mask = 0xfffffff0, 396 .pvr_mask = 0xfffffff0,
@@ -376,7 +401,8 @@ struct cpu_spec cpu_specs[] = {
376 .icache_bsize = 32, 401 .icache_bsize = 32,
377 .dcache_bsize = 32, 402 .dcache_bsize = 32,
378 .num_pmcs = 4, 403 .num_pmcs = 4,
379 .cpu_setup = __setup_cpu_750cx 404 .cpu_setup = __setup_cpu_750cx,
405 .platform = "ppc750",
380 }, 406 },
381 { /* 750CX (82201 and 82202) */ 407 { /* 750CX (82201 and 82202) */
382 .pvr_mask = 0xfffffff0, 408 .pvr_mask = 0xfffffff0,
@@ -387,7 +413,8 @@ struct cpu_spec cpu_specs[] = {
387 .icache_bsize = 32, 413 .icache_bsize = 32,
388 .dcache_bsize = 32, 414 .dcache_bsize = 32,
389 .num_pmcs = 4, 415 .num_pmcs = 4,
390 .cpu_setup = __setup_cpu_750cx 416 .cpu_setup = __setup_cpu_750cx,
417 .platform = "ppc750",
391 }, 418 },
392 { /* 750CXe (82214) */ 419 { /* 750CXe (82214) */
393 .pvr_mask = 0xfffffff0, 420 .pvr_mask = 0xfffffff0,
@@ -398,7 +425,8 @@ struct cpu_spec cpu_specs[] = {
398 .icache_bsize = 32, 425 .icache_bsize = 32,
399 .dcache_bsize = 32, 426 .dcache_bsize = 32,
400 .num_pmcs = 4, 427 .num_pmcs = 4,
401 .cpu_setup = __setup_cpu_750cx 428 .cpu_setup = __setup_cpu_750cx,
429 .platform = "ppc750",
402 }, 430 },
403 { /* 750CXe "Gekko" (83214) */ 431 { /* 750CXe "Gekko" (83214) */
404 .pvr_mask = 0xffffffff, 432 .pvr_mask = 0xffffffff,
@@ -409,7 +437,8 @@ struct cpu_spec cpu_specs[] = {
409 .icache_bsize = 32, 437 .icache_bsize = 32,
410 .dcache_bsize = 32, 438 .dcache_bsize = 32,
411 .num_pmcs = 4, 439 .num_pmcs = 4,
412 .cpu_setup = __setup_cpu_750cx 440 .cpu_setup = __setup_cpu_750cx,
441 .platform = "ppc750",
413 }, 442 },
414 { /* 745/755 */ 443 { /* 745/755 */
415 .pvr_mask = 0xfffff000, 444 .pvr_mask = 0xfffff000,
@@ -420,7 +449,8 @@ struct cpu_spec cpu_specs[] = {
420 .icache_bsize = 32, 449 .icache_bsize = 32,
421 .dcache_bsize = 32, 450 .dcache_bsize = 32,
422 .num_pmcs = 4, 451 .num_pmcs = 4,
423 .cpu_setup = __setup_cpu_750 452 .cpu_setup = __setup_cpu_750,
453 .platform = "ppc750",
424 }, 454 },
425 { /* 750FX rev 1.x */ 455 { /* 750FX rev 1.x */
426 .pvr_mask = 0xffffff00, 456 .pvr_mask = 0xffffff00,
@@ -431,7 +461,8 @@ struct cpu_spec cpu_specs[] = {
431 .icache_bsize = 32, 461 .icache_bsize = 32,
432 .dcache_bsize = 32, 462 .dcache_bsize = 32,
433 .num_pmcs = 4, 463 .num_pmcs = 4,
434 .cpu_setup = __setup_cpu_750 464 .cpu_setup = __setup_cpu_750,
465 .platform = "ppc750",
435 }, 466 },
436 { /* 750FX rev 2.0 must disable HID0[DPM] */ 467 { /* 750FX rev 2.0 must disable HID0[DPM] */
437 .pvr_mask = 0xffffffff, 468 .pvr_mask = 0xffffffff,
@@ -442,7 +473,8 @@ struct cpu_spec cpu_specs[] = {
442 .icache_bsize = 32, 473 .icache_bsize = 32,
443 .dcache_bsize = 32, 474 .dcache_bsize = 32,
444 .num_pmcs = 4, 475 .num_pmcs = 4,
445 .cpu_setup = __setup_cpu_750 476 .cpu_setup = __setup_cpu_750,
477 .platform = "ppc750",
446 }, 478 },
447 { /* 750FX (All revs except 2.0) */ 479 { /* 750FX (All revs except 2.0) */
448 .pvr_mask = 0xffff0000, 480 .pvr_mask = 0xffff0000,
@@ -453,7 +485,8 @@ struct cpu_spec cpu_specs[] = {
453 .icache_bsize = 32, 485 .icache_bsize = 32,
454 .dcache_bsize = 32, 486 .dcache_bsize = 32,
455 .num_pmcs = 4, 487 .num_pmcs = 4,
456 .cpu_setup = __setup_cpu_750fx 488 .cpu_setup = __setup_cpu_750fx,
489 .platform = "ppc750",
457 }, 490 },
458 { /* 750GX */ 491 { /* 750GX */
459 .pvr_mask = 0xffff0000, 492 .pvr_mask = 0xffff0000,
@@ -464,7 +497,8 @@ struct cpu_spec cpu_specs[] = {
464 .icache_bsize = 32, 497 .icache_bsize = 32,
465 .dcache_bsize = 32, 498 .dcache_bsize = 32,
466 .num_pmcs = 4, 499 .num_pmcs = 4,
467 .cpu_setup = __setup_cpu_750fx 500 .cpu_setup = __setup_cpu_750fx,
501 .platform = "ppc750",
468 }, 502 },
469 { /* 740/750 (L2CR bit need fixup for 740) */ 503 { /* 740/750 (L2CR bit need fixup for 740) */
470 .pvr_mask = 0xffff0000, 504 .pvr_mask = 0xffff0000,
@@ -475,7 +509,8 @@ struct cpu_spec cpu_specs[] = {
475 .icache_bsize = 32, 509 .icache_bsize = 32,
476 .dcache_bsize = 32, 510 .dcache_bsize = 32,
477 .num_pmcs = 4, 511 .num_pmcs = 4,
478 .cpu_setup = __setup_cpu_750 512 .cpu_setup = __setup_cpu_750,
513 .platform = "ppc750",
479 }, 514 },
480 { /* 7400 rev 1.1 ? (no TAU) */ 515 { /* 7400 rev 1.1 ? (no TAU) */
481 .pvr_mask = 0xffffffff, 516 .pvr_mask = 0xffffffff,
@@ -486,7 +521,8 @@ struct cpu_spec cpu_specs[] = {
486 .icache_bsize = 32, 521 .icache_bsize = 32,
487 .dcache_bsize = 32, 522 .dcache_bsize = 32,
488 .num_pmcs = 4, 523 .num_pmcs = 4,
489 .cpu_setup = __setup_cpu_7400 524 .cpu_setup = __setup_cpu_7400,
525 .platform = "ppc7400",
490 }, 526 },
491 { /* 7400 */ 527 { /* 7400 */
492 .pvr_mask = 0xffff0000, 528 .pvr_mask = 0xffff0000,
@@ -497,7 +533,8 @@ struct cpu_spec cpu_specs[] = {
497 .icache_bsize = 32, 533 .icache_bsize = 32,
498 .dcache_bsize = 32, 534 .dcache_bsize = 32,
499 .num_pmcs = 4, 535 .num_pmcs = 4,
500 .cpu_setup = __setup_cpu_7400 536 .cpu_setup = __setup_cpu_7400,
537 .platform = "ppc7400",
501 }, 538 },
502 { /* 7410 */ 539 { /* 7410 */
503 .pvr_mask = 0xffff0000, 540 .pvr_mask = 0xffff0000,
@@ -508,7 +545,8 @@ struct cpu_spec cpu_specs[] = {
508 .icache_bsize = 32, 545 .icache_bsize = 32,
509 .dcache_bsize = 32, 546 .dcache_bsize = 32,
510 .num_pmcs = 4, 547 .num_pmcs = 4,
511 .cpu_setup = __setup_cpu_7410 548 .cpu_setup = __setup_cpu_7410,
549 .platform = "ppc7400",
512 }, 550 },
513 { /* 7450 2.0 - no doze/nap */ 551 { /* 7450 2.0 - no doze/nap */
514 .pvr_mask = 0xffffffff, 552 .pvr_mask = 0xffffffff,
@@ -521,7 +559,8 @@ struct cpu_spec cpu_specs[] = {
521 .num_pmcs = 6, 559 .num_pmcs = 6,
522 .cpu_setup = __setup_cpu_745x, 560 .cpu_setup = __setup_cpu_745x,
523 .oprofile_cpu_type = "ppc/7450", 561 .oprofile_cpu_type = "ppc/7450",
524 .oprofile_type = G4, 562 .oprofile_type = PPC_OPROFILE_G4,
563 .platform = "ppc7450",
525 }, 564 },
526 { /* 7450 2.1 */ 565 { /* 7450 2.1 */
527 .pvr_mask = 0xffffffff, 566 .pvr_mask = 0xffffffff,
@@ -534,7 +573,8 @@ struct cpu_spec cpu_specs[] = {
534 .num_pmcs = 6, 573 .num_pmcs = 6,
535 .cpu_setup = __setup_cpu_745x, 574 .cpu_setup = __setup_cpu_745x,
536 .oprofile_cpu_type = "ppc/7450", 575 .oprofile_cpu_type = "ppc/7450",
537 .oprofile_type = G4, 576 .oprofile_type = PPC_OPROFILE_G4,
577 .platform = "ppc7450",
538 }, 578 },
539 { /* 7450 2.3 and newer */ 579 { /* 7450 2.3 and newer */
540 .pvr_mask = 0xffff0000, 580 .pvr_mask = 0xffff0000,
@@ -547,7 +587,8 @@ struct cpu_spec cpu_specs[] = {
547 .num_pmcs = 6, 587 .num_pmcs = 6,
548 .cpu_setup = __setup_cpu_745x, 588 .cpu_setup = __setup_cpu_745x,
549 .oprofile_cpu_type = "ppc/7450", 589 .oprofile_cpu_type = "ppc/7450",
550 .oprofile_type = G4, 590 .oprofile_type = PPC_OPROFILE_G4,
591 .platform = "ppc7450",
551 }, 592 },
552 { /* 7455 rev 1.x */ 593 { /* 7455 rev 1.x */
553 .pvr_mask = 0xffffff00, 594 .pvr_mask = 0xffffff00,
@@ -560,7 +601,8 @@ struct cpu_spec cpu_specs[] = {
560 .num_pmcs = 6, 601 .num_pmcs = 6,
561 .cpu_setup = __setup_cpu_745x, 602 .cpu_setup = __setup_cpu_745x,
562 .oprofile_cpu_type = "ppc/7450", 603 .oprofile_cpu_type = "ppc/7450",
563 .oprofile_type = G4, 604 .oprofile_type = PPC_OPROFILE_G4,
605 .platform = "ppc7450",
564 }, 606 },
565 { /* 7455 rev 2.0 */ 607 { /* 7455 rev 2.0 */
566 .pvr_mask = 0xffffffff, 608 .pvr_mask = 0xffffffff,
@@ -573,7 +615,8 @@ struct cpu_spec cpu_specs[] = {
573 .num_pmcs = 6, 615 .num_pmcs = 6,
574 .cpu_setup = __setup_cpu_745x, 616 .cpu_setup = __setup_cpu_745x,
575 .oprofile_cpu_type = "ppc/7450", 617 .oprofile_cpu_type = "ppc/7450",
576 .oprofile_type = G4, 618 .oprofile_type = PPC_OPROFILE_G4,
619 .platform = "ppc7450",
577 }, 620 },
578 { /* 7455 others */ 621 { /* 7455 others */
579 .pvr_mask = 0xffff0000, 622 .pvr_mask = 0xffff0000,
@@ -586,7 +629,8 @@ struct cpu_spec cpu_specs[] = {
586 .num_pmcs = 6, 629 .num_pmcs = 6,
587 .cpu_setup = __setup_cpu_745x, 630 .cpu_setup = __setup_cpu_745x,
588 .oprofile_cpu_type = "ppc/7450", 631 .oprofile_cpu_type = "ppc/7450",
589 .oprofile_type = G4, 632 .oprofile_type = PPC_OPROFILE_G4,
633 .platform = "ppc7450",
590 }, 634 },
591 { /* 7447/7457 Rev 1.0 */ 635 { /* 7447/7457 Rev 1.0 */
592 .pvr_mask = 0xffffffff, 636 .pvr_mask = 0xffffffff,
@@ -599,7 +643,8 @@ struct cpu_spec cpu_specs[] = {
599 .num_pmcs = 6, 643 .num_pmcs = 6,
600 .cpu_setup = __setup_cpu_745x, 644 .cpu_setup = __setup_cpu_745x,
601 .oprofile_cpu_type = "ppc/7450", 645 .oprofile_cpu_type = "ppc/7450",
602 .oprofile_type = G4, 646 .oprofile_type = PPC_OPROFILE_G4,
647 .platform = "ppc7450",
603 }, 648 },
604 { /* 7447/7457 Rev 1.1 */ 649 { /* 7447/7457 Rev 1.1 */
605 .pvr_mask = 0xffffffff, 650 .pvr_mask = 0xffffffff,
@@ -612,7 +657,8 @@ struct cpu_spec cpu_specs[] = {
612 .num_pmcs = 6, 657 .num_pmcs = 6,
613 .cpu_setup = __setup_cpu_745x, 658 .cpu_setup = __setup_cpu_745x,
614 .oprofile_cpu_type = "ppc/7450", 659 .oprofile_cpu_type = "ppc/7450",
615 .oprofile_type = G4, 660 .oprofile_type = PPC_OPROFILE_G4,
661 .platform = "ppc7450",
616 }, 662 },
617 { /* 7447/7457 Rev 1.2 and later */ 663 { /* 7447/7457 Rev 1.2 and later */
618 .pvr_mask = 0xffff0000, 664 .pvr_mask = 0xffff0000,
@@ -625,7 +671,8 @@ struct cpu_spec cpu_specs[] = {
625 .num_pmcs = 6, 671 .num_pmcs = 6,
626 .cpu_setup = __setup_cpu_745x, 672 .cpu_setup = __setup_cpu_745x,
627 .oprofile_cpu_type = "ppc/7450", 673 .oprofile_cpu_type = "ppc/7450",
628 .oprofile_type = G4, 674 .oprofile_type = PPC_OPROFILE_G4,
675 .platform = "ppc7450",
629 }, 676 },
630 { /* 7447A */ 677 { /* 7447A */
631 .pvr_mask = 0xffff0000, 678 .pvr_mask = 0xffff0000,
@@ -638,7 +685,8 @@ struct cpu_spec cpu_specs[] = {
638 .num_pmcs = 6, 685 .num_pmcs = 6,
639 .cpu_setup = __setup_cpu_745x, 686 .cpu_setup = __setup_cpu_745x,
640 .oprofile_cpu_type = "ppc/7450", 687 .oprofile_cpu_type = "ppc/7450",
641 .oprofile_type = G4, 688 .oprofile_type = PPC_OPROFILE_G4,
689 .platform = "ppc7450",
642 }, 690 },
643 { /* 7448 */ 691 { /* 7448 */
644 .pvr_mask = 0xffff0000, 692 .pvr_mask = 0xffff0000,
@@ -651,7 +699,8 @@ struct cpu_spec cpu_specs[] = {
651 .num_pmcs = 6, 699 .num_pmcs = 6,
652 .cpu_setup = __setup_cpu_745x, 700 .cpu_setup = __setup_cpu_745x,
653 .oprofile_cpu_type = "ppc/7450", 701 .oprofile_cpu_type = "ppc/7450",
654 .oprofile_type = G4, 702 .oprofile_type = PPC_OPROFILE_G4,
703 .platform = "ppc7450",
655 }, 704 },
656 { /* 82xx (8240, 8245, 8260 are all 603e cores) */ 705 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
657 .pvr_mask = 0x7fff0000, 706 .pvr_mask = 0x7fff0000,
@@ -661,7 +710,8 @@ struct cpu_spec cpu_specs[] = {
661 .cpu_user_features = COMMON_USER, 710 .cpu_user_features = COMMON_USER,
662 .icache_bsize = 32, 711 .icache_bsize = 32,
663 .dcache_bsize = 32, 712 .dcache_bsize = 32,
664 .cpu_setup = __setup_cpu_603 713 .cpu_setup = __setup_cpu_603,
714 .platform = "ppc603",
665 }, 715 },
666 { /* All G2_LE (603e core, plus some) have the same pvr */ 716 { /* All G2_LE (603e core, plus some) have the same pvr */
667 .pvr_mask = 0x7fff0000, 717 .pvr_mask = 0x7fff0000,
@@ -671,7 +721,8 @@ struct cpu_spec cpu_specs[] = {
671 .cpu_user_features = COMMON_USER, 721 .cpu_user_features = COMMON_USER,
672 .icache_bsize = 32, 722 .icache_bsize = 32,
673 .dcache_bsize = 32, 723 .dcache_bsize = 32,
674 .cpu_setup = __setup_cpu_603 724 .cpu_setup = __setup_cpu_603,
725 .platform = "ppc603",
675 }, 726 },
676 { /* e300 (a 603e core, plus some) on 83xx */ 727 { /* e300 (a 603e core, plus some) on 83xx */
677 .pvr_mask = 0x7fff0000, 728 .pvr_mask = 0x7fff0000,
@@ -681,7 +732,8 @@ struct cpu_spec cpu_specs[] = {
681 .cpu_user_features = COMMON_USER, 732 .cpu_user_features = COMMON_USER,
682 .icache_bsize = 32, 733 .icache_bsize = 32,
683 .dcache_bsize = 32, 734 .dcache_bsize = 32,
684 .cpu_setup = __setup_cpu_603 735 .cpu_setup = __setup_cpu_603,
736 .platform = "ppc603",
685 }, 737 },
686 { /* default match, we assume split I/D cache & TB (non-601)... */ 738 { /* default match, we assume split I/D cache & TB (non-601)... */
687 .pvr_mask = 0x00000000, 739 .pvr_mask = 0x00000000,
@@ -691,6 +743,7 @@ struct cpu_spec cpu_specs[] = {
691 .cpu_user_features = COMMON_USER, 743 .cpu_user_features = COMMON_USER,
692 .icache_bsize = 32, 744 .icache_bsize = 32,
693 .dcache_bsize = 32, 745 .dcache_bsize = 32,
746 .platform = "ppc603",
694 }, 747 },
695#endif /* CLASSIC_PPC */ 748#endif /* CLASSIC_PPC */
696#ifdef CONFIG_8xx 749#ifdef CONFIG_8xx
@@ -704,6 +757,7 @@ struct cpu_spec cpu_specs[] = {
704 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 757 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
705 .icache_bsize = 16, 758 .icache_bsize = 16,
706 .dcache_bsize = 16, 759 .dcache_bsize = 16,
760 .platform = "ppc823",
707 }, 761 },
708#endif /* CONFIG_8xx */ 762#endif /* CONFIG_8xx */
709#ifdef CONFIG_40x 763#ifdef CONFIG_40x
@@ -715,6 +769,7 @@ struct cpu_spec cpu_specs[] = {
715 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 769 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
716 .icache_bsize = 16, 770 .icache_bsize = 16,
717 .dcache_bsize = 16, 771 .dcache_bsize = 16,
772 .platform = "ppc403",
718 }, 773 },
719 { /* 403GCX */ 774 { /* 403GCX */
720 .pvr_mask = 0xffffff00, 775 .pvr_mask = 0xffffff00,
@@ -725,6 +780,7 @@ struct cpu_spec cpu_specs[] = {
725 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB, 780 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
726 .icache_bsize = 16, 781 .icache_bsize = 16,
727 .dcache_bsize = 16, 782 .dcache_bsize = 16,
783 .platform = "ppc403",
728 }, 784 },
729 { /* 403G ?? */ 785 { /* 403G ?? */
730 .pvr_mask = 0xffff0000, 786 .pvr_mask = 0xffff0000,
@@ -734,6 +790,7 @@ struct cpu_spec cpu_specs[] = {
734 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 790 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
735 .icache_bsize = 16, 791 .icache_bsize = 16,
736 .dcache_bsize = 16, 792 .dcache_bsize = 16,
793 .platform = "ppc403",
737 }, 794 },
738 { /* 405GP */ 795 { /* 405GP */
739 .pvr_mask = 0xffff0000, 796 .pvr_mask = 0xffff0000,
@@ -744,6 +801,7 @@ struct cpu_spec cpu_specs[] = {
744 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 801 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
745 .icache_bsize = 32, 802 .icache_bsize = 32,
746 .dcache_bsize = 32, 803 .dcache_bsize = 32,
804 .platform = "ppc405",
747 }, 805 },
748 { /* STB 03xxx */ 806 { /* STB 03xxx */
749 .pvr_mask = 0xffff0000, 807 .pvr_mask = 0xffff0000,
@@ -754,6 +812,7 @@ struct cpu_spec cpu_specs[] = {
754 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 812 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
755 .icache_bsize = 32, 813 .icache_bsize = 32,
756 .dcache_bsize = 32, 814 .dcache_bsize = 32,
815 .platform = "ppc405",
757 }, 816 },
758 { /* STB 04xxx */ 817 { /* STB 04xxx */
759 .pvr_mask = 0xffff0000, 818 .pvr_mask = 0xffff0000,
@@ -764,6 +823,7 @@ struct cpu_spec cpu_specs[] = {
764 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 823 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
765 .icache_bsize = 32, 824 .icache_bsize = 32,
766 .dcache_bsize = 32, 825 .dcache_bsize = 32,
826 .platform = "ppc405",
767 }, 827 },
768 { /* NP405L */ 828 { /* NP405L */
769 .pvr_mask = 0xffff0000, 829 .pvr_mask = 0xffff0000,
@@ -774,6 +834,7 @@ struct cpu_spec cpu_specs[] = {
774 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 834 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
775 .icache_bsize = 32, 835 .icache_bsize = 32,
776 .dcache_bsize = 32, 836 .dcache_bsize = 32,
837 .platform = "ppc405",
777 }, 838 },
778 { /* NP4GS3 */ 839 { /* NP4GS3 */
779 .pvr_mask = 0xffff0000, 840 .pvr_mask = 0xffff0000,
@@ -784,6 +845,7 @@ struct cpu_spec cpu_specs[] = {
784 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 845 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
785 .icache_bsize = 32, 846 .icache_bsize = 32,
786 .dcache_bsize = 32, 847 .dcache_bsize = 32,
848 .platform = "ppc405",
787 }, 849 },
788 { /* NP405H */ 850 { /* NP405H */
789 .pvr_mask = 0xffff0000, 851 .pvr_mask = 0xffff0000,
@@ -794,6 +856,7 @@ struct cpu_spec cpu_specs[] = {
794 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 856 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
795 .icache_bsize = 32, 857 .icache_bsize = 32,
796 .dcache_bsize = 32, 858 .dcache_bsize = 32,
859 .platform = "ppc405",
797 }, 860 },
798 { /* 405GPr */ 861 { /* 405GPr */
799 .pvr_mask = 0xffff0000, 862 .pvr_mask = 0xffff0000,
@@ -804,6 +867,7 @@ struct cpu_spec cpu_specs[] = {
804 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 867 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
805 .icache_bsize = 32, 868 .icache_bsize = 32,
806 .dcache_bsize = 32, 869 .dcache_bsize = 32,
870 .platform = "ppc405",
807 }, 871 },
808 { /* STBx25xx */ 872 { /* STBx25xx */
809 .pvr_mask = 0xffff0000, 873 .pvr_mask = 0xffff0000,
@@ -814,6 +878,7 @@ struct cpu_spec cpu_specs[] = {
814 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 878 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
815 .icache_bsize = 32, 879 .icache_bsize = 32,
816 .dcache_bsize = 32, 880 .dcache_bsize = 32,
881 .platform = "ppc405",
817 }, 882 },
818 { /* 405LP */ 883 { /* 405LP */
819 .pvr_mask = 0xffff0000, 884 .pvr_mask = 0xffff0000,
@@ -823,6 +888,7 @@ struct cpu_spec cpu_specs[] = {
823 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 888 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
824 .icache_bsize = 32, 889 .icache_bsize = 32,
825 .dcache_bsize = 32, 890 .dcache_bsize = 32,
891 .platform = "ppc405",
826 }, 892 },
827 { /* Xilinx Virtex-II Pro */ 893 { /* Xilinx Virtex-II Pro */
828 .pvr_mask = 0xffff0000, 894 .pvr_mask = 0xffff0000,
@@ -833,6 +899,7 @@ struct cpu_spec cpu_specs[] = {
833 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 899 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
834 .icache_bsize = 32, 900 .icache_bsize = 32,
835 .dcache_bsize = 32, 901 .dcache_bsize = 32,
902 .platform = "ppc405",
836 }, 903 },
837 { /* 405EP */ 904 { /* 405EP */
838 .pvr_mask = 0xffff0000, 905 .pvr_mask = 0xffff0000,
@@ -843,6 +910,7 @@ struct cpu_spec cpu_specs[] = {
843 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 910 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
844 .icache_bsize = 32, 911 .icache_bsize = 32,
845 .dcache_bsize = 32, 912 .dcache_bsize = 32,
913 .platform = "ppc405",
846 }, 914 },
847 915
848#endif /* CONFIG_40x */ 916#endif /* CONFIG_40x */
@@ -852,81 +920,90 @@ struct cpu_spec cpu_specs[] = {
852 .pvr_value = 0x40000850, 920 .pvr_value = 0x40000850,
853 .cpu_name = "440EP Rev. A", 921 .cpu_name = "440EP Rev. A",
854 .cpu_features = CPU_FTRS_44X, 922 .cpu_features = CPU_FTRS_44X,
855 .cpu_user_features = COMMON_USER, /* 440EP has an FPU */ 923 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
856 .icache_bsize = 32, 924 .icache_bsize = 32,
857 .dcache_bsize = 32, 925 .dcache_bsize = 32,
926 .platform = "ppc440",
858 }, 927 },
859 { 928 {
860 .pvr_mask = 0xf0000fff, 929 .pvr_mask = 0xf0000fff,
861 .pvr_value = 0x400008d3, 930 .pvr_value = 0x400008d3,
862 .cpu_name = "440EP Rev. B", 931 .cpu_name = "440EP Rev. B",
863 .cpu_features = CPU_FTRS_44X, 932 .cpu_features = CPU_FTRS_44X,
864 .cpu_user_features = COMMON_USER, /* 440EP has an FPU */ 933 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
865 .icache_bsize = 32, 934 .icache_bsize = 32,
866 .dcache_bsize = 32, 935 .dcache_bsize = 32,
936 .platform = "ppc440",
867 }, 937 },
868 { /* 440GP Rev. B */ 938 { /* 440GP Rev. B */
869 .pvr_mask = 0xf0000fff, 939 .pvr_mask = 0xf0000fff,
870 .pvr_value = 0x40000440, 940 .pvr_value = 0x40000440,
871 .cpu_name = "440GP Rev. B", 941 .cpu_name = "440GP Rev. B",
872 .cpu_features = CPU_FTRS_44X, 942 .cpu_features = CPU_FTRS_44X,
873 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 943 .cpu_user_features = COMMON_USER_BOOKE,
874 .icache_bsize = 32, 944 .icache_bsize = 32,
875 .dcache_bsize = 32, 945 .dcache_bsize = 32,
946 .platform = "ppc440gp",
876 }, 947 },
877 { /* 440GP Rev. C */ 948 { /* 440GP Rev. C */
878 .pvr_mask = 0xf0000fff, 949 .pvr_mask = 0xf0000fff,
879 .pvr_value = 0x40000481, 950 .pvr_value = 0x40000481,
880 .cpu_name = "440GP Rev. C", 951 .cpu_name = "440GP Rev. C",
881 .cpu_features = CPU_FTRS_44X, 952 .cpu_features = CPU_FTRS_44X,
882 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 953 .cpu_user_features = COMMON_USER_BOOKE,
883 .icache_bsize = 32, 954 .icache_bsize = 32,
884 .dcache_bsize = 32, 955 .dcache_bsize = 32,
956 .platform = "ppc440gp",
885 }, 957 },
886 { /* 440GX Rev. A */ 958 { /* 440GX Rev. A */
887 .pvr_mask = 0xf0000fff, 959 .pvr_mask = 0xf0000fff,
888 .pvr_value = 0x50000850, 960 .pvr_value = 0x50000850,
889 .cpu_name = "440GX Rev. A", 961 .cpu_name = "440GX Rev. A",
890 .cpu_features = CPU_FTRS_44X, 962 .cpu_features = CPU_FTRS_44X,
891 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 963 .cpu_user_features = COMMON_USER_BOOKE,
892 .icache_bsize = 32, 964 .icache_bsize = 32,
893 .dcache_bsize = 32, 965 .dcache_bsize = 32,
966 .platform = "ppc440",
894 }, 967 },
895 { /* 440GX Rev. B */ 968 { /* 440GX Rev. B */
896 .pvr_mask = 0xf0000fff, 969 .pvr_mask = 0xf0000fff,
897 .pvr_value = 0x50000851, 970 .pvr_value = 0x50000851,
898 .cpu_name = "440GX Rev. B", 971 .cpu_name = "440GX Rev. B",
899 .cpu_features = CPU_FTRS_44X, 972 .cpu_features = CPU_FTRS_44X,
900 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 973 .cpu_user_features = COMMON_USER_BOOKE,
901 .icache_bsize = 32, 974 .icache_bsize = 32,
902 .dcache_bsize = 32, 975 .dcache_bsize = 32,
976 .platform = "ppc440",
903 }, 977 },
904 { /* 440GX Rev. C */ 978 { /* 440GX Rev. C */
905 .pvr_mask = 0xf0000fff, 979 .pvr_mask = 0xf0000fff,
906 .pvr_value = 0x50000892, 980 .pvr_value = 0x50000892,
907 .cpu_name = "440GX Rev. C", 981 .cpu_name = "440GX Rev. C",
908 .cpu_features = CPU_FTRS_44X, 982 .cpu_features = CPU_FTRS_44X,
909 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 983 .cpu_user_features = COMMON_USER_BOOKE,
910 .icache_bsize = 32, 984 .icache_bsize = 32,
911 .dcache_bsize = 32, 985 .dcache_bsize = 32,
986 .platform = "ppc440",
912 }, 987 },
913 { /* 440GX Rev. F */ 988 { /* 440GX Rev. F */
914 .pvr_mask = 0xf0000fff, 989 .pvr_mask = 0xf0000fff,
915 .pvr_value = 0x50000894, 990 .pvr_value = 0x50000894,
916 .cpu_name = "440GX Rev. F", 991 .cpu_name = "440GX Rev. F",
917 .cpu_features = CPU_FTRS_44X, 992 .cpu_features = CPU_FTRS_44X,
918 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 993 .cpu_user_features = COMMON_USER_BOOKE,
919 .icache_bsize = 32, 994 .icache_bsize = 32,
920 .dcache_bsize = 32, 995 .dcache_bsize = 32,
996 .platform = "ppc440",
921 }, 997 },
922 { /* 440SP Rev. A */ 998 { /* 440SP Rev. A */
923 .pvr_mask = 0xff000fff, 999 .pvr_mask = 0xff000fff,
924 .pvr_value = 0x53000891, 1000 .pvr_value = 0x53000891,
925 .cpu_name = "440SP Rev. A", 1001 .cpu_name = "440SP Rev. A",
926 .cpu_features = CPU_FTRS_44X, 1002 .cpu_features = CPU_FTRS_44X,
927 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1003 .cpu_user_features = COMMON_USER_BOOKE,
928 .icache_bsize = 32, 1004 .icache_bsize = 32,
929 .dcache_bsize = 32, 1005 .dcache_bsize = 32,
1006 .platform = "ppc440",
930 }, 1007 },
931 { /* 440SPe Rev. A */ 1008 { /* 440SPe Rev. A */
932 .pvr_mask = 0xff000fff, 1009 .pvr_mask = 0xff000fff,
@@ -934,9 +1011,10 @@ struct cpu_spec cpu_specs[] = {
934 .cpu_name = "440SPe Rev. A", 1011 .cpu_name = "440SPe Rev. A",
935 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 1012 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
936 CPU_FTR_USE_TB, 1013 CPU_FTR_USE_TB,
937 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1014 .cpu_user_features = COMMON_USER_BOOKE,
938 .icache_bsize = 32, 1015 .icache_bsize = 32,
939 .dcache_bsize = 32, 1016 .dcache_bsize = 32,
1017 .platform = "ppc440",
940 }, 1018 },
941#endif /* CONFIG_44x */ 1019#endif /* CONFIG_44x */
942#ifdef CONFIG_FSL_BOOKE 1020#ifdef CONFIG_FSL_BOOKE
@@ -946,10 +1024,11 @@ struct cpu_spec cpu_specs[] = {
946 .cpu_name = "e200z5", 1024 .cpu_name = "e200z5",
947 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1025 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
948 .cpu_features = CPU_FTRS_E200, 1026 .cpu_features = CPU_FTRS_E200,
949 .cpu_user_features = PPC_FEATURE_32 | 1027 .cpu_user_features = COMMON_USER_BOOKE |
950 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_EFP_SINGLE | 1028 PPC_FEATURE_HAS_EFP_SINGLE |
951 PPC_FEATURE_UNIFIED_CACHE, 1029 PPC_FEATURE_UNIFIED_CACHE,
952 .dcache_bsize = 32, 1030 .dcache_bsize = 32,
1031 .platform = "ppc5554",
953 }, 1032 },
954 { /* e200z6 */ 1033 { /* e200z6 */
955 .pvr_mask = 0xfff00000, 1034 .pvr_mask = 0xfff00000,
@@ -957,11 +1036,12 @@ struct cpu_spec cpu_specs[] = {
957 .cpu_name = "e200z6", 1036 .cpu_name = "e200z6",
958 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1037 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
959 .cpu_features = CPU_FTRS_E200, 1038 .cpu_features = CPU_FTRS_E200,
960 .cpu_user_features = PPC_FEATURE_32 | 1039 .cpu_user_features = COMMON_USER_BOOKE |
961 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP | 1040 PPC_FEATURE_SPE_COMP |
962 PPC_FEATURE_HAS_EFP_SINGLE | 1041 PPC_FEATURE_HAS_EFP_SINGLE |
963 PPC_FEATURE_UNIFIED_CACHE, 1042 PPC_FEATURE_UNIFIED_CACHE,
964 .dcache_bsize = 32, 1043 .dcache_bsize = 32,
1044 .platform = "ppc5554",
965 }, 1045 },
966 { /* e500 */ 1046 { /* e500 */
967 .pvr_mask = 0xffff0000, 1047 .pvr_mask = 0xffff0000,
@@ -969,14 +1049,15 @@ struct cpu_spec cpu_specs[] = {
969 .cpu_name = "e500", 1049 .cpu_name = "e500",
970 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1050 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
971 .cpu_features = CPU_FTRS_E500, 1051 .cpu_features = CPU_FTRS_E500,
972 .cpu_user_features = PPC_FEATURE_32 | 1052 .cpu_user_features = COMMON_USER_BOOKE |
973 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP | 1053 PPC_FEATURE_SPE_COMP |
974 PPC_FEATURE_HAS_EFP_SINGLE, 1054 PPC_FEATURE_HAS_EFP_SINGLE,
975 .icache_bsize = 32, 1055 .icache_bsize = 32,
976 .dcache_bsize = 32, 1056 .dcache_bsize = 32,
977 .num_pmcs = 4, 1057 .num_pmcs = 4,
978 .oprofile_cpu_type = "ppc/e500", 1058 .oprofile_cpu_type = "ppc/e500",
979 .oprofile_type = BOOKE, 1059 .oprofile_type = PPC_OPROFILE_BOOKE,
1060 .platform = "ppc8540",
980 }, 1061 },
981 { /* e500v2 */ 1062 { /* e500v2 */
982 .pvr_mask = 0xffff0000, 1063 .pvr_mask = 0xffff0000,
@@ -984,14 +1065,16 @@ struct cpu_spec cpu_specs[] = {
984 .cpu_name = "e500v2", 1065 .cpu_name = "e500v2",
985 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1066 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
986 .cpu_features = CPU_FTRS_E500_2, 1067 .cpu_features = CPU_FTRS_E500_2,
987 .cpu_user_features = PPC_FEATURE_32 | 1068 .cpu_user_features = COMMON_USER_BOOKE |
988 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP | 1069 PPC_FEATURE_SPE_COMP |
989 PPC_FEATURE_HAS_EFP_SINGLE | PPC_FEATURE_HAS_EFP_DOUBLE, 1070 PPC_FEATURE_HAS_EFP_SINGLE |
1071 PPC_FEATURE_HAS_EFP_DOUBLE,
990 .icache_bsize = 32, 1072 .icache_bsize = 32,
991 .dcache_bsize = 32, 1073 .dcache_bsize = 32,
992 .num_pmcs = 4, 1074 .num_pmcs = 4,
993 .oprofile_cpu_type = "ppc/e500", 1075 .oprofile_cpu_type = "ppc/e500",
994 .oprofile_type = BOOKE, 1076 .oprofile_type = PPC_OPROFILE_BOOKE,
1077 .platform = "ppc8548",
995 }, 1078 },
996#endif 1079#endif
997#if !CLASSIC_PPC 1080#if !CLASSIC_PPC
@@ -1003,6 +1086,7 @@ struct cpu_spec cpu_specs[] = {
1003 .cpu_user_features = PPC_FEATURE_32, 1086 .cpu_user_features = PPC_FEATURE_32,
1004 .icache_bsize = 32, 1087 .icache_bsize = 32,
1005 .dcache_bsize = 32, 1088 .dcache_bsize = 32,
1089 .platform = "powerpc",
1006 } 1090 }
1007#endif /* !CLASSIC_PPC */ 1091#endif /* !CLASSIC_PPC */
1008#endif /* CONFIG_PPC32 */ 1092#endif /* CONFIG_PPC32 */
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 036b71d2adfc..d8da2a35c0a4 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -988,7 +988,7 @@ _GLOBAL(enter_rtas)
988 stwu r1,-INT_FRAME_SIZE(r1) 988 stwu r1,-INT_FRAME_SIZE(r1)
989 mflr r0 989 mflr r0
990 stw r0,INT_FRAME_SIZE+4(r1) 990 stw r0,INT_FRAME_SIZE+4(r1)
991 LOADADDR(r4, rtas) 991 LOAD_REG_ADDR(r4, rtas)
992 lis r6,1f@ha /* physical return address for rtas */ 992 lis r6,1f@ha /* physical return address for rtas */
993 addi r6,r6,1f@l 993 addi r6,r6,1f@l
994 tophys(r6,r6) 994 tophys(r6,r6)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index aacebb33e98a..542036318866 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -511,7 +511,8 @@ restore:
511 cmpdi 0,r5,0 511 cmpdi 0,r5,0
512 beq 4f 512 beq 4f
513 /* Check for pending interrupts (iSeries) */ 513 /* Check for pending interrupts (iSeries) */
514 ld r3,PACALPPACA+LPPACAANYINT(r13) 514 ld r3,PACALPPACAPTR(r13)
515 ld r3,LPPACAANYINT(r3)
515 cmpdi r3,0 516 cmpdi r3,0
516 beq+ 4f /* skip do_IRQ if no interrupts */ 517 beq+ 4f /* skip do_IRQ if no interrupts */
517 518
@@ -689,9 +690,8 @@ _GLOBAL(enter_rtas)
689 std r6,PACASAVEDMSR(r13) 690 std r6,PACASAVEDMSR(r13)
690 691
691 /* Setup our real return addr */ 692 /* Setup our real return addr */
692 SET_REG_TO_LABEL(r4,.rtas_return_loc) 693 LOAD_REG_ADDR(r4,.rtas_return_loc)
693 SET_REG_TO_CONST(r9,PAGE_OFFSET) 694 clrldi r4,r4,2 /* convert to realmode address */
694 sub r4,r4,r9
695 mtlr r4 695 mtlr r4
696 696
697 li r0,0 697 li r0,0
@@ -706,7 +706,7 @@ _GLOBAL(enter_rtas)
706 sync /* disable interrupts so SRR0/1 */ 706 sync /* disable interrupts so SRR0/1 */
707 mtmsrd r0 /* don't get trashed */ 707 mtmsrd r0 /* don't get trashed */
708 708
709 SET_REG_TO_LABEL(r4,rtas) 709 LOAD_REG_ADDR(r4, rtas)
710 ld r5,RTASENTRY(r4) /* get the rtas->entry value */ 710 ld r5,RTASENTRY(r4) /* get the rtas->entry value */
711 ld r4,RTASBASE(r4) /* get the rtas->base value */ 711 ld r4,RTASBASE(r4) /* get the rtas->base value */
712 712
@@ -718,8 +718,7 @@ _GLOBAL(enter_rtas)
718_STATIC(rtas_return_loc) 718_STATIC(rtas_return_loc)
719 /* relocation is off at this point */ 719 /* relocation is off at this point */
720 mfspr r4,SPRN_SPRG3 /* Get PACA */ 720 mfspr r4,SPRN_SPRG3 /* Get PACA */
721 SET_REG_TO_CONST(r5, PAGE_OFFSET) 721 clrldi r4,r4,2 /* convert to realmode address */
722 sub r4,r4,r5 /* RELOC the PACA base pointer */
723 722
724 mfmsr r6 723 mfmsr r6
725 li r0,MSR_RI 724 li r0,MSR_RI
@@ -728,7 +727,7 @@ _STATIC(rtas_return_loc)
728 mtmsrd r6 727 mtmsrd r6
729 728
730 ld r1,PACAR1(r4) /* Restore our SP */ 729 ld r1,PACAR1(r4) /* Restore our SP */
731 LOADADDR(r3,.rtas_restore_regs) 730 LOAD_REG_IMMEDIATE(r3,.rtas_restore_regs)
732 ld r4,PACASAVEDMSR(r4) /* Restore our MSR */ 731 ld r4,PACASAVEDMSR(r4) /* Restore our MSR */
733 732
734 mtspr SPRN_SRR0,r3 733 mtspr SPRN_SRR0,r3
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index b780b42c95fc..e4362dfa37fb 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -39,9 +39,9 @@ _GLOBAL(load_up_fpu)
39 * to another. Instead we call giveup_fpu in switch_to. 39 * to another. Instead we call giveup_fpu in switch_to.
40 */ 40 */
41#ifndef CONFIG_SMP 41#ifndef CONFIG_SMP
42 LOADBASE(r3, last_task_used_math) 42 LOAD_REG_ADDRBASE(r3, last_task_used_math)
43 toreal(r3) 43 toreal(r3)
44 PPC_LL r4,OFF(last_task_used_math)(r3) 44 PPC_LL r4,ADDROFF(last_task_used_math)(r3)
45 PPC_LCMPI 0,r4,0 45 PPC_LCMPI 0,r4,0
46 beq 1f 46 beq 1f
47 toreal(r4) 47 toreal(r4)
@@ -77,7 +77,7 @@ _GLOBAL(load_up_fpu)
77#ifndef CONFIG_SMP 77#ifndef CONFIG_SMP
78 subi r4,r5,THREAD 78 subi r4,r5,THREAD
79 fromreal(r4) 79 fromreal(r4)
80 PPC_STL r4,OFF(last_task_used_math)(r3) 80 PPC_STL r4,ADDROFF(last_task_used_math)(r3)
81#endif /* CONFIG_SMP */ 81#endif /* CONFIG_SMP */
82 /* restore registers and return */ 82 /* restore registers and return */
83 /* we haven't used ctr or xer or lr */ 83 /* we haven't used ctr or xer or lr */
@@ -113,8 +113,8 @@ _GLOBAL(giveup_fpu)
1131: 1131:
114#ifndef CONFIG_SMP 114#ifndef CONFIG_SMP
115 li r5,0 115 li r5,0
116 LOADBASE(r4,last_task_used_math) 116 LOAD_REG_ADDRBASE(r4,last_task_used_math)
117 PPC_STL r5,OFF(last_task_used_math)(r4) 117 PPC_STL r5,ADDROFF(last_task_used_math)(r4)
118#endif /* CONFIG_SMP */ 118#endif /* CONFIG_SMP */
119 blr 119 blr
120 120
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 1c066d125375..308268466342 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -154,12 +154,12 @@ _GLOBAL(__secondary_hold)
154 bne 100b 154 bne 100b
155 155
156#ifdef CONFIG_HMT 156#ifdef CONFIG_HMT
157 LOADADDR(r4, .hmt_init) 157 SET_REG_IMMEDIATE(r4, .hmt_init)
158 mtctr r4 158 mtctr r4
159 bctr 159 bctr
160#else 160#else
161#ifdef CONFIG_SMP 161#ifdef CONFIG_SMP
162 LOADADDR(r4, .pSeries_secondary_smp_init) 162 LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
163 mtctr r4 163 mtctr r4
164 mr r3,r24 164 mr r3,r24
165 bctr 165 bctr
@@ -205,9 +205,10 @@ exception_marker:
205#define EX_LR 72 205#define EX_LR 72
206 206
207/* 207/*
208 * We're short on space and time in the exception prolog, so we can't use 208 * We're short on space and time in the exception prolog, so we can't
209 * the normal LOADADDR macro. Normally we just need the low halfword of the 209 * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
210 * address, but for Kdump we need the whole low word. 210 * low halfword of the address, but for Kdump we need the whole low
211 * word.
211 */ 212 */
212#ifdef CONFIG_CRASH_DUMP 213#ifdef CONFIG_CRASH_DUMP
213#define LOAD_HANDLER(reg, label) \ 214#define LOAD_HANDLER(reg, label) \
@@ -254,8 +255,9 @@ exception_marker:
254 255
255#define EXCEPTION_PROLOG_ISERIES_2 \ 256#define EXCEPTION_PROLOG_ISERIES_2 \
256 mfmsr r10; \ 257 mfmsr r10; \
257 ld r11,PACALPPACA+LPPACASRR0(r13); \ 258 ld r12,PACALPPACAPTR(r13); \
258 ld r12,PACALPPACA+LPPACASRR1(r13); \ 259 ld r11,LPPACASRR0(r12); \
260 ld r12,LPPACASRR1(r12); \
259 ori r10,r10,MSR_RI; \ 261 ori r10,r10,MSR_RI; \
260 mtmsrd r10,1 262 mtmsrd r10,1
261 263
@@ -634,7 +636,8 @@ data_access_slb_iSeries:
634 std r12,PACA_EXSLB+EX_R12(r13) 636 std r12,PACA_EXSLB+EX_R12(r13)
635 mfspr r10,SPRN_SPRG1 637 mfspr r10,SPRN_SPRG1
636 std r10,PACA_EXSLB+EX_R13(r13) 638 std r10,PACA_EXSLB+EX_R13(r13)
637 ld r12,PACALPPACA+LPPACASRR1(r13); 639 ld r12,PACALPPACAPTR(r13)
640 ld r12,LPPACASRR1(r12)
638 b .slb_miss_realmode 641 b .slb_miss_realmode
639 642
640 STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN) 643 STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN)
@@ -644,7 +647,8 @@ instruction_access_slb_iSeries:
644 mtspr SPRN_SPRG1,r13 /* save r13 */ 647 mtspr SPRN_SPRG1,r13 /* save r13 */
645 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 648 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */
646 std r3,PACA_EXSLB+EX_R3(r13) 649 std r3,PACA_EXSLB+EX_R3(r13)
647 ld r3,PACALPPACA+LPPACASRR0(r13) /* get SRR0 value */ 650 ld r3,PACALPPACAPTR(r13)
651 ld r3,LPPACASRR0(r3) /* get SRR0 value */
648 std r9,PACA_EXSLB+EX_R9(r13) 652 std r9,PACA_EXSLB+EX_R9(r13)
649 mfcr r9 653 mfcr r9
650#ifdef __DISABLED__ 654#ifdef __DISABLED__
@@ -656,7 +660,8 @@ instruction_access_slb_iSeries:
656 std r12,PACA_EXSLB+EX_R12(r13) 660 std r12,PACA_EXSLB+EX_R12(r13)
657 mfspr r10,SPRN_SPRG1 661 mfspr r10,SPRN_SPRG1
658 std r10,PACA_EXSLB+EX_R13(r13) 662 std r10,PACA_EXSLB+EX_R13(r13)
659 ld r12,PACALPPACA+LPPACASRR1(r13); 663 ld r12,PACALPPACAPTR(r13)
664 ld r12,LPPACASRR1(r12)
660 b .slb_miss_realmode 665 b .slb_miss_realmode
661 666
662#ifdef __DISABLED__ 667#ifdef __DISABLED__
@@ -713,7 +718,7 @@ system_reset_iSeries:
713 lbz r23,PACAPROCSTART(r13) /* Test if this processor 718 lbz r23,PACAPROCSTART(r13) /* Test if this processor
714 * should start */ 719 * should start */
715 sync 720 sync
716 LOADADDR(r3,current_set) 721 LOAD_REG_IMMEDIATE(r3,current_set)
717 sldi r28,r24,3 /* get current_set[cpu#] */ 722 sldi r28,r24,3 /* get current_set[cpu#] */
718 ldx r3,r3,r28 723 ldx r3,r3,r28
719 addi r1,r3,THREAD_SIZE 724 addi r1,r3,THREAD_SIZE
@@ -745,17 +750,19 @@ iSeries_secondary_smp_loop:
745 .globl decrementer_iSeries_masked 750 .globl decrementer_iSeries_masked
746decrementer_iSeries_masked: 751decrementer_iSeries_masked:
747 li r11,1 752 li r11,1
748 stb r11,PACALPPACA+LPPACADECRINT(r13) 753 ld r12,PACALPPACAPTR(r13)
749 LOADBASE(r12,tb_ticks_per_jiffy) 754 stb r11,LPPACADECRINT(r12)
750 lwz r12,OFF(tb_ticks_per_jiffy)(r12) 755 LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy)
756 lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12)
751 mtspr SPRN_DEC,r12 757 mtspr SPRN_DEC,r12
752 /* fall through */ 758 /* fall through */
753 759
754 .globl hardware_interrupt_iSeries_masked 760 .globl hardware_interrupt_iSeries_masked
755hardware_interrupt_iSeries_masked: 761hardware_interrupt_iSeries_masked:
756 mtcrf 0x80,r9 /* Restore regs */ 762 mtcrf 0x80,r9 /* Restore regs */
757 ld r11,PACALPPACA+LPPACASRR0(r13) 763 ld r12,PACALPPACAPTR(r13)
758 ld r12,PACALPPACA+LPPACASRR1(r13) 764 ld r11,LPPACASRR0(r12)
765 ld r12,LPPACASRR1(r12)
759 mtspr SPRN_SRR0,r11 766 mtspr SPRN_SRR0,r11
760 mtspr SPRN_SRR1,r12 767 mtspr SPRN_SRR1,r12
761 ld r9,PACA_EXGEN+EX_R9(r13) 768 ld r9,PACA_EXGEN+EX_R9(r13)
@@ -994,7 +1001,8 @@ _GLOBAL(slb_miss_realmode)
994 ld r3,PACA_EXSLB+EX_R3(r13) 1001 ld r3,PACA_EXSLB+EX_R3(r13)
995 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ 1002 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
996#ifdef CONFIG_PPC_ISERIES 1003#ifdef CONFIG_PPC_ISERIES
997 ld r11,PACALPPACA+LPPACASRR0(r13) /* get SRR0 value */ 1004 ld r11,PACALPPACAPTR(r13)
1005 ld r11,LPPACASRR0(r11) /* get SRR0 value */
998#endif /* CONFIG_PPC_ISERIES */ 1006#endif /* CONFIG_PPC_ISERIES */
999 1007
1000 mtlr r10 1008 mtlr r10
@@ -1412,7 +1420,7 @@ _GLOBAL(pSeries_secondary_smp_init)
1412 * physical cpu id in r24, we need to search the pacas to find 1420 * physical cpu id in r24, we need to search the pacas to find
1413 * which logical id maps to our physical one. 1421 * which logical id maps to our physical one.
1414 */ 1422 */
1415 LOADADDR(r13, paca) /* Get base vaddr of paca array */ 1423 LOAD_REG_IMMEDIATE(r13, paca) /* Get base vaddr of paca array */
1416 li r5,0 /* logical cpu id */ 1424 li r5,0 /* logical cpu id */
14171: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */ 14251: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */
1418 cmpw r6,r24 /* Compare to our id */ 1426 cmpw r6,r24 /* Compare to our id */
@@ -1446,8 +1454,8 @@ _GLOBAL(pSeries_secondary_smp_init)
1446#ifdef CONFIG_PPC_ISERIES 1454#ifdef CONFIG_PPC_ISERIES
1447_STATIC(__start_initialization_iSeries) 1455_STATIC(__start_initialization_iSeries)
1448 /* Clear out the BSS */ 1456 /* Clear out the BSS */
1449 LOADADDR(r11,__bss_stop) 1457 LOAD_REG_IMMEDIATE(r11,__bss_stop)
1450 LOADADDR(r8,__bss_start) 1458 LOAD_REG_IMMEDIATE(r8,__bss_start)
1451 sub r11,r11,r8 /* bss size */ 1459 sub r11,r11,r8 /* bss size */
1452 addi r11,r11,7 /* round up to an even double word */ 1460 addi r11,r11,7 /* round up to an even double word */
1453 rldicl. r11,r11,61,3 /* shift right by 3 */ 1461 rldicl. r11,r11,61,3 /* shift right by 3 */
@@ -1458,17 +1466,17 @@ _STATIC(__start_initialization_iSeries)
14583: stdu r0,8(r8) 14663: stdu r0,8(r8)
1459 bdnz 3b 1467 bdnz 3b
14604: 14684:
1461 LOADADDR(r1,init_thread_union) 1469 LOAD_REG_IMMEDIATE(r1,init_thread_union)
1462 addi r1,r1,THREAD_SIZE 1470 addi r1,r1,THREAD_SIZE
1463 li r0,0 1471 li r0,0
1464 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1472 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1465 1473
1466 LOADADDR(r3,cpu_specs) 1474 LOAD_REG_IMMEDIATE(r3,cpu_specs)
1467 LOADADDR(r4,cur_cpu_spec) 1475 LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
1468 li r5,0 1476 li r5,0
1469 bl .identify_cpu 1477 bl .identify_cpu
1470 1478
1471 LOADADDR(r2,__toc_start) 1479 LOAD_REG_IMMEDIATE(r2,__toc_start)
1472 addi r2,r2,0x4000 1480 addi r2,r2,0x4000
1473 addi r2,r2,0x4000 1481 addi r2,r2,0x4000
1474 1482
@@ -1528,7 +1536,7 @@ _GLOBAL(__start_initialization_multiplatform)
1528 li r24,0 1536 li r24,0
1529 1537
1530 /* Switch off MMU if not already */ 1538 /* Switch off MMU if not already */
1531 LOADADDR(r4, .__after_prom_start - KERNELBASE) 1539 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
1532 add r4,r4,r30 1540 add r4,r4,r30
1533 bl .__mmu_off 1541 bl .__mmu_off
1534 b .__after_prom_start 1542 b .__after_prom_start
@@ -1548,7 +1556,7 @@ _STATIC(__boot_from_prom)
1548 /* put a relocation offset into r3 */ 1556 /* put a relocation offset into r3 */
1549 bl .reloc_offset 1557 bl .reloc_offset
1550 1558
1551 LOADADDR(r2,__toc_start) 1559 LOAD_REG_IMMEDIATE(r2,__toc_start)
1552 addi r2,r2,0x4000 1560 addi r2,r2,0x4000
1553 addi r2,r2,0x4000 1561 addi r2,r2,0x4000
1554 1562
@@ -1588,9 +1596,9 @@ _STATIC(__after_prom_start)
1588 */ 1596 */
1589 bl .reloc_offset 1597 bl .reloc_offset
1590 mr r26,r3 1598 mr r26,r3
1591 SET_REG_TO_CONST(r27,KERNELBASE) 1599 LOAD_REG_IMMEDIATE(r27, KERNELBASE)
1592 1600
1593 LOADADDR(r3, PHYSICAL_START) /* target addr */ 1601 LOAD_REG_IMMEDIATE(r3, PHYSICAL_START) /* target addr */
1594 1602
1595 // XXX FIXME: Use phys returned by OF (r30) 1603 // XXX FIXME: Use phys returned by OF (r30)
1596 add r4,r27,r26 /* source addr */ 1604 add r4,r27,r26 /* source addr */
@@ -1598,7 +1606,7 @@ _STATIC(__after_prom_start)
1598 /* i.e. where we are running */ 1606 /* i.e. where we are running */
1599 /* the source addr */ 1607 /* the source addr */
1600 1608
1601 LOADADDR(r5,copy_to_here) /* # bytes of memory to copy */ 1609 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1602 sub r5,r5,r27 1610 sub r5,r5,r27
1603 1611
1604 li r6,0x100 /* Start offset, the first 0x100 */ 1612 li r6,0x100 /* Start offset, the first 0x100 */
@@ -1608,11 +1616,11 @@ _STATIC(__after_prom_start)
1608 /* this includes the code being */ 1616 /* this includes the code being */
1609 /* executed here. */ 1617 /* executed here. */
1610 1618
1611 LOADADDR(r0, 4f) /* Jump to the copy of this code */ 1619 LOAD_REG_IMMEDIATE(r0, 4f) /* Jump to the copy of this code */
1612 mtctr r0 /* that we just made/relocated */ 1620 mtctr r0 /* that we just made/relocated */
1613 bctr 1621 bctr
1614 1622
16154: LOADADDR(r5,klimit) 16234: LOAD_REG_IMMEDIATE(r5,klimit)
1616 add r5,r5,r26 1624 add r5,r5,r26
1617 ld r5,0(r5) /* get the value of klimit */ 1625 ld r5,0(r5) /* get the value of klimit */
1618 sub r5,r5,r27 1626 sub r5,r5,r27
@@ -1694,7 +1702,7 @@ _GLOBAL(pmac_secondary_start)
1694 mtmsrd r3 /* RI on */ 1702 mtmsrd r3 /* RI on */
1695 1703
1696 /* Set up a paca value for this processor. */ 1704 /* Set up a paca value for this processor. */
1697 LOADADDR(r4, paca) /* Get base vaddr of paca array */ 1705 LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */
1698 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ 1706 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */
1699 add r13,r13,r4 /* for this processor. */ 1707 add r13,r13,r4 /* for this processor. */
1700 mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */ 1708 mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */
@@ -1731,7 +1739,7 @@ _GLOBAL(__secondary_start)
1731 bl .early_setup_secondary 1739 bl .early_setup_secondary
1732 1740
1733 /* Initialize the kernel stack. Just a repeat for iSeries. */ 1741 /* Initialize the kernel stack. Just a repeat for iSeries. */
1734 LOADADDR(r3,current_set) 1742 LOAD_REG_ADDR(r3, current_set)
1735 sldi r28,r24,3 /* get current_set[cpu#] */ 1743 sldi r28,r24,3 /* get current_set[cpu#] */
1736 ldx r1,r3,r28 1744 ldx r1,r3,r28
1737 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD 1745 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
@@ -1742,8 +1750,8 @@ _GLOBAL(__secondary_start)
1742 mtlr r7 1750 mtlr r7
1743 1751
1744 /* enable MMU and jump to start_secondary */ 1752 /* enable MMU and jump to start_secondary */
1745 LOADADDR(r3,.start_secondary_prolog) 1753 LOAD_REG_ADDR(r3, .start_secondary_prolog)
1746 SET_REG_TO_CONST(r4, MSR_KERNEL) 1754 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
1747#ifdef DO_SOFT_DISABLE 1755#ifdef DO_SOFT_DISABLE
1748 ori r4,r4,MSR_EE 1756 ori r4,r4,MSR_EE
1749#endif 1757#endif
@@ -1792,8 +1800,8 @@ _STATIC(start_here_multiplatform)
1792 * be detached from the kernel completely. Besides, we need 1800 * be detached from the kernel completely. Besides, we need
1793 * to clear it now for kexec-style entry. 1801 * to clear it now for kexec-style entry.
1794 */ 1802 */
1795 LOADADDR(r11,__bss_stop) 1803 LOAD_REG_IMMEDIATE(r11,__bss_stop)
1796 LOADADDR(r8,__bss_start) 1804 LOAD_REG_IMMEDIATE(r8,__bss_start)
1797 sub r11,r11,r8 /* bss size */ 1805 sub r11,r11,r8 /* bss size */
1798 addi r11,r11,7 /* round up to an even double word */ 1806 addi r11,r11,7 /* round up to an even double word */
1799 rldicl. r11,r11,61,3 /* shift right by 3 */ 1807 rldicl. r11,r11,61,3 /* shift right by 3 */
@@ -1831,7 +1839,7 @@ _STATIC(start_here_multiplatform)
1831 /* up the htab. This is done because we have relocated the */ 1839 /* up the htab. This is done because we have relocated the */
1832 /* kernel but are still running in real mode. */ 1840 /* kernel but are still running in real mode. */
1833 1841
1834 LOADADDR(r3,init_thread_union) 1842 LOAD_REG_IMMEDIATE(r3,init_thread_union)
1835 add r3,r3,r26 1843 add r3,r3,r26
1836 1844
1837 /* set up a stack pointer (physical address) */ 1845 /* set up a stack pointer (physical address) */
@@ -1840,14 +1848,14 @@ _STATIC(start_here_multiplatform)
1840 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1848 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1841 1849
1842 /* set up the TOC (physical address) */ 1850 /* set up the TOC (physical address) */
1843 LOADADDR(r2,__toc_start) 1851 LOAD_REG_IMMEDIATE(r2,__toc_start)
1844 addi r2,r2,0x4000 1852 addi r2,r2,0x4000
1845 addi r2,r2,0x4000 1853 addi r2,r2,0x4000
1846 add r2,r2,r26 1854 add r2,r2,r26
1847 1855
1848 LOADADDR(r3,cpu_specs) 1856 LOAD_REG_IMMEDIATE(r3, cpu_specs)
1849 add r3,r3,r26 1857 add r3,r3,r26
1850 LOADADDR(r4,cur_cpu_spec) 1858 LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
1851 add r4,r4,r26 1859 add r4,r4,r26
1852 mr r5,r26 1860 mr r5,r26
1853 bl .identify_cpu 1861 bl .identify_cpu
@@ -1863,11 +1871,11 @@ _STATIC(start_here_multiplatform)
1863 * nowhere it can be initialized differently before we reach this 1871 * nowhere it can be initialized differently before we reach this
1864 * code 1872 * code
1865 */ 1873 */
1866 LOADADDR(r27, boot_cpuid) 1874 LOAD_REG_IMMEDIATE(r27, boot_cpuid)
1867 add r27,r27,r26 1875 add r27,r27,r26
1868 lwz r27,0(r27) 1876 lwz r27,0(r27)
1869 1877
1870 LOADADDR(r24, paca) /* Get base vaddr of paca array */ 1878 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1871 mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */ 1879 mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */
1872 add r13,r13,r24 /* for this processor. */ 1880 add r13,r13,r24 /* for this processor. */
1873 add r13,r13,r26 /* convert to physical addr */ 1881 add r13,r13,r26 /* convert to physical addr */
@@ -1880,8 +1888,8 @@ _STATIC(start_here_multiplatform)
1880 mr r3,r31 1888 mr r3,r31
1881 bl .early_setup 1889 bl .early_setup
1882 1890
1883 LOADADDR(r3,.start_here_common) 1891 LOAD_REG_IMMEDIATE(r3, .start_here_common)
1884 SET_REG_TO_CONST(r4, MSR_KERNEL) 1892 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
1885 mtspr SPRN_SRR0,r3 1893 mtspr SPRN_SRR0,r3
1886 mtspr SPRN_SRR1,r4 1894 mtspr SPRN_SRR1,r4
1887 rfid 1895 rfid
@@ -1895,7 +1903,7 @@ _STATIC(start_here_common)
1895 /* The following code sets up the SP and TOC now that we are */ 1903 /* The following code sets up the SP and TOC now that we are */
1896 /* running with translation enabled. */ 1904 /* running with translation enabled. */
1897 1905
1898 LOADADDR(r3,init_thread_union) 1906 LOAD_REG_IMMEDIATE(r3,init_thread_union)
1899 1907
1900 /* set up the stack */ 1908 /* set up the stack */
1901 addi r1,r3,THREAD_SIZE 1909 addi r1,r3,THREAD_SIZE
@@ -1908,16 +1916,16 @@ _STATIC(start_here_common)
1908 li r3,0 1916 li r3,0
1909 bl .do_cpu_ftr_fixups 1917 bl .do_cpu_ftr_fixups
1910 1918
1911 LOADADDR(r26, boot_cpuid) 1919 LOAD_REG_IMMEDIATE(r26, boot_cpuid)
1912 lwz r26,0(r26) 1920 lwz r26,0(r26)
1913 1921
1914 LOADADDR(r24, paca) /* Get base vaddr of paca array */ 1922 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1915 mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */ 1923 mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
1916 add r13,r13,r24 /* for this processor. */ 1924 add r13,r13,r24 /* for this processor. */
1917 mtspr SPRN_SPRG3,r13 1925 mtspr SPRN_SPRG3,r13
1918 1926
1919 /* ptr to current */ 1927 /* ptr to current */
1920 LOADADDR(r4,init_task) 1928 LOAD_REG_IMMEDIATE(r4, init_task)
1921 std r4,PACACURRENT(r13) 1929 std r4,PACACURRENT(r13)
1922 1930
1923 /* Load the TOC */ 1931 /* Load the TOC */
@@ -1940,7 +1948,7 @@ _STATIC(start_here_common)
1940 1948
1941_GLOBAL(hmt_init) 1949_GLOBAL(hmt_init)
1942#ifdef CONFIG_HMT 1950#ifdef CONFIG_HMT
1943 LOADADDR(r5, hmt_thread_data) 1951 LOAD_REG_IMMEDIATE(r5, hmt_thread_data)
1944 mfspr r7,SPRN_PVR 1952 mfspr r7,SPRN_PVR
1945 srwi r7,r7,16 1953 srwi r7,r7,16
1946 cmpwi r7,0x34 /* Pulsar */ 1954 cmpwi r7,0x34 /* Pulsar */
@@ -1961,7 +1969,7 @@ _GLOBAL(hmt_init)
1961 b 101f 1969 b 101f
1962 1970
1963__hmt_secondary_hold: 1971__hmt_secondary_hold:
1964 LOADADDR(r5, hmt_thread_data) 1972 LOAD_REG_IMMEDIATE(r5, hmt_thread_data)
1965 clrldi r5,r5,4 1973 clrldi r5,r5,4
1966 li r7,0 1974 li r7,0
1967 mfspr r6,SPRN_PIR 1975 mfspr r6,SPRN_PIR
@@ -1989,7 +1997,7 @@ __hmt_secondary_hold:
1989 1997
1990#ifdef CONFIG_HMT 1998#ifdef CONFIG_HMT
1991_GLOBAL(hmt_start_secondary) 1999_GLOBAL(hmt_start_secondary)
1992 LOADADDR(r4,__hmt_secondary_hold) 2000 LOAD_REG_IMMEDIATE(r4,__hmt_secondary_hold)
1993 clrldi r4,r4,4 2001 clrldi r4,r4,4
1994 mtspr SPRN_NIADORM, r4 2002 mtspr SPRN_NIADORM, r4
1995 mfspr r4, SPRN_MSRDORM 2003 mfspr r4, SPRN_MSRDORM
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 1494e2f177f7..c16b4afab582 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -38,14 +38,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
38 /* We must dynamically check for the NAP feature as it 38 /* We must dynamically check for the NAP feature as it
39 * can be cleared by CPU init after the fixups are done 39 * can be cleared by CPU init after the fixups are done
40 */ 40 */
41 LOADBASE(r3,cur_cpu_spec) 41 LOAD_REG_ADDRBASE(r3,cur_cpu_spec)
42 ld r4,OFF(cur_cpu_spec)(r3) 42 ld r4,ADDROFF(cur_cpu_spec)(r3)
43 ld r4,CPU_SPEC_FEATURES(r4) 43 ld r4,CPU_SPEC_FEATURES(r4)
44 andi. r0,r4,CPU_FTR_CAN_NAP 44 andi. r0,r4,CPU_FTR_CAN_NAP
45 beqlr 45 beqlr
46 /* Now check if user or arch enabled NAP mode */ 46 /* Now check if user or arch enabled NAP mode */
47 LOADBASE(r3,powersave_nap) 47 LOAD_REG_ADDRBASE(r3,powersave_nap)
48 lwz r4,OFF(powersave_nap)(r3) 48 lwz r4,ADDROFF(powersave_nap)(r3)
49 cmpwi 0,r4,0 49 cmpwi 0,r4,0
50 beqlr 50 beqlr
51 51
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5651032d8706..d1fffce86df9 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -238,14 +238,10 @@ void do_IRQ(struct pt_regs *regs)
238 irq_exit(); 238 irq_exit();
239 239
240#ifdef CONFIG_PPC_ISERIES 240#ifdef CONFIG_PPC_ISERIES
241 { 241 if (get_lppaca()->int_dword.fields.decr_int) {
242 struct paca_struct *lpaca = get_paca(); 242 get_lppaca()->int_dword.fields.decr_int = 0;
243 243 /* Signal a fake decrementer interrupt */
244 if (lpaca->lppaca.int_dword.fields.decr_int) { 244 timer_interrupt(regs);
245 lpaca->lppaca.int_dword.fields.decr_int = 0;
246 /* Signal a fake decrementer interrupt */
247 timer_interrupt(regs);
248 }
249 } 245 }
250#endif 246#endif
251} 247}
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 9dda16ccde78..1ae96a8ed7e2 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -55,15 +55,13 @@ static unsigned long get_purr(void)
55{ 55{
56 unsigned long sum_purr = 0; 56 unsigned long sum_purr = 0;
57 int cpu; 57 int cpu;
58 struct paca_struct *lpaca;
59 58
60 for_each_cpu(cpu) { 59 for_each_cpu(cpu) {
61 lpaca = paca + cpu; 60 sum_purr += lppaca[cpu].emulated_time_base;
62 sum_purr += lpaca->lppaca.emulated_time_base;
63 61
64#ifdef PURR_DEBUG 62#ifdef PURR_DEBUG
65 printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n", 63 printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n",
66 cpu, lpaca->lppaca.emulated_time_base); 64 cpu, lppaca[cpu].emulated_time_base);
67#endif 65#endif
68 } 66 }
69 return sum_purr; 67 return sum_purr;
@@ -79,12 +77,11 @@ static int lparcfg_data(struct seq_file *m, void *v)
79 unsigned long pool_id, lp_index; 77 unsigned long pool_id, lp_index;
80 int shared, entitled_capacity, max_entitled_capacity; 78 int shared, entitled_capacity, max_entitled_capacity;
81 int processors, max_processors; 79 int processors, max_processors;
82 struct paca_struct *lpaca = get_paca();
83 unsigned long purr = get_purr(); 80 unsigned long purr = get_purr();
84 81
85 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); 82 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
86 83
87 shared = (int)(lpaca->lppaca_ptr->shared_proc); 84 shared = (int)(get_lppaca()->shared_proc);
88 seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n", 85 seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
89 e2a(xItExtVpdPanel.mfgID[2]), 86 e2a(xItExtVpdPanel.mfgID[2]),
90 e2a(xItExtVpdPanel.mfgID[3]), 87 e2a(xItExtVpdPanel.mfgID[3]),
@@ -402,7 +399,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
402 (h_resource >> 0 * 8) & 0xffff); 399 (h_resource >> 0 * 8) & 0xffff);
403 400
404 /* pool related entries are apropriate for shared configs */ 401 /* pool related entries are apropriate for shared configs */
405 if (paca[0].lppaca.shared_proc) { 402 if (lppaca[0].shared_proc) {
406 403
407 h_pic(&pool_idle_time, &pool_procs); 404 h_pic(&pool_idle_time, &pool_procs);
408 405
@@ -451,7 +448,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
451 seq_printf(m, "partition_potential_processors=%d\n", 448 seq_printf(m, "partition_potential_processors=%d\n",
452 partition_potential_processors); 449 partition_potential_processors);
453 450
454 seq_printf(m, "shared_processor_mode=%d\n", paca[0].lppaca.shared_proc); 451 seq_printf(m, "shared_processor_mode=%d\n", lppaca[0].shared_proc);
455 452
456 return 0; 453 return 0;
457} 454}
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 01d0d97a16e1..be982023409e 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -68,7 +68,7 @@ _GLOBAL(reloc_offset)
68 mflr r0 68 mflr r0
69 bl 1f 69 bl 1f
701: mflr r3 701: mflr r3
71 LOADADDR(r4,1b) 71 LOAD_REG_IMMEDIATE(r4,1b)
72 subf r3,r4,r3 72 subf r3,r4,r3
73 mtlr r0 73 mtlr r0
74 blr 74 blr
@@ -80,7 +80,7 @@ _GLOBAL(add_reloc_offset)
80 mflr r0 80 mflr r0
81 bl 1f 81 bl 1f
821: mflr r5 821: mflr r5
83 LOADADDR(r4,1b) 83 LOAD_REG_IMMEDIATE(r4,1b)
84 subf r5,r4,r5 84 subf r5,r4,r5
85 add r3,r3,r5 85 add r3,r3,r5
86 mtlr r0 86 mtlr r0
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index ae48a002f81a..2778cce058e2 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -39,7 +39,7 @@ _GLOBAL(reloc_offset)
39 mflr r0 39 mflr r0
40 bl 1f 40 bl 1f
411: mflr r3 411: mflr r3
42 LOADADDR(r4,1b) 42 LOAD_REG_IMMEDIATE(r4,1b)
43 subf r3,r4,r3 43 subf r3,r4,r3
44 mtlr r0 44 mtlr r0
45 blr 45 blr
@@ -51,7 +51,7 @@ _GLOBAL(add_reloc_offset)
51 mflr r0 51 mflr r0
52 bl 1f 52 bl 1f
531: mflr r5 531: mflr r5
54 LOADADDR(r4,1b) 54 LOAD_REG_IMMEDIATE(r4,1b)
55 subf r5,r4,r5 55 subf r5,r4,r5
56 add r3,r3,r5 56 add r3,r3,r5
57 mtlr r0 57 mtlr r0
@@ -498,15 +498,15 @@ _GLOBAL(identify_cpu)
498 */ 498 */
499_GLOBAL(do_cpu_ftr_fixups) 499_GLOBAL(do_cpu_ftr_fixups)
500 /* Get CPU 0 features */ 500 /* Get CPU 0 features */
501 LOADADDR(r6,cur_cpu_spec) 501 LOAD_REG_IMMEDIATE(r6,cur_cpu_spec)
502 sub r6,r6,r3 502 sub r6,r6,r3
503 ld r4,0(r6) 503 ld r4,0(r6)
504 sub r4,r4,r3 504 sub r4,r4,r3
505 ld r4,CPU_SPEC_FEATURES(r4) 505 ld r4,CPU_SPEC_FEATURES(r4)
506 /* Get the fixup table */ 506 /* Get the fixup table */
507 LOADADDR(r6,__start___ftr_fixup) 507 LOAD_REG_IMMEDIATE(r6,__start___ftr_fixup)
508 sub r6,r6,r3 508 sub r6,r6,r3
509 LOADADDR(r7,__stop___ftr_fixup) 509 LOAD_REG_IMMEDIATE(r7,__stop___ftr_fixup)
510 sub r7,r7,r3 510 sub r7,r7,r3
511 /* Do the fixup */ 511 /* Do the fixup */
5121: cmpld r6,r7 5121: cmpld r6,r7
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 999bdd816769..5d1b708086bd 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -25,6 +25,28 @@
25 * field correctly */ 25 * field correctly */
26extern unsigned long __toc_start; 26extern unsigned long __toc_start;
27 27
28/*
29 * iSeries structure which the hypervisor knows about - this structure
30 * should not cross a page boundary. The vpa_init/register_vpa call
31 * is now known to fail if the lppaca structure crosses a page
32 * boundary. The lppaca is also used on POWER5 pSeries boxes. The
33 * lppaca is 640 bytes long, and cannot readily change since the
34 * hypervisor knows its layout, so a 1kB alignment will suffice to
35 * ensure that it doesn't cross a page boundary.
36 */
37struct lppaca lppaca[] = {
38 [0 ... (NR_CPUS-1)] = {
39 .desc = 0xd397d781, /* "LpPa" */
40 .size = sizeof(struct lppaca),
41 .dyn_proc_status = 2,
42 .decr_val = 0x00ff0000,
43 .fpregs_in_use = 1,
44 .end_of_quantum = 0xfffffffffffffffful,
45 .slb_count = 64,
46 .vmxregs_in_use = 0,
47 },
48};
49
28/* The Paca is an array with one entry per processor. Each contains an 50/* The Paca is an array with one entry per processor. Each contains an
29 * lppaca, which contains the information shared between the 51 * lppaca, which contains the information shared between the
30 * hypervisor and Linux. 52 * hypervisor and Linux.
@@ -35,27 +57,17 @@ extern unsigned long __toc_start;
35 * processor (not thread). 57 * processor (not thread).
36 */ 58 */
37#define PACA_INIT_COMMON(number, start, asrr, asrv) \ 59#define PACA_INIT_COMMON(number, start, asrr, asrv) \
60 .lppaca_ptr = &lppaca[number], \
38 .lock_token = 0x8000, \ 61 .lock_token = 0x8000, \
39 .paca_index = (number), /* Paca Index */ \ 62 .paca_index = (number), /* Paca Index */ \
40 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ 63 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
41 .stab_real = (asrr), /* Real pointer to segment table */ \ 64 .stab_real = (asrr), /* Real pointer to segment table */ \
42 .stab_addr = (asrv), /* Virt pointer to segment table */ \ 65 .stab_addr = (asrv), /* Virt pointer to segment table */ \
43 .cpu_start = (start), /* Processor start */ \ 66 .cpu_start = (start), /* Processor start */ \
44 .hw_cpu_id = 0xffff, \ 67 .hw_cpu_id = 0xffff,
45 .lppaca = { \
46 .desc = 0xd397d781, /* "LpPa" */ \
47 .size = sizeof(struct lppaca), \
48 .dyn_proc_status = 2, \
49 .decr_val = 0x00ff0000, \
50 .fpregs_in_use = 1, \
51 .end_of_quantum = 0xfffffffffffffffful, \
52 .slb_count = 64, \
53 .vmxregs_in_use = 0, \
54 }, \
55 68
56#ifdef CONFIG_PPC_ISERIES 69#ifdef CONFIG_PPC_ISERIES
57#define PACA_INIT_ISERIES(number) \ 70#define PACA_INIT_ISERIES(number) \
58 .lppaca_ptr = &paca[number].lppaca, \
59 .reg_save_ptr = &iseries_reg_save[number], 71 .reg_save_ptr = &iseries_reg_save[number],
60 72
61#define PACA_INIT(number) \ 73#define PACA_INIT(number) \
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 16d9a904f3cb..d9a459c144d8 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -230,8 +230,7 @@ EXPORT_SYMBOL(__down_interruptible);
230EXPORT_SYMBOL(cpm_install_handler); 230EXPORT_SYMBOL(cpm_install_handler);
231EXPORT_SYMBOL(cpm_free_handler); 231EXPORT_SYMBOL(cpm_free_handler);
232#endif /* CONFIG_8xx */ 232#endif /* CONFIG_8xx */
233#if defined(CONFIG_8xx) || defined(CONFIG_40x) || defined(CONFIG_85xx) ||\ 233#if defined(CONFIG_8xx) || defined(CONFIG_40x)
234 defined(CONFIG_83xx)
235EXPORT_SYMBOL(__res); 234EXPORT_SYMBOL(__res);
236#endif 235#endif
237 236
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 02e2115323e4..d50c8df0183e 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1627,6 +1627,11 @@ static void of_node_release(struct kref *kref)
1627 kfree(prop->value); 1627 kfree(prop->value);
1628 kfree(prop); 1628 kfree(prop);
1629 prop = next; 1629 prop = next;
1630
1631 if (!prop) {
1632 prop = node->deadprops;
1633 node->deadprops = NULL;
1634 }
1630 } 1635 }
1631 kfree(node->intrs); 1636 kfree(node->intrs);
1632 kfree(node->full_name); 1637 kfree(node->full_name);
@@ -1774,22 +1779,32 @@ static int __init prom_reconfig_setup(void)
1774__initcall(prom_reconfig_setup); 1779__initcall(prom_reconfig_setup);
1775#endif 1780#endif
1776 1781
1777/* 1782struct property *of_find_property(struct device_node *np, const char *name,
1778 * Find a property with a given name for a given node 1783 int *lenp)
1779 * and return the value.
1780 */
1781unsigned char *get_property(struct device_node *np, const char *name,
1782 int *lenp)
1783{ 1784{
1784 struct property *pp; 1785 struct property *pp;
1785 1786
1787 read_lock(&devtree_lock);
1786 for (pp = np->properties; pp != 0; pp = pp->next) 1788 for (pp = np->properties; pp != 0; pp = pp->next)
1787 if (strcmp(pp->name, name) == 0) { 1789 if (strcmp(pp->name, name) == 0) {
1788 if (lenp != 0) 1790 if (lenp != 0)
1789 *lenp = pp->length; 1791 *lenp = pp->length;
1790 return pp->value; 1792 break;
1791 } 1793 }
1792 return NULL; 1794 read_unlock(&devtree_lock);
1795
1796 return pp;
1797}
1798
1799/*
1800 * Find a property with a given name for a given node
1801 * and return the value.
1802 */
1803unsigned char *get_property(struct device_node *np, const char *name,
1804 int *lenp)
1805{
1806 struct property *pp = of_find_property(np,name,lenp);
1807 return pp ? pp->value : NULL;
1793} 1808}
1794EXPORT_SYMBOL(get_property); 1809EXPORT_SYMBOL(get_property);
1795 1810
@@ -1823,4 +1838,82 @@ int prom_add_property(struct device_node* np, struct property* prop)
1823 return 0; 1838 return 0;
1824} 1839}
1825 1840
1841/*
1842 * Remove a property from a node. Note that we don't actually
1843 * remove it, since we have given out who-knows-how-many pointers
1844 * to the data using get-property. Instead we just move the property
1845 * to the "dead properties" list, so it won't be found any more.
1846 */
1847int prom_remove_property(struct device_node *np, struct property *prop)
1848{
1849 struct property **next;
1850 int found = 0;
1826 1851
1852 write_lock(&devtree_lock);
1853 next = &np->properties;
1854 while (*next) {
1855 if (*next == prop) {
1856 /* found the node */
1857 *next = prop->next;
1858 prop->next = np->deadprops;
1859 np->deadprops = prop;
1860 found = 1;
1861 break;
1862 }
1863 next = &(*next)->next;
1864 }
1865 write_unlock(&devtree_lock);
1866
1867 if (!found)
1868 return -ENODEV;
1869
1870#ifdef CONFIG_PROC_DEVICETREE
1871 /* try to remove the proc node as well */
1872 if (np->pde)
1873 proc_device_tree_remove_prop(np->pde, prop);
1874#endif /* CONFIG_PROC_DEVICETREE */
1875
1876 return 0;
1877}
1878
1879/*
1880 * Update a property in a node. Note that we don't actually
1881 * remove it, since we have given out who-knows-how-many pointers
1882 * to the data using get-property. Instead we just move the property
1883 * to the "dead properties" list, and add the new property to the
1884 * property list
1885 */
1886int prom_update_property(struct device_node *np,
1887 struct property *newprop,
1888 struct property *oldprop)
1889{
1890 struct property **next;
1891 int found = 0;
1892
1893 write_lock(&devtree_lock);
1894 next = &np->properties;
1895 while (*next) {
1896 if (*next == oldprop) {
1897 /* found the node */
1898 newprop->next = oldprop->next;
1899 *next = newprop;
1900 oldprop->next = np->deadprops;
1901 np->deadprops = oldprop;
1902 found = 1;
1903 break;
1904 }
1905 next = &(*next)->next;
1906 }
1907 write_unlock(&devtree_lock);
1908
1909 if (!found)
1910 return -ENODEV;
1911
1912#ifdef CONFIG_PROC_DEVICETREE
1913 /* try to add to proc as well if it was initialized */
1914 if (np->pde)
1915 proc_device_tree_update_prop(np->pde, newprop, oldprop);
1916#endif /* CONFIG_PROC_DEVICETREE */
1917
1918 return 0;
1919}
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 309ae1d5fa77..a8099c806150 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -113,7 +113,8 @@ static unsigned int of_bus_default_get_flags(u32 *addr)
113 113
114static int of_bus_pci_match(struct device_node *np) 114static int of_bus_pci_match(struct device_node *np)
115{ 115{
116 return !strcmp(np->type, "pci"); 116 /* "vci" is for the /chaos bridge on 1st-gen PCI powermacs */
117 return !strcmp(np->type, "pci") || !strcmp(np->type, "vci");
117} 118}
118 119
119static void of_bus_pci_count_cells(struct device_node *np, 120static void of_bus_pci_count_cells(struct device_node *np,
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 4b9cfe4637b1..7fe4a5c944c9 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -36,6 +36,11 @@ struct rtas_t rtas = {
36 .lock = SPIN_LOCK_UNLOCKED 36 .lock = SPIN_LOCK_UNLOCKED
37}; 37};
38 38
39struct rtas_suspend_me_data {
40 long waiting;
41 struct rtas_args *args;
42};
43
39EXPORT_SYMBOL(rtas); 44EXPORT_SYMBOL(rtas);
40 45
41DEFINE_SPINLOCK(rtas_data_buf_lock); 46DEFINE_SPINLOCK(rtas_data_buf_lock);
@@ -556,6 +561,80 @@ void rtas_os_term(char *str)
556 } while (status == RTAS_BUSY); 561 } while (status == RTAS_BUSY);
557} 562}
558 563
564static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
565#ifdef CONFIG_PPC_PSERIES
566static void rtas_percpu_suspend_me(void *info)
567{
568 long rc;
569 long flags;
570 struct rtas_suspend_me_data *data =
571 (struct rtas_suspend_me_data *)info;
572
573 /*
574 * We use "waiting" to indicate our state. As long
575 * as it is >0, we are still trying to all join up.
576 * If it goes to 0, we have successfully joined up and
577 * one thread got H_Continue. If any error happens,
578 * we set it to <0.
579 */
580 local_irq_save(flags);
581 do {
582 rc = plpar_hcall_norets(H_JOIN);
583 smp_rmb();
584 } while (rc == H_Success && data->waiting > 0);
585 if (rc == H_Success)
586 goto out;
587
588 if (rc == H_Continue) {
589 data->waiting = 0;
590 rtas_call(ibm_suspend_me_token, 0, 1,
591 data->args->args);
592 } else {
593 data->waiting = -EBUSY;
594 printk(KERN_ERR "Error on H_Join hypervisor call\n");
595 }
596
597out:
598 /* before we restore interrupts, make sure we don't
599 * generate a spurious soft lockup errors
600 */
601 touch_softlockup_watchdog();
602 local_irq_restore(flags);
603 return;
604}
605
606static int rtas_ibm_suspend_me(struct rtas_args *args)
607{
608 int i;
609
610 struct rtas_suspend_me_data data;
611
612 data.waiting = 1;
613 data.args = args;
614
615 /* Call function on all CPUs. One of us will make the
616 * rtas call
617 */
618 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0))
619 data.waiting = -EINVAL;
620
621 if (data.waiting != 0)
622 printk(KERN_ERR "Error doing global join\n");
623
624 /* Prod each CPU. This won't hurt, and will wake
625 * anyone we successfully put to sleep with H_Join
626 */
627 for_each_cpu(i)
628 plpar_hcall_norets(H_PROD, i);
629
630 return data.waiting;
631}
632#else /* CONFIG_PPC_PSERIES */
633static int rtas_ibm_suspend_me(struct rtas_args *args)
634{
635 return -ENOSYS;
636}
637#endif
559 638
560asmlinkage int ppc_rtas(struct rtas_args __user *uargs) 639asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
561{ 640{
@@ -563,6 +642,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
563 unsigned long flags; 642 unsigned long flags;
564 char *buff_copy, *errbuf = NULL; 643 char *buff_copy, *errbuf = NULL;
565 int nargs; 644 int nargs;
645 int rc;
566 646
567 if (!capable(CAP_SYS_ADMIN)) 647 if (!capable(CAP_SYS_ADMIN))
568 return -EPERM; 648 return -EPERM;
@@ -581,6 +661,17 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
581 nargs * sizeof(rtas_arg_t)) != 0) 661 nargs * sizeof(rtas_arg_t)) != 0)
582 return -EFAULT; 662 return -EFAULT;
583 663
664 if (args.token == RTAS_UNKNOWN_SERVICE)
665 return -EINVAL;
666
667 /* Need to handle ibm,suspend_me call specially */
668 if (args.token == ibm_suspend_me_token) {
669 rc = rtas_ibm_suspend_me(&args);
670 if (rc)
671 return rc;
672 goto copy_return;
673 }
674
584 buff_copy = get_errorlog_buffer(); 675 buff_copy = get_errorlog_buffer();
585 676
586 spin_lock_irqsave(&rtas.lock, flags); 677 spin_lock_irqsave(&rtas.lock, flags);
@@ -604,6 +695,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
604 kfree(buff_copy); 695 kfree(buff_copy);
605 } 696 }
606 697
698 copy_return:
607 /* Copy out args. */ 699 /* Copy out args. */
608 if (copy_to_user(uargs->args + nargs, 700 if (copy_to_user(uargs->args + nargs,
609 args.args + nargs, 701 args.args + nargs,
@@ -675,8 +767,10 @@ void __init rtas_initialize(void)
675 * the stop-self token if any 767 * the stop-self token if any
676 */ 768 */
677#ifdef CONFIG_PPC64 769#ifdef CONFIG_PPC64
678 if (_machine == PLATFORM_PSERIES_LPAR) 770 if (_machine == PLATFORM_PSERIES_LPAR) {
679 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); 771 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
772 ibm_suspend_me_token = rtas_token("ibm,suspend-me");
773 }
680#endif 774#endif
681 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region); 775 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
682 776
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index d5c52fae023a..be12041c0fc5 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -100,7 +100,8 @@ void machine_shutdown(void)
100void machine_restart(char *cmd) 100void machine_restart(char *cmd)
101{ 101{
102 machine_shutdown(); 102 machine_shutdown();
103 ppc_md.restart(cmd); 103 if (ppc_md.restart)
104 ppc_md.restart(cmd);
104#ifdef CONFIG_SMP 105#ifdef CONFIG_SMP
105 smp_send_stop(); 106 smp_send_stop();
106#endif 107#endif
@@ -112,7 +113,8 @@ void machine_restart(char *cmd)
112void machine_power_off(void) 113void machine_power_off(void)
113{ 114{
114 machine_shutdown(); 115 machine_shutdown();
115 ppc_md.power_off(); 116 if (ppc_md.power_off)
117 ppc_md.power_off();
116#ifdef CONFIG_SMP 118#ifdef CONFIG_SMP
117 smp_send_stop(); 119 smp_send_stop();
118#endif 120#endif
@@ -129,7 +131,8 @@ EXPORT_SYMBOL_GPL(pm_power_off);
129void machine_halt(void) 131void machine_halt(void)
130{ 132{
131 machine_shutdown(); 133 machine_shutdown();
132 ppc_md.halt(); 134 if (ppc_md.halt)
135 ppc_md.halt();
133#ifdef CONFIG_SMP 136#ifdef CONFIG_SMP
134 smp_send_stop(); 137 smp_send_stop();
135#endif 138#endif
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 56f50e91bddb..c4a294d657b9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -431,7 +431,7 @@ void timer_interrupt(struct pt_regs * regs)
431 profile_tick(CPU_PROFILING, regs); 431 profile_tick(CPU_PROFILING, regs);
432 432
433#ifdef CONFIG_PPC_ISERIES 433#ifdef CONFIG_PPC_ISERIES
434 get_paca()->lppaca.int_dword.fields.decr_int = 0; 434 get_lppaca()->int_dword.fields.decr_int = 0;
435#endif 435#endif
436 436
437 while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu))) 437 while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu)))
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 35bd03c41dd1..8362fa272ca5 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -28,15 +28,13 @@
28void __spin_yield(raw_spinlock_t *lock) 28void __spin_yield(raw_spinlock_t *lock)
29{ 29{
30 unsigned int lock_value, holder_cpu, yield_count; 30 unsigned int lock_value, holder_cpu, yield_count;
31 struct paca_struct *holder_paca;
32 31
33 lock_value = lock->slock; 32 lock_value = lock->slock;
34 if (lock_value == 0) 33 if (lock_value == 0)
35 return; 34 return;
36 holder_cpu = lock_value & 0xffff; 35 holder_cpu = lock_value & 0xffff;
37 BUG_ON(holder_cpu >= NR_CPUS); 36 BUG_ON(holder_cpu >= NR_CPUS);
38 holder_paca = &paca[holder_cpu]; 37 yield_count = lppaca[holder_cpu].yield_count;
39 yield_count = holder_paca->lppaca.yield_count;
40 if ((yield_count & 1) == 0) 38 if ((yield_count & 1) == 0)
41 return; /* virtual cpu is currently running */ 39 return; /* virtual cpu is currently running */
42 rmb(); 40 rmb();
@@ -60,15 +58,13 @@ void __rw_yield(raw_rwlock_t *rw)
60{ 58{
61 int lock_value; 59 int lock_value;
62 unsigned int holder_cpu, yield_count; 60 unsigned int holder_cpu, yield_count;
63 struct paca_struct *holder_paca;
64 61
65 lock_value = rw->lock; 62 lock_value = rw->lock;
66 if (lock_value >= 0) 63 if (lock_value >= 0)
67 return; /* no write lock at present */ 64 return; /* no write lock at present */
68 holder_cpu = lock_value & 0xffff; 65 holder_cpu = lock_value & 0xffff;
69 BUG_ON(holder_cpu >= NR_CPUS); 66 BUG_ON(holder_cpu >= NR_CPUS);
70 holder_paca = &paca[holder_cpu]; 67 yield_count = lppaca[holder_cpu].yield_count;
71 yield_count = holder_paca->lppaca.yield_count;
72 if ((yield_count & 1) == 0) 68 if ((yield_count & 1) == 0)
73 return; /* virtual cpu is currently running */ 69 return; /* virtual cpu is currently running */
74 rmb(); 70 rmb();
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index 71615eb70b2b..cc2535be3a73 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -140,19 +140,19 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
140 140
141 switch (cur_cpu_spec->oprofile_type) { 141 switch (cur_cpu_spec->oprofile_type) {
142#ifdef CONFIG_PPC64 142#ifdef CONFIG_PPC64
143 case RS64: 143 case PPC_OPROFILE_RS64:
144 model = &op_model_rs64; 144 model = &op_model_rs64;
145 break; 145 break;
146 case POWER4: 146 case PPC_OPROFILE_POWER4:
147 model = &op_model_power4; 147 model = &op_model_power4;
148 break; 148 break;
149#else 149#else
150 case G4: 150 case PPC_OPROFILE_G4:
151 model = &op_model_7450; 151 model = &op_model_7450;
152 break; 152 break;
153#endif 153#endif
154#ifdef CONFIG_FSL_BOOKE 154#ifdef CONFIG_FSL_BOOKE
155 case BOOKE: 155 case PPC_OPROFILE_BOOKE:
156 model = &op_model_fsl_booke; 156 model = &op_model_fsl_booke;
157 break; 157 break;
158#endif 158#endif
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index b20812d460e6..7675e675dce1 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -7,6 +7,7 @@ choice
7 7
8config MPC834x_SYS 8config MPC834x_SYS
9 bool "Freescale MPC834x SYS" 9 bool "Freescale MPC834x SYS"
10 select DEFAULT_UIMAGE
10 help 11 help
11 This option enables support for the MPC 834x SYS evaluation board. 12 This option enables support for the MPC 834x SYS evaluation board.
12 13
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
new file mode 100644
index 000000000000..2098dd05a773
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -0,0 +1,243 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc834x_sys.c
3 *
4 * MPC834x SYS board specific routines
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/major.h>
23#include <linux/console.h>
24#include <linux/delay.h>
25#include <linux/seq_file.h>
26#include <linux/root_dev.h>
27#include <linux/module.h>
28#include <linux/fsl_devices.h>
29
30#include <asm/system.h>
31#include <asm/pgtable.h>
32#include <asm/page.h>
33#include <asm/atomic.h>
34#include <asm/time.h>
35#include <asm/io.h>
36#include <asm/machdep.h>
37#include <asm/ipic.h>
38#include <asm/bootinfo.h>
39#include <asm/pci-bridge.h>
40#include <asm/mpc83xx.h>
41#include <asm/irq.h>
42#include <mm/mmu_decl.h>
43#include <asm/prom.h>
44#include <asm/udbg.h>
45#include <sysdev/fsl_soc.h>
46
47#include "mpc83xx.h"
48
49#ifndef CONFIG_PCI
50unsigned long isa_io_base = 0;
51unsigned long isa_mem_base = 0;
52#endif
53
54#ifdef CONFIG_PCI
55extern int mpc83xx_pci2_busno;
56
57static int
58mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
59{
60 static char pci_irq_table[][4] =
61 /*
62 * PCI IDSEL/INTPIN->INTLINE
63 * A B C D
64 */
65 {
66 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x11 */
67 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x12 */
68 {PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x13 */
69 {0, 0, 0, 0},
70 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x15 */
71 {PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x16 */
72 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x17 */
73 {PIRQB, PIRQC, PIRQD, PIRQA}, /* idsel 0x18 */
74 {0, 0, 0, 0}, /* idsel 0x19 */
75 {0, 0, 0, 0}, /* idsel 0x20 */
76 };
77
78 const long min_idsel = 0x11, max_idsel = 0x20, irqs_per_slot = 4;
79 return PCI_IRQ_TABLE_LOOKUP;
80}
81
82static int
83mpc83xx_exclude_device(u_char bus, u_char devfn)
84{
85 if (bus == 0 && PCI_SLOT(devfn) == 0)
86 return PCIBIOS_DEVICE_NOT_FOUND;
87 if (mpc83xx_pci2_busno)
88 if (bus == (mpc83xx_pci2_busno) && PCI_SLOT(devfn) == 0)
89 return PCIBIOS_DEVICE_NOT_FOUND;
90 return PCIBIOS_SUCCESSFUL;
91}
92#endif /* CONFIG_PCI */
93
94/* ************************************************************************
95 *
96 * Setup the architecture
97 *
98 */
99static void __init
100mpc834x_sys_setup_arch(void)
101{
102 struct device_node *np;
103
104 if (ppc_md.progress)
105 ppc_md.progress("mpc834x_sys_setup_arch()", 0);
106
107 np = of_find_node_by_type(NULL, "cpu");
108 if (np != 0) {
109 unsigned int *fp = (int *) get_property(np, "clock-frequency", NULL);
110 if (fp != 0)
111 loops_per_jiffy = *fp / HZ;
112 else
113 loops_per_jiffy = 50000000 / HZ;
114 of_node_put(np);
115 }
116
117#ifdef CONFIG_PCI
118 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
119 add_bridge(np);
120
121 ppc_md.pci_swizzle = common_swizzle;
122 ppc_md.pci_map_irq = mpc83xx_map_irq;
123 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
124#endif
125
126#ifdef CONFIG_ROOT_NFS
127 ROOT_DEV = Root_NFS;
128#else
129 ROOT_DEV = Root_HDA1;
130#endif
131}
132
133void __init
134mpc834x_sys_init_IRQ(void)
135{
136 u8 senses[8] = {
137 0, /* EXT 0 */
138 IRQ_SENSE_LEVEL, /* EXT 1 */
139 IRQ_SENSE_LEVEL, /* EXT 2 */
140 0, /* EXT 3 */
141#ifdef CONFIG_PCI
142 IRQ_SENSE_LEVEL, /* EXT 4 */
143 IRQ_SENSE_LEVEL, /* EXT 5 */
144 IRQ_SENSE_LEVEL, /* EXT 6 */
145 IRQ_SENSE_LEVEL, /* EXT 7 */
146#else
147 0, /* EXT 4 */
148 0, /* EXT 5 */
149 0, /* EXT 6 */
150 0, /* EXT 7 */
151#endif
152 };
153
154 ipic_init(get_immrbase() + 0x00700, 0, 0, senses, 8);
155
156 /* Initialize the default interrupt mapping priorities,
157 * in case the boot rom changed something on us.
158 */
159 ipic_set_default_priority();
160}
161
162#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
163extern ulong ds1374_get_rtc_time(void);
164extern int ds1374_set_rtc_time(ulong);
165
166static int __init
167mpc834x_rtc_hookup(void)
168{
169 struct timespec tv;
170
171 ppc_md.get_rtc_time = ds1374_get_rtc_time;
172 ppc_md.set_rtc_time = ds1374_set_rtc_time;
173
174 tv.tv_nsec = 0;
175 tv.tv_sec = (ppc_md.get_rtc_time)();
176 do_settimeofday(&tv);
177
178 return 0;
179}
180late_initcall(mpc834x_rtc_hookup);
181#endif
182
183static void
184mpc83xx_restart(char *cmd)
185{
186#define RST_OFFSET 0x00000900
187#define RST_PROT_REG 0x00000018
188#define RST_CTRL_REG 0x0000001c
189 __be32 __iomem *reg;
190
191 // map reset register space
192 reg = ioremap(get_immrbase() + 0x900, 0xff);
193
194 local_irq_disable();
195
196 /* enable software reset "RSTE" */
197 out_be32(reg + (RST_PROT_REG >> 2), 0x52535445);
198
199 /* set software hard reset */
200 out_be32(reg + (RST_CTRL_REG >> 2), 0x52535445);
201 for(;;);
202}
203
204static long __init
205mpc83xx_time_init(void)
206{
207#define SPCR_OFFSET 0x00000110
208#define SPCR_TBEN 0x00400000
209 __be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
210 __be32 tmp;
211
212 tmp = in_be32(spcr);
213 out_be32(spcr, tmp|SPCR_TBEN);
214
215 iounmap(spcr);
216
217 return 0;
218}
219void __init
220platform_init(void)
221{
222 /* setup the PowerPC module struct */
223 ppc_md.setup_arch = mpc834x_sys_setup_arch;
224
225 ppc_md.init_IRQ = mpc834x_sys_init_IRQ;
226 ppc_md.get_irq = ipic_get_irq;
227
228 ppc_md.restart = mpc83xx_restart;
229
230 ppc_md.time_init = mpc83xx_time_init;
231 ppc_md.set_rtc_time = NULL;
232 ppc_md.get_rtc_time = NULL;
233 ppc_md.calibrate_decr = generic_calibrate_decr;
234
235 ppc_md.progress = udbg_progress;
236
237 if (ppc_md.progress)
238 ppc_md.progress("mpc834x_sys_init(): exit", 0);
239
240 return;
241}
242
243
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
new file mode 100644
index 000000000000..e4ca39f6a862
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.h
@@ -0,0 +1,23 @@
1/*
2 * arch/powerppc/platforms/83xx/mpc834x_sys.h
3 *
4 * MPC834X SYS common board definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MACH_MPC83XX_SYS_H__
16#define __MACH_MPC83XX_SYS_H__
17
18#define PIRQA MPC83xx_IRQ_EXT4
19#define PIRQB MPC83xx_IRQ_EXT5
20#define PIRQC MPC83xx_IRQ_EXT6
21#define PIRQD MPC83xx_IRQ_EXT7
22
23#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
new file mode 100644
index 000000000000..ce9e66abef24
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -0,0 +1,14 @@
1#ifndef __MPC83XX_H__
2#define __MPC83XX_H__
3
4#include <linux/init.h>
5#include <linux/device.h>
6
7/*
8 * Declaration for the various functions exported by the
9 * mpc83xx_* files. Mostly for use by mpc83xx_setup
10 */
11
12extern int add_bridge(struct device_node *dev);
13
14#endif /* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c
new file mode 100644
index 000000000000..469cdacc5bd4
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/pci.c
@@ -0,0 +1,99 @@
1/*
2 * FSL SoC setup code
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/pci.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/module.h>
21
22#include <asm/system.h>
23#include <asm/atomic.h>
24#include <asm/io.h>
25#include <asm/pci-bridge.h>
26#include <asm/prom.h>
27#include <sysdev/fsl_soc.h>
28
29#undef DEBUG
30
31#ifdef DEBUG
32#define DBG(x...) printk(x)
33#else
34#define DBG(x...)
35#endif
36
37int mpc83xx_pci2_busno;
38
39#ifdef CONFIG_PCI
40int __init add_bridge(struct device_node *dev)
41{
42 int len;
43 struct pci_controller *hose;
44 struct resource rsrc;
45 int *bus_range;
46 int primary = 1, has_address = 0;
47 phys_addr_t immr = get_immrbase();
48
49 DBG("Adding PCI host bridge %s\n", dev->full_name);
50
51 /* Fetch host bridge registers address */
52 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
53
54 /* Get bus range if any */
55 bus_range = (int *) get_property(dev, "bus-range", &len);
56 if (bus_range == NULL || len < 2 * sizeof(int)) {
57 printk(KERN_WARNING "Can't get bus-range for %s, assume"
58 " bus 0\n", dev->full_name);
59 }
60
61 hose = pcibios_alloc_controller();
62 if (!hose)
63 return -ENOMEM;
64 hose->arch_data = dev;
65 hose->set_cfg_type = 1;
66
67 hose->first_busno = bus_range ? bus_range[0] : 0;
68 hose->last_busno = bus_range ? bus_range[1] : 0xff;
69
70 /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar
71 * the other at 0x8600, we consider the 0x8500 the primary controller
72 */
73 /* PCI 1 */
74 if ((rsrc.start & 0xfffff) == 0x8500) {
75 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304);
76 }
77 /* PCI 2*/
78 if ((rsrc.start & 0xfffff) == 0x8600) {
79 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384);
80 primary = 0;
81 hose->bus_offset = hose->first_busno;
82 mpc83xx_pci2_busno = hose->first_busno;
83 }
84
85 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%08lx. "
86 "Firmware bus number: %d->%d\n",
87 rsrc.start, hose->first_busno, hose->last_busno);
88
89 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
90 hose, hose->cfg_addr, hose->cfg_data);
91
92 /* Interpret the "ranges" property */
93 /* This also maps the I/O region and sets isa_io/mem_base */
94 pci_process_bridge_OF_ranges(hose, dev, primary);
95
96 return 0;
97}
98
99#endif
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 82c429d487f3..00c52f27ef4f 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -135,12 +135,13 @@ int __init
135hydra_init(void) 135hydra_init(void)
136{ 136{
137 struct device_node *np; 137 struct device_node *np;
138 struct resource r;
138 139
139 np = find_devices("mac-io"); 140 np = find_devices("mac-io");
140 if (np == NULL || np->n_addrs == 0) 141 if (np == NULL || of_address_to_resource(np, 0, &r))
141 return 0; 142 return 0;
142 Hydra = ioremap(np->addrs[0].address, np->addrs[0].size); 143 Hydra = ioremap(r.start, r.end-r.start);
143 printk("Hydra Mac I/O at %lx\n", np->addrs[0].address); 144 printk("Hydra Mac I/O at %lx\n", r.start);
144 printk("Hydra Feature_Control was %x", 145 printk("Hydra Feature_Control was %x",
145 in_le32(&Hydra->Feature_Control)); 146 in_le32(&Hydra->Feature_Control));
146 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN | 147 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
@@ -177,18 +178,24 @@ setup_python(struct pci_controller *hose, struct device_node *dev)
177{ 178{
178 u32 __iomem *reg; 179 u32 __iomem *reg;
179 u32 val; 180 u32 val;
180 unsigned long addr = dev->addrs[0].address; 181 struct resource r;
181 182
182 setup_indirect_pci(hose, addr + 0xf8000, addr + 0xf8010); 183 if (of_address_to_resource(dev, 0, &r)) {
184 printk(KERN_ERR "No address for Python PCI controller\n");
185 return;
186 }
183 187
184 /* Clear the magic go-slow bit */ 188 /* Clear the magic go-slow bit */
185 reg = ioremap(dev->addrs[0].address + 0xf6000, 0x40); 189 reg = ioremap(r.start + 0xf6000, 0x40);
190 BUG_ON(!reg);
186 val = in_be32(&reg[12]); 191 val = in_be32(&reg[12]);
187 if (val & PRG_CL_RESET_VALID) { 192 if (val & PRG_CL_RESET_VALID) {
188 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID); 193 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID);
189 in_be32(&reg[12]); 194 in_be32(&reg[12]);
190 } 195 }
191 iounmap(reg); 196 iounmap(reg);
197
198 setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010);
192} 199}
193 200
194/* Marvell Discovery II based Pegasos 2 */ 201/* Marvell Discovery II based Pegasos 2 */
@@ -218,7 +225,7 @@ chrp_find_bridges(void)
218 char *model, *machine; 225 char *model, *machine;
219 int is_longtrail = 0, is_mot = 0, is_pegasos = 0; 226 int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
220 struct device_node *root = find_path_device("/"); 227 struct device_node *root = find_path_device("/");
221 228 struct resource r;
222 /* 229 /*
223 * The PCI host bridge nodes on some machines don't have 230 * The PCI host bridge nodes on some machines don't have
224 * properties to adequately identify them, so we have to 231 * properties to adequately identify them, so we have to
@@ -238,7 +245,7 @@ chrp_find_bridges(void)
238 continue; 245 continue;
239 ++index; 246 ++index;
240 /* The GG2 bridge on the LongTrail doesn't have an address */ 247 /* The GG2 bridge on the LongTrail doesn't have an address */
241 if (dev->n_addrs < 1 && !is_longtrail) { 248 if (of_address_to_resource(dev, 0, &r) && !is_longtrail) {
242 printk(KERN_WARNING "Can't use %s: no address\n", 249 printk(KERN_WARNING "Can't use %s: no address\n",
243 dev->full_name); 250 dev->full_name);
244 continue; 251 continue;
@@ -255,8 +262,8 @@ chrp_find_bridges(void)
255 printk(KERN_INFO "PCI buses %d..%d", 262 printk(KERN_INFO "PCI buses %d..%d",
256 bus_range[0], bus_range[1]); 263 bus_range[0], bus_range[1]);
257 printk(" controlled by %s", dev->type); 264 printk(" controlled by %s", dev->type);
258 if (dev->n_addrs > 0) 265 if (!is_longtrail)
259 printk(" at %lx", dev->addrs[0].address); 266 printk(" at %lx", r.start);
260 printk("\n"); 267 printk("\n");
261 268
262 hose = pcibios_alloc_controller(); 269 hose = pcibios_alloc_controller();
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 4ec8ba737e7d..2dc87aa5962f 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -352,9 +352,10 @@ static void __init chrp_find_openpic(void)
352 opaddr = opprop[na-1]; /* assume 32-bit */ 352 opaddr = opprop[na-1]; /* assume 32-bit */
353 oplen /= na * sizeof(unsigned int); 353 oplen /= na * sizeof(unsigned int);
354 } else { 354 } else {
355 if (np->n_addrs == 0) 355 struct resource r;
356 if (of_address_to_resource(np, 0, &r))
356 return; 357 return;
357 opaddr = np->addrs[0].address; 358 opaddr = r.start;
358 oplen = 0; 359 oplen = 0;
359 } 360 }
360 361
@@ -377,7 +378,7 @@ static void __init chrp_find_openpic(void)
377 */ 378 */
378 if (oplen < len) { 379 if (oplen < len) {
379 printk(KERN_ERR "Insufficient addresses for distributed" 380 printk(KERN_ERR "Insufficient addresses for distributed"
380 " OpenPIC (%d < %d)\n", np->n_addrs, len); 381 " OpenPIC (%d < %d)\n", oplen, len);
381 len = oplen; 382 len = oplen;
382 } 383 }
383 384
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 737ee5d9f0aa..36a0f97bb7b1 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -21,6 +21,7 @@
21#include <linux/mc146818rtc.h> 21#include <linux/mc146818rtc.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/bcd.h> 23#include <linux/bcd.h>
24#include <linux/ioport.h>
24 25
25#include <asm/io.h> 26#include <asm/io.h>
26#include <asm/nvram.h> 27#include <asm/nvram.h>
@@ -37,14 +38,16 @@ static int nvram_data = NVRAM_DATA;
37long __init chrp_time_init(void) 38long __init chrp_time_init(void)
38{ 39{
39 struct device_node *rtcs; 40 struct device_node *rtcs;
41 struct resource r;
40 int base; 42 int base;
41 43
42 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 44 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
43 if (rtcs == NULL) 45 if (rtcs == NULL)
44 rtcs = find_compatible_devices("rtc", "ds1385-rtc"); 46 rtcs = find_compatible_devices("rtc", "ds1385-rtc");
45 if (rtcs == NULL || rtcs->addrs == NULL) 47 if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r))
46 return 0; 48 return 0;
47 base = rtcs->addrs[0].address; 49
50 base = r.start;
48 nvram_as1 = 0; 51 nvram_as1 = 0;
49 nvram_as0 = base; 52 nvram_as0 = base;
50 nvram_data = base + 1; 53 nvram_data = base + 1;
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index 83442ea77476..be3fbfc24e6c 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -334,14 +334,12 @@ int __init iSeries_allocate_IRQ(HvBusNumber bus,
334 */ 334 */
335int iSeries_get_irq(struct pt_regs *regs) 335int iSeries_get_irq(struct pt_regs *regs)
336{ 336{
337 struct paca_struct *lpaca;
338 /* -2 means ignore this interrupt */ 337 /* -2 means ignore this interrupt */
339 int irq = -2; 338 int irq = -2;
340 339
341 lpaca = get_paca();
342#ifdef CONFIG_SMP 340#ifdef CONFIG_SMP
343 if (lpaca->lppaca.int_dword.fields.ipi_cnt) { 341 if (get_lppaca()->int_dword.fields.ipi_cnt) {
344 lpaca->lppaca.int_dword.fields.ipi_cnt = 0; 342 get_lppaca()->int_dword.fields.ipi_cnt = 0;
345 iSeries_smp_message_recv(regs); 343 iSeries_smp_message_recv(regs);
346 } 344 }
347#endif /* CONFIG_SMP */ 345#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/platforms/iseries/misc.S b/arch/powerpc/platforms/iseries/misc.S
index dfe7aa1ba098..7641fc7e550a 100644
--- a/arch/powerpc/platforms/iseries/misc.S
+++ b/arch/powerpc/platforms/iseries/misc.S
@@ -44,7 +44,8 @@ _GLOBAL(local_irq_restore)
44 /* Check pending interrupts */ 44 /* Check pending interrupts */
45 /* A decrementer, IPI or PMC interrupt may have occurred 45 /* A decrementer, IPI or PMC interrupt may have occurred
46 * while we were in the hypervisor (which enables) */ 46 * while we were in the hypervisor (which enables) */
47 ld r4,PACALPPACA+LPPACAANYINT(r13) 47 ld r4,PACALPPACAPTR(r13)
48 ld r4,LPPACAANYINT(r4)
48 cmpdi r4,0 49 cmpdi r4,0
49 beqlr 50 beqlr
50 51
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index c6bbe5c25107..3f8790146b00 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -538,7 +538,7 @@ static unsigned long __init build_iSeries_Memory_Map(void)
538 */ 538 */
539static void __init iSeries_setup_arch(void) 539static void __init iSeries_setup_arch(void)
540{ 540{
541 if (get_paca()->lppaca.shared_proc) { 541 if (get_lppaca()->shared_proc) {
542 ppc_md.idle_loop = iseries_shared_idle; 542 ppc_md.idle_loop = iseries_shared_idle;
543 printk(KERN_INFO "Using shared processor idle loop\n"); 543 printk(KERN_INFO "Using shared processor idle loop\n");
544 } else { 544 } else {
@@ -647,7 +647,7 @@ static void yield_shared_processor(void)
647 * The decrementer stops during the yield. Force a fake decrementer 647 * The decrementer stops during the yield. Force a fake decrementer
648 * here and let the timer_interrupt code sort out the actual time. 648 * here and let the timer_interrupt code sort out the actual time.
649 */ 649 */
650 get_paca()->lppaca.int_dword.fields.decr_int = 1; 650 get_lppaca()->int_dword.fields.decr_int = 1;
651 process_iSeries_events(); 651 process_iSeries_events();
652} 652}
653 653
@@ -883,7 +883,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
883 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE); 883 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
884 884
885 for (i = 0; i < NR_CPUS; i++) { 885 for (i = 0; i < NR_CPUS; i++) {
886 if (paca[i].lppaca.dyn_proc_status >= 2) 886 if (lppaca[i].dyn_proc_status >= 2)
887 continue; 887 continue;
888 888
889 snprintf(p, 32 - (p - buf), "@%d", i); 889 snprintf(p, 32 - (p - buf), "@%d", i);
@@ -891,7 +891,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
891 891
892 dt_prop_str(dt, "device_type", "cpu"); 892 dt_prop_str(dt, "device_type", "cpu");
893 893
894 index = paca[i].lppaca.dyn_hv_phys_proc_index; 894 index = lppaca[i].dyn_hv_phys_proc_index;
895 d = &xIoHriProcessorVpd[index]; 895 d = &xIoHriProcessorVpd[index];
896 896
897 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024); 897 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index fcb094ec6aec..6f9d407a709f 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -91,7 +91,7 @@ static void smp_iSeries_kick_cpu(int nr)
91 BUG_ON((nr < 0) || (nr >= NR_CPUS)); 91 BUG_ON((nr < 0) || (nr >= NR_CPUS));
92 92
93 /* Verify that our partition has a processor nr */ 93 /* Verify that our partition has a processor nr */
94 if (paca[nr].lppaca.dyn_proc_status >= 2) 94 if (lppaca[nr].dyn_proc_status >= 2)
95 return; 95 return;
96 96
97 /* The processor is currently spinning, waiting 97 /* The processor is currently spinning, waiting
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 1fe445ab78a6..8952528d31ac 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -254,11 +254,11 @@ out:
254void vpa_init(int cpu) 254void vpa_init(int cpu)
255{ 255{
256 int hwcpu = get_hard_smp_processor_id(cpu); 256 int hwcpu = get_hard_smp_processor_id(cpu);
257 unsigned long vpa = __pa(&paca[cpu].lppaca); 257 unsigned long vpa = __pa(&lppaca[cpu]);
258 long ret; 258 long ret;
259 259
260 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 260 if (cpu_has_feature(CPU_FTR_ALTIVEC))
261 paca[cpu].lppaca.vmxregs_in_use = 1; 261 lppaca[cpu].vmxregs_in_use = 1;
262 262
263 ret = register_vpa(hwcpu, vpa); 263 ret = register_vpa(hwcpu, vpa);
264 264
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index d8864164dbe8..86cfa6ecdcf3 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -350,6 +350,100 @@ static int do_remove_node(char *buf)
350 return rv; 350 return rv;
351} 351}
352 352
353static char *parse_node(char *buf, size_t bufsize, struct device_node **npp)
354{
355 char *handle_str;
356 phandle handle;
357 *npp = NULL;
358
359 handle_str = buf;
360
361 buf = strchr(buf, ' ');
362 if (!buf)
363 return NULL;
364 *buf = '\0';
365 buf++;
366
367 handle = simple_strtoul(handle_str, NULL, 10);
368
369 *npp = of_find_node_by_phandle(handle);
370 return buf;
371}
372
373static int do_add_property(char *buf, size_t bufsize)
374{
375 struct property *prop = NULL;
376 struct device_node *np;
377 unsigned char *value;
378 char *name, *end;
379 int length;
380 end = buf + bufsize;
381 buf = parse_node(buf, bufsize, &np);
382
383 if (!np)
384 return -ENODEV;
385
386 if (parse_next_property(buf, end, &name, &length, &value) == NULL)
387 return -EINVAL;
388
389 prop = new_property(name, length, value, NULL);
390 if (!prop)
391 return -ENOMEM;
392
393 prom_add_property(np, prop);
394
395 return 0;
396}
397
398static int do_remove_property(char *buf, size_t bufsize)
399{
400 struct device_node *np;
401 char *tmp;
402 struct property *prop;
403 buf = parse_node(buf, bufsize, &np);
404
405 if (!np)
406 return -ENODEV;
407
408 tmp = strchr(buf,' ');
409 if (tmp)
410 *tmp = '\0';
411
412 if (strlen(buf) == 0)
413 return -EINVAL;
414
415 prop = of_find_property(np, buf, NULL);
416
417 return prom_remove_property(np, prop);
418}
419
420static int do_update_property(char *buf, size_t bufsize)
421{
422 struct device_node *np;
423 unsigned char *value;
424 char *name, *end;
425 int length;
426 struct property *newprop, *oldprop;
427 buf = parse_node(buf, bufsize, &np);
428 end = buf + bufsize;
429
430 if (!np)
431 return -ENODEV;
432
433 if (parse_next_property(buf, end, &name, &length, &value) == NULL)
434 return -EINVAL;
435
436 newprop = new_property(name, length, value, NULL);
437 if (!newprop)
438 return -ENOMEM;
439
440 oldprop = of_find_property(np, name,NULL);
441 if (!oldprop)
442 return -ENODEV;
443
444 return prom_update_property(np, newprop, oldprop);
445}
446
353/** 447/**
354 * ofdt_write - perform operations on the Open Firmware device tree 448 * ofdt_write - perform operations on the Open Firmware device tree
355 * 449 *
@@ -392,6 +486,12 @@ static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t coun
392 rv = do_add_node(tmp, count - (tmp - kbuf)); 486 rv = do_add_node(tmp, count - (tmp - kbuf));
393 else if (!strcmp(kbuf, "remove_node")) 487 else if (!strcmp(kbuf, "remove_node"))
394 rv = do_remove_node(tmp); 488 rv = do_remove_node(tmp);
489 else if (!strcmp(kbuf, "add_property"))
490 rv = do_add_property(tmp, count - (tmp - kbuf));
491 else if (!strcmp(kbuf, "remove_property"))
492 rv = do_remove_property(tmp, count - (tmp - kbuf));
493 else if (!strcmp(kbuf, "update_property"))
494 rv = do_update_property(tmp, count - (tmp - kbuf));
395 else 495 else
396 rv = -EINVAL; 496 rv = -EINVAL;
397out: 497out:
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 68b7f086d63d..da6cebaf72cd 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -190,7 +190,7 @@ static void pseries_lpar_enable_pmcs(void)
190 190
191 /* instruct hypervisor to maintain PMCs */ 191 /* instruct hypervisor to maintain PMCs */
192 if (firmware_has_feature(FW_FEATURE_SPLPAR)) 192 if (firmware_has_feature(FW_FEATURE_SPLPAR))
193 get_paca()->lppaca.pmcregs_in_use = 1; 193 get_lppaca()->pmcregs_in_use = 1;
194} 194}
195 195
196static void __init pSeries_setup_arch(void) 196static void __init pSeries_setup_arch(void)
@@ -234,7 +234,7 @@ static void __init pSeries_setup_arch(void)
234 /* Choose an idle loop */ 234 /* Choose an idle loop */
235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
236 vpa_init(boot_cpuid); 236 vpa_init(boot_cpuid);
237 if (get_paca()->lppaca.shared_proc) { 237 if (get_lppaca()->shared_proc) {
238 printk(KERN_INFO "Using shared processor idle loop\n"); 238 printk(KERN_INFO "Using shared processor idle loop\n");
239 ppc_md.idle_loop = pseries_shared_idle; 239 ppc_md.idle_loop = pseries_shared_idle;
240 } else { 240 } else {
@@ -444,10 +444,10 @@ DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
444 444
445static inline void dedicated_idle_sleep(unsigned int cpu) 445static inline void dedicated_idle_sleep(unsigned int cpu)
446{ 446{
447 struct paca_struct *ppaca = &paca[cpu ^ 1]; 447 struct lppaca *plppaca = &lppaca[cpu ^ 1];
448 448
449 /* Only sleep if the other thread is not idle */ 449 /* Only sleep if the other thread is not idle */
450 if (!(ppaca->lppaca.idle)) { 450 if (!(plppaca->idle)) {
451 local_irq_disable(); 451 local_irq_disable();
452 452
453 /* 453 /*
@@ -480,7 +480,6 @@ static inline void dedicated_idle_sleep(unsigned int cpu)
480 480
481static void pseries_dedicated_idle(void) 481static void pseries_dedicated_idle(void)
482{ 482{
483 struct paca_struct *lpaca = get_paca();
484 unsigned int cpu = smp_processor_id(); 483 unsigned int cpu = smp_processor_id();
485 unsigned long start_snooze; 484 unsigned long start_snooze;
486 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay); 485 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay);
@@ -491,7 +490,7 @@ static void pseries_dedicated_idle(void)
491 * Indicate to the HV that we are idle. Now would be 490 * Indicate to the HV that we are idle. Now would be
492 * a good time to find other work to dispatch. 491 * a good time to find other work to dispatch.
493 */ 492 */
494 lpaca->lppaca.idle = 1; 493 get_lppaca()->idle = 1;
495 494
496 if (!need_resched()) { 495 if (!need_resched()) {
497 start_snooze = get_tb() + 496 start_snooze = get_tb() +
@@ -518,7 +517,7 @@ static void pseries_dedicated_idle(void)
518 HMT_medium(); 517 HMT_medium();
519 } 518 }
520 519
521 lpaca->lppaca.idle = 0; 520 get_lppaca()->idle = 0;
522 ppc64_runlatch_on(); 521 ppc64_runlatch_on();
523 522
524 preempt_enable_no_resched(); 523 preempt_enable_no_resched();
@@ -532,7 +531,6 @@ static void pseries_dedicated_idle(void)
532 531
533static void pseries_shared_idle(void) 532static void pseries_shared_idle(void)
534{ 533{
535 struct paca_struct *lpaca = get_paca();
536 unsigned int cpu = smp_processor_id(); 534 unsigned int cpu = smp_processor_id();
537 535
538 while (1) { 536 while (1) {
@@ -540,7 +538,7 @@ static void pseries_shared_idle(void)
540 * Indicate to the HV that we are idle. Now would be 538 * Indicate to the HV that we are idle. Now would be
541 * a good time to find other work to dispatch. 539 * a good time to find other work to dispatch.
542 */ 540 */
543 lpaca->lppaca.idle = 1; 541 get_lppaca()->idle = 1;
544 542
545 while (!need_resched() && !cpu_is_offline(cpu)) { 543 while (!need_resched() && !cpu_is_offline(cpu)) {
546 local_irq_disable(); 544 local_irq_disable();
@@ -564,7 +562,7 @@ static void pseries_shared_idle(void)
564 HMT_medium(); 562 HMT_medium();
565 } 563 }
566 564
567 lpaca->lppaca.idle = 0; 565 get_lppaca()->idle = 0;
568 ppc64_runlatch_on(); 566 ppc64_runlatch_on();
569 567
570 preempt_enable_no_resched(); 568 preempt_enable_no_resched();
@@ -588,7 +586,7 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
588{ 586{
589 /* Don't risk a hypervisor call if we're crashing */ 587 /* Don't risk a hypervisor call if we're crashing */
590 if (!crash_shutdown) { 588 if (!crash_shutdown) {
591 unsigned long vpa = __pa(&get_paca()->lppaca); 589 unsigned long vpa = __pa(get_lppaca());
592 590
593 if (unregister_vpa(hard_smp_processor_id(), vpa)) { 591 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
594 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 592 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 0ae841347a09..4c2b356774ea 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_40x) += dcr.o
7obj-$(CONFIG_U3_DART) += dart_iommu.o 7obj-$(CONFIG_U3_DART) += dart_iommu.o
8obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 8obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
9obj-$(CONFIG_PPC_83xx) += ipic.o 9obj-$(CONFIG_PPC_83xx) += ipic.o
10obj-$(CONFIG_FSL_SOC) += fsl_soc.o
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
new file mode 100644
index 000000000000..064c9de47732
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -0,0 +1,317 @@
1/*
2 * FSL SoC setup code
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/major.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/module.h>
21#include <linux/device.h>
22#include <linux/platform_device.h>
23#include <linux/fsl_devices.h>
24
25#include <asm/system.h>
26#include <asm/atomic.h>
27#include <asm/io.h>
28#include <asm/irq.h>
29#include <asm/prom.h>
30#include <sysdev/fsl_soc.h>
31#include <mm/mmu_decl.h>
32
33static phys_addr_t immrbase = -1;
34
35phys_addr_t get_immrbase(void)
36{
37 struct device_node *soc;
38
39 if (immrbase != -1)
40 return immrbase;
41
42 soc = of_find_node_by_type(NULL, "soc");
43 if (soc != 0) {
44 unsigned int size;
45 void *prop = get_property(soc, "reg", &size);
46 immrbase = of_translate_address(soc, prop);
47 of_node_put(soc);
48 };
49
50 return immrbase;
51}
52EXPORT_SYMBOL(get_immrbase);
53
54static const char * gfar_tx_intr = "tx";
55static const char * gfar_rx_intr = "rx";
56static const char * gfar_err_intr = "error";
57
58static int __init gfar_of_init(void)
59{
60 struct device_node *np;
61 unsigned int i;
62 struct platform_device *mdio_dev, *gfar_dev;
63 struct resource res;
64 int ret;
65
66 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL; i++) {
67 int k;
68 struct device_node *child = NULL;
69 struct gianfar_mdio_data mdio_data;
70
71 memset(&res, 0, sizeof(res));
72 memset(&mdio_data, 0, sizeof(mdio_data));
73
74 ret = of_address_to_resource(np, 0, &res);
75 if (ret)
76 goto mdio_err;
77
78 mdio_dev = platform_device_register_simple("fsl-gianfar_mdio", res.start, &res, 1);
79 if (IS_ERR(mdio_dev)) {
80 ret = PTR_ERR(mdio_dev);
81 goto mdio_err;
82 }
83
84 for (k = 0; k < 32; k++)
85 mdio_data.irq[k] = -1;
86
87 while ((child = of_get_next_child(np, child)) != NULL) {
88 if (child->n_intrs) {
89 u32 *id = (u32 *) get_property(child, "reg", NULL);
90 mdio_data.irq[*id] = child->intrs[0].line;
91 }
92 }
93
94 ret = platform_device_add_data(mdio_dev, &mdio_data, sizeof(struct gianfar_mdio_data));
95 if (ret)
96 goto mdio_unreg;
97 }
98
99 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "network", "gianfar")) != NULL; i++) {
100 struct resource r[4];
101 struct device_node *phy, *mdio;
102 struct gianfar_platform_data gfar_data;
103 unsigned int *id;
104 char *model;
105 void *mac_addr;
106 phandle *ph;
107
108 memset(r, 0, sizeof(r));
109 memset(&gfar_data, 0, sizeof(gfar_data));
110
111 ret = of_address_to_resource(np, 0, &r[0]);
112 if (ret)
113 goto gfar_err;
114
115 r[1].start = np->intrs[0].line;
116 r[1].end = np->intrs[0].line;
117 r[1].flags = IORESOURCE_IRQ;
118
119 model = get_property(np, "model", NULL);
120
121 /* If we aren't the FEC we have multiple interrupts */
122 if (model && strcasecmp(model, "FEC")) {
123 r[1].name = gfar_tx_intr;
124
125 r[2].name = gfar_rx_intr;
126 r[2].start = np->intrs[1].line;
127 r[2].end = np->intrs[1].line;
128 r[2].flags = IORESOURCE_IRQ;
129
130 r[3].name = gfar_err_intr;
131 r[3].start = np->intrs[2].line;
132 r[3].end = np->intrs[2].line;
133 r[3].flags = IORESOURCE_IRQ;
134 }
135
136 gfar_dev = platform_device_register_simple("fsl-gianfar", i, &r[0], np->n_intrs + 1);
137
138 if (IS_ERR(gfar_dev)) {
139 ret = PTR_ERR(gfar_dev);
140 goto gfar_err;
141 }
142
143 mac_addr = get_property(np, "address", NULL);
144 memcpy(gfar_data.mac_addr, mac_addr, 6);
145
146 if (model && !strcasecmp(model, "TSEC"))
147 gfar_data.device_flags =
148 FSL_GIANFAR_DEV_HAS_GIGABIT |
149 FSL_GIANFAR_DEV_HAS_COALESCE |
150 FSL_GIANFAR_DEV_HAS_RMON |
151 FSL_GIANFAR_DEV_HAS_MULTI_INTR;
152 if (model && !strcasecmp(model, "eTSEC"))
153 gfar_data.device_flags =
154 FSL_GIANFAR_DEV_HAS_GIGABIT |
155 FSL_GIANFAR_DEV_HAS_COALESCE |
156 FSL_GIANFAR_DEV_HAS_RMON |
157 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
158 FSL_GIANFAR_DEV_HAS_CSUM |
159 FSL_GIANFAR_DEV_HAS_VLAN |
160 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
161
162 ph = (phandle *) get_property(np, "phy-handle", NULL);
163 phy = of_find_node_by_phandle(*ph);
164
165 if (phy == NULL) {
166 ret = -ENODEV;
167 goto gfar_unreg;
168 }
169
170 mdio = of_get_parent(phy);
171
172 id = (u32 *) get_property(phy, "reg", NULL);
173 ret = of_address_to_resource(mdio, 0, &res);
174 if (ret) {
175 of_node_put(phy);
176 of_node_put(mdio);
177 goto gfar_unreg;
178 }
179
180 gfar_data.phy_id = *id;
181 gfar_data.bus_id = res.start;
182
183 of_node_put(phy);
184 of_node_put(mdio);
185
186 ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct gianfar_platform_data));
187 if (ret)
188 goto gfar_unreg;
189 }
190
191 return 0;
192
193mdio_unreg:
194 platform_device_unregister(mdio_dev);
195mdio_err:
196 return ret;
197
198gfar_unreg:
199 platform_device_unregister(gfar_dev);
200gfar_err:
201 return ret;
202}
203arch_initcall(gfar_of_init);
204
205static int __init fsl_i2c_of_init(void)
206{
207 struct device_node *np;
208 unsigned int i;
209 struct platform_device *i2c_dev;
210 int ret;
211
212 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL; i++) {
213 struct resource r[2];
214 struct fsl_i2c_platform_data i2c_data;
215 unsigned char * flags = NULL;
216
217 memset(&r, 0, sizeof(r));
218 memset(&i2c_data, 0, sizeof(i2c_data));
219
220 ret = of_address_to_resource(np, 0, &r[0]);
221 if (ret)
222 goto i2c_err;
223
224 r[1].start = np->intrs[0].line;
225 r[1].end = np->intrs[0].line;
226 r[1].flags = IORESOURCE_IRQ;
227
228 i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
229 if (IS_ERR(i2c_dev)) {
230 ret = PTR_ERR(i2c_dev);
231 goto i2c_err;
232 }
233
234 i2c_data.device_flags = 0;
235 flags = get_property(np, "dfsrr", NULL);
236 if (flags)
237 i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
238
239 flags = get_property(np, "fsl5200-clocking", NULL);
240 if (flags)
241 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
242
243 ret = platform_device_add_data(i2c_dev, &i2c_data, sizeof(struct fsl_i2c_platform_data));
244 if (ret)
245 goto i2c_unreg;
246 }
247
248 return 0;
249
250i2c_unreg:
251 platform_device_unregister(i2c_dev);
252i2c_err:
253 return ret;
254}
255arch_initcall(fsl_i2c_of_init);
256
257#ifdef CONFIG_PPC_83xx
258static int __init mpc83xx_wdt_init(void)
259{
260 struct resource r;
261 struct device_node *soc, *np;
262 struct platform_device *dev;
263 unsigned int *freq;
264 int ret;
265
266 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
267
268 if (!np) {
269 ret = -ENODEV;
270 goto mpc83xx_wdt_nodev;
271 }
272
273 soc = of_find_node_by_type(NULL, "soc");
274
275 if (!soc) {
276 ret = -ENODEV;
277 goto mpc83xx_wdt_nosoc;
278 }
279
280 freq = (unsigned int *)get_property(soc, "bus-frequency", NULL);
281 if (!freq) {
282 ret = -ENODEV;
283 goto mpc83xx_wdt_err;
284 }
285
286 memset(&r, 0, sizeof(r));
287
288 ret = of_address_to_resource(np, 0, &r);
289 if (ret)
290 goto mpc83xx_wdt_err;
291
292 dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
293 if (IS_ERR(dev)) {
294 ret = PTR_ERR(dev);
295 goto mpc83xx_wdt_err;
296 }
297
298 ret = platform_device_add_data(dev, freq, sizeof(int));
299 if (ret)
300 goto mpc83xx_wdt_unreg;
301
302 of_node_put(soc);
303 of_node_put(np);
304
305 return 0;
306
307mpc83xx_wdt_unreg:
308 platform_device_unregister(dev);
309mpc83xx_wdt_err:
310 of_node_put(soc);
311mpc83xx_wdt_nosoc:
312 of_node_put(np);
313mpc83xx_wdt_nodev:
314 return ret;
315}
316arch_initcall(mpc83xx_wdt_init);
317#endif
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
new file mode 100644
index 000000000000..c433d3f39edd
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -0,0 +1,8 @@
1#ifndef __PPC_FSL_SOC_H
2#define __PPC_FSL_SOC_H
3#ifdef __KERNEL__
4
5extern phys_addr_t get_immrbase(void);
6
7#endif
8#endif
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
index ebc4db8fcc63..8ace2a1f3b48 100644
--- a/arch/ppc/4xx_io/serial_sicc.c
+++ b/arch/ppc/4xx_io/serial_sicc.c
@@ -215,7 +215,6 @@ static struct tty_driver *siccnormal_driver;
215 * memory if large numbers of serial ports are open. 215 * memory if large numbers of serial ports are open.
216 */ 216 */
217static u_char *tmp_buf; 217static u_char *tmp_buf;
218static DECLARE_MUTEX(tmp_buf_sem);
219 218
220#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 219#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
221 220
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index de0978742221..3e6ca7f5843f 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -375,6 +375,8 @@ DataStoreTLBMiss:
375 lis r11, swapper_pg_dir@h 375 lis r11, swapper_pg_dir@h
376 ori r11, r11, swapper_pg_dir@l 376 ori r11, r11, swapper_pg_dir@l
377 rlwimi r10, r11, 0, 2, 19 377 rlwimi r10, r11, 0, 2, 19
378 stw r12, 16(r0)
379 b LoadLargeDTLB
3783: 3803:
379 lwz r11, 0(r10) /* Get the level 1 entry */ 381 lwz r11, 0(r10) /* Get the level 1 entry */
380 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */ 382 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
@@ -430,6 +432,81 @@ DataStoreTLBMiss:
430InstructionTLBError: 432InstructionTLBError:
431 b InstructionAccess 433 b InstructionAccess
432 434
435LoadLargeDTLB:
436 li r12, 0
437 lwz r11, 0(r10) /* Get the level 1 entry */
438 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
439 beq 3f /* If zero, don't try to find a pte */
440
441 /* We have a pte table, so load fetch the pte from the table.
442 */
443 ori r11, r11, 1 /* Set valid bit in physical L2 page */
444 DO_8xx_CPU6(0x3b80, r3)
445 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
446 mfspr r10, SPRN_MD_TWC /* ....and get the pte address */
447 lwz r10, 0(r10) /* Get the pte */
448
449 /* Insert the Guarded flag into the TWC from the Linux PTE.
450 * It is bit 27 of both the Linux PTE and the TWC (at least
451 * I got that right :-). It will be better when we can put
452 * this into the Linux pgd/pmd and load it in the operation
453 * above.
454 */
455 rlwimi r11, r10, 0, 27, 27
456
457 rlwimi r12, r10, 0, 0, 9 /* extract phys. addr */
458 mfspr r3, SPRN_MD_EPN
459 rlwinm r3, r3, 0, 0, 9 /* extract virtual address */
460 tophys(r3, r3)
461 cmpw r3, r12 /* only use 8M page if it is a direct
462 kernel mapping */
463 bne 1f
464 ori r11, r11, MD_PS8MEG
465 li r12, 1
466 b 2f
4671:
468 li r12, 0 /* can't use 8MB TLB, so zero r12. */
4692:
470 DO_8xx_CPU6(0x3b80, r3)
471 mtspr SPRN_MD_TWC, r11
472
473 /* The Linux PTE won't go exactly into the MMU TLB.
474 * Software indicator bits 21, 22 and 28 must be clear.
475 * Software indicator bits 24, 25, 26, and 27 must be
476 * set. All other Linux PTE bits control the behavior
477 * of the MMU.
478 */
4793: li r11, 0x00f0
480 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
481 cmpwi r12, 1
482 bne 4f
483 ori r10, r10, 0x8
484
485 mfspr r12, SPRN_MD_EPN
486 lis r3, 0xff80 /* 10-19 must be clear for 8MB TLB */
487 ori r3, r3, 0x0fff
488 and r12, r3, r12
489 DO_8xx_CPU6(0x3780, r3)
490 mtspr SPRN_MD_EPN, r12
491
492 lis r3, 0xff80 /* 10-19 must be clear for 8MB TLB */
493 ori r3, r3, 0x0fff
494 and r10, r3, r10
4954:
496 DO_8xx_CPU6(0x3d80, r3)
497 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
498
499 mfspr r10, SPRN_M_TW /* Restore registers */
500 lwz r11, 0(r0)
501 mtcr r11
502 lwz r11, 4(r0)
503
504 lwz r12, 16(r0)
505#ifdef CONFIG_8xx_CPU6
506 lwz r3, 8(r0)
507#endif
508 rfi
509
433/* This is the data TLB error on the MPC8xx. This could be due to 510/* This is the data TLB error on the MPC8xx. This could be due to
434 * many reasons, including a dirty update to a pte. We can catch that 511 * many reasons, including a dirty update to a pte. We can catch that
435 * one here, but anything else is an error. First, we track down the 512 * one here, but anything else is an error. First, we track down the
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 95075f99a6d4..fb0da7c209db 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -270,7 +270,6 @@ EXPORT_SYMBOL(__delay);
270EXPORT_SYMBOL(timer_interrupt); 270EXPORT_SYMBOL(timer_interrupt);
271EXPORT_SYMBOL(irq_desc); 271EXPORT_SYMBOL(irq_desc);
272EXPORT_SYMBOL(tb_ticks_per_jiffy); 272EXPORT_SYMBOL(tb_ticks_per_jiffy);
273EXPORT_SYMBOL(get_wchan);
274EXPORT_SYMBOL(console_drivers); 273EXPORT_SYMBOL(console_drivers);
275#ifdef CONFIG_XMON 274#ifdef CONFIG_XMON
276EXPORT_SYMBOL(xmon); 275EXPORT_SYMBOL(xmon);
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index 04bdc39bf47b..012e1e652c03 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -51,9 +51,6 @@
51 51
52#include <syslib/ppc83xx_setup.h> 52#include <syslib/ppc83xx_setup.h>
53 53
54static const char *GFAR_PHY_0 = "phy0:0";
55static const char *GFAR_PHY_1 = "phy0:1";
56
57#ifndef CONFIG_PCI 54#ifndef CONFIG_PCI
58unsigned long isa_io_base = 0; 55unsigned long isa_io_base = 0;
59unsigned long isa_mem_base = 0; 56unsigned long isa_mem_base = 0;
@@ -129,20 +126,21 @@ mpc834x_sys_setup_arch(void)
129 mdata->irq[1] = MPC83xx_IRQ_EXT2; 126 mdata->irq[1] = MPC83xx_IRQ_EXT2;
130 mdata->irq[2] = -1; 127 mdata->irq[2] = -1;
131 mdata->irq[31] = -1; 128 mdata->irq[31] = -1;
132 mdata->paddr += binfo->bi_immr_base;
133 129
134 /* setup the board related information for the enet controllers */ 130 /* setup the board related information for the enet controllers */
135 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1); 131 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1);
136 if (pdata) { 132 if (pdata) {
137 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 133 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
138 pdata->bus_id = GFAR_PHY_0; 134 pdata->bus_id = 0;
135 pdata->phy_id = 0;
139 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 136 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
140 } 137 }
141 138
142 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2); 139 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2);
143 if (pdata) { 140 if (pdata) {
144 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 141 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
145 pdata->bus_id = GFAR_PHY_1; 142 pdata->bus_id = 0;
143 pdata->phy_id = 1;
146 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 144 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
147 } 145 }
148 146
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index c5cde97c6ef0..2eceb1e6f4eb 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -52,10 +52,6 @@
52 52
53#include <syslib/ppc85xx_setup.h> 53#include <syslib/ppc85xx_setup.h>
54 54
55static const char *GFAR_PHY_0 = "phy0:0";
56static const char *GFAR_PHY_1 = "phy0:1";
57static const char *GFAR_PHY_3 = "phy0:3";
58
59/* ************************************************************************ 55/* ************************************************************************
60 * 56 *
61 * Setup the architecture 57 * Setup the architecture
@@ -102,27 +98,29 @@ mpc8540ads_setup_arch(void)
102 mdata->irq[2] = -1; 98 mdata->irq[2] = -1;
103 mdata->irq[3] = MPC85xx_IRQ_EXT5; 99 mdata->irq[3] = MPC85xx_IRQ_EXT5;
104 mdata->irq[31] = -1; 100 mdata->irq[31] = -1;
105 mdata->paddr += binfo->bi_immr_base;
106 101
107 /* setup the board related information for the enet controllers */ 102 /* setup the board related information for the enet controllers */
108 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 103 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
109 if (pdata) { 104 if (pdata) {
110 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 105 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
111 pdata->bus_id = GFAR_PHY_0; 106 pdata->bus_id = 0;
107 pdata->phy_id = 0;
112 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 108 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
113 } 109 }
114 110
115 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 111 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
116 if (pdata) { 112 if (pdata) {
117 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 113 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
118 pdata->bus_id = GFAR_PHY_1; 114 pdata->bus_id = 0;
115 pdata->phy_id = 1;
119 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 116 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
120 } 117 }
121 118
122 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC); 119 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
123 if (pdata) { 120 if (pdata) {
124 pdata->board_flags = 0; 121 pdata->board_flags = 0;
125 pdata->bus_id = GFAR_PHY_3; 122 pdata->bus_id = 0;
123 pdata->phy_id = 3;
126 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6); 124 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
127 } 125 }
128 126
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index 8e39a5517092..442c7ff195d3 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -56,10 +56,6 @@
56#include <syslib/ppc85xx_setup.h> 56#include <syslib/ppc85xx_setup.h>
57 57
58 58
59static const char *GFAR_PHY_0 = "phy0:0";
60static const char *GFAR_PHY_1 = "phy0:1";
61static const char *GFAR_PHY_3 = "phy0:3";
62
63/* ************************************************************************ 59/* ************************************************************************
64 * 60 *
65 * Setup the architecture 61 * Setup the architecture
@@ -99,20 +95,21 @@ mpc8560ads_setup_arch(void)
99 mdata->irq[2] = -1; 95 mdata->irq[2] = -1;
100 mdata->irq[3] = MPC85xx_IRQ_EXT5; 96 mdata->irq[3] = MPC85xx_IRQ_EXT5;
101 mdata->irq[31] = -1; 97 mdata->irq[31] = -1;
102 mdata->paddr += binfo->bi_immr_base;
103 98
104 /* setup the board related information for the enet controllers */ 99 /* setup the board related information for the enet controllers */
105 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 100 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
106 if (pdata) { 101 if (pdata) {
107 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 102 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
108 pdata->bus_id = GFAR_PHY_0; 103 pdata->bus_id = 0;
104 pdata->phy_id = 0;
109 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 105 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
110 } 106 }
111 107
112 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 108 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
113 if (pdata) { 109 if (pdata) {
114 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 110 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
115 pdata->bus_id = GFAR_PHY_1; 111 pdata->bus_id = 0;
112 pdata->phy_id = 1;
116 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 113 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
117 } 114 }
118 115
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index 2959e3c4083d..b332ebae6bd3 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -395,9 +395,6 @@ mpc85xx_cds_pcibios_fixup(void)
395 395
396TODC_ALLOC(); 396TODC_ALLOC();
397 397
398static const char *GFAR_PHY_0 = "phy0:0";
399static const char *GFAR_PHY_1 = "phy0:1";
400
401/* ************************************************************************ 398/* ************************************************************************
402 * 399 *
403 * Setup the architecture 400 * Setup the architecture
@@ -461,34 +458,37 @@ mpc85xx_cds_setup_arch(void)
461 mdata->irq[2] = -1; 458 mdata->irq[2] = -1;
462 mdata->irq[3] = -1; 459 mdata->irq[3] = -1;
463 mdata->irq[31] = -1; 460 mdata->irq[31] = -1;
464 mdata->paddr += binfo->bi_immr_base;
465 461
466 /* setup the board related information for the enet controllers */ 462 /* setup the board related information for the enet controllers */
467 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 463 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
468 if (pdata) { 464 if (pdata) {
469 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 465 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
470 pdata->bus_id = GFAR_PHY_0; 466 pdata->bus_id = 0;
467 pdata->phy_id = 0;
471 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 468 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
472 } 469 }
473 470
474 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 471 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
475 if (pdata) { 472 if (pdata) {
476 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 473 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
477 pdata->bus_id = GFAR_PHY_1; 474 pdata->bus_id = 0;
475 pdata->phy_id = 1;
478 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 476 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
479 } 477 }
480 478
481 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1); 479 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1);
482 if (pdata) { 480 if (pdata) {
483 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 481 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
484 pdata->bus_id = GFAR_PHY_0; 482 pdata->bus_id = 0;
483 pdata->phy_id = 0;
485 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 484 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
486 } 485 }
487 486
488 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2); 487 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2);
489 if (pdata) { 488 if (pdata) {
490 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 489 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
491 pdata->bus_id = GFAR_PHY_1; 490 pdata->bus_id = 0;
491 pdata->phy_id = 1;
492 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 492 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
493 } 493 }
494 494
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index 45a5b81b4ed1..e777ba824aa9 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -91,9 +91,6 @@ sbc8560_early_serial_map(void)
91} 91}
92#endif 92#endif
93 93
94static const char *GFAR_PHY_25 = "phy0:25";
95static const char *GFAR_PHY_26 = "phy0:26";
96
97/* ************************************************************************ 94/* ************************************************************************
98 * 95 *
99 * Setup the architecture 96 * Setup the architecture
@@ -136,20 +133,21 @@ sbc8560_setup_arch(void)
136 mdata->irq[25] = MPC85xx_IRQ_EXT6; 133 mdata->irq[25] = MPC85xx_IRQ_EXT6;
137 mdata->irq[26] = MPC85xx_IRQ_EXT7; 134 mdata->irq[26] = MPC85xx_IRQ_EXT7;
138 mdata->irq[31] = -1; 135 mdata->irq[31] = -1;
139 mdata->paddr += binfo->bi_immr_base;
140 136
141 /* setup the board related information for the enet controllers */ 137 /* setup the board related information for the enet controllers */
142 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 138 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
143 if (pdata) { 139 if (pdata) {
144 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 140 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
145 pdata->bus_id = GFAR_PHY_25; 141 pdata->bus_id = 0;
142 pdata->phy_id = 25;
146 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 143 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
147 } 144 }
148 145
149 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 146 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
150 if (pdata) { 147 if (pdata) {
151 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 148 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
152 pdata->bus_id = GFAR_PHY_26; 149 pdata->bus_id = 0;
150 pdata->phy_id = 26;
153 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 151 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
154 } 152 }
155 153
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index 15ce9d070634..061bb7cf2d9a 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -93,9 +93,6 @@ static u8 gp3_openpic_initsenses[] __initdata = {
93 0x0, /* External 11: */ 93 0x0, /* External 11: */
94}; 94};
95 95
96static const char *GFAR_PHY_2 = "phy0:2";
97static const char *GFAR_PHY_4 = "phy0:4";
98
99/* 96/*
100 * Setup the architecture 97 * Setup the architecture
101 */ 98 */
@@ -130,20 +127,21 @@ gp3_setup_arch(void)
130 mdata->irq[2] = MPC85xx_IRQ_EXT5; 127 mdata->irq[2] = MPC85xx_IRQ_EXT5;
131 mdata->irq[4] = MPC85xx_IRQ_EXT5; 128 mdata->irq[4] = MPC85xx_IRQ_EXT5;
132 mdata->irq[31] = -1; 129 mdata->irq[31] = -1;
133 mdata->paddr += binfo->bi_immr_base;
134 130
135 /* setup the board related information for the enet controllers */ 131 /* setup the board related information for the enet controllers */
136 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 132 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
137 if (pdata) { 133 if (pdata) {
138 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */ 134 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
139 pdata->bus_id = GFAR_PHY_2; 135 pdata->bus_id = 0;
136 pdata->phy_id = 2;
140 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 137 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
141 } 138 }
142 139
143 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 140 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
144 if (pdata) { 141 if (pdata) {
145 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */ 142 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
146 pdata->bus_id = GFAR_PHY_4; 143 pdata->bus_id = 0;
144 pdata->phy_id = 4;
147 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 145 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
148 } 146 }
149 147
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
index c6dfd8f0f9df..b436f4d0a3fa 100644
--- a/arch/ppc/platforms/85xx/tqm85xx.c
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -91,12 +91,6 @@ static u_char tqm85xx_openpic_initsenses[] __initdata = {
91 0x0, /* External 11: */ 91 0x0, /* External 11: */
92}; 92};
93 93
94static const char *GFAR_PHY_0 = "phy0:2";
95static const char *GFAR_PHY_1 = "phy0:1";
96#ifdef CONFIG_MPC8540
97static const char *GFAR_PHY_3 = "phy0:3";
98#endif
99
100/* ************************************************************************ 94/* ************************************************************************
101 * 95 *
102 * Setup the architecture 96 * Setup the architecture
@@ -149,20 +143,21 @@ tqm85xx_setup_arch(void)
149 mdata->irq[2] = -1; 143 mdata->irq[2] = -1;
150 mdata->irq[3] = MPC85xx_IRQ_EXT8; 144 mdata->irq[3] = MPC85xx_IRQ_EXT8;
151 mdata->irq[31] = -1; 145 mdata->irq[31] = -1;
152 mdata->paddr += binfo->bi_immr_base;
153 146
154 /* setup the board related information for the enet controllers */ 147 /* setup the board related information for the enet controllers */
155 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 148 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
156 if (pdata) { 149 if (pdata) {
157 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 150 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
158 pdata->bus_id = GFAR_PHY_0; 151 pdata->bus_id = 0;
152 pdata->phy_id = 2;
159 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 153 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
160 } 154 }
161 155
162 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 156 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
163 if (pdata) { 157 if (pdata) {
164 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 158 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
165 pdata->bus_id = GFAR_PHY_1; 159 pdata->bus_id = 0;
160 pdata->phy_id = 1;
166 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 161 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
167 } 162 }
168 163
@@ -170,7 +165,8 @@ tqm85xx_setup_arch(void)
170 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC); 165 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
171 if (pdata) { 166 if (pdata) {
172 pdata->board_flags = 0; 167 pdata->board_flags = 0;
173 pdata->bus_id = GFAR_PHY_3; 168 pdata->bus_id = 0;
169 pdata->phy_id = 3;
174 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6); 170 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
175 } 171 }
176#endif 172#endif
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index 847df4409982..f9b95de70e23 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -28,7 +28,6 @@
28 */ 28 */
29 29
30struct gianfar_mdio_data mpc83xx_mdio_pdata = { 30struct gianfar_mdio_data mpc83xx_mdio_pdata = {
31 .paddr = 0x24520,
32}; 31};
33 32
34static struct gianfar_platform_data mpc83xx_tsec1_pdata = { 33static struct gianfar_platform_data mpc83xx_tsec1_pdata = {
@@ -226,7 +225,14 @@ struct platform_device ppc_sys_platform_devices[] = {
226 .name = "fsl-gianfar_mdio", 225 .name = "fsl-gianfar_mdio",
227 .id = 0, 226 .id = 0,
228 .dev.platform_data = &mpc83xx_mdio_pdata, 227 .dev.platform_data = &mpc83xx_mdio_pdata,
229 .num_resources = 0, 228 .num_resources = 1,
229 .resource = (struct resource[]) {
230 {
231 .start = 0x24520,
232 .end = 0x2453f,
233 .flags = IORESOURCE_MEM,
234 },
235 },
230 }, 236 },
231}; 237};
232 238
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
index 69949d255658..00e9b6ff2f6e 100644
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -26,7 +26,6 @@
26 * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup 26 * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup
27 */ 27 */
28struct gianfar_mdio_data mpc85xx_mdio_pdata = { 28struct gianfar_mdio_data mpc85xx_mdio_pdata = {
29 .paddr = MPC85xx_MIIM_OFFSET,
30}; 29};
31 30
32static struct gianfar_platform_data mpc85xx_tsec1_pdata = { 31static struct gianfar_platform_data mpc85xx_tsec1_pdata = {
@@ -720,7 +719,14 @@ struct platform_device ppc_sys_platform_devices[] = {
720 .name = "fsl-gianfar_mdio", 719 .name = "fsl-gianfar_mdio",
721 .id = 0, 720 .id = 0,
722 .dev.platform_data = &mpc85xx_mdio_pdata, 721 .dev.platform_data = &mpc85xx_mdio_pdata,
723 .num_resources = 0, 722 .num_resources = 1,
723 .resource = (struct resource[]) {
724 {
725 .start = 0x24520,
726 .end = 0x2453f,
727 .flags = IORESOURCE_MEM,
728 },
729 },
724 }, 730 },
725}; 731};
726 732