aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-12 13:21:22 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-12 13:21:22 -0500
commit45bfe98bd790b5ded00462cd582effcfb42263cc (patch)
treed4a1f2c5303dda106635b615f8f40ea9104bf25e
parent9f5974c8734d83d4ab7096ed98136a82f41210d6 (diff)
parent624cee31bcb14bfd85559fbec5dd7bb833542965 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
Fix up delete/modify conflict of arch/ppc/kernel/process.c by hand (it's gone, gone, gone). Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/powerpc/kernel/Makefile6
-rw-r--r--arch/powerpc/kernel/pci_64.c5
-rw-r--r--arch/powerpc/kernel/process.c8
-rw-r--r--arch/powerpc/kernel/prom.c28
-rw-r--r--arch/powerpc/kernel/prom_init.c8
-rw-r--r--arch/powerpc/kernel/signal_32.c21
-rw-r--r--arch/powerpc/kernel/signal_64.c20
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c2
-rw-r--r--arch/powerpc/platforms/cell/setup.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c4
-rw-r--r--arch/powerpc/platforms/iseries/Makefile4
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/iseries/iommu.h35
-rw-r--r--arch/powerpc/platforms/iseries/irq.c19
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c5
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c12
-rw-r--r--arch/powerpc/platforms/iseries/mf.c16
-rw-r--r--arch/powerpc/platforms/iseries/pci.c1
-rw-r--r--arch/powerpc/platforms/iseries/vio.c2
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c12
-rw-r--r--arch/powerpc/platforms/powermac/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c5
-rw-r--r--arch/powerpc/platforms/pseries/hvcserver.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c4
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/smp.c4
-rw-r--r--arch/powerpc/platforms/pseries/xics.c2
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c1
-rw-r--r--arch/powerpc/xmon/xmon.c14
-rw-r--r--arch/ppc/kernel/Makefile1
-rw-r--r--arch/ppc/kernel/process.c851
-rw-r--r--drivers/block/viodasd.c32
-rw-r--r--drivers/cdrom/viocd.c6
-rw-r--r--drivers/char/mem.c8
-rw-r--r--drivers/char/viocons.c31
-rw-r--r--drivers/net/iseries_veth.c4
-rw-r--r--include/asm-powerpc/iommu.h19
-rw-r--r--include/asm-powerpc/iseries/hv_call.h4
-rw-r--r--include/asm-powerpc/iseries/hv_call_event.h134
-rw-r--r--include/asm-powerpc/iseries/hv_call_sc.h1
-rw-r--r--include/asm-powerpc/iseries/hv_lp_config.h1
-rw-r--r--include/asm-powerpc/iseries/hv_lp_event.h42
-rw-r--r--include/asm-powerpc/iseries/hv_types.h1
-rw-r--r--include/asm-powerpc/iseries/iseries_io.h14
-rw-r--r--include/asm-powerpc/iseries/it_exp_vpd_panel.h1
-rw-r--r--include/asm-powerpc/iseries/it_lp_naca.h22
-rw-r--r--include/asm-powerpc/iseries/it_lp_queue.h1
-rw-r--r--include/asm-powerpc/iseries/it_lp_reg_save.h3
-rw-r--r--include/asm-powerpc/iseries/lpar_map.h1
-rw-r--r--include/asm-powerpc/iseries/mf.h1
-rw-r--r--include/asm-powerpc/iseries/vio.h1
-rw-r--r--include/asm-powerpc/pci-bridge.h2
-rw-r--r--include/asm-powerpc/system.h8
-rw-r--r--include/asm-ppc/system.h12
55 files changed, 298 insertions, 1155 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index bbfa1bdceb4d..a94699d8dc52 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -11,7 +11,8 @@ CFLAGS_btext.o += -fPIC
11endif 11endif
12 12
13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ 13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
14 irq.o align.o signal_32.o pmc.o vdso.o 14 irq.o align.o signal_32.o pmc.o vdso.o \
15 init_task.o process.o
15obj-y += vdso32/ 16obj-y += vdso32/
16obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ 17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
17 signal_64.o ptrace32.o systbl.o \ 18 signal_64.o ptrace32.o systbl.o \
@@ -44,8 +45,7 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
44extra-$(CONFIG_8xx) := head_8xx.o 45extra-$(CONFIG_8xx) := head_8xx.o
45extra-y += vmlinux.lds 46extra-y += vmlinux.lds
46 47
47obj-y += process.o init_task.o time.o \ 48obj-y += time.o prom.o traps.o setup-common.o udbg.o
48 prom.o traps.o setup-common.o udbg.o
49obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o 49obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o
50obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o 50obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
51obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o 51obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 24fe70f40b66..c367520bc1c3 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -53,6 +53,7 @@ EXPORT_SYMBOL(io_page_mask);
53#ifdef CONFIG_PPC_MULTIPLATFORM 53#ifdef CONFIG_PPC_MULTIPLATFORM
54static void fixup_resource(struct resource *res, struct pci_dev *dev); 54static void fixup_resource(struct resource *res, struct pci_dev *dev);
55static void do_bus_setup(struct pci_bus *bus); 55static void do_bus_setup(struct pci_bus *bus);
56static void phbs_remap_io(void);
56#endif 57#endif
57 58
58/* pci_io_base -- the base address from which io bars are offsets. 59/* pci_io_base -- the base address from which io bars are offsets.
@@ -251,6 +252,7 @@ void pcibios_free_controller(struct pci_controller *phb)
251 kfree(phb); 252 kfree(phb);
252} 253}
253 254
255#ifndef CONFIG_PPC_ISERIES
254void __devinit pcibios_claim_one_bus(struct pci_bus *b) 256void __devinit pcibios_claim_one_bus(struct pci_bus *b)
255{ 257{
256 struct pci_dev *dev; 258 struct pci_dev *dev;
@@ -275,7 +277,6 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *b)
275EXPORT_SYMBOL_GPL(pcibios_claim_one_bus); 277EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
276#endif 278#endif
277 279
278#ifndef CONFIG_PPC_ISERIES
279static void __init pcibios_claim_of_setup(void) 280static void __init pcibios_claim_of_setup(void)
280{ 281{
281 struct pci_bus *b; 282 struct pci_bus *b;
@@ -1218,7 +1219,7 @@ int remap_bus_range(struct pci_bus *bus)
1218} 1219}
1219EXPORT_SYMBOL(remap_bus_range); 1220EXPORT_SYMBOL(remap_bus_range);
1220 1221
1221void phbs_remap_io(void) 1222static void phbs_remap_io(void)
1222{ 1223{
1223 struct pci_controller *hose, *tmp; 1224 struct pci_controller *hose, *tmp;
1224 1225
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1f816f0d7740..57703994a063 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -201,13 +201,13 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
201} 201}
202#endif /* CONFIG_SPE */ 202#endif /* CONFIG_SPE */
203 203
204#ifndef CONFIG_SMP
204/* 205/*
205 * If we are doing lazy switching of CPU state (FP, altivec or SPE), 206 * If we are doing lazy switching of CPU state (FP, altivec or SPE),
206 * and the current task has some state, discard it. 207 * and the current task has some state, discard it.
207 */ 208 */
208static inline void discard_lazy_cpu_state(void) 209void discard_lazy_cpu_state(void)
209{ 210{
210#ifndef CONFIG_SMP
211 preempt_disable(); 211 preempt_disable();
212 if (last_task_used_math == current) 212 if (last_task_used_math == current)
213 last_task_used_math = NULL; 213 last_task_used_math = NULL;
@@ -220,9 +220,10 @@ static inline void discard_lazy_cpu_state(void)
220 last_task_used_spe = NULL; 220 last_task_used_spe = NULL;
221#endif 221#endif
222 preempt_enable(); 222 preempt_enable();
223#endif /* CONFIG_SMP */
224} 223}
224#endif /* CONFIG_SMP */
225 225
226#ifdef CONFIG_PPC_MERGE /* XXX for now */
226int set_dabr(unsigned long dabr) 227int set_dabr(unsigned long dabr)
227{ 228{
228 if (ppc_md.set_dabr) 229 if (ppc_md.set_dabr)
@@ -231,6 +232,7 @@ int set_dabr(unsigned long dabr)
231 mtspr(SPRN_DABR, dabr); 232 mtspr(SPRN_DABR, dabr);
232 return 0; 233 return 0;
233} 234}
235#endif
234 236
235#ifdef CONFIG_PPC64 237#ifdef CONFIG_PPC64
236DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); 238DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 34ab0daec3a7..02e2115323e4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1100,17 +1100,37 @@ static int __init early_init_dt_scan_memory(unsigned long node,
1100 1100
1101static void __init early_reserve_mem(void) 1101static void __init early_reserve_mem(void)
1102{ 1102{
1103 unsigned long base, size; 1103 u64 base, size;
1104 unsigned long *reserve_map; 1104 u64 *reserve_map;
1105 1105
1106 reserve_map = (unsigned long *)(((unsigned long)initial_boot_params) + 1106 reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
1107 initial_boot_params->off_mem_rsvmap); 1107 initial_boot_params->off_mem_rsvmap);
1108#ifdef CONFIG_PPC32
1109 /*
1110 * Handle the case where we might be booting from an old kexec
1111 * image that setup the mem_rsvmap as pairs of 32-bit values
1112 */
1113 if (*reserve_map > 0xffffffffull) {
1114 u32 base_32, size_32;
1115 u32 *reserve_map_32 = (u32 *)reserve_map;
1116
1117 while (1) {
1118 base_32 = *(reserve_map_32++);
1119 size_32 = *(reserve_map_32++);
1120 if (size_32 == 0)
1121 break;
1122 DBG("reserving: %lx -> %lx\n", base_32, size_32);
1123 lmb_reserve(base_32, size_32);
1124 }
1125 return;
1126 }
1127#endif
1108 while (1) { 1128 while (1) {
1109 base = *(reserve_map++); 1129 base = *(reserve_map++);
1110 size = *(reserve_map++); 1130 size = *(reserve_map++);
1111 if (size == 0) 1131 if (size == 0)
1112 break; 1132 break;
1113 DBG("reserving: %lx -> %lx\n", base, size); 1133 DBG("reserving: %llx -> %llx\n", base, size);
1114 lmb_reserve(base, size); 1134 lmb_reserve(base, size);
1115 } 1135 }
1116 1136
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index e381f2fc121c..d963a12ec640 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -137,8 +137,8 @@ struct prom_t {
137}; 137};
138 138
139struct mem_map_entry { 139struct mem_map_entry {
140 unsigned long base; 140 u64 base;
141 unsigned long size; 141 u64 size;
142}; 142};
143 143
144typedef u32 cell_t; 144typedef u32 cell_t;
@@ -897,9 +897,9 @@ static unsigned long __init prom_next_cell(int s, cell_t **cellp)
897 * If problems seem to show up, it would be a good start to track 897 * If problems seem to show up, it would be a good start to track
898 * them down. 898 * them down.
899 */ 899 */
900static void reserve_mem(unsigned long base, unsigned long size) 900static void reserve_mem(u64 base, u64 size)
901{ 901{
902 unsigned long top = base + size; 902 u64 top = base + size;
903 unsigned long cnt = RELOC(mem_reserve_cnt); 903 unsigned long cnt = RELOC(mem_reserve_cnt);
904 904
905 if (size == 0) 905 if (size == 0)
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index d3f0b6d452fb..177bba78fb0b 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -497,6 +497,15 @@ static long restore_user_regs(struct pt_regs *regs,
497 if (err) 497 if (err)
498 return 1; 498 return 1;
499 499
500 /*
501 * Do this before updating the thread state in
502 * current->thread.fpr/vr/evr. That way, if we get preempted
503 * and another task grabs the FPU/Altivec/SPE, it won't be
504 * tempted to save the current CPU state into the thread_struct
505 * and corrupt what we are writing there.
506 */
507 discard_lazy_cpu_state();
508
500 /* force the process to reload the FP registers from 509 /* force the process to reload the FP registers from
501 current->thread when it next does FP instructions */ 510 current->thread when it next does FP instructions */
502 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1); 511 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1);
@@ -538,18 +547,6 @@ static long restore_user_regs(struct pt_regs *regs,
538 return 1; 547 return 1;
539#endif /* CONFIG_SPE */ 548#endif /* CONFIG_SPE */
540 549
541#ifndef CONFIG_SMP
542 preempt_disable();
543 if (last_task_used_math == current)
544 last_task_used_math = NULL;
545 if (last_task_used_altivec == current)
546 last_task_used_altivec = NULL;
547#ifdef CONFIG_SPE
548 if (last_task_used_spe == current)
549 last_task_used_spe = NULL;
550#endif
551 preempt_enable();
552#endif
553 return 0; 550 return 0;
554} 551}
555 552
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 5462bef898f6..7b9d999e2115 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -207,10 +207,20 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
207 207
208 if (!sig) 208 if (!sig)
209 regs->gpr[13] = save_r13; 209 regs->gpr[13] = save_r13;
210 err |= __copy_from_user(&current->thread.fpr, &sc->fp_regs, FP_REGS_SIZE);
211 if (set != NULL) 210 if (set != NULL)
212 err |= __get_user(set->sig[0], &sc->oldmask); 211 err |= __get_user(set->sig[0], &sc->oldmask);
213 212
213 /*
214 * Do this before updating the thread state in
215 * current->thread.fpr/vr. That way, if we get preempted
216 * and another task grabs the FPU/Altivec, it won't be
217 * tempted to save the current CPU state into the thread_struct
218 * and corrupt what we are writing there.
219 */
220 discard_lazy_cpu_state();
221
222 err |= __copy_from_user(&current->thread.fpr, &sc->fp_regs, FP_REGS_SIZE);
223
214#ifdef CONFIG_ALTIVEC 224#ifdef CONFIG_ALTIVEC
215 err |= __get_user(v_regs, &sc->v_regs); 225 err |= __get_user(v_regs, &sc->v_regs);
216 err |= __get_user(msr, &sc->gp_regs[PT_MSR]); 226 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
@@ -229,14 +239,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
229 current->thread.vrsave = 0; 239 current->thread.vrsave = 0;
230#endif /* CONFIG_ALTIVEC */ 240#endif /* CONFIG_ALTIVEC */
231 241
232#ifndef CONFIG_SMP
233 preempt_disable();
234 if (last_task_used_math == current)
235 last_task_used_math = NULL;
236 if (last_task_used_altivec == current)
237 last_task_used_altivec = NULL;
238 preempt_enable();
239#endif
240 /* Force reload of FP/VEC */ 242 /* Force reload of FP/VEC */
241 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC); 243 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC);
242 244
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 85152544c153..e0e051c675dd 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -142,7 +142,7 @@ static void cbe_idle(void)
142 } 142 }
143} 143}
144 144
145int cbe_system_reset_exception(struct pt_regs *regs) 145static int cbe_system_reset_exception(struct pt_regs *regs)
146{ 146{
147 switch (regs->msr & SRR1_WAKEMASK) { 147 switch (regs->msr & SRR1_WAKEMASK) {
148 case SRR1_WAKEEE: 148 case SRR1_WAKEEE:
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 18e25e65c04b..b33a4443f5a9 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -57,7 +57,7 @@
57#define DBG(fmt...) 57#define DBG(fmt...)
58#endif 58#endif
59 59
60void cell_show_cpuinfo(struct seq_file *m) 60static void cell_show_cpuinfo(struct seq_file *m)
61{ 61{
62 struct device_node *root; 62 struct device_node *root;
63 const char *model = ""; 63 const char *model = "";
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index d549aa7ebea6..e6565a949ddc 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -29,7 +29,9 @@
29 * value of the spu_status register after the SPU has stopped. 29 * value of the spu_status register after the SPU has stopped.
30 * 30 *
31 */ 31 */
32long do_spu_run(struct file *filp, __u32 __user *unpc, __u32 __user *ustatus) 32static long do_spu_run(struct file *filp,
33 __u32 __user *unpc,
34 __u32 __user *ustatus)
33{ 35{
34 long ret; 36 long ret;
35 struct spufs_inode_info *i; 37 struct spufs_inode_info *i;
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index 127b465308be..ce8c0b943fa0 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1,8 +1,8 @@
1EXTRA_CFLAGS += -mno-minimal-toc 1EXTRA_CFLAGS += -mno-minimal-toc
2 2
3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \ 3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \
4 hvcall.o proc.o htab.o iommu.o misc.o 4 hvcall.o proc.o htab.o iommu.o misc.o irq.o
5obj-$(CONFIG_PCI) += pci.o irq.o vpdinfo.o 5obj-$(CONFIG_PCI) += pci.o vpdinfo.o
6obj-$(CONFIG_IBMVIO) += vio.o 6obj-$(CONFIG_IBMVIO) += vio.o
7obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_VIOPATH) += viopath.o 8obj-$(CONFIG_VIOPATH) += viopath.o
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 2b54eeb2c899..bea0b703f409 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -34,6 +34,8 @@
34#include <asm/pci-bridge.h> 34#include <asm/pci-bridge.h>
35#include <asm/iseries/hv_call_xm.h> 35#include <asm/iseries/hv_call_xm.h>
36 36
37#include "iommu.h"
38
37extern struct list_head iSeries_Global_Device_List; 39extern struct list_head iSeries_Global_Device_List;
38 40
39 41
diff --git a/arch/powerpc/platforms/iseries/iommu.h b/arch/powerpc/platforms/iseries/iommu.h
new file mode 100644
index 000000000000..cb5658fbe657
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/iommu.h
@@ -0,0 +1,35 @@
1#ifndef _PLATFORMS_ISERIES_IOMMU_H
2#define _PLATFORMS_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct device_node;
25struct iommu_table;
26
27/* Creates table for an individual device node */
28extern void iommu_devnode_init_iSeries(struct device_node *dn);
29
30/* Get table parameters from HV */
31extern void iommu_table_getparms_iSeries(unsigned long busno,
32 unsigned char slotno, unsigned char virtbus,
33 struct iommu_table *tbl);
34
35#endif /* _PLATFORMS_ISERIES_IOMMU_H */
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index 42e978e4897a..83442ea77476 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -48,6 +48,8 @@
48extern void iSeries_smp_message_recv(struct pt_regs *); 48extern void iSeries_smp_message_recv(struct pt_regs *);
49#endif 49#endif
50 50
51#ifdef CONFIG_PCI
52
51enum pci_event_type { 53enum pci_event_type {
52 pe_bus_created = 0, /* PHB has been created */ 54 pe_bus_created = 0, /* PHB has been created */
53 pe_bus_error = 1, /* PHB has failed */ 55 pe_bus_error = 1, /* PHB has failed */
@@ -147,20 +149,11 @@ static void int_received(struct pci_event *event, struct pt_regs *regs)
147static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs) 149static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs)
148{ 150{
149 if (event && (event->xType == HvLpEvent_Type_PciIo)) { 151 if (event && (event->xType == HvLpEvent_Type_PciIo)) {
150 switch (event->xFlags.xFunction) { 152 if (hvlpevent_is_int(event))
151 case HvLpEvent_Function_Int:
152 int_received((struct pci_event *)event, regs); 153 int_received((struct pci_event *)event, regs);
153 break; 154 else
154 case HvLpEvent_Function_Ack:
155 printk(KERN_ERR 155 printk(KERN_ERR
156 "pci_event_handler: unexpected ack received\n"); 156 "pci_event_handler: unexpected ack received\n");
157 break;
158 default:
159 printk(KERN_ERR
160 "pci_event_handler: unexpected event function %d\n",
161 (int)event->xFlags.xFunction);
162 break;
163 }
164 } else if (event) 157 } else if (event)
165 printk(KERN_ERR 158 printk(KERN_ERR
166 "pci_event_handler: Unrecognized PCI event type 0x%x\n", 159 "pci_event_handler: Unrecognized PCI event type 0x%x\n",
@@ -334,6 +327,8 @@ int __init iSeries_allocate_IRQ(HvBusNumber bus,
334 return virtirq; 327 return virtirq;
335} 328}
336 329
330#endif /* CONFIG_PCI */
331
337/* 332/*
338 * Get the next pending IRQ. 333 * Get the next pending IRQ.
339 */ 334 */
@@ -353,6 +348,7 @@ int iSeries_get_irq(struct pt_regs *regs)
353 if (hvlpevent_is_pending()) 348 if (hvlpevent_is_pending())
354 process_hvlpevents(regs); 349 process_hvlpevents(regs);
355 350
351#ifdef CONFIG_PCI
356 if (num_pending_irqs) { 352 if (num_pending_irqs) {
357 spin_lock(&pending_irqs_lock); 353 spin_lock(&pending_irqs_lock);
358 for (irq = 0; irq < NR_IRQS; irq++) { 354 for (irq = 0; irq < NR_IRQS; irq++) {
@@ -366,6 +362,7 @@ int iSeries_get_irq(struct pt_regs *regs)
366 if (irq >= NR_IRQS) 362 if (irq >= NR_IRQS)
367 irq = -2; 363 irq = -2;
368 } 364 }
365#endif
369 366
370 return irq; 367 return irq;
371} 368}
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c
index ea72385aaf0a..438e2dba63b5 100644
--- a/arch/powerpc/platforms/iseries/lpardata.c
+++ b/arch/powerpc/platforms/iseries/lpardata.c
@@ -93,10 +93,7 @@ struct ItLpNaca itLpNaca = {
93 .xPirEnvironMode = 0, /* Piranha stuff */ 93 .xPirEnvironMode = 0, /* Piranha stuff */
94 .xPirConsoleMode = 0, 94 .xPirConsoleMode = 0,
95 .xPirDasdMode = 0, 95 .xPirDasdMode = 0,
96 .xLparInstalled = 0, 96 .flags = 0,
97 .xSysPartitioned = 0,
98 .xHwSyncedTBs = 0,
99 .xIntProcUtilHmt = 0,
100 .xSpVpdFormat = 0, 97 .xSpVpdFormat = 0,
101 .xIntProcRatio = 0, 98 .xIntProcRatio = 0,
102 .xPlicVrmIndex = 0, /* VRM index of PLIC */ 99 .xPlicVrmIndex = 0, /* VRM index of PLIC */
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index e9fb98bf895f..0b885300d1d1 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -53,7 +53,7 @@ static struct HvLpEvent * get_next_hvlpevent(void)
53 struct HvLpEvent * event; 53 struct HvLpEvent * event;
54 event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; 54 event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
55 55
56 if (event->xFlags.xValid) { 56 if (hvlpevent_is_valid(event)) {
57 /* rmb() needed only for weakly consistent machines (regatta) */ 57 /* rmb() needed only for weakly consistent machines (regatta) */
58 rmb(); 58 rmb();
59 /* Set pointer to next potential event */ 59 /* Set pointer to next potential event */
@@ -84,7 +84,7 @@ int hvlpevent_is_pending(void)
84 84
85 next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; 85 next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
86 86
87 return next_event->xFlags.xValid | 87 return hvlpevent_is_valid(next_event) ||
88 hvlpevent_queue.xPlicOverflowIntPending; 88 hvlpevent_queue.xPlicOverflowIntPending;
89} 89}
90 90
@@ -101,18 +101,18 @@ static void hvlpevent_clear_valid(struct HvLpEvent * event)
101 switch (extra) { 101 switch (extra) {
102 case 3: 102 case 3:
103 tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign); 103 tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign);
104 tmp->xFlags.xValid = 0; 104 hvlpevent_invalidate(tmp);
105 case 2: 105 case 2:
106 tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign); 106 tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign);
107 tmp->xFlags.xValid = 0; 107 hvlpevent_invalidate(tmp);
108 case 1: 108 case 1:
109 tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign); 109 tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign);
110 tmp->xFlags.xValid = 0; 110 hvlpevent_invalidate(tmp);
111 } 111 }
112 112
113 mb(); 113 mb();
114 114
115 event->xFlags.xValid = 0; 115 hvlpevent_invalidate(event);
116} 116}
117 117
118void process_hvlpevents(struct pt_regs *regs) 118void process_hvlpevents(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 49e7e4b85847..a41d8b78c0cd 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -251,10 +251,7 @@ static struct pending_event *new_pending_event(void)
251 } 251 }
252 memset(ev, 0, sizeof(struct pending_event)); 252 memset(ev, 0, sizeof(struct pending_event));
253 hev = &ev->event.hp_lp_event; 253 hev = &ev->event.hp_lp_event;
254 hev->xFlags.xValid = 1; 254 hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DO_ACK | HV_LP_EVENT_INT;
255 hev->xFlags.xAckType = HvLpEvent_AckType_ImmediateAck;
256 hev->xFlags.xAckInd = HvLpEvent_AckInd_DoAck;
257 hev->xFlags.xFunction = HvLpEvent_Function_Int;
258 hev->xType = HvLpEvent_Type_MachineFac; 255 hev->xType = HvLpEvent_Type_MachineFac;
259 hev->xSourceLp = HvLpConfig_getLpIndex(); 256 hev->xSourceLp = HvLpConfig_getLpIndex();
260 hev->xTargetLp = primary_lp; 257 hev->xTargetLp = primary_lp;
@@ -518,17 +515,10 @@ static void handle_ack(struct io_mf_lp_event *event)
518static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs) 515static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs)
519{ 516{
520 if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) { 517 if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) {
521 switch(event->xFlags.xFunction) { 518 if (hvlpevent_is_ack(event))
522 case HvLpEvent_Function_Ack:
523 handle_ack((struct io_mf_lp_event *)event); 519 handle_ack((struct io_mf_lp_event *)event);
524 break; 520 else
525 case HvLpEvent_Function_Int:
526 handle_int((struct io_mf_lp_event *)event); 521 handle_int((struct io_mf_lp_event *)event);
527 break;
528 default:
529 printk(KERN_ERR "mf.c: non ack/int event received\n");
530 break;
531 }
532 } else 522 } else
533 printk(KERN_ERR "mf.c: alien event received\n"); 523 printk(KERN_ERR "mf.c: alien event received\n");
534} 524}
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index dafc518fbb83..a19833b880e4 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -43,6 +43,7 @@
43#include "irq.h" 43#include "irq.h"
44#include "pci.h" 44#include "pci.h"
45#include "call_pci.h" 45#include "call_pci.h"
46#include "iommu.h"
46 47
47extern unsigned long io_page_mask; 48extern unsigned long io_page_mask;
48 49
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index 384360ee06ec..ad36ab0639f0 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -22,6 +22,8 @@
22#include <asm/iseries/hv_lp_config.h> 22#include <asm/iseries/hv_lp_config.h>
23#include <asm/iseries/hv_call_xm.h> 23#include <asm/iseries/hv_call_xm.h>
24 24
25#include "iommu.h"
26
25struct device *iSeries_vio_dev = &vio_bus_device.dev; 27struct device *iSeries_vio_dev = &vio_bus_device.dev;
26EXPORT_SYMBOL(iSeries_vio_dev); 28EXPORT_SYMBOL(iSeries_vio_dev);
27 29
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index 842672695598..622a30149b48 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -270,7 +270,7 @@ static void handleMonitorEvent(struct HvLpEvent *event)
270 * First see if this is just a normal monitor message from the 270 * First see if this is just a normal monitor message from the
271 * other partition 271 * other partition
272 */ 272 */
273 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 273 if (hvlpevent_is_int(event)) {
274 remoteLp = event->xSourceLp; 274 remoteLp = event->xSourceLp;
275 if (!viopathStatus[remoteLp].isActive) 275 if (!viopathStatus[remoteLp].isActive)
276 sendMonMsg(remoteLp); 276 sendMonMsg(remoteLp);
@@ -331,13 +331,12 @@ static void handleConfig(struct HvLpEvent *event)
331{ 331{
332 if (!event) 332 if (!event)
333 return; 333 return;
334 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 334 if (hvlpevent_is_int(event)) {
335 printk(VIOPATH_KERN_WARN 335 printk(VIOPATH_KERN_WARN
336 "unexpected config request from partition %d", 336 "unexpected config request from partition %d",
337 event->xSourceLp); 337 event->xSourceLp);
338 338
339 if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && 339 if (hvlpevent_need_ack(event)) {
340 (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
341 event->xRc = HvLpEvent_Rc_InvalidSubtype; 340 event->xRc = HvLpEvent_Rc_InvalidSubtype;
342 HvCallEvent_ackLpEvent(event); 341 HvCallEvent_ackLpEvent(event);
343 } 342 }
@@ -377,7 +376,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs)
377 int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK) 376 int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK)
378 >> VIOMAJOR_SUBTYPE_SHIFT; 377 >> VIOMAJOR_SUBTYPE_SHIFT;
379 378
380 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 379 if (hvlpevent_is_int(event)) {
381 remoteLp = event->xSourceLp; 380 remoteLp = event->xSourceLp;
382 /* 381 /*
383 * The isActive is checked because if the hosting partition 382 * The isActive is checked because if the hosting partition
@@ -436,8 +435,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs)
436 "unexpected virtual io event subtype %d from partition %d\n", 435 "unexpected virtual io event subtype %d from partition %d\n",
437 event->xSubtype, remoteLp); 436 event->xSubtype, remoteLp);
438 /* No handler. Ack if necessary */ 437 /* No handler. Ack if necessary */
439 if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && 438 if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
440 (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
441 event->xRc = HvLpEvent_Rc_InvalidSubtype; 439 event->xRc = HvLpEvent_Rc_InvalidSubtype;
442 HvCallEvent_ackLpEvent(event); 440 HvCallEvent_ackLpEvent(event);
443 } 441 }
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 3b1a9d4fcbc6..89c4c3636161 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -278,7 +278,7 @@ static void __init l2cr_init(void)
278} 278}
279#endif 279#endif
280 280
281void __init pmac_setup_arch(void) 281static void __init pmac_setup_arch(void)
282{ 282{
283 struct device_node *cpu, *ic; 283 struct device_node *cpu, *ic;
284 int *fp; 284 int *fp;
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 17cea7f2afd3..83578313ee7e 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -208,10 +208,11 @@ static void __eeh_mark_slot (struct device_node *dn, int mode_flag)
208{ 208{
209 while (dn) { 209 while (dn) {
210 if (PCI_DN(dn)) { 210 if (PCI_DN(dn)) {
211 PCI_DN(dn)->eeh_mode |= mode_flag;
212
213 /* Mark the pci device driver too */ 211 /* Mark the pci device driver too */
214 struct pci_dev *dev = PCI_DN(dn)->pcidev; 212 struct pci_dev *dev = PCI_DN(dn)->pcidev;
213
214 PCI_DN(dn)->eeh_mode |= mode_flag;
215
215 if (dev && dev->driver) 216 if (dev && dev->driver)
216 dev->error_state = pci_channel_io_frozen; 217 dev->error_state = pci_channel_io_frozen;
217 218
diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c
index 4d584172055a..22bfb5c89db9 100644
--- a/arch/powerpc/platforms/pseries/hvcserver.c
+++ b/arch/powerpc/platforms/pseries/hvcserver.c
@@ -40,7 +40,7 @@ MODULE_VERSION(HVCS_ARCH_VERSION);
40 * functions aren't performance sensitive, so this conversion isn't an 40 * functions aren't performance sensitive, so this conversion isn't an
41 * issue. 41 * issue.
42 */ 42 */
43int hvcs_convert(long to_convert) 43static int hvcs_convert(long to_convert)
44{ 44{
45 switch (to_convert) { 45 switch (to_convert) {
46 case H_Success: 46 case H_Success:
@@ -91,7 +91,7 @@ int hvcs_free_partner_info(struct list_head *head)
91EXPORT_SYMBOL(hvcs_free_partner_info); 91EXPORT_SYMBOL(hvcs_free_partner_info);
92 92
93/* Helper function for hvcs_get_partner_info */ 93/* Helper function for hvcs_get_partner_info */
94int hvcs_next_partner(uint32_t unit_address, 94static int hvcs_next_partner(uint32_t unit_address,
95 unsigned long last_p_partition_ID, 95 unsigned long last_p_partition_ID,
96 unsigned long last_p_unit_address, unsigned long *pi_buff) 96 unsigned long last_p_unit_address, unsigned long *pi_buff)
97 97
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 169f9148789c..48cfbfc43f99 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -51,8 +51,6 @@
51 51
52#define DBG(fmt...) 52#define DBG(fmt...)
53 53
54extern int is_python(struct device_node *);
55
56static void tce_build_pSeries(struct iommu_table *tbl, long index, 54static void tce_build_pSeries(struct iommu_table *tbl, long index,
57 long npages, unsigned long uaddr, 55 long npages, unsigned long uaddr,
58 enum dma_data_direction direction) 56 enum dma_data_direction direction)
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 2edc947f7c44..50643496eb63 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -192,7 +192,7 @@ struct file_operations scanlog_fops = {
192 .release = scanlog_release, 192 .release = scanlog_release,
193}; 193};
194 194
195int __init scanlog_init(void) 195static int __init scanlog_init(void)
196{ 196{
197 struct proc_dir_entry *ent; 197 struct proc_dir_entry *ent;
198 198
@@ -222,7 +222,7 @@ int __init scanlog_init(void)
222 return 0; 222 return 0;
223} 223}
224 224
225void __exit scanlog_cleanup(void) 225static void __exit scanlog_cleanup(void)
226{ 226{
227 if (proc_ppc64_scan_log_dump) { 227 if (proc_ppc64_scan_log_dump) {
228 kfree(proc_ppc64_scan_log_dump->data); 228 kfree(proc_ppc64_scan_log_dump->data);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 8903cf63236a..68b7f086d63d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -86,7 +86,7 @@ static void pseries_dedicated_idle(void);
86 86
87struct mpic *pSeries_mpic; 87struct mpic *pSeries_mpic;
88 88
89void pSeries_show_cpuinfo(struct seq_file *m) 89static void pSeries_show_cpuinfo(struct seq_file *m)
90{ 90{
91 struct device_node *root; 91 struct device_node *root;
92 const char *model = ""; 92 const char *model = "";
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 2f543cea9787..8e6b1ed1396e 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -93,7 +93,7 @@ static int query_cpu_stopped(unsigned int pcpu)
93 return cpu_status; 93 return cpu_status;
94} 94}
95 95
96int pSeries_cpu_disable(void) 96static int pSeries_cpu_disable(void)
97{ 97{
98 int cpu = smp_processor_id(); 98 int cpu = smp_processor_id();
99 99
@@ -109,7 +109,7 @@ int pSeries_cpu_disable(void)
109 return 0; 109 return 0;
110} 110}
111 111
112void pSeries_cpu_die(unsigned int cpu) 112static void pSeries_cpu_die(unsigned int cpu)
113{ 113{
114 int tries; 114 int tries;
115 int cpu_status; 115 int cpu_status;
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 0c0cfa32eb58..fd823c7c9ac8 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -381,7 +381,7 @@ int xics_get_irq(struct pt_regs *regs)
381 381
382#ifdef CONFIG_SMP 382#ifdef CONFIG_SMP
383 383
384irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 384static irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
385{ 385{
386 int cpu = smp_processor_id(); 386 int cpu = smp_processor_id();
387 387
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index e00b46b9514e..977de9db8754 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -139,7 +139,6 @@ static void dart_build(struct iommu_table *tbl, long index,
139 139
140 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); 140 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK);
141 141
142 rpn++;
143 uaddr += DART_PAGE_SIZE; 142 uaddr += DART_PAGE_SIZE;
144 } 143 }
145 144
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 22612ed5379c..7d02fa2a8990 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -311,7 +311,7 @@ static void release_output_lock(void)
311} 311}
312#endif 312#endif
313 313
314int xmon_core(struct pt_regs *regs, int fromipi) 314static int xmon_core(struct pt_regs *regs, int fromipi)
315{ 315{
316 int cmd = 0; 316 int cmd = 0;
317 unsigned long msr; 317 unsigned long msr;
@@ -528,7 +528,7 @@ xmon_irq(int irq, void *d, struct pt_regs *regs)
528 return IRQ_HANDLED; 528 return IRQ_HANDLED;
529} 529}
530 530
531int xmon_bpt(struct pt_regs *regs) 531static int xmon_bpt(struct pt_regs *regs)
532{ 532{
533 struct bpt *bp; 533 struct bpt *bp;
534 unsigned long offset; 534 unsigned long offset;
@@ -554,7 +554,7 @@ int xmon_bpt(struct pt_regs *regs)
554 return 1; 554 return 1;
555} 555}
556 556
557int xmon_sstep(struct pt_regs *regs) 557static int xmon_sstep(struct pt_regs *regs)
558{ 558{
559 if (user_mode(regs)) 559 if (user_mode(regs))
560 return 0; 560 return 0;
@@ -562,7 +562,7 @@ int xmon_sstep(struct pt_regs *regs)
562 return 1; 562 return 1;
563} 563}
564 564
565int xmon_dabr_match(struct pt_regs *regs) 565static int xmon_dabr_match(struct pt_regs *regs)
566{ 566{
567 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) 567 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
568 return 0; 568 return 0;
@@ -572,7 +572,7 @@ int xmon_dabr_match(struct pt_regs *regs)
572 return 1; 572 return 1;
573} 573}
574 574
575int xmon_iabr_match(struct pt_regs *regs) 575static int xmon_iabr_match(struct pt_regs *regs)
576{ 576{
577 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) 577 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
578 return 0; 578 return 0;
@@ -582,7 +582,7 @@ int xmon_iabr_match(struct pt_regs *regs)
582 return 1; 582 return 1;
583} 583}
584 584
585int xmon_ipi(struct pt_regs *regs) 585static int xmon_ipi(struct pt_regs *regs)
586{ 586{
587#ifdef CONFIG_SMP 587#ifdef CONFIG_SMP
588 if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon)) 588 if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon))
@@ -591,7 +591,7 @@ int xmon_ipi(struct pt_regs *regs)
591 return 0; 591 return 0;
592} 592}
593 593
594int xmon_fault_handler(struct pt_regs *regs) 594static int xmon_fault_handler(struct pt_regs *regs)
595{ 595{
596 struct bpt *bp; 596 struct bpt *bp;
597 unsigned long offset; 597 unsigned long offset;
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index e6c1d615bb86..ca0201300868 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -13,7 +13,6 @@ extra-$(CONFIG_POWER4) += idle_power4.o
13extra-y += vmlinux.lds 13extra-y += vmlinux.lds
14 14
15obj-y := entry.o traps.o idle.o time.o misc.o \ 15obj-y := entry.o traps.o idle.o time.o misc.o \
16 process.o \
17 setup.o \ 16 setup.o \
18 ppc_htab.o 17 ppc_htab.o
19obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o 18obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
deleted file mode 100644
index a76b504299ca..000000000000
--- a/arch/ppc/kernel/process.c
+++ /dev/null
@@ -1,851 +0,0 @@
1/*
2 * arch/ppc/kernel/process.c
3 *
4 * Derived from "arch/i386/kernel/process.c"
5 * Copyright (C) 1995 Linus Torvalds
6 *
7 * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and
8 * Paul Mackerras (paulus@cs.anu.edu.au)
9 *
10 * PowerPC version
11 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/errno.h>
22#include <linux/sched.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/smp.h>
26#include <linux/smp_lock.h>
27#include <linux/stddef.h>
28#include <linux/unistd.h>
29#include <linux/ptrace.h>
30#include <linux/slab.h>
31#include <linux/user.h>
32#include <linux/elf.h>
33#include <linux/init.h>
34#include <linux/prctl.h>
35#include <linux/init_task.h>
36#include <linux/module.h>
37#include <linux/kallsyms.h>
38#include <linux/mqueue.h>
39#include <linux/hardirq.h>
40
41#include <asm/pgtable.h>
42#include <asm/uaccess.h>
43#include <asm/system.h>
44#include <asm/io.h>
45#include <asm/processor.h>
46#include <asm/mmu.h>
47#include <asm/prom.h>
48
49extern unsigned long _get_SP(void);
50
51struct task_struct *last_task_used_math = NULL;
52struct task_struct *last_task_used_altivec = NULL;
53struct task_struct *last_task_used_spe = NULL;
54
55static struct fs_struct init_fs = INIT_FS;
56static struct files_struct init_files = INIT_FILES;
57static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
58static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
59struct mm_struct init_mm = INIT_MM(init_mm);
60EXPORT_SYMBOL(init_mm);
61
62/* this is 8kB-aligned so we can get to the thread_info struct
63 at the base of it from the stack pointer with 1 integer instruction. */
64union thread_union init_thread_union
65 __attribute__((__section__(".data.init_task"))) =
66{ INIT_THREAD_INFO(init_task) };
67
68/* initial task structure */
69struct task_struct init_task = INIT_TASK(init_task);
70EXPORT_SYMBOL(init_task);
71
72/* only used to get secondary processor up */
73struct task_struct *current_set[NR_CPUS] = {&init_task, };
74
75#undef SHOW_TASK_SWITCHES
76#undef CHECK_STACK
77
78#if defined(CHECK_STACK)
79unsigned long
80kernel_stack_top(struct task_struct *tsk)
81{
82 return ((unsigned long)tsk) + sizeof(union task_union);
83}
84
85unsigned long
86task_top(struct task_struct *tsk)
87{
88 return ((unsigned long)tsk) + sizeof(struct thread_info);
89}
90
91/* check to make sure the kernel stack is healthy */
92int check_stack(struct task_struct *tsk)
93{
94 unsigned long stack_top = kernel_stack_top(tsk);
95 unsigned long tsk_top = task_top(tsk);
96 int ret = 0;
97
98#if 0
99 /* check thread magic */
100 if ( tsk->thread.magic != THREAD_MAGIC )
101 {
102 ret |= 1;
103 printk("thread.magic bad: %08x\n", tsk->thread.magic);
104 }
105#endif
106
107 if ( !tsk )
108 printk("check_stack(): tsk bad tsk %p\n",tsk);
109
110 /* check if stored ksp is bad */
111 if ( (tsk->thread.ksp > stack_top) || (tsk->thread.ksp < tsk_top) )
112 {
113 printk("stack out of bounds: %s/%d\n"
114 " tsk_top %08lx ksp %08lx stack_top %08lx\n",
115 tsk->comm,tsk->pid,
116 tsk_top, tsk->thread.ksp, stack_top);
117 ret |= 2;
118 }
119
120 /* check if stack ptr RIGHT NOW is bad */
121 if ( (tsk == current) && ((_get_SP() > stack_top ) || (_get_SP() < tsk_top)) )
122 {
123 printk("current stack ptr out of bounds: %s/%d\n"
124 " tsk_top %08lx sp %08lx stack_top %08lx\n",
125 current->comm,current->pid,
126 tsk_top, _get_SP(), stack_top);
127 ret |= 4;
128 }
129
130#if 0
131 /* check amount of free stack */
132 for ( i = (unsigned long *)task_top(tsk) ; i < kernel_stack_top(tsk) ; i++ )
133 {
134 if ( !i )
135 printk("check_stack(): i = %p\n", i);
136 if ( *i != 0 )
137 {
138 /* only notify if it's less than 900 bytes */
139 if ( (i - (unsigned long *)task_top(tsk)) < 900 )
140 printk("%d bytes free on stack\n",
141 i - task_top(tsk));
142 break;
143 }
144 }
145#endif
146
147 if (ret)
148 {
149 panic("bad kernel stack");
150 }
151 return(ret);
152}
153#endif /* defined(CHECK_STACK) */
154
155/*
156 * Make sure the floating-point register state in the
157 * the thread_struct is up to date for task tsk.
158 */
159void flush_fp_to_thread(struct task_struct *tsk)
160{
161 if (tsk->thread.regs) {
162 /*
163 * We need to disable preemption here because if we didn't,
164 * another process could get scheduled after the regs->msr
165 * test but before we have finished saving the FP registers
166 * to the thread_struct. That process could take over the
167 * FPU, and then when we get scheduled again we would store
168 * bogus values for the remaining FP registers.
169 */
170 preempt_disable();
171 if (tsk->thread.regs->msr & MSR_FP) {
172#ifdef CONFIG_SMP
173 /*
174 * This should only ever be called for current or
175 * for a stopped child process. Since we save away
176 * the FP register state on context switch on SMP,
177 * there is something wrong if a stopped child appears
178 * to still have its FP state in the CPU registers.
179 */
180 BUG_ON(tsk != current);
181#endif
182 giveup_fpu(current);
183 }
184 preempt_enable();
185 }
186}
187
188void enable_kernel_fp(void)
189{
190 WARN_ON(preemptible());
191
192#ifdef CONFIG_SMP
193 if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
194 giveup_fpu(current);
195 else
196 giveup_fpu(NULL); /* just enables FP for kernel */
197#else
198 giveup_fpu(last_task_used_math);
199#endif /* CONFIG_SMP */
200}
201EXPORT_SYMBOL(enable_kernel_fp);
202
203int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
204{
205 preempt_disable();
206 if (tsk->thread.regs && (tsk->thread.regs->msr & MSR_FP))
207 giveup_fpu(tsk);
208 preempt_enable();
209 memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
210 return 1;
211}
212
213#ifdef CONFIG_ALTIVEC
214void enable_kernel_altivec(void)
215{
216 WARN_ON(preemptible());
217
218#ifdef CONFIG_SMP
219 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
220 giveup_altivec(current);
221 else
222 giveup_altivec(NULL); /* just enable AltiVec for kernel - force */
223#else
224 giveup_altivec(last_task_used_altivec);
225#endif /* __SMP __ */
226}
227EXPORT_SYMBOL(enable_kernel_altivec);
228
229/*
230 * Make sure the VMX/Altivec register state in the
231 * the thread_struct is up to date for task tsk.
232 */
233void flush_altivec_to_thread(struct task_struct *tsk)
234{
235 if (tsk->thread.regs) {
236 preempt_disable();
237 if (tsk->thread.regs->msr & MSR_VEC) {
238#ifdef CONFIG_SMP
239 BUG_ON(tsk != current);
240#endif
241 giveup_altivec(current);
242 }
243 preempt_enable();
244 }
245}
246
247int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
248{
249 if (regs->msr & MSR_VEC)
250 giveup_altivec(current);
251 memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs));
252 return 1;
253}
254#endif /* CONFIG_ALTIVEC */
255
256#ifdef CONFIG_SPE
257void
258enable_kernel_spe(void)
259{
260 WARN_ON(preemptible());
261
262#ifdef CONFIG_SMP
263 if (current->thread.regs && (current->thread.regs->msr & MSR_SPE))
264 giveup_spe(current);
265 else
266 giveup_spe(NULL); /* just enable SPE for kernel - force */
267#else
268 giveup_spe(last_task_used_spe);
269#endif /* __SMP __ */
270}
271EXPORT_SYMBOL(enable_kernel_spe);
272
273void flush_spe_to_thread(struct task_struct *tsk)
274{
275 if (tsk->thread.regs) {
276 preempt_disable();
277 if (tsk->thread.regs->msr & MSR_SPE) {
278#ifdef CONFIG_SMP
279 BUG_ON(tsk != current);
280#endif
281 giveup_spe(current);
282 }
283 preempt_enable();
284 }
285}
286
287int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
288{
289 if (regs->msr & MSR_SPE)
290 giveup_spe(current);
291 /* We copy u32 evr[32] + u64 acc + u32 spefscr -> 35 */
292 memcpy(evrregs, &current->thread.evr[0], sizeof(u32) * 35);
293 return 1;
294}
295#endif /* CONFIG_SPE */
296
297struct task_struct *__switch_to(struct task_struct *prev,
298 struct task_struct *new)
299{
300 struct thread_struct *new_thread, *old_thread;
301 unsigned long s;
302 struct task_struct *last;
303
304 local_irq_save(s);
305#ifdef CHECK_STACK
306 check_stack(prev);
307 check_stack(new);
308#endif
309
310#ifdef CONFIG_SMP
311 /* avoid complexity of lazy save/restore of fpu
312 * by just saving it every time we switch out if
313 * this task used the fpu during the last quantum.
314 *
315 * If it tries to use the fpu again, it'll trap and
316 * reload its fp regs. So we don't have to do a restore
317 * every switch, just a save.
318 * -- Cort
319 */
320 if (prev->thread.regs && (prev->thread.regs->msr & MSR_FP))
321 giveup_fpu(prev);
322#ifdef CONFIG_ALTIVEC
323 /*
324 * If the previous thread used altivec in the last quantum
325 * (thus changing altivec regs) then save them.
326 * We used to check the VRSAVE register but not all apps
327 * set it, so we don't rely on it now (and in fact we need
328 * to save & restore VSCR even if VRSAVE == 0). -- paulus
329 *
330 * On SMP we always save/restore altivec regs just to avoid the
331 * complexity of changing processors.
332 * -- Cort
333 */
334 if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)))
335 giveup_altivec(prev);
336#endif /* CONFIG_ALTIVEC */
337#ifdef CONFIG_SPE
338 /*
339 * If the previous thread used spe in the last quantum
340 * (thus changing spe regs) then save them.
341 *
342 * On SMP we always save/restore spe regs just to avoid the
343 * complexity of changing processors.
344 */
345 if ((prev->thread.regs && (prev->thread.regs->msr & MSR_SPE)))
346 giveup_spe(prev);
347#endif /* CONFIG_SPE */
348#endif /* CONFIG_SMP */
349
350#ifdef CONFIG_ALTIVEC
351 /* Avoid the trap. On smp this this never happens since
352 * we don't set last_task_used_altivec -- Cort
353 */
354 if (new->thread.regs && last_task_used_altivec == new)
355 new->thread.regs->msr |= MSR_VEC;
356#endif
357#ifdef CONFIG_SPE
358 /* Avoid the trap. On smp this this never happens since
359 * we don't set last_task_used_spe
360 */
361 if (new->thread.regs && last_task_used_spe == new)
362 new->thread.regs->msr |= MSR_SPE;
363#endif /* CONFIG_SPE */
364 new_thread = &new->thread;
365 old_thread = &current->thread;
366 last = _switch(old_thread, new_thread);
367 local_irq_restore(s);
368 return last;
369}
370
371void show_regs(struct pt_regs * regs)
372{
373 int i, trap;
374
375 printk("NIP: %08lX LR: %08lX SP: %08lX REGS: %p TRAP: %04lx %s\n",
376 regs->nip, regs->link, regs->gpr[1], regs, regs->trap,
377 print_tainted());
378 printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
379 regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
380 regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
381 regs->msr&MSR_IR ? 1 : 0,
382 regs->msr&MSR_DR ? 1 : 0);
383 trap = TRAP(regs);
384 if (trap == 0x300 || trap == 0x600)
385 printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr);
386 printk("TASK = %p[%d] '%s' THREAD: %p\n",
387 current, current->pid, current->comm, task_thread_info(current));
388 printk("Last syscall: %ld ", current->thread.last_syscall);
389
390#ifdef CONFIG_SMP
391 printk(" CPU: %d", smp_processor_id());
392#endif /* CONFIG_SMP */
393
394 for (i = 0; i < 32; i++) {
395 long r;
396 if ((i % 8) == 0)
397 printk("\n" KERN_INFO "GPR%02d: ", i);
398 if (__get_user(r, &regs->gpr[i]))
399 break;
400 printk("%08lX ", r);
401 if (i == 12 && !FULL_REGS(regs))
402 break;
403 }
404 printk("\n");
405#ifdef CONFIG_KALLSYMS
406 /*
407 * Lookup NIP late so we have the best change of getting the
408 * above info out without failing
409 */
410 printk("NIP [%08lx] ", regs->nip);
411 print_symbol("%s\n", regs->nip);
412 printk("LR [%08lx] ", regs->link);
413 print_symbol("%s\n", regs->link);
414#endif
415 show_stack(current, (unsigned long *) regs->gpr[1]);
416}
417
418void exit_thread(void)
419{
420 preempt_disable();
421 if (last_task_used_math == current)
422 last_task_used_math = NULL;
423 if (last_task_used_altivec == current)
424 last_task_used_altivec = NULL;
425#ifdef CONFIG_SPE
426 if (last_task_used_spe == current)
427 last_task_used_spe = NULL;
428#endif
429 preempt_enable();
430}
431
432void flush_thread(void)
433{
434 preempt_disable();
435 if (last_task_used_math == current)
436 last_task_used_math = NULL;
437 if (last_task_used_altivec == current)
438 last_task_used_altivec = NULL;
439#ifdef CONFIG_SPE
440 if (last_task_used_spe == current)
441 last_task_used_spe = NULL;
442#endif
443 preempt_enable();
444}
445
446void
447release_thread(struct task_struct *t)
448{
449}
450
451/*
452 * This gets called before we allocate a new thread and copy
453 * the current task into it.
454 */
455void prepare_to_copy(struct task_struct *tsk)
456{
457 struct pt_regs *regs = tsk->thread.regs;
458
459 if (regs == NULL)
460 return;
461 preempt_disable();
462 if (regs->msr & MSR_FP)
463 giveup_fpu(current);
464#ifdef CONFIG_ALTIVEC
465 if (regs->msr & MSR_VEC)
466 giveup_altivec(current);
467#endif /* CONFIG_ALTIVEC */
468#ifdef CONFIG_SPE
469 if (regs->msr & MSR_SPE)
470 giveup_spe(current);
471#endif /* CONFIG_SPE */
472 preempt_enable();
473}
474
475/*
476 * Copy a thread..
477 */
478int
479copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
480 unsigned long unused,
481 struct task_struct *p, struct pt_regs *regs)
482{
483 struct pt_regs *childregs, *kregs;
484 extern void ret_from_fork(void);
485 unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
486 unsigned long childframe;
487
488 CHECK_FULL_REGS(regs);
489 /* Copy registers */
490 sp -= sizeof(struct pt_regs);
491 childregs = (struct pt_regs *) sp;
492 *childregs = *regs;
493 if ((childregs->msr & MSR_PR) == 0) {
494 /* for kernel thread, set `current' and stackptr in new task */
495 childregs->gpr[1] = sp + sizeof(struct pt_regs);
496 childregs->gpr[2] = (unsigned long) p;
497 p->thread.regs = NULL; /* no user register state */
498 } else {
499 childregs->gpr[1] = usp;
500 p->thread.regs = childregs;
501 if (clone_flags & CLONE_SETTLS)
502 childregs->gpr[2] = childregs->gpr[6];
503 }
504 childregs->gpr[3] = 0; /* Result from fork() */
505 sp -= STACK_FRAME_OVERHEAD;
506 childframe = sp;
507
508 /*
509 * The way this works is that at some point in the future
510 * some task will call _switch to switch to the new task.
511 * That will pop off the stack frame created below and start
512 * the new task running at ret_from_fork. The new task will
513 * do some house keeping and then return from the fork or clone
514 * system call, using the stack frame created above.
515 */
516 sp -= sizeof(struct pt_regs);
517 kregs = (struct pt_regs *) sp;
518 sp -= STACK_FRAME_OVERHEAD;
519 p->thread.ksp = sp;
520 kregs->nip = (unsigned long)ret_from_fork;
521
522 p->thread.last_syscall = -1;
523
524 return 0;
525}
526
527/*
528 * Set up a thread for executing a new program
529 */
530void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp)
531{
532 set_fs(USER_DS);
533 memset(regs->gpr, 0, sizeof(regs->gpr));
534 regs->ctr = 0;
535 regs->link = 0;
536 regs->xer = 0;
537 regs->ccr = 0;
538 regs->mq = 0;
539 regs->nip = nip;
540 regs->gpr[1] = sp;
541 regs->msr = MSR_USER;
542 preempt_disable();
543 if (last_task_used_math == current)
544 last_task_used_math = NULL;
545 if (last_task_used_altivec == current)
546 last_task_used_altivec = NULL;
547#ifdef CONFIG_SPE
548 if (last_task_used_spe == current)
549 last_task_used_spe = NULL;
550#endif
551 preempt_enable();
552 memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
553 current->thread.fpscr.val = 0;
554#ifdef CONFIG_ALTIVEC
555 memset(current->thread.vr, 0, sizeof(current->thread.vr));
556 memset(&current->thread.vscr, 0, sizeof(current->thread.vscr));
557 current->thread.vrsave = 0;
558 current->thread.used_vr = 0;
559#endif /* CONFIG_ALTIVEC */
560#ifdef CONFIG_SPE
561 memset(current->thread.evr, 0, sizeof(current->thread.evr));
562 current->thread.acc = 0;
563 current->thread.spefscr = 0;
564 current->thread.used_spe = 0;
565#endif /* CONFIG_SPE */
566}
567
568#define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
569 | PR_FP_EXC_RES | PR_FP_EXC_INV)
570
571int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
572{
573 struct pt_regs *regs = tsk->thread.regs;
574
575 /* This is a bit hairy. If we are an SPE enabled processor
576 * (have embedded fp) we store the IEEE exception enable flags in
577 * fpexc_mode. fpexc_mode is also used for setting FP exception
578 * mode (asyn, precise, disabled) for 'Classic' FP. */
579 if (val & PR_FP_EXC_SW_ENABLE) {
580#ifdef CONFIG_SPE
581 tsk->thread.fpexc_mode = val &
582 (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
583#else
584 return -EINVAL;
585#endif
586 } else {
587 /* on a CONFIG_SPE this does not hurt us. The bits that
588 * __pack_fe01 use do not overlap with bits used for
589 * PR_FP_EXC_SW_ENABLE. Additionally, the MSR[FE0,FE1] bits
590 * on CONFIG_SPE implementations are reserved so writing to
591 * them does not change anything */
592 if (val > PR_FP_EXC_PRECISE)
593 return -EINVAL;
594 tsk->thread.fpexc_mode = __pack_fe01(val);
595 if (regs != NULL && (regs->msr & MSR_FP) != 0)
596 regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1))
597 | tsk->thread.fpexc_mode;
598 }
599 return 0;
600}
601
602int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
603{
604 unsigned int val;
605
606 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
607#ifdef CONFIG_SPE
608 val = tsk->thread.fpexc_mode;
609#else
610 return -EINVAL;
611#endif
612 else
613 val = __unpack_fe01(tsk->thread.fpexc_mode);
614 return put_user(val, (unsigned int __user *) adr);
615}
616
617int sys_clone(unsigned long clone_flags, unsigned long usp,
618 int __user *parent_tidp, void __user *child_threadptr,
619 int __user *child_tidp, int p6,
620 struct pt_regs *regs)
621{
622 CHECK_FULL_REGS(regs);
623 if (usp == 0)
624 usp = regs->gpr[1]; /* stack pointer for child */
625 return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp);
626}
627
628int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
629 unsigned long p4, unsigned long p5, unsigned long p6,
630 struct pt_regs *regs)
631{
632 CHECK_FULL_REGS(regs);
633 return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL);
634}
635
636int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
637 unsigned long p4, unsigned long p5, unsigned long p6,
638 struct pt_regs *regs)
639{
640 CHECK_FULL_REGS(regs);
641 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1],
642 regs, 0, NULL, NULL);
643}
644
645int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
646 unsigned long a3, unsigned long a4, unsigned long a5,
647 struct pt_regs *regs)
648{
649 int error;
650 char * filename;
651
652 filename = getname((char __user *) a0);
653 error = PTR_ERR(filename);
654 if (IS_ERR(filename))
655 goto out;
656 preempt_disable();
657 if (regs->msr & MSR_FP)
658 giveup_fpu(current);
659#ifdef CONFIG_ALTIVEC
660 if (regs->msr & MSR_VEC)
661 giveup_altivec(current);
662#endif /* CONFIG_ALTIVEC */
663#ifdef CONFIG_SPE
664 if (regs->msr & MSR_SPE)
665 giveup_spe(current);
666#endif /* CONFIG_SPE */
667 preempt_enable();
668 error = do_execve(filename, (char __user *__user *) a1,
669 (char __user *__user *) a2, regs);
670 if (error == 0) {
671 task_lock(current);
672 current->ptrace &= ~PT_DTRACE;
673 task_unlock(current);
674 }
675 putname(filename);
676out:
677 return error;
678}
679
680void dump_stack(void)
681{
682 show_stack(current, NULL);
683}
684
685EXPORT_SYMBOL(dump_stack);
686
687void show_stack(struct task_struct *tsk, unsigned long *stack)
688{
689 unsigned long sp, stack_top, prev_sp, ret;
690 int count = 0;
691 unsigned long next_exc = 0;
692 struct pt_regs *regs;
693 extern char ret_from_except, ret_from_except_full, ret_from_syscall;
694
695 sp = (unsigned long) stack;
696 if (tsk == NULL)
697 tsk = current;
698 if (sp == 0) {
699 if (tsk == current)
700 asm("mr %0,1" : "=r" (sp));
701 else
702 sp = tsk->thread.ksp;
703 }
704
705 prev_sp = (unsigned long) end_of_stack(tsk);
706 stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE;
707 while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
708 if (count == 0) {
709 printk("Call trace:");
710#ifdef CONFIG_KALLSYMS
711 printk("\n");
712#endif
713 } else {
714 if (next_exc) {
715 ret = next_exc;
716 next_exc = 0;
717 } else
718 ret = *(unsigned long *)(sp + 4);
719 printk(" [%08lx] ", ret);
720#ifdef CONFIG_KALLSYMS
721 print_symbol("%s", ret);
722 printk("\n");
723#endif
724 if (ret == (unsigned long) &ret_from_except
725 || ret == (unsigned long) &ret_from_except_full
726 || ret == (unsigned long) &ret_from_syscall) {
727 /* sp + 16 points to an exception frame */
728 regs = (struct pt_regs *) (sp + 16);
729 if (sp + 16 + sizeof(*regs) <= stack_top)
730 next_exc = regs->nip;
731 }
732 }
733 ++count;
734 sp = *(unsigned long *)sp;
735 }
736#ifndef CONFIG_KALLSYMS
737 if (count > 0)
738 printk("\n");
739#endif
740}
741
742#if 0
743/*
744 * Low level print for debugging - Cort
745 */
746int __init ll_printk(const char *fmt, ...)
747{
748 va_list args;
749 char buf[256];
750 int i;
751
752 va_start(args, fmt);
753 i=vsprintf(buf,fmt,args);
754 ll_puts(buf);
755 va_end(args);
756 return i;
757}
758
759int lines = 24, cols = 80;
760int orig_x = 0, orig_y = 0;
761
762void puthex(unsigned long val)
763{
764 unsigned char buf[10];
765 int i;
766 for (i = 7; i >= 0; i--)
767 {
768 buf[i] = "0123456789ABCDEF"[val & 0x0F];
769 val >>= 4;
770 }
771 buf[8] = '\0';
772 prom_print(buf);
773}
774
775void __init ll_puts(const char *s)
776{
777 int x,y;
778 char *vidmem = (char *)/*(_ISA_MEM_BASE + 0xB8000) */0xD00B8000;
779 char c;
780 extern int mem_init_done;
781
782 if ( mem_init_done ) /* assume this means we can printk */
783 {
784 printk(s);
785 return;
786 }
787
788#if 0
789 if ( have_of )
790 {
791 prom_print(s);
792 return;
793 }
794#endif
795
796 /*
797 * can't ll_puts on chrp without openfirmware yet.
798 * vidmem just needs to be setup for it.
799 * -- Cort
800 */
801 if ( _machine != _MACH_prep )
802 return;
803 x = orig_x;
804 y = orig_y;
805
806 while ( ( c = *s++ ) != '\0' ) {
807 if ( c == '\n' ) {
808 x = 0;
809 if ( ++y >= lines ) {
810 /*scroll();*/
811 /*y--;*/
812 y = 0;
813 }
814 } else {
815 vidmem [ ( x + cols * y ) * 2 ] = c;
816 if ( ++x >= cols ) {
817 x = 0;
818 if ( ++y >= lines ) {
819 /*scroll();*/
820 /*y--;*/
821 y = 0;
822 }
823 }
824 }
825 }
826
827 orig_x = x;
828 orig_y = y;
829}
830#endif
831
832unsigned long get_wchan(struct task_struct *p)
833{
834 unsigned long ip, sp;
835 unsigned long stack_page = (unsigned long) task_stack_page(p);
836 int count = 0;
837 if (!p || p == current || p->state == TASK_RUNNING)
838 return 0;
839 sp = p->thread.ksp;
840 do {
841 sp = *(unsigned long *)sp;
842 if (sp < stack_page || sp >= stack_page + 8188)
843 return 0;
844 if (count > 0) {
845 ip = *(unsigned long *)(sp + 4);
846 if (!in_sched_functions(ip))
847 return ip;
848 }
849 } while (count++ < 16);
850 return 0;
851}
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index d1aaf31bd97e..f63e07bd9f9c 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -293,6 +293,7 @@ static int send_request(struct request *req)
293 u16 viocmd; 293 u16 viocmd;
294 HvLpEvent_Rc hvrc; 294 HvLpEvent_Rc hvrc;
295 struct vioblocklpevent *bevent; 295 struct vioblocklpevent *bevent;
296 struct HvLpEvent *hev;
296 struct scatterlist sg[VIOMAXBLOCKDMA]; 297 struct scatterlist sg[VIOMAXBLOCKDMA];
297 int sgindex; 298 int sgindex;
298 int statindex; 299 int statindex;
@@ -347,22 +348,19 @@ static int send_request(struct request *req)
347 * token so we can match the response up later 348 * token so we can match the response up later
348 */ 349 */
349 memset(bevent, 0, sizeof(struct vioblocklpevent)); 350 memset(bevent, 0, sizeof(struct vioblocklpevent));
350 bevent->event.xFlags.xValid = 1; 351 hev = &bevent->event;
351 bevent->event.xFlags.xFunction = HvLpEvent_Function_Int; 352 hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DO_ACK |
352 bevent->event.xFlags.xAckInd = HvLpEvent_AckInd_DoAck; 353 HV_LP_EVENT_INT;
353 bevent->event.xFlags.xAckType = HvLpEvent_AckType_ImmediateAck; 354 hev->xType = HvLpEvent_Type_VirtualIo;
354 bevent->event.xType = HvLpEvent_Type_VirtualIo; 355 hev->xSubtype = viocmd;
355 bevent->event.xSubtype = viocmd; 356 hev->xSourceLp = HvLpConfig_getLpIndex();
356 bevent->event.xSourceLp = HvLpConfig_getLpIndex(); 357 hev->xTargetLp = viopath_hostLp;
357 bevent->event.xTargetLp = viopath_hostLp; 358 hev->xSizeMinus1 =
358 bevent->event.xSizeMinus1 =
359 offsetof(struct vioblocklpevent, u.rw_data.dma_info) + 359 offsetof(struct vioblocklpevent, u.rw_data.dma_info) +
360 (sizeof(bevent->u.rw_data.dma_info[0]) * nsg) - 1; 360 (sizeof(bevent->u.rw_data.dma_info[0]) * nsg) - 1;
361 bevent->event.xSourceInstanceId = 361 hev->xSourceInstanceId = viopath_sourceinst(viopath_hostLp);
362 viopath_sourceinst(viopath_hostLp); 362 hev->xTargetInstanceId = viopath_targetinst(viopath_hostLp);
363 bevent->event.xTargetInstanceId = 363 hev->xCorrelationToken = (u64)req;
364 viopath_targetinst(viopath_hostLp);
365 bevent->event.xCorrelationToken = (u64)req;
366 bevent->version = VIOVERSION; 364 bevent->version = VIOVERSION;
367 bevent->disk = DEVICE_NO(d); 365 bevent->disk = DEVICE_NO(d);
368 bevent->u.rw_data.offset = start; 366 bevent->u.rw_data.offset = start;
@@ -649,10 +647,10 @@ static void handle_block_event(struct HvLpEvent *event)
649 /* Notification that a partition went away! */ 647 /* Notification that a partition went away! */
650 return; 648 return;
651 /* First, we should NEVER get an int here...only acks */ 649 /* First, we should NEVER get an int here...only acks */
652 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 650 if (hvlpevent_is_int(event)) {
653 printk(VIOD_KERN_WARNING 651 printk(VIOD_KERN_WARNING
654 "Yikes! got an int in viodasd event handler!\n"); 652 "Yikes! got an int in viodasd event handler!\n");
655 if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { 653 if (hvlpevent_need_ack(event)) {
656 event->xRc = HvLpEvent_Rc_InvalidSubtype; 654 event->xRc = HvLpEvent_Rc_InvalidSubtype;
657 HvCallEvent_ackLpEvent(event); 655 HvCallEvent_ackLpEvent(event);
658 } 656 }
@@ -695,7 +693,7 @@ static void handle_block_event(struct HvLpEvent *event)
695 693
696 default: 694 default:
697 printk(VIOD_KERN_WARNING "invalid subtype!"); 695 printk(VIOD_KERN_WARNING "invalid subtype!");
698 if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { 696 if (hvlpevent_need_ack(event)) {
699 event->xRc = HvLpEvent_Rc_InvalidSubtype; 697 event->xRc = HvLpEvent_Rc_InvalidSubtype;
700 HvCallEvent_ackLpEvent(event); 698 HvCallEvent_ackLpEvent(event);
701 } 699 }
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index b5191780ecca..193446e6a08a 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -542,10 +542,10 @@ static void vio_handle_cd_event(struct HvLpEvent *event)
542 /* Notification that a partition went away! */ 542 /* Notification that a partition went away! */
543 return; 543 return;
544 /* First, we should NEVER get an int here...only acks */ 544 /* First, we should NEVER get an int here...only acks */
545 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 545 if (hvlpevent_is_int(event)) {
546 printk(VIOCD_KERN_WARNING 546 printk(VIOCD_KERN_WARNING
547 "Yikes! got an int in viocd event handler!\n"); 547 "Yikes! got an int in viocd event handler!\n");
548 if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { 548 if (hvlpevent_need_ack(event)) {
549 event->xRc = HvLpEvent_Rc_InvalidSubtype; 549 event->xRc = HvLpEvent_Rc_InvalidSubtype;
550 HvCallEvent_ackLpEvent(event); 550 HvCallEvent_ackLpEvent(event);
551 } 551 }
@@ -616,7 +616,7 @@ return_complete:
616 printk(VIOCD_KERN_WARNING 616 printk(VIOCD_KERN_WARNING
617 "message with invalid subtype %0x04X!\n", 617 "message with invalid subtype %0x04X!\n",
618 event->xSubtype & VIOMINOR_SUBTYPE_MASK); 618 event->xSubtype & VIOMINOR_SUBTYPE_MASK);
619 if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { 619 if (hvlpevent_need_ack(event)) {
620 event->xRc = HvLpEvent_Rc_InvalidSubtype; 620 event->xRc = HvLpEvent_Rc_InvalidSubtype;
621 HvCallEvent_ackLpEvent(event); 621 HvCallEvent_ackLpEvent(event);
622 } 622 }
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 704c3c07f0ab..29c41f4418c0 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -534,7 +534,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
534 return virtr + wrote; 534 return virtr + wrote;
535} 535}
536 536
537#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) 537#if defined(CONFIG_ISA) || !defined(__mc68000__)
538static ssize_t read_port(struct file * file, char __user * buf, 538static ssize_t read_port(struct file * file, char __user * buf,
539 size_t count, loff_t *ppos) 539 size_t count, loff_t *ppos)
540{ 540{
@@ -795,7 +795,7 @@ static struct file_operations null_fops = {
795 .write = write_null, 795 .write = write_null,
796}; 796};
797 797
798#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) 798#if defined(CONFIG_ISA) || !defined(__mc68000__)
799static struct file_operations port_fops = { 799static struct file_operations port_fops = {
800 .llseek = memory_lseek, 800 .llseek = memory_lseek,
801 .read = read_port, 801 .read = read_port,
@@ -865,7 +865,7 @@ static int memory_open(struct inode * inode, struct file * filp)
865 case 3: 865 case 3:
866 filp->f_op = &null_fops; 866 filp->f_op = &null_fops;
867 break; 867 break;
868#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) 868#if defined(CONFIG_ISA) || !defined(__mc68000__)
869 case 4: 869 case 4:
870 filp->f_op = &port_fops; 870 filp->f_op = &port_fops;
871 break; 871 break;
@@ -912,7 +912,7 @@ static const struct {
912 {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, 912 {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
913 {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, 913 {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
914 {3, "null", S_IRUGO | S_IWUGO, &null_fops}, 914 {3, "null", S_IRUGO | S_IWUGO, &null_fops},
915#if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) 915#if defined(CONFIG_ISA) || !defined(__mc68000__)
916 {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops}, 916 {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
917#endif 917#endif
918 {5, "zero", S_IRUGO | S_IWUGO, &zero_fops}, 918 {5, "zero", S_IRUGO | S_IWUGO, &zero_fops},
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c
index faee5e7acaf7..4e5360388748 100644
--- a/drivers/char/viocons.c
+++ b/drivers/char/viocons.c
@@ -476,19 +476,19 @@ static struct port_info *get_port_data(struct tty_struct *tty)
476 */ 476 */
477static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp) 477static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp)
478{ 478{
479 struct HvLpEvent *hev = &viochar->event;
480
479 memset(viochar, 0, sizeof(struct viocharlpevent)); 481 memset(viochar, 0, sizeof(struct viocharlpevent));
480 482
481 viochar->event.xFlags.xValid = 1; 483 hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK |
482 viochar->event.xFlags.xFunction = HvLpEvent_Function_Int; 484 HV_LP_EVENT_INT;
483 viochar->event.xFlags.xAckInd = HvLpEvent_AckInd_NoAck; 485 hev->xType = HvLpEvent_Type_VirtualIo;
484 viochar->event.xFlags.xAckType = HvLpEvent_AckType_DeferredAck; 486 hev->xSubtype = viomajorsubtype_chario | viochardata;
485 viochar->event.xType = HvLpEvent_Type_VirtualIo; 487 hev->xSourceLp = HvLpConfig_getLpIndex();
486 viochar->event.xSubtype = viomajorsubtype_chario | viochardata; 488 hev->xTargetLp = lp;
487 viochar->event.xSourceLp = HvLpConfig_getLpIndex(); 489 hev->xSizeMinus1 = sizeof(struct viocharlpevent);
488 viochar->event.xTargetLp = lp; 490 hev->xSourceInstanceId = viopath_sourceinst(lp);
489 viochar->event.xSizeMinus1 = sizeof(struct viocharlpevent); 491 hev->xTargetInstanceId = viopath_targetinst(lp);
490 viochar->event.xSourceInstanceId = viopath_sourceinst(lp);
491 viochar->event.xTargetInstanceId = viopath_targetinst(lp);
492} 492}
493 493
494/* 494/*
@@ -752,7 +752,7 @@ static void vioHandleOpenEvent(struct HvLpEvent *event)
752 struct port_info *pi; 752 struct port_info *pi;
753 int reject = 0; 753 int reject = 0;
754 754
755 if (event->xFlags.xFunction == HvLpEvent_Function_Ack) { 755 if (hvlpevent_is_ack(event)) {
756 if (port >= VTTY_PORTS) 756 if (port >= VTTY_PORTS)
757 return; 757 return;
758 758
@@ -788,7 +788,7 @@ static void vioHandleOpenEvent(struct HvLpEvent *event)
788 } 788 }
789 789
790 /* This had better require an ack, otherwise complain */ 790 /* This had better require an ack, otherwise complain */
791 if (event->xFlags.xAckInd != HvLpEvent_AckInd_DoAck) { 791 if (!hvlpevent_need_ack(event)) {
792 printk(VIOCONS_KERN_WARN "viocharopen without ack bit!\n"); 792 printk(VIOCONS_KERN_WARN "viocharopen without ack bit!\n");
793 return; 793 return;
794 } 794 }
@@ -856,7 +856,7 @@ static void vioHandleCloseEvent(struct HvLpEvent *event)
856 struct viocharlpevent *cevent = (struct viocharlpevent *)event; 856 struct viocharlpevent *cevent = (struct viocharlpevent *)event;
857 u8 port = cevent->virtual_device; 857 u8 port = cevent->virtual_device;
858 858
859 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 859 if (hvlpevent_is_int(event)) {
860 if (port >= VTTY_PORTS) { 860 if (port >= VTTY_PORTS) {
861 printk(VIOCONS_KERN_WARN 861 printk(VIOCONS_KERN_WARN
862 "close message from invalid virtual device.\n"); 862 "close message from invalid virtual device.\n");
@@ -1056,8 +1056,7 @@ static void vioHandleCharEvent(struct HvLpEvent *event)
1056 vioHandleConfig(event); 1056 vioHandleConfig(event);
1057 break; 1057 break;
1058 default: 1058 default:
1059 if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && 1059 if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
1060 (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
1061 event->xRc = HvLpEvent_Rc_InvalidSubtype; 1060 event->xRc = HvLpEvent_Rc_InvalidSubtype;
1062 HvCallEvent_ackLpEvent(event); 1061 HvCallEvent_ackLpEvent(event);
1063 } 1062 }
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index 77eadf84cb2c..f0f04be989d6 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -590,9 +590,9 @@ static void veth_handle_event(struct HvLpEvent *event, struct pt_regs *regs)
590{ 590{
591 struct veth_lpevent *veth_event = (struct veth_lpevent *)event; 591 struct veth_lpevent *veth_event = (struct veth_lpevent *)event;
592 592
593 if (event->xFlags.xFunction == HvLpEvent_Function_Ack) 593 if (hvlpevent_is_ack(event))
594 veth_handle_ack(veth_event); 594 veth_handle_ack(veth_event);
595 else if (event->xFlags.xFunction == HvLpEvent_Function_Int) 595 else
596 veth_handle_int(veth_event); 596 veth_handle_int(veth_event);
597} 597}
598 598
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 8a8393e50774..d5677cbec200 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -64,25 +64,6 @@ extern void iommu_free_table(struct device_node *dn);
64 64
65#endif /* CONFIG_PPC_MULTIPLATFORM */ 65#endif /* CONFIG_PPC_MULTIPLATFORM */
66 66
67#ifdef CONFIG_PPC_PSERIES
68
69/* Creates table for an individual device node */
70extern void iommu_devnode_init_pSeries(struct device_node *dn);
71
72#endif /* CONFIG_PPC_PSERIES */
73
74#ifdef CONFIG_PPC_ISERIES
75
76/* Creates table for an individual device node */
77extern void iommu_devnode_init_iSeries(struct device_node *dn);
78/* Get table parameters from HV */
79extern void iommu_table_getparms_iSeries(unsigned long busno,
80 unsigned char slotno,
81 unsigned char virtbus,
82 struct iommu_table* tbl);
83
84#endif /* CONFIG_PPC_ISERIES */
85
86/* Initializes an iommu_table based in values set in the passed-in 67/* Initializes an iommu_table based in values set in the passed-in
87 * structure 68 * structure
88 */ 69 */
diff --git a/include/asm-powerpc/iseries/hv_call.h b/include/asm-powerpc/iseries/hv_call.h
index e9f831c9a5e5..162d653ad51f 100644
--- a/include/asm-powerpc/iseries/hv_call.h
+++ b/include/asm-powerpc/iseries/hv_call.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCall.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -15,8 +14,7 @@
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * 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
18 */ 17 *
19/*
20 * This file contains the "hypervisor call" interface which is used to 18 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS. 19 * drive the hypervisor from the OS.
22 */ 20 */
diff --git a/include/asm-powerpc/iseries/hv_call_event.h b/include/asm-powerpc/iseries/hv_call_event.h
index 46763a30590a..4cec4762076d 100644
--- a/include/asm-powerpc/iseries/hv_call_event.h
+++ b/include/asm-powerpc/iseries/hv_call_event.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCallEvent.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -15,8 +14,7 @@
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * 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
18 */ 17 *
19/*
20 * This file contains the "hypervisor call" interface which is used to 18 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS. 19 * drive the hypervisor from the OS.
22 */ 20 */
@@ -33,32 +31,9 @@ typedef u8 HvLpEvent_Type;
33typedef u8 HvLpEvent_AckInd; 31typedef u8 HvLpEvent_AckInd;
34typedef u8 HvLpEvent_AckType; 32typedef u8 HvLpEvent_AckType;
35 33
36struct HvCallEvent_PackedParms {
37 u8 xAckType:1;
38 u8 xAckInd:1;
39 u8 xRsvd:1;
40 u8 xTargetLp:5;
41 u8 xType;
42 u16 xSubtype;
43 HvLpInstanceId xSourceInstId;
44 HvLpInstanceId xTargetInstId;
45};
46
47typedef u8 HvLpDma_Direction; 34typedef u8 HvLpDma_Direction;
48typedef u8 HvLpDma_AddressType; 35typedef u8 HvLpDma_AddressType;
49 36
50struct HvCallEvent_PackedDmaParms {
51 u8 xDirection:1;
52 u8 xLocalAddrType:1;
53 u8 xRemoteAddrType:1;
54 u8 xRsvd1:5;
55 HvLpIndex xRemoteLp;
56 u8 xType;
57 u8 xRsvd2;
58 HvLpInstanceId xLocalInstId;
59 HvLpInstanceId xRemoteInstId;
60};
61
62typedef u64 HvLpEvent_Rc; 37typedef u64 HvLpEvent_Rc;
63typedef u64 HvLpDma_Rc; 38typedef u64 HvLpDma_Rc;
64 39
@@ -92,11 +67,8 @@ static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
92static inline void HvCallEvent_setLpEventStack(u8 queueIndex, 67static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
93 char *eventStackAddr, u32 eventStackSize) 68 char *eventStackAddr, u32 eventStackSize)
94{ 69{
95 u64 abs_addr; 70 HvCall3(HvCallEventSetLpEventStack, queueIndex,
96 71 virt_to_abs(eventStackAddr), eventStackSize);
97 abs_addr = virt_to_abs(eventStackAddr);
98 HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr,
99 eventStackSize);
100} 72}
101 73
102static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, 74static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
@@ -108,14 +80,7 @@ static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
108 80
109static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) 81static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
110{ 82{
111 u64 abs_addr; 83 return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event));
112
113#ifdef DEBUG_SENDEVENT
114 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ",
115 (unsigned long)event);
116#endif
117 abs_addr = virt_to_abs(event);
118 return HvCall1(HvCallEventSignalLpEvent, abs_addr);
119} 84}
120 85
121static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, 86static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
@@ -127,17 +92,21 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
127{ 92{
128 /* Pack the misc bits into a single Dword to pass to PLIC */ 93 /* Pack the misc bits into a single Dword to pass to PLIC */
129 union { 94 union {
130 struct HvCallEvent_PackedParms parms; 95 struct {
96 u8 ack_and_target;
97 u8 type;
98 u16 subtype;
99 HvLpInstanceId src_inst;
100 HvLpInstanceId target_inst;
101 } parms;
131 u64 dword; 102 u64 dword;
132 } packed; 103 } packed;
133 packed.parms.xAckType = ackType; 104
134 packed.parms.xAckInd = ackInd; 105 packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp;
135 packed.parms.xRsvd = 0; 106 packed.parms.type = type;
136 packed.parms.xTargetLp = targetLp; 107 packed.parms.subtype = subtype;
137 packed.parms.xType = type; 108 packed.parms.src_inst = sourceInstanceId;
138 packed.parms.xSubtype = subtype; 109 packed.parms.target_inst = targetInstanceId;
139 packed.parms.xSourceInstId = sourceInstanceId;
140 packed.parms.xTargetInstId = targetInstanceId;
141 110
142 return HvCall7(HvCallEventSignalLpEventParms, packed.dword, 111 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
143 correlationToken, eventData1, eventData2, 112 correlationToken, eventData1, eventData2,
@@ -146,18 +115,12 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
146 115
147static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) 116static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
148{ 117{
149 u64 abs_addr; 118 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
150
151 abs_addr = virt_to_abs(event);
152 return HvCall1(HvCallEventAckLpEvent, abs_addr);
153} 119}
154 120
155static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) 121static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
156{ 122{
157 u64 abs_addr; 123 return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event));
158
159 abs_addr = virt_to_abs(event);
160 return HvCall1(HvCallEventCancelLpEvent, abs_addr);
161} 124}
162 125
163static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( 126static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
@@ -195,59 +158,34 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
195{ 158{
196 /* Pack the misc bits into a single Dword to pass to PLIC */ 159 /* Pack the misc bits into a single Dword to pass to PLIC */
197 union { 160 union {
198 struct HvCallEvent_PackedDmaParms parms; 161 struct {
162 u8 flags;
163 HvLpIndex remote;
164 u8 type;
165 u8 reserved;
166 HvLpInstanceId local_inst;
167 HvLpInstanceId remote_inst;
168 } parms;
199 u64 dword; 169 u64 dword;
200 } packed; 170 } packed;
201 171
202 packed.parms.xDirection = direction; 172 packed.parms.flags = (direction << 7) |
203 packed.parms.xLocalAddrType = localAddressType; 173 (localAddressType << 6) | (remoteAddressType << 5);
204 packed.parms.xRemoteAddrType = remoteAddressType; 174 packed.parms.remote = remoteLp;
205 packed.parms.xRsvd1 = 0; 175 packed.parms.type = type;
206 packed.parms.xRemoteLp = remoteLp; 176 packed.parms.reserved = 0;
207 packed.parms.xType = type; 177 packed.parms.local_inst = localInstanceId;
208 packed.parms.xRsvd2 = 0; 178 packed.parms.remote_inst = remoteInstanceId;
209 packed.parms.xLocalInstId = localInstanceId;
210 packed.parms.xRemoteInstId = remoteInstanceId;
211 179
212 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList, 180 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
213 remoteBufList, transferLength); 181 remoteBufList, transferLength);
214} 182}
215 183
216static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
217 HvLpIndex remoteLp, HvLpDma_Direction direction,
218 HvLpInstanceId localInstanceId,
219 HvLpInstanceId remoteInstanceId,
220 HvLpDma_AddressType localAddressType,
221 HvLpDma_AddressType remoteAddressType,
222 u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength)
223{
224 /* Pack the misc bits into a single Dword to pass to PLIC */
225 union {
226 struct HvCallEvent_PackedDmaParms parms;
227 u64 dword;
228 } packed;
229
230 packed.parms.xDirection = direction;
231 packed.parms.xLocalAddrType = localAddressType;
232 packed.parms.xRemoteAddrType = remoteAddressType;
233 packed.parms.xRsvd1 = 0;
234 packed.parms.xRemoteLp = remoteLp;
235 packed.parms.xType = type;
236 packed.parms.xRsvd2 = 0;
237 packed.parms.xLocalInstId = localInstanceId;
238 packed.parms.xRemoteInstId = remoteInstanceId;
239
240 return (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, packed.dword,
241 localAddrOrTce, remoteAddrOrTce, transferLength);
242}
243
244static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, 184static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
245 u32 length, HvLpDma_Direction dir) 185 u32 length, HvLpDma_Direction dir)
246{ 186{
247 u64 abs_addr; 187 return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote,
248 188 length, dir);
249 abs_addr = virt_to_abs(local);
250 return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir);
251} 189}
252 190
253#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */ 191#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */
diff --git a/include/asm-powerpc/iseries/hv_call_sc.h b/include/asm-powerpc/iseries/hv_call_sc.h
index dec7e9d9ab78..f5d210959250 100644
--- a/include/asm-powerpc/iseries/hv_call_sc.h
+++ b/include/asm-powerpc/iseries/hv_call_sc.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCallSc.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h
index bc00f036bca0..df8b20739719 100644
--- a/include/asm-powerpc/iseries/hv_lp_config.h
+++ b/include/asm-powerpc/iseries/hv_lp_config.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvLpConfig.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-powerpc/iseries/hv_lp_event.h b/include/asm-powerpc/iseries/hv_lp_event.h
index 499ab1ad0185..4065a4de4935 100644
--- a/include/asm-powerpc/iseries/hv_lp_event.h
+++ b/include/asm-powerpc/iseries/hv_lp_event.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvLpEvent.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -32,17 +31,8 @@
32 * partitions through PLIC. 31 * partitions through PLIC.
33 */ 32 */
34 33
35struct HvEventFlags {
36 u8 xValid:1; /* Indicates a valid request x00-x00 */
37 u8 xRsvd1:4; /* Reserved ... */
38 u8 xAckType:1; /* Immediate or deferred ... */
39 u8 xAckInd:1; /* Indicates if ACK required ... */
40 u8 xFunction:1; /* Interrupt or Acknowledge ... */
41};
42
43
44struct HvLpEvent { 34struct HvLpEvent {
45 struct HvEventFlags xFlags; /* Event flags x00-x00 */ 35 u8 flags; /* Event flags x00-x00 */
46 u8 xType; /* Type of message x01-x01 */ 36 u8 xType; /* Type of message x01-x01 */
47 u16 xSubtype; /* Subtype for event x02-x03 */ 37 u16 xSubtype; /* Subtype for event x02-x03 */
48 u8 xSourceLp; /* Source LP x04-x04 */ 38 u8 xSourceLp; /* Source LP x04-x04 */
@@ -126,6 +116,11 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
126#define HvLpEvent_AckType_ImmediateAck 0 116#define HvLpEvent_AckType_ImmediateAck 0
127#define HvLpEvent_AckType_DeferredAck 1 117#define HvLpEvent_AckType_DeferredAck 1
128 118
119#define HV_LP_EVENT_INT 0x01
120#define HV_LP_EVENT_DO_ACK 0x02
121#define HV_LP_EVENT_DEFERRED_ACK 0x04
122#define HV_LP_EVENT_VALID 0x80
123
129#define HvLpDma_Direction_LocalToRemote 0 124#define HvLpDma_Direction_LocalToRemote 0
130#define HvLpDma_Direction_RemoteToLocal 1 125#define HvLpDma_Direction_RemoteToLocal 1
131 126
@@ -139,4 +134,29 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
139#define HvLpDma_Rc_InvalidAddress 4 134#define HvLpDma_Rc_InvalidAddress 4
140#define HvLpDma_Rc_InvalidLength 5 135#define HvLpDma_Rc_InvalidLength 5
141 136
137static inline int hvlpevent_is_valid(struct HvLpEvent *h)
138{
139 return h->flags & HV_LP_EVENT_VALID;
140}
141
142static inline void hvlpevent_invalidate(struct HvLpEvent *h)
143{
144 h->flags &= ~ HV_LP_EVENT_VALID;
145}
146
147static inline int hvlpevent_is_int(struct HvLpEvent *h)
148{
149 return h->flags & HV_LP_EVENT_INT;
150}
151
152static inline int hvlpevent_is_ack(struct HvLpEvent *h)
153{
154 return !hvlpevent_is_int(h);
155}
156
157static inline int hvlpevent_need_ack(struct HvLpEvent *h)
158{
159 return h->flags & HV_LP_EVENT_DO_ACK;
160}
161
142#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */ 162#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */
diff --git a/include/asm-powerpc/iseries/hv_types.h b/include/asm-powerpc/iseries/hv_types.h
index c38f7e3d01dc..c3e6d2a1d1c3 100644
--- a/include/asm-powerpc/iseries/hv_types.h
+++ b/include/asm-powerpc/iseries/hv_types.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvTypes.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h
index 56b2113ff0f5..496aa852b617 100644
--- a/include/asm-powerpc/iseries/iseries_io.h
+++ b/include/asm-powerpc/iseries/iseries_io.h
@@ -6,7 +6,7 @@
6#ifdef CONFIG_PPC_ISERIES 6#ifdef CONFIG_PPC_ISERIES
7#include <linux/types.h> 7#include <linux/types.h>
8/* 8/*
9 * File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. 9 * Created by Allan Trautman on Thu Dec 28 2000.
10 * 10 *
11 * Remaps the io.h for the iSeries Io 11 * Remaps the io.h for the iSeries Io
12 * Copyright (C) 2000 Allan H Trautman, IBM Corporation 12 * Copyright (C) 2000 Allan H Trautman, IBM Corporation
@@ -32,6 +32,7 @@
32 * End Change Activity 32 * End Change Activity
33 */ 33 */
34 34
35#ifdef CONFIG_PCI
35extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); 36extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
36extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); 37extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
37extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); 38extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
@@ -44,6 +45,17 @@ extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
44 size_t n); 45 size_t n);
45extern void iSeries_memcpy_fromio(void *dest, 46extern void iSeries_memcpy_fromio(void *dest,
46 const volatile void __iomem *source, size_t n); 47 const volatile void __iomem *source, size_t n);
48#else
49static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
50{
51 return 0xff;
52}
53
54static inline void iSeries_Write_Byte(u8 IoData,
55 volatile void __iomem *IoAddress)
56{
57}
58#endif /* CONFIG_PCI */
47 59
48#endif /* CONFIG_PPC_ISERIES */ 60#endif /* CONFIG_PPC_ISERIES */
49#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */ 61#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
diff --git a/include/asm-powerpc/iseries/it_exp_vpd_panel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
index 66a17a230c52..304a609ae21a 100644
--- a/include/asm-powerpc/iseries/it_exp_vpd_panel.h
+++ b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItExtVpdPanel.h
3 * Copyright (C) 2002 Dave Boutcher IBM Corporation 2 * Copyright (C) 2002 Dave Boutcher IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-powerpc/iseries/it_lp_naca.h b/include/asm-powerpc/iseries/it_lp_naca.h
index c3ef1de45d82..4fdcf052927f 100644
--- a/include/asm-powerpc/iseries/it_lp_naca.h
+++ b/include/asm-powerpc/iseries/it_lp_naca.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpNaca.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -37,17 +36,13 @@ struct ItLpNaca {
37 u8 xLpIndex; // LP Index x0B-x0B 36 u8 xLpIndex; // LP Index x0B-x0B
38 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D 37 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D
39 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F 38 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F
40 u8 xPirEnvironMode:8; // Piranha or hardware x10-x10 39 u8 xPirEnvironMode; // Piranha or hardware x10-x10
41 u8 xPirConsoleMode:8; // Piranha console indicator x11-x11 40 u8 xPirConsoleMode; // Piranha console indicator x11-x11
42 u8 xPirDasdMode:8; // Piranha dasd indicator x12-x12 41 u8 xPirDasdMode; // Piranha dasd indicator x12-x12
43 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 42 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17
44 u8 xLparInstalled:1; // Is LPAR installed on system x18-x1F 43 u8 flags; // flags, see below x18-x1F
45 u8 xSysPartitioned:1; // Is the system partitioned ... 44 u8 xSpVpdFormat; // VPD areas are in CSP format ...
46 u8 xHwSyncedTBs:1; // Hardware synced TBs ... 45 u8 xIntProcRatio; // Ratio of int procs to procs ...
47 u8 xIntProcUtilHmt:1; // Utilize HMT for interrupts ...
48 u8 xRsvd1_1:4; // Reserved ...
49 u8 xSpVpdFormat:8; // VPD areas are in CSP format ...
50 u8 xIntProcRatio:8; // Ratio of int procs to procs ...
51 u8 xRsvd1_2[5]; // Reserved ... 46 u8 xRsvd1_2[5]; // Reserved ...
52 u16 xRsvd1_3; // Reserved x20-x21 47 u16 xRsvd1_3; // Reserved x20-x21
53 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 48 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23
@@ -77,4 +72,9 @@ struct ItLpNaca {
77 72
78extern struct ItLpNaca itLpNaca; 73extern struct ItLpNaca itLpNaca;
79 74
75#define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */
76#define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */
77#define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */
78#define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */
79
80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */ 80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h
index a60d03afbf95..b7c6fc12cce2 100644
--- a/include/asm-powerpc/iseries/it_lp_queue.h
+++ b/include/asm-powerpc/iseries/it_lp_queue.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpQueue.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-powerpc/iseries/it_lp_reg_save.h b/include/asm-powerpc/iseries/it_lp_reg_save.h
index 81824e1bb767..5403b756f654 100644
--- a/include/asm-powerpc/iseries/it_lp_reg_save.h
+++ b/include/asm-powerpc/iseries/it_lp_reg_save.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpRegSave.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -83,4 +82,4 @@ struct ItLpRegSave {
83 82
84extern struct ItLpRegSave iseries_reg_save[]; 83extern struct ItLpRegSave iseries_reg_save[];
85 84
86#endif /* _ITLPREGSAVE_H */ 85#endif /* _ASM_POWERPC_ISERIES_IT_LP_REG_SAVE_H */
diff --git a/include/asm-powerpc/iseries/lpar_map.h b/include/asm-powerpc/iseries/lpar_map.h
index 84fc321615bf..2ec384d66abb 100644
--- a/include/asm-powerpc/iseries/lpar_map.h
+++ b/include/asm-powerpc/iseries/lpar_map.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * LparMap.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h
index e7bd57a03fb1..857e5202fc78 100644
--- a/include/asm-powerpc/iseries/mf.h
+++ b/include/asm-powerpc/iseries/mf.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * mf.h
3 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation 2 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation
4 * Copyright (C) 2004 Stephen Rothwell IBM Corporation 3 * Copyright (C) 2004 Stephen Rothwell IBM Corporation
5 * 4 *
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h
index 7e3a469420dd..72a97d37aac3 100644
--- a/include/asm-powerpc/iseries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -1,5 +1,4 @@
1/* -*- linux-c -*- 1/* -*- linux-c -*-
2 * drivers/char/vio.h
3 * 2 *
4 * iSeries Virtual I/O Message Path header 3 * iSeries Virtual I/O Message Path header
5 * 4 *
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index b0d816fe2e27..38de92d41a14 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -142,8 +142,6 @@ void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus);
142 142
143extern int pcibios_remove_root_bus(struct pci_controller *phb); 143extern int pcibios_remove_root_bus(struct pci_controller *phb);
144 144
145extern void phbs_remap_io(void);
146
147static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) 145static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
148{ 146{
149 struct device_node *busdn = bus->sysdata; 147 struct device_node *busdn = bus->sysdata;
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 1be629b4fb97..9b822afa7d0e 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -133,6 +133,14 @@ extern int fix_alignment(struct pt_regs *);
133extern void cvt_fd(float *from, double *to, struct thread_struct *thread); 133extern void cvt_fd(float *from, double *to, struct thread_struct *thread);
134extern void cvt_df(double *from, float *to, struct thread_struct *thread); 134extern void cvt_df(double *from, float *to, struct thread_struct *thread);
135 135
136#ifndef CONFIG_SMP
137extern void discard_lazy_cpu_state(void);
138#else
139static inline void discard_lazy_cpu_state(void)
140{
141}
142#endif
143
136#ifdef CONFIG_ALTIVEC 144#ifdef CONFIG_ALTIVEC
137extern void flush_altivec_to_thread(struct task_struct *); 145extern void flush_altivec_to_thread(struct task_struct *);
138#else 146#else
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index 212dca66fcac..fb49c0c49ea1 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -4,7 +4,6 @@
4#ifndef __PPC_SYSTEM_H 4#ifndef __PPC_SYSTEM_H
5#define __PPC_SYSTEM_H 5#define __PPC_SYSTEM_H
6 6
7#include <linux/config.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9 8
10#include <asm/atomic.h> 9#include <asm/atomic.h>
@@ -39,7 +38,7 @@
39#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
40#define smp_mb() mb() 39#define smp_mb() mb()
41#define smp_rmb() rmb() 40#define smp_rmb() rmb()
42#define smp_wmb() wmb() 41#define smp_wmb() __asm__ __volatile__ ("eieio" : : : "memory")
43#define smp_read_barrier_depends() read_barrier_depends() 42#define smp_read_barrier_depends() read_barrier_depends()
44#else 43#else
45#define smp_mb() barrier() 44#define smp_mb() barrier()
@@ -74,6 +73,7 @@ extern void chrp_nvram_init(void);
74extern void read_rtc_time(void); 73extern void read_rtc_time(void);
75extern void pmac_find_display(void); 74extern void pmac_find_display(void);
76extern void giveup_fpu(struct task_struct *); 75extern void giveup_fpu(struct task_struct *);
76extern void disable_kernel_fp(void);
77extern void enable_kernel_fp(void); 77extern void enable_kernel_fp(void);
78extern void flush_fp_to_thread(struct task_struct *); 78extern void flush_fp_to_thread(struct task_struct *);
79extern void enable_kernel_altivec(void); 79extern void enable_kernel_altivec(void);
@@ -86,6 +86,14 @@ extern int fix_alignment(struct pt_regs *);
86extern void cvt_fd(float *from, double *to, struct thread_struct *thread); 86extern void cvt_fd(float *from, double *to, struct thread_struct *thread);
87extern void cvt_df(double *from, float *to, struct thread_struct *thread); 87extern void cvt_df(double *from, float *to, struct thread_struct *thread);
88 88
89#ifndef CONFIG_SMP
90extern void discard_lazy_cpu_state(void);
91#else
92static inline void discard_lazy_cpu_state(void)
93{
94}
95#endif
96
89#ifdef CONFIG_ALTIVEC 97#ifdef CONFIG_ALTIVEC
90extern void flush_altivec_to_thread(struct task_struct *); 98extern void flush_altivec_to_thread(struct task_struct *);
91#else 99#else