aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@men-an-tol.chygwyn.com>2006-02-23 04:49:43 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-23 04:49:43 -0500
commitd35462b4bb847b68321c55e95c926aa485aecce2 (patch)
treeb08e18bf6e672633402871ee763102fdb5e63229 /arch/mips
parent91ffd7db71e7451f89941a8f428b4daa2a7c1e38 (diff)
parent9e956c2dac9bec602ed1ba29181b45ba6d2b6448 (diff)
Merge branch 'master'
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/Makefile26
-rw-r--r--arch/mips/au1000/common/reset.c2
-rw-r--r--arch/mips/au1000/common/setup.c3
-rw-r--r--arch/mips/cobalt/int-handler.S2
-rw-r--r--arch/mips/cobalt/irq.c2
-rw-r--r--arch/mips/cobalt/reset.c2
-rw-r--r--arch/mips/cobalt/setup.c9
-rw-r--r--arch/mips/configs/ip27_defconfig13
-rw-r--r--arch/mips/configs/ip32_defconfig1
-rw-r--r--arch/mips/configs/qemu_defconfig78
-rw-r--r--arch/mips/ddb5xxx/ddb5074/setup.c3
-rw-r--r--arch/mips/ddb5xxx/ddb5476/setup.c3
-rw-r--r--arch/mips/ddb5xxx/ddb5477/setup.c3
-rw-r--r--arch/mips/dec/setup.c3
-rw-r--r--arch/mips/gt64120/ev64120/setup.c4
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c6
-rw-r--r--arch/mips/ite-boards/generic/it8172_setup.c3
-rw-r--r--arch/mips/jazz/setup.c4
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c3
-rw-r--r--arch/mips/kernel/binfmt_elfn32.c5
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c5
-rw-r--r--arch/mips/kernel/cpu-probe.c7
-rw-r--r--arch/mips/kernel/gdb-stub.c2
-rw-r--r--arch/mips/kernel/genex.S2
-rw-r--r--arch/mips/kernel/linux32.c22
-rw-r--r--arch/mips/kernel/process.c163
-rw-r--r--arch/mips/kernel/ptrace32.c22
-rw-r--r--arch/mips/kernel/reset.c18
-rw-r--r--arch/mips/kernel/rtlx.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S17
-rw-r--r--arch/mips/kernel/scall64-64.S17
-rw-r--r--arch/mips/kernel/scall64-n32.S21
-rw-r--r--arch/mips/kernel/scall64-o32.S17
-rw-r--r--arch/mips/kernel/signal-common.h8
-rw-r--r--arch/mips/kernel/signal.c104
-rw-r--r--arch/mips/kernel/signal32.c143
-rw-r--r--arch/mips/kernel/signal_n32.c49
-rw-r--r--arch/mips/kernel/smp.c20
-rw-r--r--arch/mips/kernel/smp_mt.c34
-rw-r--r--arch/mips/kernel/syscall.c48
-rw-r--r--arch/mips/kernel/traps.c6
-rw-r--r--arch/mips/kernel/vmlinux.lds.S11
-rw-r--r--arch/mips/lasat/reset.c5
-rw-r--r--arch/mips/lasat/setup.c4
-rw-r--r--arch/mips/lib-32/dump_tlb.c33
-rw-r--r--arch/mips/math-emu/dp_simple.c14
-rw-r--r--arch/mips/math-emu/sp_simple.c14
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c4
-rw-r--r--arch/mips/mips-boards/generic/reset.c5
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c4
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c4
-rw-r--r--arch/mips/mm/c-r4k.c111
-rw-r--r--arch/mips/mm/c-tx39.c70
-rw-r--r--arch/mips/mm/cache.c5
-rw-r--r--arch/mips/mm/cex-sb1.S2
-rw-r--r--arch/mips/mm/init.c16
-rw-r--r--arch/mips/momentum/jaguar_atx/ja-console.c2
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c3
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c4
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c4
-rw-r--r--arch/mips/momentum/ocelot_g/setup.c4
-rw-r--r--arch/mips/oprofile/Makefile1
-rw-r--r--arch/mips/oprofile/common.c3
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c11
-rw-r--r--arch/mips/pci/Makefile1
-rw-r--r--arch/mips/pci/fixup-cobalt.c6
-rw-r--r--arch/mips/pci/ops-gt64111.c2
-rw-r--r--arch/mips/pci/pci-bcm1480.c2
-rw-r--r--arch/mips/philips/pnx8550/common/platform.c8
-rw-r--r--arch/mips/philips/pnx8550/common/setup.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c2
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c55
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c10
-rw-r--r--arch/mips/sgi-ip27/ip27-reset.c5
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c3
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c13
-rw-r--r--arch/mips/sibyte/Kconfig4
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c5
-rw-r--r--arch/mips/sibyte/cfe/setup.c3
-rw-r--r--arch/mips/sibyte/sb1250/prom.c3
-rw-r--r--arch/mips/sibyte/sb1250/setup.c36
-rw-r--r--arch/mips/sni/setup.c5
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c10
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c140
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c4
-rw-r--r--arch/mips/vr41xx/common/pmu.c3
89 files changed, 849 insertions, 718 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c3e852e9953e..767de847b4ab 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -595,6 +595,7 @@ config SGI_IP32
595 select SYS_HAS_CPU_R5000 595 select SYS_HAS_CPU_R5000
596 select SYS_HAS_CPU_R10000 if BROKEN 596 select SYS_HAS_CPU_R10000 if BROKEN
597 select SYS_HAS_CPU_RM7000 597 select SYS_HAS_CPU_RM7000
598 select SYS_HAS_CPU_NEVADA
598 select SYS_SUPPORTS_64BIT_KERNEL 599 select SYS_SUPPORTS_64BIT_KERNEL
599 select SYS_SUPPORTS_BIG_ENDIAN 600 select SYS_SUPPORTS_BIG_ENDIAN
600 help 601 help
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 2a9f2ef27b29..38c0f3360d51 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -53,14 +53,17 @@ CROSS_COMPILE := $(tool-prefix)
53endif 53endif
54 54
55CHECKFLAGS-y += -D__linux__ -D__mips__ \ 55CHECKFLAGS-y += -D__linux__ -D__mips__ \
56 -D_MIPS_SZINT=32 \
56 -D_ABIO32=1 \ 57 -D_ABIO32=1 \
57 -D_ABIN32=2 \ 58 -D_ABIN32=2 \
58 -D_ABI64=3 59 -D_ABI64=3
59CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \ 60CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \
60 -D_MIPS_SZLONG=32 \ 61 -D_MIPS_SZLONG=32 \
62 -D_MIPS_SZPTR=32 \
61 -D__PTRDIFF_TYPE__=int 63 -D__PTRDIFF_TYPE__=int
62CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \ 64CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \
63 -D_MIPS_SZLONG=64 \ 65 -D_MIPS_SZLONG=64 \
66 -D_MIPS_SZPTR=64 \
64 -D__PTRDIFF_TYPE__="long int" 67 -D__PTRDIFF_TYPE__="long int"
65CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__ 68CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__
66CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__ 69CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__
@@ -91,7 +94,6 @@ endif
91# machines may also. Since BFD is incredibly buggy with respect to 94# machines may also. Since BFD is incredibly buggy with respect to
92# crossformat linking we rely on the elf2ecoff tool for format conversion. 95# crossformat linking we rely on the elf2ecoff tool for format conversion.
93# 96#
94cflags-y += -I $(TOPDIR)/include/asm/gcc
95cflags-y += -G 0 -mno-abicalls -fno-pic -pipe 97cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
96LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 98LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
97MODFLAGS += -mlong-calls 99MODFLAGS += -mlong-calls
@@ -166,79 +168,97 @@ echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_i
166# 168#
167cflags-$(CONFIG_CPU_R3000) += \ 169cflags-$(CONFIG_CPU_R3000) += \
168 $(call set_gccflags,r3000,mips1,r3000,mips1,mips1) 170 $(call set_gccflags,r3000,mips1,r3000,mips1,mips1)
171CHECKFLAGS-$(CONFIG_CPU_R3000) += -D_MIPS_ISA=_MIPS_ISA_MIPS1
169 172
170cflags-$(CONFIG_CPU_TX39XX) += \ 173cflags-$(CONFIG_CPU_TX39XX) += \
171 $(call set_gccflags,r3900,mips1,r3000,mips1,mips1) 174 $(call set_gccflags,r3900,mips1,r3000,mips1,mips1)
175CHECKFLAGS-$(CONFIG_CPU_TX39XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS1
172 176
173cflags-$(CONFIG_CPU_R6000) += \ 177cflags-$(CONFIG_CPU_R6000) += \
174 $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \ 178 $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \
175 -Wa,--trap 179 -Wa,--trap
180CHECKFLAGS-$(CONFIG_CPU_R6000) += -D_MIPS_ISA=_MIPS_ISA_MIPS2
176 181
177cflags-$(CONFIG_CPU_R4300) += \ 182cflags-$(CONFIG_CPU_R4300) += \
178 $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \ 183 $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \
179 -Wa,--trap 184 -Wa,--trap
185CHECKFLAGS-$(CONFIG_CPU_R4300) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
180 186
181cflags-$(CONFIG_CPU_VR41XX) += \ 187cflags-$(CONFIG_CPU_VR41XX) += \
182 $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \ 188 $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \
183 -Wa,--trap 189 -Wa,--trap
190CHECKFLAGS-$(CONFIG_CPU_VR41XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
184 191
185cflags-$(CONFIG_CPU_R4X00) += \ 192cflags-$(CONFIG_CPU_R4X00) += \
186 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ 193 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
187 -Wa,--trap 194 -Wa,--trap
195CHECKFLAGS-$(CONFIG_CPU_R4X00) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
188 196
189cflags-$(CONFIG_CPU_TX49XX) += \ 197cflags-$(CONFIG_CPU_TX49XX) += \
190 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ 198 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
191 -Wa,--trap 199 -Wa,--trap
200CHECKFLAGS-$(CONFIG_CPU_TX49XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
192 201
193cflags-$(CONFIG_CPU_MIPS32_R1) += \ 202cflags-$(CONFIG_CPU_MIPS32_R1) += \
194 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \ 203 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
195 -Wa,--trap 204 -Wa,--trap
205CHECKFLAGS-$(CONFIG_CPU_MIPS32_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS32
196 206
197cflags-$(CONFIG_CPU_MIPS32_R2) += \ 207cflags-$(CONFIG_CPU_MIPS32_R2) += \
198 $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \ 208 $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \
199 -Wa,--trap 209 -Wa,--trap
210CHECKFLAGS-$(CONFIG_CPU_MIPS32_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS32
200 211
201cflags-$(CONFIG_CPU_MIPS64_R1) += \ 212cflags-$(CONFIG_CPU_MIPS64_R1) += \
202 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \ 213 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
203 -Wa,--trap 214 -Wa,--trap
215CHECKFLAGS-$(CONFIG_CPU_MIPS64_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
204 216
205cflags-$(CONFIG_CPU_MIPS64_R2) += \ 217cflags-$(CONFIG_CPU_MIPS64_R2) += \
206 $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \ 218 $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \
207 -Wa,--trap 219 -Wa,--trap
220CHECKFLAGS-$(CONFIG_CPU_MIPS64_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
208 221
209cflags-$(CONFIG_CPU_R5000) += \ 222cflags-$(CONFIG_CPU_R5000) += \
210 $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \ 223 $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \
211 -Wa,--trap 224 -Wa,--trap
225CHECKFLAGS-$(CONFIG_CPU_R5000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
212 226
213cflags-$(CONFIG_CPU_R5432) += \ 227cflags-$(CONFIG_CPU_R5432) += \
214 $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \ 228 $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \
215 -Wa,--trap 229 -Wa,--trap
230CHECKFLAGS-$(CONFIG_CPU_R5432) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
216 231
217cflags-$(CONFIG_CPU_NEVADA) += \ 232cflags-$(CONFIG_CPU_NEVADA) += \
218 $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \ 233 $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \
219 -Wa,--trap 234 -Wa,--trap
220# $(call cc-option,-mmad) 235CHECKFLAGS-$(CONFIG_CPU_NEVADA) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
221 236
222cflags-$(CONFIG_CPU_RM7000) += \ 237cflags-$(CONFIG_CPU_RM7000) += \
223 $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \ 238 $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \
224 -Wa,--trap 239 -Wa,--trap
240CHECKFLAGS-$(CONFIG_CPU_RM7000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
225 241
226cflags-$(CONFIG_CPU_RM9000) += \ 242cflags-$(CONFIG_CPU_RM9000) += \
227 $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \ 243 $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \
228 -Wa,--trap 244 -Wa,--trap
245CHECKFLAGS-$(CONFIG_CPU_RM9000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
229 246
230 247
231cflags-$(CONFIG_CPU_SB1) += \ 248cflags-$(CONFIG_CPU_SB1) += \
232 $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \ 249 $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \
233 -Wa,--trap 250 -Wa,--trap
251CHECKFLAGS-$(CONFIG_CPU_SB1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
234 252
235cflags-$(CONFIG_CPU_R8000) += \ 253cflags-$(CONFIG_CPU_R8000) += \
236 $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \ 254 $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \
237 -Wa,--trap 255 -Wa,--trap
256CHECKFLAGS-$(CONFIG_CPU_R8000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
238 257
239cflags-$(CONFIG_CPU_R10000) += \ 258cflags-$(CONFIG_CPU_R10000) += \
240 $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \ 259 $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \
241 -Wa,--trap 260 -Wa,--trap
261CHECKFLAGS-$(CONFIG_CPU_R10000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
242 262
243ifdef CONFIG_CPU_SB1 263ifdef CONFIG_CPU_SB1
244ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 264ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
@@ -369,7 +389,7 @@ load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
369# Cobalt Server 389# Cobalt Server
370# 390#
371core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/ 391core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/
372cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/cobalt 392cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/mach-cobalt
373load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000 393load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
374 394
375# 395#
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c
index 65b84db800e4..4ffccedf5967 100644
--- a/arch/mips/au1000/common/reset.c
+++ b/arch/mips/au1000/common/reset.c
@@ -151,7 +151,7 @@ void au1000_restart(char *command)
151 } 151 }
152 152
153 set_c0_status(ST0_BEV | ST0_ERL); 153 set_c0_status(ST0_BEV | ST0_ERL);
154 set_c0_config(CONF_CM_UNCACHED); 154 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
155 flush_cache_all(); 155 flush_cache_all();
156 write_c0_wired(0); 156 write_c0_wired(0);
157 157
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 08c8c855cc9c..eb155c071aa6 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -33,6 +33,7 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/pm.h>
36 37
37#include <asm/cpu.h> 38#include <asm/cpu.h>
38#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
@@ -125,7 +126,7 @@ void __init plat_setup(void)
125#endif 126#endif
126 _machine_restart = au1000_restart; 127 _machine_restart = au1000_restart;
127 _machine_halt = au1000_halt; 128 _machine_halt = au1000_halt;
128 _machine_power_off = au1000_power_off; 129 pm_power_off = au1000_power_off;
129 board_time_init = au1xxx_time_init; 130 board_time_init = au1xxx_time_init;
130 board_timer_setup = au1xxx_timer_setup; 131 board_timer_setup = au1xxx_timer_setup;
131 132
diff --git a/arch/mips/cobalt/int-handler.S b/arch/mips/cobalt/int-handler.S
index f92608e8d84f..e75d5e3ca868 100644
--- a/arch/mips/cobalt/int-handler.S
+++ b/arch/mips/cobalt/int-handler.S
@@ -8,7 +8,7 @@
8 */ 8 */
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/mipsregs.h> 10#include <asm/mipsregs.h>
11#include <asm/cobalt/cobalt.h> 11#include <asm/mach-cobalt/cobalt.h>
12#include <asm/regdef.h> 12#include <asm/regdef.h>
13#include <asm/stackframe.h> 13#include <asm/stackframe.h>
14 14
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
index 0d90851f925e..f9a108820d6e 100644
--- a/arch/mips/cobalt/irq.c
+++ b/arch/mips/cobalt/irq.c
@@ -18,7 +18,7 @@
18#include <asm/gt64120.h> 18#include <asm/gt64120.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20 20
21#include <asm/cobalt/cobalt.h> 21#include <asm/mach-cobalt/cobalt.h>
22 22
23extern void cobalt_handle_int(void); 23extern void cobalt_handle_int(void);
24 24
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c
index 805a0e88507b..753dfccae6fa 100644
--- a/arch/mips/cobalt/reset.c
+++ b/arch/mips/cobalt/reset.c
@@ -16,7 +16,7 @@
16#include <asm/reboot.h> 16#include <asm/reboot.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/cobalt/cobalt.h> 19#include <asm/mach-cobalt/cobalt.h>
20 20
21void cobalt_machine_halt(void) 21void cobalt_machine_halt(void)
22{ 22{
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index d358a118fa31..b9713a723053 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 1997, 2004, 05 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv) 9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10 * 10 *
11 */ 11 */
@@ -13,6 +13,7 @@
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pm.h>
16#include <linux/serial.h> 17#include <linux/serial.h>
17#include <linux/serial_core.h> 18#include <linux/serial_core.h>
18 19
@@ -25,7 +26,7 @@
25#include <asm/gt64120.h> 26#include <asm/gt64120.h>
26#include <asm/serial.h> 27#include <asm/serial.h>
27 28
28#include <asm/cobalt/cobalt.h> 29#include <asm/mach-cobalt/cobalt.h>
29 30
30extern void cobalt_machine_restart(char *command); 31extern void cobalt_machine_restart(char *command);
31extern void cobalt_machine_halt(void); 32extern void cobalt_machine_halt(void);
@@ -99,7 +100,7 @@ void __init plat_setup(void)
99 100
100 _machine_restart = cobalt_machine_restart; 101 _machine_restart = cobalt_machine_restart;
101 _machine_halt = cobalt_machine_halt; 102 _machine_halt = cobalt_machine_halt;
102 _machine_power_off = cobalt_machine_power_off; 103 pm_power_off = cobalt_machine_power_off;
103 104
104 board_timer_setup = cobalt_timer_setup; 105 board_timer_setup = cobalt_timer_setup;
105 106
@@ -139,7 +140,7 @@ void __init plat_setup(void)
139 uart.type = PORT_UNKNOWN; 140 uart.type = PORT_UNKNOWN;
140 uart.uartclk = 18432000; 141 uart.uartclk = 18432000;
141 uart.irq = COBALT_SERIAL_IRQ; 142 uart.irq = COBALT_SERIAL_IRQ;
142 uart.flags = STD_COM_FLAGS; 143 uart.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
143 uart.iobase = 0xc800000; 144 uart.iobase = 0xc800000;
144 uart.iotype = UPIO_PORT; 145 uart.iotype = UPIO_PORT;
145 146
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index e17d3adff021..58c22cd344d3 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2 3# Linux kernel version: 2.6.16-rc4
4# Thu Nov 24 01:06:21 2005 4# Tue Feb 21 13:44:31 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -144,7 +144,6 @@ CONFIG_PREEMPT_BKL=y
144# Code maturity level options 144# Code maturity level options
145# 145#
146CONFIG_EXPERIMENTAL=y 146CONFIG_EXPERIMENTAL=y
147CONFIG_CLEAN_COMPILE=y
148CONFIG_LOCK_KERNEL=y 147CONFIG_LOCK_KERNEL=y
149CONFIG_INIT_ENV_ARG_LIMIT=32 148CONFIG_INIT_ENV_ARG_LIMIT=32
150 149
@@ -250,6 +249,7 @@ CONFIG_NET=y
250# 249#
251# Networking options 250# Networking options
252# 251#
252# CONFIG_NETDEBUG is not set
253CONFIG_PACKET=y 253CONFIG_PACKET=y
254CONFIG_PACKET_MMAP=y 254CONFIG_PACKET_MMAP=y
255CONFIG_UNIX=y 255CONFIG_UNIX=y
@@ -289,6 +289,7 @@ CONFIG_TCP_CONG_BIC=y
289# SCTP Configuration (EXPERIMENTAL) 289# SCTP Configuration (EXPERIMENTAL)
290# 290#
291# CONFIG_IP_SCTP is not set 291# CONFIG_IP_SCTP is not set
292
292# CONFIG_ATM is not set 293# CONFIG_ATM is not set
293# CONFIG_BRIDGE is not set 294# CONFIG_BRIDGE is not set
294# CONFIG_VLAN_8021Q is not set 295# CONFIG_VLAN_8021Q is not set
@@ -448,7 +449,7 @@ CONFIG_SCSI_SAS_ATTRS=m
448# 449#
449# SCSI low-level drivers 450# SCSI low-level drivers
450# 451#
451CONFIG_ISCSI_TCP=m 452# CONFIG_ISCSI_TCP is not set
452# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 453# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
453# CONFIG_SCSI_3W_9XXX is not set 454# CONFIG_SCSI_3W_9XXX is not set
454# CONFIG_SCSI_ACARD is not set 455# CONFIG_SCSI_ACARD is not set
@@ -774,6 +775,10 @@ CONFIG_USB_ARCH_HAS_OHCI=y
774# 775#
775 776
776# 777#
778# EDAC - error detection and reporting (RAS)
779#
780
781#
777# File systems 782# File systems
778# 783#
779CONFIG_EXT2_FS=y 784CONFIG_EXT2_FS=y
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 967e7acd8e1f..a34db6e82b27 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -102,6 +102,7 @@ CONFIG_CPU_R5000=y
102# CONFIG_CPU_RM9000 is not set 102# CONFIG_CPU_RM9000 is not set
103# CONFIG_CPU_SB1 is not set 103# CONFIG_CPU_SB1 is not set
104CONFIG_SYS_HAS_CPU_R5000=y 104CONFIG_SYS_HAS_CPU_R5000=y
105CONFIG_SYS_HAS_CPU_NEVADA=y
105CONFIG_SYS_HAS_CPU_RM7000=y 106CONFIG_SYS_HAS_CPU_RM7000=y
106CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y 107CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
107CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 108CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index dee44606164c..c02becab850b 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2 3# Linux kernel version: 2.6.16-rc2
4# Thu Nov 24 01:07:00 2005 4# Fri Feb 3 17:14:27 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -147,26 +147,27 @@ CONFIG_LOCALVERSION_AUTO=y
147# CONFIG_BSD_PROCESS_ACCT is not set 147# CONFIG_BSD_PROCESS_ACCT is not set
148# CONFIG_SYSCTL is not set 148# CONFIG_SYSCTL is not set
149# CONFIG_AUDIT is not set 149# CONFIG_AUDIT is not set
150# CONFIG_HOTPLUG is not set
151CONFIG_KOBJECT_UEVENT=y
152# CONFIG_IKCONFIG is not set 150# CONFIG_IKCONFIG is not set
153CONFIG_INITRAMFS_SOURCE="" 151CONFIG_INITRAMFS_SOURCE=""
154CONFIG_EMBEDDED=y 152CONFIG_EMBEDDED=y
155CONFIG_KALLSYMS=y 153CONFIG_KALLSYMS=y
156# CONFIG_KALLSYMS_EXTRA_PASS is not set 154# CONFIG_KALLSYMS_EXTRA_PASS is not set
155# CONFIG_HOTPLUG is not set
157CONFIG_PRINTK=y 156CONFIG_PRINTK=y
158# CONFIG_BUG is not set 157# CONFIG_BUG is not set
158CONFIG_ELF_CORE=y
159# CONFIG_BASE_FULL is not set 159# CONFIG_BASE_FULL is not set
160# CONFIG_FUTEX is not set 160# CONFIG_FUTEX is not set
161# CONFIG_EPOLL is not set 161# CONFIG_EPOLL is not set
162# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
163# CONFIG_SHMEM is not set 162# CONFIG_SHMEM is not set
164CONFIG_CC_ALIGN_FUNCTIONS=0 163CONFIG_CC_ALIGN_FUNCTIONS=0
165CONFIG_CC_ALIGN_LABELS=0 164CONFIG_CC_ALIGN_LABELS=0
166CONFIG_CC_ALIGN_LOOPS=0 165CONFIG_CC_ALIGN_LOOPS=0
167CONFIG_CC_ALIGN_JUMPS=0 166CONFIG_CC_ALIGN_JUMPS=0
167CONFIG_SLAB=y
168CONFIG_TINY_SHMEM=y 168CONFIG_TINY_SHMEM=y
169CONFIG_BASE_SMALL=1 169CONFIG_BASE_SMALL=1
170# CONFIG_SLOB is not set
170 171
171# 172#
172# Loadable module support 173# Loadable module support
@@ -266,11 +267,7 @@ CONFIG_TCP_CONG_BIC=y
266# CONFIG_HAMRADIO is not set 267# CONFIG_HAMRADIO is not set
267# CONFIG_IRDA is not set 268# CONFIG_IRDA is not set
268# CONFIG_BT is not set 269# CONFIG_BT is not set
269CONFIG_IEEE80211=y 270# CONFIG_IEEE80211 is not set
270# CONFIG_IEEE80211_DEBUG is not set
271CONFIG_IEEE80211_CRYPT_WEP=y
272CONFIG_IEEE80211_CRYPT_CCMP=y
273CONFIG_IEEE80211_CRYPT_TKIP=y
274 271
275# 272#
276# Device Drivers 273# Device Drivers
@@ -323,7 +320,7 @@ CONFIG_BLK_DEV_RAM_COUNT=16
323# 320#
324# SCSI device support 321# SCSI device support
325# 322#
326CONFIG_RAID_ATTRS=y 323# CONFIG_RAID_ATTRS is not set
327# CONFIG_SCSI is not set 324# CONFIG_SCSI is not set
328 325
329# 326#
@@ -366,24 +363,16 @@ CONFIG_NETDEVICES=y
366# 363#
367# PHY device support 364# PHY device support
368# 365#
369CONFIG_PHYLIB=y 366# CONFIG_PHYLIB is not set
370
371#
372# MII PHY device drivers
373#
374CONFIG_MARVELL_PHY=y
375CONFIG_DAVICOM_PHY=y
376CONFIG_QSEMI_PHY=y
377CONFIG_LXT_PHY=y
378CONFIG_CICADA_PHY=y
379 367
380# 368#
381# Ethernet (10 or 100Mbit) 369# Ethernet (10 or 100Mbit)
382# 370#
383CONFIG_NET_ETHERNET=y 371CONFIG_NET_ETHERNET=y
384CONFIG_MII=y 372# CONFIG_MII is not set
385# CONFIG_NET_VENDOR_3COM is not set 373# CONFIG_NET_VENDOR_3COM is not set
386# CONFIG_NET_VENDOR_SMC is not set 374# CONFIG_NET_VENDOR_SMC is not set
375# CONFIG_DM9000 is not set
387# CONFIG_NET_VENDOR_RACAL is not set 376# CONFIG_NET_VENDOR_RACAL is not set
388# CONFIG_DEPCA is not set 377# CONFIG_DEPCA is not set
389# CONFIG_HP100 is not set 378# CONFIG_HP100 is not set
@@ -479,6 +468,7 @@ CONFIG_HW_CONSOLE=y
479CONFIG_SERIAL_8250=y 468CONFIG_SERIAL_8250=y
480CONFIG_SERIAL_8250_CONSOLE=y 469CONFIG_SERIAL_8250_CONSOLE=y
481CONFIG_SERIAL_8250_NR_UARTS=4 470CONFIG_SERIAL_8250_NR_UARTS=4
471CONFIG_SERIAL_8250_RUNTIME_UARTS=4
482# CONFIG_SERIAL_8250_EXTENDED is not set 472# CONFIG_SERIAL_8250_EXTENDED is not set
483 473
484# 474#
@@ -518,6 +508,12 @@ CONFIG_SERIAL_CORE_CONSOLE=y
518# CONFIG_I2C is not set 508# CONFIG_I2C is not set
519 509
520# 510#
511# SPI support
512#
513# CONFIG_SPI is not set
514# CONFIG_SPI_MASTER is not set
515
516#
521# Dallas's 1-wire bus 517# Dallas's 1-wire bus
522# 518#
523# CONFIG_W1 is not set 519# CONFIG_W1 is not set
@@ -592,11 +588,14 @@ CONFIG_DUMMY_CONSOLE=y
592# 588#
593 589
594# 590#
591# EDAC - error detection and reporting (RAS)
592#
593
594#
595# File systems 595# File systems
596# 596#
597# CONFIG_EXT2_FS is not set 597# CONFIG_EXT2_FS is not set
598# CONFIG_EXT3_FS is not set 598# CONFIG_EXT3_FS is not set
599# CONFIG_JBD is not set
600# CONFIG_REISERFS_FS is not set 599# CONFIG_REISERFS_FS is not set
601# CONFIG_JFS_FS is not set 600# CONFIG_JFS_FS is not set
602# CONFIG_FS_POSIX_ACL is not set 601# CONFIG_FS_POSIX_ACL is not set
@@ -677,6 +676,7 @@ CONFIG_MSDOS_PARTITION=y
677# Kernel hacking 676# Kernel hacking
678# 677#
679# CONFIG_PRINTK_TIME is not set 678# CONFIG_PRINTK_TIME is not set
679# CONFIG_MAGIC_SYSRQ is not set
680# CONFIG_DEBUG_KERNEL is not set 680# CONFIG_DEBUG_KERNEL is not set
681CONFIG_LOG_BUF_SHIFT=14 681CONFIG_LOG_BUF_SHIFT=14
682CONFIG_CROSSCOMPILE=y 682CONFIG_CROSSCOMPILE=y
@@ -690,31 +690,7 @@ CONFIG_CMDLINE="console=ttyS0 debug ip=172.20.0.2:172.20.0.1::255.255.0.0"
690# 690#
691# Cryptographic options 691# Cryptographic options
692# 692#
693CONFIG_CRYPTO=y 693# CONFIG_CRYPTO is not set
694CONFIG_CRYPTO_HMAC=y
695CONFIG_CRYPTO_NULL=y
696CONFIG_CRYPTO_MD4=y
697CONFIG_CRYPTO_MD5=y
698CONFIG_CRYPTO_SHA1=y
699CONFIG_CRYPTO_SHA256=y
700CONFIG_CRYPTO_SHA512=y
701CONFIG_CRYPTO_WP512=y
702CONFIG_CRYPTO_TGR192=y
703CONFIG_CRYPTO_DES=y
704CONFIG_CRYPTO_BLOWFISH=y
705CONFIG_CRYPTO_TWOFISH=y
706CONFIG_CRYPTO_SERPENT=y
707CONFIG_CRYPTO_AES=y
708CONFIG_CRYPTO_CAST5=y
709CONFIG_CRYPTO_CAST6=y
710CONFIG_CRYPTO_TEA=y
711CONFIG_CRYPTO_ARC4=y
712CONFIG_CRYPTO_KHAZAD=y
713CONFIG_CRYPTO_ANUBIS=y
714CONFIG_CRYPTO_DEFLATE=y
715CONFIG_CRYPTO_MICHAEL_MIC=y
716CONFIG_CRYPTO_CRC32C=y
717# CONFIG_CRYPTO_TEST is not set
718 694
719# 695#
720# Hardware crypto devices 696# Hardware crypto devices
@@ -724,8 +700,6 @@ CONFIG_CRYPTO_CRC32C=y
724# Library routines 700# Library routines
725# 701#
726# CONFIG_CRC_CCITT is not set 702# CONFIG_CRC_CCITT is not set
727CONFIG_CRC16=y 703# CONFIG_CRC16 is not set
728CONFIG_CRC32=y 704CONFIG_CRC32=y
729CONFIG_LIBCRC32C=y 705# CONFIG_LIBCRC32C is not set
730CONFIG_ZLIB_INFLATE=y
731CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/mips/ddb5xxx/ddb5074/setup.c b/arch/mips/ddb5xxx/ddb5074/setup.c
index 11535be265b9..91456b068c2e 100644
--- a/arch/mips/ddb5xxx/ddb5074/setup.c
+++ b/arch/mips/ddb5xxx/ddb5074/setup.c
@@ -14,6 +14,7 @@
14#include <linux/ide.h> 14#include <linux/ide.h>
15#include <linux/ioport.h> 15#include <linux/ioport.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/pm.h>
17 18
18#include <asm/addrspace.h> 19#include <asm/addrspace.h>
19#include <asm/bcache.h> 20#include <asm/bcache.h>
@@ -95,7 +96,7 @@ void __init plat_setup(void)
95 96
96 _machine_restart = ddb_machine_restart; 97 _machine_restart = ddb_machine_restart;
97 _machine_halt = ddb_machine_halt; 98 _machine_halt = ddb_machine_halt;
98 _machine_power_off = ddb_machine_power_off; 99 pm_power_off = ddb_machine_power_off;
99 100
100 ddb_out32(DDB_BAR0, 0); 101 ddb_out32(DDB_BAR0, 0);
101 102
diff --git a/arch/mips/ddb5xxx/ddb5476/setup.c b/arch/mips/ddb5xxx/ddb5476/setup.c
index f4e480a74edf..c902adef5942 100644
--- a/arch/mips/ddb5xxx/ddb5476/setup.c
+++ b/arch/mips/ddb5xxx/ddb5476/setup.c
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/pm.h>
14 15
15#include <asm/addrspace.h> 16#include <asm/addrspace.h>
16#include <asm/bcache.h> 17#include <asm/bcache.h>
@@ -133,7 +134,7 @@ void __init plat_setup(void)
133 134
134 _machine_restart = ddb_machine_restart; 135 _machine_restart = ddb_machine_restart;
135 _machine_halt = ddb_machine_halt; 136 _machine_halt = ddb_machine_halt;
136 _machine_power_off = ddb_machine_power_off; 137 pm_power_off = ddb_machine_power_off;
137 138
138 /* request io port/mem resources */ 139 /* request io port/mem resources */
139 if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) || 140 if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) ||
diff --git a/arch/mips/ddb5xxx/ddb5477/setup.c b/arch/mips/ddb5xxx/ddb5477/setup.c
index 81163353c4a8..2f566034cc44 100644
--- a/arch/mips/ddb5xxx/ddb5477/setup.c
+++ b/arch/mips/ddb5xxx/ddb5477/setup.c
@@ -26,6 +26,7 @@
26#include <linux/major.h> 26#include <linux/major.h>
27#include <linux/kdev_t.h> 27#include <linux/kdev_t.h>
28#include <linux/root_dev.h> 28#include <linux/root_dev.h>
29#include <linux/pm.h>
29 30
30#include <asm/cpu.h> 31#include <asm/cpu.h>
31#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
@@ -182,7 +183,7 @@ void __init plat_setup(void)
182 183
183 _machine_restart = ddb_machine_restart; 184 _machine_restart = ddb_machine_restart;
184 _machine_halt = ddb_machine_halt; 185 _machine_halt = ddb_machine_halt;
185 _machine_power_off = ddb_machine_power_off; 186 pm_power_off = ddb_machine_power_off;
186 187
187 /* setup resource limits */ 188 /* setup resource limits */
188 ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1; 189 ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1;
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index 9ef54fe1feaa..7c1ca8f6330e 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -17,6 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/pm.h>
20 21
21#include <asm/bootinfo.h> 22#include <asm/bootinfo.h>
22#include <asm/cpu.h> 23#include <asm/cpu.h>
@@ -158,7 +159,7 @@ void __init plat_setup(void)
158 159
159 _machine_restart = dec_machine_restart; 160 _machine_restart = dec_machine_restart;
160 _machine_halt = dec_machine_halt; 161 _machine_halt = dec_machine_halt;
161 _machine_power_off = dec_machine_power_off; 162 pm_power_off = dec_machine_power_off;
162 163
163 ioport_resource.start = ~0UL; 164 ioport_resource.start = ~0UL;
164 ioport_resource.end = 0UL; 165 ioport_resource.end = 0UL;
diff --git a/arch/mips/gt64120/ev64120/setup.c b/arch/mips/gt64120/ev64120/setup.c
index 98b5a96cc039..6d859d1e7a2d 100644
--- a/arch/mips/gt64120/ev64120/setup.c
+++ b/arch/mips/gt64120/ev64120/setup.c
@@ -34,6 +34,8 @@
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/timex.h> 36#include <linux/timex.h>
37#include <linux/pm.h>
38
37#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
38#include <asm/page.h> 40#include <asm/page.h>
39#include <asm/io.h> 41#include <asm/io.h>
@@ -73,7 +75,7 @@ void __init plat_setup(void)
73{ 75{
74 _machine_restart = galileo_machine_restart; 76 _machine_restart = galileo_machine_restart;
75 _machine_halt = galileo_machine_halt; 77 _machine_halt = galileo_machine_halt;
76 _machine_power_off = galileo_machine_power_off; 78 pm_power_off = galileo_machine_power_off;
77 79
78 board_time_init = gt64120_time_init; 80 board_time_init = gt64120_time_init;
79 set_io_port_base(KSEG1); 81 set_io_port_base(KSEG1);
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
index 0d07c33112d0..20b65d3d2151 100644
--- a/arch/mips/gt64120/momenco_ocelot/setup.c
+++ b/arch/mips/gt64120/momenco_ocelot/setup.c
@@ -4,7 +4,7 @@
4 * BRIEF MODULE DESCRIPTION 4 * BRIEF MODULE DESCRIPTION
5 * Momentum Computer Ocelot (CP7000) - board dependent boot routines 5 * Momentum Computer Ocelot (CP7000) - board dependent boot routines
6 * 6 *
7 * Copyright (C) 1996, 1997, 2001 Ralf Baechle 7 * Copyright (C) 1996, 1997, 2001, 06 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2000 RidgeRun, Inc. 8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Copyright (C) 2001 Red Hat, Inc. 9 * Copyright (C) 2001 Red Hat, Inc.
10 * Copyright (C) 2002 Momentum Computer 10 * Copyright (C) 2002 Momentum Computer
@@ -47,6 +47,8 @@
47#include <linux/pci.h> 47#include <linux/pci.h>
48#include <linux/timex.h> 48#include <linux/timex.h>
49#include <linux/vmalloc.h> 49#include <linux/vmalloc.h>
50#include <linux/pm.h>
51
50#include <asm/time.h> 52#include <asm/time.h>
51#include <asm/bootinfo.h> 53#include <asm/bootinfo.h>
52#include <asm/page.h> 54#include <asm/page.h>
@@ -159,7 +161,7 @@ void __init plat_setup(void)
159 161
160 _machine_restart = momenco_ocelot_restart; 162 _machine_restart = momenco_ocelot_restart;
161 _machine_halt = momenco_ocelot_halt; 163 _machine_halt = momenco_ocelot_halt;
162 _machine_power_off = momenco_ocelot_power_off; 164 pm_power_off = momenco_ocelot_power_off;
163 165
164 /* 166 /*
165 * initrd_start = (ulong)ocelot_initrd_start; 167 * initrd_start = (ulong)ocelot_initrd_start;
diff --git a/arch/mips/ite-boards/generic/it8172_setup.c b/arch/mips/ite-boards/generic/it8172_setup.c
index 062429dd7ca0..fc73c8d69df7 100644
--- a/arch/mips/ite-boards/generic/it8172_setup.c
+++ b/arch/mips/ite-boards/generic/it8172_setup.c
@@ -34,6 +34,7 @@
34#include <linux/major.h> 34#include <linux/major.h>
35#include <linux/kdev_t.h> 35#include <linux/kdev_t.h>
36#include <linux/root_dev.h> 36#include <linux/root_dev.h>
37#include <linux/pm.h>
37 38
38#include <asm/cpu.h> 39#include <asm/cpu.h>
39#include <asm/time.h> 40#include <asm/time.h>
@@ -125,7 +126,7 @@ void __init plat_setup(void)
125 126
126 _machine_restart = it8172_restart; 127 _machine_restart = it8172_restart;
127 _machine_halt = it8172_halt; 128 _machine_halt = it8172_halt;
128 _machine_power_off = it8172_power_off; 129 pm_power_off = it8172_power_off;
129 130
130 /* 131 /*
131 * IO/MEM resources. 132 * IO/MEM resources.
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index 044df9d4ab7c..4036dc434551 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -19,6 +19,8 @@
19#include <linux/console.h> 19#include <linux/console.h>
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <linux/ide.h> 21#include <linux/ide.h>
22#include <linux/pm.h>
23
22#include <asm/bootinfo.h> 24#include <asm/bootinfo.h>
23#include <asm/irq.h> 25#include <asm/irq.h>
24#include <asm/jazz.h> 26#include <asm/jazz.h>
@@ -79,7 +81,7 @@ void __init plat_setup(void)
79 81
80 _machine_restart = jazz_machine_restart; 82 _machine_restart = jazz_machine_restart;
81 _machine_halt = jazz_machine_halt; 83 _machine_halt = jazz_machine_halt;
82 _machine_power_off = jazz_machine_power_off; 84 pm_power_off = jazz_machine_power_off;
83 85
84#warning "Somebody should check if screen_info is ok for Jazz." 86#warning "Somebody should check if screen_info is ok for Jazz."
85 87
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 4763957df8fc..9359cc413494 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -44,6 +44,7 @@
44#include <linux/ioport.h> 44#include <linux/ioport.h>
45#include <linux/param.h> /* for HZ */ 45#include <linux/param.h> /* for HZ */
46#include <linux/delay.h> 46#include <linux/delay.h>
47#include <linux/pm.h>
47#ifdef CONFIG_SERIAL_TXX9 48#ifdef CONFIG_SERIAL_TXX9
48#include <linux/tty.h> 49#include <linux/tty.h>
49#include <linux/serial.h> 50#include <linux/serial.h>
@@ -211,7 +212,7 @@ void __init plat_setup(void)
211 212
212 _machine_restart = jmr3927_machine_restart; 213 _machine_restart = jmr3927_machine_restart;
213 _machine_halt = jmr3927_machine_halt; 214 _machine_halt = jmr3927_machine_halt;
214 _machine_power_off = jmr3927_machine_power_off; 215 pm_power_off = jmr3927_machine_power_off;
215 216
216 /* 217 /*
217 * IO/MEM resources. 218 * IO/MEM resources.
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index d8e2674a1543..4a9f1ecefaf2 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -103,8 +103,9 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
103 * one divide. 103 * one divide.
104 */ 104 */
105 u64 nsec = (u64)jiffies * TICK_NSEC; 105 u64 nsec = (u64)jiffies * TICK_NSEC;
106 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 106 long rem;
107 value->tv_usec /= NSEC_PER_USEC; 107 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem);
108 value->tv_usec = rem / NSEC_PER_USEC;
108} 109}
109 110
110#define ELF_CORE_EFLAGS EF_MIPS_ABI2 111#define ELF_CORE_EFLAGS EF_MIPS_ABI2
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index cec5f327e360..e31813779895 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -105,8 +105,9 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
105 * one divide. 105 * one divide.
106 */ 106 */
107 u64 nsec = (u64)jiffies * TICK_NSEC; 107 u64 nsec = (u64)jiffies * TICK_NSEC;
108 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 108 long rem;
109 value->tv_usec /= NSEC_PER_USEC; 109 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem);
110 value->tv_usec = rem / NSEC_PER_USEC;
110} 111}
111 112
112#undef ELF_CORE_COPY_REGS 113#undef ELF_CORE_COPY_REGS
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index fac48ad27b34..292f8b243a5e 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -2,8 +2,8 @@
2 * Processor capabilities determination functions. 2 * Processor capabilities determination functions.
3 * 3 *
4 * Copyright (C) xxxx the Anonymous 4 * Copyright (C) xxxx the Anonymous
5 * Copyright (C) 1994 - 2006 Ralf Baechle
5 * Copyright (C) 2003, 2004 Maciej W. Rozycki 6 * Copyright (C) 2003, 2004 Maciej W. Rozycki
6 * Copyright (C) 1994 - 2003 Ralf Baechle
7 * Copyright (C) 2001, 2004 MIPS Inc. 7 * Copyright (C) 2001, 2004 MIPS Inc.
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -641,10 +641,9 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
641 switch (c->processor_id & 0xff00) { 641 switch (c->processor_id & 0xff00) {
642 case PRID_IMP_SB1: 642 case PRID_IMP_SB1:
643 c->cputype = CPU_SB1; 643 c->cputype = CPU_SB1;
644#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
645 /* FPU in pass1 is known to have issues. */ 644 /* FPU in pass1 is known to have issues. */
646 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); 645 if ((c->processor_id & 0xff) < 0x20)
647#endif 646 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
648 break; 647 break;
649 case PRID_IMP_SB1A: 648 case PRID_IMP_SB1A:
650 c->cputype = CPU_SB1A; 649 c->cputype = CPU_SB1A;
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c
index 96d18c43dca0..d4f88e0af24c 100644
--- a/arch/mips/kernel/gdb-stub.c
+++ b/arch/mips/kernel/gdb-stub.c
@@ -178,7 +178,7 @@ int kgdb_enabled;
178 */ 178 */
179static DEFINE_SPINLOCK(kgdb_lock); 179static DEFINE_SPINLOCK(kgdb_lock);
180static raw_spinlock_t kgdb_cpulock[NR_CPUS] = { 180static raw_spinlock_t kgdb_cpulock[NR_CPUS] = {
181 [0 ... NR_CPUS-1] = __RAW_SPIN_LOCK_UNLOCKED; 181 [0 ... NR_CPUS-1] = __RAW_SPIN_LOCK_UNLOCKED,
182}; 182};
183 183
184/* 184/*
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index aa18a8b7b380..13f22d1d0e8b 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -233,11 +233,11 @@ NESTED(except_vec_nmi, 0, sp)
233NESTED(nmi_handler, PT_SIZE, sp) 233NESTED(nmi_handler, PT_SIZE, sp)
234 .set push 234 .set push
235 .set noat 235 .set noat
236 .set mips3
237 SAVE_ALL 236 SAVE_ALL
238 move a0, sp 237 move a0, sp
239 jal nmi_exception_handler 238 jal nmi_exception_handler
240 RESTORE_ALL 239 RESTORE_ALL
240 .set mips3
241 eret 241 eret
242 .set pop 242 .set pop
243 END(nmi_handler) 243 END(nmi_handler)
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 60353f5acc48..5f68b220c26d 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -230,6 +230,9 @@ sysn32_waitid(int which, compat_pid_t pid,
230 long ret; 230 long ret;
231 mm_segment_t old_fs = get_fs(); 231 mm_segment_t old_fs = get_fs();
232 232
233 if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo)))
234 return -EFAULT;
235
233 set_fs (KERNEL_DS); 236 set_fs (KERNEL_DS);
234 ret = sys_waitid(which, pid, uinfo, options, 237 ret = sys_waitid(which, pid, uinfo, options,
235 uru ? (struct rusage __user *) &ru : NULL); 238 uru ? (struct rusage __user *) &ru : NULL);
@@ -1450,25 +1453,6 @@ sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *ti
1450 return sys_timer_create(clock, p, timer_id); 1453 return sys_timer_create(clock, p, timer_id);
1451} 1454}
1452 1455
1453asmlinkage long
1454sysn32_rt_sigtimedwait(const sigset_t __user *uthese,
1455 siginfo_t __user *uinfo,
1456 const struct compat_timespec __user *uts32,
1457 size_t sigsetsize)
1458{
1459 struct timespec __user *uts = NULL;
1460
1461 if (uts32) {
1462 struct timespec ts;
1463 uts = compat_alloc_user_space(sizeof(struct timespec));
1464 if (get_user(ts.tv_sec, &uts32->tv_sec) ||
1465 get_user(ts.tv_nsec, &uts32->tv_nsec) ||
1466 copy_to_user (uts, &ts, sizeof (ts)))
1467 return -EFAULT;
1468 }
1469 return sys_rt_sigtimedwait(uthese, uinfo, uts, sigsetsize);
1470}
1471
1472save_static_function(sys32_clone); 1456save_static_function(sys32_clone);
1473__attribute_used__ noinline static int 1457__attribute_used__ noinline static int
1474_sys32_clone(nabi_no_regargs struct pt_regs regs) 1458_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index fa98f10d0132..092679c2dca9 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others. 6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
7 * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2004 Thiemo Seufer 9 * Copyright (C) 2004 Thiemo Seufer
9 */ 10 */
@@ -24,6 +25,7 @@
24#include <linux/a.out.h> 25#include <linux/a.out.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/completion.h> 27#include <linux/completion.h>
28#include <linux/kallsyms.h>
27 29
28#include <asm/abi.h> 30#include <asm/abi.h>
29#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
@@ -58,8 +60,8 @@ ATTRIB_NORET void cpu_idle(void)
58 } 60 }
59} 61}
60 62
61extern int do_signal(sigset_t *oldset, struct pt_regs *regs); 63extern void do_signal(struct pt_regs *regs);
62extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); 64extern void do_signal32(struct pt_regs *regs);
63 65
64/* 66/*
65 * Native o32 and N64 ABI without DSP ASE 67 * Native o32 and N64 ABI without DSP ASE
@@ -271,46 +273,19 @@ long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
271 273
272static struct mips_frame_info { 274static struct mips_frame_info {
273 void *func; 275 void *func;
274 int omit_fp; /* compiled without fno-omit-frame-pointer */ 276 unsigned long func_size;
275 int frame_offset; 277 int frame_size;
276 int pc_offset; 278 int pc_offset;
277} schedule_frame, mfinfo[] = { 279} *schedule_frame, mfinfo[64];
278 { schedule, 0 }, /* must be first */ 280static int mfinfo_num;
279 /* arch/mips/kernel/semaphore.c */
280 { __down, 1 },
281 { __down_interruptible, 1 },
282 /* kernel/sched.c */
283#ifdef CONFIG_PREEMPT
284 { preempt_schedule, 0 },
285#endif
286 { wait_for_completion, 0 },
287 { interruptible_sleep_on, 0 },
288 { interruptible_sleep_on_timeout, 0 },
289 { sleep_on, 0 },
290 { sleep_on_timeout, 0 },
291 { yield, 0 },
292 { io_schedule, 0 },
293 { io_schedule_timeout, 0 },
294#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
295 { __preempt_spin_lock, 0 },
296 { __preempt_write_lock, 0 },
297#endif
298 /* kernel/timer.c */
299 { schedule_timeout, 1 },
300/* { nanosleep_restart, 1 }, */
301 /* lib/rwsem-spinlock.c */
302 { __down_read, 1 },
303 { __down_write, 1 },
304};
305 281
306static int mips_frame_info_initialized;
307static int __init get_frame_info(struct mips_frame_info *info) 282static int __init get_frame_info(struct mips_frame_info *info)
308{ 283{
309 int i; 284 int i;
310 void *func = info->func; 285 void *func = info->func;
311 union mips_instruction *ip = (union mips_instruction *)func; 286 union mips_instruction *ip = (union mips_instruction *)func;
312 info->pc_offset = -1; 287 info->pc_offset = -1;
313 info->frame_offset = info->omit_fp ? 0 : -1; 288 info->frame_size = 0;
314 for (i = 0; i < 128; i++, ip++) { 289 for (i = 0; i < 128; i++, ip++) {
315 /* if jal, jalr, jr, stop. */ 290 /* if jal, jalr, jr, stop. */
316 if (ip->j_format.opcode == jal_op || 291 if (ip->j_format.opcode == jal_op ||
@@ -319,6 +294,23 @@ static int __init get_frame_info(struct mips_frame_info *info)
319 ip->r_format.func == jr_op))) 294 ip->r_format.func == jr_op)))
320 break; 295 break;
321 296
297 if (info->func_size && i >= info->func_size / 4)
298 break;
299 if (
300#ifdef CONFIG_32BIT
301 ip->i_format.opcode == addiu_op &&
302#endif
303#ifdef CONFIG_64BIT
304 ip->i_format.opcode == daddiu_op &&
305#endif
306 ip->i_format.rs == 29 &&
307 ip->i_format.rt == 29) {
308 /* addiu/daddiu sp,sp,-imm */
309 if (info->frame_size)
310 continue;
311 info->frame_size = - ip->i_format.simmediate;
312 }
313
322 if ( 314 if (
323#ifdef CONFIG_32BIT 315#ifdef CONFIG_32BIT
324 ip->i_format.opcode == sw_op && 316 ip->i_format.opcode == sw_op &&
@@ -326,31 +318,20 @@ static int __init get_frame_info(struct mips_frame_info *info)
326#ifdef CONFIG_64BIT 318#ifdef CONFIG_64BIT
327 ip->i_format.opcode == sd_op && 319 ip->i_format.opcode == sd_op &&
328#endif 320#endif
329 ip->i_format.rs == 29) 321 ip->i_format.rs == 29 &&
330 { 322 ip->i_format.rt == 31) {
331 /* sw / sd $ra, offset($sp) */ 323 /* sw / sd $ra, offset($sp) */
332 if (ip->i_format.rt == 31) { 324 if (info->pc_offset != -1)
333 if (info->pc_offset != -1) 325 continue;
334 continue; 326 info->pc_offset =
335 info->pc_offset = 327 ip->i_format.simmediate / sizeof(long);
336 ip->i_format.simmediate / sizeof(long);
337 }
338 /* sw / sd $s8, offset($sp) */
339 if (ip->i_format.rt == 30) {
340//#if 0 /* gcc 3.4 does aggressive optimization... */
341 if (info->frame_offset != -1)
342 continue;
343//#endif
344 info->frame_offset =
345 ip->i_format.simmediate / sizeof(long);
346 }
347 } 328 }
348 } 329 }
349 if (info->pc_offset == -1 || info->frame_offset == -1) { 330 if (info->pc_offset == -1 || info->frame_size == 0) {
350 printk("Can't analyze prologue code at %p\n", func); 331 if (func == schedule)
332 printk("Can't analyze prologue code at %p\n", func);
351 info->pc_offset = -1; 333 info->pc_offset = -1;
352 info->frame_offset = -1; 334 info->frame_size = 0;
353 return -1;
354 } 335 }
355 336
356 return 0; 337 return 0;
@@ -358,25 +339,36 @@ static int __init get_frame_info(struct mips_frame_info *info)
358 339
359static int __init frame_info_init(void) 340static int __init frame_info_init(void)
360{ 341{
361 int i, found; 342 int i;
362 for (i = 0; i < ARRAY_SIZE(mfinfo); i++) 343#ifdef CONFIG_KALLSYMS
363 if (get_frame_info(&mfinfo[i])) 344 char *modname;
364 return -1; 345 char namebuf[KSYM_NAME_LEN + 1];
365 schedule_frame = mfinfo[0]; 346 unsigned long start, size, ofs;
366 /* bubble sort */ 347 extern char __sched_text_start[], __sched_text_end[];
367 do { 348 extern char __lock_text_start[], __lock_text_end[];
368 struct mips_frame_info tmp; 349
369 found = 0; 350 start = (unsigned long)__sched_text_start;
370 for (i = 1; i < ARRAY_SIZE(mfinfo); i++) { 351 for (i = 0; i < ARRAY_SIZE(mfinfo); i++) {
371 if (mfinfo[i-1].func > mfinfo[i].func) { 352 if (start == (unsigned long)schedule)
372 tmp = mfinfo[i]; 353 schedule_frame = &mfinfo[i];
373 mfinfo[i] = mfinfo[i-1]; 354 if (!kallsyms_lookup(start, &size, &ofs, &modname, namebuf))
374 mfinfo[i-1] = tmp; 355 break;
375 found = 1; 356 mfinfo[i].func = (void *)(start + ofs);
376 } 357 mfinfo[i].func_size = size;
377 } 358 start += size - ofs;
378 } while (found); 359 if (start >= (unsigned long)__lock_text_end)
379 mips_frame_info_initialized = 1; 360 break;
361 if (start == (unsigned long)__sched_text_end)
362 start = (unsigned long)__lock_text_start;
363 }
364#else
365 mfinfo[0].func = schedule;
366 schedule_frame = &mfinfo[0];
367#endif
368 for (i = 0; i < ARRAY_SIZE(mfinfo) && mfinfo[i].func; i++)
369 get_frame_info(&mfinfo[i]);
370
371 mfinfo_num = i;
380 return 0; 372 return 0;
381} 373}
382 374
@@ -393,47 +385,52 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
393 if (t->reg31 == (unsigned long) ret_from_fork) 385 if (t->reg31 == (unsigned long) ret_from_fork)
394 return t->reg31; 386 return t->reg31;
395 387
396 if (schedule_frame.pc_offset < 0) 388 if (!schedule_frame || schedule_frame->pc_offset < 0)
397 return 0; 389 return 0;
398 return ((unsigned long *)t->reg29)[schedule_frame.pc_offset]; 390 return ((unsigned long *)t->reg29)[schedule_frame->pc_offset];
399} 391}
400 392
401/* get_wchan - a maintenance nightmare^W^Wpain in the ass ... */ 393/* get_wchan - a maintenance nightmare^W^Wpain in the ass ... */
402unsigned long get_wchan(struct task_struct *p) 394unsigned long get_wchan(struct task_struct *p)
403{ 395{
404 unsigned long stack_page; 396 unsigned long stack_page;
405 unsigned long frame, pc; 397 unsigned long pc;
398#ifdef CONFIG_KALLSYMS
399 unsigned long frame;
400#endif
406 401
407 if (!p || p == current || p->state == TASK_RUNNING) 402 if (!p || p == current || p->state == TASK_RUNNING)
408 return 0; 403 return 0;
409 404
410 stack_page = (unsigned long)task_stack_page(p); 405 stack_page = (unsigned long)task_stack_page(p);
411 if (!stack_page || !mips_frame_info_initialized) 406 if (!stack_page || !mfinfo_num)
412 return 0; 407 return 0;
413 408
414 pc = thread_saved_pc(p); 409 pc = thread_saved_pc(p);
410#ifdef CONFIG_KALLSYMS
415 if (!in_sched_functions(pc)) 411 if (!in_sched_functions(pc))
416 return pc; 412 return pc;
417 413
418 frame = ((unsigned long *)p->thread.reg30)[schedule_frame.frame_offset]; 414 frame = p->thread.reg29 + schedule_frame->frame_size;
419 do { 415 do {
420 int i; 416 int i;
421 417
422 if (frame < stack_page || frame > stack_page + THREAD_SIZE - 32) 418 if (frame < stack_page || frame > stack_page + THREAD_SIZE - 32)
423 return 0; 419 return 0;
424 420
425 for (i = ARRAY_SIZE(mfinfo) - 1; i >= 0; i--) { 421 for (i = mfinfo_num - 1; i >= 0; i--) {
426 if (pc >= (unsigned long) mfinfo[i].func) 422 if (pc >= (unsigned long) mfinfo[i].func)
427 break; 423 break;
428 } 424 }
429 if (i < 0) 425 if (i < 0)
430 break; 426 break;
431 427
432 if (mfinfo[i].omit_fp)
433 break;
434 pc = ((unsigned long *)frame)[mfinfo[i].pc_offset]; 428 pc = ((unsigned long *)frame)[mfinfo[i].pc_offset];
435 frame = ((unsigned long *)frame)[mfinfo[i].frame_offset]; 429 if (!mfinfo[i].frame_size)
430 break;
431 frame += mfinfo[i].frame_size;
436 } while (in_sched_functions(pc)); 432 } while (in_sched_functions(pc));
433#endif
437 434
438 return pc; 435 return pc;
439} 436}
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 0c82b25d8c6d..0d5cf97af727 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -88,7 +88,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
88 ret = -EIO; 88 ret = -EIO;
89 if (copied != sizeof(tmp)) 89 if (copied != sizeof(tmp))
90 break; 90 break;
91 ret = put_user(tmp, (unsigned int *) (unsigned long) data); 91 ret = put_user(tmp, (unsigned int __user *) (unsigned long) data);
92 break; 92 break;
93 } 93 }
94 94
@@ -174,8 +174,10 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
174 case FPC_EIR: { /* implementation / version register */ 174 case FPC_EIR: { /* implementation / version register */
175 unsigned int flags; 175 unsigned int flags;
176 176
177 if (!cpu_has_fpu) 177 if (!cpu_has_fpu) {
178 tmp = 0;
178 break; 179 break;
180 }
179 181
180 preempt_disable(); 182 preempt_disable();
181 if (cpu_has_mipsmt) { 183 if (cpu_has_mipsmt) {
@@ -194,15 +196,18 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
194 preempt_enable(); 196 preempt_enable();
195 break; 197 break;
196 } 198 }
197 case DSP_BASE ... DSP_BASE + 5: 199 case DSP_BASE ... DSP_BASE + 5: {
200 dspreg_t *dregs;
201
198 if (!cpu_has_dsp) { 202 if (!cpu_has_dsp) {
199 tmp = 0; 203 tmp = 0;
200 ret = -EIO; 204 ret = -EIO;
201 goto out_tsk; 205 goto out_tsk;
202 } 206 }
203 dspreg_t *dregs = __get_dsp_regs(child); 207 dregs = __get_dsp_regs(child);
204 tmp = (unsigned long) (dregs[addr - DSP_BASE]); 208 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
205 break; 209 break;
210 }
206 case DSP_CONTROL: 211 case DSP_CONTROL:
207 if (!cpu_has_dsp) { 212 if (!cpu_has_dsp) {
208 tmp = 0; 213 tmp = 0;
@@ -216,7 +221,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
216 ret = -EIO; 221 ret = -EIO;
217 goto out_tsk; 222 goto out_tsk;
218 } 223 }
219 ret = put_user(tmp, (unsigned *) (unsigned long) data); 224 ret = put_user(tmp, (unsigned __user *) (unsigned long) data);
220 break; 225 break;
221 } 226 }
222 227
@@ -304,15 +309,18 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
304 else 309 else
305 child->thread.fpu.soft.fcr31 = data; 310 child->thread.fpu.soft.fcr31 = data;
306 break; 311 break;
307 case DSP_BASE ... DSP_BASE + 5: 312 case DSP_BASE ... DSP_BASE + 5: {
313 dspreg_t *dregs;
314
308 if (!cpu_has_dsp) { 315 if (!cpu_has_dsp) {
309 ret = -EIO; 316 ret = -EIO;
310 break; 317 break;
311 } 318 }
312 319
313 dspreg_t *dregs = __get_dsp_regs(child); 320 dregs = __get_dsp_regs(child);
314 dregs[addr - DSP_BASE] = data; 321 dregs[addr - DSP_BASE] = data;
315 break; 322 break;
323 }
316 case DSP_CONTROL: 324 case DSP_CONTROL:
317 if (!cpu_has_dsp) { 325 if (!cpu_has_dsp) {
318 ret = -EIO; 326 ret = -EIO;
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 5e37df3111ad..621037db2290 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -3,17 +3,16 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2001 by Ralf Baechle 6 * Copyright (C) 2001, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2001 MIPS Technologies, Inc. 7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */ 8 */
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/pm.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/reboot.h> 13#include <linux/reboot.h>
13#include <asm/reboot.h>
14 14
15void (*pm_power_off)(void); 15#include <asm/reboot.h>
16EXPORT_SYMBOL(pm_power_off);
17 16
18/* 17/*
19 * Urgs ... Too many MIPS machines to handle this in a generic way. 18 * Urgs ... Too many MIPS machines to handle this in a generic way.
@@ -22,23 +21,22 @@ EXPORT_SYMBOL(pm_power_off);
22 */ 21 */
23void (*_machine_restart)(char *command); 22void (*_machine_restart)(char *command);
24void (*_machine_halt)(void); 23void (*_machine_halt)(void);
25void (*_machine_power_off)(void); 24void (*pm_power_off)(void);
26 25
27void machine_restart(char *command) 26void machine_restart(char *command)
28{ 27{
29 _machine_restart(command); 28 if (_machine_restart)
29 _machine_restart(command);
30} 30}
31 31
32void machine_halt(void) 32void machine_halt(void)
33{ 33{
34 _machine_halt(); 34 if (_machine_halt)
35 _machine_halt();
35} 36}
36 37
37void machine_power_off(void) 38void machine_power_off(void)
38{ 39{
39 if (pm_power_off) 40 if (pm_power_off)
40 pm_power_off(); 41 pm_power_off();
41
42 _machine_power_off();
43} 42}
44
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 1d855112bac2..986a9cf23067 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org)
3 * 4 *
4 * This program is free software; you can distribute it and/or modify it 5 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as 6 * under the terms of the GNU General Public License (Version 2) as
@@ -20,9 +21,12 @@
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/fs.h> 22#include <linux/fs.h>
22#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/irq.h>
23#include <linux/poll.h> 26#include <linux/poll.h>
24#include <linux/sched.h> 27#include <linux/sched.h>
25#include <linux/wait.h> 28#include <linux/wait.h>
29
26#include <asm/mipsmtregs.h> 30#include <asm/mipsmtregs.h>
27#include <asm/bitops.h> 31#include <asm/bitops.h>
28#include <asm/cpu.h> 32#include <asm/cpu.h>
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index a42e0e8caa7b..d83e033dbc87 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -617,6 +617,23 @@ einval: li v0, -EINVAL
617 sys sys_inotify_init 0 617 sys sys_inotify_init 0
618 sys sys_inotify_add_watch 3 /* 4285 */ 618 sys sys_inotify_add_watch 3 /* 4285 */
619 sys sys_inotify_rm_watch 2 619 sys sys_inotify_rm_watch 2
620 sys sys_migrate_pages 4
621 sys sys_openat 4
622 sys sys_mkdirat 3
623 sys sys_mknodat 4 /* 4290 */
624 sys sys_fchownat 5
625 sys sys_futimesat 3
626 sys sys_fstatat64 4
627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4
630 sys sys_symlinkat 3
631 sys sys_readlinkat 4
632 sys sys_fchmodat 3
633 sys sys_faccessat 3 /* 4300 */
634 sys sys_pselect6 6
635 sys sys_ppoll 5
636 sys sys_unshare 1
620 .endm 637 .endm
621 638
622 /* We pre-compute the number of _instruction_ bytes needed to 639 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 47bfbd416709..98bf25df56f3 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -443,3 +443,20 @@ sys_call_table:
443 PTR sys_inotify_init 443 PTR sys_inotify_init
444 PTR sys_inotify_add_watch 444 PTR sys_inotify_add_watch
445 PTR sys_inotify_rm_watch /* 5245 */ 445 PTR sys_inotify_rm_watch /* 5245 */
446 PTR sys_migrate_pages
447 PTR sys_openat
448 PTR sys_mkdirat
449 PTR sys_mknodat
450 PTR sys_fchownat /* 5250 */
451 PTR sys_futimesat
452 PTR sys_newfstatat
453 PTR sys_unlinkat
454 PTR sys_renameat
455 PTR sys_linkat /* 5255 */
456 PTR sys_symlinkat
457 PTR sys_readlinkat
458 PTR sys_fchmodat
459 PTR sys_faccessat
460 PTR sys_pselect6 /* 5260 */
461 PTR sys_ppoll
462 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index b465ced1758f..d87b5446fa13 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -245,9 +245,9 @@ EXPORT(sysn32_call_table)
245 PTR sys_capget 245 PTR sys_capget
246 PTR sys_capset 246 PTR sys_capset
247 PTR sys32_rt_sigpending /* 6125 */ 247 PTR sys32_rt_sigpending /* 6125 */
248 PTR sysn32_rt_sigtimedwait 248 PTR compat_sys_rt_sigtimedwait
249 PTR sys_rt_sigqueueinfo 249 PTR sys_rt_sigqueueinfo
250 PTR sys32_rt_sigsuspend 250 PTR sysn32_rt_sigsuspend
251 PTR sys32_sigaltstack 251 PTR sys32_sigaltstack
252 PTR compat_sys_utime /* 6130 */ 252 PTR compat_sys_utime /* 6130 */
253 PTR sys_mknod 253 PTR sys_mknod
@@ -369,3 +369,20 @@ EXPORT(sysn32_call_table)
369 PTR sys_inotify_init 369 PTR sys_inotify_init
370 PTR sys_inotify_add_watch 370 PTR sys_inotify_add_watch
371 PTR sys_inotify_rm_watch 371 PTR sys_inotify_rm_watch
372 PTR sys_migrate_pages /* 6250 */
373 PTR sys_openat
374 PTR sys_mkdirat
375 PTR sys_mknodat
376 PTR sys_fchownat
377 PTR sys_futimesat /* 6255 */
378 PTR sys_newfstatat
379 PTR sys_unlinkat
380 PTR sys_renameat
381 PTR sys_linkat
382 PTR sys_symlinkat /* 6260 */
383 PTR sys_readlinkat
384 PTR sys_fchmodat
385 PTR sys_faccessat
386 PTR sys_pselect6
387 PTR sys_ppoll /* 6265 */
388 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 3d338ca7eeeb..5b0414018c9a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -491,4 +491,21 @@ sys_call_table:
491 PTR sys_inotify_init 491 PTR sys_inotify_init
492 PTR sys_inotify_add_watch /* 4285 */ 492 PTR sys_inotify_add_watch /* 4285 */
493 PTR sys_inotify_rm_watch 493 PTR sys_inotify_rm_watch
494 PTR sys_migrate_pages
495 PTR compat_sys_openat
496 PTR sys_mkdirat
497 PTR sys_mknodat /* 4290 */
498 PTR sys_fchownat
499 PTR compat_sys_futimesat
500 PTR compat_sys_newfstatat
501 PTR sys_unlinkat
502 PTR sys_renameat /* 4295 */
503 PTR sys_linkat
504 PTR sys_symlinkat
505 PTR sys_readlinkat
506 PTR sys_fchmodat
507 PTR sys_faccessat /* 4300 */
508 PTR sys_pselect6
509 PTR sys_ppoll
510 PTR sys_unshare
494 .size sys_call_table,.-sys_call_table 511 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 0f66ae5838b9..36bfc2588aa3 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -11,7 +11,7 @@
11#include <linux/config.h> 11#include <linux/config.h>
12 12
13static inline int 13static inline int
14setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 14setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
15{ 15{
16 int err = 0; 16 int err = 0;
17 17
@@ -82,7 +82,7 @@ out:
82} 82}
83 83
84static inline int 84static inline int
85restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 85restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
86{ 86{
87 unsigned int used_math; 87 unsigned int used_math;
88 unsigned long treg; 88 unsigned long treg;
@@ -157,7 +157,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
157/* 157/*
158 * Determine which stack to use.. 158 * Determine which stack to use..
159 */ 159 */
160static inline void * 160static inline void __user *
161get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 161get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
162{ 162{
163 unsigned long sp; 163 unsigned long sp;
@@ -176,7 +176,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
177 sp = current->sas_ss_sp + current->sas_ss_size; 177 sp = current->sas_ss_sp + current->sas_ss_size;
178 178
179 return (void *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK)); 179 return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK));
180} 180}
181 181
182static inline int install_sigtramp(unsigned int __user *tramp, 182static inline int install_sigtramp(unsigned int __user *tramp,
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 7d1800fe7038..c974cc9b30eb 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -39,8 +39,6 @@
39 39
40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
41 41
42int do_signal(sigset_t *oldset, struct pt_regs *regs);
43
44/* 42/*
45 * Atomically swap in the new signal mask, and wait for a signal. 43 * Atomically swap in the new signal mask, and wait for a signal.
46 */ 44 */
@@ -50,7 +48,7 @@ save_static_function(sys_sigsuspend);
50__attribute_used__ noinline static int 48__attribute_used__ noinline static int
51_sys_sigsuspend(nabi_no_regargs struct pt_regs regs) 49_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
52{ 50{
53 sigset_t saveset, newset; 51 sigset_t newset;
54 sigset_t __user *uset; 52 sigset_t __user *uset;
55 53
56 uset = (sigset_t __user *) regs.regs[4]; 54 uset = (sigset_t __user *) regs.regs[4];
@@ -59,19 +57,15 @@ _sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
59 sigdelsetmask(&newset, ~_BLOCKABLE); 57 sigdelsetmask(&newset, ~_BLOCKABLE);
60 58
61 spin_lock_irq(&current->sighand->siglock); 59 spin_lock_irq(&current->sighand->siglock);
62 saveset = current->blocked; 60 current->saved_sigmask = current->blocked;
63 current->blocked = newset; 61 current->blocked = newset;
64 recalc_sigpending(); 62 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock); 63 spin_unlock_irq(&current->sighand->siglock);
66 64
67 regs.regs[2] = EINTR; 65 current->state = TASK_INTERRUPTIBLE;
68 regs.regs[7] = 1; 66 schedule();
69 while (1) { 67 set_thread_flag(TIF_RESTORE_SIGMASK);
70 current->state = TASK_INTERRUPTIBLE; 68 return -ERESTARTNOHAND;
71 schedule();
72 if (do_signal(&saveset, &regs))
73 return -EINTR;
74 }
75} 69}
76#endif 70#endif
77 71
@@ -79,7 +73,7 @@ save_static_function(sys_rt_sigsuspend);
79__attribute_used__ noinline static int 73__attribute_used__ noinline static int
80_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 74_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
81{ 75{
82 sigset_t saveset, newset; 76 sigset_t newset;
83 sigset_t __user *unewset; 77 sigset_t __user *unewset;
84 size_t sigsetsize; 78 size_t sigsetsize;
85 79
@@ -94,19 +88,15 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
94 sigdelsetmask(&newset, ~_BLOCKABLE); 88 sigdelsetmask(&newset, ~_BLOCKABLE);
95 89
96 spin_lock_irq(&current->sighand->siglock); 90 spin_lock_irq(&current->sighand->siglock);
97 saveset = current->blocked; 91 current->saved_sigmask = current->blocked;
98 current->blocked = newset; 92 current->blocked = newset;
99 recalc_sigpending(); 93 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock); 94 spin_unlock_irq(&current->sighand->siglock);
101 95
102 regs.regs[2] = EINTR; 96 current->state = TASK_INTERRUPTIBLE;
103 regs.regs[7] = 1; 97 schedule();
104 while (1) { 98 set_thread_flag(TIF_RESTORE_SIGMASK);
105 current->state = TASK_INTERRUPTIBLE; 99 return -ERESTARTNOHAND;
106 schedule();
107 if (do_signal(&saveset, &regs))
108 return -EINTR;
109 }
110} 100}
111 101
112#ifdef CONFIG_TRAD_SIGNALS 102#ifdef CONFIG_TRAD_SIGNALS
@@ -199,10 +189,10 @@ save_static_function(sys_sigreturn);
199__attribute_used__ noinline static void 189__attribute_used__ noinline static void
200_sys_sigreturn(nabi_no_regargs struct pt_regs regs) 190_sys_sigreturn(nabi_no_regargs struct pt_regs regs)
201{ 191{
202 struct sigframe *frame; 192 struct sigframe __user *frame;
203 sigset_t blocked; 193 sigset_t blocked;
204 194
205 frame = (struct sigframe *) regs.regs[29]; 195 frame = (struct sigframe __user *) regs.regs[29];
206 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 196 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
207 goto badframe; 197 goto badframe;
208 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 198 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
@@ -236,11 +226,11 @@ save_static_function(sys_rt_sigreturn);
236__attribute_used__ noinline static void 226__attribute_used__ noinline static void
237_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 227_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
238{ 228{
239 struct rt_sigframe *frame; 229 struct rt_sigframe __user *frame;
240 sigset_t set; 230 sigset_t set;
241 stack_t st; 231 stack_t st;
242 232
243 frame = (struct rt_sigframe *) regs.regs[29]; 233 frame = (struct rt_sigframe __user *) regs.regs[29];
244 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 234 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
245 goto badframe; 235 goto badframe;
246 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 236 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -259,7 +249,7 @@ _sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
259 goto badframe; 249 goto badframe;
260 /* It is more difficult to avoid calling this function than to 250 /* It is more difficult to avoid calling this function than to
261 call it and ignore errors. */ 251 call it and ignore errors. */
262 do_sigaltstack(&st, NULL, regs.regs[29]); 252 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
263 253
264 /* 254 /*
265 * Don't let your children do this ... 255 * Don't let your children do this ...
@@ -279,7 +269,7 @@ badframe:
279int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, 269int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
280 int signr, sigset_t *set) 270 int signr, sigset_t *set)
281{ 271{
282 struct sigframe *frame; 272 struct sigframe __user *frame;
283 int err = 0; 273 int err = 0;
284 274
285 frame = get_sigframe(ka, regs, sizeof(*frame)); 275 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -315,18 +305,18 @@ int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
315 current->comm, current->pid, 305 current->comm, current->pid,
316 frame, regs->cp0_epc, frame->regs[31]); 306 frame, regs->cp0_epc, frame->regs[31]);
317#endif 307#endif
318 return 1; 308 return 0;
319 309
320give_sigsegv: 310give_sigsegv:
321 force_sigsegv(signr, current); 311 force_sigsegv(signr, current);
322 return 0; 312 return -EFAULT;
323} 313}
324#endif 314#endif
325 315
326int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, 316int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
327 int signr, sigset_t *set, siginfo_t *info) 317 int signr, sigset_t *set, siginfo_t *info)
328{ 318{
329 struct rt_sigframe *frame; 319 struct rt_sigframe __user *frame;
330 int err = 0; 320 int err = 0;
331 321
332 frame = get_sigframe(ka, regs, sizeof(*frame)); 322 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -340,7 +330,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
340 330
341 /* Create the ucontext. */ 331 /* Create the ucontext. */
342 err |= __put_user(0, &frame->rs_uc.uc_flags); 332 err |= __put_user(0, &frame->rs_uc.uc_flags);
343 err |= __put_user(0, &frame->rs_uc.uc_link); 333 err |= __put_user(NULL, &frame->rs_uc.uc_link);
344 err |= __put_user((void *)current->sas_ss_sp, 334 err |= __put_user((void *)current->sas_ss_sp,
345 &frame->rs_uc.uc_stack.ss_sp); 335 &frame->rs_uc.uc_stack.ss_sp);
346 err |= __put_user(sas_ss_flags(regs->regs[29]), 336 err |= __put_user(sas_ss_flags(regs->regs[29]),
@@ -375,11 +365,11 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
375 current->comm, current->pid, 365 current->comm, current->pid,
376 frame, regs->cp0_epc, regs->regs[31]); 366 frame, regs->cp0_epc, regs->regs[31]);
377#endif 367#endif
378 return 1; 368 return 0;
379 369
380give_sigsegv: 370give_sigsegv:
381 force_sigsegv(signr, current); 371 force_sigsegv(signr, current);
382 return 0; 372 return -EFAULT;
383} 373}
384 374
385static inline int handle_signal(unsigned long sig, siginfo_t *info, 375static inline int handle_signal(unsigned long sig, siginfo_t *info,
@@ -393,7 +383,7 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
393 regs->regs[2] = EINTR; 383 regs->regs[2] = EINTR;
394 break; 384 break;
395 case ERESTARTSYS: 385 case ERESTARTSYS:
396 if(!(ka->sa.sa_flags & SA_RESTART)) { 386 if (!(ka->sa.sa_flags & SA_RESTART)) {
397 regs->regs[2] = EINTR; 387 regs->regs[2] = EINTR;
398 break; 388 break;
399 } 389 }
@@ -420,9 +410,10 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
420 return ret; 410 return ret;
421} 411}
422 412
423int do_signal(sigset_t *oldset, struct pt_regs *regs) 413void do_signal(struct pt_regs *regs)
424{ 414{
425 struct k_sigaction ka; 415 struct k_sigaction ka;
416 sigset_t *oldset;
426 siginfo_t info; 417 siginfo_t info;
427 int signr; 418 int signr;
428 419
@@ -432,17 +423,31 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
432 * if so. 423 * if so.
433 */ 424 */
434 if (!user_mode(regs)) 425 if (!user_mode(regs))
435 return 1; 426 return;
436 427
437 if (try_to_freeze()) 428 if (try_to_freeze())
438 goto no_signal; 429 goto no_signal;
439 430
440 if (!oldset) 431 if (test_thread_flag(TIF_RESTORE_SIGMASK))
432 oldset = &current->saved_sigmask;
433 else
441 oldset = &current->blocked; 434 oldset = &current->blocked;
442 435
436
443 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 437 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
444 if (signr > 0) 438 if (signr > 0) {
445 return handle_signal(signr, &info, &ka, oldset, regs); 439 /* Whee! Actually deliver the signal. */
440 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
441 /*
442 * A signal was successfully delivered; the saved
443 * sigmask will have been stored in the signal frame,
444 * and will be restored by sigreturn, so we can simply
445 * clear the TIF_RESTORE_SIGMASK flag.
446 */
447 if (test_thread_flag(TIF_RESTORE_SIGMASK))
448 clear_thread_flag(TIF_RESTORE_SIGMASK);
449 }
450 }
446 451
447no_signal: 452no_signal:
448 /* 453 /*
@@ -463,18 +468,25 @@ no_signal:
463 regs->cp0_epc -= 4; 468 regs->cp0_epc -= 4;
464 } 469 }
465 } 470 }
466 return 0; 471
472 /*
473 * If there's no signal to deliver, we just put the saved sigmask
474 * back
475 */
476 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
477 clear_thread_flag(TIF_RESTORE_SIGMASK);
478 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
479 }
467} 480}
468 481
469/* 482/*
470 * notification of userspace execution resumption 483 * notification of userspace execution resumption
471 * - triggered by current->work.notify_resume 484 * - triggered by the TIF_WORK_MASK flags
472 */ 485 */
473asmlinkage void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, 486asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
474 __u32 thread_info_flags) 487 __u32 thread_info_flags)
475{ 488{
476 /* deal with pending signal delivery */ 489 /* deal with pending signal delivery */
477 if (thread_info_flags & _TIF_SIGPENDING) { 490 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
478 current->thread.abi->do_signal(oldset, regs); 491 current->thread.abi->do_signal(regs);
479 }
480} 492}
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 98b185bbc947..237cd8a2cd32 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1991, 1992 Linus Torvalds 6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle 7 * Copyright (C) 1994 - 2000, 2006 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/cache.h> 10#include <linux/cache.h>
@@ -106,8 +106,6 @@ typedef struct compat_siginfo {
106 106
107#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 107#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
108 108
109extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
110
111/* 32-bit compatibility types */ 109/* 32-bit compatibility types */
112 110
113#define _NSIG_BPW32 32 111#define _NSIG_BPW32 32
@@ -144,7 +142,7 @@ struct ucontext32 {
144extern void __put_sigset_unknown_nsig(void); 142extern void __put_sigset_unknown_nsig(void);
145extern void __get_sigset_unknown_nsig(void); 143extern void __get_sigset_unknown_nsig(void);
146 144
147static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t *ubuf) 145static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf)
148{ 146{
149 int err = 0; 147 int err = 0;
150 148
@@ -198,7 +196,7 @@ __attribute_used__ noinline static int
198_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) 196_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
199{ 197{
200 compat_sigset_t *uset; 198 compat_sigset_t *uset;
201 sigset_t newset, saveset; 199 sigset_t newset;
202 200
203 uset = (compat_sigset_t *) regs.regs[4]; 201 uset = (compat_sigset_t *) regs.regs[4];
204 if (get_sigset(&newset, uset)) 202 if (get_sigset(&newset, uset))
@@ -206,19 +204,15 @@ _sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
206 sigdelsetmask(&newset, ~_BLOCKABLE); 204 sigdelsetmask(&newset, ~_BLOCKABLE);
207 205
208 spin_lock_irq(&current->sighand->siglock); 206 spin_lock_irq(&current->sighand->siglock);
209 saveset = current->blocked; 207 current->saved_sigmask = current->blocked;
210 current->blocked = newset; 208 current->blocked = newset;
211 recalc_sigpending(); 209 recalc_sigpending();
212 spin_unlock_irq(&current->sighand->siglock); 210 spin_unlock_irq(&current->sighand->siglock);
213 211
214 regs.regs[2] = EINTR; 212 current->state = TASK_INTERRUPTIBLE;
215 regs.regs[7] = 1; 213 schedule();
216 while (1) { 214 set_thread_flag(TIF_RESTORE_SIGMASK);
217 current->state = TASK_INTERRUPTIBLE; 215 return -ERESTARTNOHAND;
218 schedule();
219 if (do_signal32(&saveset, &regs))
220 return -EINTR;
221 }
222} 216}
223 217
224save_static_function(sys32_rt_sigsuspend); 218save_static_function(sys32_rt_sigsuspend);
@@ -226,8 +220,8 @@ __attribute_used__ noinline static int
226_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 220_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
227{ 221{
228 compat_sigset_t *uset; 222 compat_sigset_t *uset;
229 sigset_t newset, saveset; 223 sigset_t newset;
230 size_t sigsetsize; 224 size_t sigsetsize;
231 225
232 /* XXX Don't preclude handling different sized sigset_t's. */ 226 /* XXX Don't preclude handling different sized sigset_t's. */
233 sigsetsize = regs.regs[5]; 227 sigsetsize = regs.regs[5];
@@ -240,19 +234,15 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
240 sigdelsetmask(&newset, ~_BLOCKABLE); 234 sigdelsetmask(&newset, ~_BLOCKABLE);
241 235
242 spin_lock_irq(&current->sighand->siglock); 236 spin_lock_irq(&current->sighand->siglock);
243 saveset = current->blocked; 237 current->saved_sigmask = current->blocked;
244 current->blocked = newset; 238 current->blocked = newset;
245 recalc_sigpending(); 239 recalc_sigpending();
246 spin_unlock_irq(&current->sighand->siglock); 240 spin_unlock_irq(&current->sighand->siglock);
247 241
248 regs.regs[2] = EINTR; 242 current->state = TASK_INTERRUPTIBLE;
249 regs.regs[7] = 1; 243 schedule();
250 while (1) { 244 set_thread_flag(TIF_RESTORE_SIGMASK);
251 current->state = TASK_INTERRUPTIBLE; 245 return -ERESTARTNOHAND;
252 schedule();
253 if (do_signal32(&saveset, &regs))
254 return -EINTR;
255 }
256} 246}
257 247
258asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, 248asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
@@ -269,7 +259,7 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
269 if (!access_ok(VERIFY_READ, act, sizeof(*act))) 259 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
270 return -EFAULT; 260 return -EFAULT;
271 err |= __get_user(handler, &act->sa_handler); 261 err |= __get_user(handler, &act->sa_handler);
272 new_ka.sa.sa_handler = (void*)(s64)handler; 262 new_ka.sa.sa_handler = (void __user *)(s64)handler;
273 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); 263 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
274 err |= __get_user(mask, &act->sa_mask.sig[0]); 264 err |= __get_user(mask, &act->sa_mask.sig[0]);
275 if (err) 265 if (err)
@@ -299,8 +289,8 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
299 289
300asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) 290asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
301{ 291{
302 const stack32_t *uss = (const stack32_t *) regs.regs[4]; 292 const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4];
303 stack32_t *uoss = (stack32_t *) regs.regs[5]; 293 stack32_t __user *uoss = (stack32_t __user *) regs.regs[5];
304 unsigned long usp = regs.regs[29]; 294 unsigned long usp = regs.regs[29];
305 stack_t kss, koss; 295 stack_t kss, koss;
306 int ret, err = 0; 296 int ret, err = 0;
@@ -319,7 +309,8 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
319 } 309 }
320 310
321 set_fs (KERNEL_DS); 311 set_fs (KERNEL_DS);
322 ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, usp); 312 ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL,
313 uoss ? (stack_t __user *)&koss : NULL, usp);
323 set_fs (old_fs); 314 set_fs (old_fs);
324 315
325 if (!ret && uoss) { 316 if (!ret && uoss) {
@@ -335,7 +326,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
335 return ret; 326 return ret;
336} 327}
337 328
338static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 *sc) 329static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user *sc)
339{ 330{
340 u32 used_math; 331 u32 used_math;
341 int err = 0; 332 int err = 0;
@@ -420,7 +411,7 @@ struct rt_sigframe32 {
420#endif 411#endif
421}; 412};
422 413
423int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from) 414int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
424{ 415{
425 int err; 416 int err;
426 417
@@ -455,7 +446,7 @@ int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from)
455 err |= __put_user(from->si_uid, &to->si_uid); 446 err |= __put_user(from->si_uid, &to->si_uid);
456 break; 447 break;
457 case __SI_FAULT >> 16: 448 case __SI_FAULT >> 16:
458 err |= __put_user((long)from->si_addr, &to->si_addr); 449 err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
459 break; 450 break;
460 case __SI_POLL >> 16: 451 case __SI_POLL >> 16:
461 err |= __put_user(from->si_band, &to->si_band); 452 err |= __put_user(from->si_band, &to->si_band);
@@ -476,10 +467,10 @@ save_static_function(sys32_sigreturn);
476__attribute_used__ noinline static void 467__attribute_used__ noinline static void
477_sys32_sigreturn(nabi_no_regargs struct pt_regs regs) 468_sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
478{ 469{
479 struct sigframe *frame; 470 struct sigframe __user *frame;
480 sigset_t blocked; 471 sigset_t blocked;
481 472
482 frame = (struct sigframe *) regs.regs[29]; 473 frame = (struct sigframe __user *) regs.regs[29];
483 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 474 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
484 goto badframe; 475 goto badframe;
485 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 476 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
@@ -512,13 +503,13 @@ save_static_function(sys32_rt_sigreturn);
512__attribute_used__ noinline static void 503__attribute_used__ noinline static void
513_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 504_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
514{ 505{
515 struct rt_sigframe32 *frame; 506 struct rt_sigframe32 __user *frame;
516 mm_segment_t old_fs; 507 mm_segment_t old_fs;
517 sigset_t set; 508 sigset_t set;
518 stack_t st; 509 stack_t st;
519 s32 sp; 510 s32 sp;
520 511
521 frame = (struct rt_sigframe32 *) regs.regs[29]; 512 frame = (struct rt_sigframe32 __user *) regs.regs[29];
522 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 513 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
523 goto badframe; 514 goto badframe;
524 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 515 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -536,7 +527,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
536 /* The ucontext contains a stack32_t, so we must convert! */ 527 /* The ucontext contains a stack32_t, so we must convert! */
537 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 528 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
538 goto badframe; 529 goto badframe;
539 st.ss_size = (long) sp; 530 st.ss_sp = (void *)(long) sp;
540 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) 531 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
541 goto badframe; 532 goto badframe;
542 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) 533 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
@@ -546,7 +537,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
546 call it and ignore errors. */ 537 call it and ignore errors. */
547 old_fs = get_fs(); 538 old_fs = get_fs();
548 set_fs (KERNEL_DS); 539 set_fs (KERNEL_DS);
549 do_sigaltstack(&st, NULL, regs.regs[29]); 540 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
550 set_fs (old_fs); 541 set_fs (old_fs);
551 542
552 /* 543 /*
@@ -564,7 +555,7 @@ badframe:
564} 555}
565 556
566static inline int setup_sigcontext32(struct pt_regs *regs, 557static inline int setup_sigcontext32(struct pt_regs *regs,
567 struct sigcontext32 *sc) 558 struct sigcontext32 __user *sc)
568{ 559{
569 int err = 0; 560 int err = 0;
570 561
@@ -623,8 +614,9 @@ out:
623/* 614/*
624 * Determine which stack to use.. 615 * Determine which stack to use..
625 */ 616 */
626static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 617static inline void __user *get_sigframe(struct k_sigaction *ka,
627 size_t frame_size) 618 struct pt_regs *regs,
619 size_t frame_size)
628{ 620{
629 unsigned long sp; 621 unsigned long sp;
630 622
@@ -642,13 +634,13 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
642 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 634 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
643 sp = current->sas_ss_sp + current->sas_ss_size; 635 sp = current->sas_ss_sp + current->sas_ss_size;
644 636
645 return (void *)((sp - frame_size) & ALMASK); 637 return (void __user *)((sp - frame_size) & ALMASK);
646} 638}
647 639
648int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 640int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
649 int signr, sigset_t *set) 641 int signr, sigset_t *set)
650{ 642{
651 struct sigframe *frame; 643 struct sigframe __user *frame;
652 int err = 0; 644 int err = 0;
653 645
654 frame = get_sigframe(ka, regs, sizeof(*frame)); 646 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -692,17 +684,17 @@ int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
692 current->comm, current->pid, 684 current->comm, current->pid,
693 frame, regs->cp0_epc, frame->sf_code); 685 frame, regs->cp0_epc, frame->sf_code);
694#endif 686#endif
695 return 1; 687 return 0;
696 688
697give_sigsegv: 689give_sigsegv:
698 force_sigsegv(signr, current); 690 force_sigsegv(signr, current);
699 return 0; 691 return -EFAULT;
700} 692}
701 693
702int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 694int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
703 int signr, sigset_t *set, siginfo_t *info) 695 int signr, sigset_t *set, siginfo_t *info)
704{ 696{
705 struct rt_sigframe32 *frame; 697 struct rt_sigframe32 __user *frame;
706 int err = 0; 698 int err = 0;
707 s32 sp; 699 s32 sp;
708 700
@@ -763,11 +755,11 @@ int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
763 current->comm, current->pid, 755 current->comm, current->pid,
764 frame, regs->cp0_epc, frame->rs_code); 756 frame, regs->cp0_epc, frame->rs_code);
765#endif 757#endif
766 return 1; 758 return 0;
767 759
768give_sigsegv: 760give_sigsegv:
769 force_sigsegv(signr, current); 761 force_sigsegv(signr, current);
770 return 0; 762 return -EFAULT;
771} 763}
772 764
773static inline int handle_signal(unsigned long sig, siginfo_t *info, 765static inline int handle_signal(unsigned long sig, siginfo_t *info,
@@ -781,7 +773,7 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
781 regs->regs[2] = EINTR; 773 regs->regs[2] = EINTR;
782 break; 774 break;
783 case ERESTARTSYS: 775 case ERESTARTSYS:
784 if(!(ka->sa.sa_flags & SA_RESTART)) { 776 if (!(ka->sa.sa_flags & SA_RESTART)) {
785 regs->regs[2] = EINTR; 777 regs->regs[2] = EINTR;
786 break; 778 break;
787 } 779 }
@@ -808,9 +800,10 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
808 return ret; 800 return ret;
809} 801}
810 802
811int do_signal32(sigset_t *oldset, struct pt_regs *regs) 803void do_signal32(struct pt_regs *regs)
812{ 804{
813 struct k_sigaction ka; 805 struct k_sigaction ka;
806 sigset_t *oldset;
814 siginfo_t info; 807 siginfo_t info;
815 int signr; 808 int signr;
816 809
@@ -820,17 +813,30 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
820 * if so. 813 * if so.
821 */ 814 */
822 if (!user_mode(regs)) 815 if (!user_mode(regs))
823 return 1; 816 return;
824 817
825 if (try_to_freeze()) 818 if (try_to_freeze())
826 goto no_signal; 819 goto no_signal;
827 820
828 if (!oldset) 821 if (test_thread_flag(TIF_RESTORE_SIGMASK))
822 oldset = &current->saved_sigmask;
823 else
829 oldset = &current->blocked; 824 oldset = &current->blocked;
830 825
831 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 826 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
832 if (signr > 0) 827 if (signr > 0) {
833 return handle_signal(signr, &info, &ka, oldset, regs); 828 /* Whee! Actually deliver the signal. */
829 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
830 /*
831 * A signal was successfully delivered; the saved
832 * sigmask will have been stored in the signal frame,
833 * and will be restored by sigreturn, so we can simply
834 * clear the TIF_RESTORE_SIGMASK flag.
835 */
836 if (test_thread_flag(TIF_RESTORE_SIGMASK))
837 clear_thread_flag(TIF_RESTORE_SIGMASK);
838 }
839 }
834 840
835no_signal: 841no_signal:
836 /* 842 /*
@@ -851,11 +857,19 @@ no_signal:
851 regs->cp0_epc -= 4; 857 regs->cp0_epc -= 4;
852 } 858 }
853 } 859 }
854 return 0; 860
861 /*
862 * If there's no signal to deliver, we just put the saved sigmask
863 * back
864 */
865 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
866 clear_thread_flag(TIF_RESTORE_SIGMASK);
867 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
868 }
855} 869}
856 870
857asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, 871asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
858 struct sigaction32 *oact, 872 struct sigaction32 __user *oact,
859 unsigned int sigsetsize) 873 unsigned int sigsetsize)
860{ 874{
861 struct k_sigaction new_sa, old_sa; 875 struct k_sigaction new_sa, old_sa;
@@ -872,7 +886,7 @@ asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
872 if (!access_ok(VERIFY_READ, act, sizeof(*act))) 886 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
873 return -EFAULT; 887 return -EFAULT;
874 err |= __get_user(handler, &act->sa_handler); 888 err |= __get_user(handler, &act->sa_handler);
875 new_sa.sa.sa_handler = (void*)(s64)handler; 889 new_sa.sa.sa_handler = (void __user *)(s64)handler;
876 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); 890 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags);
877 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); 891 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask);
878 if (err) 892 if (err)
@@ -899,7 +913,7 @@ out:
899} 913}
900 914
901asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, 915asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
902 compat_sigset_t *oset, unsigned int sigsetsize) 916 compat_sigset_t __user *oset, unsigned int sigsetsize)
903{ 917{
904 sigset_t old_set, new_set; 918 sigset_t old_set, new_set;
905 int ret; 919 int ret;
@@ -909,8 +923,9 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
909 return -EFAULT; 923 return -EFAULT;
910 924
911 set_fs (KERNEL_DS); 925 set_fs (KERNEL_DS);
912 ret = sys_rt_sigprocmask(how, set ? &new_set : NULL, 926 ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL,
913 oset ? &old_set : NULL, sigsetsize); 927 oset ? (sigset_t __user *)&old_set : NULL,
928 sigsetsize);
914 set_fs (old_fs); 929 set_fs (old_fs);
915 930
916 if (!ret && oset && put_sigset(&old_set, oset)) 931 if (!ret && oset && put_sigset(&old_set, oset))
@@ -919,7 +934,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
919 return ret; 934 return ret;
920} 935}
921 936
922asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, 937asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
923 unsigned int sigsetsize) 938 unsigned int sigsetsize)
924{ 939{
925 int ret; 940 int ret;
@@ -927,7 +942,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
927 mm_segment_t old_fs = get_fs(); 942 mm_segment_t old_fs = get_fs();
928 943
929 set_fs (KERNEL_DS); 944 set_fs (KERNEL_DS);
930 ret = sys_rt_sigpending(&set, sigsetsize); 945 ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize);
931 set_fs (old_fs); 946 set_fs (old_fs);
932 947
933 if (!ret && put_sigset(&set, uset)) 948 if (!ret && put_sigset(&set, uset))
@@ -936,7 +951,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
936 return ret; 951 return ret;
937} 952}
938 953
939asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) 954asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
940{ 955{
941 siginfo_t info; 956 siginfo_t info;
942 int ret; 957 int ret;
@@ -946,7 +961,7 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo)
946 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) 961 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
947 return -EFAULT; 962 return -EFAULT;
948 set_fs (KERNEL_DS); 963 set_fs (KERNEL_DS);
949 ret = sys_rt_sigqueueinfo(pid, sig, &info); 964 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
950 set_fs (old_fs); 965 set_fs (old_fs);
951 return ret; 966 return ret;
952} 967}
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ec61b2670ba6..3e168c08a3a8 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -48,6 +48,8 @@
48#define __NR_N32_rt_sigreturn 6211 48#define __NR_N32_rt_sigreturn 6211
49#define __NR_N32_restart_syscall 6214 49#define __NR_N32_restart_syscall 6214
50 50
51#define DEBUG_SIG 0
52
51#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 53#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
52 54
53/* IRIX compatible stack_t */ 55/* IRIX compatible stack_t */
@@ -79,16 +81,49 @@ struct rt_sigframe_n32 {
79#endif 81#endif
80}; 82};
81 83
84extern void sigset_from_compat (sigset_t *set, compat_sigset_t *compat);
85
86save_static_function(sysn32_rt_sigsuspend);
87__attribute_used__ noinline static int
88_sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
89{
90 compat_sigset_t __user *unewset, uset;
91 size_t sigsetsize;
92 sigset_t newset;
93
94 /* XXX Don't preclude handling different sized sigset_t's. */
95 sigsetsize = regs.regs[5];
96 if (sigsetsize != sizeof(sigset_t))
97 return -EINVAL;
98
99 unewset = (compat_sigset_t __user *) regs.regs[4];
100 if (copy_from_user(&uset, unewset, sizeof(uset)))
101 return -EFAULT;
102 sigset_from_compat (&newset, &uset);
103 sigdelsetmask(&newset, ~_BLOCKABLE);
104
105 spin_lock_irq(&current->sighand->siglock);
106 current->saved_sigmask = current->blocked;
107 current->blocked = newset;
108 recalc_sigpending();
109 spin_unlock_irq(&current->sighand->siglock);
110
111 current->state = TASK_INTERRUPTIBLE;
112 schedule();
113 set_thread_flag(TIF_RESTORE_SIGMASK);
114 return -ERESTARTNOHAND;
115}
116
82save_static_function(sysn32_rt_sigreturn); 117save_static_function(sysn32_rt_sigreturn);
83__attribute_used__ noinline static void 118__attribute_used__ noinline static void
84_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 119_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
85{ 120{
86 struct rt_sigframe_n32 *frame; 121 struct rt_sigframe_n32 __user *frame;
87 sigset_t set; 122 sigset_t set;
88 stack_t st; 123 stack_t st;
89 s32 sp; 124 s32 sp;
90 125
91 frame = (struct rt_sigframe_n32 *) regs.regs[29]; 126 frame = (struct rt_sigframe_n32 __user *) regs.regs[29];
92 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 127 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
93 goto badframe; 128 goto badframe;
94 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 129 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
@@ -106,7 +141,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
106 /* The ucontext contains a stack32_t, so we must convert! */ 141 /* The ucontext contains a stack32_t, so we must convert! */
107 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 142 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
108 goto badframe; 143 goto badframe;
109 st.ss_size = (long) sp; 144 st.ss_sp = (void *)(long) sp;
110 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) 145 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
111 goto badframe; 146 goto badframe;
112 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) 147 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
@@ -114,7 +149,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
114 149
115 /* It is more difficult to avoid calling this function than to 150 /* It is more difficult to avoid calling this function than to
116 call it and ignore errors. */ 151 call it and ignore errors. */
117 do_sigaltstack(&st, NULL, regs.regs[29]); 152 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
118 153
119 /* 154 /*
120 * Don't let your children do this ... 155 * Don't let your children do this ...
@@ -133,7 +168,7 @@ badframe:
133int setup_rt_frame_n32(struct k_sigaction * ka, 168int setup_rt_frame_n32(struct k_sigaction * ka,
134 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) 169 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info)
135{ 170{
136 struct rt_sigframe_n32 *frame; 171 struct rt_sigframe_n32 __user *frame;
137 int err = 0; 172 int err = 0;
138 s32 sp; 173 s32 sp;
139 174
@@ -184,9 +219,9 @@ int setup_rt_frame_n32(struct k_sigaction * ka,
184 current->comm, current->pid, 219 current->comm, current->pid,
185 frame, regs->cp0_epc, regs->regs[31]); 220 frame, regs->cp0_epc, regs->regs[31]);
186#endif 221#endif
187 return 1; 222 return 0;
188 223
189give_sigsegv: 224give_sigsegv:
190 force_sigsegv(signr, current); 225 force_sigsegv(signr, current);
191 return 0; 226 return -EFAULT;
192} 227}
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 25472fcaf715..5e189862e523 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -29,6 +29,7 @@
29#include <linux/timex.h> 29#include <linux/timex.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/cpumask.h> 31#include <linux/cpumask.h>
32#include <linux/cpu.h>
32 33
33#include <asm/atomic.h> 34#include <asm/atomic.h>
34#include <asm/cpu.h> 35#include <asm/cpu.h>
@@ -424,6 +425,25 @@ void flush_tlb_one(unsigned long vaddr)
424 local_flush_tlb_one(vaddr); 425 local_flush_tlb_one(vaddr);
425} 426}
426 427
428static DEFINE_PER_CPU(struct cpu, cpu_devices);
429
430static int __init topology_init(void)
431{
432 int cpu;
433 int ret;
434
435 for_each_cpu(cpu) {
436 ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL);
437 if (ret)
438 printk(KERN_WARNING "topology_init: register_cpu %d "
439 "failed (%d)\n", cpu, ret);
440 }
441
442 return 0;
443}
444
445subsys_initcall(topology_init);
446
427EXPORT_SYMBOL(flush_tlb_page); 447EXPORT_SYMBOL(flush_tlb_page);
428EXPORT_SYMBOL(flush_tlb_one); 448EXPORT_SYMBOL(flush_tlb_one);
429EXPORT_SYMBOL(cpu_data); 449EXPORT_SYMBOL(cpu_data);
diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp_mt.c
index 794a1c3de2a4..c930364830d0 100644
--- a/arch/mips/kernel/smp_mt.c
+++ b/arch/mips/kernel/smp_mt.c
@@ -68,6 +68,8 @@ void __init sanitize_tlb_entries(void)
68 68
69 set_c0_mvpcontrol(MVPCONTROL_VPC); 69 set_c0_mvpcontrol(MVPCONTROL_VPC);
70 70
71 back_to_back_c0_hazard();
72
71 /* Disable TLB sharing */ 73 /* Disable TLB sharing */
72 clear_c0_mvpcontrol(MVPCONTROL_STLB); 74 clear_c0_mvpcontrol(MVPCONTROL_STLB);
73 75
@@ -102,35 +104,6 @@ void __init sanitize_tlb_entries(void)
102 clear_c0_mvpcontrol(MVPCONTROL_VPC); 104 clear_c0_mvpcontrol(MVPCONTROL_VPC);
103} 105}
104 106
105#if 0
106/*
107 * Use c0_MVPConf0 to find out how many CPUs are available, setting up
108 * phys_cpu_present_map and the logical/physical mappings.
109 */
110void __init prom_build_cpu_map(void)
111{
112 int i, num, ncpus;
113
114 cpus_clear(phys_cpu_present_map);
115
116 /* assume we boot on cpu 0.... */
117 cpu_set(0, phys_cpu_present_map);
118 __cpu_number_map[0] = 0;
119 __cpu_logical_map[0] = 0;
120
121 if (cpu_has_mipsmt) {
122 ncpus = ((read_c0_mvpconf0() & (MVPCONF0_PVPE)) >> MVPCONF0_PVPE_SHIFT) + 1;
123 for (i=1, num=0; i< NR_CPUS && i<ncpus; i++) {
124 cpu_set(i, phys_cpu_present_map);
125 __cpu_number_map[i] = ++num;
126 __cpu_logical_map[num] = i;
127 }
128
129 printk(KERN_INFO "%i available secondary CPU(s)\n", num);
130 }
131}
132#endif
133
134static void ipi_resched_dispatch (struct pt_regs *regs) 107static void ipi_resched_dispatch (struct pt_regs *regs)
135{ 108{
136 do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ, regs); 109 do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ, regs);
@@ -222,6 +195,9 @@ void prom_prepare_cpus(unsigned int max_cpus)
222 195
223 /* set config to be the same as vpe0, particularly kseg0 coherency alg */ 196 /* set config to be the same as vpe0, particularly kseg0 coherency alg */
224 write_vpe_c0_config( read_c0_config()); 197 write_vpe_c0_config( read_c0_config());
198
199 /* Propagate Config7 */
200 write_vpe_c0_config7(read_c0_config7());
225 } 201 }
226 202
227 } 203 }
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 332358430ff5..1da2eeb3ef9e 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
212 int error; 212 int error;
213 char * filename; 213 char * filename;
214 214
215 filename = getname((char *) (long)regs.regs[4]); 215 filename = getname((char __user *) (long)regs.regs[4]);
216 error = PTR_ERR(filename); 216 error = PTR_ERR(filename);
217 if (IS_ERR(filename)) 217 if (IS_ERR(filename))
218 goto out; 218 goto out;
219 error = do_execve(filename, (char **) (long)regs.regs[5], 219 error = do_execve(filename, (char __user *__user *) (long)regs.regs[5],
220 (char **) (long)regs.regs[6], &regs); 220 (char __user *__user *) (long)regs.regs[6], &regs);
221 putname(filename); 221 putname(filename);
222 222
223out: 223out:
@@ -227,7 +227,7 @@ out:
227/* 227/*
228 * Compacrapability ... 228 * Compacrapability ...
229 */ 229 */
230asmlinkage int sys_uname(struct old_utsname * name) 230asmlinkage int sys_uname(struct old_utsname __user * name)
231{ 231{
232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
233 return 0; 233 return 0;
@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
237/* 237/*
238 * Compacrapability ... 238 * Compacrapability ...
239 */ 239 */
240asmlinkage int sys_olduname(struct oldold_utsname * name) 240asmlinkage int sys_olduname(struct oldold_utsname __user * name)
241{ 241{
242 int error; 242 int error;
243 243
@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long addr)
274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
275{ 275{
276 int tmp, len; 276 int tmp, len;
277 char *name; 277 char __user *name;
278 278
279 switch(cmd) { 279 switch(cmd) {
280 case SETNAME: { 280 case SETNAME: {
@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
283 if (!capable(CAP_SYS_ADMIN)) 283 if (!capable(CAP_SYS_ADMIN))
284 return -EPERM; 284 return -EPERM;
285 285
286 name = (char *) arg1; 286 name = (char __user *) arg1;
287 287
288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); 288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
289 if (len < 0) 289 if (len < 0)
@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
324 * This is really horribly ugly. 324 * This is really horribly ugly.
325 */ 325 */
326asmlinkage int sys_ipc (uint call, int first, int second, 326asmlinkage int sys_ipc (uint call, int first, int second,
327 unsigned long third, void *ptr, long fifth) 327 unsigned long third, void __user *ptr, long fifth)
328{ 328{
329 int version, ret; 329 int version, ret;
330 330
@@ -333,24 +333,25 @@ asmlinkage int sys_ipc (uint call, int first, int second,
333 333
334 switch (call) { 334 switch (call) {
335 case SEMOP: 335 case SEMOP:
336 return sys_semtimedop (first, (struct sembuf *)ptr, second, 336 return sys_semtimedop (first, (struct sembuf __user *)ptr,
337 NULL); 337 second, NULL);
338 case SEMTIMEDOP: 338 case SEMTIMEDOP:
339 return sys_semtimedop (first, (struct sembuf *)ptr, second, 339 return sys_semtimedop (first, (struct sembuf __user *)ptr,
340 (const struct timespec __user *)fifth); 340 second,
341 (const struct timespec __user *)fifth);
341 case SEMGET: 342 case SEMGET:
342 return sys_semget (first, second, third); 343 return sys_semget (first, second, third);
343 case SEMCTL: { 344 case SEMCTL: {
344 union semun fourth; 345 union semun fourth;
345 if (!ptr) 346 if (!ptr)
346 return -EINVAL; 347 return -EINVAL;
347 if (get_user(fourth.__pad, (void **) ptr)) 348 if (get_user(fourth.__pad, (void *__user *) ptr))
348 return -EFAULT; 349 return -EFAULT;
349 return sys_semctl (first, second, third, fourth); 350 return sys_semctl (first, second, third, fourth);
350 } 351 }
351 352
352 case MSGSND: 353 case MSGSND:
353 return sys_msgsnd (first, (struct msgbuf *) ptr, 354 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
354 second, third); 355 second, third);
355 case MSGRCV: 356 case MSGRCV:
356 switch (version) { 357 switch (version) {
@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
360 return -EINVAL; 361 return -EINVAL;
361 362
362 if (copy_from_user(&tmp, 363 if (copy_from_user(&tmp,
363 (struct ipc_kludge *) ptr, 364 (struct ipc_kludge __user *) ptr,
364 sizeof (tmp))) 365 sizeof (tmp)))
365 return -EFAULT; 366 return -EFAULT;
366 return sys_msgrcv (first, tmp.msgp, second, 367 return sys_msgrcv (first, tmp.msgp, second,
@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int first, int second,
368 } 369 }
369 default: 370 default:
370 return sys_msgrcv (first, 371 return sys_msgrcv (first,
371 (struct msgbuf *) ptr, 372 (struct msgbuf __user *) ptr,
372 second, fifth, third); 373 second, fifth, third);
373 } 374 }
374 case MSGGET: 375 case MSGGET:
375 return sys_msgget ((key_t) first, second); 376 return sys_msgget ((key_t) first, second);
376 case MSGCTL: 377 case MSGCTL:
377 return sys_msgctl (first, second, (struct msqid_ds *) ptr); 378 return sys_msgctl (first, second,
379 (struct msqid_ds __user *) ptr);
378 380
379 case SHMAT: 381 case SHMAT:
380 switch (version) { 382 switch (version) {
381 default: { 383 default: {
382 ulong raddr; 384 ulong raddr;
383 ret = do_shmat (first, (char *) ptr, second, &raddr); 385 ret = do_shmat (first, (char __user *) ptr, second,
386 &raddr);
384 if (ret) 387 if (ret)
385 return ret; 388 return ret;
386 return put_user (raddr, (ulong *) third); 389 return put_user (raddr, (ulong __user *) third);
387 } 390 }
388 case 1: /* iBCS2 emulator entry point */ 391 case 1: /* iBCS2 emulator entry point */
389 if (!segment_eq(get_fs(), get_ds())) 392 if (!segment_eq(get_fs(), get_ds()))
390 return -EINVAL; 393 return -EINVAL;
391 return do_shmat (first, (char *) ptr, second, (ulong *) third); 394 return do_shmat (first, (char __user *) ptr, second,
395 (ulong *) third);
392 } 396 }
393 case SHMDT: 397 case SHMDT:
394 return sys_shmdt ((char *)ptr); 398 return sys_shmdt ((char __user *)ptr);
395 case SHMGET: 399 case SHMGET:
396 return sys_shmget (first, second, third); 400 return sys_shmget (first, second, third);
397 case SHMCTL: 401 case SHMCTL:
398 return sys_shmctl (first, second, 402 return sys_shmctl (first, second,
399 (struct shmid_ds *) ptr); 403 (struct shmid_ds __user *) ptr);
400 default: 404 default:
401 return -ENOSYS; 405 return -ENOSYS;
402 } 406 }
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 59a187956de0..005debbfbe84 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 1999, 2000, 01 Ralf Baechle 6 * Copyright (C) 1994 - 1999, 2000, 01, 06 Ralf Baechle
7 * Copyright (C) 1995, 1996 Paul M. Antoine 7 * Copyright (C) 1995, 1996 Paul M. Antoine
8 * Copyright (C) 1998 Ulf Carlsson 8 * Copyright (C) 1998 Ulf Carlsson
9 * Copyright (C) 1999 Silicon Graphics, Inc. 9 * Copyright (C) 1999 Silicon Graphics, Inc.
@@ -548,6 +548,8 @@ asmlinkage void do_ov(struct pt_regs *regs)
548{ 548{
549 siginfo_t info; 549 siginfo_t info;
550 550
551 die_if_kernel("Integer overflow", regs);
552
551 info.si_code = FPE_INTOVF; 553 info.si_code = FPE_INTOVF;
552 info.si_signo = SIGFPE; 554 info.si_signo = SIGFPE;
553 info.si_errno = 0; 555 info.si_errno = 0;
@@ -1168,7 +1170,7 @@ void __init per_cpu_trap_init(void)
1168#endif 1170#endif
1169 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) 1171 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV)
1170 status_set |= ST0_XX; 1172 status_set |= ST0_XX;
1171 change_c0_status(ST0_CU|ST0_MX|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, 1173 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
1172 status_set); 1174 status_set);
1173 1175
1174 if (cpu_has_dsp) 1176 if (cpu_has_dsp)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 25cc856d8e7e..ff699dbb99f7 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -1,4 +1,5 @@
1#include <linux/config.h> 1#include <linux/config.h>
2#include <asm/asm-offsets.h>
2#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
3 4
4#undef mips /* CPP really sucks for this job */ 5#undef mips /* CPP really sucks for this job */
@@ -64,10 +65,10 @@ SECTIONS
64 we can shorten the on-disk segment size. */ 65 we can shorten the on-disk segment size. */
65 .sdata : { *(.sdata) } 66 .sdata : { *(.sdata) }
66 67
67 . = ALIGN(4096); 68 . = ALIGN(_PAGE_SIZE);
68 __nosave_begin = .; 69 __nosave_begin = .;
69 .data_nosave : { *(.data.nosave) } 70 .data_nosave : { *(.data.nosave) }
70 . = ALIGN(4096); 71 . = ALIGN(_PAGE_SIZE);
71 __nosave_end = .; 72 __nosave_end = .;
72 73
73 . = ALIGN(32); 74 . = ALIGN(32);
@@ -76,7 +77,7 @@ SECTIONS
76 _edata = .; /* End of data section */ 77 _edata = .; /* End of data section */
77 78
78 /* will be freed after init */ 79 /* will be freed after init */
79 . = ALIGN(4096); /* Init code and data */ 80 . = ALIGN(_PAGE_SIZE); /* Init code and data */
80 __init_begin = .; 81 __init_begin = .;
81 .init.text : { 82 .init.text : {
82 _sinittext = .; 83 _sinittext = .;
@@ -105,7 +106,7 @@ SECTIONS
105 .con_initcall.init : { *(.con_initcall.init) } 106 .con_initcall.init : { *(.con_initcall.init) }
106 __con_initcall_end = .; 107 __con_initcall_end = .;
107 SECURITY_INIT 108 SECURITY_INIT
108 . = ALIGN(4096); 109 . = ALIGN(_PAGE_SIZE);
109 __initramfs_start = .; 110 __initramfs_start = .;
110 .init.ramfs : { *(.init.ramfs) } 111 .init.ramfs : { *(.init.ramfs) }
111 __initramfs_end = .; 112 __initramfs_end = .;
@@ -113,7 +114,7 @@ SECTIONS
113 __per_cpu_start = .; 114 __per_cpu_start = .;
114 .data.percpu : { *(.data.percpu) } 115 .data.percpu : { *(.data.percpu) }
115 __per_cpu_end = .; 116 __per_cpu_end = .;
116 . = ALIGN(4096); 117 . = ALIGN(_PAGE_SIZE);
117 __init_end = .; 118 __init_end = .;
118 /* freed after init ends here */ 119 /* freed after init ends here */
119 120
diff --git a/arch/mips/lasat/reset.c b/arch/mips/lasat/reset.c
index 8d7d7a454f9a..181bf68175fc 100644
--- a/arch/mips/lasat/reset.c
+++ b/arch/mips/lasat/reset.c
@@ -19,9 +19,12 @@
19 */ 19 */
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/pm.h>
23
22#include <asm/reboot.h> 24#include <asm/reboot.h>
23#include <asm/system.h> 25#include <asm/system.h>
24#include <asm/lasat/lasat.h> 26#include <asm/lasat/lasat.h>
27
25#include "picvue.h" 28#include "picvue.h"
26#include "prom.h" 29#include "prom.h"
27 30
@@ -63,5 +66,5 @@ void lasat_reboot_setup(void)
63{ 66{
64 _machine_restart = lasat_machine_restart; 67 _machine_restart = lasat_machine_restart;
65 _machine_halt = lasat_machine_halt; 68 _machine_halt = lasat_machine_halt;
66 _machine_power_off = lasat_machine_halt; 69 pm_power_off = lasat_machine_halt;
67} 70}
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index dcd819d57dae..83eb08b7a072 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -134,8 +134,8 @@ void __init serial_init(void)
134 134
135 memset(&s, 0, sizeof(s)); 135 memset(&s, 0, sizeof(s));
136 136
137 s.flags = STD_COM_FLAGS; 137 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
138 s.iotype = SERIAL_IO_MEM; 138 s.iotype = UPIO_MEM;
139 139
140 if (mips_machtype == MACH_LASAT_100) { 140 if (mips_machtype == MACH_LASAT_100) {
141 s.uartclk = LASAT_BASE_BAUD_100 * 16; 141 s.uartclk = LASAT_BASE_BAUD_100 * 16;
diff --git a/arch/mips/lib-32/dump_tlb.c b/arch/mips/lib-32/dump_tlb.c
index 46519f4331eb..c49a925d0169 100644
--- a/arch/mips/lib-32/dump_tlb.c
+++ b/arch/mips/lib-32/dump_tlb.c
@@ -158,29 +158,26 @@ void dump_list_process(struct task_struct *t, void *address)
158 printk("task->mm == %8p\n", t->mm); 158 printk("task->mm == %8p\n", t->mm);
159 //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd); 159 //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd);
160 160
161 if (addr > KSEG0) 161 if (addr > KSEG0) {
162 page_dir = pgd_offset_k(0); 162 page_dir = pgd_offset_k(0);
163 else if (t->mm) {
164 page_dir = pgd_offset(t->mm, 0);
165 printk("page_dir == %08x\n", (unsigned int) page_dir);
166 } else
167 printk("Current thread has no mm\n");
168
169 if (addr > KSEG0)
170 pgd = pgd_offset_k(addr); 163 pgd = pgd_offset_k(addr);
171 else if (t->mm) { 164 } else if (t->mm) {
165 page_dir = pgd_offset(t->mm, 0);
172 pgd = pgd_offset(t->mm, addr); 166 pgd = pgd_offset(t->mm, addr);
173 printk("pgd == %08x, ", (unsigned int) pgd); 167 } else {
174 pud = pud_offset(pgd, addr); 168 printk("Current thread has no mm\n");
175 printk("pud == %08x, ", (unsigned int) pud); 169 return;
170 }
171 printk("page_dir == %08x\n", (unsigned int) page_dir);
172 printk("pgd == %08x, ", (unsigned int) pgd);
173 pud = pud_offset(pgd, addr);
174 printk("pud == %08x, ", (unsigned int) pud);
176 175
177 pmd = pmd_offset(pud, addr); 176 pmd = pmd_offset(pud, addr);
178 printk("pmd == %08x, ", (unsigned int) pmd); 177 printk("pmd == %08x, ", (unsigned int) pmd);
179 178
180 pte = pte_offset(pmd, addr); 179 pte = pte_offset(pmd, addr);
181 printk("pte == %08x, ", (unsigned int) pte); 180 printk("pte == %08x, ", (unsigned int) pte);
182 } else
183 printk("Current thread has no mm\n");
184 181
185 page = *pte; 182 page = *pte;
186#ifdef CONFIG_64BIT_PHYS_ADDR 183#ifdef CONFIG_64BIT_PHYS_ADDR
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
index 495c1ac94298..1c555e6c6a9f 100644
--- a/arch/mips/math-emu/dp_simple.c
+++ b/arch/mips/math-emu/dp_simple.c
@@ -48,16 +48,22 @@ ieee754dp ieee754dp_neg(ieee754dp x)
48 CLEARCX; 48 CLEARCX;
49 FLUSHXDP; 49 FLUSHXDP;
50 50
51 /*
52 * Invert the sign ALWAYS to prevent an endless recursion on
53 * pow() in libc.
54 */
55 /* quick fix up */
56 DPSIGN(x) ^= 1;
57
51 if (xc == IEEE754_CLASS_SNAN) { 58 if (xc == IEEE754_CLASS_SNAN) {
59 ieee754dp y = ieee754dp_indef();
52 SETCX(IEEE754_INVALID_OPERATION); 60 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754dp_nanxcpt(ieee754dp_indef(), "neg"); 61 DPSIGN(y) = DPSIGN(x);
62 return ieee754dp_nanxcpt(y, "neg");
54 } 63 }
55 64
56 if (ieee754dp_isnan(x)) /* but not infinity */ 65 if (ieee754dp_isnan(x)) /* but not infinity */
57 return ieee754dp_nanxcpt(x, "neg", x); 66 return ieee754dp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 DPSIGN(x) ^= 1;
61 return x; 67 return x;
62} 68}
63 69
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index c809830dffb4..770f0f4677cd 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -48,16 +48,22 @@ ieee754sp ieee754sp_neg(ieee754sp x)
48 CLEARCX; 48 CLEARCX;
49 FLUSHXSP; 49 FLUSHXSP;
50 50
51 /*
52 * Invert the sign ALWAYS to prevent an endless recursion on
53 * pow() in libc.
54 */
55 /* quick fix up */
56 SPSIGN(x) ^= 1;
57
51 if (xc == IEEE754_CLASS_SNAN) { 58 if (xc == IEEE754_CLASS_SNAN) {
59 ieee754sp y = ieee754sp_indef();
52 SETCX(IEEE754_INVALID_OPERATION); 60 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754sp_nanxcpt(ieee754sp_indef(), "neg"); 61 SPSIGN(y) = SPSIGN(x);
62 return ieee754sp_nanxcpt(y, "neg");
54 } 63 }
55 64
56 if (ieee754sp_isnan(x)) /* but not infinity */ 65 if (ieee754sp_isnan(x)) /* but not infinity */
57 return ieee754sp_nanxcpt(x, "neg", x); 66 return ieee754sp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 SPSIGN(x) ^= 1;
61 return x; 67 return x;
62} 68}
63 69
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 625843b30bed..873cf3141a31 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -82,8 +82,8 @@ static void __init serial_init(void)
82#endif 82#endif
83 s.irq = ATLASINT_UART; 83 s.irq = ATLASINT_UART;
84 s.uartclk = ATLAS_BASE_BAUD * 16; 84 s.uartclk = ATLAS_BASE_BAUD * 16;
85 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 85 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
86 s.iotype = SERIAL_IO_PORT; 86 s.iotype = UPIO_PORT;
87 s.regshift = 3; 87 s.regshift = 3;
88 88
89 if (early_serial_setup(&s) != 0) { 89 if (early_serial_setup(&s) != 0) {
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c
index 9fdec743bd95..7213c395fb6b 100644
--- a/arch/mips/mips-boards/generic/reset.c
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -23,6 +23,7 @@
23 * 23 *
24 */ 24 */
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/pm.h>
26 27
27#include <asm/io.h> 28#include <asm/io.h>
28#include <asm/reboot.h> 29#include <asm/reboot.h>
@@ -65,9 +66,9 @@ void mips_reboot_setup(void)
65 _machine_restart = mips_machine_restart; 66 _machine_restart = mips_machine_restart;
66 _machine_halt = mips_machine_halt; 67 _machine_halt = mips_machine_halt;
67#if defined(CONFIG_MIPS_ATLAS) 68#if defined(CONFIG_MIPS_ATLAS)
68 _machine_power_off = atlas_machine_power_off; 69 pm_power_off = atlas_machine_power_off;
69#endif 70#endif
70#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD) 71#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD)
71 _machine_power_off = mips_machine_halt; 72 pm_power_off = mips_machine_halt;
72#endif 73#endif
73} 74}
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index f966bc161dfa..4266ce445174 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -71,8 +71,8 @@ static void __init serial_init(void)
71#endif 71#endif
72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0; 72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0;
73 s.uartclk = SEAD_BASE_BAUD * 16; 73 s.uartclk = SEAD_BASE_BAUD * 16;
74 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 74 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
75 s.iotype = 0; 75 s.iotype = UPIO_PORT;
76 s.regshift = 3; 76 s.regshift = 3;
77 77
78 if (early_serial_setup(&s) != 0) { 78 if (early_serial_setup(&s) != 0) {
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index 485d5a58d9cf..a2fd62997ca3 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -88,8 +88,8 @@ static void __init serial_init(void)
88 but poll for now */ 88 but poll for now */
89 s.irq = 0; 89 s.irq = 0;
90 s.uartclk = BASE_BAUD * 16; 90 s.uartclk = BASE_BAUD * 16;
91 s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST; 91 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
92 s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST; 92 s.iotype = UPIO_PORT;
93 s.regshift = 0; 93 s.regshift = 0;
94 s.timeout = 4; 94 s.timeout = 4;
95 95
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 422b55fab07a..1b71d91e8268 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -464,72 +464,39 @@ static void r4k_flush_data_cache_page(unsigned long addr)
464} 464}
465 465
466struct flush_icache_range_args { 466struct flush_icache_range_args {
467 unsigned long __user start; 467 unsigned long start;
468 unsigned long __user end; 468 unsigned long end;
469}; 469};
470 470
471static inline void local_r4k_flush_icache_range(void *args) 471static inline void local_r4k_flush_icache_range(void *args)
472{ 472{
473 struct flush_icache_range_args *fir_args = args; 473 struct flush_icache_range_args *fir_args = args;
474 unsigned long dc_lsize = cpu_dcache_line_size();
475 unsigned long ic_lsize = cpu_icache_line_size();
476 unsigned long sc_lsize = cpu_scache_line_size();
477 unsigned long start = fir_args->start; 474 unsigned long start = fir_args->start;
478 unsigned long end = fir_args->end; 475 unsigned long end = fir_args->end;
479 unsigned long addr, aend;
480 476
481 if (!cpu_has_ic_fills_f_dc) { 477 if (!cpu_has_ic_fills_f_dc) {
482 if (end - start > dcache_size) { 478 if (end - start > dcache_size) {
483 r4k_blast_dcache(); 479 r4k_blast_dcache();
484 } else { 480 } else {
485 R4600_HIT_CACHEOP_WAR_IMPL; 481 R4600_HIT_CACHEOP_WAR_IMPL;
486 addr = start & ~(dc_lsize - 1); 482 protected_blast_dcache_range(start, end);
487 aend = (end - 1) & ~(dc_lsize - 1);
488
489 while (1) {
490 /* Hit_Writeback_Inv_D */
491 protected_writeback_dcache_line(addr);
492 if (addr == aend)
493 break;
494 addr += dc_lsize;
495 }
496 } 483 }
497 484
498 if (!cpu_icache_snoops_remote_store) { 485 if (!cpu_icache_snoops_remote_store) {
499 if (end - start > scache_size) { 486 if (end - start > scache_size)
500 r4k_blast_scache(); 487 r4k_blast_scache();
501 } else { 488 else
502 addr = start & ~(sc_lsize - 1); 489 protected_blast_scache_range(start, end);
503 aend = (end - 1) & ~(sc_lsize - 1);
504
505 while (1) {
506 /* Hit_Writeback_Inv_SD */
507 protected_writeback_scache_line(addr);
508 if (addr == aend)
509 break;
510 addr += sc_lsize;
511 }
512 }
513 } 490 }
514 } 491 }
515 492
516 if (end - start > icache_size) 493 if (end - start > icache_size)
517 r4k_blast_icache(); 494 r4k_blast_icache();
518 else { 495 else
519 addr = start & ~(ic_lsize - 1); 496 protected_blast_icache_range(start, end);
520 aend = (end - 1) & ~(ic_lsize - 1);
521 while (1) {
522 /* Hit_Invalidate_I */
523 protected_flush_icache_line(addr);
524 if (addr == aend)
525 break;
526 addr += ic_lsize;
527 }
528 }
529} 497}
530 498
531static void r4k_flush_icache_range(unsigned long __user start, 499static void r4k_flush_icache_range(unsigned long start, unsigned long end)
532 unsigned long __user end)
533{ 500{
534 struct flush_icache_range_args args; 501 struct flush_icache_range_args args;
535 502
@@ -620,27 +587,14 @@ static void r4k_flush_icache_page(struct vm_area_struct *vma,
620 587
621static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) 588static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
622{ 589{
623 unsigned long end, a;
624
625 /* Catch bad driver code */ 590 /* Catch bad driver code */
626 BUG_ON(size == 0); 591 BUG_ON(size == 0);
627 592
628 if (cpu_has_subset_pcaches) { 593 if (cpu_has_subset_pcaches) {
629 unsigned long sc_lsize = cpu_scache_line_size(); 594 if (size >= scache_size)
630
631 if (size >= scache_size) {
632 r4k_blast_scache(); 595 r4k_blast_scache();
633 return; 596 else
634 } 597 blast_scache_range(addr, addr + size);
635
636 a = addr & ~(sc_lsize - 1);
637 end = (addr + size - 1) & ~(sc_lsize - 1);
638 while (1) {
639 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
640 if (a == end)
641 break;
642 a += sc_lsize;
643 }
644 return; 598 return;
645 } 599 }
646 600
@@ -652,17 +606,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
652 if (size >= dcache_size) { 606 if (size >= dcache_size) {
653 r4k_blast_dcache(); 607 r4k_blast_dcache();
654 } else { 608 } else {
655 unsigned long dc_lsize = cpu_dcache_line_size();
656
657 R4600_HIT_CACHEOP_WAR_IMPL; 609 R4600_HIT_CACHEOP_WAR_IMPL;
658 a = addr & ~(dc_lsize - 1); 610 blast_dcache_range(addr, addr + size);
659 end = (addr + size - 1) & ~(dc_lsize - 1);
660 while (1) {
661 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
662 if (a == end)
663 break;
664 a += dc_lsize;
665 }
666 } 611 }
667 612
668 bc_wback_inv(addr, size); 613 bc_wback_inv(addr, size);
@@ -670,44 +615,22 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
670 615
671static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) 616static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
672{ 617{
673 unsigned long end, a;
674
675 /* Catch bad driver code */ 618 /* Catch bad driver code */
676 BUG_ON(size == 0); 619 BUG_ON(size == 0);
677 620
678 if (cpu_has_subset_pcaches) { 621 if (cpu_has_subset_pcaches) {
679 unsigned long sc_lsize = cpu_scache_line_size(); 622 if (size >= scache_size)
680
681 if (size >= scache_size) {
682 r4k_blast_scache(); 623 r4k_blast_scache();
683 return; 624 else
684 } 625 blast_scache_range(addr, addr + size);
685
686 a = addr & ~(sc_lsize - 1);
687 end = (addr + size - 1) & ~(sc_lsize - 1);
688 while (1) {
689 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
690 if (a == end)
691 break;
692 a += sc_lsize;
693 }
694 return; 626 return;
695 } 627 }
696 628
697 if (size >= dcache_size) { 629 if (size >= dcache_size) {
698 r4k_blast_dcache(); 630 r4k_blast_dcache();
699 } else { 631 } else {
700 unsigned long dc_lsize = cpu_dcache_line_size();
701
702 R4600_HIT_CACHEOP_WAR_IMPL; 632 R4600_HIT_CACHEOP_WAR_IMPL;
703 a = addr & ~(dc_lsize - 1); 633 blast_dcache_range(addr, addr + size);
704 end = (addr + size - 1) & ~(dc_lsize - 1);
705 while (1) {
706 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
707 if (a == end)
708 break;
709 a += dc_lsize;
710 }
711 } 634 }
712 635
713 bc_inv(addr, size); 636 bc_inv(addr, size);
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index 0a97a9434eba..7c572bea4a98 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -44,8 +44,6 @@ __asm__ __volatile__( \
44/* TX39H-style cache flush routines. */ 44/* TX39H-style cache flush routines. */
45static void tx39h_flush_icache_all(void) 45static void tx39h_flush_icache_all(void)
46{ 46{
47 unsigned long start = KSEG0;
48 unsigned long end = (start + icache_size);
49 unsigned long flags, config; 47 unsigned long flags, config;
50 48
51 /* disable icache (set ICE#) */ 49 /* disable icache (set ICE#) */
@@ -53,33 +51,18 @@ static void tx39h_flush_icache_all(void)
53 config = read_c0_conf(); 51 config = read_c0_conf();
54 write_c0_conf(config & ~TX39_CONF_ICE); 52 write_c0_conf(config & ~TX39_CONF_ICE);
55 TX39_STOP_STREAMING(); 53 TX39_STOP_STREAMING();
56 54 blast_icache16();
57 /* invalidate icache */
58 while (start < end) {
59 cache16_unroll32(start, Index_Invalidate_I);
60 start += 0x200;
61 }
62
63 write_c0_conf(config); 55 write_c0_conf(config);
64 local_irq_restore(flags); 56 local_irq_restore(flags);
65} 57}
66 58
67static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size) 59static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size)
68{ 60{
69 unsigned long end, a;
70 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
71
72 /* Catch bad driver code */ 61 /* Catch bad driver code */
73 BUG_ON(size == 0); 62 BUG_ON(size == 0);
74 63
75 iob(); 64 iob();
76 a = addr & ~(dc_lsize - 1); 65 blast_inv_dcache_range(addr, addr + size);
77 end = (addr + size - 1) & ~(dc_lsize - 1);
78 while (1) {
79 invalidate_dcache_line(a); /* Hit_Invalidate_D */
80 if (a == end) break;
81 a += dc_lsize;
82 }
83} 66}
84 67
85 68
@@ -241,42 +224,21 @@ static void tx39_flush_data_cache_page(unsigned long addr)
241 224
242static void tx39_flush_icache_range(unsigned long start, unsigned long end) 225static void tx39_flush_icache_range(unsigned long start, unsigned long end)
243{ 226{
244 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
245 unsigned long addr, aend;
246
247 if (end - start > dcache_size) 227 if (end - start > dcache_size)
248 tx39_blast_dcache(); 228 tx39_blast_dcache();
249 else { 229 else
250 addr = start & ~(dc_lsize - 1); 230 protected_blast_dcache_range(start, end);
251 aend = (end - 1) & ~(dc_lsize - 1);
252
253 while (1) {
254 /* Hit_Writeback_Inv_D */
255 protected_writeback_dcache_line(addr);
256 if (addr == aend)
257 break;
258 addr += dc_lsize;
259 }
260 }
261 231
262 if (end - start > icache_size) 232 if (end - start > icache_size)
263 tx39_blast_icache(); 233 tx39_blast_icache();
264 else { 234 else {
265 unsigned long flags, config; 235 unsigned long flags, config;
266 addr = start & ~(dc_lsize - 1);
267 aend = (end - 1) & ~(dc_lsize - 1);
268 /* disable icache (set ICE#) */ 236 /* disable icache (set ICE#) */
269 local_irq_save(flags); 237 local_irq_save(flags);
270 config = read_c0_conf(); 238 config = read_c0_conf();
271 write_c0_conf(config & ~TX39_CONF_ICE); 239 write_c0_conf(config & ~TX39_CONF_ICE);
272 TX39_STOP_STREAMING(); 240 TX39_STOP_STREAMING();
273 while (1) { 241 protected_blast_icache_range(start, end);
274 /* Hit_Invalidate_I */
275 protected_flush_icache_line(addr);
276 if (addr == aend)
277 break;
278 addr += dc_lsize;
279 }
280 write_c0_conf(config); 242 write_c0_conf(config);
281 local_irq_restore(flags); 243 local_irq_restore(flags);
282 } 244 }
@@ -311,7 +273,7 @@ static void tx39_flush_icache_page(struct vm_area_struct *vma, struct page *page
311 273
312static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size) 274static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
313{ 275{
314 unsigned long end, a; 276 unsigned long end;
315 277
316 if (((size | addr) & (PAGE_SIZE - 1)) == 0) { 278 if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
317 end = addr + size; 279 end = addr + size;
@@ -322,20 +284,13 @@ static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
322 } else if (size > dcache_size) { 284 } else if (size > dcache_size) {
323 tx39_blast_dcache(); 285 tx39_blast_dcache();
324 } else { 286 } else {
325 unsigned long dc_lsize = current_cpu_data.dcache.linesz; 287 blast_dcache_range(addr, addr + size);
326 a = addr & ~(dc_lsize - 1);
327 end = (addr + size - 1) & ~(dc_lsize - 1);
328 while (1) {
329 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
330 if (a == end) break;
331 a += dc_lsize;
332 }
333 } 288 }
334} 289}
335 290
336static void tx39_dma_cache_inv(unsigned long addr, unsigned long size) 291static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
337{ 292{
338 unsigned long end, a; 293 unsigned long end;
339 294
340 if (((size | addr) & (PAGE_SIZE - 1)) == 0) { 295 if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
341 end = addr + size; 296 end = addr + size;
@@ -346,14 +301,7 @@ static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
346 } else if (size > dcache_size) { 301 } else if (size > dcache_size) {
347 tx39_blast_dcache(); 302 tx39_blast_dcache();
348 } else { 303 } else {
349 unsigned long dc_lsize = current_cpu_data.dcache.linesz; 304 blast_inv_dcache_range(addr, addr + size);
350 a = addr & ~(dc_lsize - 1);
351 end = (addr + size - 1) & ~(dc_lsize - 1);
352 while (1) {
353 invalidate_dcache_line(a); /* Hit_Invalidate_D */
354 if (a == end) break;
355 a += dc_lsize;
356 }
357 } 305 }
358} 306}
359 307
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 314701a66b13..591c22b080e4 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -25,8 +25,7 @@ void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
25 unsigned long end); 25 unsigned long end);
26void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, 26void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page,
27 unsigned long pfn); 27 unsigned long pfn);
28void (*flush_icache_range)(unsigned long __user start, 28void (*flush_icache_range)(unsigned long start, unsigned long end);
29 unsigned long __user end);
30void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page); 29void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page);
31 30
32/* MIPS specific cache operations */ 31/* MIPS specific cache operations */
@@ -53,7 +52,7 @@ EXPORT_SYMBOL(_dma_cache_inv);
53 * We could optimize the case where the cache argument is not BCACHE but 52 * We could optimize the case where the cache argument is not BCACHE but
54 * that seems very atypical use ... 53 * that seems very atypical use ...
55 */ 54 */
56asmlinkage int sys_cacheflush(unsigned long __user addr, 55asmlinkage int sys_cacheflush(unsigned long addr,
57 unsigned long bytes, unsigned int cache) 56 unsigned long bytes, unsigned int cache)
58{ 57{
59 if (bytes == 0) 58 if (bytes == 0)
diff --git a/arch/mips/mm/cex-sb1.S b/arch/mips/mm/cex-sb1.S
index 0e71580774ff..e54a62f2807c 100644
--- a/arch/mips/mm/cex-sb1.S
+++ b/arch/mips/mm/cex-sb1.S
@@ -64,7 +64,7 @@ LEAF(except_vec2_sb1)
64 sd k0,0x170($0) 64 sd k0,0x170($0)
65 sd k1,0x178($0) 65 sd k1,0x178($0)
66 66
67#if CONFIG_SB1_CEX_ALWAYS_FATAL 67#ifdef CONFIG_SB1_CEX_ALWAYS_FATAL
68 j handle_vec2_sb1 68 j handle_vec2_sb1
69 nop 69 nop
70#else 70#else
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 4ee91c9a556f..0ff9a348b843 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -24,6 +24,7 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/highmem.h> 25#include <linux/highmem.h>
26#include <linux/swap.h> 26#include <linux/swap.h>
27#include <linux/proc_fs.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
29#include <asm/cachectl.h> 30#include <asm/cachectl.h>
@@ -200,6 +201,11 @@ static inline int page_is_ram(unsigned long pagenr)
200 return 0; 201 return 0;
201} 202}
202 203
204static struct kcore_list kcore_mem, kcore_vmalloc;
205#ifdef CONFIG_64BIT
206static struct kcore_list kcore_kseg0;
207#endif
208
203void __init mem_init(void) 209void __init mem_init(void)
204{ 210{
205 unsigned long codesize, reservedpages, datasize, initsize; 211 unsigned long codesize, reservedpages, datasize, initsize;
@@ -249,6 +255,16 @@ void __init mem_init(void)
249 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 255 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
250 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 256 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
251 257
258#ifdef CONFIG_64BIT
259 if ((unsigned long) &_text > (unsigned long) CKSEG0)
260 /* The -4 is a hack so that user tools don't have to handle
261 the overflow. */
262 kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4);
263#endif
264 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
265 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
266 VMALLOC_END-VMALLOC_START);
267
252 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 268 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
253 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", 269 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
254 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 270 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
index da6e1ed34db1..2292d0ec47fc 100644
--- a/arch/mips/momentum/jaguar_atx/ja-console.c
+++ b/arch/mips/momentum/jaguar_atx/ja-console.c
@@ -93,7 +93,7 @@ static void inline ja_console_probe(void)
93 up.uartclk = JAGUAR_ATX_UART_CLK; 93 up.uartclk = JAGUAR_ATX_UART_CLK;
94 up.regshift = 2; 94 up.regshift = 2;
95 up.iotype = UPIO_MEM; 95 up.iotype = UPIO_MEM;
96 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 96 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
97 up.line = 0; 97 up.line = 0;
98 98
99 if (early_serial_setup(&up)) 99 if (early_serial_setup(&up))
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
index bab192ddc185..301d67226d72 100644
--- a/arch/mips/momentum/jaguar_atx/setup.c
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -50,6 +50,7 @@
50#include <linux/pci.h> 50#include <linux/pci.h>
51#include <linux/swap.h> 51#include <linux/swap.h>
52#include <linux/ioport.h> 52#include <linux/ioport.h>
53#include <linux/pm.h>
53#include <linux/sched.h> 54#include <linux/sched.h>
54#include <linux/interrupt.h> 55#include <linux/interrupt.h>
55#include <linux/timex.h> 56#include <linux/timex.h>
@@ -365,7 +366,7 @@ void __init plat_setup(void)
365 366
366 _machine_restart = momenco_jaguar_restart; 367 _machine_restart = momenco_jaguar_restart;
367 _machine_halt = momenco_jaguar_halt; 368 _machine_halt = momenco_jaguar_halt;
368 _machine_power_off = momenco_jaguar_power_off; 369 pm_power_off = momenco_jaguar_power_off;
369 370
370 /* 371 /*
371 * initrd_start = (ulong)jaguar_initrd_start; 372 * initrd_start = (ulong)jaguar_initrd_start;
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index c9b7ff8148ec..f95677f4f06f 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -57,6 +57,8 @@
57#include <linux/timex.h> 57#include <linux/timex.h>
58#include <linux/bootmem.h> 58#include <linux/bootmem.h>
59#include <linux/mv643xx.h> 59#include <linux/mv643xx.h>
60#include <linux/pm.h>
61
60#include <asm/time.h> 62#include <asm/time.h>
61#include <asm/page.h> 63#include <asm/page.h>
62#include <asm/bootinfo.h> 64#include <asm/bootinfo.h>
@@ -321,7 +323,7 @@ void __init plat_setup(void)
321 323
322 _machine_restart = momenco_ocelot_restart; 324 _machine_restart = momenco_ocelot_restart;
323 _machine_halt = momenco_ocelot_halt; 325 _machine_halt = momenco_ocelot_halt;
324 _machine_power_off = momenco_ocelot_power_off; 326 pm_power_off = momenco_ocelot_power_off;
325 327
326 /* Wired TLB entries */ 328 /* Wired TLB entries */
327 setup_wired_tlb_entries(); 329 setup_wired_tlb_entries();
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
index 2755c1547473..15998d8a9341 100644
--- a/arch/mips/momentum/ocelot_c/setup.c
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -51,8 +51,10 @@
51#include <linux/sched.h> 51#include <linux/sched.h>
52#include <linux/interrupt.h> 52#include <linux/interrupt.h>
53#include <linux/pci.h> 53#include <linux/pci.h>
54#include <linux/pm.h>
54#include <linux/timex.h> 55#include <linux/timex.h>
55#include <linux/vmalloc.h> 56#include <linux/vmalloc.h>
57
56#include <asm/time.h> 58#include <asm/time.h>
57#include <asm/bootinfo.h> 59#include <asm/bootinfo.h>
58#include <asm/page.h> 60#include <asm/page.h>
@@ -236,7 +238,7 @@ void __init plat_setup(void)
236 238
237 _machine_restart = momenco_ocelot_restart; 239 _machine_restart = momenco_ocelot_restart;
238 _machine_halt = momenco_ocelot_halt; 240 _machine_halt = momenco_ocelot_halt;
239 _machine_power_off = momenco_ocelot_power_off; 241 pm_power_off = momenco_ocelot_power_off;
240 242
241 /* 243 /*
242 * initrd_start = (ulong)ocelot_initrd_start; 244 * initrd_start = (ulong)ocelot_initrd_start;
diff --git a/arch/mips/momentum/ocelot_g/setup.c b/arch/mips/momentum/ocelot_g/setup.c
index 6336751391c3..fed4e8eee116 100644
--- a/arch/mips/momentum/ocelot_g/setup.c
+++ b/arch/mips/momentum/ocelot_g/setup.c
@@ -47,8 +47,10 @@
47#include <linux/sched.h> 47#include <linux/sched.h>
48#include <linux/interrupt.h> 48#include <linux/interrupt.h>
49#include <linux/pci.h> 49#include <linux/pci.h>
50#include <linux/pm.h>
50#include <linux/timex.h> 51#include <linux/timex.h>
51#include <linux/vmalloc.h> 52#include <linux/vmalloc.h>
53
52#include <asm/time.h> 54#include <asm/time.h>
53#include <asm/bootinfo.h> 55#include <asm/bootinfo.h>
54#include <asm/page.h> 56#include <asm/page.h>
@@ -169,7 +171,7 @@ void __init plat_setup(void)
169 171
170 _machine_restart = momenco_ocelot_restart; 172 _machine_restart = momenco_ocelot_restart;
171 _machine_halt = momenco_ocelot_halt; 173 _machine_halt = momenco_ocelot_halt;
172 _machine_power_off = momenco_ocelot_power_off; 174 pm_power_off = momenco_ocelot_power_off;
173 175
174 /* 176 /*
175 * initrd_start = (ulong)ocelot_initrd_start; 177 * initrd_start = (ulong)ocelot_initrd_start;
diff --git a/arch/mips/oprofile/Makefile b/arch/mips/oprofile/Makefile
index 354261d37d62..0a50aad5bbe4 100644
--- a/arch/mips/oprofile/Makefile
+++ b/arch/mips/oprofile/Makefile
@@ -12,4 +12,5 @@ oprofile-y := $(DRIVER_OBJS) common.o
12 12
13oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o 13oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o
14oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o 14oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o
15oprofile-$(CONFIG_CPU_SB1) += op_model_mipsxx.o
15oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o 16oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 53f9889b30ed..935dd851f480 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -79,6 +79,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
79 case CPU_20KC: 79 case CPU_20KC:
80 case CPU_24K: 80 case CPU_24K:
81 case CPU_25KF: 81 case CPU_25KF:
82 case CPU_34K:
83 case CPU_SB1:
84 case CPU_SB1A:
82 lmodel = &op_model_mipsxx; 85 lmodel = &op_model_mipsxx;
83 break; 86 break;
84 87
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 1d1eee407faf..95d488ca0754 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -201,10 +201,21 @@ static int __init mipsxx_init(void)
201 op_model_mipsxx.cpu_type = "mips/25K"; 201 op_model_mipsxx.cpu_type = "mips/25K";
202 break; 202 break;
203 203
204#ifndef CONFIG_SMP
205 case CPU_34K:
206 op_model_mipsxx.cpu_type = "mips/34K";
207 break;
208#endif
209
204 case CPU_5KC: 210 case CPU_5KC:
205 op_model_mipsxx.cpu_type = "mips/5K"; 211 op_model_mipsxx.cpu_type = "mips/5K";
206 break; 212 break;
207 213
214 case CPU_SB1:
215 case CPU_SB1A:
216 op_model_mipsxx.cpu_type = "mips/sb1";
217 break;
218
208 default: 219 default:
209 printk(KERN_ERR "Profiling unsupported for this CPU\n"); 220 printk(KERN_ERR "Profiling unsupported for this CPU\n");
210 221
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 741e67c9195a..16205b587338 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \
46obj-$(CONFIG_SGI_IP27) += pci-ip27.o 46obj-$(CONFIG_SGI_IP27) += pci-ip27.o
47obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o 47obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o
48obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o 48obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
49obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o
49obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o 50obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o
50obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o 51obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o
51obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o 52obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index 909292f50d06..75a01e764898 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -17,7 +17,7 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/gt64120.h> 18#include <asm/gt64120.h>
19 19
20#include <asm/cobalt/cobalt.h> 20#include <asm/mach-cobalt/cobalt.h>
21 21
22extern int cobalt_board_id; 22extern int cobalt_board_id;
23 23
@@ -52,7 +52,7 @@ static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
52 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lt); 52 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lt);
53 if (lt < 64) 53 if (lt < 64)
54 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); 54 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
55 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7); 55 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8);
56} 56}
57 57
58DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, 58DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
@@ -69,7 +69,7 @@ static void qube_raq_galileo_fixup(struct pci_dev *dev)
69 * host bridge. 69 * host bridge.
70 */ 70 */
71 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); 71 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
72 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7); 72 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8);
73 73
74 /* 74 /*
75 * The code described by the comment below has been removed 75 * The code described by the comment below has been removed
diff --git a/arch/mips/pci/ops-gt64111.c b/arch/mips/pci/ops-gt64111.c
index c1807934768d..13de45940b19 100644
--- a/arch/mips/pci/ops-gt64111.c
+++ b/arch/mips/pci/ops-gt64111.c
@@ -15,7 +15,7 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/gt64120.h> 16#include <asm/gt64120.h>
17 17
18#include <asm/cobalt/cobalt.h> 18#include <asm/mach-cobalt/cobalt.h>
19 19
20/* 20/*
21 * Device 31 on the GT64111 is used to generate PCI special 21 * Device 31 on the GT64111 is used to generate PCI special
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index f194b4e4f86a..ca975e7d32ff 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -234,11 +234,9 @@ static int __init bcm1480_pcibios_init(void)
234 234
235 /* turn on ExpMemEn */ 235 /* turn on ExpMemEn */
236 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); 236 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40));
237 printk("PCIFeatureCtrl = %x\n", cmdreg);
238 WRITECFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40), 237 WRITECFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40),
239 cmdreg | 0x10); 238 cmdreg | 0x10);
240 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); 239 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40));
241 printk("PCIFeatureCtrl = %x\n", cmdreg);
242 240
243 /* 241 /*
244 * Establish mappings in KSEG2 (kernel virtual) to PCI I/O 242 * Establish mappings in KSEG2 (kernel virtual) to PCI I/O
diff --git a/arch/mips/philips/pnx8550/common/platform.c b/arch/mips/philips/pnx8550/common/platform.c
index 8aa9bd65b45e..a592260fd673 100644
--- a/arch/mips/philips/pnx8550/common/platform.c
+++ b/arch/mips/philips/pnx8550/common/platform.c
@@ -66,28 +66,28 @@ struct ip3106_port ip3106_ports[] = {
66 [0] = { 66 [0] = {
67 .port = { 67 .port = {
68 .type = PORT_IP3106, 68 .type = PORT_IP3106,
69 .iotype = SERIAL_IO_MEM, 69 .iotype = UPIO_MEM,
70 .membase = (void __iomem *)PNX8550_UART_PORT0, 70 .membase = (void __iomem *)PNX8550_UART_PORT0,
71 .mapbase = PNX8550_UART_PORT0, 71 .mapbase = PNX8550_UART_PORT0,
72 .irq = PNX8550_UART_INT(0), 72 .irq = PNX8550_UART_INT(0),
73 .uartclk = 3692300, 73 .uartclk = 3692300,
74 .fifosize = 16, 74 .fifosize = 16,
75 .ops = &ip3106_pops, 75 .ops = &ip3106_pops,
76 .flags = ASYNC_BOOT_AUTOCONF, 76 .flags = UPF_BOOT_AUTOCONF,
77 .line = 0, 77 .line = 0,
78 }, 78 },
79 }, 79 },
80 [1] = { 80 [1] = {
81 .port = { 81 .port = {
82 .type = PORT_IP3106, 82 .type = PORT_IP3106,
83 .iotype = SERIAL_IO_MEM, 83 .iotype = UPIO_MEM,
84 .membase = (void __iomem *)PNX8550_UART_PORT1, 84 .membase = (void __iomem *)PNX8550_UART_PORT1,
85 .mapbase = PNX8550_UART_PORT1, 85 .mapbase = PNX8550_UART_PORT1,
86 .irq = PNX8550_UART_INT(1), 86 .irq = PNX8550_UART_INT(1),
87 .uartclk = 3692300, 87 .uartclk = 3692300,
88 .fifosize = 16, 88 .fifosize = 16,
89 .ops = &ip3106_pops, 89 .ops = &ip3106_pops,
90 .flags = ASYNC_BOOT_AUTOCONF, 90 .flags = UPF_BOOT_AUTOCONF,
91 .line = 1, 91 .line = 1,
92 }, 92 },
93 }, 93 },
diff --git a/arch/mips/philips/pnx8550/common/setup.c b/arch/mips/philips/pnx8550/common/setup.c
index ee6bf72094f6..0d8a77619391 100644
--- a/arch/mips/philips/pnx8550/common/setup.c
+++ b/arch/mips/philips/pnx8550/common/setup.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/serial_ip3106.h> 27#include <linux/serial_ip3106.h>
28#include <linux/pm.h>
28 29
29#include <asm/cpu.h> 30#include <asm/cpu.h>
30#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
@@ -90,7 +91,7 @@ void __init plat_setup(void)
90 91
91 _machine_restart = pnx8550_machine_restart; 92 _machine_restart = pnx8550_machine_restart;
92 _machine_halt = pnx8550_machine_halt; 93 _machine_halt = pnx8550_machine_halt;
93 _machine_power_off = pnx8550_machine_power_off; 94 pm_power_off = pnx8550_machine_power_off;
94 95
95 board_time_init = pnx8550_time_init; 96 board_time_init = pnx8550_time_init;
96 board_timer_setup = pnx8550_timer_setup; 97 board_timer_setup = pnx8550_timer_setup;
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
index 555bfacf7647..165275c00cbb 100644
--- a/arch/mips/pmc-sierra/yosemite/prom.c
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/pm.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
17 18
18#include <asm/io.h> 19#include <asm/io.h>
@@ -92,7 +93,7 @@ void __init prom_init(void)
92 /* Callbacks for halt, restart */ 93 /* Callbacks for halt, restart */
93 _machine_restart = (void (*)(char *)) prom_exit; 94 _machine_restart = (void (*)(char *)) prom_exit;
94 _machine_halt = prom_halt; 95 _machine_halt = prom_halt;
95 _machine_power_off = prom_halt; 96 pm_power_off = prom_halt;
96 97
97 debug_vectors = cv; 98 debug_vectors = cv;
98 arcs_cmdline[0] = '\0'; 99 arcs_cmdline[0] = '\0';
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 059755b5ed57..8bce711575de 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -185,7 +185,7 @@ static void __init py_uart_setup(void)
185 up.uartclk = TITAN_UART_CLK; 185 up.uartclk = TITAN_UART_CLK;
186 up.regshift = 0; 186 up.regshift = 0;
187 up.iotype = UPIO_MEM; 187 up.iotype = UPIO_MEM;
188 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 188 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
189 up.line = 0; 189 up.line = 0;
190 190
191 if (early_serial_setup(&up)) 191 if (early_serial_setup(&up))
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index f17f575f58f0..7f8fda962190 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -94,7 +94,7 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
94void prom_boot_secondary(int cpu, struct task_struct *idle) 94void prom_boot_secondary(int cpu, struct task_struct *idle)
95{ 95{
96 unsigned long gp = (unsigned long) task_thread_info(idle); 96 unsigned long gp = (unsigned long) task_thread_info(idle);
97 unsigned long sp = __KSTK_TOP(idle); 97 unsigned long sp = __KSTK_TOS(idle);
98 98
99 secondary_sp = sp; 99 secondary_sp = sp;
100 secondary_gp = gp; 100 secondary_gp = gp;
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 214ffd2e98a3..92a3b3c15ed3 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -3,8 +3,9 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1997, 1998, 2001, 2003 by Ralf Baechle 6 * Copyright (C) 1997, 1998, 2001, 03, 05, 06 by Ralf Baechle
7 */ 7 */
8#include <linux/linkage.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/ds1286.h> 10#include <linux/ds1286.h>
10#include <linux/module.h> 11#include <linux/module.h>
@@ -12,6 +13,7 @@
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/sched.h> 14#include <linux/sched.h>
14#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/pm.h>
15#include <linux/timer.h> 17#include <linux/timer.h>
16 18
17#include <asm/io.h> 19#include <asm/io.h>
@@ -41,28 +43,10 @@ static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer;
41 43
42#define MACHINE_PANICED 1 44#define MACHINE_PANICED 1
43#define MACHINE_SHUTTING_DOWN 2 45#define MACHINE_SHUTTING_DOWN 2
44static int machine_state = 0;
45 46
46static void sgi_machine_restart(char *command) __attribute__((noreturn)); 47static int machine_state;
47static void sgi_machine_halt(void) __attribute__((noreturn));
48static void sgi_machine_power_off(void) __attribute__((noreturn));
49 48
50static void sgi_machine_restart(char *command) 49static void ATTRIB_NORET sgi_machine_power_off(void)
51{
52 if (machine_state & MACHINE_SHUTTING_DOWN)
53 sgi_machine_power_off();
54 sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT;
55 while (1);
56}
57
58static void sgi_machine_halt(void)
59{
60 if (machine_state & MACHINE_SHUTTING_DOWN)
61 sgi_machine_power_off();
62 ArcEnterInteractiveMode();
63}
64
65static void sgi_machine_power_off(void)
66{ 50{
67 unsigned int tmp; 51 unsigned int tmp;
68 52
@@ -84,6 +68,21 @@ static void sgi_machine_power_off(void)
84 } 68 }
85} 69}
86 70
71static void ATTRIB_NORET sgi_machine_restart(char *command)
72{
73 if (machine_state & MACHINE_SHUTTING_DOWN)
74 sgi_machine_power_off();
75 sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT;
76 while (1);
77}
78
79static void ATTRIB_NORET sgi_machine_halt(void)
80{
81 if (machine_state & MACHINE_SHUTTING_DOWN)
82 sgi_machine_power_off();
83 ArcEnterInteractiveMode();
84}
85
87static void power_timeout(unsigned long data) 86static void power_timeout(unsigned long data)
88{ 87{
89 sgi_machine_power_off(); 88 sgi_machine_power_off();
@@ -95,7 +94,7 @@ static void blink_timeout(unsigned long data)
95 sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); 94 sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
96 sgioc->reset = sgi_ioc_reset; 95 sgioc->reset = sgi_ioc_reset;
97 96
98 mod_timer(&blink_timer, jiffies+data); 97 mod_timer(&blink_timer, jiffies + data);
99} 98}
100 99
101static void debounce(unsigned long data) 100static void debounce(unsigned long data)
@@ -103,7 +102,7 @@ static void debounce(unsigned long data)
103 del_timer(&debounce_timer); 102 del_timer(&debounce_timer);
104 if (sgint->istat1 & SGINT_ISTAT1_PWR) { 103 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
105 /* Interrupt still being sent. */ 104 /* Interrupt still being sent. */
106 debounce_timer.expires = jiffies + 5; /* 0.05s */ 105 debounce_timer.expires = jiffies + (HZ / 20); /* 0.05s */
107 add_timer(&debounce_timer); 106 add_timer(&debounce_timer);
108 107
109 sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | 108 sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR |
@@ -151,7 +150,7 @@ static inline void volume_up_button(unsigned long data)
151 indy_volume_button(1); 150 indy_volume_button(1);
152 151
153 if (sgint->istat1 & SGINT_ISTAT1_PWR) { 152 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
154 volume_timer.expires = jiffies + 1; 153 volume_timer.expires = jiffies + (HZ / 100);
155 add_timer(&volume_timer); 154 add_timer(&volume_timer);
156 } 155 }
157} 156}
@@ -164,7 +163,7 @@ static inline void volume_down_button(unsigned long data)
164 indy_volume_button(-1); 163 indy_volume_button(-1);
165 164
166 if (sgint->istat1 & SGINT_ISTAT1_PWR) { 165 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
167 volume_timer.expires = jiffies + 1; 166 volume_timer.expires = jiffies + (HZ / 100);
168 add_timer(&volume_timer); 167 add_timer(&volume_timer);
169 } 168 }
170} 169}
@@ -199,14 +198,14 @@ static irqreturn_t panel_int(int irq, void *dev_id, struct pt_regs *regs)
199 if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { 198 if (!(buttons & SGIOC_PANEL_VOLUPINTR)) {
200 init_timer(&volume_timer); 199 init_timer(&volume_timer);
201 volume_timer.function = volume_up_button; 200 volume_timer.function = volume_up_button;
202 volume_timer.expires = jiffies + 1; 201 volume_timer.expires = jiffies + (HZ / 100);
203 add_timer(&volume_timer); 202 add_timer(&volume_timer);
204 } 203 }
205 /* Volume down button was pressed */ 204 /* Volume down button was pressed */
206 if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { 205 if (!(buttons & SGIOC_PANEL_VOLDNINTR)) {
207 init_timer(&volume_timer); 206 init_timer(&volume_timer);
208 volume_timer.function = volume_down_button; 207 volume_timer.function = volume_down_button;
209 volume_timer.expires = jiffies + 1; 208 volume_timer.expires = jiffies + (HZ / 100);
210 add_timer(&volume_timer); 209 add_timer(&volume_timer);
211 } 210 }
212 211
@@ -234,7 +233,7 @@ static int __init reboot_setup(void)
234{ 233{
235 _machine_restart = sgi_machine_restart; 234 _machine_restart = sgi_machine_restart;
236 _machine_halt = sgi_machine_halt; 235 _machine_halt = sgi_machine_halt;
237 _machine_power_off = sgi_machine_power_off; 236 pm_power_off = sgi_machine_power_off;
238 237
239 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); 238 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
240 init_timer(&blink_timer); 239 init_timer(&blink_timer);
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 5e59b4c8876b..7018e1833e85 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -56,6 +56,7 @@ extern void ip22_time_init(void) __init;
56void __init plat_setup(void) 56void __init plat_setup(void)
57{ 57{
58 char *ctype; 58 char *ctype;
59 char *cserial;
59 60
60 board_be_init = ip22_be_init; 61 board_be_init = ip22_be_init;
61 ip22_time_init(); 62 ip22_time_init();
@@ -81,9 +82,14 @@ void __init plat_setup(void)
81 /* ARCS console environment variable is set to "g?" for 82 /* ARCS console environment variable is set to "g?" for
82 * graphics console, it is set to "d" for the first serial 83 * graphics console, it is set to "d" for the first serial
83 * line and "d2" for the second serial line. 84 * line and "d2" for the second serial line.
85 *
86 * Need to check if the case is 'g' but no keyboard:
87 * (ConsoleIn/Out = serial)
84 */ 88 */
85 ctype = ArcGetEnvironmentVariable("console"); 89 ctype = ArcGetEnvironmentVariable("console");
86 if (ctype && *ctype == 'd') { 90 cserial = ArcGetEnvironmentVariable("ConsoleOut");
91
92 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
87 static char options[8]; 93 static char options[8];
88 char *baud = ArcGetEnvironmentVariable("dbaud"); 94 char *baud = ArcGetEnvironmentVariable("dbaud");
89 if (baud) 95 if (baud)
@@ -91,7 +97,7 @@ void __init plat_setup(void)
91 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0, 97 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
92 baud ? options : NULL); 98 baud ? options : NULL);
93 } else if (!ctype || *ctype != 'g') { 99 } else if (!ctype || *ctype != 'g') {
94 /* Use ARC if we don't want serial ('d') or Newport ('g'). */ 100 /* Use ARC if we don't want serial ('d') or graphics ('g'). */
95 prom_flags |= PROM_FLAG_USE_AS_CONSOLE; 101 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
96 add_preferred_console("arc", 0, NULL); 102 add_preferred_console("arc", 0, NULL);
97 } 103 }
diff --git a/arch/mips/sgi-ip27/ip27-reset.c b/arch/mips/sgi-ip27/ip27-reset.c
index 2e16be94c78b..4322db57d3c1 100644
--- a/arch/mips/sgi-ip27/ip27-reset.c
+++ b/arch/mips/sgi-ip27/ip27-reset.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Reset an IP27. 6 * Reset an IP27.
7 * 7 *
8 * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle 8 * Copyright (C) 1997, 1998, 1999, 2000, 06 by Ralf Baechle
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */ 10 */
11#include <linux/config.h> 11#include <linux/config.h>
@@ -15,6 +15,7 @@
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/mmzone.h> 16#include <linux/mmzone.h>
17#include <linux/nodemask.h> 17#include <linux/nodemask.h>
18#include <linux/pm.h>
18 19
19#include <asm/io.h> 20#include <asm/io.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
@@ -77,5 +78,5 @@ void ip27_reboot_setup(void)
77{ 78{
78 _machine_restart = ip27_machine_restart; 79 _machine_restart = ip27_machine_restart;
79 _machine_halt = ip27_machine_halt; 80 _machine_halt = ip27_machine_halt;
80 _machine_power_off = ip27_machine_power_off; 81 pm_power_off = ip27_machine_power_off;
81} 82}
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 88e1f52059ff..0c948008b023 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/ds17287rtc.h> 16#include <linux/ds17287rtc.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/pm.h>
18 19
19#include <asm/addrspace.h> 20#include <asm/addrspace.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
@@ -188,7 +189,7 @@ static __init int ip32_reboot_setup(void)
188 189
189 _machine_restart = ip32_machine_restart; 190 _machine_restart = ip32_machine_restart;
190 _machine_halt = ip32_machine_halt; 191 _machine_halt = ip32_machine_halt;
191 _machine_power_off = ip32_machine_power_off; 192 pm_power_off = ip32_machine_power_off;
192 193
193 init_timer(&blink_timer); 194 init_timer(&blink_timer);
194 blink_timer.function = blink_timeout; 195 blink_timer.function = blink_timeout;
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index d10a269aeae1..2c38770b1e1b 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -66,11 +66,6 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
66#include <linux/tty.h> 66#include <linux/tty.h>
67#include <linux/serial.h> 67#include <linux/serial.h>
68#include <linux/serial_core.h> 68#include <linux/serial_core.h>
69extern int early_serial_setup(struct uart_port *port);
70
71#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
72#define BASE_BAUD (1843200 / 16)
73
74#endif /* CONFIG_SERIAL_8250 */ 69#endif /* CONFIG_SERIAL_8250 */
75 70
76/* An arbitrary time; this can be decreased if reliability looks good */ 71/* An arbitrary time; this can be decreased if reliability looks good */
@@ -110,8 +105,8 @@ void __init plat_setup(void)
110 o2_serial[0].type = PORT_16550A; 105 o2_serial[0].type = PORT_16550A;
111 o2_serial[0].line = 0; 106 o2_serial[0].line = 0;
112 o2_serial[0].irq = MACEISA_SERIAL1_IRQ; 107 o2_serial[0].irq = MACEISA_SERIAL1_IRQ;
113 o2_serial[0].flags = STD_COM_FLAGS; 108 o2_serial[0].flags = UPF_SKIP_TEST;
114 o2_serial[0].uartclk = BASE_BAUD * 16; 109 o2_serial[0].uartclk = 1843200;
115 o2_serial[0].iotype = UPIO_MEM; 110 o2_serial[0].iotype = UPIO_MEM;
116 o2_serial[0].membase = (char *)&mace->isa.serial1; 111 o2_serial[0].membase = (char *)&mace->isa.serial1;
117 o2_serial[0].fifosize = 14; 112 o2_serial[0].fifosize = 14;
@@ -121,8 +116,8 @@ void __init plat_setup(void)
121 o2_serial[1].type = PORT_16550A; 116 o2_serial[1].type = PORT_16550A;
122 o2_serial[1].line = 1; 117 o2_serial[1].line = 1;
123 o2_serial[1].irq = MACEISA_SERIAL2_IRQ; 118 o2_serial[1].irq = MACEISA_SERIAL2_IRQ;
124 o2_serial[1].flags = STD_COM_FLAGS; 119 o2_serial[1].flags = UPF_SKIP_TEST;
125 o2_serial[1].uartclk = BASE_BAUD * 16; 120 o2_serial[1].uartclk = 1843200;
126 o2_serial[1].iotype = UPIO_MEM; 121 o2_serial[1].iotype = UPIO_MEM;
127 o2_serial[1].membase = (char *)&mace->isa.serial2; 122 o2_serial[1].membase = (char *)&mace->isa.serial2;
128 o2_serial[1].fifosize = 14; 123 o2_serial[1].fifosize = 14;
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index de46f62ac462..816aee7fcd25 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -102,11 +102,11 @@ config SIMULATION
102 Build a kernel suitable for running under the GDB simulator. 102 Build a kernel suitable for running under the GDB simulator.
103 Primarily adjusts the kernel's notion of time. 103 Primarily adjusts the kernel's notion of time.
104 104
105config CONFIG_SB1_CEX_ALWAYS_FATAL 105config SB1_CEX_ALWAYS_FATAL
106 bool "All cache exceptions considered fatal (no recovery attempted)" 106 bool "All cache exceptions considered fatal (no recovery attempted)"
107 depends on SIBYTE_SB1xxx_SOC 107 depends on SIBYTE_SB1xxx_SOC
108 108
109config CONFIG_SB1_CERR_STALL 109config SB1_CERR_STALL
110 bool "Stall (rather than panic) on fatal cache error" 110 bool "Stall (rather than panic) on fatal cache error"
111 depends on SIBYTE_SB1xxx_SOC 111 depends on SIBYTE_SB1xxx_SOC
112 112
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index b2a1ba5d23df..9cf7d713b13c 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -139,7 +139,7 @@ void bcm1480_unmask_irq(int cpu, int irq)
139#ifdef CONFIG_SMP 139#ifdef CONFIG_SMP
140static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask) 140static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
141{ 141{
142 int i = 0, old_cpu, cpu, int_on; 142 int i = 0, old_cpu, cpu, int_on, k;
143 u64 cur_ints; 143 u64 cur_ints;
144 irq_desc_t *desc = irq_desc + irq; 144 irq_desc_t *desc = irq_desc + irq;
145 unsigned long flags; 145 unsigned long flags;
@@ -165,7 +165,6 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
165 irq_dirty -= BCM1480_NR_IRQS_HALF; 165 irq_dirty -= BCM1480_NR_IRQS_HALF;
166 } 166 }
167 167
168 int k;
169 for (k=0; k<2; k++) { /* Loop through high and low interrupt mask register */ 168 for (k=0; k<2; k++) { /* Loop through high and low interrupt mask register */
170 cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(old_cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + (k*BCM1480_IMR_HL_SPACING))); 169 cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(old_cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + (k*BCM1480_IMR_HL_SPACING)));
171 int_on = !(cur_ints & (((u64) 1) << irq_dirty)); 170 int_on = !(cur_ints & (((u64) 1) << irq_dirty));
@@ -216,6 +215,7 @@ static void ack_bcm1480_irq(unsigned int irq)
216{ 215{
217 u64 pending; 216 u64 pending;
218 unsigned int irq_dirty; 217 unsigned int irq_dirty;
218 int k;
219 219
220 /* 220 /*
221 * If the interrupt was an HT interrupt, now is the time to 221 * If the interrupt was an HT interrupt, now is the time to
@@ -227,7 +227,6 @@ static void ack_bcm1480_irq(unsigned int irq)
227 if ((irq_dirty >= BCM1480_NR_IRQS_HALF) && (irq_dirty <= BCM1480_NR_IRQS)) { 227 if ((irq_dirty >= BCM1480_NR_IRQS_HALF) && (irq_dirty <= BCM1480_NR_IRQS)) {
228 irq_dirty -= BCM1480_NR_IRQS_HALF; 228 irq_dirty -= BCM1480_NR_IRQS_HALF;
229 } 229 }
230 int k;
231 for (k=0; k<2; k++) { /* Loop through high and low LDT interrupts */ 230 for (k=0; k<2; k++) { /* Loop through high and low LDT interrupts */
232 pending = __raw_readq(IOADDR(A_BCM1480_IMR_REGISTER(bcm1480_irq_owner[irq], 231 pending = __raw_readq(IOADDR(A_BCM1480_IMR_REGISTER(bcm1480_irq_owner[irq],
233 R_BCM1480_IMR_LDT_INTERRUPT_H + (k*BCM1480_IMR_HL_SPACING)))); 232 R_BCM1480_IMR_LDT_INTERRUPT_H + (k*BCM1480_IMR_HL_SPACING))));
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c
index 7a2c7a8510d4..ea308029450e 100644
--- a/arch/mips/sibyte/cfe/setup.c
+++ b/arch/mips/sibyte/cfe/setup.c
@@ -23,6 +23,7 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/blkdev.h> 24#include <linux/blkdev.h>
25#include <linux/bootmem.h> 25#include <linux/bootmem.h>
26#include <linux/pm.h>
26#include <linux/smp.h> 27#include <linux/smp.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
@@ -248,7 +249,7 @@ void __init prom_init(void)
248 249
249 _machine_restart = cfe_linux_restart; 250 _machine_restart = cfe_linux_restart;
250 _machine_halt = cfe_linux_halt; 251 _machine_halt = cfe_linux_halt;
251 _machine_power_off = cfe_linux_halt; 252 pm_power_off = cfe_linux_halt;
252 253
253 /* 254 /*
254 * Check if a loader was used; if NOT, the 4 arguments are 255 * Check if a loader was used; if NOT, the 4 arguments are
diff --git a/arch/mips/sibyte/sb1250/prom.c b/arch/mips/sibyte/sb1250/prom.c
index de62ab0f55a2..742043f8d755 100644
--- a/arch/mips/sibyte/sb1250/prom.c
+++ b/arch/mips/sibyte/sb1250/prom.c
@@ -24,6 +24,7 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/initrd.h> 26#include <linux/initrd.h>
27#include <linux/pm.h>
27 28
28#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
29#include <asm/reboot.h> 30#include <asm/reboot.h>
@@ -79,7 +80,7 @@ void __init prom_init(void)
79{ 80{
80 _machine_restart = (void (*)(char *))prom_linux_exit; 81 _machine_restart = (void (*)(char *))prom_linux_exit;
81 _machine_halt = prom_linux_exit; 82 _machine_halt = prom_linux_exit;
82 _machine_power_off = prom_linux_exit; 83 pm_power_off = prom_linux_exit;
83 84
84 strcpy(arcs_cmdline, "root=/dev/ram0 "); 85 strcpy(arcs_cmdline, "root=/dev/ram0 ");
85 86
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index df2e266c700c..fde4751c84fe 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/config.h> 18#include <linux/config.h>
19#include <linux/init.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/reboot.h> 21#include <linux/reboot.h>
21#include <linux/string.h> 22#include <linux/string.h>
@@ -42,7 +43,7 @@ static inline int setup_bcm112x(void);
42 43
43/* Setup code likely to be common to all SiByte platforms */ 44/* Setup code likely to be common to all SiByte platforms */
44 45
45static inline int sys_rev_decode(void) 46static int __init sys_rev_decode(void)
46{ 47{
47 int ret = 0; 48 int ret = 0;
48 49
@@ -74,7 +75,7 @@ static inline int sys_rev_decode(void)
74 return ret; 75 return ret;
75} 76}
76 77
77static inline int setup_bcm1250(void) 78static int __init setup_bcm1250(void)
78{ 79{
79 int ret = 0; 80 int ret = 0;
80 81
@@ -120,7 +121,7 @@ static inline int setup_bcm1250(void)
120 return ret; 121 return ret;
121} 122}
122 123
123static inline int setup_bcm112x(void) 124static int __init setup_bcm112x(void)
124{ 125{
125 int ret = 0; 126 int ret = 0;
126 127
@@ -146,7 +147,7 @@ static inline int setup_bcm112x(void)
146 return ret; 147 return ret;
147} 148}
148 149
149void sb1250_setup(void) 150void __init sb1250_setup(void)
150{ 151{
151 uint64_t sys_rev; 152 uint64_t sys_rev;
152 int plldiv; 153 int plldiv;
@@ -169,31 +170,42 @@ void sb1250_setup(void)
169 soc_str, pass_str, zbbus_mhz * 2, sb1_pass); 170 soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
170 prom_printf("Board type: %s\n", get_system_type()); 171 prom_printf("Board type: %s\n", get_system_type());
171 172
172 switch(war_pass) { 173 switch (war_pass) {
173 case K_SYS_REVISION_BCM1250_PASS1: 174 case K_SYS_REVISION_BCM1250_PASS1:
174#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS 175#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
175 prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); 176 prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
177 "and the kernel doesn't have the proper "
178 "workarounds compiled in. @@@@\n");
176 bad_config = 1; 179 bad_config = 1;
177#endif 180#endif
178 break; 181 break;
179 case K_SYS_REVISION_BCM1250_PASS2: 182 case K_SYS_REVISION_BCM1250_PASS2:
180 /* Pass 2 - easiest as default for now - so many numbers */ 183 /* Pass 2 - easiest as default for now - so many numbers */
181#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) 184#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \
182 prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); 185 !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
186 prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the "
187 "kernel doesn't have the proper workarounds "
188 "compiled in. @@@@\n");
183 bad_config = 1; 189 bad_config = 1;
184#endif 190#endif
185#ifdef CONFIG_CPU_HAS_PREFETCH 191#ifdef CONFIG_CPU_HAS_PREFETCH
186 prom_printf("@@@@ Prefetches may be enabled in this kernel, but are buggy on this board. @@@@\n"); 192 prom_printf("@@@@ Prefetches may be enabled in this kernel, "
193 "but are buggy on this board. @@@@\n");
187 bad_config = 1; 194 bad_config = 1;
188#endif 195#endif
189 break; 196 break;
190 case K_SYS_REVISION_BCM1250_PASS2_2: 197 case K_SYS_REVISION_BCM1250_PASS2_2:
191#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS 198#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
192 prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); 199 prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the "
200 "kernel doesn't have the proper workarounds "
201 "compiled in. @@@@\n");
193 bad_config = 1; 202 bad_config = 1;
194#endif 203#endif
195#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || !defined(CONFIG_CPU_HAS_PREFETCH) 204#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \
196 prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is conservatively configured for an 'A' stepping. @@@@\n"); 205 !defined(CONFIG_CPU_HAS_PREFETCH)
206 prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is "
207 "conservatively configured for an 'A' stepping. "
208 "@@@@\n");
197#endif 209#endif
198 break; 210 break;
199 default: 211 default:
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 262c85680709..1141fcd13a59 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
9 */ 9 */
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/eisa.h> 11#include <linux/eisa.h>
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/mc146818rtc.h> 17#include <linux/mc146818rtc.h>
18#include <linux/pm.h>
18#include <linux/pci.h> 19#include <linux/pci.h>
19#include <linux/console.h> 20#include <linux/console.h>
20#include <linux/fb.h> 21#include <linux/fb.h>
@@ -189,7 +190,7 @@ void __init plat_setup(void)
189 190
190 _machine_restart = sni_machine_restart; 191 _machine_restart = sni_machine_restart;
191 _machine_halt = sni_machine_halt; 192 _machine_halt = sni_machine_halt;
192 _machine_power_off = sni_machine_power_off; 193 pm_power_off = sni_machine_power_off;
193 194
194 sni_display_setup(); 195 sni_display_setup();
195 196
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
index e4d095d3e192..e19e2be70f76 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
@@ -60,7 +60,6 @@ void __init prom_init_cmdline(void)
60 60
61void __init prom_init(void) 61void __init prom_init(void)
62{ 62{
63 const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES;
64 extern int tx4927_get_mem_size(void); 63 extern int tx4927_get_mem_size(void);
65 extern char* toshiba_name; 64 extern char* toshiba_name;
66 int msize; 65 int msize;
@@ -69,12 +68,13 @@ void __init prom_init(void)
69 68
70 mips_machgroup = MACH_GROUP_TOSHIBA; 69 mips_machgroup = MACH_GROUP_TOSHIBA;
71 70
72 if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) 71 if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) {
73 mips_machtype = MACH_TOSHIBA_RBTX4927; 72 mips_machtype = MACH_TOSHIBA_RBTX4927;
74 else 73 toshiba_name = "TX4927";
74 } else {
75 mips_machtype = MACH_TOSHIBA_RBTX4937; 75 mips_machtype = MACH_TOSHIBA_RBTX4937;
76 76 toshiba_name = "TX4937";
77 toshiba_name = toshiba_name_list[mips_machtype]; 77 }
78 78
79 msize = tx4927_get_mem_size(); 79 msize = tx4927_get_mem_size();
80 add_memory_region(0, msize << 20, BOOT_MEM_RAM); 80 add_memory_region(0, msize << 20, BOOT_MEM_RAM);
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index 990fcb294bab..2ad6401d2af4 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -53,6 +53,8 @@
53#include <linux/interrupt.h> 53#include <linux/interrupt.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/timex.h> 55#include <linux/timex.h>
56#include <linux/pm.h>
57
56#include <asm/bootinfo.h> 58#include <asm/bootinfo.h>
57#include <asm/page.h> 59#include <asm/page.h>
58#include <asm/io.h> 60#include <asm/io.h>
@@ -537,19 +539,10 @@ void tx4927_pci_setup(void)
537 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, 539 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
538 "0x%08lx=mips_io_port_base", 540 "0x%08lx=mips_io_port_base",
539 mips_io_port_base); 541 mips_io_port_base);
540
541 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
542 "setup pci_io_resource to 0x%08lx 0x%08lx\n",
543 pci_io_resource.start,
544 pci_io_resource.end);
545 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
546 "setup pci_mem_resource to 0x%08lx 0x%08lx\n",
547 pci_mem_resource.start,
548 pci_mem_resource.end);
549
550 if (!called) { 542 if (!called) {
551 printk 543 printk
552 ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", 544 ("%s PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
545 toshiba_name,
553 (unsigned short) (tx4927_pcicptr->pciid >> 16), 546 (unsigned short) (tx4927_pcicptr->pciid >> 16),
554 (unsigned short) (tx4927_pcicptr->pciid & 0xffff), 547 (unsigned short) (tx4927_pcicptr->pciid & 0xffff),
555 (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), 548 (unsigned short) (tx4927_pcicptr->pciccrev & 0xff),
@@ -562,21 +555,52 @@ void tx4927_pci_setup(void)
562 (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); 555 (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : "");
563 if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { 556 if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) {
564 int pciclk = 0; 557 int pciclk = 0;
565 switch ((unsigned long) tx4927_ccfgptr-> 558 if (mips_machtype == MACH_TOSHIBA_RBTX4937)
566 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 559 switch ((unsigned long) tx4927_ccfgptr->
567 case TX4927_CCFG_PCIDIVMODE_2_5: 560 ccfg & TX4937_CCFG_PCIDIVMODE_MASK) {
568 pciclk = tx4927_cpu_clock * 2 / 5; 561 case TX4937_CCFG_PCIDIVMODE_4:
569 break; 562 pciclk = tx4927_cpu_clock / 4;
570 case TX4927_CCFG_PCIDIVMODE_3: 563 break;
571 pciclk = tx4927_cpu_clock / 3; 564 case TX4937_CCFG_PCIDIVMODE_4_5:
572 break; 565 pciclk = tx4927_cpu_clock * 2 / 9;
573 case TX4927_CCFG_PCIDIVMODE_5: 566 break;
574 pciclk = tx4927_cpu_clock / 5; 567 case TX4937_CCFG_PCIDIVMODE_5:
575 break; 568 pciclk = tx4927_cpu_clock / 5;
576 case TX4927_CCFG_PCIDIVMODE_6: 569 break;
577 pciclk = tx4927_cpu_clock / 6; 570 case TX4937_CCFG_PCIDIVMODE_5_5:
578 break; 571 pciclk = tx4927_cpu_clock * 2 / 11;
579 } 572 break;
573 case TX4937_CCFG_PCIDIVMODE_8:
574 pciclk = tx4927_cpu_clock / 8;
575 break;
576 case TX4937_CCFG_PCIDIVMODE_9:
577 pciclk = tx4927_cpu_clock / 9;
578 break;
579 case TX4937_CCFG_PCIDIVMODE_10:
580 pciclk = tx4927_cpu_clock / 10;
581 break;
582 case TX4937_CCFG_PCIDIVMODE_11:
583 pciclk = tx4927_cpu_clock / 11;
584 break;
585 }
586
587 else
588 switch ((unsigned long) tx4927_ccfgptr->
589 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
590 case TX4927_CCFG_PCIDIVMODE_2_5:
591 pciclk = tx4927_cpu_clock * 2 / 5;
592 break;
593 case TX4927_CCFG_PCIDIVMODE_3:
594 pciclk = tx4927_cpu_clock / 3;
595 break;
596 case TX4927_CCFG_PCIDIVMODE_5:
597 pciclk = tx4927_cpu_clock / 5;
598 break;
599 case TX4927_CCFG_PCIDIVMODE_6:
600 pciclk = tx4927_cpu_clock / 6;
601 break;
602 }
603
580 printk("Internal(%dMHz)", pciclk / 1000000); 604 printk("Internal(%dMHz)", pciclk / 1000000);
581 } else { 605 } else {
582 int pciclk = 0; 606 int pciclk = 0;
@@ -814,24 +838,40 @@ void __init toshiba_rbtx4927_setup(void)
814 ":ResetRoutines\n"); 838 ":ResetRoutines\n");
815 _machine_restart = toshiba_rbtx4927_restart; 839 _machine_restart = toshiba_rbtx4927_restart;
816 _machine_halt = toshiba_rbtx4927_halt; 840 _machine_halt = toshiba_rbtx4927_halt;
817 _machine_power_off = toshiba_rbtx4927_power_off; 841 pm_power_off = toshiba_rbtx4927_power_off;
818 842
819#ifdef CONFIG_PCI 843#ifdef CONFIG_PCI
820 844
821 /* PCIC */ 845 /* PCIC */
822 /* 846 /*
823 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. 847 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
824 * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1). 848 *
849 * For TX4927:
850 * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
825 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) 851 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
826 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) 852 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
827 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) 853 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
828 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) 854 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
829 * i.e. S9[3]: ON (83MHz), OFF (100MHz) 855 * i.e. S9[3]: ON (83MHz), OFF (100MHz)
856 *
857 * For TX4937:
858 * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
859 * PCIDIVMODE[10] is 0.
860 * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
861 * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
862 * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
863 * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
864 * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
865 * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
866 *
830 */ 867 */
831 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 868 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
832 "ccfg is %lx, DIV is %x\n", 869 "ccfg is %lx, PCIDIVMODE is %x\n",
833 (unsigned long) tx4927_ccfgptr-> 870 (unsigned long) tx4927_ccfgptr->ccfg,
834 ccfg, TX4927_CCFG_PCIDIVMODE_MASK); 871 (unsigned long) tx4927_ccfgptr->ccfg &
872 (mips_machtype == MACH_TOSHIBA_RBTX4937 ?
873 TX4937_CCFG_PCIDIVMODE_MASK :
874 TX4927_CCFG_PCIDIVMODE_MASK));
835 875
836 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 876 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
837 "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", 877 "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n",
@@ -842,20 +882,30 @@ void __init toshiba_rbtx4927_setup(void)
842 (unsigned long) tx4927_ccfgptr-> 882 (unsigned long) tx4927_ccfgptr->
843 ccfg & TX4927_CCFG_PCIXARB); 883 ccfg & TX4927_CCFG_PCIXARB);
844 884
845 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 885 if (mips_machtype == MACH_TOSHIBA_RBTX4937)
846 "PCIDIVMODE is %lx\n", 886 switch ((unsigned long)tx4927_ccfgptr->
847 (unsigned long) tx4927_ccfgptr-> 887 ccfg & TX4937_CCFG_PCIDIVMODE_MASK) {
848 ccfg & TX4927_CCFG_PCIDIVMODE_MASK); 888 case TX4937_CCFG_PCIDIVMODE_8:
849 889 case TX4937_CCFG_PCIDIVMODE_4:
850 switch ((unsigned long) tx4927_ccfgptr-> 890 tx4927_cpu_clock = 266666666; /* 266MHz */
851 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 891 break;
852 case TX4927_CCFG_PCIDIVMODE_2_5: 892 case TX4937_CCFG_PCIDIVMODE_9:
853 case TX4927_CCFG_PCIDIVMODE_5: 893 case TX4937_CCFG_PCIDIVMODE_4_5:
854 tx4927_cpu_clock = 166000000; /* 166MHz */ 894 tx4927_cpu_clock = 300000000; /* 300MHz */
855 break; 895 break;
856 default: 896 default:
857 tx4927_cpu_clock = 200000000; /* 200MHz */ 897 tx4927_cpu_clock = 333333333; /* 333MHz */
858 } 898 }
899 else
900 switch ((unsigned long)tx4927_ccfgptr->
901 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
902 case TX4927_CCFG_PCIDIVMODE_2_5:
903 case TX4927_CCFG_PCIDIVMODE_5:
904 tx4927_cpu_clock = 166666666; /* 166MHz */
905 break;
906 default:
907 tx4927_cpu_clock = 200000000; /* 200MHz */
908 }
859 909
860 /* CCFG */ 910 /* CCFG */
861 /* enable Timeout BusError */ 911 /* enable Timeout BusError */
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 9f1dcc8ca5a3..5c7ace982a49 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -20,6 +20,8 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/console.h> 21#include <linux/console.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/pm.h>
24
23#include <asm/wbflush.h> 25#include <asm/wbflush.h>
24#include <asm/reboot.h> 26#include <asm/reboot.h>
25#include <asm/irq.h> 27#include <asm/irq.h>
@@ -1003,7 +1005,7 @@ void __init toshiba_rbtx4938_setup(void)
1003 1005
1004 _machine_restart = rbtx4938_machine_restart; 1006 _machine_restart = rbtx4938_machine_restart;
1005 _machine_halt = rbtx4938_machine_halt; 1007 _machine_halt = rbtx4938_machine_halt;
1006 _machine_power_off = rbtx4938_machine_power_off; 1008 pm_power_off = rbtx4938_machine_power_off;
1007 1009
1008 *rbtx4938_led_ptr = 0xff; 1010 *rbtx4938_led_ptr = 0xff;
1009 printk("RBTX4938 --- FPGA(Rev %02x)", *rbtx4938_fpga_rev_ptr); 1011 printk("RBTX4938 --- FPGA(Rev %02x)", *rbtx4938_fpga_rev_ptr);
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c
index 02bf4f7d06ba..5e469796413f 100644
--- a/arch/mips/vr41xx/common/pmu.c
+++ b/arch/mips/vr41xx/common/pmu.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/pm.h>
24#include <linux/smp.h> 25#include <linux/smp.h>
25#include <linux/types.h> 26#include <linux/types.h>
26 27
@@ -114,7 +115,7 @@ static int __init vr41xx_pmu_init(void)
114 115
115 _machine_restart = vr41xx_restart; 116 _machine_restart = vr41xx_restart;
116 _machine_halt = vr41xx_halt; 117 _machine_halt = vr41xx_halt;
117 _machine_power_off = vr41xx_power_off; 118 pm_power_off = vr41xx_power_off;
118 119
119 return 0; 120 return 0;
120} 121}