aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/Makefile3
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/binfmt_elf32.c1
-rw-r--r--arch/powerpc/kernel/btext.c1
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S1
-rw-r--r--arch/powerpc/kernel/cpu_setup_power4.S15
-rw-r--r--arch/powerpc/kernel/cputable.c13
-rw-r--r--arch/powerpc/kernel/crash.c153
-rw-r--r--arch/powerpc/kernel/entry_32.S1
-rw-r--r--arch/powerpc/kernel/entry_64.S1
-rw-r--r--arch/powerpc/kernel/firmware.c1
-rw-r--r--arch/powerpc/kernel/fpu.S1
-rw-r--r--arch/powerpc/kernel/head_32.S1
-rw-r--r--arch/powerpc/kernel/head_44x.S1
-rw-r--r--arch/powerpc/kernel/head_4xx.S1
-rw-r--r--arch/powerpc/kernel/head_64.S63
-rw-r--r--arch/powerpc/kernel/head_8xx.S1
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S1
-rw-r--r--arch/powerpc/kernel/idle.c1
-rw-r--r--arch/powerpc/kernel/idle_6xx.S1
-rw-r--r--arch/powerpc/kernel/idle_power4.S1
-rw-r--r--arch/powerpc/kernel/iommu.c31
-rw-r--r--arch/powerpc/kernel/irq.c11
-rw-r--r--arch/powerpc/kernel/kprobes.c1
-rw-r--r--arch/powerpc/kernel/l2cr_6xx.S1
-rw-r--r--arch/powerpc/kernel/legacy_serial.c12
-rw-r--r--arch/powerpc/kernel/lparcfg.c148
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c4
-rw-r--r--arch/powerpc/kernel/misc.S203
-rw-r--r--arch/powerpc/kernel/misc_32.S157
-rw-r--r--arch/powerpc/kernel/misc_64.S224
-rw-r--r--arch/powerpc/kernel/of_device.c1
-rw-r--r--arch/powerpc/kernel/paca.c2
-rw-r--r--arch/powerpc/kernel/pci_32.c48
-rw-r--r--arch/powerpc/kernel/pci_64.c5
-rw-r--r--arch/powerpc/kernel/perfmon_fsl_booke.c1
-rw-r--r--arch/powerpc/kernel/pmc.c1
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c1
-rw-r--r--arch/powerpc/kernel/proc_ppc64.c1
-rw-r--r--arch/powerpc/kernel/process.c1
-rw-r--r--arch/powerpc/kernel/prom.c50
-rw-r--r--arch/powerpc/kernel/prom_init.c3
-rw-r--r--arch/powerpc/kernel/ptrace-common.h1
-rw-r--r--arch/powerpc/kernel/ptrace.c1
-rw-r--r--arch/powerpc/kernel/ptrace32.c1
-rw-r--r--arch/powerpc/kernel/rtas.c119
-rw-r--r--arch/powerpc/kernel/setup-common.c1
-rw-r--r--arch/powerpc/kernel/setup_32.c1
-rw-r--r--arch/powerpc/kernel/setup_64.c23
-rw-r--r--arch/powerpc/kernel/signal_32.c1
-rw-r--r--arch/powerpc/kernel/signal_64.c1
-rw-r--r--arch/powerpc/kernel/smp-tbsync.c1
-rw-r--r--arch/powerpc/kernel/smp.c1
-rw-r--r--arch/powerpc/kernel/swsusp_32.S1
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c1
-rw-r--r--arch/powerpc/kernel/sysfs.c1
-rw-r--r--arch/powerpc/kernel/systbl.S1
-rw-r--r--arch/powerpc/kernel/tau_6xx.c1
-rw-r--r--arch/powerpc/kernel/time.c1
-rw-r--r--arch/powerpc/kernel/traps.c28
-rw-r--r--arch/powerpc/kernel/udbg.c8
-rw-r--r--arch/powerpc/kernel/udbg_16550.c1
-rw-r--r--arch/powerpc/kernel/vdso.c1
-rw-r--r--arch/powerpc/kernel/vdso32/cacheflush.S1
-rw-r--r--arch/powerpc/kernel/vdso32/datapage.S1
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S1
-rw-r--r--arch/powerpc/kernel/vdso32/sigtramp.S1
-rw-r--r--arch/powerpc/kernel/vdso64/cacheflush.S1
-rw-r--r--arch/powerpc/kernel/vdso64/datapage.S1
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S1
-rw-r--r--arch/powerpc/kernel/vdso64/sigtramp.S1
-rw-r--r--arch/powerpc/kernel/vector.S1
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S1
73 files changed, 673 insertions, 701 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 803858e86160..814f242aeb8c 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -50,7 +50,8 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
50extra-$(CONFIG_8xx) := head_8xx.o 50extra-$(CONFIG_8xx) := head_8xx.o
51extra-y += vmlinux.lds 51extra-y += vmlinux.lds
52 52
53obj-y += time.o prom.o traps.o setup-common.o udbg.o 53obj-y += time.o prom.o traps.o setup-common.o \
54 udbg.o misc.o
54obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o 55obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o
55obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o 56obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
56obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o 57obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index ff2940548929..7ee84968087b 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -13,7 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/signal.h> 16#include <linux/signal.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
diff --git a/arch/powerpc/kernel/binfmt_elf32.c b/arch/powerpc/kernel/binfmt_elf32.c
index 8ad6b0f33651..5cb58757e1b1 100644
--- a/arch/powerpc/kernel/binfmt_elf32.c
+++ b/arch/powerpc/kernel/binfmt_elf32.c
@@ -19,7 +19,6 @@
19 19
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/config.h>
23#include <linux/elfcore.h> 22#include <linux/elfcore.h>
24#include <linux/compat.h> 23#include <linux/compat.h>
25 24
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 6223d39177cb..a6920919d68e 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org> 4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 */ 5 */
6#include <linux/config.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
8#include <linux/string.h> 7#include <linux/string.h>
9#include <linux/init.h> 8#include <linux/init.h>
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 365381fcb27c..8b4a4ee85eca 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -9,7 +9,6 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/cputable.h> 14#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S
index 271418308d53..f69af2c5d7b3 100644
--- a/arch/powerpc/kernel/cpu_setup_power4.S
+++ b/arch/powerpc/kernel/cpu_setup_power4.S
@@ -9,7 +9,6 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/cputable.h> 14#include <asm/cputable.h>
@@ -125,7 +124,12 @@ _GLOBAL(__save_cpu_setup)
125 cmpwi r0,0x44 124 cmpwi r0,0x44
126 bne 2f 125 bne 2f
127 126
1281: /* Save HID0,1,4 and 5 */ 1271: /* skip if not running in HV mode */
128 mfmsr r0
129 rldicl. r0,r0,4,63
130 beq 2f
131
132 /* Save HID0,1,4 and 5 */
129 mfspr r3,SPRN_HID0 133 mfspr r3,SPRN_HID0
130 std r3,CS_HID0(r5) 134 std r3,CS_HID0(r5)
131 mfspr r3,SPRN_HID1 135 mfspr r3,SPRN_HID1
@@ -159,7 +163,12 @@ _GLOBAL(__restore_cpu_setup)
159 cmpwi r0,0x44 163 cmpwi r0,0x44
160 bnelr 164 bnelr
161 165
1621: /* Before accessing memory, we make sure rm_ci is clear */ 1661: /* skip if not running in HV mode */
167 mfmsr r0
168 rldicl. r0,r0,4,63
169 beqlr
170
171 /* Before accessing memory, we make sure rm_ci is clear */
163 li r0,0 172 li r0,0
164 mfspr r3,SPRN_HID4 173 mfspr r3,SPRN_HID4
165 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */ 174 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1c114880dc05..272e43622fd6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -10,7 +10,6 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <linux/string.h> 13#include <linux/string.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/threads.h> 15#include <linux/threads.h>
@@ -722,18 +721,6 @@ struct cpu_spec cpu_specs[] = {
722 .oprofile_type = PPC_OPROFILE_G4, 721 .oprofile_type = PPC_OPROFILE_G4,
723 .platform = "ppc7450", 722 .platform = "ppc7450",
724 }, 723 },
725 { /* 8641 */
726 .pvr_mask = 0xffffffff,
727 .pvr_value = 0x80040010,
728 .cpu_name = "8641",
729 .cpu_features = CPU_FTRS_7447A,
730 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP,
731 .icache_bsize = 32,
732 .dcache_bsize = 32,
733 .num_pmcs = 6,
734 .cpu_setup = __setup_cpu_745x
735 },
736
737 { /* 82xx (8240, 8245, 8260 are all 603e cores) */ 724 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
738 .pvr_mask = 0x7fff0000, 725 .pvr_mask = 0x7fff0000,
739 .pvr_value = 0x00810000, 726 .pvr_value = 0x00810000,
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index e253a45dcf10..358cecdc6aef 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -24,9 +24,11 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/irq.h>
27 28
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/kexec.h>
30#include <asm/kdump.h> 32#include <asm/kdump.h>
31#include <asm/lmb.h> 33#include <asm/lmb.h>
32#include <asm/firmware.h> 34#include <asm/firmware.h>
@@ -41,6 +43,7 @@
41 43
42/* This keeps a track of which one is crashing cpu. */ 44/* This keeps a track of which one is crashing cpu. */
43int crashing_cpu = -1; 45int crashing_cpu = -1;
46static cpumask_t cpus_in_crash = CPU_MASK_NONE;
44 47
45static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, 48static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
46 size_t data_len) 49 size_t data_len)
@@ -98,34 +101,66 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
98} 101}
99 102
100#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
101static atomic_t waiting_for_crash_ipi; 104static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
102 105
103void crash_ipi_callback(struct pt_regs *regs) 106void crash_ipi_callback(struct pt_regs *regs)
104{ 107{
105 int cpu = smp_processor_id(); 108 int cpu = smp_processor_id();
106 109
107 if (cpu == crashing_cpu)
108 return;
109
110 if (!cpu_online(cpu)) 110 if (!cpu_online(cpu))
111 return; 111 return;
112 112
113 if (ppc_md.kexec_cpu_down)
114 ppc_md.kexec_cpu_down(1, 1);
115
116 local_irq_disable(); 113 local_irq_disable();
114 if (!cpu_isset(cpu, cpus_in_crash))
115 crash_save_this_cpu(regs, cpu);
116 cpu_set(cpu, cpus_in_crash);
117 117
118 crash_save_this_cpu(regs, cpu); 118 /*
119 atomic_dec(&waiting_for_crash_ipi); 119 * Entered via soft-reset - could be the kdump
120 * process is invoked using soft-reset or user activated
121 * it if some CPU did not respond to an IPI.
122 * For soft-reset, the secondary CPU can enter this func
123 * twice. 1 - using IPI, and 2. soft-reset.
124 * Tell the kexec CPU that entered via soft-reset and ready
125 * to go down.
126 */
127 if (cpu_isset(cpu, cpus_in_sr)) {
128 cpu_clear(cpu, cpus_in_sr);
129 atomic_inc(&enter_on_soft_reset);
130 }
131
132 /*
133 * Starting the kdump boot.
134 * This barrier is needed to make sure that all CPUs are stopped.
135 * If not, soft-reset will be invoked to bring other CPUs.
136 */
137 while (!cpu_isset(crashing_cpu, cpus_in_crash))
138 cpu_relax();
139
140 if (ppc_md.kexec_cpu_down)
141 ppc_md.kexec_cpu_down(1, 1);
120 kexec_smp_wait(); 142 kexec_smp_wait();
121 /* NOTREACHED */ 143 /* NOTREACHED */
122} 144}
123 145
124static void crash_kexec_prepare_cpus(void) 146/*
147 * Wait until all CPUs are entered via soft-reset.
148 */
149static void crash_soft_reset_check(int cpu)
150{
151 unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
152
153 cpu_clear(cpu, cpus_in_sr);
154 while (atomic_read(&enter_on_soft_reset) != ncpus)
155 cpu_relax();
156}
157
158
159static void crash_kexec_prepare_cpus(int cpu)
125{ 160{
126 unsigned int msecs; 161 unsigned int msecs;
127 162
128 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); 163 unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
129 164
130 crash_send_ipi(crash_ipi_callback); 165 crash_send_ipi(crash_ipi_callback);
131 smp_wmb(); 166 smp_wmb();
@@ -133,14 +168,13 @@ static void crash_kexec_prepare_cpus(void)
133 /* 168 /*
134 * FIXME: Until we will have the way to stop other CPUSs reliabally, 169 * FIXME: Until we will have the way to stop other CPUSs reliabally,
135 * the crash CPU will send an IPI and wait for other CPUs to 170 * the crash CPU will send an IPI and wait for other CPUs to
136 * respond. If not, proceed the kexec boot even though we failed to 171 * respond.
137 * capture other CPU states.
138 * Delay of at least 10 seconds. 172 * Delay of at least 10 seconds.
139 */ 173 */
140 printk(KERN_ALERT "Sending IPI to other cpus...\n"); 174 printk(KERN_EMERG "Sending IPI to other cpus...\n");
141 msecs = 10000; 175 msecs = 10000;
142 while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) { 176 while ((cpus_weight(cpus_in_crash) < ncpus) && (--msecs > 0)) {
143 barrier(); 177 cpu_relax();
144 mdelay(1); 178 mdelay(1);
145 } 179 }
146 180
@@ -149,18 +183,71 @@ static void crash_kexec_prepare_cpus(void)
149 /* 183 /*
150 * FIXME: In case if we do not get all CPUs, one possibility: ask the 184 * FIXME: In case if we do not get all CPUs, one possibility: ask the
151 * user to do soft reset such that we get all. 185 * user to do soft reset such that we get all.
152 * IPI handler is already set by the panic cpu initially. Therefore, 186 * Soft-reset will be used until better mechanism is implemented.
153 * all cpus could invoke this handler from die() and the panic CPU 187 */
154 * will call machine_kexec() directly from this handler to do 188 if (cpus_weight(cpus_in_crash) < ncpus) {
155 * kexec boot. 189 printk(KERN_EMERG "done waiting: %d cpu(s) not responding\n",
190 ncpus - cpus_weight(cpus_in_crash));
191 printk(KERN_EMERG "Activate soft-reset to stop other cpu(s)\n");
192 cpus_in_sr = CPU_MASK_NONE;
193 atomic_set(&enter_on_soft_reset, 0);
194 while (cpus_weight(cpus_in_crash) < ncpus)
195 cpu_relax();
196 }
197 /*
198 * Make sure all CPUs are entered via soft-reset if the kdump is
199 * invoked using soft-reset.
156 */ 200 */
157 if (atomic_read(&waiting_for_crash_ipi)) 201 if (cpu_isset(cpu, cpus_in_sr))
158 printk(KERN_ALERT "done waiting: %d cpus not responding\n", 202 crash_soft_reset_check(cpu);
159 atomic_read(&waiting_for_crash_ipi));
160 /* Leave the IPI callback set */ 203 /* Leave the IPI callback set */
161} 204}
205
206/*
207 * This function will be called by secondary cpus or by kexec cpu
208 * if soft-reset is activated to stop some CPUs.
209 */
210void crash_kexec_secondary(struct pt_regs *regs)
211{
212 int cpu = smp_processor_id();
213 unsigned long flags;
214 int msecs = 5;
215
216 local_irq_save(flags);
217 /* Wait 5ms if the kexec CPU is not entered yet. */
218 while (crashing_cpu < 0) {
219 if (--msecs < 0) {
220 /*
221 * Either kdump image is not loaded or
222 * kdump process is not started - Probably xmon
223 * exited using 'x'(exit and recover) or
224 * kexec_should_crash() failed for all running tasks.
225 */
226 cpu_clear(cpu, cpus_in_sr);
227 local_irq_restore(flags);
228 return;
229 }
230 mdelay(1);
231 cpu_relax();
232 }
233 if (cpu == crashing_cpu) {
234 /*
235 * Panic CPU will enter this func only via soft-reset.
236 * Wait until all secondary CPUs entered and
237 * then start kexec boot.
238 */
239 crash_soft_reset_check(cpu);
240 cpu_set(crashing_cpu, cpus_in_crash);
241 if (ppc_md.kexec_cpu_down)
242 ppc_md.kexec_cpu_down(1, 0);
243 machine_kexec(kexec_crash_image);
244 /* NOTREACHED */
245 }
246 crash_ipi_callback(regs);
247}
248
162#else 249#else
163static void crash_kexec_prepare_cpus(void) 250static void crash_kexec_prepare_cpus(int cpu)
164{ 251{
165 /* 252 /*
166 * move the secondarys to us so that we can copy 253 * move the secondarys to us so that we can copy
@@ -171,6 +258,10 @@ static void crash_kexec_prepare_cpus(void)
171 smp_release_cpus(); 258 smp_release_cpus();
172} 259}
173 260
261void crash_kexec_secondary(struct pt_regs *regs)
262{
263 cpus_in_sr = CPU_MASK_NONE;
264}
174#endif 265#endif
175 266
176void default_machine_crash_shutdown(struct pt_regs *regs) 267void default_machine_crash_shutdown(struct pt_regs *regs)
@@ -190,23 +281,23 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
190 local_irq_disable(); 281 local_irq_disable();
191 282
192 for_each_irq(irq) { 283 for_each_irq(irq) {
193 struct irq_desc *desc = irq_descp(irq); 284 struct irq_desc *desc = irq_desc + irq;
194 285
195 if (desc->status & IRQ_INPROGRESS) 286 if (desc->status & IRQ_INPROGRESS)
196 desc->handler->end(irq); 287 desc->chip->end(irq);
197 288
198 if (!(desc->status & IRQ_DISABLED)) 289 if (!(desc->status & IRQ_DISABLED))
199 desc->handler->disable(irq); 290 desc->chip->disable(irq);
200 } 291 }
201 292
202 if (ppc_md.kexec_cpu_down)
203 ppc_md.kexec_cpu_down(1, 0);
204
205 /* 293 /*
206 * Make a note of crashing cpu. Will be used in machine_kexec 294 * Make a note of crashing cpu. Will be used in machine_kexec
207 * such that another IPI will not be sent. 295 * such that another IPI will not be sent.
208 */ 296 */
209 crashing_cpu = smp_processor_id(); 297 crashing_cpu = smp_processor_id();
210 crash_kexec_prepare_cpus();
211 crash_save_this_cpu(regs, crashing_cpu); 298 crash_save_this_cpu(regs, crashing_cpu);
299 crash_kexec_prepare_cpus(crashing_cpu);
300 cpu_set(crashing_cpu, cpus_in_crash);
301 if (ppc_md.kexec_cpu_down)
302 ppc_md.kexec_cpu_down(1, 0);
212} 303}
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 8866fd26c6b9..c03e829fee3c 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/sys.h> 23#include <linux/sys.h>
25#include <linux/threads.h> 24#include <linux/threads.h>
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 221062c960c9..54d9f5cdaab4 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -18,7 +18,6 @@
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
23#include <asm/unistd.h> 22#include <asm/unistd.h>
24#include <asm/processor.h> 23#include <asm/processor.h>
diff --git a/arch/powerpc/kernel/firmware.c b/arch/powerpc/kernel/firmware.c
index 0bfe9061720a..1679a70bbcad 100644
--- a/arch/powerpc/kernel/firmware.c
+++ b/arch/powerpc/kernel/firmware.c
@@ -13,7 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/module.h> 16#include <linux/module.h>
18 17
19#include <asm/firmware.h> 18#include <asm/firmware.h>
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index 01f71200c603..7e2c9fe44ac1 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -9,7 +9,6 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/reg.h> 12#include <asm/reg.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/mmu.h> 14#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index b25b25902d15..d88e182e40b3 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/config.h>
26#include <asm/reg.h> 25#include <asm/reg.h>
27#include <asm/page.h> 26#include <asm/page.h>
28#include <asm/mmu.h> 27#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 47c7fa148c9a..accb39d49911 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -28,7 +28,6 @@
28 * option) any later version. 28 * option) any later version.
29 */ 29 */
30 30
31#include <linux/config.h>
32#include <asm/processor.h> 31#include <asm/processor.h>
33#include <asm/page.h> 32#include <asm/page.h>
34#include <asm/mmu.h> 33#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_4xx.S b/arch/powerpc/kernel/head_4xx.S
index 2590e97f5539..adc7f8097cd4 100644
--- a/arch/powerpc/kernel/head_4xx.S
+++ b/arch/powerpc/kernel/head_4xx.S
@@ -31,7 +31,6 @@
31 * 31 *
32 */ 32 */
33 33
34#include <linux/config.h>
35#include <asm/processor.h> 34#include <asm/processor.h>
36#include <asm/page.h> 35#include <asm/page.h>
37#include <asm/mmu.h> 36#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 831acbdf2592..e16eb2a33173 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -21,7 +21,6 @@
21 * 2 of the License, or (at your option) any later version. 21 * 2 of the License, or (at your option) any later version.
22 */ 22 */
23 23
24#include <linux/config.h>
25#include <linux/threads.h> 24#include <linux/threads.h>
26#include <asm/reg.h> 25#include <asm/reg.h>
27#include <asm/page.h> 26#include <asm/page.h>
@@ -85,34 +84,6 @@ END_FTR_SECTION(0, 1)
85 /* Catch branch to 0 in real mode */ 84 /* Catch branch to 0 in real mode */
86 trap 85 trap
87 86
88#ifdef CONFIG_PPC_ISERIES
89 /*
90 * At offset 0x20, there is a pointer to iSeries LPAR data.
91 * This is required by the hypervisor
92 */
93 . = 0x20
94 .llong hvReleaseData-KERNELBASE
95
96 /*
97 * At offset 0x28 and 0x30 are offsets to the mschunks_map
98 * array (used by the iSeries LPAR debugger to do translation
99 * between physical addresses and absolute addresses) and
100 * to the pidhash table (also used by the debugger)
101 */
102 .llong mschunks_map-KERNELBASE
103 .llong 0 /* pidhash-KERNELBASE SFRXXX */
104
105 /* Offset 0x38 - Pointer to start of embedded System.map */
106 .globl embedded_sysmap_start
107embedded_sysmap_start:
108 .llong 0
109 /* Offset 0x40 - Pointer to end of embedded System.map */
110 .globl embedded_sysmap_end
111embedded_sysmap_end:
112 .llong 0
113
114#endif /* CONFIG_PPC_ISERIES */
115
116 /* Secondary processors spin on this value until it goes to 1. */ 87 /* Secondary processors spin on this value until it goes to 1. */
117 .globl __secondary_hold_spinloop 88 .globl __secondary_hold_spinloop
118__secondary_hold_spinloop: 89__secondary_hold_spinloop:
@@ -124,6 +95,15 @@ __secondary_hold_spinloop:
124__secondary_hold_acknowledge: 95__secondary_hold_acknowledge:
125 .llong 0x0 96 .llong 0x0
126 97
98#ifdef CONFIG_PPC_ISERIES
99 /*
100 * At offset 0x20, there is a pointer to iSeries LPAR data.
101 * This is required by the hypervisor
102 */
103 . = 0x20
104 .llong hvReleaseData-KERNELBASE
105#endif /* CONFIG_PPC_ISERIES */
106
127 . = 0x60 107 . = 0x60
128/* 108/*
129 * The following code is used on pSeries to hold secondary processors 109 * The following code is used on pSeries to hold secondary processors
@@ -1602,9 +1582,6 @@ _GLOBAL(__start_initialization_multiplatform)
1602 /* Setup some critical 970 SPRs before switching MMU off */ 1582 /* Setup some critical 970 SPRs before switching MMU off */
1603 bl .__970_cpu_preinit 1583 bl .__970_cpu_preinit
1604 1584
1605 /* cpu # */
1606 li r24,0
1607
1608 /* Switch off MMU if not already */ 1585 /* Switch off MMU if not already */
1609 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) 1586 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
1610 add r4,r4,r30 1587 add r4,r4,r30
@@ -1683,6 +1660,9 @@ _STATIC(__after_prom_start)
1683 /* i.e. where we are running */ 1660 /* i.e. where we are running */
1684 /* the source addr */ 1661 /* the source addr */
1685 1662
1663 cmpdi r4,0 /* In some cases the loader may */
1664 beq .start_here_multiplatform /* have already put us at zero */
1665 /* so we can skip the copy. */
1686 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */ 1666 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1687 sub r5,r5,r27 1667 sub r5,r5,r27
1688 1668
@@ -1962,14 +1942,6 @@ _STATIC(start_here_common)
1962 li r3,0 1942 li r3,0
1963 bl .do_cpu_ftr_fixups 1943 bl .do_cpu_ftr_fixups
1964 1944
1965 LOAD_REG_IMMEDIATE(r26, boot_cpuid)
1966 lwz r26,0(r26)
1967
1968 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1969 mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
1970 add r13,r13,r24 /* for this processor. */
1971 mtspr SPRN_SPRG3,r13
1972
1973 /* ptr to current */ 1945 /* ptr to current */
1974 LOAD_REG_IMMEDIATE(r4, init_task) 1946 LOAD_REG_IMMEDIATE(r4, init_task)
1975 std r4,PACACURRENT(r13) 1947 std r4,PACACURRENT(r13)
@@ -1995,17 +1967,6 @@ _STATIC(start_here_common)
1995 /* Not reached */ 1967 /* Not reached */
1996 BUG_OPCODE 1968 BUG_OPCODE
1997 1969
1998/* Put the paca pointer into r13 and SPRG3 */
1999_GLOBAL(setup_boot_paca)
2000 LOAD_REG_IMMEDIATE(r3, boot_cpuid)
2001 lwz r3,0(r3)
2002 LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */
2003 mulli r3,r3,PACA_SIZE /* Calculate vaddr of right paca */
2004 add r13,r3,r4 /* for this processor. */
2005 mtspr SPRN_SPRG3,r13
2006
2007 blr
2008
2009/* 1970/*
2010 * We put a few things here that have to be page-aligned. 1971 * We put a few things here that have to be page-aligned.
2011 * This stuff goes at the beginning of the bss, which is page-aligned. 1972 * This stuff goes at the beginning of the bss, which is page-aligned.
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 28941f5ce673..901be47a02a9 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <asm/processor.h> 22#include <asm/processor.h>
24#include <asm/page.h> 23#include <asm/page.h>
25#include <asm/mmu.h> 24#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index dd86bbed7627..66877bdfe0b7 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -30,7 +30,6 @@
30 * option) any later version. 30 * option) any later version.
31 */ 31 */
32 32
33#include <linux/config.h>
34#include <linux/threads.h> 33#include <linux/threads.h>
35#include <asm/processor.h> 34#include <asm/processor.h>
36#include <asm/page.h> 35#include <asm/page.h>
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index d491052c8e0c..4180c3998b39 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -19,7 +19,6 @@
19 * 2 of the License, or (at your option) any later version. 19 * 2 of the License, or (at your option) any later version.
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <linux/sched.h> 22#include <linux/sched.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/smp.h> 24#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index b45fa0e37212..01bcd52bbf8e 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -13,7 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/threads.h> 16#include <linux/threads.h>
18#include <asm/reg.h> 17#include <asm/reg.h>
19#include <asm/page.h> 18#include <asm/page.h>
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index d85c7c938eed..30de81da7b40 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -7,7 +7,6 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9 9
10#include <linux/config.h>
11#include <linux/threads.h> 10#include <linux/threads.h>
12#include <asm/processor.h> 11#include <asm/processor.h>
13#include <asm/page.h> 12#include <asm/page.h>
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 7cb77c20fc5d..ba0694071728 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -23,7 +23,6 @@
23 */ 23 */
24 24
25 25
26#include <linux/config.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/types.h> 27#include <linux/types.h>
29#include <linux/slab.h> 28#include <linux/slab.h>
@@ -38,6 +37,7 @@
38#include <asm/iommu.h> 37#include <asm/iommu.h>
39#include <asm/pci-bridge.h> 38#include <asm/pci-bridge.h>
40#include <asm/machdep.h> 39#include <asm/machdep.h>
40#include <asm/kdump.h>
41 41
42#define DBG(...) 42#define DBG(...)
43 43
@@ -440,8 +440,37 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
440 tbl->it_largehint = tbl->it_halfpoint; 440 tbl->it_largehint = tbl->it_halfpoint;
441 spin_lock_init(&tbl->it_lock); 441 spin_lock_init(&tbl->it_lock);
442 442
443#ifdef CONFIG_CRASH_DUMP
444 if (ppc_md.tce_get) {
445 unsigned long index, tceval;
446 unsigned long tcecount = 0;
447
448 /*
449 * Reserve the existing mappings left by the first kernel.
450 */
451 for (index = 0; index < tbl->it_size; index++) {
452 tceval = ppc_md.tce_get(tbl, index + tbl->it_offset);
453 /*
454 * Freed TCE entry contains 0x7fffffffffffffff on JS20
455 */
456 if (tceval && (tceval != 0x7fffffffffffffffUL)) {
457 __set_bit(index, tbl->it_map);
458 tcecount++;
459 }
460 }
461 if ((tbl->it_size - tcecount) < KDUMP_MIN_TCE_ENTRIES) {
462 printk(KERN_WARNING "TCE table is full; ");
463 printk(KERN_WARNING "freeing %d entries for the kdump boot\n",
464 KDUMP_MIN_TCE_ENTRIES);
465 for (index = tbl->it_size - KDUMP_MIN_TCE_ENTRIES;
466 index < tbl->it_size; index++)
467 __clear_bit(index, tbl->it_map);
468 }
469 }
470#else
443 /* Clear the hardware table in case firmware left allocations in it */ 471 /* Clear the hardware table in case firmware left allocations in it */
444 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); 472 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
473#endif
445 474
446 if (!welcomed) { 475 if (!welcomed) {
447 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n", 476 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n",
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 40d4c14fde8f..525baab45d2d 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -38,7 +38,6 @@
38#include <linux/ioport.h> 38#include <linux/ioport.h>
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/timex.h> 40#include <linux/timex.h>
41#include <linux/config.h>
42#include <linux/init.h> 41#include <linux/init.h>
43#include <linux/slab.h> 42#include <linux/slab.h>
44#include <linux/delay.h> 43#include <linux/delay.h>
@@ -120,8 +119,8 @@ int show_interrupts(struct seq_file *p, void *v)
120#else 119#else
121 seq_printf(p, "%10u ", kstat_irqs(i)); 120 seq_printf(p, "%10u ", kstat_irqs(i));
122#endif /* CONFIG_SMP */ 121#endif /* CONFIG_SMP */
123 if (desc->handler) 122 if (desc->chip)
124 seq_printf(p, " %s ", desc->handler->typename); 123 seq_printf(p, " %s ", desc->chip->typename);
125 else 124 else
126 seq_puts(p, " None "); 125 seq_puts(p, " None ");
127 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge "); 126 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge ");
@@ -164,13 +163,13 @@ void fixup_irqs(cpumask_t map)
164 if (irq_desc[irq].status & IRQ_PER_CPU) 163 if (irq_desc[irq].status & IRQ_PER_CPU)
165 continue; 164 continue;
166 165
167 cpus_and(mask, irq_affinity[irq], map); 166 cpus_and(mask, irq_desc[irq].affinity, map);
168 if (any_online_cpu(mask) == NR_CPUS) { 167 if (any_online_cpu(mask) == NR_CPUS) {
169 printk("Breaking affinity for irq %i\n", irq); 168 printk("Breaking affinity for irq %i\n", irq);
170 mask = map; 169 mask = map;
171 } 170 }
172 if (irq_desc[irq].handler->set_affinity) 171 if (irq_desc[irq].chip->set_affinity)
173 irq_desc[irq].handler->set_affinity(irq, mask); 172 irq_desc[irq].chip->set_affinity(irq, mask);
174 else if (irq_desc[irq].action && !(warned++)) 173 else if (irq_desc[irq].action && !(warned++))
175 printk("Cannot set affinity for irq %i\n", irq); 174 printk("Cannot set affinity for irq %i\n", irq);
176 } 175 }
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index f78866367b70..9f0898c89759 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -26,7 +26,6 @@
26 * for PPC64 26 * for PPC64
27 */ 27 */
28 28
29#include <linux/config.h>
30#include <linux/kprobes.h> 29#include <linux/kprobes.h>
31#include <linux/ptrace.h> 30#include <linux/ptrace.h>
32#include <linux/preempt.h> 31#include <linux/preempt.h>
diff --git a/arch/powerpc/kernel/l2cr_6xx.S b/arch/powerpc/kernel/l2cr_6xx.S
index d7f4e982b539..858f28ac8a06 100644
--- a/arch/powerpc/kernel/l2cr_6xx.S
+++ b/arch/powerpc/kernel/l2cr_6xx.S
@@ -40,7 +40,6 @@
40 Author: Terry Greeniaus (tgree@phys.ualberta.ca) 40 Author: Terry Greeniaus (tgree@phys.ualberta.ca)
41 Please e-mail updates to this file to me, thanks! 41 Please e-mail updates to this file to me, thanks!
42*/ 42*/
43#include <linux/config.h>
44#include <asm/processor.h> 43#include <asm/processor.h>
45#include <asm/cputable.h> 44#include <asm/cputable.h>
46#include <asm/ppc_asm.h> 45#include <asm/ppc_asm.h>
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 6e67b5b49ba1..4cf0b971976b 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/kernel.h> 1#include <linux/kernel.h>
3#include <linux/serial.h> 2#include <linux/serial.h>
4#include <linux/serial_8250.h> 3#include <linux/serial_8250.h>
@@ -302,6 +301,17 @@ void __init find_legacy_serial_ports(void)
302 of_node_put(isa); 301 of_node_put(isa);
303 } 302 }
304 303
304 /* First fill our array with tsi-bridge ports */
305 for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) {
306 struct device_node *tsi = of_get_parent(np);
307 if (tsi && !strcmp(tsi->type, "tsi-bridge")) {
308 index = add_legacy_soc_port(np, np);
309 if (index >= 0 && np == stdout)
310 legacy_serial_console = index;
311 }
312 of_node_put(tsi);
313 }
314
305#ifdef CONFIG_PCI 315#ifdef CONFIG_PCI
306 /* Next, try to locate PCI ports */ 316 /* Next, try to locate PCI ports */
307 for (np = NULL; (np = of_find_all_nodes(np));) { 317 for (np = NULL; (np = of_find_all_nodes(np));) {
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index c02deaab26c7..23f34daa044a 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -18,7 +18,6 @@
18 * keyword - value pairs that specify the configuration of the partition. 18 * keyword - value pairs that specify the configuration of the partition.
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include <linux/errno.h> 23#include <linux/errno.h>
@@ -45,11 +44,9 @@
45static struct proc_dir_entry *proc_ppc64_lparcfg; 44static struct proc_dir_entry *proc_ppc64_lparcfg;
46#define LPARCFG_BUFF_SIZE 4096 45#define LPARCFG_BUFF_SIZE 4096
47 46
48#ifdef CONFIG_PPC_ISERIES
49
50/* 47/*
51 * For iSeries legacy systems, the PPA purr function is available from the 48 * Track sum of all purrs across all processors. This is used to further
52 * emulated_time_base field in the paca. 49 * calculate usage values by different applications
53 */ 50 */
54static unsigned long get_purr(void) 51static unsigned long get_purr(void)
55{ 52{
@@ -57,48 +54,31 @@ static unsigned long get_purr(void)
57 int cpu; 54 int cpu;
58 55
59 for_each_possible_cpu(cpu) { 56 for_each_possible_cpu(cpu) {
60 sum_purr += lppaca[cpu].emulated_time_base; 57 if (firmware_has_feature(FW_FEATURE_ISERIES))
58 sum_purr += lppaca[cpu].emulated_time_base;
59 else {
60 struct cpu_usage *cu;
61 61
62#ifdef PURR_DEBUG 62 cu = &per_cpu(cpu_usage_array, cpu);
63 printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n", 63 sum_purr += cu->current_tb;
64 cpu, lppaca[cpu].emulated_time_base); 64 }
65#endif
66 } 65 }
67 return sum_purr; 66 return sum_purr;
68} 67}
69 68
70#define lparcfg_write NULL 69#ifdef CONFIG_PPC_ISERIES
71 70
72/* 71/*
73 * Methods used to fetch LPAR data when running on an iSeries platform. 72 * Methods used to fetch LPAR data when running on an iSeries platform.
74 */ 73 */
75static int lparcfg_data(struct seq_file *m, void *v) 74static int iseries_lparcfg_data(struct seq_file *m, void *v)
76{ 75{
77 unsigned long pool_id, lp_index; 76 unsigned long pool_id;
78 int shared, entitled_capacity, max_entitled_capacity; 77 int shared, entitled_capacity, max_entitled_capacity;
79 int processors, max_processors; 78 int processors, max_processors;
80 unsigned long purr = get_purr(); 79 unsigned long purr = get_purr();
81 80
82 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
83
84 shared = (int)(get_lppaca()->shared_proc); 81 shared = (int)(get_lppaca()->shared_proc);
85 seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
86 e2a(xItExtVpdPanel.mfgID[2]),
87 e2a(xItExtVpdPanel.mfgID[3]),
88 e2a(xItExtVpdPanel.systemSerial[1]),
89 e2a(xItExtVpdPanel.systemSerial[2]),
90 e2a(xItExtVpdPanel.systemSerial[3]),
91 e2a(xItExtVpdPanel.systemSerial[4]),
92 e2a(xItExtVpdPanel.systemSerial[5]));
93
94 seq_printf(m, "system_type=%c%c%c%c\n",
95 e2a(xItExtVpdPanel.machineType[0]),
96 e2a(xItExtVpdPanel.machineType[1]),
97 e2a(xItExtVpdPanel.machineType[2]),
98 e2a(xItExtVpdPanel.machineType[3]));
99
100 lp_index = HvLpConfig_getLpIndex();
101 seq_printf(m, "partition_id=%d\n", (int)lp_index);
102 82
103 seq_printf(m, "system_active_processors=%d\n", 83 seq_printf(m, "system_active_processors=%d\n",
104 (int)HvLpConfig_getSystemPhysicalProcessors()); 84 (int)HvLpConfig_getSystemPhysicalProcessors());
@@ -137,6 +117,14 @@ static int lparcfg_data(struct seq_file *m, void *v)
137 117
138 return 0; 118 return 0;
139} 119}
120
121#else /* CONFIG_PPC_ISERIES */
122
123static int iseries_lparcfg_data(struct seq_file *m, void *v)
124{
125 return 0;
126}
127
140#endif /* CONFIG_PPC_ISERIES */ 128#endif /* CONFIG_PPC_ISERIES */
141 129
142#ifdef CONFIG_PPC_PSERIES 130#ifdef CONFIG_PPC_PSERIES
@@ -213,22 +201,6 @@ static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs)
213 log_plpar_hcall_return(rc, "H_PIC"); 201 log_plpar_hcall_return(rc, "H_PIC");
214} 202}
215 203
216/* Track sum of all purrs across all processors. This is used to further */
217/* calculate usage values by different applications */
218
219static unsigned long get_purr(void)
220{
221 unsigned long sum_purr = 0;
222 int cpu;
223 struct cpu_usage *cu;
224
225 for_each_possible_cpu(cpu) {
226 cu = &per_cpu(cpu_usage_array, cpu);
227 sum_purr += cu->current_tb;
228 }
229 return sum_purr;
230}
231
232#define SPLPAR_CHARACTERISTICS_TOKEN 20 204#define SPLPAR_CHARACTERISTICS_TOKEN 20
233#define SPLPAR_MAXLENGTH 1026*(sizeof(char)) 205#define SPLPAR_MAXLENGTH 1026*(sizeof(char))
234 206
@@ -333,35 +305,13 @@ static int lparcfg_count_active_processors(void)
333 return count; 305 return count;
334} 306}
335 307
336static int lparcfg_data(struct seq_file *m, void *v) 308static int pseries_lparcfg_data(struct seq_file *m, void *v)
337{ 309{
338 int partition_potential_processors; 310 int partition_potential_processors;
339 int partition_active_processors; 311 int partition_active_processors;
340 struct device_node *rootdn;
341 const char *model = "";
342 const char *system_id = "";
343 unsigned int *lp_index_ptr, lp_index = 0;
344 struct device_node *rtas_node; 312 struct device_node *rtas_node;
345 int *lrdrp = NULL; 313 int *lrdrp = NULL;
346 314
347 rootdn = find_path_device("/");
348 if (rootdn) {
349 model = get_property(rootdn, "model", NULL);
350 system_id = get_property(rootdn, "system-id", NULL);
351 lp_index_ptr = (unsigned int *)
352 get_property(rootdn, "ibm,partition-no", NULL);
353 if (lp_index_ptr)
354 lp_index = *lp_index_ptr;
355 }
356
357 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
358
359 seq_printf(m, "serial_number=%s\n", system_id);
360
361 seq_printf(m, "system_type=%s\n", model);
362
363 seq_printf(m, "partition_id=%d\n", (int)lp_index);
364
365 rtas_node = find_path_device("/rtas"); 315 rtas_node = find_path_device("/rtas");
366 if (rtas_node) 316 if (rtas_node)
367 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", 317 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity",
@@ -549,8 +499,61 @@ out:
549 return retval; 499 return retval;
550} 500}
551 501
502#else /* CONFIG_PPC_PSERIES */
503
504static int pseries_lparcfg_data(struct seq_file *m, void *v)
505{
506 return 0;
507}
508
509static ssize_t lparcfg_write(struct file *file, const char __user * buf,
510 size_t count, loff_t * off)
511{
512 return count;
513}
514
552#endif /* CONFIG_PPC_PSERIES */ 515#endif /* CONFIG_PPC_PSERIES */
553 516
517static int lparcfg_data(struct seq_file *m, void *v)
518{
519 struct device_node *rootdn;
520 const char *model = "";
521 const char *system_id = "";
522 const char *tmp;
523 unsigned int *lp_index_ptr, lp_index = 0;
524
525 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
526
527 rootdn = find_path_device("/");
528 if (rootdn) {
529 tmp = get_property(rootdn, "model", NULL);
530 if (tmp) {
531 model = tmp;
532 /* Skip "IBM," - see platforms/iseries/dt.c */
533 if (firmware_has_feature(FW_FEATURE_ISERIES))
534 model += 4;
535 }
536 tmp = get_property(rootdn, "system-id", NULL);
537 if (tmp) {
538 system_id = tmp;
539 /* Skip "IBM," - see platforms/iseries/dt.c */
540 if (firmware_has_feature(FW_FEATURE_ISERIES))
541 system_id += 4;
542 }
543 lp_index_ptr = (unsigned int *)
544 get_property(rootdn, "ibm,partition-no", NULL);
545 if (lp_index_ptr)
546 lp_index = *lp_index_ptr;
547 }
548 seq_printf(m, "serial_number=%s\n", system_id);
549 seq_printf(m, "system_type=%s\n", model);
550 seq_printf(m, "partition_id=%d\n", (int)lp_index);
551
552 if (firmware_has_feature(FW_FEATURE_ISERIES))
553 return iseries_lparcfg_data(m, v);
554 return pseries_lparcfg_data(m, v);
555}
556
554static int lparcfg_open(struct inode *inode, struct file *file) 557static int lparcfg_open(struct inode *inode, struct file *file)
555{ 558{
556 return single_open(file, lparcfg_data, NULL); 559 return single_open(file, lparcfg_data, NULL);
@@ -569,7 +572,8 @@ int __init lparcfg_init(void)
569 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 572 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
570 573
571 /* Allow writing if we have FW_FEATURE_SPLPAR */ 574 /* Allow writing if we have FW_FEATURE_SPLPAR */
572 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 575 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
576 !firmware_has_feature(FW_FEATURE_ISERIES)) {
573 lparcfg_fops.write = lparcfg_write; 577 lparcfg_fops.write = lparcfg_write;
574 mode |= S_IWUSR; 578 mode |= S_IWUSR;
575 } 579 }
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index a8fa04ef27cd..b438d45a068c 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -378,11 +378,13 @@ static void __init export_crashk_values(void)
378 of_node_put(node); 378 of_node_put(node);
379} 379}
380 380
381void __init kexec_setup(void) 381static int __init kexec_setup(void)
382{ 382{
383 export_htab_values(); 383 export_htab_values();
384 export_crashk_values(); 384 export_crashk_values();
385 return 0;
385} 386}
387__initcall(kexec_setup);
386 388
387static int __init early_parse_crashk(char *p) 389static int __init early_parse_crashk(char *p)
388{ 390{
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
new file mode 100644
index 000000000000..fc23040d5a26
--- /dev/null
+++ b/arch/powerpc/kernel/misc.S
@@ -0,0 +1,203 @@
1/*
2 * This file contains miscellaneous low-level functions.
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras.
7 *
8 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
9 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#include <asm/ppc_asm.h>
17
18 .text
19
20#ifdef CONFIG_PPC64
21#define IN_SYNC twi 0,r5,0; isync
22#define EIEIO_32
23#define SYNC_64 sync
24#else /* CONFIG_PPC32 */
25#define IN_SYNC
26#define EIEIO_32 eieio
27#define SYNC_64
28#endif
29/*
30 * Returns (address we are running at) - (address we were linked at)
31 * for use before the text and data are mapped to KERNELBASE.
32 */
33
34_GLOBAL(reloc_offset)
35 mflr r0
36 bl 1f
371: mflr r3
38 LOAD_REG_IMMEDIATE(r4,1b)
39 subf r3,r4,r3
40 mtlr r0
41 blr
42
43/*
44 * add_reloc_offset(x) returns x + reloc_offset().
45 */
46_GLOBAL(add_reloc_offset)
47 mflr r0
48 bl 1f
491: mflr r5
50 LOAD_REG_IMMEDIATE(r4,1b)
51 subf r5,r4,r5
52 add r3,r3,r5
53 mtlr r0
54 blr
55
56/*
57 * I/O string operations
58 *
59 * insb(port, buf, len)
60 * outsb(port, buf, len)
61 * insw(port, buf, len)
62 * outsw(port, buf, len)
63 * insl(port, buf, len)
64 * outsl(port, buf, len)
65 * insw_ns(port, buf, len)
66 * outsw_ns(port, buf, len)
67 * insl_ns(port, buf, len)
68 * outsl_ns(port, buf, len)
69 *
70 * The *_ns versions don't do byte-swapping.
71 */
72_GLOBAL(_insb)
73 cmpwi 0,r5,0
74 mtctr r5
75 subi r4,r4,1
76 blelr-
7700: lbz r5,0(r3)
78 eieio
79 stbu r5,1(r4)
80 bdnz 00b
81 IN_SYNC
82 blr
83
84_GLOBAL(_outsb)
85 cmpwi 0,r5,0
86 mtctr r5
87 subi r4,r4,1
88 blelr-
8900: lbzu r5,1(r4)
90 stb r5,0(r3)
91 EIEIO_32
92 bdnz 00b
93 SYNC_64
94 blr
95
96_GLOBAL(_insw)
97 cmpwi 0,r5,0
98 mtctr r5
99 subi r4,r4,2
100 blelr-
10100: lhbrx r5,0,r3
102 eieio
103 sthu r5,2(r4)
104 bdnz 00b
105 IN_SYNC
106 blr
107
108_GLOBAL(_outsw)
109 cmpwi 0,r5,0
110 mtctr r5
111 subi r4,r4,2
112 blelr-
11300: lhzu r5,2(r4)
114 EIEIO_32
115 sthbrx r5,0,r3
116 bdnz 00b
117 SYNC_64
118 blr
119
120_GLOBAL(_insl)
121 cmpwi 0,r5,0
122 mtctr r5
123 subi r4,r4,4
124 blelr-
12500: lwbrx r5,0,r3
126 eieio
127 stwu r5,4(r4)
128 bdnz 00b
129 IN_SYNC
130 blr
131
132_GLOBAL(_outsl)
133 cmpwi 0,r5,0
134 mtctr r5
135 subi r4,r4,4
136 blelr-
13700: lwzu r5,4(r4)
138 stwbrx r5,0,r3
139 EIEIO_32
140 bdnz 00b
141 SYNC_64
142 blr
143
144#ifdef CONFIG_PPC32
145_GLOBAL(__ide_mm_insw)
146#endif
147_GLOBAL(_insw_ns)
148 cmpwi 0,r5,0
149 mtctr r5
150 subi r4,r4,2
151 blelr-
15200: lhz r5,0(r3)
153 eieio
154 sthu r5,2(r4)
155 bdnz 00b
156 IN_SYNC
157 blr
158
159#ifdef CONFIG_PPC32
160_GLOBAL(__ide_mm_outsw)
161#endif
162_GLOBAL(_outsw_ns)
163 cmpwi 0,r5,0
164 mtctr r5
165 subi r4,r4,2
166 blelr-
16700: lhzu r5,2(r4)
168 sth r5,0(r3)
169 EIEIO_32
170 bdnz 00b
171 SYNC_64
172 blr
173
174#ifdef CONFIG_PPC32
175_GLOBAL(__ide_mm_insl)
176#endif
177_GLOBAL(_insl_ns)
178 cmpwi 0,r5,0
179 mtctr r5
180 subi r4,r4,4
181 blelr-
18200: lwz r5,0(r3)
183 eieio
184 stwu r5,4(r4)
185 bdnz 00b
186 IN_SYNC
187 blr
188
189#ifdef CONFIG_PPC32
190_GLOBAL(__ide_mm_outsl)
191#endif
192_GLOBAL(_outsl_ns)
193 cmpwi 0,r5,0
194 mtctr r5
195 subi r4,r4,4
196 blelr-
19700: lwzu r5,4(r4)
198 stw r5,0(r3)
199 EIEIO_32
200 bdnz 00b
201 SYNC_64
202 blr
203
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 01d3916c4cb1..58758d883361 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19#include <linux/config.h>
20#include <linux/sys.h> 19#include <linux/sys.h>
21#include <asm/unistd.h> 20#include <asm/unistd.h>
22#include <asm/errno.h> 21#include <asm/errno.h>
@@ -61,32 +60,6 @@ _GLOBAL(mulhdu)
61 blr 60 blr
62 61
63/* 62/*
64 * Returns (address we're running at) - (address we were linked at)
65 * for use before the text and data are mapped to KERNELBASE.
66 */
67_GLOBAL(reloc_offset)
68 mflr r0
69 bl 1f
701: mflr r3
71 LOAD_REG_IMMEDIATE(r4,1b)
72 subf r3,r4,r3
73 mtlr r0
74 blr
75
76/*
77 * add_reloc_offset(x) returns x + reloc_offset().
78 */
79_GLOBAL(add_reloc_offset)
80 mflr r0
81 bl 1f
821: mflr r5
83 LOAD_REG_IMMEDIATE(r4,1b)
84 subf r5,r4,r5
85 add r3,r3,r5
86 mtlr r0
87 blr
88
89/*
90 * sub_reloc_offset(x) returns x - reloc_offset(). 63 * sub_reloc_offset(x) returns x - reloc_offset().
91 */ 64 */
92_GLOBAL(sub_reloc_offset) 65_GLOBAL(sub_reloc_offset)
@@ -781,136 +754,6 @@ _GLOBAL(atomic_set_mask)
781 blr 754 blr
782 755
783/* 756/*
784 * I/O string operations
785 *
786 * insb(port, buf, len)
787 * outsb(port, buf, len)
788 * insw(port, buf, len)
789 * outsw(port, buf, len)
790 * insl(port, buf, len)
791 * outsl(port, buf, len)
792 * insw_ns(port, buf, len)
793 * outsw_ns(port, buf, len)
794 * insl_ns(port, buf, len)
795 * outsl_ns(port, buf, len)
796 *
797 * The *_ns versions don't do byte-swapping.
798 */
799_GLOBAL(_insb)
800 cmpwi 0,r5,0
801 mtctr r5
802 subi r4,r4,1
803 blelr-
80400: lbz r5,0(r3)
805 eieio
806 stbu r5,1(r4)
807 bdnz 00b
808 blr
809
810_GLOBAL(_outsb)
811 cmpwi 0,r5,0
812 mtctr r5
813 subi r4,r4,1
814 blelr-
81500: lbzu r5,1(r4)
816 stb r5,0(r3)
817 eieio
818 bdnz 00b
819 blr
820
821_GLOBAL(_insw)
822 cmpwi 0,r5,0
823 mtctr r5
824 subi r4,r4,2
825 blelr-
82600: lhbrx r5,0,r3
827 eieio
828 sthu r5,2(r4)
829 bdnz 00b
830 blr
831
832_GLOBAL(_outsw)
833 cmpwi 0,r5,0
834 mtctr r5
835 subi r4,r4,2
836 blelr-
83700: lhzu r5,2(r4)
838 eieio
839 sthbrx r5,0,r3
840 bdnz 00b
841 blr
842
843_GLOBAL(_insl)
844 cmpwi 0,r5,0
845 mtctr r5
846 subi r4,r4,4
847 blelr-
84800: lwbrx r5,0,r3
849 eieio
850 stwu r5,4(r4)
851 bdnz 00b
852 blr
853
854_GLOBAL(_outsl)
855 cmpwi 0,r5,0
856 mtctr r5
857 subi r4,r4,4
858 blelr-
85900: lwzu r5,4(r4)
860 stwbrx r5,0,r3
861 eieio
862 bdnz 00b
863 blr
864
865_GLOBAL(__ide_mm_insw)
866_GLOBAL(_insw_ns)
867 cmpwi 0,r5,0
868 mtctr r5
869 subi r4,r4,2
870 blelr-
87100: lhz r5,0(r3)
872 eieio
873 sthu r5,2(r4)
874 bdnz 00b
875 blr
876
877_GLOBAL(__ide_mm_outsw)
878_GLOBAL(_outsw_ns)
879 cmpwi 0,r5,0
880 mtctr r5
881 subi r4,r4,2
882 blelr-
88300: lhzu r5,2(r4)
884 sth r5,0(r3)
885 eieio
886 bdnz 00b
887 blr
888
889_GLOBAL(__ide_mm_insl)
890_GLOBAL(_insl_ns)
891 cmpwi 0,r5,0
892 mtctr r5
893 subi r4,r4,4
894 blelr-
89500: lwz r5,0(r3)
896 eieio
897 stwu r5,4(r4)
898 bdnz 00b
899 blr
900
901_GLOBAL(__ide_mm_outsl)
902_GLOBAL(_outsl_ns)
903 cmpwi 0,r5,0
904 mtctr r5
905 subi r4,r4,4
906 blelr-
90700: lwzu r5,4(r4)
908 stw r5,0(r3)
909 eieio
910 bdnz 00b
911 blr
912
913/*
914 * Extended precision shifts. 757 * Extended precision shifts.
915 * 758 *
916 * Updated to be valid for shift counts from 0 to 63 inclusive. 759 * Updated to be valid for shift counts from 0 to 63 inclusive.
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index e8883d42c43c..0c3c70d115c6 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -1,14 +1,12 @@
1/* 1/*
2 * arch/powerpc/kernel/misc64.S
3 *
4 * This file contains miscellaneous low-level functions. 2 * This file contains miscellaneous low-level functions.
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * 4 *
7 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) 5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
8 * and Paul Mackerras. 6 * and Paul Mackerras.
9 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) 7 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
10 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) 8 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
11 * 9 *
12 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 12 * as published by the Free Software Foundation; either version
@@ -16,7 +14,6 @@
16 * 14 *
17 */ 15 */
18 16
19#include <linux/config.h>
20#include <linux/sys.h> 17#include <linux/sys.h>
21#include <asm/unistd.h> 18#include <asm/unistd.h>
22#include <asm/errno.h> 19#include <asm/errno.h>
@@ -30,41 +27,10 @@
30 27
31 .text 28 .text
32 29
33/*
34 * Returns (address we are running at) - (address we were linked at)
35 * for use before the text and data are mapped to KERNELBASE.
36 */
37
38_GLOBAL(reloc_offset)
39 mflr r0
40 bl 1f
411: mflr r3
42 LOAD_REG_IMMEDIATE(r4,1b)
43 subf r3,r4,r3
44 mtlr r0
45 blr
46
47/*
48 * add_reloc_offset(x) returns x + reloc_offset().
49 */
50_GLOBAL(add_reloc_offset)
51 mflr r0
52 bl 1f
531: mflr r5
54 LOAD_REG_IMMEDIATE(r4,1b)
55 subf r5,r4,r5
56 add r3,r3,r5
57 mtlr r0
58 blr
59
60_GLOBAL(get_msr) 30_GLOBAL(get_msr)
61 mfmsr r3 31 mfmsr r3
62 blr 32 blr
63 33
64_GLOBAL(get_dar)
65 mfdar r3
66 blr
67
68_GLOBAL(get_srr0) 34_GLOBAL(get_srr0)
69 mfsrr0 r3 35 mfsrr0 r3
70 blr 36 blr
@@ -72,10 +38,6 @@ _GLOBAL(get_srr0)
72_GLOBAL(get_srr1) 38_GLOBAL(get_srr1)
73 mfsrr1 r3 39 mfsrr1 r3
74 blr 40 blr
75
76_GLOBAL(get_sp)
77 mr r3,r1
78 blr
79 41
80#ifdef CONFIG_IRQSTACKS 42#ifdef CONFIG_IRQSTACKS
81_GLOBAL(call_do_softirq) 43_GLOBAL(call_do_softirq)
@@ -101,48 +63,6 @@ _GLOBAL(call___do_IRQ)
101 blr 63 blr
102#endif /* CONFIG_IRQSTACKS */ 64#endif /* CONFIG_IRQSTACKS */
103 65
104 /*
105 * To be called by C code which needs to do some operations with MMU
106 * disabled. Note that interrupts have to be disabled by the caller
107 * prior to calling us. The code called _MUST_ be in the RMO of course
108 * and part of the linear mapping as we don't attempt to translate the
109 * stack pointer at all. The function is called with the stack switched
110 * to this CPU emergency stack
111 *
112 * prototype is void *call_with_mmu_off(void *func, void *data);
113 *
114 * the called function is expected to be of the form
115 *
116 * void *called(void *data);
117 */
118_GLOBAL(call_with_mmu_off)
119 mflr r0 /* get link, save it on stackframe */
120 std r0,16(r1)
121 mr r1,r5 /* save old stack ptr */
122 ld r1,PACAEMERGSP(r13) /* get emerg. stack */
123 subi r1,r1,STACK_FRAME_OVERHEAD
124 std r0,16(r1) /* save link on emerg. stack */
125 std r5,0(r1) /* save old stack ptr in backchain */
126 ld r3,0(r3) /* get to real function ptr (assume same TOC) */
127 bl 2f /* we need LR to return, continue at label 2 */
128
129 ld r0,16(r1) /* we return here from the call, get LR and */
130 ld r1,0(r1) /* .. old stack ptr */
131 mtspr SPRN_SRR0,r0 /* and get back to virtual mode with these */
132 mfmsr r4
133 ori r4,r4,MSR_IR|MSR_DR
134 mtspr SPRN_SRR1,r4
135 rfid
136
1372: mtspr SPRN_SRR0,r3 /* coming from above, enter real mode */
138 mr r3,r4 /* get parameter */
139 mfmsr r0
140 ori r0,r0,MSR_IR|MSR_DR
141 xori r0,r0,MSR_IR|MSR_DR
142 mtspr SPRN_SRR1,r0
143 rfid
144
145
146 .section ".toc","aw" 66 .section ".toc","aw"
147PPC64_CACHES: 67PPC64_CACHES:
148 .tc ppc64_caches[TC],ppc64_caches 68 .tc ppc64_caches[TC],ppc64_caches
@@ -323,144 +243,6 @@ _GLOBAL(__flush_dcache_icache)
323 bdnz 1b 243 bdnz 1b
324 isync 244 isync
325 blr 245 blr
326
327/*
328 * I/O string operations
329 *
330 * insb(port, buf, len)
331 * outsb(port, buf, len)
332 * insw(port, buf, len)
333 * outsw(port, buf, len)
334 * insl(port, buf, len)
335 * outsl(port, buf, len)
336 * insw_ns(port, buf, len)
337 * outsw_ns(port, buf, len)
338 * insl_ns(port, buf, len)
339 * outsl_ns(port, buf, len)
340 *
341 * The *_ns versions don't do byte-swapping.
342 */
343_GLOBAL(_insb)
344 cmpwi 0,r5,0
345 mtctr r5
346 subi r4,r4,1
347 blelr-
34800: lbz r5,0(r3)
349 eieio
350 stbu r5,1(r4)
351 bdnz 00b
352 twi 0,r5,0
353 isync
354 blr
355
356_GLOBAL(_outsb)
357 cmpwi 0,r5,0
358 mtctr r5
359 subi r4,r4,1
360 blelr-
36100: lbzu r5,1(r4)
362 stb r5,0(r3)
363 bdnz 00b
364 sync
365 blr
366
367_GLOBAL(_insw)
368 cmpwi 0,r5,0
369 mtctr r5
370 subi r4,r4,2
371 blelr-
37200: lhbrx r5,0,r3
373 eieio
374 sthu r5,2(r4)
375 bdnz 00b
376 twi 0,r5,0
377 isync
378 blr
379
380_GLOBAL(_outsw)
381 cmpwi 0,r5,0
382 mtctr r5
383 subi r4,r4,2
384 blelr-
38500: lhzu r5,2(r4)
386 sthbrx r5,0,r3
387 bdnz 00b
388 sync
389 blr
390
391_GLOBAL(_insl)
392 cmpwi 0,r5,0
393 mtctr r5
394 subi r4,r4,4
395 blelr-
39600: lwbrx r5,0,r3
397 eieio
398 stwu r5,4(r4)
399 bdnz 00b
400 twi 0,r5,0
401 isync
402 blr
403
404_GLOBAL(_outsl)
405 cmpwi 0,r5,0
406 mtctr r5
407 subi r4,r4,4
408 blelr-
40900: lwzu r5,4(r4)
410 stwbrx r5,0,r3
411 bdnz 00b
412 sync
413 blr
414
415/* _GLOBAL(ide_insw) now in drivers/ide/ide-iops.c */
416_GLOBAL(_insw_ns)
417 cmpwi 0,r5,0
418 mtctr r5
419 subi r4,r4,2
420 blelr-
42100: lhz r5,0(r3)
422 eieio
423 sthu r5,2(r4)
424 bdnz 00b
425 twi 0,r5,0
426 isync
427 blr
428
429/* _GLOBAL(ide_outsw) now in drivers/ide/ide-iops.c */
430_GLOBAL(_outsw_ns)
431 cmpwi 0,r5,0
432 mtctr r5
433 subi r4,r4,2
434 blelr-
43500: lhzu r5,2(r4)
436 sth r5,0(r3)
437 bdnz 00b
438 sync
439 blr
440
441_GLOBAL(_insl_ns)
442 cmpwi 0,r5,0
443 mtctr r5
444 subi r4,r4,4
445 blelr-
44600: lwz r5,0(r3)
447 eieio
448 stwu r5,4(r4)
449 bdnz 00b
450 twi 0,r5,0
451 isync
452 blr
453
454_GLOBAL(_outsl_ns)
455 cmpwi 0,r5,0
456 mtctr r5
457 subi r4,r4,4
458 blelr-
45900: lwzu r5,4(r4)
460 stw r5,0(r3)
461 bdnz 00b
462 sync
463 blr
464 246
465/* 247/*
466 * identify_cpu and calls setup_cpu 248 * identify_cpu and calls setup_cpu
@@ -605,6 +387,7 @@ _GLOBAL(real_writeb)
605 blr 387 blr
606#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */ 388#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
607 389
390#ifdef CONFIG_CPU_FREQ_PMAC64
608/* 391/*
609 * SCOM access functions for 970 (FX only for now) 392 * SCOM access functions for 970 (FX only for now)
610 * 393 *
@@ -673,6 +456,7 @@ _GLOBAL(scom970_write)
673 /* restore interrupts */ 456 /* restore interrupts */
674 mtmsrd r5,1 457 mtmsrd r5,1
675 blr 458 blr
459#endif /* CONFIG_CPU_FREQ_PMAC64 */
676 460
677 461
678/* 462/*
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 9feeeef5a875..3262b73a3a68 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/string.h> 1#include <linux/string.h>
3#include <linux/kernel.h> 2#include <linux/kernel.h>
4#include <linux/init.h> 3#include <linux/init.h>
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index f505a8827e3e..c68741fed14b 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -7,7 +7,6 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9 9
10#include <linux/config.h>
11#include <linux/types.h> 10#include <linux/types.h>
12#include <linux/threads.h> 11#include <linux/threads.h>
13#include <linux/module.h> 12#include <linux/module.h>
@@ -16,7 +15,6 @@
16#include <asm/ptrace.h> 15#include <asm/ptrace.h>
17#include <asm/page.h> 16#include <asm/page.h>
18#include <asm/lppaca.h> 17#include <asm/lppaca.h>
19#include <asm/iseries/it_lp_queue.h>
20#include <asm/iseries/it_lp_reg_save.h> 18#include <asm/iseries/it_lp_reg_save.h>
21#include <asm/paca.h> 19#include <asm/paca.h>
22 20
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index b5431ccf1147..1333335c474e 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -2,7 +2,6 @@
2 * Common pmac/prep/chrp pci routines. -- Cort 2 * Common pmac/prep/chrp pci routines. -- Cort
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/kernel.h> 5#include <linux/kernel.h>
7#include <linux/pci.h> 6#include <linux/pci.h>
8#include <linux/delay.h> 7#include <linux/delay.h>
@@ -99,7 +98,7 @@ pcibios_fixup_resources(struct pci_dev *dev)
99 if (!res->flags) 98 if (!res->flags)
100 continue; 99 continue;
101 if (res->end == 0xffffffff) { 100 if (res->end == 0xffffffff) {
102 DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n", 101 DBG("PCI:%s Resource %d [%016llx-%016llx] is unassigned\n",
103 pci_name(dev), i, res->start, res->end); 102 pci_name(dev), i, res->start, res->end);
104 res->end -= res->start; 103 res->end -= res->start;
105 res->start = 0; 104 res->start = 0;
@@ -117,7 +116,7 @@ pcibios_fixup_resources(struct pci_dev *dev)
117 res->start += offset; 116 res->start += offset;
118 res->end += offset; 117 res->end += offset;
119#ifdef DEBUG 118#ifdef DEBUG
120 printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n", 119 printk("Fixup res %d (%lx) of dev %s: %llx -> %llx\n",
121 i, res->flags, pci_name(dev), 120 i, res->flags, pci_name(dev),
122 res->start - offset, res->start); 121 res->start - offset, res->start);
123#endif 122#endif
@@ -173,18 +172,18 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
173 * but we want to try to avoid allocating at 0x2900-0x2bff 172 * but we want to try to avoid allocating at 0x2900-0x2bff
174 * which might have be mirrored at 0x0100-0x03ff.. 173 * which might have be mirrored at 0x0100-0x03ff..
175 */ 174 */
176void pcibios_align_resource(void *data, struct resource *res, unsigned long size, 175void pcibios_align_resource(void *data, struct resource *res,
177 unsigned long align) 176 resource_size_t size, resource_size_t align)
178{ 177{
179 struct pci_dev *dev = data; 178 struct pci_dev *dev = data;
180 179
181 if (res->flags & IORESOURCE_IO) { 180 if (res->flags & IORESOURCE_IO) {
182 unsigned long start = res->start; 181 resource_size_t start = res->start;
183 182
184 if (size > 0x100) { 183 if (size > 0x100) {
185 printk(KERN_ERR "PCI: I/O Region %s/%d too large" 184 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
186 " (%ld bytes)\n", pci_name(dev), 185 " (%lld bytes)\n", pci_name(dev),
187 dev->resource - res, size); 186 dev->resource - res, (unsigned long long)size);
188 } 187 }
189 188
190 if (start & 0x300) { 189 if (start & 0x300) {
@@ -255,8 +254,8 @@ pcibios_allocate_bus_resources(struct list_head *bus_list)
255 } 254 }
256 } 255 }
257 256
258 DBG("PCI: bridge rsrc %lx..%lx (%lx), parent %p\n", 257 DBG("PCI: bridge rsrc %llx..%llx (%lx), parent %p\n",
259 res->start, res->end, res->flags, pr); 258 res->start, res->end, res->flags, pr);
260 if (pr) { 259 if (pr) {
261 if (request_resource(pr, res) == 0) 260 if (request_resource(pr, res) == 0)
262 continue; 261 continue;
@@ -306,7 +305,7 @@ reparent_resources(struct resource *parent, struct resource *res)
306 *pp = NULL; 305 *pp = NULL;
307 for (p = res->child; p != NULL; p = p->sibling) { 306 for (p = res->child; p != NULL; p = p->sibling) {
308 p->parent = res; 307 p->parent = res;
309 DBG(KERN_INFO "PCI: reparented %s [%lx..%lx] under %s\n", 308 DBG(KERN_INFO "PCI: reparented %s [%llx..%llx] under %s\n",
310 p->name, p->start, p->end, res->name); 309 p->name, p->start, p->end, res->name);
311 } 310 }
312 return 0; 311 return 0;
@@ -362,13 +361,14 @@ pci_relocate_bridge_resource(struct pci_bus *bus, int i)
362 try = conflict->start - 1; 361 try = conflict->start - 1;
363 } 362 }
364 if (request_resource(pr, res)) { 363 if (request_resource(pr, res)) {
365 DBG(KERN_ERR "PCI: huh? couldn't move to %lx..%lx\n", 364 DBG(KERN_ERR "PCI: huh? couldn't move to %llx..%llx\n",
366 res->start, res->end); 365 res->start, res->end);
367 return -1; /* "can't happen" */ 366 return -1; /* "can't happen" */
368 } 367 }
369 update_bridge_base(bus, i); 368 update_bridge_base(bus, i);
370 printk(KERN_INFO "PCI: bridge %d resource %d moved to %lx..%lx\n", 369 printk(KERN_INFO "PCI: bridge %d resource %d moved to %llx..%llx\n",
371 bus->number, i, res->start, res->end); 370 bus->number, i, (unsigned long long)res->start,
371 (unsigned long long)res->end);
372 return 0; 372 return 0;
373} 373}
374 374
@@ -479,14 +479,14 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
479{ 479{
480 struct resource *pr, *r = &dev->resource[idx]; 480 struct resource *pr, *r = &dev->resource[idx];
481 481
482 DBG("PCI:%s: Resource %d: %08lx-%08lx (f=%lx)\n", 482 DBG("PCI:%s: Resource %d: %016llx-%016llx (f=%lx)\n",
483 pci_name(dev), idx, r->start, r->end, r->flags); 483 pci_name(dev), idx, r->start, r->end, r->flags);
484 pr = pci_find_parent_resource(dev, r); 484 pr = pci_find_parent_resource(dev, r);
485 if (!pr || request_resource(pr, r) < 0) { 485 if (!pr || request_resource(pr, r) < 0) {
486 printk(KERN_ERR "PCI: Cannot allocate resource region %d" 486 printk(KERN_ERR "PCI: Cannot allocate resource region %d"
487 " of device %s\n", idx, pci_name(dev)); 487 " of device %s\n", idx, pci_name(dev));
488 if (pr) 488 if (pr)
489 DBG("PCI: parent is %p: %08lx-%08lx (f=%lx)\n", 489 DBG("PCI: parent is %p: %016llx-%016llx (f=%lx)\n",
490 pr, pr->start, pr->end, pr->flags); 490 pr, pr->start, pr->end, pr->flags);
491 /* We'll assign a new address later */ 491 /* We'll assign a new address later */
492 r->flags |= IORESOURCE_UNSET; 492 r->flags |= IORESOURCE_UNSET;
@@ -956,7 +956,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
956 res = &hose->io_resource; 956 res = &hose->io_resource;
957 res->flags = IORESOURCE_IO; 957 res->flags = IORESOURCE_IO;
958 res->start = ranges[2]; 958 res->start = ranges[2];
959 DBG("PCI: IO 0x%lx -> 0x%lx\n", 959 DBG("PCI: IO 0x%llx -> 0x%llx\n",
960 res->start, res->start + size - 1); 960 res->start, res->start + size - 1);
961 break; 961 break;
962 case 2: /* memory space */ 962 case 2: /* memory space */
@@ -978,7 +978,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
978 if(ranges[0] & 0x40000000) 978 if(ranges[0] & 0x40000000)
979 res->flags |= IORESOURCE_PREFETCH; 979 res->flags |= IORESOURCE_PREFETCH;
980 res->start = ranges[na+2]; 980 res->start = ranges[na+2];
981 DBG("PCI: MEM[%d] 0x%lx -> 0x%lx\n", memno, 981 DBG("PCI: MEM[%d] 0x%llx -> 0x%llx\n", memno,
982 res->start, res->start + size - 1); 982 res->start, res->start + size - 1);
983 } 983 }
984 break; 984 break;
@@ -1074,7 +1074,7 @@ do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
1074 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge)); 1074 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge));
1075 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base); 1075 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base);
1076 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base); 1076 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base);
1077 DBG(" IO window: %08lx-%08lx\n", res.start, res.end); 1077 DBG(" IO window: %016llx-%016llx\n", res.start, res.end);
1078 1078
1079 /* Set up the top and bottom of the PCI I/O segment for this bus. */ 1079 /* Set up the top and bottom of the PCI I/O segment for this bus. */
1080 pci_read_config_dword(bridge, PCI_IO_BASE, &l); 1080 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
@@ -1223,8 +1223,8 @@ do_fixup_p2p_level(struct pci_bus *bus)
1223 continue; 1223 continue;
1224 if ((r->flags & IORESOURCE_IO) == 0) 1224 if ((r->flags & IORESOURCE_IO) == 0)
1225 continue; 1225 continue;
1226 DBG("Trying to allocate from %08lx, size %08lx from parent" 1226 DBG("Trying to allocate from %016llx, size %016llx from parent"
1227 " res %d: %08lx -> %08lx\n", 1227 " res %d: %016llx -> %016llx\n",
1228 res->start, res->end, i, r->start, r->end); 1228 res->start, res->end, i, r->start, r->end);
1229 1229
1230 if (allocate_resource(r, res, res->end + 1, res->start, max, 1230 if (allocate_resource(r, res, res->end + 1, res->start, max,
@@ -1574,8 +1574,8 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
1574 else 1574 else
1575 prot |= _PAGE_GUARDED; 1575 prot |= _PAGE_GUARDED;
1576 1576
1577 printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, 1577 printk("PCI map for %s:%llx, prot: %lx\n", pci_name(dev),
1578 prot); 1578 (unsigned long long)rp->start, prot);
1579 1579
1580 return __pgprot(prot); 1580 return __pgprot(prot);
1581} 1581}
@@ -1755,7 +1755,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
1755 1755
1756void pci_resource_to_user(const struct pci_dev *dev, int bar, 1756void pci_resource_to_user(const struct pci_dev *dev, int bar,
1757 const struct resource *rsrc, 1757 const struct resource *rsrc,
1758 u64 *start, u64 *end) 1758 resource_size_t *start, resource_size_t *end)
1759{ 1759{
1760 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); 1760 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
1761 unsigned long offset = 0; 1761 unsigned long offset = 0;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 247937dd8b73..bea8451fb57b 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -13,7 +13,6 @@
13 13
14#undef DEBUG 14#undef DEBUG
15 15
16#include <linux/config.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/pci.h> 17#include <linux/pci.h>
19#include <linux/string.h> 18#include <linux/string.h>
@@ -138,11 +137,11 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
138 * which might have be mirrored at 0x0100-0x03ff.. 137 * which might have be mirrored at 0x0100-0x03ff..
139 */ 138 */
140void pcibios_align_resource(void *data, struct resource *res, 139void pcibios_align_resource(void *data, struct resource *res,
141 unsigned long size, unsigned long align) 140 resource_size_t size, resource_size_t align)
142{ 141{
143 struct pci_dev *dev = data; 142 struct pci_dev *dev = data;
144 struct pci_controller *hose = pci_bus_to_host(dev->bus); 143 struct pci_controller *hose = pci_bus_to_host(dev->bus);
145 unsigned long start = res->start; 144 resource_size_t start = res->start;
146 unsigned long alignto; 145 unsigned long alignto;
147 146
148 if (res->flags & IORESOURCE_IO) { 147 if (res->flags & IORESOURCE_IO) {
diff --git a/arch/powerpc/kernel/perfmon_fsl_booke.c b/arch/powerpc/kernel/perfmon_fsl_booke.c
index 32455dfcc36b..bdc3977a7b06 100644
--- a/arch/powerpc/kernel/perfmon_fsl_booke.c
+++ b/arch/powerpc/kernel/perfmon_fsl_booke.c
@@ -21,7 +21,6 @@
21#include <linux/user.h> 21#include <linux/user.h>
22#include <linux/a.out.h> 22#include <linux/a.out.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/config.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/module.h> 25#include <linux/module.h>
27#include <linux/prctl.h> 26#include <linux/prctl.h>
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c
index e6fb194fe537..a0a2efadeabf 100644
--- a/arch/powerpc/kernel/pmc.c
+++ b/arch/powerpc/kernel/pmc.c
@@ -12,7 +12,6 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/module.h> 17#include <linux/module.h>
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 4b052ae5dc34..e3b80f71748e 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/module.h> 1#include <linux/module.h>
3#include <linux/threads.h> 2#include <linux/threads.h>
4#include <linux/smp.h> 3#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c
index 2ab8f2be911e..f598cb519539 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_ppc64.c
@@ -16,7 +16,6 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/config.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e4732459c485..a127a1e3c097 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 483455c5bb02..4c524cb52184 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -16,7 +16,6 @@
16#undef DEBUG 16#undef DEBUG
17 17
18#include <stdarg.h> 18#include <stdarg.h>
19#include <linux/config.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/init.h> 21#include <linux/init.h>
@@ -30,6 +29,7 @@
30#include <linux/bitops.h> 29#include <linux/bitops.h>
31#include <linux/module.h> 30#include <linux/module.h>
32#include <linux/kexec.h> 31#include <linux/kexec.h>
32#include <linux/debugfs.h>
33 33
34#include <asm/prom.h> 34#include <asm/prom.h>
35#include <asm/rtas.h> 35#include <asm/rtas.h>
@@ -952,6 +952,7 @@ static struct ibm_pa_feature {
952 /* put this back once we know how to test if firmware does 64k IO */ 952 /* put this back once we know how to test if firmware does 64k IO */
953 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, 953 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0},
954#endif 954#endif
955 {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
955}; 956};
956 957
957static void __init check_cpu_pa_features(unsigned long node) 958static void __init check_cpu_pa_features(unsigned long node)
@@ -1124,24 +1125,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1124 tce_alloc_end = *lprop; 1125 tce_alloc_end = *lprop;
1125#endif 1126#endif
1126 1127
1127#ifdef CONFIG_PPC_RTAS
1128 /* To help early debugging via the front panel, we retrieve a minimal
1129 * set of RTAS infos now if available
1130 */
1131 {
1132 u64 *basep, *entryp, *sizep;
1133
1134 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL);
1135 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
1136 sizep = of_get_flat_dt_prop(node, "linux,rtas-size", NULL);
1137 if (basep && entryp && sizep) {
1138 rtas.base = *basep;
1139 rtas.entry = *entryp;
1140 rtas.size = *sizep;
1141 }
1142 }
1143#endif /* CONFIG_PPC_RTAS */
1144
1145#ifdef CONFIG_KEXEC 1128#ifdef CONFIG_KEXEC
1146 lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL); 1129 lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL);
1147 if (lprop) 1130 if (lprop)
@@ -1326,6 +1309,11 @@ void __init early_init_devtree(void *params)
1326 /* Setup flat device-tree pointer */ 1309 /* Setup flat device-tree pointer */
1327 initial_boot_params = params; 1310 initial_boot_params = params;
1328 1311
1312#ifdef CONFIG_PPC_RTAS
1313 /* Some machines might need RTAS info for debugging, grab it now. */
1314 of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
1315#endif
1316
1329 /* Retrieve various informations from the /chosen node of the 1317 /* Retrieve various informations from the /chosen node of the
1330 * device-tree, including the platform type, initrd location and 1318 * device-tree, including the platform type, initrd location and
1331 * size, TCE reserve, and more ... 1319 * size, TCE reserve, and more ...
@@ -2148,3 +2136,27 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
2148 } 2136 }
2149 return NULL; 2137 return NULL;
2150} 2138}
2139
2140#ifdef DEBUG
2141static struct debugfs_blob_wrapper flat_dt_blob;
2142
2143static int __init export_flat_device_tree(void)
2144{
2145 struct dentry *d;
2146
2147 d = debugfs_create_dir("powerpc", NULL);
2148 if (!d)
2149 return 1;
2150
2151 flat_dt_blob.data = initial_boot_params;
2152 flat_dt_blob.size = initial_boot_params->totalsize;
2153
2154 d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
2155 d, &flat_dt_blob);
2156 if (!d)
2157 return 1;
2158
2159 return 0;
2160}
2161__initcall(export_flat_device_tree);
2162#endif
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 8c28eb0cbdac..1e95a9f8cda1 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -16,7 +16,6 @@
16#undef DEBUG_PROM 16#undef DEBUG_PROM
17 17
18#include <stdarg.h> 18#include <stdarg.h>
19#include <linux/config.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/init.h> 21#include <linux/init.h>
@@ -988,7 +987,7 @@ static void reserve_mem(u64 base, u64 size)
988} 987}
989 988
990/* 989/*
991 * Initialize memory allocation mecanism, parse "memory" nodes and 990 * Initialize memory allocation mechanism, parse "memory" nodes and
992 * obtain that way the top of memory and RMO to setup out local allocator 991 * obtain that way the top of memory and RMO to setup out local allocator
993 */ 992 */
994static void __init prom_init_mem(void) 993static void __init prom_init_mem(void)
diff --git a/arch/powerpc/kernel/ptrace-common.h b/arch/powerpc/kernel/ptrace-common.h
index c42a860c8d25..8797ae737a7b 100644
--- a/arch/powerpc/kernel/ptrace-common.h
+++ b/arch/powerpc/kernel/ptrace-common.h
@@ -10,7 +10,6 @@
10#ifndef _PPC64_PTRACE_COMMON_H 10#ifndef _PPC64_PTRACE_COMMON_H
11#define _PPC64_PTRACE_COMMON_H 11#define _PPC64_PTRACE_COMMON_H
12 12
13#include <linux/config.h>
14#include <asm/system.h> 13#include <asm/system.h>
15 14
16/* 15/*
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 5563e2e7d89c..dea75d73f983 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -15,7 +15,6 @@
15 * this archive for more details. 15 * this archive for more details.
16 */ 16 */
17 17
18#include <linux/config.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/sched.h> 19#include <linux/sched.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 826ee3d056de..9b9a230349bc 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -17,7 +17,6 @@
17 * this archive for more details. 17 * this archive for more details.
18 */ 18 */
19 19
20#include <linux/config.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/sched.h> 21#include <linux/sched.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 17dc79198515..4a4cb5598402 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -38,16 +38,19 @@
38struct rtas_t rtas = { 38struct rtas_t rtas = {
39 .lock = SPIN_LOCK_UNLOCKED 39 .lock = SPIN_LOCK_UNLOCKED
40}; 40};
41EXPORT_SYMBOL(rtas);
41 42
42struct rtas_suspend_me_data { 43struct rtas_suspend_me_data {
43 long waiting; 44 long waiting;
44 struct rtas_args *args; 45 struct rtas_args *args;
45}; 46};
46 47
47EXPORT_SYMBOL(rtas);
48
49DEFINE_SPINLOCK(rtas_data_buf_lock); 48DEFINE_SPINLOCK(rtas_data_buf_lock);
49EXPORT_SYMBOL(rtas_data_buf_lock);
50
50char rtas_data_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned; 51char rtas_data_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned;
52EXPORT_SYMBOL(rtas_data_buf);
53
51unsigned long rtas_rmo_buf; 54unsigned long rtas_rmo_buf;
52 55
53/* 56/*
@@ -106,11 +109,71 @@ static void call_rtas_display_status_delay(char c)
106 } 109 }
107} 110}
108 111
109void __init udbg_init_rtas(void) 112void __init udbg_init_rtas_panel(void)
110{ 113{
111 udbg_putc = call_rtas_display_status_delay; 114 udbg_putc = call_rtas_display_status_delay;
112} 115}
113 116
117#ifdef CONFIG_UDBG_RTAS_CONSOLE
118
119/* If you think you're dying before early_init_dt_scan_rtas() does its
120 * work, you can hard code the token values for your firmware here and
121 * hardcode rtas.base/entry etc.
122 */
123static unsigned int rtas_putchar_token = RTAS_UNKNOWN_SERVICE;
124static unsigned int rtas_getchar_token = RTAS_UNKNOWN_SERVICE;
125
126static void udbg_rtascon_putc(char c)
127{
128 int tries;
129
130 if (!rtas.base)
131 return;
132
133 /* Add CRs before LFs */
134 if (c == '\n')
135 udbg_rtascon_putc('\r');
136
137 /* if there is more than one character to be displayed, wait a bit */
138 for (tries = 0; tries < 16; tries++) {
139 if (rtas_call(rtas_putchar_token, 1, 1, NULL, c) == 0)
140 break;
141 udelay(1000);
142 }
143}
144
145static int udbg_rtascon_getc_poll(void)
146{
147 int c;
148
149 if (!rtas.base)
150 return -1;
151
152 if (rtas_call(rtas_getchar_token, 0, 2, &c))
153 return -1;
154
155 return c;
156}
157
158static int udbg_rtascon_getc(void)
159{
160 int c;
161
162 while ((c = udbg_rtascon_getc_poll()) == -1)
163 ;
164
165 return c;
166}
167
168
169void __init udbg_init_rtas_console(void)
170{
171 udbg_putc = udbg_rtascon_putc;
172 udbg_getc = udbg_rtascon_getc;
173 udbg_getc_poll = udbg_rtascon_getc_poll;
174}
175#endif /* CONFIG_UDBG_RTAS_CONSOLE */
176
114void rtas_progress(char *s, unsigned short hex) 177void rtas_progress(char *s, unsigned short hex)
115{ 178{
116 struct device_node *root; 179 struct device_node *root;
@@ -236,6 +299,7 @@ int rtas_token(const char *service)
236 tokp = (int *) get_property(rtas.dev, service, NULL); 299 tokp = (int *) get_property(rtas.dev, service, NULL);
237 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; 300 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
238} 301}
302EXPORT_SYMBOL(rtas_token);
239 303
240#ifdef CONFIG_RTAS_ERROR_LOGGING 304#ifdef CONFIG_RTAS_ERROR_LOGGING
241/* 305/*
@@ -328,7 +392,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
328 char *buff_copy = NULL; 392 char *buff_copy = NULL;
329 int ret; 393 int ret;
330 394
331 if (token == RTAS_UNKNOWN_SERVICE) 395 if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
332 return -1; 396 return -1;
333 397
334 /* Gotta do something different here, use global lock for now... */ 398 /* Gotta do something different here, use global lock for now... */
@@ -369,6 +433,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
369 } 433 }
370 return ret; 434 return ret;
371} 435}
436EXPORT_SYMBOL(rtas_call);
372 437
373/* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status 438/* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status
374 * code of 990n, perform the hinted delay of 10^n (last digit) milliseconds. 439 * code of 990n, perform the hinted delay of 10^n (last digit) milliseconds.
@@ -388,6 +453,7 @@ unsigned int rtas_busy_delay_time(int status)
388 453
389 return ms; 454 return ms;
390} 455}
456EXPORT_SYMBOL(rtas_busy_delay_time);
391 457
392/* For an RTAS busy status code, perform the hinted delay. */ 458/* For an RTAS busy status code, perform the hinted delay. */
393unsigned int rtas_busy_delay(int status) 459unsigned int rtas_busy_delay(int status)
@@ -401,6 +467,7 @@ unsigned int rtas_busy_delay(int status)
401 467
402 return ms; 468 return ms;
403} 469}
470EXPORT_SYMBOL(rtas_busy_delay);
404 471
405int rtas_error_rc(int rtas_rc) 472int rtas_error_rc(int rtas_rc)
406{ 473{
@@ -446,6 +513,7 @@ int rtas_get_power_level(int powerdomain, int *level)
446 return rtas_error_rc(rc); 513 return rtas_error_rc(rc);
447 return rc; 514 return rc;
448} 515}
516EXPORT_SYMBOL(rtas_get_power_level);
449 517
450int rtas_set_power_level(int powerdomain, int level, int *setlevel) 518int rtas_set_power_level(int powerdomain, int level, int *setlevel)
451{ 519{
@@ -463,6 +531,7 @@ int rtas_set_power_level(int powerdomain, int level, int *setlevel)
463 return rtas_error_rc(rc); 531 return rtas_error_rc(rc);
464 return rc; 532 return rc;
465} 533}
534EXPORT_SYMBOL(rtas_set_power_level);
466 535
467int rtas_get_sensor(int sensor, int index, int *state) 536int rtas_get_sensor(int sensor, int index, int *state)
468{ 537{
@@ -480,6 +549,7 @@ int rtas_get_sensor(int sensor, int index, int *state)
480 return rtas_error_rc(rc); 549 return rtas_error_rc(rc);
481 return rc; 550 return rc;
482} 551}
552EXPORT_SYMBOL(rtas_get_sensor);
483 553
484int rtas_set_indicator(int indicator, int index, int new_value) 554int rtas_set_indicator(int indicator, int index, int new_value)
485{ 555{
@@ -497,6 +567,7 @@ int rtas_set_indicator(int indicator, int index, int new_value)
497 return rtas_error_rc(rc); 567 return rtas_error_rc(rc);
498 return rc; 568 return rc;
499} 569}
570EXPORT_SYMBOL(rtas_set_indicator);
500 571
501void rtas_restart(char *cmd) 572void rtas_restart(char *cmd)
502{ 573{
@@ -791,14 +862,34 @@ void __init rtas_initialize(void)
791#endif 862#endif
792} 863}
793 864
865int __init early_init_dt_scan_rtas(unsigned long node,
866 const char *uname, int depth, void *data)
867{
868 u32 *basep, *entryp, *sizep;
794 869
795EXPORT_SYMBOL(rtas_token); 870 if (depth != 1 || strcmp(uname, "rtas") != 0)
796EXPORT_SYMBOL(rtas_call); 871 return 0;
797EXPORT_SYMBOL(rtas_data_buf); 872
798EXPORT_SYMBOL(rtas_data_buf_lock); 873 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL);
799EXPORT_SYMBOL(rtas_busy_delay_time); 874 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
800EXPORT_SYMBOL(rtas_busy_delay); 875 sizep = of_get_flat_dt_prop(node, "rtas-size", NULL);
801EXPORT_SYMBOL(rtas_get_sensor); 876
802EXPORT_SYMBOL(rtas_get_power_level); 877 if (basep && entryp && sizep) {
803EXPORT_SYMBOL(rtas_set_power_level); 878 rtas.base = *basep;
804EXPORT_SYMBOL(rtas_set_indicator); 879 rtas.entry = *entryp;
880 rtas.size = *sizep;
881 }
882
883#ifdef CONFIG_UDBG_RTAS_CONSOLE
884 basep = of_get_flat_dt_prop(node, "put-term-char", NULL);
885 if (basep)
886 rtas_putchar_token = *basep;
887
888 basep = of_get_flat_dt_prop(node, "get-term-char", NULL);
889 if (basep)
890 rtas_getchar_token = *basep;
891#endif
892
893 /* break now */
894 return 1;
895}
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index bd328123af75..c6d7b98af7d5 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -12,7 +12,6 @@
12 12
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/config.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 0932a62a1c96..ba7cd50d820d 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -2,7 +2,6 @@
2 * Common prep/pmac/chrp boot and setup code. 2 * Common prep/pmac/chrp boot and setup code.
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/module.h> 5#include <linux/module.h>
7#include <linux/string.h> 6#include <linux/string.h>
8#include <linux/sched.h> 7#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 78f3a5fd43f6..ac7276c40685 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -12,7 +12,6 @@
12 12
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/config.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
@@ -149,6 +148,13 @@ early_param("smt-enabled", early_smt_enabled);
149#define check_smt_enabled() 148#define check_smt_enabled()
150#endif /* CONFIG_SMP */ 149#endif /* CONFIG_SMP */
151 150
151/* Put the paca pointer into r13 and SPRG3 */
152void __init setup_paca(int cpu)
153{
154 local_paca = &paca[cpu];
155 mtspr(SPRN_SPRG3, local_paca);
156}
157
152/* 158/*
153 * Early initialization entry point. This is called by head.S 159 * Early initialization entry point. This is called by head.S
154 * with MMU translation disabled. We rely on the "feature" of 160 * with MMU translation disabled. We rely on the "feature" of
@@ -170,6 +176,9 @@ early_param("smt-enabled", early_smt_enabled);
170 176
171void __init early_setup(unsigned long dt_ptr) 177void __init early_setup(unsigned long dt_ptr)
172{ 178{
179 /* Assume we're on cpu 0 for now. Don't write to the paca yet! */
180 setup_paca(0);
181
173 /* Enable early debugging if any specified (see udbg.h) */ 182 /* Enable early debugging if any specified (see udbg.h) */
174 udbg_early_init(); 183 udbg_early_init();
175 184
@@ -183,7 +192,7 @@ void __init early_setup(unsigned long dt_ptr)
183 early_init_devtree(__va(dt_ptr)); 192 early_init_devtree(__va(dt_ptr));
184 193
185 /* Now we know the logical id of our boot cpu, setup the paca. */ 194 /* Now we know the logical id of our boot cpu, setup the paca. */
186 setup_boot_paca(); 195 setup_paca(boot_cpuid);
187 196
188 /* Fix up paca fields required for the boot cpu */ 197 /* Fix up paca fields required for the boot cpu */
189 get_paca()->cpu_start = 1; 198 get_paca()->cpu_start = 1;
@@ -350,19 +359,11 @@ void __init setup_system(void)
350 */ 359 */
351 unflatten_device_tree(); 360 unflatten_device_tree();
352 361
353#ifdef CONFIG_KEXEC
354 kexec_setup(); /* requires unflattened device tree. */
355#endif
356
357 /* 362 /*
358 * Fill the ppc64_caches & systemcfg structures with informations 363 * Fill the ppc64_caches & systemcfg structures with informations
359 * retrieved from the device-tree. Need to be called before 364 * retrieved from the device-tree. Need to be called before
360 * finish_device_tree() since the later requires some of the 365 * finish_device_tree() since the later requires some of the
361 * informations filled up here to properly parse the interrupt 366 * informations filled up here to properly parse the interrupt tree.
362 * tree.
363 * It also sets up the cache line sizes which allows to call
364 * routines like flush_icache_range (used by the hash init
365 * later on).
366 */ 367 */
367 initialize_cache_info(); 368 initialize_cache_info();
368 369
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index d73b25e22fca..320353f0926f 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -17,7 +17,6 @@
17 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
18 */ 18 */
19 19
20#include <linux/config.h>
21#include <linux/sched.h> 20#include <linux/sched.h>
22#include <linux/mm.h> 21#include <linux/mm.h>
23#include <linux/smp.h> 22#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 6e75d7ab6d4d..f72e8e823d78 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -12,7 +12,6 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/sched.h> 15#include <linux/sched.h>
17#include <linux/mm.h> 16#include <linux/mm.h>
18#include <linux/smp.h> 17#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/smp-tbsync.c b/arch/powerpc/kernel/smp-tbsync.c
index 9adef3bddad4..f19e2e0e61e7 100644
--- a/arch/powerpc/kernel/smp-tbsync.c
+++ b/arch/powerpc/kernel/smp-tbsync.c
@@ -5,7 +5,6 @@
5 * 5 *
6 */ 6 */
7 7
8#include <linux/config.h>
9#include <linux/kernel.h> 8#include <linux/kernel.h>
10#include <linux/sched.h> 9#include <linux/sched.h>
11#include <linux/smp.h> 10#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c5d179d4f818..46c56cfd1b2f 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -17,7 +17,6 @@
17 17
18#undef DEBUG 18#undef DEBUG
19 19
20#include <linux/config.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/sched.h> 22#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/swsusp_32.S b/arch/powerpc/kernel/swsusp_32.S
index 69773cc1a85f..7369f9a6ad25 100644
--- a/arch/powerpc/kernel/swsusp_32.S
+++ b/arch/powerpc/kernel/swsusp_32.S
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/threads.h> 1#include <linux/threads.h>
3#include <asm/processor.h> 2#include <asm/processor.h>
4#include <asm/page.h> 3#include <asm/page.h>
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index ec274e688816..2e292863e982 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/fs.h> 19#include <linux/fs.h>
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 4662b580efa1..010435095550 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/sysdev.h> 1#include <linux/sysdev.h>
3#include <linux/cpu.h> 2#include <linux/cpu.h>
4#include <linux/smp.h> 3#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index ee75ccf1a802..579de70e0b4d 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <asm/ppc_asm.h> 17#include <asm/ppc_asm.h>
19 18
20#ifdef CONFIG_PPC64 19#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c
index 26bd8ea35a4e..368a4934f7ee 100644
--- a/arch/powerpc/kernel/tau_6xx.c
+++ b/arch/powerpc/kernel/tau_6xx.c
@@ -11,7 +11,6 @@
11 * life in portables, and add a 'performance/watt' metric somewhere in /proc 11 * life in portables, and add a 'performance/watt' metric somewhere in /proc
12 */ 12 */
13 13
14#include <linux/config.h>
15#include <linux/errno.h> 14#include <linux/errno.h>
16#include <linux/jiffies.h> 15#include <linux/jiffies.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 7dd5dab789a1..774c0a3c5019 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -32,7 +32,6 @@
32 * 2 of the License, or (at your option) any later version. 32 * 2 of the License, or (at your option) any later version.
33 */ 33 */
34 34
35#include <linux/config.h>
36#include <linux/errno.h> 35#include <linux/errno.h>
37#include <linux/module.h> 36#include <linux/module.h>
38#include <linux/sched.h> 37#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 52f5659534f4..3c668078e524 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -14,7 +14,6 @@
14 * This file handles the architecture-dependent parts of hardware exceptions 14 * This file handles the architecture-dependent parts of hardware exceptions
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -52,9 +51,13 @@
52#include <asm/firmware.h> 51#include <asm/firmware.h>
53#include <asm/processor.h> 52#include <asm/processor.h>
54#endif 53#endif
54#include <asm/kexec.h>
55 55
56#ifdef CONFIG_PPC64 /* XXX */ 56#ifdef CONFIG_PPC64 /* XXX */
57#define _IO_BASE pci_io_base 57#define _IO_BASE pci_io_base
58#ifdef CONFIG_KEXEC
59cpumask_t cpus_in_sr = CPU_MASK_NONE;
60#endif
58#endif 61#endif
59 62
60#ifdef CONFIG_DEBUGGER 63#ifdef CONFIG_DEBUGGER
@@ -97,7 +100,7 @@ static DEFINE_SPINLOCK(die_lock);
97 100
98int die(const char *str, struct pt_regs *regs, long err) 101int die(const char *str, struct pt_regs *regs, long err)
99{ 102{
100 static int die_counter, crash_dump_start = 0; 103 static int die_counter;
101 104
102 if (debugger(regs)) 105 if (debugger(regs))
103 return 1; 106 return 1;
@@ -137,21 +140,12 @@ int die(const char *str, struct pt_regs *regs, long err)
137 print_modules(); 140 print_modules();
138 show_regs(regs); 141 show_regs(regs);
139 bust_spinlocks(0); 142 bust_spinlocks(0);
143 spin_unlock_irq(&die_lock);
140 144
141 if (!crash_dump_start && kexec_should_crash(current)) { 145 if (kexec_should_crash(current) ||
142 crash_dump_start = 1; 146 kexec_sr_activated(smp_processor_id()))
143 spin_unlock_irq(&die_lock);
144 crash_kexec(regs); 147 crash_kexec(regs);
145 /* NOTREACHED */ 148 crash_kexec_secondary(regs);
146 }
147 spin_unlock_irq(&die_lock);
148 if (crash_dump_start)
149 /*
150 * Only for soft-reset: Other CPUs will be responded to an IPI
151 * sent by first kexec CPU.
152 */
153 for(;;)
154 ;
155 149
156 if (in_interrupt()) 150 if (in_interrupt())
157 panic("Fatal exception in interrupt"); 151 panic("Fatal exception in interrupt");
@@ -215,6 +209,10 @@ void system_reset_exception(struct pt_regs *regs)
215 return; 209 return;
216 } 210 }
217 211
212#ifdef CONFIG_KEXEC
213 cpu_set(smp_processor_id(), cpus_in_sr);
214#endif
215
218 die("System Reset", regs, SIGABRT); 216 die("System Reset", regs, SIGABRT);
219 217
220 /* Must die if the interrupt is not recoverable */ 218 /* Must die if the interrupt is not recoverable */
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 67d9fd9ae2b5..5730906b23d5 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <stdarg.h> 12#include <stdarg.h>
13#include <linux/config.h>
14#include <linux/types.h> 13#include <linux/types.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/console.h> 15#include <linux/console.h>
@@ -34,9 +33,12 @@ void __init udbg_early_init(void)
34#elif defined(CONFIG_PPC_EARLY_DEBUG_G5) 33#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
35 /* For use on Apple G5 machines */ 34 /* For use on Apple G5 machines */
36 udbg_init_pmac_realmode(); 35 udbg_init_pmac_realmode();
37#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS) 36#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL)
38 /* RTAS panel debug */ 37 /* RTAS panel debug */
39 udbg_init_rtas(); 38 udbg_init_rtas_panel();
39#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE)
40 /* RTAS console debug */
41 udbg_init_rtas_console();
40#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) 42#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
41 /* Maple real mode debug */ 43 /* Maple real mode debug */
42 udbg_init_maple_realmode(); 44 udbg_init_maple_realmode();
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 5d29dcca523c..0835b4841dea 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -8,7 +8,6 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h>
12#include <linux/types.h> 11#include <linux/types.h>
13#include <asm/udbg.h> 12#include <asm/udbg.h>
14#include <asm/io.h> 13#include <asm/io.h>
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index bc3e15be3087..1a7e19cdab39 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -8,7 +8,6 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#include <linux/config.h>
12#include <linux/module.h> 11#include <linux/module.h>
13#include <linux/errno.h> 12#include <linux/errno.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S
index 09629aea3e47..9cb319992c38 100644
--- a/arch/powerpc/kernel/vdso32/cacheflush.S
+++ b/arch/powerpc/kernel/vdso32/cacheflush.S
@@ -9,7 +9,6 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 14#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S
index 4709f1d9542c..dc21e891d2e7 100644
--- a/arch/powerpc/kernel/vdso32/datapage.S
+++ b/arch/powerpc/kernel/vdso32/datapage.S
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 7eebff03a041..05909f754307 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -10,7 +10,6 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
16#include <asm/vdso.h> 15#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso32/sigtramp.S b/arch/powerpc/kernel/vdso32/sigtramp.S
index 0c6a37b29dde..68d49dd71dcc 100644
--- a/arch/powerpc/kernel/vdso32/sigtramp.S
+++ b/arch/powerpc/kernel/vdso32/sigtramp.S
@@ -10,7 +10,6 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
16#include <asm/unistd.h> 15#include <asm/unistd.h>
diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S
index cb4ae0a5edd0..66a36d3cc6ad 100644
--- a/arch/powerpc/kernel/vdso64/cacheflush.S
+++ b/arch/powerpc/kernel/vdso64/cacheflush.S
@@ -9,7 +9,6 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 14#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S
index 3b2dd7d0c1eb..79796de11737 100644
--- a/arch/powerpc/kernel/vdso64/datapage.S
+++ b/arch/powerpc/kernel/vdso64/datapage.S
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index 4ee871f1cadb..56e76ff5498f 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -11,7 +11,6 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14#include <linux/config.h>
15#include <asm/processor.h> 14#include <asm/processor.h>
16#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
17#include <asm/vdso.h> 16#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso64/sigtramp.S b/arch/powerpc/kernel/vdso64/sigtramp.S
index 7479edb101b8..17a83fa6dc52 100644
--- a/arch/powerpc/kernel/vdso64/sigtramp.S
+++ b/arch/powerpc/kernel/vdso64/sigtramp.S
@@ -10,7 +10,6 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
16#include <asm/unistd.h> 15#include <asm/unistd.h>
diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
index 9416b4ab92ec..49ac3d6e1399 100644
--- a/arch/powerpc/kernel/vector.S
+++ b/arch/powerpc/kernel/vector.S
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <asm/ppc_asm.h> 1#include <asm/ppc_asm.h>
3#include <asm/reg.h> 2#include <asm/reg.h>
4 3
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 8b25953dc4f0..02665a02130d 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#ifdef CONFIG_PPC64 1#ifdef CONFIG_PPC64
3#include <asm/page.h> 2#include <asm/page.h>
4#define PROVIDE32(x) PROVIDE(__unused__##x) 3#define PROVIDE32(x) PROVIDE(__unused__##x)