aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c21
-rw-r--r--arch/ia64/Kconfig13
-rw-r--r--arch/ia64/Makefile2
-rw-r--r--arch/ia64/ia32/ia32_support.c10
-rw-r--r--arch/ia64/kernel/acpi.c10
-rw-r--r--arch/ia64/kernel/entry.S26
-rw-r--r--arch/ia64/kernel/palinfo.c6
-rw-r--r--arch/ia64/kernel/perfmon.c16
-rw-r--r--arch/ia64/kernel/process.c25
-rw-r--r--arch/ia64/kernel/sal.c11
-rw-r--r--arch/ia64/kernel/setup.c29
-rw-r--r--arch/ia64/mm/init.c25
-rw-r--r--arch/ia64/uv/Makefile12
-rw-r--r--arch/ia64/uv/kernel/Makefile13
-rw-r--r--arch/ia64/uv/kernel/machvec.c11
-rw-r--r--arch/ia64/uv/kernel/setup.c98
-rw-r--r--arch/m68knommu/Kconfig3
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S10
-rw-r--r--arch/mips/au1000/common/Makefile7
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c145
-rw-r--r--arch/mips/au1000/common/clocks.c24
-rw-r--r--arch/mips/au1000/common/cputable.c5
-rw-r--r--arch/mips/au1000/common/dbdma.c389
-rw-r--r--arch/mips/au1000/common/dbg_io.c32
-rw-r--r--arch/mips/au1000/common/dma.c56
-rw-r--r--arch/mips/au1000/common/gpio.c6
-rw-r--r--arch/mips/au1000/common/irq.c6
-rw-r--r--arch/mips/au1000/common/pci.c11
-rw-r--r--arch/mips/au1000/common/platform.c11
-rw-r--r--arch/mips/au1000/common/power.c157
-rw-r--r--arch/mips/au1000/common/prom.c21
-rw-r--r--arch/mips/au1000/common/puts.c35
-rw-r--r--arch/mips/au1000/common/reset.c33
-rw-r--r--arch/mips/au1000/common/setup.c60
-rw-r--r--arch/mips/au1000/common/time.c78
-rw-r--r--arch/mips/au1000/db1x00/Makefile8
-rw-r--r--arch/mips/au1000/db1x00/board_setup.c61
-rw-r--r--arch/mips/au1000/db1x00/init.c11
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c22
-rw-r--r--arch/mips/au1000/mtx-1/Makefile3
-rw-r--r--arch/mips/au1000/mtx-1/board_setup.c63
-rw-r--r--arch/mips/au1000/mtx-1/init.c11
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c18
-rw-r--r--arch/mips/au1000/mtx-1/platform.c3
-rw-r--r--arch/mips/au1000/pb1000/Makefile8
-rw-r--r--arch/mips/au1000/pb1000/board_setup.c117
-rw-r--r--arch/mips/au1000/pb1000/init.c20
-rw-r--r--arch/mips/au1000/pb1100/Makefile6
-rw-r--r--arch/mips/au1000/pb1100/board_setup.c50
-rw-r--r--arch/mips/au1000/pb1100/init.c11
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c10
-rw-r--r--arch/mips/au1000/pb1200/Makefile2
-rw-r--r--arch/mips/au1000/pb1200/board_setup.c139
-rw-r--r--arch/mips/au1000/pb1200/init.c18
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c66
-rw-r--r--arch/mips/au1000/pb1500/Makefile6
-rw-r--r--arch/mips/au1000/pb1500/board_setup.c46
-rw-r--r--arch/mips/au1000/pb1500/init.c20
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c6
-rw-r--r--arch/mips/au1000/pb1550/Makefile7
-rw-r--r--arch/mips/au1000/pb1550/board_setup.c16
-rw-r--r--arch/mips/au1000/pb1550/init.c20
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c6
-rw-r--r--arch/mips/au1000/xxs1500/Makefile3
-rw-r--r--arch/mips/au1000/xxs1500/board_setup.c39
-rw-r--r--arch/mips/au1000/xxs1500/init.c11
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c2
-rw-r--r--arch/mips/emma2rh/markeins/setup.c7
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cpu-bugs64.c2
-rw-r--r--arch/mips/kernel/irixelf.c11
-rw-r--r--arch/mips/kernel/kspd.c5
-rw-r--r--arch/mips/kernel/rtlx.c65
-rw-r--r--arch/mips/kernel/setup.c1
-rw-r--r--arch/mips/kernel/smp.c4
-rw-r--r--arch/mips/kernel/vpe.c29
-rw-r--r--arch/mips/mm/highmem.c1
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c6
-rw-r--r--arch/mips/pci/fixup-au1000.c7
-rw-r--r--arch/mips/pci/ops-au1000.c115
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c4
-rw-r--r--arch/mn10300/boot/install.sh16
-rw-r--r--arch/parisc/hpux/gate.S3
-rw-r--r--arch/parisc/hpux/wrappers.S3
-rw-r--r--arch/parisc/kernel/Makefile3
-rw-r--r--arch/parisc/kernel/entry.S49
-rw-r--r--arch/parisc/kernel/head.S2
-rw-r--r--arch/parisc/kernel/hpmc.S3
-rw-r--r--arch/parisc/kernel/inventory.c2
-rw-r--r--arch/parisc/kernel/pacache.S73
-rw-r--r--arch/parisc/kernel/perf_asm.S4
-rw-r--r--arch/parisc/kernel/real2.S13
-rw-r--r--arch/parisc/kernel/syscall.S5
-rw-r--r--arch/parisc/kernel/traps.c2
-rw-r--r--arch/parisc/kernel/unaligned.c5
-rw-r--r--arch/parisc/lib/fixup.S3
-rw-r--r--arch/parisc/lib/lusercopy.S5
-rw-r--r--arch/parisc/lib/memcpy.c2
-rw-r--r--arch/parisc/mm/init.c4
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts27
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts60
-rw-r--r--arch/powerpc/boot/dts/sbc8548.dts94
-rw-r--r--arch/powerpc/configs/mpc8610_hpcd_defconfig95
-rw-r--r--arch/powerpc/kernel/Makefile6
-rw-r--r--arch/powerpc/kernel/cputable.c2
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c28
-rw-r--r--arch/powerpc/mm/init_64.c10
-rw-r--r--arch/powerpc/mm/slb.c16
-rw-r--r--arch/powerpc/mm/slb_low.S16
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c121
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c30
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c15
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.c6
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.h6
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c2
-rw-r--r--arch/ppc/Makefile2
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c1
-rw-r--r--arch/ppc/kernel/setup.c1
-rw-r--r--arch/ppc/platforms/residual.c1
-rw-r--r--arch/s390/kernel/debug.c20
-rw-r--r--arch/s390/kernel/irq.c3
-rw-r--r--arch/s390/kernel/smp.c16
-rw-r--r--arch/s390/mm/vmem.c19
-rw-r--r--arch/sh/kernel/kgdb_stub.c8
-rw-r--r--arch/sparc/kernel/entry.S2
-rw-r--r--arch/sparc/kernel/process.c5
-rw-r--r--arch/sparc/kernel/ptrace.c6
-rw-r--r--arch/sparc/kernel/rtrap.S11
-rw-r--r--arch/sparc/kernel/signal.c64
-rw-r--r--arch/sparc/kernel/sys_sparc.c48
-rw-r--r--arch/sparc64/defconfig40
-rw-r--r--arch/sparc64/kernel/etrap.S7
-rw-r--r--arch/sparc64/kernel/ptrace.c16
-rw-r--r--arch/sparc64/kernel/rtrap.S7
-rw-r--r--arch/sparc64/kernel/signal.c81
-rw-r--r--arch/sparc64/kernel/signal32.c39
-rw-r--r--arch/sparc64/kernel/sys_sparc.c36
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c33
-rw-r--r--arch/sparc64/mm/init.c18
-rw-r--r--arch/um/Kconfig.char6
-rw-r--r--arch/um/drivers/chan_user.c1
-rw-r--r--arch/um/drivers/cow_sys.h2
-rw-r--r--arch/um/drivers/daemon_user.c4
-rw-r--r--arch/um/drivers/fd.c2
-rw-r--r--arch/um/drivers/hostaudio_kern.c2
-rw-r--r--arch/um/drivers/mcast_user.c3
-rw-r--r--arch/um/drivers/net_user.c2
-rw-r--r--arch/um/drivers/port_user.c2
-rw-r--r--arch/um/drivers/pty.c2
-rw-r--r--arch/um/drivers/random.c122
-rw-r--r--arch/um/drivers/slip_user.c2
-rw-r--r--arch/um/drivers/tty.c2
-rw-r--r--arch/um/drivers/ubd_kern.c4
-rw-r--r--arch/um/drivers/xterm.c2
-rw-r--r--arch/um/include/as-layout.h14
-rw-r--r--arch/um/include/line.h4
-rw-r--r--arch/um/include/os.h1
-rw-r--r--arch/um/include/process.h20
-rw-r--r--arch/um/include/skas_ptrace.h13
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h30
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h2
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace_user.h17
-rw-r--r--arch/um/include/um_malloc.h9
-rw-r--r--arch/um/kernel/dyn.lds.S7
-rw-r--r--arch/um/kernel/mem.c5
-rw-r--r--arch/um/kernel/time.c4
-rw-r--r--arch/um/kernel/um_arch.c7
-rw-r--r--arch/um/kernel/uml.lds.S7
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c4
-rw-r--r--arch/um/os-Linux/helper.c4
-rw-r--r--arch/um/os-Linux/main.c2
-rw-r--r--arch/um/os-Linux/sigio.c39
-rw-r--r--arch/um/os-Linux/signal.c1
-rw-r--r--arch/um/os-Linux/skas/process.c2
-rw-r--r--arch/um/os-Linux/start_up.c81
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/time.c54
-rw-r--r--arch/um/sys-i386/ptrace.c30
-rw-r--r--arch/um/sys-i386/user-offsets.c2
-rw-r--r--arch/um/sys-x86_64/user-offsets.c1
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.lds.S10
-rw-r--r--arch/x86/kernel/pci-dma.c8
-rw-r--r--arch/x86/kernel/process.c36
-rw-r--r--arch/x86/kernel/ptrace.c7
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/kernel/setup_64.c2
-rw-r--r--arch/x86/kernel/smp.c3
-rw-r--r--arch/x86/kernel/smpboot.c24
-rw-r--r--arch/x86/kernel/x8664_ksyms_64.c3
-rw-r--r--arch/x86/lib/csum-partial_64.c2
-rw-r--r--arch/x86/mm/init_32.c12
-rw-r--r--arch/x86/mm/pat.c6
-rw-r--r--arch/x86/pci/i386.c4
197 files changed, 2486 insertions, 1890 deletions
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 728bb8f39441..0babb645b83c 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -544,10 +544,10 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
544 struct resource *fb_res = &lcdc_resources[2]; 544 struct resource *fb_res = &lcdc_resources[2];
545 size_t fb_len = fb_res->end - fb_res->start + 1; 545 size_t fb_len = fb_res->end - fb_res->start + 1;
546 546
547 fb = ioremap_writecombine(fb_res->start, fb_len); 547 fb = ioremap(fb_res->start, fb_len);
548 if (fb) { 548 if (fb) {
549 memset(fb, 0, fb_len); 549 memset(fb, 0, fb_len);
550 iounmap(fb, fb_len); 550 iounmap(fb);
551 } 551 }
552 } 552 }
553 lcdc_data = *data; 553 lcdc_data = *data;
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 054689804e77..450db304936f 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -332,13 +332,6 @@ static struct resource lcdc_resources[] = {
332 .end = AT91SAM9RL_ID_LCDC, 332 .end = AT91SAM9RL_ID_LCDC,
333 .flags = IORESOURCE_IRQ, 333 .flags = IORESOURCE_IRQ,
334 }, 334 },
335#if defined(CONFIG_FB_INTSRAM)
336 [2] = {
337 .start = AT91SAM9RL_SRAM_BASE,
338 .end = AT91SAM9RL_SRAM_BASE + AT91SAM9RL_SRAM_SIZE - 1,
339 .flags = IORESOURCE_MEM,
340 },
341#endif
342}; 335};
343 336
344static struct platform_device at91_lcdc_device = { 337static struct platform_device at91_lcdc_device = {
@@ -381,20 +374,6 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
381 at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */ 374 at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */
382 at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */ 375 at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */
383 376
384#ifdef CONFIG_FB_INTSRAM
385 {
386 void __iomem *fb;
387 struct resource *fb_res = &lcdc_resources[2];
388 size_t fb_len = fb_res->end - fb_res->start + 1;
389
390 fb = ioremap_writecombine(fb_res->start, fb_len);
391 if (fb) {
392 memset(fb, 0, fb_len);
393 iounmap(fb, fb_len);
394 }
395 }
396#endif
397
398 lcdc_data = *data; 377 lcdc_data = *data;
399 platform_device_register(&at91_lcdc_device); 378 platform_device_register(&at91_lcdc_device);
400} 379}
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 0df5f6f75edf..16be41446b5b 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -135,6 +135,7 @@ config IA64_GENERIC
135 HP-zx1/sx1000 For HP systems 135 HP-zx1/sx1000 For HP systems
136 HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices. 136 HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices.
137 SGI-SN2 For SGI Altix systems 137 SGI-SN2 For SGI Altix systems
138 SGI-UV For SGI UV systems
138 Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/> 139 Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/>
139 140
140 If you don't know what to do, choose "generic". 141 If you don't know what to do, choose "generic".
@@ -170,6 +171,18 @@ config IA64_SGI_SN2
170 to select this option. If in doubt, select ia64 generic support 171 to select this option. If in doubt, select ia64 generic support
171 instead. 172 instead.
172 173
174config IA64_SGI_UV`
175 bool "SGI-UV`"
176 select NUMA
177 select ACPI_NUMA
178 select SWIOTLB
179 help
180 Selecting this option will optimize the kernel for use on UV based
181 systems, but the resulting kernel binary will not run on other
182 types of ia64 systems. If you have an SGI UV system, it's safe
183 to select this option. If in doubt, select ia64 generic support
184 instead.
185
173config IA64_HP_SIM 186config IA64_HP_SIM
174 bool "Ski-simulator" 187 bool "Ski-simulator"
175 select SWIOTLB 188 select SWIOTLB
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index ec4cca477f49..88f1a55c6c94 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -63,7 +63,7 @@ drivers-$(CONFIG_PCI) += arch/ia64/pci/
63drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/ 63drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/
64drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ 64drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
65drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ 65drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
66drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/ 66drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/ arch/ia64/uv/
67drivers-$(CONFIG_OPROFILE) += arch/ia64/oprofile/ 67drivers-$(CONFIG_OPROFILE) += arch/ia64/oprofile/
68 68
69boot := arch/ia64/hp/sim/boot 69boot := arch/ia64/hp/sim/boot
diff --git a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c
index 896b1ebbfb26..a6965ddafc46 100644
--- a/arch/ia64/ia32/ia32_support.c
+++ b/arch/ia64/ia32/ia32_support.c
@@ -15,7 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/personality.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20 19
21#include <asm/intrinsics.h> 20#include <asm/intrinsics.h>
@@ -29,7 +28,6 @@
29 28
30extern int die_if_kernel (char *str, struct pt_regs *regs, long err); 29extern int die_if_kernel (char *str, struct pt_regs *regs, long err);
31 30
32struct exec_domain ia32_exec_domain;
33struct page *ia32_shared_page[NR_CPUS]; 31struct page *ia32_shared_page[NR_CPUS];
34unsigned long *ia32_boot_gdt; 32unsigned long *ia32_boot_gdt;
35unsigned long *cpu_gdt_table[NR_CPUS]; 33unsigned long *cpu_gdt_table[NR_CPUS];
@@ -240,14 +238,6 @@ ia32_cpu_init (void)
240static int __init 238static int __init
241ia32_init (void) 239ia32_init (void)
242{ 240{
243 ia32_exec_domain.name = "Linux/x86";
244 ia32_exec_domain.handler = NULL;
245 ia32_exec_domain.pers_low = PER_LINUX32;
246 ia32_exec_domain.pers_high = PER_LINUX32;
247 ia32_exec_domain.signal_map = default_exec_domain.signal_map;
248 ia32_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
249 register_exec_domain(&ia32_exec_domain);
250
251#if PAGE_SHIFT > IA32_PAGE_SHIFT 241#if PAGE_SHIFT > IA32_PAGE_SHIFT
252 { 242 {
253 extern struct kmem_cache *ia64_partial_page_cachep; 243 extern struct kmem_cache *ia64_partial_page_cachep;
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 19709a079635..853d1f11be00 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -117,7 +117,10 @@ acpi_get_sysname(void)
117 if (!strcmp(hdr->oem_id, "HP")) { 117 if (!strcmp(hdr->oem_id, "HP")) {
118 return "hpzx1"; 118 return "hpzx1";
119 } else if (!strcmp(hdr->oem_id, "SGI")) { 119 } else if (!strcmp(hdr->oem_id, "SGI")) {
120 return "sn2"; 120 if (!strcmp(hdr->oem_table_id + 4, "UV"))
121 return "uv";
122 else
123 return "sn2";
121 } 124 }
122 125
123 return "dig"; 126 return "dig";
@@ -130,6 +133,8 @@ acpi_get_sysname(void)
130 return "hpzx1_swiotlb"; 133 return "hpzx1_swiotlb";
131# elif defined (CONFIG_IA64_SGI_SN2) 134# elif defined (CONFIG_IA64_SGI_SN2)
132 return "sn2"; 135 return "sn2";
136# elif defined (CONFIG_IA64_SGI_UV)
137 return "uv";
133# elif defined (CONFIG_IA64_DIG) 138# elif defined (CONFIG_IA64_DIG)
134 return "dig"; 139 return "dig";
135# else 140# else
@@ -622,6 +627,9 @@ void acpi_unregister_gsi(u32 gsi)
622 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM) 627 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
623 return; 628 return;
624 629
630 if (has_8259 && gsi < 16)
631 return;
632
625 iosapic_unregister_intr(gsi); 633 iosapic_unregister_intr(gsi);
626} 634}
627 635
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index e49ad8c5dc69..ca2bb95726de 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1156,6 +1156,9 @@ skip_rbs_switch:
1156 * r31 = current->thread_info->flags 1156 * r31 = current->thread_info->flags
1157 * On exit: 1157 * On exit:
1158 * p6 = TRUE if work-pending-check needs to be redone 1158 * p6 = TRUE if work-pending-check needs to be redone
1159 *
1160 * Interrupts are disabled on entry, reenabled depend on work, and
1161 * disabled on exit.
1159 */ 1162 */
1160.work_pending_syscall: 1163.work_pending_syscall:
1161 add r2=-8,r2 1164 add r2=-8,r2
@@ -1164,16 +1167,16 @@ skip_rbs_switch:
1164 st8 [r2]=r8 1167 st8 [r2]=r8
1165 st8 [r3]=r10 1168 st8 [r3]=r10
1166.work_pending: 1169.work_pending:
1167 tbit.z p6,p0=r31,TIF_NEED_RESCHED // current_thread_info()->need_resched==0? 1170 tbit.z p6,p0=r31,TIF_NEED_RESCHED // is resched not needed?
1168(p6) br.cond.sptk.few .notify 1171(p6) br.cond.sptk.few .notify
1169#ifdef CONFIG_PREEMPT 1172#ifdef CONFIG_PREEMPT
1170(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1 1173(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1
1171 ;; 1174 ;;
1172(pKStk) st4 [r20]=r21 1175(pKStk) st4 [r20]=r21
1173 ssm psr.i // enable interrupts
1174#endif 1176#endif
1177 ssm psr.i // enable interrupts
1175 br.call.spnt.many rp=schedule 1178 br.call.spnt.many rp=schedule
1176.ret9: cmp.eq p6,p0=r0,r0 // p6 <- 1 1179.ret9: cmp.eq p6,p0=r0,r0 // p6 <- 1 (re-check)
1177 rsm psr.i // disable interrupts 1180 rsm psr.i // disable interrupts
1178 ;; 1181 ;;
1179#ifdef CONFIG_PREEMPT 1182#ifdef CONFIG_PREEMPT
@@ -1182,13 +1185,13 @@ skip_rbs_switch:
1182(pKStk) st4 [r20]=r0 // preempt_count() <- 0 1185(pKStk) st4 [r20]=r0 // preempt_count() <- 0
1183#endif 1186#endif
1184(pLvSys)br.cond.sptk.few .work_pending_syscall_end 1187(pLvSys)br.cond.sptk.few .work_pending_syscall_end
1185 br.cond.sptk.many .work_processed_kernel // re-check 1188 br.cond.sptk.many .work_processed_kernel
1186 1189
1187.notify: 1190.notify:
1188(pUStk) br.call.spnt.many rp=notify_resume_user 1191(pUStk) br.call.spnt.many rp=notify_resume_user
1189.ret10: cmp.ne p6,p0=r0,r0 // p6 <- 0 1192.ret10: cmp.ne p6,p0=r0,r0 // p6 <- 0 (don't re-check)
1190(pLvSys)br.cond.sptk.few .work_pending_syscall_end 1193(pLvSys)br.cond.sptk.few .work_pending_syscall_end
1191 br.cond.sptk.many .work_processed_kernel // don't re-check 1194 br.cond.sptk.many .work_processed_kernel
1192 1195
1193.work_pending_syscall_end: 1196.work_pending_syscall_end:
1194 adds r2=PT(R8)+16,r12 1197 adds r2=PT(R8)+16,r12
@@ -1196,7 +1199,7 @@ skip_rbs_switch:
1196 ;; 1199 ;;
1197 ld8 r8=[r2] 1200 ld8 r8=[r2]
1198 ld8 r10=[r3] 1201 ld8 r10=[r3]
1199 br.cond.sptk.many .work_processed_syscall // re-check 1202 br.cond.sptk.many .work_processed_syscall
1200 1203
1201END(ia64_leave_kernel) 1204END(ia64_leave_kernel)
1202 1205
@@ -1234,9 +1237,12 @@ GLOBAL_ENTRY(ia64_invoke_schedule_tail)
1234END(ia64_invoke_schedule_tail) 1237END(ia64_invoke_schedule_tail)
1235 1238
1236 /* 1239 /*
1237 * Setup stack and call do_notify_resume_user(). Note that pSys and pNonSys need to 1240 * Setup stack and call do_notify_resume_user(), keeping interrupts
1238 * be set up by the caller. We declare 8 input registers so the system call 1241 * disabled.
1239 * args get preserved, in case we need to restart a system call. 1242 *
1243 * Note that pSys and pNonSys need to be set up by the caller.
1244 * We declare 8 input registers so the system call args get preserved,
1245 * in case we need to restart a system call.
1240 */ 1246 */
1241ENTRY(notify_resume_user) 1247ENTRY(notify_resume_user)
1242 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) 1248 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 4547a2092af9..9dc00f7fe10e 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -900,12 +900,6 @@ static void
900palinfo_smp_call(void *info) 900palinfo_smp_call(void *info)
901{ 901{
902 palinfo_smp_data_t *data = (palinfo_smp_data_t *)info; 902 palinfo_smp_data_t *data = (palinfo_smp_data_t *)info;
903 if (data == NULL) {
904 printk(KERN_ERR "palinfo: data pointer is NULL\n");
905 data->ret = 0; /* no output */
906 return;
907 }
908 /* does this actual call */
909 data->ret = (*data->func)(data->page); 903 data->ret = (*data->func)(data->page);
910} 904}
911 905
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index c1ad27de2dd2..71d05133f556 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -5013,12 +5013,13 @@ pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs)
5013} 5013}
5014 5014
5015static int pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds); 5015static int pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds);
5016
5016 /* 5017 /*
5017 * pfm_handle_work() can be called with interrupts enabled 5018 * pfm_handle_work() can be called with interrupts enabled
5018 * (TIF_NEED_RESCHED) or disabled. The down_interruptible 5019 * (TIF_NEED_RESCHED) or disabled. The down_interruptible
5019 * call may sleep, therefore we must re-enable interrupts 5020 * call may sleep, therefore we must re-enable interrupts
5020 * to avoid deadlocks. It is safe to do so because this function 5021 * to avoid deadlocks. It is safe to do so because this function
5021 * is called ONLY when returning to user level (PUStk=1), in which case 5022 * is called ONLY when returning to user level (pUStk=1), in which case
5022 * there is no risk of kernel stack overflow due to deep 5023 * there is no risk of kernel stack overflow due to deep
5023 * interrupt nesting. 5024 * interrupt nesting.
5024 */ 5025 */
@@ -5034,7 +5035,8 @@ pfm_handle_work(void)
5034 5035
5035 ctx = PFM_GET_CTX(current); 5036 ctx = PFM_GET_CTX(current);
5036 if (ctx == NULL) { 5037 if (ctx == NULL) {
5037 printk(KERN_ERR "perfmon: [%d] has no PFM context\n", task_pid_nr(current)); 5038 printk(KERN_ERR "perfmon: [%d] has no PFM context\n",
5039 task_pid_nr(current));
5038 return; 5040 return;
5039 } 5041 }
5040 5042
@@ -5058,11 +5060,12 @@ pfm_handle_work(void)
5058 /* 5060 /*
5059 * must be done before we check for simple-reset mode 5061 * must be done before we check for simple-reset mode
5060 */ 5062 */
5061 if (ctx->ctx_fl_going_zombie || ctx->ctx_state == PFM_CTX_ZOMBIE) goto do_zombie; 5063 if (ctx->ctx_fl_going_zombie || ctx->ctx_state == PFM_CTX_ZOMBIE)
5062 5064 goto do_zombie;
5063 5065
5064 //if (CTX_OVFL_NOBLOCK(ctx)) goto skip_blocking; 5066 //if (CTX_OVFL_NOBLOCK(ctx)) goto skip_blocking;
5065 if (reason == PFM_TRAP_REASON_RESET) goto skip_blocking; 5067 if (reason == PFM_TRAP_REASON_RESET)
5068 goto skip_blocking;
5066 5069
5067 /* 5070 /*
5068 * restore interrupt mask to what it was on entry. 5071 * restore interrupt mask to what it was on entry.
@@ -5110,7 +5113,8 @@ do_zombie:
5110 /* 5113 /*
5111 * in case of interruption of down() we don't restart anything 5114 * in case of interruption of down() we don't restart anything
5112 */ 5115 */
5113 if (ret < 0) goto nothing_to_do; 5116 if (ret < 0)
5117 goto nothing_to_do;
5114 5118
5115skip_blocking: 5119skip_blocking:
5116 pfm_resume_after_ovfl(ctx, ovfl_regs, regs); 5120 pfm_resume_after_ovfl(ctx, ovfl_regs, regs);
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 58dcfac5ea88..a3a34b4eb038 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -167,11 +167,18 @@ void tsk_clear_notify_resume(struct task_struct *tsk)
167 clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME); 167 clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME);
168} 168}
169 169
170/*
171 * do_notify_resume_user():
172 * Called from notify_resume_user at entry.S, with interrupts disabled.
173 */
170void 174void
171do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall) 175do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
172{ 176{
173 if (fsys_mode(current, &scr->pt)) { 177 if (fsys_mode(current, &scr->pt)) {
174 /* defer signal-handling etc. until we return to privilege-level 0. */ 178 /*
179 * defer signal-handling etc. until we return to
180 * privilege-level 0.
181 */
175 if (!ia64_psr(&scr->pt)->lp) 182 if (!ia64_psr(&scr->pt)->lp)
176 ia64_psr(&scr->pt)->lp = 1; 183 ia64_psr(&scr->pt)->lp = 1;
177 return; 184 return;
@@ -179,16 +186,26 @@ do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall
179 186
180#ifdef CONFIG_PERFMON 187#ifdef CONFIG_PERFMON
181 if (current->thread.pfm_needs_checking) 188 if (current->thread.pfm_needs_checking)
189 /*
190 * Note: pfm_handle_work() allow us to call it with interrupts
191 * disabled, and may enable interrupts within the function.
192 */
182 pfm_handle_work(); 193 pfm_handle_work();
183#endif 194#endif
184 195
185 /* deal with pending signal delivery */ 196 /* deal with pending signal delivery */
186 if (test_thread_flag(TIF_SIGPENDING)) 197 if (test_thread_flag(TIF_SIGPENDING)) {
198 local_irq_enable(); /* force interrupt enable */
187 ia64_do_signal(scr, in_syscall); 199 ia64_do_signal(scr, in_syscall);
200 }
188 201
189 /* copy user rbs to kernel rbs */ 202 /* copy user rbs to kernel rbs */
190 if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) 203 if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) {
204 local_irq_enable(); /* force interrupt enable */
191 ia64_sync_krbs(); 205 ia64_sync_krbs();
206 }
207
208 local_irq_disable(); /* force interrupt disable */
192} 209}
193 210
194static int pal_halt = 1; 211static int pal_halt = 1;
diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
index a3022dc48ef8..7e0259709c04 100644
--- a/arch/ia64/kernel/sal.c
+++ b/arch/ia64/kernel/sal.c
@@ -229,6 +229,14 @@ static void __init sal_desc_ap_wakeup(void *p) { }
229 */ 229 */
230static int sal_cache_flush_drops_interrupts; 230static int sal_cache_flush_drops_interrupts;
231 231
232static int __init
233force_pal_cache_flush(char *str)
234{
235 sal_cache_flush_drops_interrupts = 1;
236 return 0;
237}
238early_param("force_pal_cache_flush", force_pal_cache_flush);
239
232void __init 240void __init
233check_sal_cache_flush (void) 241check_sal_cache_flush (void)
234{ 242{
@@ -237,6 +245,9 @@ check_sal_cache_flush (void)
237 u64 vector, cache_type = 3; 245 u64 vector, cache_type = 3;
238 struct ia64_sal_retval isrv; 246 struct ia64_sal_retval isrv;
239 247
248 if (sal_cache_flush_drops_interrupts)
249 return;
250
240 cpu = get_cpu(); 251 cpu = get_cpu();
241 local_irq_save(flags); 252 local_irq_save(flags);
242 253
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5015ca1275ca..e9596cd0cdab 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -239,6 +239,25 @@ __initcall(register_memory);
239 239
240 240
241#ifdef CONFIG_KEXEC 241#ifdef CONFIG_KEXEC
242
243/*
244 * This function checks if the reserved crashkernel is allowed on the specific
245 * IA64 machine flavour. Machines without an IO TLB use swiotlb and require
246 * some memory below 4 GB (i.e. in 32 bit area), see the implementation of
247 * lib/swiotlb.c. The hpzx1 architecture has an IO TLB but cannot use that
248 * in kdump case. See the comment in sba_init() in sba_iommu.c.
249 *
250 * So, the only machvec that really supports loading the kdump kernel
251 * over 4 GB is "sn2".
252 */
253static int __init check_crashkernel_memory(unsigned long pbase, size_t size)
254{
255 if (ia64_platform_is("sn2") || ia64_platform_is("uv"))
256 return 1;
257 else
258 return pbase < (1UL << 32);
259}
260
242static void __init setup_crashkernel(unsigned long total, int *n) 261static void __init setup_crashkernel(unsigned long total, int *n)
243{ 262{
244 unsigned long long base = 0, size = 0; 263 unsigned long long base = 0, size = 0;
@@ -252,6 +271,16 @@ static void __init setup_crashkernel(unsigned long total, int *n)
252 base = kdump_find_rsvd_region(size, 271 base = kdump_find_rsvd_region(size,
253 rsvd_region, *n); 272 rsvd_region, *n);
254 } 273 }
274
275 if (!check_crashkernel_memory(base, size)) {
276 pr_warning("crashkernel: There would be kdump memory "
277 "at %ld GB but this is unusable because it "
278 "must\nbe below 4 GB. Change the memory "
279 "configuration of the machine.\n",
280 (unsigned long)(base >> 30));
281 return;
282 }
283
255 if (base != ~0UL) { 284 if (base != ~0UL) {
256 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " 285 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
257 "for crashkernel (System RAM: %ldMB)\n", 286 "for crashkernel (System RAM: %ldMB)\n",
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index fc6c6636ffda..200100ea7610 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -719,3 +719,28 @@ out:
719EXPORT_SYMBOL_GPL(remove_memory); 719EXPORT_SYMBOL_GPL(remove_memory);
720#endif /* CONFIG_MEMORY_HOTREMOVE */ 720#endif /* CONFIG_MEMORY_HOTREMOVE */
721#endif 721#endif
722
723/*
724 * Even when CONFIG_IA32_SUPPORT is not enabled it is
725 * useful to have the Linux/x86 domain registered to
726 * avoid an attempted module load when emulators call
727 * personality(PER_LINUX32). This saves several milliseconds
728 * on each such call.
729 */
730static struct exec_domain ia32_exec_domain;
731
732static int __init
733per_linux32_init(void)
734{
735 ia32_exec_domain.name = "Linux/x86";
736 ia32_exec_domain.handler = NULL;
737 ia32_exec_domain.pers_low = PER_LINUX32;
738 ia32_exec_domain.pers_high = PER_LINUX32;
739 ia32_exec_domain.signal_map = default_exec_domain.signal_map;
740 ia32_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
741 register_exec_domain(&ia32_exec_domain);
742
743 return 0;
744}
745
746__initcall(per_linux32_init);
diff --git a/arch/ia64/uv/Makefile b/arch/ia64/uv/Makefile
new file mode 100644
index 000000000000..aa9f91947c49
--- /dev/null
+++ b/arch/ia64/uv/Makefile
@@ -0,0 +1,12 @@
1# arch/ia64/uv/Makefile
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 2008 Silicon Graphics, Inc. All Rights Reserved.
8#
9# Makefile for the sn uv subplatform
10#
11
12obj-y += kernel/
diff --git a/arch/ia64/uv/kernel/Makefile b/arch/ia64/uv/kernel/Makefile
new file mode 100644
index 000000000000..8d92b4684d8e
--- /dev/null
+++ b/arch/ia64/uv/kernel/Makefile
@@ -0,0 +1,13 @@
1# arch/ia64/uv/kernel/Makefile
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 2008 Silicon Graphics, Inc. All Rights Reserved.
8#
9
10EXTRA_CFLAGS += -Iarch/ia64/sn/include
11
12obj-y += setup.o
13obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff --git a/arch/ia64/uv/kernel/machvec.c b/arch/ia64/uv/kernel/machvec.c
new file mode 100644
index 000000000000..50737a9dca74
--- /dev/null
+++ b/arch/ia64/uv/kernel/machvec.c
@@ -0,0 +1,11 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#define MACHVEC_PLATFORM_NAME uv
10#define MACHVEC_PLATFORM_HEADER <asm/machvec_uv.h>
11#include <asm/machvec_init.h>
diff --git a/arch/ia64/uv/kernel/setup.c b/arch/ia64/uv/kernel/setup.c
new file mode 100644
index 000000000000..9aa743203c3c
--- /dev/null
+++ b/arch/ia64/uv/kernel/setup.c
@@ -0,0 +1,98 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI UV Core Functions
7 *
8 * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#include <linux/module.h>
12#include <linux/percpu.h>
13#include <asm/sn/simulator.h>
14#include <asm/uv/uv_mmrs.h>
15#include <asm/uv/uv_hub.h>
16
17DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
18EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info);
19
20
21struct redir_addr {
22 unsigned long redirect;
23 unsigned long alias;
24};
25
26#define DEST_SHIFT UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT
27
28static __initdata struct redir_addr redir_addrs[] = {
29 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR, UVH_SI_ALIAS0_OVERLAY_CONFIG},
30 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR, UVH_SI_ALIAS1_OVERLAY_CONFIG},
31 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_SI_ALIAS2_OVERLAY_CONFIG},
32};
33
34static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
35{
36 union uvh_si_alias0_overlay_config_u alias;
37 union uvh_rh_gam_alias210_redirect_config_2_mmr_u redirect;
38 int i;
39
40 for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) {
41 alias.v = uv_read_local_mmr(redir_addrs[i].alias);
42 if (alias.s.base == 0) {
43 *size = (1UL << alias.s.m_alias);
44 redirect.v = uv_read_local_mmr(redir_addrs[i].redirect);
45 *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT;
46 return;
47 }
48 }
49 BUG();
50}
51
52void __init uv_setup(char **cmdline_p)
53{
54 union uvh_si_addr_map_config_u m_n_config;
55 union uvh_node_id_u node_id;
56 unsigned long gnode_upper;
57 int nid, cpu, m_val, n_val;
58 unsigned long mmr_base, lowmem_redir_base, lowmem_redir_size;
59
60 if (IS_MEDUSA()) {
61 lowmem_redir_base = 0;
62 lowmem_redir_size = 0;
63 node_id.v = 0;
64 m_n_config.s.m_skt = 37;
65 m_n_config.s.n_skt = 0;
66 mmr_base = 0;
67 } else {
68 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
69 node_id.v = uv_read_local_mmr(UVH_NODE_ID);
70 m_n_config.v = uv_read_local_mmr(UVH_SI_ADDR_MAP_CONFIG);
71 mmr_base =
72 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
73 ~UV_MMR_ENABLE;
74 }
75
76 m_val = m_n_config.s.m_skt;
77 n_val = m_n_config.s.n_skt;
78 printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
79
80 gnode_upper = (((unsigned long)node_id.s.node_id) &
81 ~((1 << n_val) - 1)) << m_val;
82
83 for_each_present_cpu(cpu) {
84 nid = cpu_to_node(cpu);
85 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
86 uv_cpu_hub_info(cpu)->lowmem_remap_top =
87 lowmem_redir_base + lowmem_redir_size;
88 uv_cpu_hub_info(cpu)->m_val = m_val;
89 uv_cpu_hub_info(cpu)->n_val = m_val;
90 uv_cpu_hub_info(cpu)->pnode_mask = (1 << n_val) -1;
91 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
92 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
93 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
94 uv_cpu_hub_info(cpu)->coherency_domain_number = 0;/* ZZZ */
95 printk(KERN_DEBUG "UV cpu %d, nid %d\n", cpu, nid);
96 }
97}
98
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 07eb4c4bab82..8e8441587c22 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -671,6 +671,9 @@ config ROMKERNEL
671 671
672endchoice 672endchoice
673 673
674if COLDFIRE
675source "kernel/Kconfig.preempt"
676endif
674source "mm/Kconfig" 677source "mm/Kconfig"
675 678
676endmenu 679endmenu
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 5592e0bf951f..93e69236ed6f 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -114,6 +114,16 @@ SECTIONS {
114 *(__kcrctab_gpl) 114 *(__kcrctab_gpl)
115 __stop___kcrctab_gpl = .; 115 __stop___kcrctab_gpl = .;
116 116
117 /* Kernel symbol table: Normal unused symbols */
118 __start___kcrctab_unused = .;
119 *(__kcrctab_unused)
120 __stop___kcrctab_unused = .;
121
122 /* Kernel symbol table: GPL-only unused symbols */
123 __start___kcrctab_unused_gpl = .;
124 *(__kcrctab_unused_gpl)
125 __stop___kcrctab_unused_gpl = .;
126
117 /* Kernel symbol table: GPL-future symbols */ 127 /* Kernel symbol table: GPL-future symbols */
118 __start___kcrctab_gpl_future = .; 128 __start___kcrctab_gpl_future = .;
119 *(__kcrctab_gpl_future) 129 *(__kcrctab_gpl_future)
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
index 90e2d7a46e8e..dd0e19dacfcf 100644
--- a/arch/mips/au1000/common/Makefile
+++ b/arch/mips/au1000/common/Makefile
@@ -1,9 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Au1000 CPU, generic files. 5# Makefile for the Alchemy Au1xx0 CPUs, generic files.
7# 6#
8 7
9obj-y += prom.o irq.o puts.o time.o reset.o \ 8obj-y += prom.o irq.o puts.o time.o reset.o \
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
index 37a10a01de9d..c7ca1596394c 100644
--- a/arch/mips/au1000/common/au1xxx_irqmap.c
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -40,20 +40,20 @@
40struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = { 40struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
41 41
42#if defined(CONFIG_SOC_AU1000) 42#if defined(CONFIG_SOC_AU1000)
43 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 43 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
44 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 44 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
45 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0}, 45 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0 },
46 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 46 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
47 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 47 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 },
48 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 48 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 },
49 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 49 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
50 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 50 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
51 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 51 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
52 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 52 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
53 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 53 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
54 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 54 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
55 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 55 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
56 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 56 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -62,32 +62,32 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
65 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 65 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 },
66 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 66 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 },
67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
71 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 71 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
72 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 72 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
74 74
75#elif defined(CONFIG_SOC_AU1500) 75#elif defined(CONFIG_SOC_AU1500)
76 76
77 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 77 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
80 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 80 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
83 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 83 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
84 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 84 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
85 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 85 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
86 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 86 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
87 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 87 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
88 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 88 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
89 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 89 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
90 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 90 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -100,26 +100,26 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
103 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 103 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
104 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 104 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
106 106
107#elif defined(CONFIG_SOC_AU1100) 107#elif defined(CONFIG_SOC_AU1100)
108 108
109 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 109 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
110 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 110 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
111 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 111 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0 },
112 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 112 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
113 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 113 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 },
114 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 114 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 },
115 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 115 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 },
116 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 116 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 },
117 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 117 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 },
118 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 118 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 },
119 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 119 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 },
120 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 120 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 },
121 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 121 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 },
122 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 122 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 },
123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -128,33 +128,33 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
131 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 131 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 },
132 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 132 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 },
133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
137 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 137 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
138 /*{ AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0},*/ 138 /* { AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0 }, */
139 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 139 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0 },
140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
141 141
142#elif defined(CONFIG_SOC_AU1550) 142#elif defined(CONFIG_SOC_AU1550)
143 143
144 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 144 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
147 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 147 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 },
148 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0}, 148 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0 },
149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 }, 151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 },
152 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 152 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
153 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 153 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0 },
154 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 154 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 },
155 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 155 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 },
156 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0}, 156 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0 },
157 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0}, 157 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0 },
158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -163,26 +163,26 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
166 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0}, 166 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0 },
167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
170 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 170 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
171 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 171 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 },
172 172
173#elif defined(CONFIG_SOC_AU1200) 173#elif defined(CONFIG_SOC_AU1200)
174 174
175 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 175 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0 },
176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 }, 176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 },
177 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 177 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0 },
178 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 178 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 },
179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 }, 179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 },
180 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 180 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0 },
181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 }, 181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 },
182 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 182 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 },
183 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 183 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 },
184 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0}, 184 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0 },
185 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0}, 185 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0 },
186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
@@ -191,10 +191,10 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
194 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0}, 194 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0 },
195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 }, 195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 },
196 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 196 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0 },
197 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0}, 197 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0 },
198 198
199#else 199#else
200#error "Error: Unknown Alchemy SOC" 200#error "Error: Unknown Alchemy SOC"
@@ -203,4 +203,3 @@ struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = {
203}; 203};
204 204
205int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map); 205int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map);
206
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c
index 3ce6cace0eb0..46f8ee0e2657 100644
--- a/arch/mips/au1000/common/clocks.c
+++ b/arch/mips/au1000/common/clocks.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Simple Au1000 clocks routines. 3 * Simple Au1xx0 clocks routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -30,8 +29,8 @@
30#include <linux/module.h> 29#include <linux/module.h>
31#include <asm/mach-au1x00/au1000.h> 30#include <asm/mach-au1x00/au1000.h>
32 31
33static unsigned int au1x00_clock; // Hz 32static unsigned int au1x00_clock; /* Hz */
34static unsigned int lcd_clock; // KHz 33static unsigned int lcd_clock; /* KHz */
35static unsigned long uart_baud_base; 34static unsigned long uart_baud_base;
36 35
37/* 36/*
@@ -47,8 +46,6 @@ unsigned int get_au1x00_speed(void)
47 return au1x00_clock; 46 return au1x00_clock;
48} 47}
49 48
50
51
52/* 49/*
53 * The UART baud base is not known at compile time ... if 50 * The UART baud base is not known at compile time ... if
54 * we want to be able to use the same code on different 51 * we want to be able to use the same code on different
@@ -73,24 +70,23 @@ void set_au1x00_uart_baud_base(unsigned long new_baud_base)
73void set_au1x00_lcd_clock(void) 70void set_au1x00_lcd_clock(void)
74{ 71{
75 unsigned int static_cfg0; 72 unsigned int static_cfg0;
76 unsigned int sys_busclk = 73 unsigned int sys_busclk = (get_au1x00_speed() / 1000) /
77 (get_au1x00_speed()/1000) / 74 ((int)(au_readl(SYS_POWERCTRL) & 0x03) + 2);
78 ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2);
79 75
80 static_cfg0 = au_readl(MEM_STCFG0); 76 static_cfg0 = au_readl(MEM_STCFG0);
81 77
82 if (static_cfg0 & (1<<11)) 78 if (static_cfg0 & (1 << 11))
83 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ 79 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */
84 else 80 else
85 lcd_clock = sys_busclk / 4; 81 lcd_clock = sys_busclk / 4;
86 82
87 if (lcd_clock > 50000) /* Epson MAX */ 83 if (lcd_clock > 50000) /* Epson MAX */
88 printk("warning: LCD clock too high (%d KHz)\n", lcd_clock); 84 printk(KERN_WARNING "warning: LCD clock too high (%u KHz)\n",
85 lcd_clock);
89} 86}
90 87
91unsigned int get_au1x00_lcd_clock(void) 88unsigned int get_au1x00_lcd_clock(void)
92{ 89{
93 return lcd_clock; 90 return lcd_clock;
94} 91}
95
96EXPORT_SYMBOL(get_au1x00_lcd_clock); 92EXPORT_SYMBOL(get_au1x00_lcd_clock);
diff --git a/arch/mips/au1000/common/cputable.c b/arch/mips/au1000/common/cputable.c
index 8c93a05d7382..ba6430bc2d03 100644
--- a/arch/mips/au1000/common/cputable.c
+++ b/arch/mips/au1000/common/cputable.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/mach-au1x00/au1000.h> 15#include <asm/mach-au1x00/au1000.h>
16 16
17struct cpu_spec* cur_cpu_spec[NR_CPUS]; 17struct cpu_spec *cur_cpu_spec[NR_CPUS];
18 18
19/* With some thought, we can probably use the mask to reduce the 19/* With some thought, we can probably use the mask to reduce the
20 * size of the table. 20 * size of the table.
@@ -39,8 +39,7 @@ struct cpu_spec cpu_specs[] = {
39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 } 39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 }
40}; 40};
41 41
42void 42void set_cpuspec(void)
43set_cpuspec(void)
44{ 43{
45 struct cpu_spec *sp; 44 struct cpu_spec *sp;
46 u32 prid; 45 u32 prid;
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index 53377dfc0640..42d555236de1 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -53,12 +53,11 @@
53 */ 53 */
54static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock); 54static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock);
55 55
56/* I couldn't find a macro that did this...... 56/* I couldn't find a macro that did this... */
57*/
58#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1)) 57#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1))
59 58
60static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE; 59static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE;
61static int dbdma_initialized=0; 60static int dbdma_initialized;
62static void au1xxx_dbdma_init(void); 61static void au1xxx_dbdma_init(void);
63 62
64static dbdev_tab_t dbdev_tab[] = { 63static dbdev_tab_t dbdev_tab[] = {
@@ -149,7 +148,7 @@ static dbdev_tab_t dbdev_tab[] = {
149 148
150 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, 149 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
151 150
152#endif // CONFIG_SOC_AU1200 151#endif /* CONFIG_SOC_AU1200 */
153 152
154 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 153 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
155 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 154 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
@@ -177,8 +176,7 @@ static dbdev_tab_t dbdev_tab[] = {
177 176
178static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS]; 177static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS];
179 178
180static dbdev_tab_t * 179static dbdev_tab_t *find_dbdev_id(u32 id)
181find_dbdev_id(u32 id)
182{ 180{
183 int i; 181 int i;
184 dbdev_tab_t *p; 182 dbdev_tab_t *p;
@@ -190,29 +188,27 @@ find_dbdev_id(u32 id)
190 return NULL; 188 return NULL;
191} 189}
192 190
193void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp) 191void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp)
194{ 192{
195 return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 193 return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
196} 194}
197EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt); 195EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt);
198 196
199u32 197u32 au1xxx_ddma_add_device(dbdev_tab_t *dev)
200au1xxx_ddma_add_device(dbdev_tab_t *dev)
201{ 198{
202 u32 ret = 0; 199 u32 ret = 0;
203 dbdev_tab_t *p=NULL; 200 dbdev_tab_t *p;
204 static u16 new_id=0x1000; 201 static u16 new_id = 0x1000;
205 202
206 p = find_dbdev_id(~0); 203 p = find_dbdev_id(~0);
207 if ( NULL != p ) 204 if (NULL != p) {
208 {
209 memcpy(p, dev, sizeof(dbdev_tab_t)); 205 memcpy(p, dev, sizeof(dbdev_tab_t));
210 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id); 206 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id);
211 ret = p->dev_id; 207 ret = p->dev_id;
212 new_id++; 208 new_id++;
213#if 0 209#if 0
214 printk("add_device: id:%x flags:%x padd:%x\n", 210 printk(KERN_DEBUG "add_device: id:%x flags:%x padd:%x\n",
215 p->dev_id, p->dev_flags, p->dev_physaddr ); 211 p->dev_id, p->dev_flags, p->dev_physaddr);
216#endif 212#endif
217 } 213 }
218 214
@@ -220,10 +216,8 @@ au1xxx_ddma_add_device(dbdev_tab_t *dev)
220} 216}
221EXPORT_SYMBOL(au1xxx_ddma_add_device); 217EXPORT_SYMBOL(au1xxx_ddma_add_device);
222 218
223/* Allocate a channel and return a non-zero descriptor if successful. 219/* Allocate a channel and return a non-zero descriptor if successful. */
224*/ 220u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
225u32
226au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
227 void (*callback)(int, void *), void *callparam) 221 void (*callback)(int, void *), void *callparam)
228{ 222{
229 unsigned long flags; 223 unsigned long flags;
@@ -234,7 +228,8 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
234 chan_tab_t *ctp; 228 chan_tab_t *ctp;
235 au1x_dma_chan_t *cp; 229 au1x_dma_chan_t *cp;
236 230
237 /* We do the intialization on the first channel allocation. 231 /*
232 * We do the intialization on the first channel allocation.
238 * We have to wait because of the interrupt handler initialization 233 * We have to wait because of the interrupt handler initialization
239 * which can't be done successfully during board set up. 234 * which can't be done successfully during board set up.
240 */ 235 */
@@ -242,16 +237,17 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
242 au1xxx_dbdma_init(); 237 au1xxx_dbdma_init();
243 dbdma_initialized = 1; 238 dbdma_initialized = 1;
244 239
245 if ((stp = find_dbdev_id(srcid)) == NULL) 240 stp = find_dbdev_id(srcid);
241 if (stp == NULL)
246 return 0; 242 return 0;
247 if ((dtp = find_dbdev_id(destid)) == NULL) 243 dtp = find_dbdev_id(destid);
244 if (dtp == NULL)
248 return 0; 245 return 0;
249 246
250 used = 0; 247 used = 0;
251 rv = 0; 248 rv = 0;
252 249
253 /* Check to see if we can get both channels. 250 /* Check to see if we can get both channels. */
254 */
255 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 251 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
256 if (!(stp->dev_flags & DEV_FLAGS_INUSE) || 252 if (!(stp->dev_flags & DEV_FLAGS_INUSE) ||
257 (stp->dev_flags & DEV_FLAGS_ANYUSE)) { 253 (stp->dev_flags & DEV_FLAGS_ANYUSE)) {
@@ -261,35 +257,30 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
261 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) { 257 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) {
262 /* Got destination */ 258 /* Got destination */
263 dtp->dev_flags |= DEV_FLAGS_INUSE; 259 dtp->dev_flags |= DEV_FLAGS_INUSE;
264 } 260 } else {
265 else { 261 /* Can't get dest. Release src. */
266 /* Can't get dest. Release src.
267 */
268 stp->dev_flags &= ~DEV_FLAGS_INUSE; 262 stp->dev_flags &= ~DEV_FLAGS_INUSE;
269 used++; 263 used++;
270 } 264 }
271 } 265 } else
272 else {
273 used++; 266 used++;
274 }
275 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 267 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
276 268
277 if (!used) { 269 if (!used) {
278 /* Let's see if we can allocate a channel for it. 270 /* Let's see if we can allocate a channel for it. */
279 */
280 ctp = NULL; 271 ctp = NULL;
281 chan = 0; 272 chan = 0;
282 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 273 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
283 for (i=0; i<NUM_DBDMA_CHANS; i++) { 274 for (i = 0; i < NUM_DBDMA_CHANS; i++)
284 if (chan_tab_ptr[i] == NULL) { 275 if (chan_tab_ptr[i] == NULL) {
285 /* If kmalloc fails, it is caught below same 276 /*
277 * If kmalloc fails, it is caught below same
286 * as a channel not available. 278 * as a channel not available.
287 */ 279 */
288 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC); 280 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
289 chan_tab_ptr[i] = ctp; 281 chan_tab_ptr[i] = ctp;
290 break; 282 break;
291 } 283 }
292 }
293 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 284 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
294 285
295 if (ctp != NULL) { 286 if (ctp != NULL) {
@@ -304,8 +295,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
304 ctp->chan_callback = callback; 295 ctp->chan_callback = callback;
305 ctp->chan_callparam = callparam; 296 ctp->chan_callparam = callparam;
306 297
307 /* Initialize channel configuration. 298 /* Initialize channel configuration. */
308 */
309 i = 0; 299 i = 0;
310 if (stp->dev_intlevel) 300 if (stp->dev_intlevel)
311 i |= DDMA_CFG_SED; 301 i |= DDMA_CFG_SED;
@@ -326,8 +316,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
326 * operations. 316 * operations.
327 */ 317 */
328 rv = (u32)(&chan_tab_ptr[chan]); 318 rv = (u32)(&chan_tab_ptr[chan]);
329 } 319 } else {
330 else {
331 /* Release devices */ 320 /* Release devices */
332 stp->dev_flags &= ~DEV_FLAGS_INUSE; 321 stp->dev_flags &= ~DEV_FLAGS_INUSE;
333 dtp->dev_flags &= ~DEV_FLAGS_INUSE; 322 dtp->dev_flags &= ~DEV_FLAGS_INUSE;
@@ -337,11 +326,11 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
337} 326}
338EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc); 327EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc);
339 328
340/* Set the device width if source or destination is a FIFO. 329/*
330 * Set the device width if source or destination is a FIFO.
341 * Should be 8, 16, or 32 bits. 331 * Should be 8, 16, or 32 bits.
342 */ 332 */
343u32 333u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
344au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
345{ 334{
346 u32 rv; 335 u32 rv;
347 chan_tab_t *ctp; 336 chan_tab_t *ctp;
@@ -365,10 +354,8 @@ au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
365} 354}
366EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth); 355EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth);
367 356
368/* Allocate a descriptor ring, initializing as much as possible. 357/* Allocate a descriptor ring, initializing as much as possible. */
369*/ 358u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
370u32
371au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
372{ 359{
373 int i; 360 int i;
374 u32 desc_base, srcid, destid; 361 u32 desc_base, srcid, destid;
@@ -378,43 +365,45 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
378 dbdev_tab_t *stp, *dtp; 365 dbdev_tab_t *stp, *dtp;
379 au1x_ddma_desc_t *dp; 366 au1x_ddma_desc_t *dp;
380 367
381 /* I guess we could check this to be within the 368 /*
369 * I guess we could check this to be within the
382 * range of the table...... 370 * range of the table......
383 */ 371 */
384 ctp = *((chan_tab_t **)chanid); 372 ctp = *((chan_tab_t **)chanid);
385 stp = ctp->chan_src; 373 stp = ctp->chan_src;
386 dtp = ctp->chan_dest; 374 dtp = ctp->chan_dest;
387 375
388 /* The descriptors must be 32-byte aligned. There is a 376 /*
377 * The descriptors must be 32-byte aligned. There is a
389 * possibility the allocation will give us such an address, 378 * possibility the allocation will give us such an address,
390 * and if we try that first we are likely to not waste larger 379 * and if we try that first we are likely to not waste larger
391 * slabs of memory. 380 * slabs of memory.
392 */ 381 */
393 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), 382 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
394 GFP_KERNEL|GFP_DMA); 383 GFP_KERNEL|GFP_DMA);
395 if (desc_base == 0) 384 if (desc_base == 0)
396 return 0; 385 return 0;
397 386
398 if (desc_base & 0x1f) { 387 if (desc_base & 0x1f) {
399 /* Lost....do it again, allocate extra, and round 388 /*
389 * Lost....do it again, allocate extra, and round
400 * the address base. 390 * the address base.
401 */ 391 */
402 kfree((const void *)desc_base); 392 kfree((const void *)desc_base);
403 i = entries * sizeof(au1x_ddma_desc_t); 393 i = entries * sizeof(au1x_ddma_desc_t);
404 i += (sizeof(au1x_ddma_desc_t) - 1); 394 i += (sizeof(au1x_ddma_desc_t) - 1);
405 if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0) 395 desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA);
396 if (desc_base == 0)
406 return 0; 397 return 0;
407 398
408 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t)); 399 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));
409 } 400 }
410 dp = (au1x_ddma_desc_t *)desc_base; 401 dp = (au1x_ddma_desc_t *)desc_base;
411 402
412 /* Keep track of the base descriptor. 403 /* Keep track of the base descriptor. */
413 */
414 ctp->chan_desc_base = dp; 404 ctp->chan_desc_base = dp;
415 405
416 /* Initialize the rings with as much information as we know. 406 /* Initialize the rings with as much information as we know. */
417 */
418 srcid = stp->dev_id; 407 srcid = stp->dev_id;
419 destid = dtp->dev_id; 408 destid = dtp->dev_id;
420 409
@@ -426,11 +415,12 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
426 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV; 415 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV;
427 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE); 416 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE);
428 417
429 /* is it mem to mem transfer? */ 418 /* Is it mem to mem transfer? */
430 if(((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) && 419 if (((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) ||
431 ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS))) { 420 (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) &&
432 cmd0 |= DSCR_CMD0_MEM; 421 ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) ||
433 } 422 (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS)))
423 cmd0 |= DSCR_CMD0_MEM;
434 424
435 switch (stp->dev_devwidth) { 425 switch (stp->dev_devwidth) {
436 case 8: 426 case 8:
@@ -458,15 +448,17 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
458 break; 448 break;
459 } 449 }
460 450
461 /* If the device is marked as an in/out FIFO, ensure it is 451 /*
452 * If the device is marked as an in/out FIFO, ensure it is
462 * set non-coherent. 453 * set non-coherent.
463 */ 454 */
464 if (stp->dev_flags & DEV_FLAGS_IN) 455 if (stp->dev_flags & DEV_FLAGS_IN)
465 cmd0 |= DSCR_CMD0_SN; /* Source in fifo */ 456 cmd0 |= DSCR_CMD0_SN; /* Source in FIFO */
466 if (dtp->dev_flags & DEV_FLAGS_OUT) 457 if (dtp->dev_flags & DEV_FLAGS_OUT)
467 cmd0 |= DSCR_CMD0_DN; /* Destination out fifo */ 458 cmd0 |= DSCR_CMD0_DN; /* Destination out FIFO */
468 459
469 /* Set up source1. For now, assume no stride and increment. 460 /*
461 * Set up source1. For now, assume no stride and increment.
470 * A channel attribute update can change this later. 462 * A channel attribute update can change this later.
471 */ 463 */
472 switch (stp->dev_tsize) { 464 switch (stp->dev_tsize) {
@@ -485,19 +477,19 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
485 break; 477 break;
486 } 478 }
487 479
488 /* If source input is fifo, set static address. 480 /* If source input is FIFO, set static address. */
489 */
490 if (stp->dev_flags & DEV_FLAGS_IN) { 481 if (stp->dev_flags & DEV_FLAGS_IN) {
491 if ( stp->dev_flags & DEV_FLAGS_BURSTABLE ) 482 if (stp->dev_flags & DEV_FLAGS_BURSTABLE)
492 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST); 483 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST);
493 else 484 else
494 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); 485 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC);
495
496 } 486 }
487
497 if (stp->dev_physaddr) 488 if (stp->dev_physaddr)
498 src0 = stp->dev_physaddr; 489 src0 = stp->dev_physaddr;
499 490
500 /* Set up dest1. For now, assume no stride and increment. 491 /*
492 * Set up dest1. For now, assume no stride and increment.
501 * A channel attribute update can change this later. 493 * A channel attribute update can change this later.
502 */ 494 */
503 switch (dtp->dev_tsize) { 495 switch (dtp->dev_tsize) {
@@ -516,22 +508,24 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
516 break; 508 break;
517 } 509 }
518 510
519 /* If destination output is fifo, set static address. 511 /* If destination output is FIFO, set static address. */
520 */
521 if (dtp->dev_flags & DEV_FLAGS_OUT) { 512 if (dtp->dev_flags & DEV_FLAGS_OUT) {
522 if ( dtp->dev_flags & DEV_FLAGS_BURSTABLE ) 513 if (dtp->dev_flags & DEV_FLAGS_BURSTABLE)
523 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST); 514 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST);
524 else 515 else
525 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC); 516 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC);
526 } 517 }
518
527 if (dtp->dev_physaddr) 519 if (dtp->dev_physaddr)
528 dest0 = dtp->dev_physaddr; 520 dest0 = dtp->dev_physaddr;
529 521
530#if 0 522#if 0
531 printk("did:%x sid:%x cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 523 printk(KERN_DEBUG "did:%x sid:%x cmd0:%x cmd1:%x source0:%x "
532 dtp->dev_id, stp->dev_id, cmd0, cmd1, src0, src1, dest0, dest1 ); 524 "source1:%x dest0:%x dest1:%x\n",
525 dtp->dev_id, stp->dev_id, cmd0, cmd1, src0,
526 src1, dest0, dest1);
533#endif 527#endif
534 for (i=0; i<entries; i++) { 528 for (i = 0; i < entries; i++) {
535 dp->dscr_cmd0 = cmd0; 529 dp->dscr_cmd0 = cmd0;
536 dp->dscr_cmd1 = cmd1; 530 dp->dscr_cmd1 = cmd1;
537 dp->dscr_source0 = src0; 531 dp->dscr_source0 = src0;
@@ -545,49 +539,49 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
545 dp++; 539 dp++;
546 } 540 }
547 541
548 /* Make last descrptor point to the first. 542 /* Make last descrptor point to the first. */
549 */
550 dp--; 543 dp--;
551 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base)); 544 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base));
552 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 545 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
553 546
554 return (u32)(ctp->chan_desc_base); 547 return (u32)ctp->chan_desc_base;
555} 548}
556EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc); 549EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc);
557 550
558/* Put a source buffer into the DMA ring. 551/*
552 * Put a source buffer into the DMA ring.
559 * This updates the source pointer and byte count. Normally used 553 * This updates the source pointer and byte count. Normally used
560 * for memory to fifo transfers. 554 * for memory to fifo transfers.
561 */ 555 */
562u32 556u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
563_au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
564{ 557{
565 chan_tab_t *ctp; 558 chan_tab_t *ctp;
566 au1x_ddma_desc_t *dp; 559 au1x_ddma_desc_t *dp;
567 560
568 /* I guess we could check this to be within the 561 /*
562 * I guess we could check this to be within the
569 * range of the table...... 563 * range of the table......
570 */ 564 */
571 ctp = *((chan_tab_t **)chanid); 565 ctp = *(chan_tab_t **)chanid;
572 566
573 /* We should have multiple callers for a particular channel, 567 /*
568 * We should have multiple callers for a particular channel,
574 * an interrupt doesn't affect this pointer nor the descriptor, 569 * an interrupt doesn't affect this pointer nor the descriptor,
575 * so no locking should be needed. 570 * so no locking should be needed.
576 */ 571 */
577 dp = ctp->put_ptr; 572 dp = ctp->put_ptr;
578 573
579 /* If the descriptor is valid, we are way ahead of the DMA 574 /*
575 * If the descriptor is valid, we are way ahead of the DMA
580 * engine, so just return an error condition. 576 * engine, so just return an error condition.
581 */ 577 */
582 if (dp->dscr_cmd0 & DSCR_CMD0_V) { 578 if (dp->dscr_cmd0 & DSCR_CMD0_V)
583 return 0; 579 return 0;
584 }
585 580
586 /* Load up buffer address and byte count. 581 /* Load up buffer address and byte count. */
587 */
588 dp->dscr_source0 = virt_to_phys(buf); 582 dp->dscr_source0 = virt_to_phys(buf);
589 dp->dscr_cmd1 = nbytes; 583 dp->dscr_cmd1 = nbytes;
590 /* Check flags */ 584 /* Check flags */
591 if (flags & DDMA_FLAGS_IE) 585 if (flags & DDMA_FLAGS_IE)
592 dp->dscr_cmd0 |= DSCR_CMD0_IE; 586 dp->dscr_cmd0 |= DSCR_CMD0_IE;
593 if (flags & DDMA_FLAGS_NOIE) 587 if (flags & DDMA_FLAGS_NOIE)
@@ -595,23 +589,21 @@ _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
595 589
596 /* 590 /*
597 * There is an errata on the Au1200/Au1550 parts that could result 591 * There is an errata on the Au1200/Au1550 parts that could result
598 * in "stale" data being DMA'd. It has to do with the snoop logic on 592 * in "stale" data being DMA'ed. It has to do with the snoop logic on
599 * the dache eviction buffer. NONCOHERENT_IO is on by default for 593 * the cache eviction buffer. DMA_NONCOHERENT is on by default for
600 * these parts. If it is fixedin the future, these dma_cache_inv will 594 * these parts. If it is fixed in the future, these dma_cache_inv will
601 * just be nothing more than empty macros. See io.h. 595 * just be nothing more than empty macros. See io.h.
602 * */ 596 */
603 dma_cache_wback_inv((unsigned long)buf, nbytes); 597 dma_cache_wback_inv((unsigned long)buf, nbytes);
604 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 598 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
605 au_sync(); 599 au_sync();
606 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 600 dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
607 ctp->chan_ptr->ddma_dbell = 0; 601 ctp->chan_ptr->ddma_dbell = 0;
608 602
609 /* Get next descriptor pointer. 603 /* Get next descriptor pointer. */
610 */
611 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 604 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
612 605
613 /* return something not zero. 606 /* Return something non-zero. */
614 */
615 return nbytes; 607 return nbytes;
616} 608}
617EXPORT_SYMBOL(_au1xxx_dbdma_put_source); 609EXPORT_SYMBOL(_au1xxx_dbdma_put_source);
@@ -654,81 +646,77 @@ _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
654 dp->dscr_dest0 = virt_to_phys(buf); 646 dp->dscr_dest0 = virt_to_phys(buf);
655 dp->dscr_cmd1 = nbytes; 647 dp->dscr_cmd1 = nbytes;
656#if 0 648#if 0
657 printk("cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 649 printk(KERN_DEBUG "cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n",
658 dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0, 650 dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0,
659 dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1 ); 651 dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1);
660#endif 652#endif
661 /* 653 /*
662 * There is an errata on the Au1200/Au1550 parts that could result in 654 * There is an errata on the Au1200/Au1550 parts that could result in
663 * "stale" data being DMA'd. It has to do with the snoop logic on the 655 * "stale" data being DMA'ed. It has to do with the snoop logic on the
664 * dache eviction buffer. NONCOHERENT_IO is on by default for these 656 * cache eviction buffer. DMA_NONCOHERENT is on by default for these
665 * parts. If it is fixedin the future, these dma_cache_inv will just 657 * parts. If it is fixed in the future, these dma_cache_inv will just
666 * be nothing more than empty macros. See io.h. 658 * be nothing more than empty macros. See io.h.
667 * */ 659 */
668 dma_cache_inv((unsigned long)buf, nbytes); 660 dma_cache_inv((unsigned long)buf, nbytes);
669 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 661 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
670 au_sync(); 662 au_sync();
671 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 663 dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
672 ctp->chan_ptr->ddma_dbell = 0; 664 ctp->chan_ptr->ddma_dbell = 0;
673 665
674 /* Get next descriptor pointer. 666 /* Get next descriptor pointer. */
675 */
676 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 667 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
677 668
678 /* return something not zero. 669 /* Return something non-zero. */
679 */
680 return nbytes; 670 return nbytes;
681} 671}
682EXPORT_SYMBOL(_au1xxx_dbdma_put_dest); 672EXPORT_SYMBOL(_au1xxx_dbdma_put_dest);
683 673
684/* Get a destination buffer into the DMA ring. 674/*
675 * Get a destination buffer into the DMA ring.
685 * Normally used to get a full buffer from the ring during fifo 676 * Normally used to get a full buffer from the ring during fifo
686 * to memory transfers. This does not set the valid bit, you will 677 * to memory transfers. This does not set the valid bit, you will
687 * have to put another destination buffer to keep the DMA going. 678 * have to put another destination buffer to keep the DMA going.
688 */ 679 */
689u32 680u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
690au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
691{ 681{
692 chan_tab_t *ctp; 682 chan_tab_t *ctp;
693 au1x_ddma_desc_t *dp; 683 au1x_ddma_desc_t *dp;
694 u32 rv; 684 u32 rv;
695 685
696 /* I guess we could check this to be within the 686 /*
687 * I guess we could check this to be within the
697 * range of the table...... 688 * range of the table......
698 */ 689 */
699 ctp = *((chan_tab_t **)chanid); 690 ctp = *((chan_tab_t **)chanid);
700 691
701 /* We should have multiple callers for a particular channel, 692 /*
693 * We should have multiple callers for a particular channel,
702 * an interrupt doesn't affect this pointer nor the descriptor, 694 * an interrupt doesn't affect this pointer nor the descriptor,
703 * so no locking should be needed. 695 * so no locking should be needed.
704 */ 696 */
705 dp = ctp->get_ptr; 697 dp = ctp->get_ptr;
706 698
707 /* If the descriptor is valid, we are way ahead of the DMA 699 /*
700 * If the descriptor is valid, we are way ahead of the DMA
708 * engine, so just return an error condition. 701 * engine, so just return an error condition.
709 */ 702 */
710 if (dp->dscr_cmd0 & DSCR_CMD0_V) 703 if (dp->dscr_cmd0 & DSCR_CMD0_V)
711 return 0; 704 return 0;
712 705
713 /* Return buffer address and byte count. 706 /* Return buffer address and byte count. */
714 */
715 *buf = (void *)(phys_to_virt(dp->dscr_dest0)); 707 *buf = (void *)(phys_to_virt(dp->dscr_dest0));
716 *nbytes = dp->dscr_cmd1; 708 *nbytes = dp->dscr_cmd1;
717 rv = dp->dscr_stat; 709 rv = dp->dscr_stat;
718 710
719 /* Get next descriptor pointer. 711 /* Get next descriptor pointer. */
720 */
721 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 712 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
722 713
723 /* return something not zero. 714 /* Return something non-zero. */
724 */
725 return rv; 715 return rv;
726} 716}
727
728EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest); 717EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest);
729 718
730void 719void au1xxx_dbdma_stop(u32 chanid)
731au1xxx_dbdma_stop(u32 chanid)
732{ 720{
733 chan_tab_t *ctp; 721 chan_tab_t *ctp;
734 au1x_dma_chan_t *cp; 722 au1x_dma_chan_t *cp;
@@ -743,7 +731,7 @@ au1xxx_dbdma_stop(u32 chanid)
743 udelay(1); 731 udelay(1);
744 halt_timeout++; 732 halt_timeout++;
745 if (halt_timeout > 100) { 733 if (halt_timeout > 100) {
746 printk("warning: DMA channel won't halt\n"); 734 printk(KERN_WARNING "warning: DMA channel won't halt\n");
747 break; 735 break;
748 } 736 }
749 } 737 }
@@ -753,12 +741,12 @@ au1xxx_dbdma_stop(u32 chanid)
753} 741}
754EXPORT_SYMBOL(au1xxx_dbdma_stop); 742EXPORT_SYMBOL(au1xxx_dbdma_stop);
755 743
756/* Start using the current descriptor pointer. If the dbdma encounters 744/*
757 * a not valid descriptor, it will stop. In this case, we can just 745 * Start using the current descriptor pointer. If the DBDMA encounters
746 * a non-valid descriptor, it will stop. In this case, we can just
758 * continue by adding a buffer to the list and starting again. 747 * continue by adding a buffer to the list and starting again.
759 */ 748 */
760void 749void au1xxx_dbdma_start(u32 chanid)
761au1xxx_dbdma_start(u32 chanid)
762{ 750{
763 chan_tab_t *ctp; 751 chan_tab_t *ctp;
764 au1x_dma_chan_t *cp; 752 au1x_dma_chan_t *cp;
@@ -773,8 +761,7 @@ au1xxx_dbdma_start(u32 chanid)
773} 761}
774EXPORT_SYMBOL(au1xxx_dbdma_start); 762EXPORT_SYMBOL(au1xxx_dbdma_start);
775 763
776void 764void au1xxx_dbdma_reset(u32 chanid)
777au1xxx_dbdma_reset(u32 chanid)
778{ 765{
779 chan_tab_t *ctp; 766 chan_tab_t *ctp;
780 au1x_ddma_desc_t *dp; 767 au1x_ddma_desc_t *dp;
@@ -784,14 +771,14 @@ au1xxx_dbdma_reset(u32 chanid)
784 ctp = *((chan_tab_t **)chanid); 771 ctp = *((chan_tab_t **)chanid);
785 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 772 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
786 773
787 /* Run through the descriptors and reset the valid indicator. 774 /* Run through the descriptors and reset the valid indicator. */
788 */
789 dp = ctp->chan_desc_base; 775 dp = ctp->chan_desc_base;
790 776
791 do { 777 do {
792 dp->dscr_cmd0 &= ~DSCR_CMD0_V; 778 dp->dscr_cmd0 &= ~DSCR_CMD0_V;
793 /* reset our SW status -- this is used to determine 779 /*
794 * if a descriptor is in use by upper level SW. Since 780 * Reset our software status -- this is used to determine
781 * if a descriptor is in use by upper level software. Since
795 * posting can reset 'V' bit. 782 * posting can reset 'V' bit.
796 */ 783 */
797 dp->sw_status = 0; 784 dp->sw_status = 0;
@@ -800,8 +787,7 @@ au1xxx_dbdma_reset(u32 chanid)
800} 787}
801EXPORT_SYMBOL(au1xxx_dbdma_reset); 788EXPORT_SYMBOL(au1xxx_dbdma_reset);
802 789
803u32 790u32 au1xxx_get_dma_residue(u32 chanid)
804au1xxx_get_dma_residue(u32 chanid)
805{ 791{
806 chan_tab_t *ctp; 792 chan_tab_t *ctp;
807 au1x_dma_chan_t *cp; 793 au1x_dma_chan_t *cp;
@@ -810,18 +796,15 @@ au1xxx_get_dma_residue(u32 chanid)
810 ctp = *((chan_tab_t **)chanid); 796 ctp = *((chan_tab_t **)chanid);
811 cp = ctp->chan_ptr; 797 cp = ctp->chan_ptr;
812 798
813 /* This is only valid if the channel is stopped. 799 /* This is only valid if the channel is stopped. */
814 */
815 rv = cp->ddma_bytecnt; 800 rv = cp->ddma_bytecnt;
816 au_sync(); 801 au_sync();
817 802
818 return rv; 803 return rv;
819} 804}
820
821EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue); 805EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue);
822 806
823void 807void au1xxx_dbdma_chan_free(u32 chanid)
824au1xxx_dbdma_chan_free(u32 chanid)
825{ 808{
826 chan_tab_t *ctp; 809 chan_tab_t *ctp;
827 dbdev_tab_t *stp, *dtp; 810 dbdev_tab_t *stp, *dtp;
@@ -842,8 +825,7 @@ au1xxx_dbdma_chan_free(u32 chanid)
842} 825}
843EXPORT_SYMBOL(au1xxx_dbdma_chan_free); 826EXPORT_SYMBOL(au1xxx_dbdma_chan_free);
844 827
845static irqreturn_t 828static irqreturn_t dbdma_interrupt(int irq, void *dev_id)
846dbdma_interrupt(int irq, void *dev_id)
847{ 829{
848 u32 intstat; 830 u32 intstat;
849 u32 chan_index; 831 u32 chan_index;
@@ -859,13 +841,12 @@ dbdma_interrupt(int irq, void *dev_id)
859 cp = ctp->chan_ptr; 841 cp = ctp->chan_ptr;
860 dp = ctp->cur_ptr; 842 dp = ctp->cur_ptr;
861 843
862 /* Reset interrupt. 844 /* Reset interrupt. */
863 */
864 cp->ddma_irq = 0; 845 cp->ddma_irq = 0;
865 au_sync(); 846 au_sync();
866 847
867 if (ctp->chan_callback) 848 if (ctp->chan_callback)
868 (ctp->chan_callback)(irq, ctp->chan_callparam); 849 ctp->chan_callback(irq, ctp->chan_callparam);
869 850
870 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 851 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
871 return IRQ_RETVAL(1); 852 return IRQ_RETVAL(1);
@@ -890,47 +871,47 @@ static void au1xxx_dbdma_init(void)
890 871
891 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED, 872 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED,
892 "Au1xxx dbdma", (void *)dbdma_gptr)) 873 "Au1xxx dbdma", (void *)dbdma_gptr))
893 printk("Can't get 1550 dbdma irq"); 874 printk(KERN_ERR "Can't get 1550 dbdma irq");
894} 875}
895 876
896void 877void au1xxx_dbdma_dump(u32 chanid)
897au1xxx_dbdma_dump(u32 chanid)
898{ 878{
899 chan_tab_t *ctp; 879 chan_tab_t *ctp;
900 au1x_ddma_desc_t *dp; 880 au1x_ddma_desc_t *dp;
901 dbdev_tab_t *stp, *dtp; 881 dbdev_tab_t *stp, *dtp;
902 au1x_dma_chan_t *cp; 882 au1x_dma_chan_t *cp;
903 u32 i = 0; 883 u32 i = 0;
904 884
905 ctp = *((chan_tab_t **)chanid); 885 ctp = *((chan_tab_t **)chanid);
906 stp = ctp->chan_src; 886 stp = ctp->chan_src;
907 dtp = ctp->chan_dest; 887 dtp = ctp->chan_dest;
908 cp = ctp->chan_ptr; 888 cp = ctp->chan_ptr;
909 889
910 printk("Chan %x, stp %x (dev %d) dtp %x (dev %d) \n", 890 printk(KERN_DEBUG "Chan %x, stp %x (dev %d) dtp %x (dev %d) \n",
911 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp, dtp - dbdev_tab); 891 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp,
912 printk("desc base %x, get %x, put %x, cur %x\n", 892 dtp - dbdev_tab);
913 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr), 893 printk(KERN_DEBUG "desc base %x, get %x, put %x, cur %x\n",
914 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr)); 894 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr),
915 895 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr));
916 printk("dbdma chan %x\n", (u32)cp); 896
917 printk("cfg %08x, desptr %08x, statptr %08x\n", 897 printk(KERN_DEBUG "dbdma chan %x\n", (u32)cp);
918 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr); 898 printk(KERN_DEBUG "cfg %08x, desptr %08x, statptr %08x\n",
919 printk("dbell %08x, irq %08x, stat %08x, bytecnt %08x\n", 899 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr);
920 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat, cp->ddma_bytecnt); 900 printk(KERN_DEBUG "dbell %08x, irq %08x, stat %08x, bytecnt %08x\n",
921 901 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat,
922 902 cp->ddma_bytecnt);
923 /* Run through the descriptors 903
924 */ 904 /* Run through the descriptors */
925 dp = ctp->chan_desc_base; 905 dp = ctp->chan_desc_base;
926 906
927 do { 907 do {
928 printk("Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n", 908 printk(KERN_DEBUG "Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n",
929 i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); 909 i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1);
930 printk("src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n", 910 printk(KERN_DEBUG "src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n",
931 dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1); 911 dp->dscr_source0, dp->dscr_source1,
932 printk("stat %08x, nxtptr %08x\n", 912 dp->dscr_dest0, dp->dscr_dest1);
933 dp->dscr_stat, dp->dscr_nxtptr); 913 printk(KERN_DEBUG "stat %08x, nxtptr %08x\n",
914 dp->dscr_stat, dp->dscr_nxtptr);
934 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 915 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
935 } while (dp != ctp->chan_desc_base); 916 } while (dp != ctp->chan_desc_base);
936} 917}
@@ -938,32 +919,33 @@ au1xxx_dbdma_dump(u32 chanid)
938/* Put a descriptor into the DMA ring. 919/* Put a descriptor into the DMA ring.
939 * This updates the source/destination pointers and byte count. 920 * This updates the source/destination pointers and byte count.
940 */ 921 */
941u32 922u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr)
942au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr )
943{ 923{
944 chan_tab_t *ctp; 924 chan_tab_t *ctp;
945 au1x_ddma_desc_t *dp; 925 au1x_ddma_desc_t *dp;
946 u32 nbytes=0; 926 u32 nbytes = 0;
947 927
948 /* I guess we could check this to be within the 928 /*
949 * range of the table...... 929 * I guess we could check this to be within the
950 */ 930 * range of the table......
931 */
951 ctp = *((chan_tab_t **)chanid); 932 ctp = *((chan_tab_t **)chanid);
952 933
953 /* We should have multiple callers for a particular channel, 934 /*
954 * an interrupt doesn't affect this pointer nor the descriptor, 935 * We should have multiple callers for a particular channel,
955 * so no locking should be needed. 936 * an interrupt doesn't affect this pointer nor the descriptor,
956 */ 937 * so no locking should be needed.
938 */
957 dp = ctp->put_ptr; 939 dp = ctp->put_ptr;
958 940
959 /* If the descriptor is valid, we are way ahead of the DMA 941 /*
960 * engine, so just return an error condition. 942 * If the descriptor is valid, we are way ahead of the DMA
961 */ 943 * engine, so just return an error condition.
944 */
962 if (dp->dscr_cmd0 & DSCR_CMD0_V) 945 if (dp->dscr_cmd0 & DSCR_CMD0_V)
963 return 0; 946 return 0;
964 947
965 /* Load up buffer addresses and byte count. 948 /* Load up buffer addresses and byte count. */
966 */
967 dp->dscr_dest0 = dscr->dscr_dest0; 949 dp->dscr_dest0 = dscr->dscr_dest0;
968 dp->dscr_source0 = dscr->dscr_source0; 950 dp->dscr_source0 = dscr->dscr_source0;
969 dp->dscr_dest1 = dscr->dscr_dest1; 951 dp->dscr_dest1 = dscr->dscr_dest1;
@@ -975,14 +957,11 @@ au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr )
975 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V; 957 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V;
976 ctp->chan_ptr->ddma_dbell = 0; 958 ctp->chan_ptr->ddma_dbell = 0;
977 959
978 /* Get next descriptor pointer. 960 /* Get next descriptor pointer. */
979 */
980 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 961 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
981 962
982 /* return something not zero. 963 /* Return something non-zero. */
983 */
984 return nbytes; 964 return nbytes;
985} 965}
986 966
987#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */ 967#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */
988
diff --git a/arch/mips/au1000/common/dbg_io.c b/arch/mips/au1000/common/dbg_io.c
index eae1bb2ca26e..af5be7df2f2a 100644
--- a/arch/mips/au1000/common/dbg_io.c
+++ b/arch/mips/au1000/common/dbg_io.c
@@ -1,3 +1,4 @@
1#include <linux/types.h>
1 2
2#include <asm/mach-au1x00/au1000.h> 3#include <asm/mach-au1x00/au1000.h>
3 4
@@ -8,12 +9,6 @@
8 * uart to be used for debugging. 9 * uart to be used for debugging.
9 */ 10 */
10#define DEBUG_BASE UART_DEBUG_BASE 11#define DEBUG_BASE UART_DEBUG_BASE
11/**/
12
13/* we need uint32 uint8 */
14/* #include "types.h" */
15typedef unsigned char uint8;
16typedef unsigned int uint32;
17 12
18#define UART16550_BAUD_2400 2400 13#define UART16550_BAUD_2400 2400
19#define UART16550_BAUD_4800 4800 14#define UART16550_BAUD_4800 4800
@@ -51,17 +46,15 @@ typedef unsigned int uint32;
51#define UART_MOD_CNTRL 0x100 /* Module Control */ 46#define UART_MOD_CNTRL 0x100 /* Module Control */
52 47
53/* memory-mapped read/write of the port */ 48/* memory-mapped read/write of the port */
54#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff) 49#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff)
55#define UART16550_WRITE(y, z) (au_writel(z&0xff, DEBUG_BASE + y)) 50#define UART16550_WRITE(y, z) (au_writel(z & 0xff, DEBUG_BASE + y))
56 51
57extern unsigned long calc_clock(void); 52extern unsigned long calc_clock(void);
58 53
59void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) 54void debugInit(u32 baud, u8 data, u8 parity, u8 stop)
60{ 55{
61 56 if (UART16550_READ(UART_MOD_CNTRL) != 0x3)
62 if (UART16550_READ(UART_MOD_CNTRL) != 0x3) {
63 UART16550_WRITE(UART_MOD_CNTRL, 3); 57 UART16550_WRITE(UART_MOD_CNTRL, 3);
64 }
65 calc_clock(); 58 calc_clock();
66 59
67 /* disable interrupts */ 60 /* disable interrupts */
@@ -69,7 +62,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
69 62
70 /* set up baud rate */ 63 /* set up baud rate */
71 { 64 {
72 uint32 divisor; 65 u32 divisor;
73 66
74 /* set divisor */ 67 /* set divisor */
75 divisor = get_au1x00_uart_baud_base() / baud; 68 divisor = get_au1x00_uart_baud_base() / baud;
@@ -80,9 +73,9 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
80 UART16550_WRITE(UART_LCR, (data | parity | stop)); 73 UART16550_WRITE(UART_LCR, (data | parity | stop));
81} 74}
82 75
83static int remoteDebugInitialized = 0; 76static int remoteDebugInitialized;
84 77
85uint8 getDebugChar(void) 78u8 getDebugChar(void)
86{ 79{
87 if (!remoteDebugInitialized) { 80 if (!remoteDebugInitialized) {
88 remoteDebugInitialized = 1; 81 remoteDebugInitialized = 1;
@@ -92,15 +85,13 @@ uint8 getDebugChar(void)
92 UART16550_STOP_1BIT); 85 UART16550_STOP_1BIT);
93 } 86 }
94 87
95 while((UART16550_READ(UART_LSR) & 0x1) == 0); 88 while ((UART16550_READ(UART_LSR) & 0x1) == 0);
96 return UART16550_READ(UART_RX); 89 return UART16550_READ(UART_RX);
97} 90}
98 91
99 92
100int putDebugChar(uint8 byte) 93int putDebugChar(u8 byte)
101{ 94{
102// int i;
103
104 if (!remoteDebugInitialized) { 95 if (!remoteDebugInitialized) {
105 remoteDebugInitialized = 1; 96 remoteDebugInitialized = 1;
106 debugInit(UART16550_BAUD_115200, 97 debugInit(UART16550_BAUD_115200,
@@ -109,9 +100,8 @@ int putDebugChar(uint8 byte)
109 UART16550_STOP_1BIT); 100 UART16550_STOP_1BIT);
110 } 101 }
111 102
112 while ((UART16550_READ(UART_LSR)&0x40) == 0); 103 while ((UART16550_READ(UART_LSR) & 0x40) == 0);
113 UART16550_WRITE(UART_TX, byte); 104 UART16550_WRITE(UART_TX, byte);
114 //for (i=0;i<0xfff;i++);
115 105
116 return 1; 106 return 1;
117} 107}
diff --git a/arch/mips/au1000/common/dma.c b/arch/mips/au1000/common/dma.c
index 95f69ea146e9..d6fbda232e6a 100644
--- a/arch/mips/au1000/common/dma.c
+++ b/arch/mips/au1000/common/dma.c
@@ -1,12 +1,11 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * A DMA channel allocator for Au1000. API is modeled loosely off of 4 * A DMA channel allocator for Au1x00. API is modeled loosely off of
5 * linux/kernel/dma.c. 5 * linux/kernel/dma.c.
6 * 6 *
7 * Copyright 2000 MontaVista Software Inc. 7 * Copyright 2000, 2008 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc. 8 * Author: MontaVista Software, Inc. <source@mvista.com>
9 * stevel@mvista.com or source@mvista.com
10 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 9 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
11 * 10 *
12 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
@@ -39,7 +38,8 @@
39#include <asm/mach-au1x00/au1000.h> 38#include <asm/mach-au1x00/au1000.h>
40#include <asm/mach-au1x00/au1000_dma.h> 39#include <asm/mach-au1x00/au1000_dma.h>
41 40
42#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 41#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
42 defined(CONFIG_SOC_AU1100)
43/* 43/*
44 * A note on resource allocation: 44 * A note on resource allocation:
45 * 45 *
@@ -56,7 +56,6 @@
56 * returned from request_dma. 56 * returned from request_dma.
57 */ 57 */
58 58
59
60DEFINE_SPINLOCK(au1000_dma_spin_lock); 59DEFINE_SPINLOCK(au1000_dma_spin_lock);
61 60
62struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = { 61struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
@@ -71,7 +70,7 @@ struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
71}; 70};
72EXPORT_SYMBOL(au1000_dma_table); 71EXPORT_SYMBOL(au1000_dma_table);
73 72
74// Device FIFO addresses and default DMA modes 73/* Device FIFO addresses and default DMA modes */
75static const struct dma_dev { 74static const struct dma_dev {
76 unsigned int fifo_addr; 75 unsigned int fifo_addr;
77 unsigned int dma_mode; 76 unsigned int dma_mode;
@@ -80,8 +79,8 @@ static const struct dma_dev {
80 {UART0_ADDR + UART_RX, 0}, 79 {UART0_ADDR + UART_RX, 0},
81 {0, 0}, 80 {0, 0},
82 {0, 0}, 81 {0, 0},
83 {AC97C_DATA, DMA_DW16 }, // coherent 82 {AC97C_DATA, DMA_DW16 }, /* coherent */
84 {AC97C_DATA, DMA_DR | DMA_DW16 }, // coherent 83 {AC97C_DATA, DMA_DR | DMA_DW16 }, /* coherent */
85 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC}, 84 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC},
86 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC}, 85 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC},
87 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC}, 86 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC},
@@ -101,10 +100,10 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
101 struct dma_chan *chan; 100 struct dma_chan *chan;
102 101
103 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 102 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) {
104 if ((chan = get_dma_chan(i)) != NULL) { 103 chan = get_dma_chan(i);
104 if (chan != NULL)
105 len += sprintf(buf + len, "%2d: %s\n", 105 len += sprintf(buf + len, "%2d: %s\n",
106 i, chan->dev_str); 106 i, chan->dev_str);
107 }
108 } 107 }
109 108
110 if (fpos >= len) { 109 if (fpos >= len) {
@@ -113,18 +112,19 @@ int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
113 return 0; 112 return 0;
114 } 113 }
115 *start = buf + fpos; 114 *start = buf + fpos;
116 if ((len -= fpos) > length) 115 len -= fpos;
116 if (len > length)
117 return length; 117 return length;
118 *eof = 1; 118 *eof = 1;
119 return len; 119 return len;
120} 120}
121 121
122// Device FIFO addresses and default DMA modes - 2nd bank 122/* Device FIFO addresses and default DMA modes - 2nd bank */
123static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = { 123static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = {
124 {SD0_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 124 { SD0_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */
125 {SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8}, // coherent 125 { SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 }, /* coherent */
126 {SD1_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 126 { SD1_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */
127 {SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8} // coherent 127 { SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 } /* coherent */
128}; 128};
129 129
130void dump_au1000_dma_channel(unsigned int dmanr) 130void dump_au1000_dma_channel(unsigned int dmanr)
@@ -150,7 +150,6 @@ void dump_au1000_dma_channel(unsigned int dmanr)
150 au_readl(chan->io + DMA_BUFFER1_COUNT)); 150 au_readl(chan->io + DMA_BUFFER1_COUNT));
151} 151}
152 152
153
154/* 153/*
155 * Finds a free channel, and binds the requested device to it. 154 * Finds a free channel, and binds the requested device to it.
156 * Returns the allocated channel number, or negative on error. 155 * Returns the allocated channel number, or negative on error.
@@ -169,14 +168,14 @@ int request_au1000_dma(int dev_id, const char *dev_str,
169 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2)) 168 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2))
170 return -EINVAL; 169 return -EINVAL;
171#else 170#else
172 if (dev_id < 0 || dev_id >= DMA_NUM_DEV) 171 if (dev_id < 0 || dev_id >= DMA_NUM_DEV)
173 return -EINVAL; 172 return -EINVAL;
174#endif 173#endif
175 174
176 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 175 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++)
177 if (au1000_dma_table[i].dev_id < 0) 176 if (au1000_dma_table[i].dev_id < 0)
178 break; 177 break;
179 } 178
180 if (i == NUM_AU1000_DMA_CHANNELS) 179 if (i == NUM_AU1000_DMA_CHANNELS)
181 return -ENODEV; 180 return -ENODEV;
182 181
@@ -185,15 +184,15 @@ int request_au1000_dma(int dev_id, const char *dev_str,
185 if (dev_id >= DMA_NUM_DEV) { 184 if (dev_id >= DMA_NUM_DEV) {
186 dev_id -= DMA_NUM_DEV; 185 dev_id -= DMA_NUM_DEV;
187 dev = &dma_dev_table_bank2[dev_id]; 186 dev = &dma_dev_table_bank2[dev_id];
188 } else { 187 } else
189 dev = &dma_dev_table[dev_id]; 188 dev = &dma_dev_table[dev_id];
190 }
191 189
192 if (irqhandler) { 190 if (irqhandler) {
193 chan->irq = AU1000_DMA_INT_BASE + i; 191 chan->irq = AU1000_DMA_INT_BASE + i;
194 chan->irq_dev = irq_dev_id; 192 chan->irq_dev = irq_dev_id;
195 if ((ret = request_irq(chan->irq, irqhandler, irqflags, 193 ret = request_irq(chan->irq, irqhandler, irqflags, dev_str,
196 dev_str, chan->irq_dev))) { 194 chan->irq_dev);
195 if (ret) {
197 chan->irq = 0; 196 chan->irq = 0;
198 chan->irq_dev = NULL; 197 chan->irq_dev = NULL;
199 return ret; 198 return ret;
@@ -203,7 +202,7 @@ int request_au1000_dma(int dev_id, const char *dev_str,
203 chan->irq_dev = NULL; 202 chan->irq_dev = NULL;
204 } 203 }
205 204
206 // fill it in 205 /* fill it in */
207 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN; 206 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN;
208 chan->dev_id = dev_id; 207 chan->dev_id = dev_id;
209 chan->dev_str = dev_str; 208 chan->dev_str = dev_str;
@@ -220,8 +219,9 @@ EXPORT_SYMBOL(request_au1000_dma);
220void free_au1000_dma(unsigned int dmanr) 219void free_au1000_dma(unsigned int dmanr)
221{ 220{
222 struct dma_chan *chan = get_dma_chan(dmanr); 221 struct dma_chan *chan = get_dma_chan(dmanr);
222
223 if (!chan) { 223 if (!chan) {
224 printk("Trying to free DMA%d\n", dmanr); 224 printk(KERN_ERR "Error trying to free DMA%d\n", dmanr);
225 return; 225 return;
226 } 226 }
227 227
@@ -235,4 +235,4 @@ void free_au1000_dma(unsigned int dmanr)
235} 235}
236EXPORT_SYMBOL(free_au1000_dma); 236EXPORT_SYMBOL(free_au1000_dma);
237 237
238#endif // AU1000 AU1500 AU1100 238#endif /* AU1000 AU1500 AU1100 */
diff --git a/arch/mips/au1000/common/gpio.c b/arch/mips/au1000/common/gpio.c
index 525452589971..b485d94ce8a5 100644
--- a/arch/mips/au1000/common/gpio.c
+++ b/arch/mips/au1000/common/gpio.c
@@ -69,7 +69,7 @@ static int au1xxx_gpio2_direction_output(unsigned gpio, int value)
69 69
70static int au1xxx_gpio1_read(unsigned gpio) 70static int au1xxx_gpio1_read(unsigned gpio)
71{ 71{
72 return ((gpio1->pinstaterd >> gpio) & 0x01); 72 return (gpio1->pinstaterd >> gpio) & 0x01;
73} 73}
74 74
75static void au1xxx_gpio1_write(unsigned gpio, int value) 75static void au1xxx_gpio1_write(unsigned gpio, int value)
@@ -104,7 +104,6 @@ int au1xxx_gpio_get_value(unsigned gpio)
104 else 104 else
105 return au1xxx_gpio1_read(gpio); 105 return au1xxx_gpio1_read(gpio);
106} 106}
107
108EXPORT_SYMBOL(au1xxx_gpio_get_value); 107EXPORT_SYMBOL(au1xxx_gpio_get_value);
109 108
110void au1xxx_gpio_set_value(unsigned gpio, int value) 109void au1xxx_gpio_set_value(unsigned gpio, int value)
@@ -118,7 +117,6 @@ void au1xxx_gpio_set_value(unsigned gpio, int value)
118 else 117 else
119 au1xxx_gpio1_write(gpio, value); 118 au1xxx_gpio1_write(gpio, value);
120} 119}
121
122EXPORT_SYMBOL(au1xxx_gpio_set_value); 120EXPORT_SYMBOL(au1xxx_gpio_set_value);
123 121
124int au1xxx_gpio_direction_input(unsigned gpio) 122int au1xxx_gpio_direction_input(unsigned gpio)
@@ -132,7 +130,6 @@ int au1xxx_gpio_direction_input(unsigned gpio)
132 130
133 return au1xxx_gpio1_direction_input(gpio); 131 return au1xxx_gpio1_direction_input(gpio);
134} 132}
135
136EXPORT_SYMBOL(au1xxx_gpio_direction_input); 133EXPORT_SYMBOL(au1xxx_gpio_direction_input);
137 134
138int au1xxx_gpio_direction_output(unsigned gpio, int value) 135int au1xxx_gpio_direction_output(unsigned gpio, int value)
@@ -146,5 +143,4 @@ int au1xxx_gpio_direction_output(unsigned gpio, int value)
146 143
147 return au1xxx_gpio1_direction_output(gpio, value); 144 return au1xxx_gpio1_direction_output(gpio, value);
148} 145}
149
150EXPORT_SYMBOL(au1xxx_gpio_direction_output); 146EXPORT_SYMBOL(au1xxx_gpio_direction_output);
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index f0626992fd75..40c6ceceb5f9 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -210,10 +210,8 @@ static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
210 au_sync(); 210 au_sync();
211} 211}
212 212
213
214static inline void mask_and_ack_level_irq(unsigned int irq_nr) 213static inline void mask_and_ack_level_irq(unsigned int irq_nr)
215{ 214{
216
217 local_disable_irq(irq_nr); 215 local_disable_irq(irq_nr);
218 au_sync(); 216 au_sync();
219#if defined(CONFIG_MIPS_PB1000) 217#if defined(CONFIG_MIPS_PB1000)
@@ -263,14 +261,14 @@ void restore_local_and_enable(int controller, unsigned long mask)
263 unsigned long flags, new_mask; 261 unsigned long flags, new_mask;
264 262
265 spin_lock_irqsave(&irq_lock, flags); 263 spin_lock_irqsave(&irq_lock, flags);
266 for (i = 0; i < 32; i++) { 264 for (i = 0; i < 32; i++)
267 if (mask & (1 << i)) { 265 if (mask & (1 << i)) {
268 if (controller) 266 if (controller)
269 local_enable_irq(i + 32); 267 local_enable_irq(i + 32);
270 else 268 else
271 local_enable_irq(i); 269 local_enable_irq(i);
272 } 270 }
273 } 271
274 if (controller) 272 if (controller)
275 new_mask = au_readl(IC1_MASKSET); 273 new_mask = au_readl(IC1_MASKSET);
276 else 274 else
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 7e966b31e3e1..7866cf50cf99 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 PCI support. 3 * Alchemy/AMD Au1x00 PCI support.
4 * 4 *
5 * Copyright 2001-2003, 2007 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007-2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
10 * 9 *
@@ -86,9 +85,9 @@ static int __init au1x_pci_setup(void)
86 u32 prid = read_c0_prid(); 85 u32 prid = read_c0_prid();
87 86
88 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) { 87 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) {
89 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG), 88 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG),
90 Au1500_PCI_CFG); 89 Au1500_PCI_CFG);
91 printk("Non-coherent PCI accesses enabled\n"); 90 printk(KERN_INFO "Non-coherent PCI accesses enabled\n");
92 } 91 }
93 } 92 }
94#endif 93#endif
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index 31d2a2270878..8cae7753ef79 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -269,8 +269,8 @@ static struct platform_device au1x00_pcmcia_device = {
269#ifdef SMBUS_PSC_BASE 269#ifdef SMBUS_PSC_BASE
270static struct resource pbdb_smbus_resources[] = { 270static struct resource pbdb_smbus_resources[] = {
271 { 271 {
272 .start = SMBUS_PSC_BASE, 272 .start = CPHYSADDR(SMBUS_PSC_BASE),
273 .end = SMBUS_PSC_BASE + 0x24 - 1, 273 .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff),
274 .flags = IORESOURCE_MEM, 274 .flags = IORESOURCE_MEM,
275 }, 275 },
276}; 276};
@@ -302,16 +302,17 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
302#endif 302#endif
303}; 303};
304 304
305int __init au1xxx_platform_init(void) 305static int __init au1xxx_platform_init(void)
306{ 306{
307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
308 int i; 308 int i;
309 309
310 /* Fill up uartclk. */ 310 /* Fill up uartclk. */
311 for (i = 0; au1x00_uart_data[i].flags ; i++) 311 for (i = 0; au1x00_uart_data[i].flags; i++)
312 au1x00_uart_data[i].uartclk = uartclk; 312 au1x00_uart_data[i].uartclk = uartclk;
313 313
314 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices)); 314 return platform_add_devices(au1xxx_platform_devices,
315 ARRAY_SIZE(au1xxx_platform_devices));
315} 316}
316 317
317arch_initcall(au1xxx_platform_init); 318arch_initcall(au1xxx_platform_init);
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index a8cd2c1b9e1b..2166b9e1e80c 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1000 Power Management routines. 3 * Au1xx0 Power Management routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Some of the routines are right out of init/main.c, whose 8 * Some of the routines are right out of init/main.c, whose
10 * copyrights apply here. 9 * copyrights apply here.
@@ -43,10 +42,10 @@
43#ifdef CONFIG_PM 42#ifdef CONFIG_PM
44 43
45#define DEBUG 1 44#define DEBUG 1
46#ifdef DEBUG 45#ifdef DEBUG
47# define DPRINTK(fmt, args...) printk("%s: " fmt, __func__, ## args) 46#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args)
48#else 47#else
49# define DPRINTK(fmt, args...) 48#define DPRINTK(fmt, args...)
50#endif 49#endif
51 50
52static void au1000_calibrate_delay(void); 51static void au1000_calibrate_delay(void);
@@ -57,7 +56,8 @@ extern void local_enable_irq(unsigned int irq_nr);
57 56
58static DEFINE_SPINLOCK(pm_lock); 57static DEFINE_SPINLOCK(pm_lock);
59 58
60/* We need to save/restore a bunch of core registers that are 59/*
60 * We need to save/restore a bunch of core registers that are
61 * either volatile or reset to some state across a processor sleep. 61 * either volatile or reset to some state across a processor sleep.
62 * If reading a register doesn't provide a proper result for a 62 * If reading a register doesn't provide a proper result for a
63 * later restore, we have to provide a function for loading that 63 * later restore, we have to provide a function for loading that
@@ -78,24 +78,25 @@ static unsigned int sleep_usbhost_enable;
78static unsigned int sleep_usbdev_enable; 78static unsigned int sleep_usbdev_enable;
79static unsigned int sleep_static_memctlr[4][3]; 79static unsigned int sleep_static_memctlr[4][3];
80 80
81/* Define this to cause the value you write to /proc/sys/pm/sleep to 81/*
82 * Define this to cause the value you write to /proc/sys/pm/sleep to
82 * set the TOY timer for the amount of time you want to sleep. 83 * set the TOY timer for the amount of time you want to sleep.
83 * This is done mainly for testing, but may be useful in other cases. 84 * This is done mainly for testing, but may be useful in other cases.
84 * The value is number of 32KHz ticks to sleep. 85 * The value is number of 32KHz ticks to sleep.
85 */ 86 */
86#define SLEEP_TEST_TIMEOUT 1 87#define SLEEP_TEST_TIMEOUT 1
87#ifdef SLEEP_TEST_TIMEOUT 88#ifdef SLEEP_TEST_TIMEOUT
88static int sleep_ticks; 89static int sleep_ticks;
89void wakeup_counter0_set(int ticks); 90void wakeup_counter0_set(int ticks);
90#endif 91#endif
91 92
92static void 93static void save_core_regs(void)
93save_core_regs(void)
94{ 94{
95 extern void save_au1xxx_intctl(void); 95 extern void save_au1xxx_intctl(void);
96 extern void pm_eth0_shutdown(void); 96 extern void pm_eth0_shutdown(void);
97 97
98 /* Do the serial ports.....these really should be a pm_* 98 /*
99 * Do the serial ports.....these really should be a pm_*
99 * registered function by the driver......but of course the 100 * registered function by the driver......but of course the
100 * standard serial driver doesn't understand our Au1xxx 101 * standard serial driver doesn't understand our Au1xxx
101 * unique registers. 102 * unique registers.
@@ -106,27 +107,24 @@ save_core_regs(void)
106 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK); 107 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK);
107 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL); 108 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL);
108 109
109 /* Shutdown USB host/device. 110 /* Shutdown USB host/device. */
110 */
111 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG); 111 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG);
112 112
113 /* There appears to be some undocumented reset register.... 113 /* There appears to be some undocumented reset register.... */
114 */
115 au_writel(0, 0xb0100004); au_sync(); 114 au_writel(0, 0xb0100004); au_sync();
116 au_writel(0, USB_HOST_CONFIG); au_sync(); 115 au_writel(0, USB_HOST_CONFIG); au_sync();
117 116
118 sleep_usbdev_enable = au_readl(USBD_ENABLE); 117 sleep_usbdev_enable = au_readl(USBD_ENABLE);
119 au_writel(0, USBD_ENABLE); au_sync(); 118 au_writel(0, USBD_ENABLE); au_sync();
120 119
121 /* Save interrupt controller state. 120 /* Save interrupt controller state. */
122 */
123 save_au1xxx_intctl(); 121 save_au1xxx_intctl();
124 122
125 /* Clocks and PLLs. 123 /* Clocks and PLLs. */
126 */
127 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL); 124 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL);
128 125
129 /* We don't really need to do this one, but unless we 126 /*
127 * We don't really need to do this one, but unless we
130 * write it again it won't have a valid value if we 128 * write it again it won't have a valid value if we
131 * happen to read it. 129 * happen to read it.
132 */ 130 */
@@ -134,8 +132,7 @@ save_core_regs(void)
134 132
135 sleep_pin_function = au_readl(SYS_PINFUNC); 133 sleep_pin_function = au_readl(SYS_PINFUNC);
136 134
137 /* Save the static memory controller configuration. 135 /* Save the static memory controller configuration. */
138 */
139 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0); 136 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0);
140 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0); 137 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0);
141 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0); 138 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0);
@@ -150,8 +147,7 @@ save_core_regs(void)
150 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3); 147 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3);
151} 148}
152 149
153static void 150static void restore_core_regs(void)
154restore_core_regs(void)
155{ 151{
156 extern void restore_au1xxx_intctl(void); 152 extern void restore_au1xxx_intctl(void);
157 extern void wakeup_counter0_adjust(void); 153 extern void wakeup_counter0_adjust(void);
@@ -160,8 +156,7 @@ restore_core_regs(void)
160 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync(); 156 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync();
161 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync(); 157 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync();
162 158
163 /* Restore the static memory controller configuration. 159 /* Restore the static memory controller configuration. */
164 */
165 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0); 160 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0);
166 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0); 161 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0);
167 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0); 162 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0);
@@ -175,7 +170,8 @@ restore_core_regs(void)
175 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); 170 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
176 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); 171 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);
177 172
178 /* Enable the UART if it was enabled before sleep. 173 /*
174 * Enable the UART if it was enabled before sleep.
179 * I guess I should define module control bits........ 175 * I guess I should define module control bits........
180 */ 176 */
181 if (sleep_uart0_enable & 0x02) { 177 if (sleep_uart0_enable & 0x02) {
@@ -202,7 +198,7 @@ void wakeup_from_suspend(void)
202int au_sleep(void) 198int au_sleep(void)
203{ 199{
204 unsigned long wakeup, flags; 200 unsigned long wakeup, flags;
205 extern void save_and_sleep(void); 201 extern void save_and_sleep(void);
206 202
207 spin_lock_irqsave(&pm_lock, flags); 203 spin_lock_irqsave(&pm_lock, flags);
208 204
@@ -210,23 +206,22 @@ int au_sleep(void)
210 206
211 flush_cache_all(); 207 flush_cache_all();
212 208
213 /** The code below is all system dependent and we should probably 209 /**
210 ** The code below is all system dependent and we should probably
214 ** have a function call out of here to set this up. You need 211 ** have a function call out of here to set this up. You need
215 ** to configure the GPIO or timer interrupts that will bring 212 ** to configure the GPIO or timer interrupts that will bring
216 ** you out of sleep. 213 ** you out of sleep.
217 ** For testing, the TOY counter wakeup is useful. 214 ** For testing, the TOY counter wakeup is useful.
218 **/ 215 **/
219
220#if 0 216#if 0
221 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD); 217 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD);
222 218
223 /* gpio 6 can cause a wake up event */ 219 /* GPIO 6 can cause a wake up event */
224 wakeup = au_readl(SYS_WAKEMSK); 220 wakeup = au_readl(SYS_WAKEMSK);
225 wakeup &= ~(1 << 8); /* turn off match20 wakeup */ 221 wakeup &= ~(1 << 8); /* turn off match20 wakeup */
226 wakeup |= 1 << 6; /* turn on gpio 6 wakeup */ 222 wakeup |= 1 << 6; /* turn on GPIO 6 wakeup */
227#else 223#else
228 /* For testing, allow match20 to wake us up. 224 /* For testing, allow match20 to wake us up. */
229 */
230#ifdef SLEEP_TEST_TIMEOUT 225#ifdef SLEEP_TEST_TIMEOUT
231 wakeup_counter0_set(sleep_ticks); 226 wakeup_counter0_set(sleep_ticks);
232#endif 227#endif
@@ -240,7 +235,8 @@ int au_sleep(void)
240 235
241 save_and_sleep(); 236 save_and_sleep();
242 237
243 /* after a wakeup, the cpu vectors back to 0x1fc00000 so 238 /*
239 * After a wakeup, the cpu vectors back to 0x1fc00000, so
244 * it's up to the boot code to get us back here. 240 * it's up to the boot code to get us back here.
245 */ 241 */
246 restore_core_regs(); 242 restore_core_regs();
@@ -248,24 +244,22 @@ int au_sleep(void)
248 return 0; 244 return 0;
249} 245}
250 246
251static int pm_do_sleep(ctl_table * ctl, int write, struct file *file, 247static int pm_do_sleep(ctl_table *ctl, int write, struct file *file,
252 void __user *buffer, size_t * len, loff_t *ppos) 248 void __user *buffer, size_t *len, loff_t *ppos)
253{ 249{
254#ifdef SLEEP_TEST_TIMEOUT 250#ifdef SLEEP_TEST_TIMEOUT
255#define TMPBUFLEN2 16 251#define TMPBUFLEN2 16
256 char buf[TMPBUFLEN2], *p; 252 char buf[TMPBUFLEN2], *p;
257#endif 253#endif
258 254
259 if (!write) { 255 if (!write)
260 *len = 0; 256 *len = 0;
261 } else { 257 else {
262#ifdef SLEEP_TEST_TIMEOUT 258#ifdef SLEEP_TEST_TIMEOUT
263 if (*len > TMPBUFLEN2 - 1) { 259 if (*len > TMPBUFLEN2 - 1)
264 return -EFAULT; 260 return -EFAULT;
265 } 261 if (copy_from_user(buf, buffer, *len))
266 if (copy_from_user(buf, buffer, *len)) {
267 return -EFAULT; 262 return -EFAULT;
268 }
269 buf[*len] = 0; 263 buf[*len] = 0;
270 p = buf; 264 p = buf;
271 sleep_ticks = simple_strtoul(p, &p, 0); 265 sleep_ticks = simple_strtoul(p, &p, 0);
@@ -276,8 +270,8 @@ static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,
276 return 0; 270 return 0;
277} 271}
278 272
279static int pm_do_freq(ctl_table * ctl, int write, struct file *file, 273static int pm_do_freq(ctl_table *ctl, int write, struct file *file,
280 void __user *buffer, size_t * len, loff_t *ppos) 274 void __user *buffer, size_t *len, loff_t *ppos)
281{ 275{
282 int retval = 0, i; 276 int retval = 0, i;
283 unsigned long val, pll; 277 unsigned long val, pll;
@@ -285,14 +279,14 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
285#define MAX_CPU_FREQ 396 279#define MAX_CPU_FREQ 396
286 char buf[TMPBUFLEN], *p; 280 char buf[TMPBUFLEN], *p;
287 unsigned long flags, intc0_mask, intc1_mask; 281 unsigned long flags, intc0_mask, intc1_mask;
288 unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, 282 unsigned long old_baud_base, old_cpu_freq, old_clk, old_refresh;
289 old_refresh;
290 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh; 283 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh;
284 unsigned long baud_rate;
291 285
292 spin_lock_irqsave(&pm_lock, flags); 286 spin_lock_irqsave(&pm_lock, flags);
293 if (!write) { 287 if (!write)
294 *len = 0; 288 *len = 0;
295 } else { 289 else {
296 /* Parse the new frequency */ 290 /* Parse the new frequency */
297 if (*len > TMPBUFLEN - 1) { 291 if (*len > TMPBUFLEN - 1) {
298 spin_unlock_irqrestore(&pm_lock, flags); 292 spin_unlock_irqrestore(&pm_lock, flags);
@@ -312,7 +306,7 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
312 306
313 pll = val / 12; 307 pll = val / 12;
314 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */ 308 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */
315 /* revisit this for higher speed cpus */ 309 /* Revisit this for higher speed CPUs */
316 spin_unlock_irqrestore(&pm_lock, flags); 310 spin_unlock_irqrestore(&pm_lock, flags);
317 return -EFAULT; 311 return -EFAULT;
318 } 312 }
@@ -321,30 +315,28 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
321 old_cpu_freq = get_au1x00_speed(); 315 old_cpu_freq = get_au1x00_speed();
322 316
323 new_cpu_freq = pll * 12 * 1000000; 317 new_cpu_freq = pll * 12 * 1000000;
324 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 318 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)
319 & 0x03) + 2) * 16));
325 set_au1x00_speed(new_cpu_freq); 320 set_au1x00_speed(new_cpu_freq);
326 set_au1x00_uart_baud_base(new_baud_base); 321 set_au1x00_uart_baud_base(new_baud_base);
327 322
328 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff; 323 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff;
329 new_refresh = 324 new_refresh = ((old_refresh * new_cpu_freq) / old_cpu_freq) |
330 ((old_refresh * new_cpu_freq) / 325 (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
331 old_cpu_freq) | (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
332 326
333 au_writel(pll, SYS_CPUPLL); 327 au_writel(pll, SYS_CPUPLL);
334 au_sync_delay(1); 328 au_sync_delay(1);
335 au_writel(new_refresh, MEM_SDREFCFG); 329 au_writel(new_refresh, MEM_SDREFCFG);
336 au_sync_delay(1); 330 au_sync_delay(1);
337 331
338 for (i = 0; i < 4; i++) { 332 for (i = 0; i < 4; i++)
339 if (au_readl 333 if (au_readl(UART_BASE + UART_MOD_CNTRL +
340 (UART_BASE + UART_MOD_CNTRL + 334 i * 0x00100000) == 3) {
341 i * 0x00100000) == 3) { 335 old_clk = au_readl(UART_BASE + UART_CLK +
342 old_clk = 336 i * 0x00100000);
343 au_readl(UART_BASE + UART_CLK +
344 i * 0x00100000);
345 // baud_rate = baud_base/clk
346 baud_rate = old_baud_base / old_clk; 337 baud_rate = old_baud_base / old_clk;
347 /* we won't get an exact baud rate and the error 338 /*
339 * We won't get an exact baud rate and the error
348 * could be significant enough that our new 340 * could be significant enough that our new
349 * calculation will result in a clock that will 341 * calculation will result in a clock that will
350 * give us a baud rate that's too far off from 342 * give us a baud rate that's too far off from
@@ -359,18 +351,14 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
359 else if (baud_rate > 17000) 351 else if (baud_rate > 17000)
360 baud_rate = 19200; 352 baud_rate = 19200;
361 else 353 else
362 (baud_rate = 9600); 354 baud_rate = 9600;
363 // new_clk = new_baud_base/baud_rate
364 new_clk = new_baud_base / baud_rate; 355 new_clk = new_baud_base / baud_rate;
365 au_writel(new_clk, 356 au_writel(new_clk, UART_BASE + UART_CLK +
366 UART_BASE + UART_CLK + 357 i * 0x00100000);
367 i * 0x00100000);
368 au_sync_delay(10); 358 au_sync_delay(10);
369 } 359 }
370 }
371 } 360 }
372 361
373
374 /* 362 /*
375 * We don't want _any_ interrupts other than match20. Otherwise our 363 * We don't want _any_ interrupts other than match20. Otherwise our
376 * au1000_calibrate_delay() calculation will be off, potentially a lot. 364 * au1000_calibrate_delay() calculation will be off, potentially a lot.
@@ -428,14 +416,15 @@ static int __init pm_init(void)
428 416
429__initcall(pm_init); 417__initcall(pm_init);
430 418
431
432/* 419/*
433 * This is right out of init/main.c 420 * This is right out of init/main.c
434 */ 421 */
435 422
436/* This is the number of bits of precision for the loops_per_jiffy. Each 423/*
437 bit takes on average 1.5/HZ seconds. This (like the original) is a little 424 * This is the number of bits of precision for the loops_per_jiffy.
438 better than 1% */ 425 * Each bit takes on average 1.5/HZ seconds. This (like the original)
426 * is a little better than 1%.
427 */
439#define LPS_PREC 8 428#define LPS_PREC 8
440 429
441static void au1000_calibrate_delay(void) 430static void au1000_calibrate_delay(void)
@@ -443,14 +432,14 @@ static void au1000_calibrate_delay(void)
443 unsigned long ticks, loopbit; 432 unsigned long ticks, loopbit;
444 int lps_precision = LPS_PREC; 433 int lps_precision = LPS_PREC;
445 434
446 loops_per_jiffy = (1 << 12); 435 loops_per_jiffy = 1 << 12;
447 436
448 while (loops_per_jiffy <<= 1) { 437 while (loops_per_jiffy <<= 1) {
449 /* wait for "start of" clock tick */ 438 /* Wait for "start of" clock tick */
450 ticks = jiffies; 439 ticks = jiffies;
451 while (ticks == jiffies) 440 while (ticks == jiffies)
452 /* nothing */ ; 441 /* nothing */ ;
453 /* Go .. */ 442 /* Go ... */
454 ticks = jiffies; 443 ticks = jiffies;
455 __delay(loops_per_jiffy); 444 __delay(loops_per_jiffy);
456 ticks = jiffies - ticks; 445 ticks = jiffies - ticks;
@@ -458,8 +447,10 @@ static void au1000_calibrate_delay(void)
458 break; 447 break;
459 } 448 }
460 449
461/* Do a binary approximation to get loops_per_jiffy set to equal one clock 450 /*
462 (up to lps_precision bits) */ 451 * Do a binary approximation to get loops_per_jiffy set to be equal
452 * one clock (up to lps_precision bits)
453 */
463 loops_per_jiffy >>= 1; 454 loops_per_jiffy >>= 1;
464 loopbit = loops_per_jiffy; 455 loopbit = loops_per_jiffy;
465 while (lps_precision-- && (loopbit >>= 1)) { 456 while (lps_precision-- && (loopbit >>= 1)) {
@@ -472,4 +463,4 @@ static void au1000_calibrate_delay(void)
472 loops_per_jiffy &= ~loopbit; 463 loops_per_jiffy &= ~loopbit;
473 } 464 }
474} 465}
475#endif /* CONFIG_PM */ 466#endif /* CONFIG_PM */
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index f10af829e4ec..18b310b475ca 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PROM library initialisation code, supports YAMON and U-Boot. 4 * PROM library initialisation code, supports YAMON and U-Boot.
5 * 5 *
6 * Copyright 2000, 2001, 2006 MontaVista Software Inc. 6 * Copyright 2000-2001, 2006, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This file was derived from Carsten Langgaard's 9 * This file was derived from Carsten Langgaard's
11 * arch/mips/mips-boards/xx files. 10 * arch/mips/mips-boards/xx files.
@@ -57,7 +56,7 @@ void prom_init_cmdline(void)
57 actr = 1; /* Always ignore argv[0] */ 56 actr = 1; /* Always ignore argv[0] */
58 57
59 cp = &(arcs_cmdline[0]); 58 cp = &(arcs_cmdline[0]);
60 while(actr < prom_argc) { 59 while (actr < prom_argc) {
61 strcpy(cp, prom_argv[actr]); 60 strcpy(cp, prom_argv[actr]);
62 cp += strlen(prom_argv[actr]); 61 cp += strlen(prom_argv[actr]);
63 *cp++ = ' '; 62 *cp++ = ' ';
@@ -84,10 +83,8 @@ char *prom_getenv(char *envname)
84 if (yamon) { 83 if (yamon) {
85 if (strcmp(envname, *env++) == 0) 84 if (strcmp(envname, *env++) == 0)
86 return *env; 85 return *env;
87 } else { 86 } else if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=')
88 if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') 87 return *env + i + 1;
89 return *env + i + 1;
90 }
91 env++; 88 env++;
92 } 89 }
93 90
@@ -110,13 +107,13 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
110{ 107{
111 int i; 108 int i;
112 109
113 for(i = 0; i < 6; i++) { 110 for (i = 0; i < 6; i++) {
114 unsigned char num; 111 unsigned char num;
115 112
116 if((*str == '.') || (*str == ':')) 113 if ((*str == '.') || (*str == ':'))
117 str++; 114 str++;
118 num = str2hexnum(*str++) << 4; 115 num = str2hexnum(*str++) << 4;
119 num |= (str2hexnum(*str++)); 116 num |= str2hexnum(*str++);
120 ea[i] = num; 117 ea[i] = num;
121 } 118 }
122} 119}
diff --git a/arch/mips/au1000/common/puts.c b/arch/mips/au1000/common/puts.c
index e34c67e89293..55bbe24d45b6 100644
--- a/arch/mips/au1000/common/puts.c
+++ b/arch/mips/au1000/common/puts.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a 16550 uart. 4 * Low level UART routines to directly access Alchemy UART.
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -40,12 +39,12 @@
40 39
41static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE; 40static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE;
42 41
43
44#ifdef SLOW_DOWN 42#ifdef SLOW_DOWN
45static inline void slow_down(void) 43static inline void slow_down(void)
46{ 44{
47 int k; 45 int k;
48 for (k=0; k<10000; k++); 46
47 for (k = 0; k < 10000; k++);
49} 48}
50#else 49#else
51#define slow_down() 50#define slow_down()
@@ -54,16 +53,16 @@ static inline void slow_down(void)
54void 53void
55prom_putchar(const unsigned char c) 54prom_putchar(const unsigned char c)
56{ 55{
57 unsigned char ch; 56 unsigned char ch;
58 int i = 0; 57 int i = 0;
58
59 do {
60 ch = com1[SER_CMD];
61 slow_down();
62 i++;
63 if (i > TIMEOUT)
64 break;
65 } while (0 == (ch & TX_BUSY));
59 66
60 do { 67 com1[SER_DATA] = c;
61 ch = com1[SER_CMD];
62 slow_down();
63 i++;
64 if (i>TIMEOUT) {
65 break;
66 }
67 } while (0 == (ch & TX_BUSY));
68 com1[SER_DATA] = c;
69} 68}
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c
index 60cec537c745..d555429c8d6f 100644
--- a/arch/mips/au1000/common/reset.c
+++ b/arch/mips/au1000/common/reset.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Au1000 reset routines. 4 * Au1xx0 reset routines.
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2006, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -28,10 +27,11 @@
28 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 28 */
30 29
30#include <asm/cacheflush.h>
31
31#include <asm/mach-au1x00/au1000.h> 32#include <asm/mach-au1x00/au1000.h>
32 33
33extern int au_sleep(void); 34extern int au_sleep(void);
34extern void (*flush_cache_all)(void);
35 35
36void au1000_restart(char *command) 36void au1000_restart(char *command)
37{ 37{
@@ -40,8 +40,8 @@ void au1000_restart(char *command)
40 u32 prid = read_c0_prid(); 40 u32 prid = read_c0_prid();
41 41
42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n"); 42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n");
43 switch (prid & 0xFF000000) 43
44 { 44 switch (prid & 0xFF000000) {
45 case 0x00000000: /* Au1000 */ 45 case 0x00000000: /* Au1000 */
46 au_writel(0x02, 0xb0000010); /* ac97_enable */ 46 au_writel(0x02, 0xb0000010); /* ac97_enable */
47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ 47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
@@ -138,9 +138,6 @@ void au1000_restart(char *command)
138 au_writel(0x00, 0xb1900064); /* sys_auxpll */ 138 au_writel(0x00, 0xb1900064); /* sys_auxpll */
139 au_writel(0x00, 0xb1900100); /* sys_pininputen */ 139 au_writel(0x00, 0xb1900100); /* sys_pininputen */
140 break; 140 break;
141
142 default:
143 break;
144 } 141 }
145 142
146 set_c0_status(ST0_BEV | ST0_ERL); 143 set_c0_status(ST0_BEV | ST0_ERL);
@@ -158,25 +155,25 @@ void au1000_restart(char *command)
158void au1000_halt(void) 155void au1000_halt(void)
159{ 156{
160#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550) 157#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550)
161 /* power off system */ 158 /* Power off system */
162 printk("\n** Powering off...\n"); 159 printk(KERN_NOTICE "\n** Powering off...\n");
163 au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C); 160 au_writew(au_readw(0xAF00001C) | (3 << 14), 0xAF00001C);
164 au_sync(); 161 au_sync();
165 while(1); /* should not get here */ 162 while (1); /* should not get here */
166#else 163#else
167 printk(KERN_NOTICE "\n** You can safely turn off the power\n"); 164 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
168#ifdef CONFIG_MIPS_MIRAGE 165#ifdef CONFIG_MIPS_MIRAGE
169 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); 166 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT);
170#endif 167#endif
171#ifdef CONFIG_MIPS_DB1200 168#ifdef CONFIG_MIPS_DB1200
172 au_writew(au_readw(0xB980001C) | (1<<14), 0xB980001C); 169 au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
173#endif 170#endif
174#ifdef CONFIG_PM 171#ifdef CONFIG_PM
175 au_sleep(); 172 au_sleep();
176 173
177 /* should not get here */ 174 /* Should not get here */
178 printk(KERN_ERR "Unable to put cpu in sleep mode\n"); 175 printk(KERN_ERR "Unable to put CPU in sleep mode\n");
179 while(1); 176 while (1);
180#else 177#else
181 while (1) 178 while (1)
182 __asm__(".set\tmips3\n\t" 179 __asm__(".set\tmips3\n\t"
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 0e86f7a6b4a7..1ac6b06f42a3 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2007-2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc. 5 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc.
7 * 6 *
@@ -48,7 +47,7 @@ void __init plat_mem_setup(void)
48{ 47{
49 struct cpu_spec *sp; 48 struct cpu_spec *sp;
50 char *argptr; 49 char *argptr;
51 unsigned long prid, cpufreq, bclk = 1; 50 unsigned long prid, cpufreq, bclk;
52 51
53 set_cpuspec(); 52 set_cpuspec();
54 sp = cur_cpu_spec[0]; 53 sp = cur_cpu_spec[0];
@@ -66,42 +65,39 @@ void __init plat_mem_setup(void)
66 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12; 65 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12;
67 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq); 66 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq);
68 67
69 bclk = sp->cpu_bclk; 68 if (sp->cpu_bclk) {
70 if (bclk)
71 {
72 /* Enable BCLK switching */ 69 /* Enable BCLK switching */
73 bclk = au_readl(0xB190003C); 70 bclk = au_readl(SYS_POWERCTRL);
74 au_writel(bclk | 0x60, 0xB190003C); 71 au_writel(bclk | 0x60, SYS_POWERCTRL);
75 printk("BCLK switching enabled!\n"); 72 printk(KERN_INFO "BCLK switching enabled!\n");
76 } 73 }
77 74
78 if (sp->cpu_od) { 75 if (sp->cpu_od)
79 /* Various early Au1000 Errata corrected by this */ 76 /* Various early Au1xx0 errata corrected by this */
80 set_c0_config(1<<19); /* Set Config[OD] */ 77 set_c0_config(1 << 19); /* Set Config[OD] */
81 } 78 else
82 else {
83 /* Clear to obtain best system bus performance */ 79 /* Clear to obtain best system bus performance */
84 clear_c0_config(1<<19); /* Clear Config[OD] */ 80 clear_c0_config(1 << 19); /* Clear Config[OD] */
85 }
86 81
87 argptr = prom_getcmdline(); 82 argptr = prom_getcmdline();
88 83
89#ifdef CONFIG_SERIAL_8250_CONSOLE 84#ifdef CONFIG_SERIAL_8250_CONSOLE
90 if ((argptr = strstr(argptr, "console=")) == NULL) { 85 argptr = strstr(argptr, "console=");
86 if (argptr == NULL) {
91 argptr = prom_getcmdline(); 87 argptr = prom_getcmdline();
92 strcat(argptr, " console=ttyS0,115200"); 88 strcat(argptr, " console=ttyS0,115200");
93 } 89 }
94#endif 90#endif
95 91
96#ifdef CONFIG_FB_AU1100 92#ifdef CONFIG_FB_AU1100
97 if ((argptr = strstr(argptr, "video=")) == NULL) { 93 argptr = strstr(argptr, "video=");
98 argptr = prom_getcmdline(); 94 if (argptr == NULL) {
99 /* default panel */ 95 argptr = prom_getcmdline();
100 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/ 96 /* default panel */
101 } 97 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
98 }
102#endif 99#endif
103 100
104
105#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000) 101#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
106 /* au1000 does not support vra, au1500 and au1100 do */ 102 /* au1000 does not support vra, au1500 and au1100 do */
107 strcat(argptr, " au1000_audio=vra"); 103 strcat(argptr, " au1000_audio=vra");
@@ -129,7 +125,7 @@ void __init plat_mem_setup(void)
129/* This routine should be valid for all Au1x based boards */ 125/* This routine should be valid for all Au1x based boards */
130phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size) 126phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
131{ 127{
132 /* Don't fixup 36 bit addresses */ 128 /* Don't fixup 36-bit addresses */
133 if ((phys_addr >> 32) != 0) 129 if ((phys_addr >> 32) != 0)
134 return phys_addr; 130 return phys_addr;
135 131
@@ -145,17 +141,17 @@ phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
145 } 141 }
146#endif 142#endif
147 143
148 /* All Au1x SOCs have a pcmcia controller */ 144 /*
149 /* We setup our 32 bit pseudo addresses to be equal to the 145 * All Au1xx0 SOCs have a PCMCIA controller.
150 * 36 bit addr >> 4, to make it easier to check the address 146 * We setup our 32-bit pseudo addresses to be equal to the
147 * 36-bit addr >> 4, to make it easier to check the address
151 * and fix it. 148 * and fix it.
152 * The Au1x socket 0 phys attribute address is 0xF 4000 0000. 149 * The PCMCIA socket 0 physical attribute address is 0xF 4000 0000.
153 * The pseudo address we use is 0xF400 0000. Any address over 150 * The pseudo address we use is 0xF400 0000. Any address over
154 * 0xF400 0000 is a pcmcia pseudo address. 151 * 0xF400 0000 is a PCMCIA pseudo address.
155 */ 152 */
156 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF)) { 153 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF))
157 return (phys_t)(phys_addr << 4); 154 return (phys_t)(phys_addr << 4);
158 }
159 155
160 /* default nop */ 156 /* default nop */
161 return phys_addr; 157 return phys_addr;
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index bdb6d73b26fb..563d9390a872 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -25,11 +25,9 @@
25 * 25 *
26 * Setting up the clock on the MIPS boards. 26 * Setting up the clock on the MIPS boards.
27 * 27 *
28 * Update. Always configure the kernel with CONFIG_NEW_TIME_C. This 28 * We provide the clock interrupt processing and the timer offset compute
29 * will use the user interface gettimeofday() functions from the 29 * functions. If CONFIG_PM is selected, we also ensure the 32KHz timer is
30 * arch/mips/kernel/time.c, and we provide the clock interrupt processing 30 * available. -- Dan
31 * and the timer offset compute functions. If CONFIG_PM is selected,
32 * we also ensure the 32KHz timer is available. -- Dan
33 */ 31 */
34 32
35#include <linux/types.h> 33#include <linux/types.h>
@@ -47,8 +45,7 @@ extern int allow_au1k_wait; /* default off for CP0 Counter */
47#if HZ < 100 || HZ > 1000 45#if HZ < 100 || HZ > 1000
48#error "unsupported HZ value! Must be in [100,1000]" 46#error "unsupported HZ value! Must be in [100,1000]"
49#endif 47#endif
50#define MATCH20_INC (328*100/HZ) /* magic number 328 is for HZ=100... */ 48#define MATCH20_INC (328 * 100 / HZ) /* magic number 328 is for HZ=100... */
51extern void startup_match20_interrupt(irq_handler_t handler);
52static unsigned long last_pc0, last_match20; 49static unsigned long last_pc0, last_match20;
53#endif 50#endif
54 51
@@ -61,7 +58,7 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
61{ 58{
62 unsigned long pc0; 59 unsigned long pc0;
63 int time_elapsed; 60 int time_elapsed;
64 static int jiffie_drift = 0; 61 static int jiffie_drift;
65 62
66 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) { 63 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) {
67 /* should never happen! */ 64 /* should never happen! */
@@ -70,13 +67,11 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
70 } 67 }
71 68
72 pc0 = au_readl(SYS_TOYREAD); 69 pc0 = au_readl(SYS_TOYREAD);
73 if (pc0 < last_match20) { 70 if (pc0 < last_match20)
74 /* counter overflowed */ 71 /* counter overflowed */
75 time_elapsed = (0xffffffff - last_match20) + pc0; 72 time_elapsed = (0xffffffff - last_match20) + pc0;
76 } 73 else
77 else {
78 time_elapsed = pc0 - last_match20; 74 time_elapsed = pc0 - last_match20;
79 }
80 75
81 while (time_elapsed > 0) { 76 while (time_elapsed > 0) {
82 do_timer(1); 77 do_timer(1);
@@ -92,8 +87,9 @@ static irqreturn_t counter0_irq(int irq, void *dev_id)
92 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 87 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
93 au_sync(); 88 au_sync();
94 89
95 /* our counter ticks at 10.009765625 ms/tick, we we're running 90 /*
96 * almost 10uS too slow per tick. 91 * Our counter ticks at 10.009765625 ms/tick, we we're running
92 * almost 10 uS too slow per tick.
97 */ 93 */
98 94
99 if (jiffie_drift >= 999) { 95 if (jiffie_drift >= 999) {
@@ -117,20 +113,17 @@ struct irqaction counter0_action = {
117/* When we wakeup from sleep, we have to "catch up" on all of the 113/* When we wakeup from sleep, we have to "catch up" on all of the
118 * timer ticks we have missed. 114 * timer ticks we have missed.
119 */ 115 */
120void 116void wakeup_counter0_adjust(void)
121wakeup_counter0_adjust(void)
122{ 117{
123 unsigned long pc0; 118 unsigned long pc0;
124 int time_elapsed; 119 int time_elapsed;
125 120
126 pc0 = au_readl(SYS_TOYREAD); 121 pc0 = au_readl(SYS_TOYREAD);
127 if (pc0 < last_match20) { 122 if (pc0 < last_match20)
128 /* counter overflowed */ 123 /* counter overflowed */
129 time_elapsed = (0xffffffff - last_match20) + pc0; 124 time_elapsed = (0xffffffff - last_match20) + pc0;
130 } 125 else
131 else {
132 time_elapsed = pc0 - last_match20; 126 time_elapsed = pc0 - last_match20;
133 }
134 127
135 while (time_elapsed > 0) { 128 while (time_elapsed > 0) {
136 time_elapsed -= MATCH20_INC; 129 time_elapsed -= MATCH20_INC;
@@ -143,10 +136,8 @@ wakeup_counter0_adjust(void)
143 136
144} 137}
145 138
146/* This is just for debugging to set the timer for a sleep delay. 139/* This is just for debugging to set the timer for a sleep delay. */
147*/ 140void wakeup_counter0_set(int ticks)
148void
149wakeup_counter0_set(int ticks)
150{ 141{
151 unsigned long pc0; 142 unsigned long pc0;
152 143
@@ -157,21 +148,22 @@ wakeup_counter0_set(int ticks)
157} 148}
158#endif 149#endif
159 150
160/* I haven't found anyone that doesn't use a 12 MHz source clock, 151/*
152 * I haven't found anyone that doesn't use a 12 MHz source clock,
161 * but just in case..... 153 * but just in case.....
162 */ 154 */
163#define AU1000_SRC_CLK 12000000 155#define AU1000_SRC_CLK 12000000
164 156
165/* 157/*
166 * We read the real processor speed from the PLL. This is important 158 * We read the real processor speed from the PLL. This is important
167 * because it is more accurate than computing it from the 32KHz 159 * because it is more accurate than computing it from the 32 KHz
168 * counter, if it exists. If we don't have an accurate processor 160 * counter, if it exists. If we don't have an accurate processor
169 * speed, all of the peripherals that derive their clocks based on 161 * speed, all of the peripherals that derive their clocks based on
170 * this advertised speed will introduce error and sometimes not work 162 * this advertised speed will introduce error and sometimes not work
171 * properly. This function is futher convoluted to still allow configurations 163 * properly. This function is futher convoluted to still allow configurations
172 * to do that in case they have really, really old silicon with a 164 * to do that in case they have really, really old silicon with a
173 * write-only PLL register, that we need the 32KHz when power management 165 * write-only PLL register, that we need the 32 KHz when power management
174 * "wait" is enabled, and we need to detect if the 32KHz isn't present 166 * "wait" is enabled, and we need to detect if the 32 KHz isn't present
175 * but requested......got it? :-) -- Dan 167 * but requested......got it? :-) -- Dan
176 */ 168 */
177unsigned long calc_clock(void) 169unsigned long calc_clock(void)
@@ -182,8 +174,7 @@ unsigned long calc_clock(void)
182 174
183 spin_lock_irqsave(&time_lock, flags); 175 spin_lock_irqsave(&time_lock, flags);
184 176
185 /* Power management cares if we don't have a 32KHz counter. 177 /* Power management cares if we don't have a 32 KHz counter. */
186 */
187 no_au1xxx_32khz = 0; 178 no_au1xxx_32khz = 0;
188 counter = au_readl(SYS_COUNTER_CNTRL); 179 counter = au_readl(SYS_COUNTER_CNTRL);
189 if (counter & SYS_CNTRL_E0) { 180 if (counter & SYS_CNTRL_E0) {
@@ -193,7 +184,7 @@ unsigned long calc_clock(void)
193 184
194 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 185 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
195 /* RTC now ticks at 32.768/16 kHz */ 186 /* RTC now ticks at 32.768/16 kHz */
196 au_writel(trim_divide-1, SYS_RTCTRIM); 187 au_writel(trim_divide - 1, SYS_RTCTRIM);
197 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 188 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
198 189
199 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S); 190 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S);
@@ -215,9 +206,11 @@ unsigned long calc_clock(void)
215#endif 206#endif
216 else 207 else
217 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK; 208 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK;
209 /* On Alchemy CPU:counter ratio is 1:1 */
218 mips_hpt_frequency = cpu_speed; 210 mips_hpt_frequency = cpu_speed;
219 // Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) 211 /* Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) */
220 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 212 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)
213 & 0x03) + 2) * 16));
221 spin_unlock_irqrestore(&time_lock, flags); 214 spin_unlock_irqrestore(&time_lock, flags);
222 return cpu_speed; 215 return cpu_speed;
223} 216}
@@ -228,10 +221,10 @@ void __init plat_time_init(void)
228 221
229 est_freq += 5000; /* round */ 222 est_freq += 5000; /* round */
230 est_freq -= est_freq%10000; 223 est_freq -= est_freq%10000;
231 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000, 224 printk(KERN_INFO "CPU frequency %u.%02u MHz\n",
232 (est_freq%1000000)*100/1000000); 225 est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000);
233 set_au1x00_speed(est_freq); 226 set_au1x00_speed(est_freq);
234 set_au1x00_lcd_clock(); // program the LCD clock 227 set_au1x00_lcd_clock(); /* program the LCD clock */
235 228
236#ifdef CONFIG_PM 229#ifdef CONFIG_PM
237 /* 230 /*
@@ -243,30 +236,29 @@ void __init plat_time_init(void)
243 * counter 0 interrupt as a special irq and it doesn't show 236 * counter 0 interrupt as a special irq and it doesn't show
244 * up under /proc/interrupts. 237 * up under /proc/interrupts.
245 * 238 *
246 * Check to ensure we really have a 32KHz oscillator before 239 * Check to ensure we really have a 32 KHz oscillator before
247 * we do this. 240 * we do this.
248 */ 241 */
249 if (no_au1xxx_32khz) 242 if (no_au1xxx_32khz)
250 printk("WARNING: no 32KHz clock found.\n"); 243 printk(KERN_WARNING "WARNING: no 32KHz clock found.\n");
251 else { 244 else {
252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 245 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
253 au_writel(0, SYS_TOYWRITE); 246 au_writel(0, SYS_TOYWRITE);
254 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 247 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
255 248
256 au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK); 249 au_writel(au_readl(SYS_WAKEMSK) | (1 << 8), SYS_WAKEMSK);
257 au_writel(~0, SYS_WAKESRC); 250 au_writel(~0, SYS_WAKESRC);
258 au_sync(); 251 au_sync();
259 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
260 253
261 /* setup match20 to interrupt once every HZ */ 254 /* Setup match20 to interrupt once every HZ */
262 last_pc0 = last_match20 = au_readl(SYS_TOYREAD); 255 last_pc0 = last_match20 = au_readl(SYS_TOYREAD);
263 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 256 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
264 au_sync(); 257 au_sync();
265 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 258 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
266 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action); 259 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action);
267 260
268 /* We can use the real 'wait' instruction. 261 /* We can use the real 'wait' instruction. */
269 */
270 allow_au1k_wait = 1; 262 allow_au1k_wait = 1;
271 } 263 }
272 264
diff --git a/arch/mips/au1000/db1x00/Makefile b/arch/mips/au1000/db1x00/Makefile
index 51d62bd5d900..274db3b55d82 100644
--- a/arch/mips/au1000/db1x00/Makefile
+++ b/arch/mips/au1000/db1x00/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com 4#
5# Makefile for the Alchemy Semiconductor DBAu1xx0 boards.
5# 6#
6# Makefile for the Alchemy Semiconductor Db1x00 board.
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/db1x00/board_setup.c b/arch/mips/au1000/db1x00/board_setup.c
index b7dcbad5c586..9e5ccbbfcedd 100644
--- a/arch/mips/au1000/db1x00/board_setup.c
+++ b/arch/mips/au1000/db1x00/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Db1x00 board setup. 4 * Alchemy Db1x00 board setup.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -37,49 +36,49 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
37 36
38void board_reset(void) 37void board_reset(void)
39{ 38{
40 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 39 /* Hit BCSR.SW_RESET[RESET] */
41 bcsr->swreset = 0x0000; 40 bcsr->swreset = 0x0000;
42} 41}
43 42
44void __init board_setup(void) 43void __init board_setup(void)
45{ 44{
46 u32 pin_func; 45 u32 pin_func = 0;
47 46
48 pin_func = 0; 47 /* Not valid for Au1550 */
49 /* not valid for 1550 */ 48#if defined(CONFIG_IRDA) && \
50 49 (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
51#if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100)) 50 /* Set IRFIRSEL instead of GPIO15 */
52 /* set IRFIRSEL instead of GPIO15 */ 51 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
53 pin_func = au_readl(SYS_PINFUNC) | (u32)((1<<8));
54 au_writel(pin_func, SYS_PINFUNC); 52 au_writel(pin_func, SYS_PINFUNC);
55 /* power off until the driver is in use */ 53 /* Power off until the driver is in use */
56 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK; 54 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
57 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF; 55 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF;
58 au_sync(); 56 au_sync();
59#endif 57#endif
60 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */ 58 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
61 59
62#ifdef CONFIG_MIPS_MIRAGE 60#ifdef CONFIG_MIPS_MIRAGE
63 /* enable GPIO[31:0] inputs */ 61 /* Enable GPIO[31:0] inputs */
64 au_writel(0, SYS_PININPUTEN); 62 au_writel(0, SYS_PININPUTEN);
65 63
66 /* GPIO[20] is output, tristate the other input primary GPIO's */ 64 /* GPIO[20] is output, tristate the other input primary GPIOs */
67 au_writel((u32)(~(1<<20)), SYS_TRIOUTCLR); 65 au_writel(~(1 << 20), SYS_TRIOUTCLR);
68 66
69 /* set GPIO[210:208] instead of SSI_0 */ 67 /* Set GPIO[210:208] instead of SSI_0 */
70 pin_func = au_readl(SYS_PINFUNC) | (u32)(1); 68 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
71 69
72 /* set GPIO[215:211] for LED's */ 70 /* Set GPIO[215:211] for LEDs */
73 pin_func |= (u32)((5<<2)); 71 pin_func |= 5 << 2;
74 72
75 /* set GPIO[214:213] for more LED's */ 73 /* Set GPIO[214:213] for more LEDs */
76 pin_func |= (u32)((5<<12)); 74 pin_func |= 5 << 12;
77 75
78 /* set GPIO[207:200] instead of PCMCIA/LCD */ 76 /* Set GPIO[207:200] instead of PCMCIA/LCD */
79 pin_func |= (u32)((3<<17)); 77 pin_func |= SYS_PF_LCD | SYS_PF_PC;
80 au_writel(pin_func, SYS_PINFUNC); 78 au_writel(pin_func, SYS_PINFUNC);
81 79
82 /* Enable speaker amplifier. This should 80 /*
81 * Enable speaker amplifier. This should
83 * be part of the audio driver. 82 * be part of the audio driver.
84 */ 83 */
85 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR); 84 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR);
@@ -89,21 +88,21 @@ void __init board_setup(void)
89 au_sync(); 88 au_sync();
90 89
91#ifdef CONFIG_MIPS_DB1000 90#ifdef CONFIG_MIPS_DB1000
92 printk("AMD Alchemy Au1000/Db1000 Board\n"); 91 printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
93#endif 92#endif
94#ifdef CONFIG_MIPS_DB1500 93#ifdef CONFIG_MIPS_DB1500
95 printk("AMD Alchemy Au1500/Db1500 Board\n"); 94 printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
96#endif 95#endif
97#ifdef CONFIG_MIPS_DB1100 96#ifdef CONFIG_MIPS_DB1100
98 printk("AMD Alchemy Au1100/Db1100 Board\n"); 97 printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
99#endif 98#endif
100#ifdef CONFIG_MIPS_BOSPORUS 99#ifdef CONFIG_MIPS_BOSPORUS
101 printk("AMD Alchemy Bosporus Board\n"); 100 printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
102#endif 101#endif
103#ifdef CONFIG_MIPS_MIRAGE 102#ifdef CONFIG_MIPS_MIRAGE
104 printk("AMD Alchemy Mirage Board\n"); 103 printk(KERN_INFO "AMD Alchemy Mirage Board\n");
105#endif 104#endif
106#ifdef CONFIG_MIPS_DB1550 105#ifdef CONFIG_MIPS_DB1550
107 printk("AMD Alchemy Au1550/Db1550 Board\n"); 106 printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
108#endif 107#endif
109} 108}
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index d3b967caf70c..5ebe0de5e459 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup 3 * PB1000 board setup
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -49,8 +48,8 @@ void __init prom_init(void)
49 unsigned long memsize; 48 unsigned long memsize;
50 49
51 prom_argc = fw_arg0; 50 prom_argc = fw_arg0;
52 prom_argv = (char **) fw_arg1; 51 prom_argv = (char **)fw_arg1;
53 prom_envp = (char **) fw_arg2; 52 prom_envp = (char **)fw_arg2;
54 53
55 prom_init_cmdline(); 54 prom_init_cmdline();
56 55
@@ -58,6 +57,6 @@ void __init prom_init(void)
58 if (!memsize_str) 57 if (!memsize_str)
59 memsize = 0x04000000; 58 memsize = 0x04000000;
60 else 59 else
61 memsize = simple_strtol(memsize_str, NULL, 0); 60 memsize = strict_strtol(memsize_str, 0, NULL);
62 add_memory_region(0, memsize, BOOT_MEM_RAM); 61 add_memory_region(0, memsize, BOOT_MEM_RAM);
63} 62}
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
index eaa50c7b6341..94c090e8bf7a 100644
--- a/arch/mips/au1000/db1x00/irqmap.c
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -32,32 +32,32 @@
32 32
33#ifdef CONFIG_MIPS_DB1500 33#ifdef CONFIG_MIPS_DB1500
34char irq_tab_alchemy[][5] __initdata = { 34char irq_tab_alchemy[][5] __initdata = {
35 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT371 */ 35 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT371 */
36 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 36 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
37}; 37};
38#endif 38#endif
39 39
40#ifdef CONFIG_MIPS_BOSPORUS 40#ifdef CONFIG_MIPS_BOSPORUS
41char irq_tab_alchemy[][5] __initdata = { 41char irq_tab_alchemy[][5] __initdata = {
42 [11] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 11 - miniPCI */ 42 [11] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 11 - miniPCI */
43 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - SN1741 */ 43 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - SN1741 */
44 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 44 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
45}; 45};
46#endif 46#endif
47 47
48#ifdef CONFIG_MIPS_MIRAGE 48#ifdef CONFIG_MIPS_MIRAGE
49char irq_tab_alchemy[][5] __initdata = { 49char irq_tab_alchemy[][5] __initdata = {
50 [11] = { -1, INTD, INTX, INTX, INTX}, /* IDSEL 11 - SMI VGX */ 50 [11] = { -1, INTD, INTX, INTX, INTX }, /* IDSEL 11 - SMI VGX */
51 [12] = { -1, INTX, INTX, INTC, INTX}, /* IDSEL 12 - PNX1300 */ 51 [12] = { -1, INTX, INTX, INTC, INTX }, /* IDSEL 12 - PNX1300 */
52 [13] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 13 - miniPCI */ 52 [13] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 13 - miniPCI */
53}; 53};
54#endif 54#endif
55 55
56#ifdef CONFIG_MIPS_DB1550 56#ifdef CONFIG_MIPS_DB1550
57char irq_tab_alchemy[][5] __initdata = { 57char irq_tab_alchemy[][5] __initdata = {
58 [11] = { -1, INTC, INTX, INTX, INTX}, /* IDSEL 11 - on-board HPT371 */ 58 [11] = { -1, INTC, INTX, INTX, INTX }, /* IDSEL 11 - on-board HPT371 */
59 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */ 59 [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
60 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 60 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
61}; 61};
62#endif 62#endif
63 63
diff --git a/arch/mips/au1000/mtx-1/Makefile b/arch/mips/au1000/mtx-1/Makefile
index 85a90941de4f..7c67b3d33bec 100644
--- a/arch/mips/au1000/mtx-1/Makefile
+++ b/arch/mips/au1000/mtx-1/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Copyright 2003 MontaVista Software Inc. 2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# Bruno Randolf <bruno.randolf@4g-systems.biz> 4# Bruno Randolf <bruno.randolf@4g-systems.biz>
6# 5#
7# Makefile for 4G Systems MTX-1 board. 6# Makefile for 4G Systems MTX-1 board.
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c
index 5736354829c6..3f8079186cf2 100644
--- a/arch/mips/au1000/mtx-1/board_setup.c
+++ b/arch/mips/au1000/mtx-1/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup. 4 * 4G Systems MTX-1 board setup.
5 * 5 *
6 * Copyright 2003 MontaVista Software Inc. 6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz> 8 * Bruno Randolf <bruno.randolf@4g-systems.biz>
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
@@ -34,7 +33,7 @@
34#include <asm/mach-au1x00/au1000.h> 33#include <asm/mach-au1x00/au1000.h>
35 34
36extern int (*board_pci_idsel)(unsigned int devsel, int assert); 35extern int (*board_pci_idsel)(unsigned int devsel, int assert);
37int mtx1_pci_idsel(unsigned int devsel, int assert); 36int mtx1_pci_idsel(unsigned int devsel, int assert);
38 37
39void board_reset(void) 38void board_reset(void)
40{ 39{
@@ -45,36 +44,36 @@ void board_reset(void)
45void __init board_setup(void) 44void __init board_setup(void)
46{ 45{
47#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 46#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
48 // enable USB power switch 47 /* Enable USB power switch */
49 au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR ); 48 au_writel(au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR);
50 au_writel( 0x100000, GPIO2_OUTPUT ); 49 au_writel(0x100000, GPIO2_OUTPUT);
51#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 50#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
52 51
53#ifdef CONFIG_PCI 52#ifdef CONFIG_PCI
54#if defined(__MIPSEB__) 53#if defined(__MIPSEB__)
55 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 54 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
56#else 55#else
57 au_writel(0xf, Au1500_PCI_CFG); 56 au_writel(0xf, Au1500_PCI_CFG);
58#endif 57#endif
59#endif 58#endif
60 59
61 // initialize sys_pinfunc: 60 /* Initialize sys_pinfunc */
62 au_writel( SYS_PF_NI2, SYS_PINFUNC ); 61 au_writel(SYS_PF_NI2, SYS_PINFUNC);
63 62
64 // initialize GPIO 63 /* Initialize GPIO */
65 au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); 64 au_writel(0xFFFFFFFF, SYS_TRIOUTCLR);
66 au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF 65 au_writel(0x00000001, SYS_OUTPUTCLR); /* set M66EN (PCI 66MHz) to OFF */
67 au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF 66 au_writel(0x00000008, SYS_OUTPUTSET); /* set PCI CLKRUN# to OFF */
68 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON 67 au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
69 au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF 68 au_writel(0x00000020, SYS_OUTPUTCLR); /* set eth PHY TX_ER to OFF */
70 69
71 // enable LED and set it to green 70 /* Enable LED and set it to green */
72 au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); 71 au_writel(au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR);
73 au_writel( 0x18000800, GPIO2_OUTPUT ); 72 au_writel(0x18000800, GPIO2_OUTPUT);
74 73
75 board_pci_idsel = mtx1_pci_idsel; 74 board_pci_idsel = mtx1_pci_idsel;
76 75
77 printk("4G Systems MTX-1 Board\n"); 76 printk(KERN_INFO "4G Systems MTX-1 Board\n");
78} 77}
79 78
80int 79int
@@ -82,20 +81,18 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
82{ 81{
83#define MTX_IDSEL_ONLY_0_AND_3 0 82#define MTX_IDSEL_ONLY_0_AND_3 0
84#if MTX_IDSEL_ONLY_0_AND_3 83#if MTX_IDSEL_ONLY_0_AND_3
85 if (devsel != 0 && devsel != 3) { 84 if (devsel != 0 && devsel != 3) {
86 printk("*** not 0 or 3\n"); 85 printk(KERN_ERR "*** not 0 or 3\n");
87 return 0; 86 return 0;
88 } 87 }
89#endif 88#endif
90 89
91 if (assert && devsel != 0) { 90 if (assert && devsel != 0)
92 // suppress signal to cardbus 91 /* Suppress signal to Cardbus */
93 au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF 92 au_writel(0x00000002, SYS_OUTPUTCLR); /* set EXT_IO3 OFF */
94 } 93 else
95 else { 94 au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
96 au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON 95 au_sync_udelay(1);
97 } 96 return 1;
98 au_sync_udelay(1);
99 return 1;
100} 97}
101 98
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
index c015cbce1cca..33a4aebe0cba 100644
--- a/arch/mips/au1000/mtx-1/init.c
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup 4 * 4G Systems MTX-1 board setup
5 * 5 *
6 * Copyright 2003 MontaVista Software Inc. 6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz> 8 * Bruno Randolf <bruno.randolf@4g-systems.biz>
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
@@ -47,8 +46,8 @@ void __init prom_init(void)
47 unsigned long memsize; 46 unsigned long memsize;
48 47
49 prom_argc = fw_arg0; 48 prom_argc = fw_arg0;
50 prom_argv = (char **) fw_arg1; 49 prom_argv = (char **)fw_arg1;
51 prom_envp = (char **) fw_arg2; 50 prom_envp = (char **)fw_arg2;
52 51
53 prom_init_cmdline(); 52 prom_init_cmdline();
54 53
@@ -56,6 +55,6 @@ void __init prom_init(void)
56 if (!memsize_str) 55 if (!memsize_str)
57 memsize = 0x04000000; 56 memsize = 0x04000000;
58 else 57 else
59 memsize = simple_strtol(memsize_str, NULL, 0); 58 memsize = strict_strtol(memsize_str, 0, NULL);
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 60}
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
index 78d70c42c9db..f2bf02951e9c 100644
--- a/arch/mips/au1000/mtx-1/irqmap.c
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -31,18 +31,18 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [0] = { -1, INTA, INTA, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */ 34 [0] = { -1, INTA, INTA, INTX, INTX }, /* IDSEL 00 - AdapterA-Slot0 (top) */
35 [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ 35 [1] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
36 [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */ 36 [2] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 02 - AdapterB-Slot0 (top) */
37 [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ 37 [3] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
38 [4] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 04 - AdapterC-Slot0 (top) */ 38 [4] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 04 - AdapterC-Slot0 (top) */
39 [5] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 05 - AdapterC-Slot1 (bottom) */ 39 [5] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
40 [6] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 06 - AdapterD-Slot0 (top) */ 40 [6] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 06 - AdapterD-Slot0 (top) */
41 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ 41 [7] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
42}; 42};
43 43
44struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 44struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
45 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 45 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
46 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 46 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
47 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 47 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
48 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 48 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/mtx-1/platform.c b/arch/mips/au1000/mtx-1/platform.c
index a7edbf0829ac..9807be37c32f 100644
--- a/arch/mips/au1000/mtx-1/platform.c
+++ b/arch/mips/au1000/mtx-1/platform.c
@@ -21,11 +21,10 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/gpio.h>
24#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
25#include <linux/input.h> 26#include <linux/input.h>
26 27
27#include <asm/gpio.h>
28
29static struct gpio_keys_button mtx1_gpio_button[] = { 28static struct gpio_keys_button mtx1_gpio_button[] = {
30 { 29 {
31 .gpio = 207, 30 .gpio = 207,
diff --git a/arch/mips/au1000/pb1000/Makefile b/arch/mips/au1000/pb1000/Makefile
index daa1a507e72f..99bbec0ca41b 100644
--- a/arch/mips/au1000/pb1000/Makefile
+++ b/arch/mips/au1000/pb1000/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com 4#
5# Makefile for the Alchemy Semiconductor Pb1000 board.
5# 6#
6# Makefile for the Alchemy Semiconductor PB1000 board.
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1000/board_setup.c b/arch/mips/au1000/pb1000/board_setup.c
index 33f15acc1b17..25df167a95b3 100644
--- a/arch/mips/au1000/pb1000/board_setup.c
+++ b/arch/mips/au1000/pb1000/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -40,128 +39,126 @@ void __init board_setup(void)
40 u32 sys_freqctrl, sys_clksrc; 39 u32 sys_freqctrl, sys_clksrc;
41 u32 prid = read_c0_prid(); 40 u32 prid = read_c0_prid();
42 41
43 // set AUX clock to 12MHz * 8 = 96 MHz 42 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
44 au_writel(8, SYS_AUXPLL); 43 au_writel(8, SYS_AUXPLL);
45 au_writel(0, SYS_PINSTATERD); 44 au_writel(0, SYS_PINSTATERD);
46 udelay(100); 45 udelay(100);
47 46
48#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 47#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
49 /* zero and disable FREQ2 */ 48 /* Zero and disable FREQ2 */
50 sys_freqctrl = au_readl(SYS_FREQCTRL0); 49 sys_freqctrl = au_readl(SYS_FREQCTRL0);
51 sys_freqctrl &= ~0xFFF00000; 50 sys_freqctrl &= ~0xFFF00000;
52 au_writel(sys_freqctrl, SYS_FREQCTRL0); 51 au_writel(sys_freqctrl, SYS_FREQCTRL0);
53 52
54 /* zero and disable USBH/USBD clocks */ 53 /* Zero and disable USBH/USBD clocks */
55 sys_clksrc = au_readl(SYS_CLKSRC); 54 sys_clksrc = au_readl(SYS_CLKSRC);
56 sys_clksrc &= ~0x00007FE0; 55 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
56 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
57 au_writel(sys_clksrc, SYS_CLKSRC); 57 au_writel(sys_clksrc, SYS_CLKSRC);
58 58
59 sys_freqctrl = au_readl(SYS_FREQCTRL0); 59 sys_freqctrl = au_readl(SYS_FREQCTRL0);
60 sys_freqctrl &= ~0xFFF00000; 60 sys_freqctrl &= ~0xFFF00000;
61 61
62 sys_clksrc = au_readl(SYS_CLKSRC); 62 sys_clksrc = au_readl(SYS_CLKSRC);
63 sys_clksrc &= ~0x00007FE0; 63 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
64 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
64 65
65 switch (prid & 0x000000FF) 66 switch (prid & 0x000000FF) {
66 {
67 case 0x00: /* DA */ 67 case 0x00: /* DA */
68 case 0x01: /* HA */ 68 case 0x01: /* HA */
69 case 0x02: /* HB */ 69 case 0x02: /* HB */
70 /* CPU core freq to 48MHz to slow it way down... */ 70 /* CPU core freq to 48 MHz to slow it way down... */
71 au_writel(4, SYS_CPUPLL); 71 au_writel(4, SYS_CPUPLL);
72 72
73 /* 73 /*
74 * Setup 48MHz FREQ2 from CPUPLL for USB Host 74 * Setup 48 MHz FREQ2 from CPUPLL for USB Host
75 */ 75 * FRDIV2 = 3 -> div by 8 of 384 MHz -> 48 MHz
76 /* FRDIV2=3 -> div by 8 of 384MHz -> 48MHz */ 76 */
77 sys_freqctrl |= ((3<<22) | (1<<21) | (0<<20)); 77 sys_freqctrl |= (3 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2;
78 au_writel(sys_freqctrl, SYS_FREQCTRL0); 78 au_writel(sys_freqctrl, SYS_FREQCTRL0);
79 79
80 /* CPU core freq to 384MHz */ 80 /* CPU core freq to 384 MHz */
81 au_writel(0x20, SYS_CPUPLL); 81 au_writel(0x20, SYS_CPUPLL);
82 82
83 printk("Au1000: 48MHz OHCI workaround enabled\n"); 83 printk(KERN_INFO "Au1000: 48 MHz OHCI workaround enabled\n");
84 break; 84 break;
85 85
86 default: /* HC and newer */ 86 default: /* HC and newer */
87 // FREQ2 = aux/2 = 48 MHz 87 /* FREQ2 = aux / 2 = 48 MHz */
88 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 88 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) |
89 au_writel(sys_freqctrl, SYS_FREQCTRL0); 89 SYS_FC_FE2 | SYS_FC_FS2;
90 au_writel(sys_freqctrl, SYS_FREQCTRL0);
90 break; 91 break;
91 } 92 }
92 93
93 /* 94 /*
94 * Route 48MHz FREQ2 into USB Host and/or Device 95 * Route 48 MHz FREQ2 into USB Host and/or Device
95 */ 96 */
96#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 97 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT;
97 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
98#endif
99 au_writel(sys_clksrc, SYS_CLKSRC); 98 au_writel(sys_clksrc, SYS_CLKSRC);
100 99
101 // configure pins GPIO[14:9] as GPIO 100 /* Configure pins GPIO[14:9] as GPIO */
102 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080); 101 pin_func = au_readl(SYS_PINFUNC) & ~(SYS_PF_UR3 | SYS_PF_USB);
103 102
104 // 2nd USB port is USB host 103 /* 2nd USB port is USB host */
105 pin_func |= 0x8000; 104 pin_func |= SYS_PF_USB;
106 105
107 au_writel(pin_func, SYS_PINFUNC); 106 au_writel(pin_func, SYS_PINFUNC);
108 au_writel(0x2800, SYS_TRIOUTCLR); 107 au_writel(0x2800, SYS_TRIOUTCLR);
109 au_writel(0x0030, SYS_OUTPUTCLR); 108 au_writel(0x0030, SYS_OUTPUTCLR);
110#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 109#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
111 110
112 // make gpio 15 an input (for interrupt line) 111 /* Make GPIO 15 an input (for interrupt line) */
113 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100); 112 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_IRF;
114 // we don't need I2S, so make it available for GPIO[31:29] 113 /* We don't need I2S, so make it available for GPIO[31:29] */
115 pin_func |= (1<<5); 114 pin_func |= SYS_PF_I2S;
116 au_writel(pin_func, SYS_PINFUNC); 115 au_writel(pin_func, SYS_PINFUNC);
117 116
118 au_writel(0x8000, SYS_TRIOUTCLR); 117 au_writel(0x8000, SYS_TRIOUTCLR);
119 118
120 static_cfg0 = au_readl(MEM_STCFG0) & (u32)(~0xc00); 119 static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00;
121 au_writel(static_cfg0, MEM_STCFG0); 120 au_writel(static_cfg0, MEM_STCFG0);
122 121
123 // configure RCE2* for LCD 122 /* configure RCE2* for LCD */
124 au_writel(0x00000004, MEM_STCFG2); 123 au_writel(0x00000004, MEM_STCFG2);
125 124
126 // MEM_STTIME2 125 /* MEM_STTIME2 */
127 au_writel(0x09000000, MEM_STTIME2); 126 au_writel(0x09000000, MEM_STTIME2);
128 127
129 // Set 32-bit base address decoding for RCE2* 128 /* Set 32-bit base address decoding for RCE2* */
130 au_writel(0x10003ff0, MEM_STADDR2); 129 au_writel(0x10003ff0, MEM_STADDR2);
131 130
132 // PCI CPLD setup 131 /*
133 // expand CE0 to cover PCI 132 * PCI CPLD setup
133 * Expand CE0 to cover PCI
134 */
134 au_writel(0x11803e40, MEM_STADDR1); 135 au_writel(0x11803e40, MEM_STADDR1);
135 136
136 // burst visibility on 137 /* Burst visibility on */
137 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0); 138 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0);
138 139
139 au_writel(0x83, MEM_STCFG1); // ewait enabled, flash timing 140 au_writel(0x83, MEM_STCFG1); /* ewait enabled, flash timing */
140 au_writel(0x33030a10, MEM_STTIME1); // slower timing for FPGA 141 au_writel(0x33030a10, MEM_STTIME1); /* slower timing for FPGA */
141 142
142 /* setup the static bus controller */ 143 /* Setup the static bus controller */
143 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 144 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
144 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 145 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
145 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 146 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
146 147
147#ifdef CONFIG_PCI 148 /*
148 au_writel(0, PCI_BRIDGE_CONFIG); // set extend byte to 0 149 * Enable Au1000 BCLK switching - note: sed1356 must not use
149 au_writel(0, SDRAM_MBAR); // set mbar to 0 150 * its BCLK (Au1000 LCLK) for any timings
150 au_writel(0x2, SDRAM_CMD); // enable memory accesses 151 */
151 au_sync_delay(1); 152 switch (prid & 0x000000FF) {
152#endif
153
154 /* Enable Au1000 BCLK switching - note: sed1356 must not use
155 * its BCLK (Au1000 LCLK) for any timings */
156 switch (prid & 0x000000FF)
157 {
158 case 0x00: /* DA */ 153 case 0x00: /* DA */
159 case 0x01: /* HA */ 154 case 0x01: /* HA */
160 case 0x02: /* HB */ 155 case 0x02: /* HB */
161 break; 156 break;
162 default: /* HC and newer */ 157 default: /* HC and newer */
163 /* Enable sys bus clock divider when IDLE state or no bus 158 /*
164 activity. */ 159 * Enable sys bus clock divider when IDLE state or no bus
160 * activity.
161 */
165 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 162 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
166 break; 163 break;
167 } 164 }
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
index 549447df71d6..3837365d613d 100644
--- a/arch/mips/au1000/pb1000/init.c
+++ b/arch/mips/au1000/pb1000/init.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup 3 * Pb1000 board setup
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -44,16 +43,15 @@ void __init prom_init(void)
44 unsigned char *memsize_str; 43 unsigned char *memsize_str;
45 unsigned long memsize; 44 unsigned long memsize;
46 45
47 prom_argc = (int) fw_arg0; 46 prom_argc = (int)fw_arg0;
48 prom_argv = (char **) fw_arg1; 47 prom_argv = (char **)fw_arg1;
49 prom_envp = (char **) fw_arg2; 48 prom_envp = (char **)fw_arg2;
50 49
51 prom_init_cmdline(); 50 prom_init_cmdline();
52 memsize_str = prom_getenv("memsize"); 51 memsize_str = prom_getenv("memsize");
53 if (!memsize_str) { 52 if (!memsize_str)
54 memsize = 0x04000000; 53 memsize = 0x04000000;
55 } else { 54 else
56 memsize = simple_strtol(memsize_str, NULL, 0); 55 memsize = strict_strtol(memsize_str, 0, NULL);
57 }
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 56 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 57}
diff --git a/arch/mips/au1000/pb1100/Makefile b/arch/mips/au1000/pb1100/Makefile
index 996236df6375..793e97c49e46 100644
--- a/arch/mips/au1000/pb1100/Makefile
+++ b/arch/mips/au1000/pb1100/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000,2001 MontaVista Software Inc. 2# Copyright 2000, 2001, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor Pb1100 board. 5# Makefile for the Alchemy Semiconductor Pb1100 board.
6#
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1100/board_setup.c b/arch/mips/au1000/pb1100/board_setup.c
index 656164c8e9ca..c0bfd59a7a36 100644
--- a/arch/mips/au1000/pb1100/board_setup.c
+++ b/arch/mips/au1000/pb1100/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2002 MontaVista Software Inc. 2 * Copyright 2002, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -32,15 +31,15 @@
32 31
33void board_reset(void) 32void board_reset(void)
34{ 33{
35 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 34 /* Hit BCSR.RST_VDDI[SOFT_RESET] */
36 au_writel(0x00000000, 0xAE00001C); 35 au_writel(0x00000000, PB1100_RST_VDDI);
37} 36}
38 37
39void __init board_setup(void) 38void __init board_setup(void)
40{ 39{
41 volatile void __iomem * base = (volatile void __iomem *) 0xac000000UL; 40 volatile void __iomem *base = (volatile void __iomem *)0xac000000UL;
42 41
43 // set AUX clock to 12MHz * 8 = 96 MHz 42 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
44 au_writel(8, SYS_AUXPLL); 43 au_writel(8, SYS_AUXPLL);
45 au_writel(0, SYS_PININPUTEN); 44 au_writel(0, SYS_PININPUTEN);
46 udelay(100); 45 udelay(100);
@@ -49,44 +48,47 @@ void __init board_setup(void)
49 { 48 {
50 u32 pin_func, sys_freqctrl, sys_clksrc; 49 u32 pin_func, sys_freqctrl, sys_clksrc;
51 50
52 // configure pins GPIO[14:9] as GPIO 51 /* Configure pins GPIO[14:9] as GPIO */
53 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80); 52 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
54 53
55 /* zero and disable FREQ2 */ 54 /* Zero and disable FREQ2 */
56 sys_freqctrl = au_readl(SYS_FREQCTRL0); 55 sys_freqctrl = au_readl(SYS_FREQCTRL0);
57 sys_freqctrl &= ~0xFFF00000; 56 sys_freqctrl &= ~0xFFF00000;
58 au_writel(sys_freqctrl, SYS_FREQCTRL0); 57 au_writel(sys_freqctrl, SYS_FREQCTRL0);
59 58
60 /* zero and disable USBH/USBD/IrDA clock */ 59 /* Zero and disable USBH/USBD/IrDA clock */
61 sys_clksrc = au_readl(SYS_CLKSRC); 60 sys_clksrc = au_readl(SYS_CLKSRC);
62 sys_clksrc &= ~0x0000001F; 61 sys_clksrc &= ~(SYS_CS_CIR | SYS_CS_DIR | SYS_CS_MIR_MASK);
63 au_writel(sys_clksrc, SYS_CLKSRC); 62 au_writel(sys_clksrc, SYS_CLKSRC);
64 63
65 sys_freqctrl = au_readl(SYS_FREQCTRL0); 64 sys_freqctrl = au_readl(SYS_FREQCTRL0);
66 sys_freqctrl &= ~0xFFF00000; 65 sys_freqctrl &= ~0xFFF00000;
67 66
68 sys_clksrc = au_readl(SYS_CLKSRC); 67 sys_clksrc = au_readl(SYS_CLKSRC);
69 sys_clksrc &= ~0x0000001F; 68 sys_clksrc &= ~(SYS_CS_CIR | SYS_CS_DIR | SYS_CS_MIR_MASK);
70 69
71 // FREQ2 = aux/2 = 48 MHz 70 /* FREQ2 = aux / 2 = 48 MHz */
72 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 71 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) |
72 SYS_FC_FE2 | SYS_FC_FS2;
73 au_writel(sys_freqctrl, SYS_FREQCTRL0); 73 au_writel(sys_freqctrl, SYS_FREQCTRL0);
74 74
75 /* 75 /*
76 * Route 48MHz FREQ2 into USBH/USBD/IrDA 76 * Route 48 MHz FREQ2 into USBH/USBD/IrDA
77 */ 77 */
78 sys_clksrc |= ((4<<2) | (0<<1) | 0 ); 78 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MIR_BIT;
79 au_writel(sys_clksrc, SYS_CLKSRC); 79 au_writel(sys_clksrc, SYS_CLKSRC);
80 80
81 /* setup the static bus controller */ 81 /* Setup the static bus controller */
82 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 82 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
83 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 83 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
84 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 84 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
85 85
86 // get USB Functionality pin state (device vs host drive pins) 86 /*
87 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 87 * Get USB Functionality pin state (device vs host drive pins).
88 // 2nd USB port is USB host 88 */
89 pin_func |= 0x8000; 89 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_USB;
90 /* 2nd USB port is USB host. */
91 pin_func |= SYS_PF_USB;
90 au_writel(pin_func, SYS_PINFUNC); 92 au_writel(pin_func, SYS_PINFUNC);
91 } 93 }
92#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 94#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
@@ -94,12 +96,12 @@ void __init board_setup(void)
94 /* Enable sys bus clock divider when IDLE state or no bus activity. */ 96 /* Enable sys bus clock divider when IDLE state or no bus activity. */
95 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 97 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
96 98
97 // Enable the RTC if not already enabled 99 /* Enable the RTC if not already enabled. */
98 if (!(readb(base + 0x28) & 0x20)) { 100 if (!(readb(base + 0x28) & 0x20)) {
99 writeb(readb(base + 0x28) | 0x20, base + 0x28); 101 writeb(readb(base + 0x28) | 0x20, base + 0x28);
100 au_sync(); 102 au_sync();
101 } 103 }
102 // Put the clock in BCD mode 104 /* Put the clock in BCD mode. */
103 if (readb(base + 0x2C) & 0x4) { /* reg B */ 105 if (readb(base + 0x2C) & 0x4) { /* reg B */
104 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c); 106 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c);
105 au_sync(); 107 au_sync();
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
index c91344648ed3..8355483f3de2 100644
--- a/arch/mips/au1000/pb1100/init.c
+++ b/arch/mips/au1000/pb1100/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Pb1100 board setup 4 * Pb1100 board setup
5 * 5 *
6 * Copyright 2002 MontaVista Software Inc. 6 * Copyright 2002, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -46,8 +45,8 @@ void __init prom_init(void)
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = fw_arg0; 47 prom_argc = fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg3; 49 prom_envp = (char **)fw_arg3;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 52
@@ -55,7 +54,7 @@ void __init prom_init(void)
55 if (!memsize_str) 54 if (!memsize_str)
56 memsize = 0x04000000; 55 memsize = 0x04000000;
57 else 56 else
58 memsize = simple_strtol(memsize_str, NULL, 0); 57 memsize = strict_strtol(memsize_str, 0, NULL);
59 58
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 60}
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
index b5021e3d477f..9b7dd8b41283 100644
--- a/arch/mips/au1000/pb1100/irqmap.c
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table 3 * Au1xx0 IRQ map table
4 * 4 *
5 * Copyright 2003 Embedded Edge, LLC 5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com 6 * dan@embeddededge.com
@@ -31,10 +31,10 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
34 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted# 34 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card Fully_Inserted# */
35 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG# 35 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card STSCHG# */
36 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ# 36 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card IRQ# */
37 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, // DC_IRQ# 37 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, /* DC_IRQ# */
38}; 38};
39 39
40int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); 40int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
diff --git a/arch/mips/au1000/pb1200/Makefile b/arch/mips/au1000/pb1200/Makefile
index 4fe02ea65a60..d678adf7ce85 100644
--- a/arch/mips/au1000/pb1200/Makefile
+++ b/arch/mips/au1000/pb1200/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Makefile for the Alchemy Semiconductor PB1200 board. 2# Makefile for the Alchemy Semiconductor Pb1200/DBAu1200 boards.
3# 3#
4 4
5lib-y := init.o board_setup.o irqmap.o 5lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1200/board_setup.c b/arch/mips/au1000/pb1200/board_setup.c
index 4493a792cc4c..6cb2115059ad 100644
--- a/arch/mips/au1000/pb1200/board_setup.c
+++ b/arch/mips/au1000/pb1200/board_setup.c
@@ -27,16 +27,8 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/sched.h> 28#include <linux/sched.h>
29 29
30#include <au1000.h>
31#include <prom.h> 30#include <prom.h>
32 31#include <au1xxx.h>
33#ifdef CONFIG_MIPS_PB1200
34#include <asm/mach-pb1x00/pb1200.h>
35#endif
36
37#ifdef CONFIG_MIPS_DB1200
38#include <asm/mach-db1x00/db1200.h>
39#endif
40 32
41extern void _board_init_irq(void); 33extern void _board_init_irq(void);
42extern void (*board_init_irq)(void); 34extern void (*board_init_irq)(void);
@@ -53,56 +45,57 @@ void __init board_setup(void)
53 45
54#if 0 46#if 0
55 { 47 {
56 u32 pin_func; 48 u32 pin_func;
57 49
58 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 50 /*
59 * but it is board specific code, so put it here. 51 * Enable PSC1 SYNC for AC97. Normaly done in audio driver,
60 */ 52 * but it is board specific code, so put it here.
61 pin_func = au_readl(SYS_PINFUNC); 53 */
62 au_sync(); 54 pin_func = au_readl(SYS_PINFUNC);
63 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; 55 au_sync();
64 au_writel(pin_func, SYS_PINFUNC); 56 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
65 57 au_writel(pin_func, SYS_PINFUNC);
66 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 58
67 au_sync(); 59 au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
60 au_sync();
68 } 61 }
69#endif 62#endif
70 63
71#if defined(CONFIG_I2C_AU1550) 64#if defined(CONFIG_I2C_AU1550)
72 { 65 {
73 u32 freq0, clksrc; 66 u32 freq0, clksrc;
74 u32 pin_func; 67 u32 pin_func;
75 68
76 /* Select SMBUS in CPLD */ 69 /* Select SMBus in CPLD */
77 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX); 70 bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
78 71
79 pin_func = au_readl(SYS_PINFUNC); 72 pin_func = au_readl(SYS_PINFUNC);
80 au_sync(); 73 au_sync();
81 pin_func &= ~(3<<17 | 1<<4); 74 pin_func &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
82 /* Set GPIOs correctly */ 75 /* Set GPIOs correctly */
83 pin_func |= 2<<17; 76 pin_func |= 2 << 17;
84 au_writel(pin_func, SYS_PINFUNC); 77 au_writel(pin_func, SYS_PINFUNC);
85 au_sync(); 78 au_sync();
86 79
87 /* The i2c driver depends on 50Mhz clock */ 80 /* The I2C driver depends on 50 MHz clock */
88 freq0 = au_readl(SYS_FREQCTRL0); 81 freq0 = au_readl(SYS_FREQCTRL0);
89 au_sync(); 82 au_sync();
90 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1); 83 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1);
91 freq0 |= (3<<SYS_FC_FRDIV1_BIT); 84 freq0 |= 3 << SYS_FC_FRDIV1_BIT;
92 /* 396Mhz / (3+1)*2 == 49.5Mhz */ 85 /* 396 MHz / (3 + 1) * 2 == 49.5 MHz */
93 au_writel(freq0, SYS_FREQCTRL0); 86 au_writel(freq0, SYS_FREQCTRL0);
94 au_sync(); 87 au_sync();
95 freq0 |= SYS_FC_FE1; 88 freq0 |= SYS_FC_FE1;
96 au_writel(freq0, SYS_FREQCTRL0); 89 au_writel(freq0, SYS_FREQCTRL0);
97 au_sync(); 90 au_sync();
98 91
99 clksrc = au_readl(SYS_CLKSRC); 92 clksrc = au_readl(SYS_CLKSRC);
100 au_sync(); 93 au_sync();
101 clksrc &= ~0x01f00000; 94 clksrc &= ~(SYS_CS_CE0 | SYS_CS_DE0 | SYS_CS_ME0_MASK);
102 /* bit 22 is EXTCLK0 for PSC0 */ 95 /* Bit 22 is EXTCLK0 for PSC0 */
103 clksrc |= (0x3 << 22); 96 clksrc |= SYS_CS_MUX_FQ1 << SYS_CS_ME0_BIT;
104 au_writel(clksrc, SYS_CLKSRC); 97 au_writel(clksrc, SYS_CLKSRC);
105 au_sync(); 98 au_sync();
106 } 99 }
107#endif 100#endif
108 101
@@ -116,27 +109,27 @@ void __init board_setup(void)
116#endif 109#endif
117#endif 110#endif
118 111
119 /* The Pb1200 development board uses external MUX for PSC0 to 112 /*
120 support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI 113 * The Pb1200 development board uses external MUX for PSC0 to
121 */ 114 * support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
115 */
122#ifdef CONFIG_I2C_AU1550 116#ifdef CONFIG_I2C_AU1550
123 bcsr->resets &= (~BCSR_RESETS_PCS0MUX); 117 bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
124#endif 118#endif
125 au_sync(); 119 au_sync();
126 120
127#ifdef CONFIG_MIPS_PB1200 121#ifdef CONFIG_MIPS_PB1200
128 printk("AMD Alchemy Pb1200 Board\n"); 122 printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
129#endif 123#endif
130#ifdef CONFIG_MIPS_DB1200 124#ifdef CONFIG_MIPS_DB1200
131 printk("AMD Alchemy Db1200 Board\n"); 125 printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
132#endif 126#endif
133 127
134 /* Setup Pb1200 External Interrupt Controller */ 128 /* Setup Pb1200 External Interrupt Controller */
135 board_init_irq = _board_init_irq; 129 board_init_irq = _board_init_irq;
136} 130}
137 131
138int 132int board_au1200fb_panel(void)
139board_au1200fb_panel(void)
140{ 133{
141 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 134 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
142 int p; 135 int p;
@@ -147,23 +140,23 @@ board_au1200fb_panel(void)
147 return p; 140 return p;
148} 141}
149 142
150int 143int board_au1200fb_panel_init(void)
151board_au1200fb_panel_init(void)
152{ 144{
153 /* Apply power */ 145 /* Apply power */
154 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 146 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
155 bcsr->board |= (BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); 147
156 /*printk("board_au1200fb_panel_init()\n"); */ 148 bcsr->board |= BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL;
149 /* printk(KERN_DEBUG "board_au1200fb_panel_init()\n"); */
157 return 0; 150 return 0;
158} 151}
159 152
160int 153int board_au1200fb_panel_shutdown(void)
161board_au1200fb_panel_shutdown(void)
162{ 154{
163 /* Remove power */ 155 /* Remove power */
164 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; 156 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
165 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); 157
166 /*printk("board_au1200fb_panel_shutdown()\n"); */ 158 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
159 BCSR_BOARD_LCDBL);
160 /* printk(KERN_DEBUG "board_au1200fb_panel_shutdown()\n"); */
167 return 0; 161 return 0;
168} 162}
169
diff --git a/arch/mips/au1000/pb1200/init.c b/arch/mips/au1000/pb1200/init.c
index 72af5500660b..09fd63b86062 100644
--- a/arch/mips/au1000/pb1200/init.c
+++ b/arch/mips/au1000/pb1200/init.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1200 board setup 4 * PB1200 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x08000000; 54 memsize = 0x08000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index e61eb8e0b76b..2a505ad8715b 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -39,25 +39,25 @@
39#endif 39#endif
40 40
41struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 41struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
42 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade 42 /* This is external interrupt cascade */
43 { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 },
43}; 44};
44 45
45int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); 46int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map);
46 47
47/* 48/*
48 * Support for External interrupts on the PbAu1200 Development platform. 49 * Support for External interrupts on the Pb1200 Development platform.
49 */ 50 */
50static volatile int pb1200_cascade_en=0; 51static volatile int pb1200_cascade_en;
51 52
52irqreturn_t pb1200_cascade_handler( int irq, void *dev_id) 53irqreturn_t pb1200_cascade_handler(int irq, void *dev_id)
53{ 54{
54 unsigned short bisr = bcsr->int_status; 55 unsigned short bisr = bcsr->int_status;
55 int extirq_nr = 0; 56 int extirq_nr = 0;
56 57
57 /* Clear all the edge interrupts. This has no effect on level */ 58 /* Clear all the edge interrupts. This has no effect on level. */
58 bcsr->int_status = bisr; 59 bcsr->int_status = bisr;
59 for( ; bisr; bisr &= (bisr-1) ) 60 for ( ; bisr; bisr &= bisr - 1) {
60 {
61 extirq_nr = PB1200_INT_BEGIN + __ffs(bisr); 61 extirq_nr = PB1200_INT_BEGIN + __ffs(bisr);
62 /* Ack and dispatch IRQ */ 62 /* Ack and dispatch IRQ */
63 do_IRQ(extirq_nr); 63 do_IRQ(extirq_nr);
@@ -68,26 +68,20 @@ irqreturn_t pb1200_cascade_handler( int irq, void *dev_id)
68 68
69inline void pb1200_enable_irq(unsigned int irq_nr) 69inline void pb1200_enable_irq(unsigned int irq_nr)
70{ 70{
71 bcsr->intset_mask = 1<<(irq_nr - PB1200_INT_BEGIN); 71 bcsr->intset_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
72 bcsr->intset = 1<<(irq_nr - PB1200_INT_BEGIN); 72 bcsr->intset = 1 << (irq_nr - PB1200_INT_BEGIN);
73} 73}
74 74
75inline void pb1200_disable_irq(unsigned int irq_nr) 75inline void pb1200_disable_irq(unsigned int irq_nr)
76{ 76{
77 bcsr->intclr_mask = 1<<(irq_nr - PB1200_INT_BEGIN); 77 bcsr->intclr_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
78 bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); 78 bcsr->intclr = 1 << (irq_nr - PB1200_INT_BEGIN);
79} 79}
80 80
81static unsigned int pb1200_setup_cascade(void) 81static unsigned int pb1200_setup_cascade(void)
82{ 82{
83 int err; 83 return request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
84 84 0, "Pb1200 Cascade", &pb1200_cascade_handler);
85 err = request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
86 0, "Pb1200 Cascade", &pb1200_cascade_handler);
87 if (err)
88 return err;
89
90 return 0;
91} 85}
92 86
93static unsigned int pb1200_startup_irq(unsigned int irq) 87static unsigned int pb1200_startup_irq(unsigned int irq)
@@ -132,23 +126,23 @@ void _board_init_irq(void)
132 unsigned int irq; 126 unsigned int irq;
133 127
134#ifdef CONFIG_MIPS_PB1200 128#ifdef CONFIG_MIPS_PB1200
135 /* We have a problem with CPLD rev3. Enable a workaround */ 129 /* We have a problem with CPLD rev 3. */
136 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) { 130 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) {
137 printk("\nWARNING!!!\n"); 131 printk(KERN_ERR "WARNING!!!\n");
138 printk("\nWARNING!!!\n"); 132 printk(KERN_ERR "WARNING!!!\n");
139 printk("\nWARNING!!!\n"); 133 printk(KERN_ERR "WARNING!!!\n");
140 printk("\nWARNING!!!\n"); 134 printk(KERN_ERR "WARNING!!!\n");
141 printk("\nWARNING!!!\n"); 135 printk(KERN_ERR "WARNING!!!\n");
142 printk("\nWARNING!!!\n"); 136 printk(KERN_ERR "WARNING!!!\n");
143 printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n"); 137 printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n");
144 printk("updated to latest revision. This software will not\n"); 138 printk(KERN_ERR "updated to latest revision. This software will\n");
145 printk("work on anything less than CPLD rev4\n"); 139 printk(KERN_ERR "not work on anything less than CPLD rev 4.\n");
146 printk("\nWARNING!!!\n"); 140 printk(KERN_ERR "WARNING!!!\n");
147 printk("\nWARNING!!!\n"); 141 printk(KERN_ERR "WARNING!!!\n");
148 printk("\nWARNING!!!\n"); 142 printk(KERN_ERR "WARNING!!!\n");
149 printk("\nWARNING!!!\n"); 143 printk(KERN_ERR "WARNING!!!\n");
150 printk("\nWARNING!!!\n"); 144 printk(KERN_ERR "WARNING!!!\n");
151 printk("\nWARNING!!!\n"); 145 printk(KERN_ERR "WARNING!!!\n");
152 panic("Game over. Your score is 0."); 146 panic("Game over. Your score is 0.");
153 } 147 }
154#endif 148#endif
@@ -161,6 +155,6 @@ void _board_init_irq(void)
161 155
162 /* 156 /*
163 * GPIO_7 can not be hooked here, so it is hooked upon first 157 * GPIO_7 can not be hooked here, so it is hooked upon first
164 * request of any source attached to the cascade 158 * request of any source attached to the cascade.
165 */ 159 */
166} 160}
diff --git a/arch/mips/au1000/pb1500/Makefile b/arch/mips/au1000/pb1500/Makefile
index 97a730813cd3..602f38df20bb 100644
--- a/arch/mips/au1000/pb1500/Makefile
+++ b/arch/mips/au1000/pb1500/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# Copyright 2000,2001 MontaVista Software Inc. 2# Copyright 2000, 2001, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor Pb1500 board. 5# Makefile for the Alchemy Semiconductor Pb1500 board.
6#
7 7
8lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1500/board_setup.c b/arch/mips/au1000/pb1500/board_setup.c
index 24c652e8ec4b..035771c6e5b8 100644
--- a/arch/mips/au1000/pb1500/board_setup.c
+++ b/arch/mips/au1000/pb1500/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000 MontaVista Software Inc. 2 * Copyright 2000, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -32,8 +31,8 @@
32 31
33void board_reset(void) 32void board_reset(void)
34{ 33{
35 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 34 /* Hit BCSR.RST_VDDI[SOFT_RESET] */
36 au_writel(0x00000000, 0xAE00001C); 35 au_writel(0x00000000, PB1500_RST_VDDI);
37} 36}
38 37
39void __init board_setup(void) 38void __init board_setup(void)
@@ -42,7 +41,7 @@ void __init board_setup(void)
42 u32 sys_freqctrl, sys_clksrc; 41 u32 sys_freqctrl, sys_clksrc;
43 42
44 sys_clksrc = sys_freqctrl = pin_func = 0; 43 sys_clksrc = sys_freqctrl = pin_func = 0;
45 // set AUX clock to 12MHz * 8 = 96 MHz 44 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
46 au_writel(8, SYS_AUXPLL); 45 au_writel(8, SYS_AUXPLL);
47 au_writel(0, SYS_PINSTATERD); 46 au_writel(0, SYS_PINSTATERD);
48 udelay(100); 47 udelay(100);
@@ -51,51 +50,48 @@ void __init board_setup(void)
51 50
52 /* GPIO201 is input for PCMCIA card detect */ 51 /* GPIO201 is input for PCMCIA card detect */
53 /* GPIO203 is input for PCMCIA interrupt request */ 52 /* GPIO203 is input for PCMCIA interrupt request */
54 au_writel(au_readl(GPIO2_DIR) & (u32)(~((1<<1)|(1<<3))), GPIO2_DIR); 53 au_writel(au_readl(GPIO2_DIR) & ~((1 << 1) | (1 << 3)), GPIO2_DIR);
55 54
56 /* zero and disable FREQ2 */ 55 /* Zero and disable FREQ2 */
57 sys_freqctrl = au_readl(SYS_FREQCTRL0); 56 sys_freqctrl = au_readl(SYS_FREQCTRL0);
58 sys_freqctrl &= ~0xFFF00000; 57 sys_freqctrl &= ~0xFFF00000;
59 au_writel(sys_freqctrl, SYS_FREQCTRL0); 58 au_writel(sys_freqctrl, SYS_FREQCTRL0);
60 59
61 /* zero and disable USBH/USBD clocks */ 60 /* zero and disable USBH/USBD clocks */
62 sys_clksrc = au_readl(SYS_CLKSRC); 61 sys_clksrc = au_readl(SYS_CLKSRC);
63 sys_clksrc &= ~0x00007FE0; 62 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
63 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
64 au_writel(sys_clksrc, SYS_CLKSRC); 64 au_writel(sys_clksrc, SYS_CLKSRC);
65 65
66 sys_freqctrl = au_readl(SYS_FREQCTRL0); 66 sys_freqctrl = au_readl(SYS_FREQCTRL0);
67 sys_freqctrl &= ~0xFFF00000; 67 sys_freqctrl &= ~0xFFF00000;
68 68
69 sys_clksrc = au_readl(SYS_CLKSRC); 69 sys_clksrc = au_readl(SYS_CLKSRC);
70 sys_clksrc &= ~0x00007FE0; 70 sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK |
71 SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK);
71 72
72 // FREQ2 = aux/2 = 48 MHz 73 /* FREQ2 = aux/2 = 48 MHz */
73 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 74 sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2 | SYS_FC_FS2;
74 au_writel(sys_freqctrl, SYS_FREQCTRL0); 75 au_writel(sys_freqctrl, SYS_FREQCTRL0);
75 76
76 /* 77 /*
77 * Route 48MHz FREQ2 into USB Host and/or Device 78 * Route 48MHz FREQ2 into USB Host and/or Device
78 */ 79 */
79#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 80 sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT;
80 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
81#endif
82 au_writel(sys_clksrc, SYS_CLKSRC); 81 au_writel(sys_clksrc, SYS_CLKSRC);
83 82
84 83 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_USB;
85 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 84 /* 2nd USB port is USB host */
86 // 2nd USB port is USB host 85 pin_func |= SYS_PF_USB;
87 pin_func |= 0x8000;
88 au_writel(pin_func, SYS_PINFUNC); 86 au_writel(pin_func, SYS_PINFUNC);
89#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 87#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
90 88
91
92
93#ifdef CONFIG_PCI 89#ifdef CONFIG_PCI
94 // Setup PCI bus controller 90 /* Setup PCI bus controller */
95 au_writel(0, Au1500_PCI_CMEM); 91 au_writel(0, Au1500_PCI_CMEM);
96 au_writel(0x00003fff, Au1500_CFG_BASE); 92 au_writel(0x00003fff, Au1500_CFG_BASE);
97#if defined(__MIPSEB__) 93#if defined(__MIPSEB__)
98 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 94 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
99#else 95#else
100 au_writel(0xf, Au1500_PCI_CFG); 96 au_writel(0xf, Au1500_PCI_CFG);
101#endif 97#endif
@@ -112,11 +108,11 @@ void __init board_setup(void)
112 108
113 /* Enable the RTC if not already enabled */ 109 /* Enable the RTC if not already enabled */
114 if (!(au_readl(0xac000028) & 0x20)) { 110 if (!(au_readl(0xac000028) & 0x20)) {
115 printk("enabling clock ...\n"); 111 printk(KERN_INFO "enabling clock ...\n");
116 au_writel((au_readl(0xac000028) | 0x20), 0xac000028); 112 au_writel((au_readl(0xac000028) | 0x20), 0xac000028);
117 } 113 }
118 /* Put the clock in BCD mode */ 114 /* Put the clock in BCD mode */
119 if (au_readl(0xac00002C) & 0x4) { /* reg B */ 115 if (au_readl(0xac00002c) & 0x4) { /* reg B */
120 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c); 116 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c);
121 au_sync(); 117 au_sync();
122 } 118 }
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
index 488507c07db9..49f51e165863 100644
--- a/arch/mips/au1000/pb1500/init.c
+++ b/arch/mips/au1000/pb1500/init.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1500 board setup 4 * Pb1500 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x04000000; 54 memsize = 0x04000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
index 4817ab44d07f..39c4682766a8 100644
--- a/arch/mips/au1000/pb1500/irqmap.c
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -31,12 +31,12 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT370 */ 34 [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT370 */
35 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */ 35 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
36}; 36};
37 37
38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
39 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 39 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
40 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 40 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
41 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 41 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
42 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 42 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/au1000/pb1550/Makefile b/arch/mips/au1000/pb1550/Makefile
index aa35bc6cb8cf..7d8beca87fa5 100644
--- a/arch/mips/au1000/pb1550/Makefile
+++ b/arch/mips/au1000/pb1550/Makefile
@@ -1,9 +1,8 @@
1# 1#
2# Copyright 2000 MontaVista Software Inc. 2# Copyright 2000, 2008 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for the Alchemy Semiconductor PB1000 board. 5# Makefile for the Alchemy Semiconductor Pb1550 board.
7# 6#
8 7
9lib-y := init.o board_setup.o irqmap.o 8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1550/board_setup.c b/arch/mips/au1000/pb1550/board_setup.c
index 45d60872b565..0ed76b64b6ab 100644
--- a/arch/mips/au1000/pb1550/board_setup.c
+++ b/arch/mips/au1000/pb1550/board_setup.c
@@ -3,9 +3,8 @@
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Pb1550 board setup. 4 * Alchemy Pb1550 board setup.
5 * 5 *
6 * Copyright 2000 MontaVista Software Inc. 6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -35,15 +34,16 @@
35 34
36void board_reset(void) 35void board_reset(void)
37{ 36{
38 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 37 /* Hit BCSR.SYSTEM[RESET] */
39 au_writew(au_readw(0xAF00001C) & ~(1<<15), 0xAF00001C); 38 au_writew(au_readw(0xAF00001C) & ~BCSR_SYSTEM_RESET, 0xAF00001C);
40} 39}
41 40
42void __init board_setup(void) 41void __init board_setup(void)
43{ 42{
44 u32 pin_func; 43 u32 pin_func;
45 44
46 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 45 /*
46 * Enable PSC1 SYNC for AC'97. Normaly done in audio driver,
47 * but it is board specific code, so put it here. 47 * but it is board specific code, so put it here.
48 */ 48 */
49 pin_func = au_readl(SYS_PINFUNC); 49 pin_func = au_readl(SYS_PINFUNC);
@@ -51,8 +51,8 @@ void __init board_setup(void)
51 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; 51 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
52 au_writel(pin_func, SYS_PINFUNC); 52 au_writel(pin_func, SYS_PINFUNC);
53 53
54 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 54 au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
55 au_sync(); 55 au_sync();
56 56
57 printk("AMD Alchemy Pb1550 Board\n"); 57 printk(KERN_INFO "AMD Alchemy Pb1550 Board\n");
58} 58}
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
index f6b2fc587980..1b5f58434bb7 100644
--- a/arch/mips/au1000/pb1550/init.c
+++ b/arch/mips/au1000/pb1550/init.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * 2 *
3 * BRIEF MODULE DESCRIPTION 3 * BRIEF MODULE DESCRIPTION
4 * PB1550 board setup 4 * Pb1550 board setup
5 * 5 *
6 * Copyright 2001 MontaVista Software Inc. 6 * Copyright 2001, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. 7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * ppopov@mvista.com or source@mvista.com
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -45,16 +44,15 @@ void __init prom_init(void)
45 unsigned char *memsize_str; 44 unsigned char *memsize_str;
46 unsigned long memsize; 45 unsigned long memsize;
47 46
48 prom_argc = (int) fw_arg0; 47 prom_argc = (int)fw_arg0;
49 prom_argv = (char **) fw_arg1; 48 prom_argv = (char **)fw_arg1;
50 prom_envp = (char **) fw_arg2; 49 prom_envp = (char **)fw_arg2;
51 50
52 prom_init_cmdline(); 51 prom_init_cmdline();
53 memsize_str = prom_getenv("memsize"); 52 memsize_str = prom_getenv("memsize");
54 if (!memsize_str) { 53 if (!memsize_str)
55 memsize = 0x08000000; 54 memsize = 0x08000000;
56 } else { 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 }
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
index e1dac37af08a..a02a4d1fa899 100644
--- a/arch/mips/au1000/pb1550/irqmap.c
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table 3 * Au1xx0 IRQ map table
4 * 4 *
5 * Copyright 2003 Embedded Edge, LLC 5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com 6 * dan@embeddededge.com
@@ -31,8 +31,8 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33char irq_tab_alchemy[][5] __initdata = { 33char irq_tab_alchemy[][5] __initdata = {
34 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */ 34 [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
35 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */ 35 [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
36}; 36};
37 37
38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 38struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
diff --git a/arch/mips/au1000/xxs1500/Makefile b/arch/mips/au1000/xxs1500/Makefile
index 44d7f7056ae7..db3c526f64d8 100644
--- a/arch/mips/au1000/xxs1500/Makefile
+++ b/arch/mips/au1000/xxs1500/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Copyright 2003 MontaVista Software Inc. 2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. 3# Author: MontaVista Software, Inc. <source@mvista.com>
4# ppopov@mvista.com or source@mvista.com
5# 4#
6# Makefile for MyCable XXS1500 board. 5# Makefile for MyCable XXS1500 board.
7# 6#
diff --git a/arch/mips/au1000/xxs1500/board_setup.c b/arch/mips/au1000/xxs1500/board_setup.c
index 79d1798621bf..4c587acac5c3 100644
--- a/arch/mips/au1000/xxs1500/board_setup.c
+++ b/arch/mips/au1000/xxs1500/board_setup.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright 2000-2003 MontaVista Software Inc. 2 * Copyright 2000-2003, 2008 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc. 3 * Author: MontaVista Software, Inc. <source@mvista.com>
4 * ppopov@mvista.com or source@mvista.com
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -39,40 +38,40 @@ void __init board_setup(void)
39{ 38{
40 u32 pin_func; 39 u32 pin_func;
41 40
42 // set multiple use pins (UART3/GPIO) to UART (it's used as UART too) 41 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
43 pin_func = au_readl(SYS_PINFUNC) & (u32)(~SYS_PF_UR3); 42 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
44 pin_func |= SYS_PF_UR3; 43 pin_func |= SYS_PF_UR3;
45 au_writel(pin_func, SYS_PINFUNC); 44 au_writel(pin_func, SYS_PINFUNC);
46 45
47 // enable UART 46 /* Enable UART */
48 au_writel(0x01, UART3_ADDR+UART_MOD_CNTRL); // clock enable (CE) 47 au_writel(0x01, UART3_ADDR + UART_MOD_CNTRL); /* clock enable (CE) */
49 mdelay(10); 48 mdelay(10);
50 au_writel(0x03, UART3_ADDR+UART_MOD_CNTRL); // CE and "enable" 49 au_writel(0x03, UART3_ADDR + UART_MOD_CNTRL); /* CE and "enable" */
51 mdelay(10); 50 mdelay(10);
52 51
53 // enable DTR = USB power up 52 /* Enable DTR = USB power up */
54 au_writel(0x01, UART3_ADDR+UART_MCR); //? UART_MCR_DTR is 0x01??? 53 au_writel(0x01, UART3_ADDR + UART_MCR); /* UART_MCR_DTR is 0x01??? */
55 54
56#ifdef CONFIG_PCMCIA_XXS1500 55#ifdef CONFIG_PCMCIA_XXS1500
57 /* setup pcmcia signals */ 56 /* Setup PCMCIA signals */
58 au_writel(0, SYS_PININPUTEN); 57 au_writel(0, SYS_PININPUTEN);
59 58
60 /* gpio 0, 1, and 4 are inputs */ 59 /* GPIO 0, 1, and 4 are inputs */
61 au_writel(1 | (1<<1) | (1<<4), SYS_TRIOUTCLR); 60 au_writel(1 | (1 << 1) | (1 << 4), SYS_TRIOUTCLR);
62 61
63 /* enable GPIO2 if not already enabled */ 62 /* Enable GPIO2 if not already enabled */
64 au_writel(1, GPIO2_ENABLE); 63 au_writel(1, GPIO2_ENABLE);
65 /* gpio2 208/9/10/11 are inputs */ 64 /* GPIO2 208/9/10/11 are inputs */
66 au_writel((1<<8) | (1<<9) | (1<<10) | (1<<11), GPIO2_DIR); 65 au_writel((1 << 8) | (1 << 9) | (1 << 10) | (1 << 11), GPIO2_DIR);
67 66
68 /* turn off power */ 67 /* Turn off power */
69 au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<14))|(1<<30), GPIO2_OUTPUT); 68 au_writel((au_readl(GPIO2_PINSTATE) & ~(1 << 14)) | (1 << 30),
69 GPIO2_OUTPUT);
70#endif 70#endif
71 71
72
73#ifdef CONFIG_PCI 72#ifdef CONFIG_PCI
74#if defined(__MIPSEB__) 73#if defined(__MIPSEB__)
75 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); 74 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
76#else 75#else
77 au_writel(0xf, Au1500_PCI_CFG); 76 au_writel(0xf, Au1500_PCI_CFG);
78#endif 77#endif
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
index 24fc6e132dc0..b849bf501c04 100644
--- a/arch/mips/au1000/xxs1500/init.c
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -2,9 +2,8 @@
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * XXS1500 board setup 3 * XXS1500 board setup
4 * 4 *
5 * Copyright 2003 MontaVista Software Inc. 5 * Copyright 2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -45,8 +44,8 @@ void __init prom_init(void)
45 unsigned long memsize; 44 unsigned long memsize;
46 45
47 prom_argc = fw_arg0; 46 prom_argc = fw_arg0;
48 prom_argv = (char **) fw_arg1; 47 prom_argv = (char **)fw_arg1;
49 prom_envp = (char **) fw_arg2; 48 prom_envp = (char **)fw_arg2;
50 49
51 prom_init_cmdline(); 50 prom_init_cmdline();
52 51
@@ -54,6 +53,6 @@ void __init prom_init(void)
54 if (!memsize_str) 53 if (!memsize_str)
55 memsize = 0x04000000; 54 memsize = 0x04000000;
56 else 55 else
57 memsize = simple_strtol(memsize_str, NULL, 0); 56 memsize = strict_strtol(memsize_str, 0, NULL);
58 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
59} 58}
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
index dd6e3d1eb4d4..edf06ed11870 100644
--- a/arch/mips/au1000/xxs1500/irqmap.c
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -31,7 +31,7 @@
31#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
32 32
33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { 33struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
34 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0}, 34 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 },
35 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, 35 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
36 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, 36 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
37 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, 37 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index 82f9e9013e70..62bfb455d1b1 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -76,7 +76,9 @@ static void markeins_machine_power_off(void)
76 while (1) ; 76 while (1) ;
77} 77}
78 78
79static unsigned long clock[4] = { 166500000, 187312500, 199800000, 210600000 }; 79static unsigned long __initdata emma2rh_clock[4] = {
80 166500000, 187312500, 199800000, 210600000
81};
80 82
81static unsigned int __init detect_bus_frequency(unsigned long rtc_base) 83static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
82{ 84{
@@ -85,7 +87,8 @@ static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
85 /* detect from boot strap */ 87 /* detect from boot strap */
86 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); 88 reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
87 reg = (reg >> 4) & 0x3; 89 reg = (reg >> 4) & 0x3;
88 return clock[reg]; 90
91 return emma2rh_clock[reg];
89} 92}
90 93
91void __init plat_time_init(void) 94void __init plat_time_init(void)
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 45545be3eb86..cc0244036aec 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -56,9 +56,9 @@ obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o
56obj-$(CONFIG_MIPS_CMP) += smp-cmp.o 56obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
57obj-$(CONFIG_CPU_MIPSR2) += spram.o 57obj-$(CONFIG_CPU_MIPSR2) += spram.o
58 58
59obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
60obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o 59obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
61obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o 60obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
61obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
62 62
63obj-$(CONFIG_I8259) += i8259.o 63obj-$(CONFIG_I8259) += i8259.o
64obj-$(CONFIG_IRQ_CPU) += irq_cpu.o 64obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
index a1b48af0992f..02b7713cf71c 100644
--- a/arch/mips/kernel/cpu-bugs64.c
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -38,7 +38,7 @@ static inline void align_mod(const int align, const int mod)
38 ".endr\n\t" 38 ".endr\n\t"
39 ".set pop" 39 ".set pop"
40 : 40 :
41 : GCC_IMM_ASM(align), GCC_IMM_ASM(mod)); 41 : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
42} 42}
43 43
44static inline void mult_sh_align_mod(long *v1, long *v2, long *w, 44static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 290d8e3a664d..469c7237e5ba 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -578,7 +578,7 @@ static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp,
578 * process and the system, here we map the page and fill the 578 * process and the system, here we map the page and fill the
579 * structure 579 * structure
580 */ 580 */
581static void irix_map_prda_page(void) 581static int irix_map_prda_page(void)
582{ 582{
583 unsigned long v; 583 unsigned long v;
584 struct prda *pp; 584 struct prda *pp;
@@ -587,8 +587,8 @@ static void irix_map_prda_page(void)
587 v = do_brk(PRDA_ADDRESS, PAGE_SIZE); 587 v = do_brk(PRDA_ADDRESS, PAGE_SIZE);
588 up_write(&current->mm->mmap_sem); 588 up_write(&current->mm->mmap_sem);
589 589
590 if (v < 0) 590 if (v != PRDA_ADDRESS)
591 return; 591 return v; /* v must be an error code */
592 592
593 pp = (struct prda *) v; 593 pp = (struct prda *) v;
594 pp->prda_sys.t_pid = task_pid_vnr(current); 594 pp->prda_sys.t_pid = task_pid_vnr(current);
@@ -596,6 +596,8 @@ static void irix_map_prda_page(void)
596 pp->prda_sys.t_rpid = task_pid_vnr(current); 596 pp->prda_sys.t_rpid = task_pid_vnr(current);
597 597
598 /* We leave the rest set to zero */ 598 /* We leave the rest set to zero */
599
600 return 0;
599} 601}
600 602
601 603
@@ -781,7 +783,8 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
781 * IRIX maps a page at 0x200000 which holds some system 783 * IRIX maps a page at 0x200000 which holds some system
782 * information. Programs depend on this. 784 * information. Programs depend on this.
783 */ 785 */
784 irix_map_prda_page(); 786 if (irix_map_prda_page())
787 goto out_free_dentry;
785 788
786 padzero(elf_bss); 789 padzero(elf_bss);
787 790
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index ceb62dce1c9c..b0591ae0ce56 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -257,7 +257,7 @@ void sp_work_handle_request(void)
257 257
258 vcwd = vpe_getcwd(tclimit); 258 vcwd = vpe_getcwd(tclimit);
259 259
260 /* change to the cwd of the process that loaded the SP program */ 260 /* change to cwd of the process that loaded the SP program */
261 old_fs = get_fs(); 261 old_fs = get_fs();
262 set_fs(KERNEL_DS); 262 set_fs(KERNEL_DS);
263 sys_chdir(vcwd); 263 sys_chdir(vcwd);
@@ -323,6 +323,9 @@ static void sp_cleanup(void)
323 set >>= 1; 323 set >>= 1;
324 } 324 }
325 } 325 }
326
327 /* Put daemon cwd back to root to avoid umount problems */
328 sys_chdir("/");
326} 329}
327 330
328static int channel_open = 0; 331static int channel_open = 0;
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 0233798f7155..b88f1c18ff4d 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -72,6 +72,15 @@ static void rtlx_dispatch(void)
72static irqreturn_t rtlx_interrupt(int irq, void *dev_id) 72static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
73{ 73{
74 int i; 74 int i;
75 unsigned int flags, vpeflags;
76
77 /* Ought not to be strictly necessary for SMTC builds */
78 local_irq_save(flags);
79 vpeflags = dvpe();
80 set_c0_status(0x100 << MIPS_CPU_RTLX_IRQ);
81 irq_enable_hazard();
82 evpe(vpeflags);
83 local_irq_restore(flags);
75 84
76 for (i = 0; i < RTLX_CHANNELS; i++) { 85 for (i = 0; i < RTLX_CHANNELS; i++) {
77 wake_up(&channel_wqs[i].lx_queue); 86 wake_up(&channel_wqs[i].lx_queue);
@@ -108,7 +117,8 @@ static void __used dump_rtlx(void)
108static int rtlx_init(struct rtlx_info *rtlxi) 117static int rtlx_init(struct rtlx_info *rtlxi)
109{ 118{
110 if (rtlxi->id != RTLX_ID) { 119 if (rtlxi->id != RTLX_ID) {
111 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n", rtlxi, rtlxi->id); 120 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n",
121 rtlxi, rtlxi->id);
112 return -ENOEXEC; 122 return -ENOEXEC;
113 } 123 }
114 124
@@ -162,18 +172,17 @@ int rtlx_open(int index, int can_sleep)
162 172
163 if (rtlx == NULL) { 173 if (rtlx == NULL) {
164 if( (p = vpe_get_shared(tclimit)) == NULL) { 174 if( (p = vpe_get_shared(tclimit)) == NULL) {
165 if (can_sleep) { 175 if (can_sleep) {
166 __wait_event_interruptible(channel_wqs[index].lx_queue, 176 __wait_event_interruptible(channel_wqs[index].lx_queue,
167 (p = vpe_get_shared(tclimit)), 177 (p = vpe_get_shared(tclimit)), ret);
168 ret); 178 if (ret)
169 if (ret)
170 goto out_fail;
171 } else {
172 printk(KERN_DEBUG "No SP program loaded, and device "
173 "opened with O_NONBLOCK\n");
174 ret = -ENOSYS;
175 goto out_fail; 179 goto out_fail;
176 } 180 } else {
181 printk(KERN_DEBUG "No SP program loaded, and device "
182 "opened with O_NONBLOCK\n");
183 ret = -ENOSYS;
184 goto out_fail;
185 }
177 } 186 }
178 187
179 smp_rmb(); 188 smp_rmb();
@@ -182,7 +191,9 @@ int rtlx_open(int index, int can_sleep)
182 DEFINE_WAIT(wait); 191 DEFINE_WAIT(wait);
183 192
184 for (;;) { 193 for (;;) {
185 prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE); 194 prepare_to_wait(
195 &channel_wqs[index].lx_queue,
196 &wait, TASK_INTERRUPTIBLE);
186 smp_rmb(); 197 smp_rmb();
187 if (*p != NULL) 198 if (*p != NULL)
188 break; 199 break;
@@ -195,7 +206,7 @@ int rtlx_open(int index, int can_sleep)
195 } 206 }
196 finish_wait(&channel_wqs[index].lx_queue, &wait); 207 finish_wait(&channel_wqs[index].lx_queue, &wait);
197 } else { 208 } else {
198 printk(" *vpe_get_shared is NULL. " 209 pr_err(" *vpe_get_shared is NULL. "
199 "Has an SP program been loaded?\n"); 210 "Has an SP program been loaded?\n");
200 ret = -ENOSYS; 211 ret = -ENOSYS;
201 goto out_fail; 212 goto out_fail;
@@ -203,8 +214,9 @@ int rtlx_open(int index, int can_sleep)
203 } 214 }
204 215
205 if ((unsigned int)*p < KSEG0) { 216 if ((unsigned int)*p < KSEG0) {
206 printk(KERN_WARNING "vpe_get_shared returned an invalid pointer " 217 printk(KERN_WARNING "vpe_get_shared returned an "
207 "maybe an error code %d\n", (int)*p); 218 "invalid pointer maybe an error code %d\n",
219 (int)*p);
208 ret = -ENOSYS; 220 ret = -ENOSYS;
209 goto out_fail; 221 goto out_fail;
210 } 222 }
@@ -232,6 +244,10 @@ out_ret:
232 244
233int rtlx_release(int index) 245int rtlx_release(int index)
234{ 246{
247 if (rtlx == NULL) {
248 pr_err("rtlx_release() with null rtlx\n");
249 return 0;
250 }
235 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED; 251 rtlx->channel[index].lx_state = RTLX_STATE_UNUSED;
236 return 0; 252 return 0;
237} 253}
@@ -251,8 +267,8 @@ unsigned int rtlx_read_poll(int index, int can_sleep)
251 int ret = 0; 267 int ret = 0;
252 268
253 __wait_event_interruptible(channel_wqs[index].lx_queue, 269 __wait_event_interruptible(channel_wqs[index].lx_queue,
254 chan->lx_read != chan->lx_write || sp_stopping, 270 (chan->lx_read != chan->lx_write) ||
255 ret); 271 sp_stopping, ret);
256 if (ret) 272 if (ret)
257 return ret; 273 return ret;
258 274
@@ -282,7 +298,9 @@ static inline int write_spacefree(int read, int write, int size)
282unsigned int rtlx_write_poll(int index) 298unsigned int rtlx_write_poll(int index)
283{ 299{
284 struct rtlx_channel *chan = &rtlx->channel[index]; 300 struct rtlx_channel *chan = &rtlx->channel[index];
285 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); 301
302 return write_spacefree(chan->rt_read, chan->rt_write,
303 chan->buffer_size);
286} 304}
287 305
288ssize_t rtlx_read(int index, void __user *buff, size_t count) 306ssize_t rtlx_read(int index, void __user *buff, size_t count)
@@ -344,8 +362,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
344 rt_read = rt->rt_read; 362 rt_read = rt->rt_read;
345 363
346 /* total number of bytes to copy */ 364 /* total number of bytes to copy */
347 count = min(count, 365 count = min(count, (size_t)write_spacefree(rt_read, rt->rt_write,
348 (size_t)write_spacefree(rt_read, rt->rt_write, rt->buffer_size)); 366 rt->buffer_size));
349 367
350 /* first bit from write pointer to the end of the buffer, or count */ 368 /* first bit from write pointer to the end of the buffer, or count */
351 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 369 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
@@ -514,6 +532,11 @@ static int __init rtlx_module_init(void)
514 532
515 if (cpu_has_vint) 533 if (cpu_has_vint)
516 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); 534 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
535 else {
536 pr_err("APRP RTLX init on non-vectored-interrupt processor\n");
537 err = -ENODEV;
538 goto out_chrdev;
539 }
517 540
518 rtlx_irq.dev_id = rtlx; 541 rtlx_irq.dev_id = rtlx;
519 setup_irq(rtlx_irq_num, &rtlx_irq); 542 setup_irq(rtlx_irq_num, &rtlx_irq);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 39f3dfe134fb..c6a063b2a0d9 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -331,6 +331,7 @@ static void __init bootmem_init(void)
331 /* 331 /*
332 * Determine low and high memory ranges 332 * Determine low and high memory ranges
333 */ 333 */
334 max_pfn = max_low_pfn;
334 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) { 335 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) {
335#ifdef CONFIG_HIGHMEM 336#ifdef CONFIG_HIGHMEM
336 highstart_pfn = PFN_DOWN(HIGHMEM_START); 337 highstart_pfn = PFN_DOWN(HIGHMEM_START);
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 33780cc61ce9..63370cdd3c90 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -87,8 +87,8 @@ struct plat_smp_ops *mp_ops;
87 87
88__cpuinit void register_smp_ops(struct plat_smp_ops *ops) 88__cpuinit void register_smp_ops(struct plat_smp_ops *ops)
89{ 89{
90 if (ops) 90 if (mp_ops)
91 printk(KERN_WARNING "Overriding previous set SMP ops\n"); 91 printk(KERN_WARNING "Overriding previously set SMP ops\n");
92 92
93 mp_ops = ops; 93 mp_ops = ops;
94} 94}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 39804c584edd..2794501ff302 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -269,7 +269,7 @@ static void *alloc_progmem(unsigned long len)
269 * This means you must tell Linux to use less memory than you 269 * This means you must tell Linux to use less memory than you
270 * physically have, for example by passing a mem= boot argument. 270 * physically have, for example by passing a mem= boot argument.
271 */ 271 */
272 addr = pfn_to_kaddr(max_pfn); 272 addr = pfn_to_kaddr(max_low_pfn);
273 memset(addr, 0, len); 273 memset(addr, 0, len);
274#else 274#else
275 /* simple grab some mem for now */ 275 /* simple grab some mem for now */
@@ -781,10 +781,15 @@ static int vpe_run(struct vpe * v)
781 /* take system out of configuration state */ 781 /* take system out of configuration state */
782 clear_c0_mvpcontrol(MVPCONTROL_VPC); 782 clear_c0_mvpcontrol(MVPCONTROL_VPC);
783 783
784 /*
785 * SMTC/SMVP kernels manage VPE enable independently,
786 * but uniprocessor kernels need to turn it on, even
787 * if that wasn't the pre-dvpe() state.
788 */
784#ifdef CONFIG_SMP 789#ifdef CONFIG_SMP
785 evpe(EVPE_ENABLE);
786#else
787 evpe(vpeflags); 790 evpe(vpeflags);
791#else
792 evpe(EVPE_ENABLE);
788#endif 793#endif
789 emt(dmt_flag); 794 emt(dmt_flag);
790 local_irq_restore(flags); 795 local_irq_restore(flags);
@@ -840,7 +845,7 @@ static int vpe_elfload(struct vpe * v)
840 845
841 /* Sanity checks against insmoding binaries or wrong arch, 846 /* Sanity checks against insmoding binaries or wrong arch,
842 weird elf version */ 847 weird elf version */
843 if (memcmp(hdr->e_ident, ELFMAG, 4) != 0 848 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
844 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC) 849 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
845 || !elf_check_arch(hdr) 850 || !elf_check_arch(hdr)
846 || hdr->e_shentsize != sizeof(*sechdrs)) { 851 || hdr->e_shentsize != sizeof(*sechdrs)) {
@@ -947,12 +952,14 @@ static int vpe_elfload(struct vpe * v)
947 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); 952 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff);
948 953
949 for (i = 0; i < hdr->e_phnum; i++) { 954 for (i = 0; i < hdr->e_phnum; i++) {
950 if (phdr->p_type != PT_LOAD) 955 if (phdr->p_type == PT_LOAD) {
951 continue; 956 memcpy((void *)phdr->p_paddr,
952 957 (char *)hdr + phdr->p_offset,
953 memcpy((void *)phdr->p_paddr, (char *)hdr + phdr->p_offset, phdr->p_filesz); 958 phdr->p_filesz);
954 memset((void *)phdr->p_paddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); 959 memset((void *)phdr->p_paddr + phdr->p_filesz,
955 phdr++; 960 0, phdr->p_memsz - phdr->p_filesz);
961 }
962 phdr++;
956 } 963 }
957 964
958 for (i = 0; i < hdr->e_shnum; i++) { 965 for (i = 0; i < hdr->e_shnum; i++) {
@@ -1107,7 +1114,7 @@ static int vpe_release(struct inode *inode, struct file *filp)
1107 return -ENODEV; 1114 return -ENODEV;
1108 1115
1109 hdr = (Elf_Ehdr *) v->pbuffer; 1116 hdr = (Elf_Ehdr *) v->pbuffer;
1110 if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) { 1117 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
1111 if (vpe_elfload(v) >= 0) { 1118 if (vpe_elfload(v) >= 0) {
1112 vpe_run(v); 1119 vpe_run(v);
1113 } else { 1120 } else {
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 10dd2af2343b..8f2cd8eda741 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -116,4 +116,3 @@ EXPORT_SYMBOL(__kmap);
116EXPORT_SYMBOL(__kunmap); 116EXPORT_SYMBOL(__kunmap);
117EXPORT_SYMBOL(__kmap_atomic); 117EXPORT_SYMBOL(__kmap_atomic);
118EXPORT_SYMBOL(__kunmap_atomic); 118EXPORT_SYMBOL(__kunmap_atomic);
119EXPORT_SYMBOL(__kmap_atomic_to_page);
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index da8cbb6899dc..b40df7d2cf44 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -281,7 +281,7 @@ static inline int n_counters(void)
281 281
282static void reset_counters(void *arg) 282static void reset_counters(void *arg)
283{ 283{
284 int counters = (int)arg; 284 int counters = (int)(long)arg;
285 switch (counters) { 285 switch (counters) {
286 case 4: 286 case 4:
287 w_c0_perfctrl3(0); 287 w_c0_perfctrl3(0);
@@ -313,7 +313,7 @@ static int __init mipsxx_init(void)
313 if (!cpu_has_mipsmt_pertccounters) 313 if (!cpu_has_mipsmt_pertccounters)
314 counters = counters_total_to_per_cpu(counters); 314 counters = counters_total_to_per_cpu(counters);
315#endif 315#endif
316 on_each_cpu(reset_counters, (void *)counters, 0, 1); 316 on_each_cpu(reset_counters, (void *)(long)counters, 0, 1);
317 317
318 op_model_mipsxx_ops.num_counters = counters; 318 op_model_mipsxx_ops.num_counters = counters;
319 switch (current_cpu_type()) { 319 switch (current_cpu_type()) {
@@ -382,7 +382,7 @@ static void mipsxx_exit(void)
382 int counters = op_model_mipsxx_ops.num_counters; 382 int counters = op_model_mipsxx_ops.num_counters;
383 383
384 counters = counters_per_cpu_to_total(counters); 384 counters = counters_per_cpu_to_total(counters);
385 on_each_cpu(reset_counters, (void *)counters, 0, 1); 385 on_each_cpu(reset_counters, (void *)(long)counters, 0, 1);
386 386
387 perf_irq = save_perf_irq; 387 perf_irq = save_perf_irq;
388} 388}
diff --git a/arch/mips/pci/fixup-au1000.c b/arch/mips/pci/fixup-au1000.c
index 00c36c9dbe0e..e2ddfc49237c 100644
--- a/arch/mips/pci/fixup-au1000.c
+++ b/arch/mips/pci/fixup-au1000.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups. 3 * Board specific PCI fixups.
4 * 4 *
5 * Copyright 2001-2003 MontaVista Software Inc. 5 * Copyright 2001-2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
index 1314bd58f036..9a57c5ab91dd 100644
--- a/arch/mips/pci/ops-au1000.c
+++ b/arch/mips/pci/ops-au1000.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 PCI support. 3 * Alchemy/AMD Au1xx0 PCI support.
4 * 4 *
5 * Copyright 2001-2003, 2007 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007-2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * Support for all devices (greater than 16) added by David Gathright. 8 * Support for all devices (greater than 16) added by David Gathright.
10 * 9 *
@@ -28,6 +27,7 @@
28 * with this program; if not, write to the Free Software Foundation, Inc., 27 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */ 29 */
30
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -36,9 +36,9 @@
36 36
37#include <asm/mach-au1x00/au1000.h> 37#include <asm/mach-au1x00/au1000.h>
38 38
39#undef DEBUG 39#undef DEBUG
40#ifdef DEBUG 40#ifdef DEBUG
41#define DBG(x...) printk(x) 41#define DBG(x...) printk(KERN_DEBUG x)
42#else 42#else
43#define DBG(x...) 43#define DBG(x...)
44#endif 44#endif
@@ -46,7 +46,6 @@
46#define PCI_ACCESS_READ 0 46#define PCI_ACCESS_READ 0
47#define PCI_ACCESS_WRITE 1 47#define PCI_ACCESS_WRITE 1
48 48
49
50int (*board_pci_idsel)(unsigned int devsel, int assert); 49int (*board_pci_idsel)(unsigned int devsel, int assert);
51 50
52void mod_wired_entry(int entry, unsigned long entrylo0, 51void mod_wired_entry(int entry, unsigned long entrylo0,
@@ -92,10 +91,9 @@ void __init au1x_pci_cfg_init(void)
92} 91}
93 92
94static int config_access(unsigned char access_type, struct pci_bus *bus, 93static int config_access(unsigned char access_type, struct pci_bus *bus,
95 unsigned int dev_fn, unsigned char where, 94 unsigned int dev_fn, unsigned char where, u32 *data)
96 u32 * data)
97{ 95{
98#if defined( CONFIG_SOC_AU1500 ) || defined( CONFIG_SOC_AU1550 ) 96#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
99 unsigned int device = PCI_SLOT(dev_fn); 97 unsigned int device = PCI_SLOT(dev_fn);
100 unsigned int function = PCI_FUNC(dev_fn); 98 unsigned int function = PCI_FUNC(dev_fn);
101 unsigned long offset, status; 99 unsigned long offset, status;
@@ -114,38 +112,36 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
114 Au1500_PCI_STATCMD); 112 Au1500_PCI_STATCMD);
115 au_sync_udelay(1); 113 au_sync_udelay(1);
116 114
117 /* Allow board vendors to implement their own off-chip idsel. 115 /*
116 * Allow board vendors to implement their own off-chip IDSEL.
118 * If it doesn't succeed, may as well bail out at this point. 117 * If it doesn't succeed, may as well bail out at this point.
119 */ 118 */
120 if (board_pci_idsel) { 119 if (board_pci_idsel && board_pci_idsel(device, 1) == 0) {
121 if (board_pci_idsel(device, 1) == 0) { 120 *data = 0xffffffff;
122 *data = 0xffffffff; 121 local_irq_restore(flags);
123 local_irq_restore(flags); 122 return -1;
124 return -1;
125 }
126 } 123 }
127 124
128 /* setup the config window */ 125 /* Setup the config window */
129 if (bus->number == 0) { 126 if (bus->number == 0)
130 cfg_base = ((1<<device)<<11); 127 cfg_base = (1 << device) << 11;
131 } else { 128 else
132 cfg_base = 0x80000000 | (bus->number<<16) | (device<<11); 129 cfg_base = 0x80000000 | (bus->number << 16) | (device << 11);
133 }
134 130
135 /* setup the lower bits of the 36 bit address */ 131 /* Setup the lower bits of the 36-bit address */
136 offset = (function << 8) | (where & ~0x3); 132 offset = (function << 8) | (where & ~0x3);
137 /* pick up any address that falls below the page mask */ 133 /* Pick up any address that falls below the page mask */
138 offset |= cfg_base & ~PAGE_MASK; 134 offset |= cfg_base & ~PAGE_MASK;
139 135
140 /* page boundary */ 136 /* Page boundary */
141 cfg_base = cfg_base & PAGE_MASK; 137 cfg_base = cfg_base & PAGE_MASK;
142 138
143 /* 139 /*
144 * To improve performance, if the current device is the same as 140 * To improve performance, if the current device is the same as
145 * the last device accessed, we don't touch the TLB. 141 * the last device accessed, we don't touch the TLB.
146 */ 142 */
147 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7; 143 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7;
148 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7; 144 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
149 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) { 145 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
150 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1, 146 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
151 (unsigned long)pci_cfg_vm->addr, PM_4K); 147 (unsigned long)pci_cfg_vm->addr, PM_4K);
@@ -153,38 +149,37 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
153 last_entryLo1 = entryLo1; 149 last_entryLo1 = entryLo1;
154 } 150 }
155 151
156 if (access_type == PCI_ACCESS_WRITE) { 152 if (access_type == PCI_ACCESS_WRITE)
157 au_writel(*data, (int)(pci_cfg_vm->addr + offset)); 153 au_writel(*data, (int)(pci_cfg_vm->addr + offset));
158 } else { 154 else
159 *data = au_readl((int)(pci_cfg_vm->addr + offset)); 155 *data = au_readl((int)(pci_cfg_vm->addr + offset));
160 } 156
161 au_sync_udelay(2); 157 au_sync_udelay(2);
162 158
163 DBG("cfg_access %d bus->number %d dev %d at %x *data %x conf %x\n", 159 DBG("cfg_access %d bus->number %u dev %u at %x *data %x conf %lx\n",
164 access_type, bus->number, device, where, *data, offset); 160 access_type, bus->number, device, where, *data, offset);
165 161
166 /* check master abort */ 162 /* Check master abort */
167 status = au_readl(Au1500_PCI_STATCMD); 163 status = au_readl(Au1500_PCI_STATCMD);
168 164
169 if (status & (1<<29)) { 165 if (status & (1 << 29)) {
170 *data = 0xffffffff; 166 *data = 0xffffffff;
171 error = -1; 167 error = -1;
172 DBG("Au1x Master Abort\n"); 168 DBG("Au1x Master Abort\n");
173 } else if ((status >> 28) & 0xf) { 169 } else if ((status >> 28) & 0xf) {
174 DBG("PCI ERR detected: device %d, status %x\n", device, ((status >> 28) & 0xf)); 170 DBG("PCI ERR detected: device %u, status %lx\n",
171 device, (status >> 28) & 0xf);
175 172
176 /* clear errors */ 173 /* Clear errors */
177 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD); 174 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD);
178 175
179 *data = 0xffffffff; 176 *data = 0xffffffff;
180 error = -1; 177 error = -1;
181 } 178 }
182 179
183 /* Take away the idsel. 180 /* Take away the IDSEL. */
184 */ 181 if (board_pci_idsel)
185 if (board_pci_idsel) {
186 (void)board_pci_idsel(device, 0); 182 (void)board_pci_idsel(device, 0);
187 }
188 183
189 local_irq_restore(flags); 184 local_irq_restore(flags);
190 return error; 185 return error;
@@ -192,7 +187,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
192} 187}
193 188
194static int read_config_byte(struct pci_bus *bus, unsigned int devfn, 189static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
195 int where, u8 * val) 190 int where, u8 *val)
196{ 191{
197 u32 data; 192 u32 data;
198 int ret; 193 int ret;
@@ -206,9 +201,8 @@ static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
206 return ret; 201 return ret;
207} 202}
208 203
209
210static int read_config_word(struct pci_bus *bus, unsigned int devfn, 204static int read_config_word(struct pci_bus *bus, unsigned int devfn,
211 int where, u16 * val) 205 int where, u16 *val)
212{ 206{
213 u32 data; 207 u32 data;
214 int ret; 208 int ret;
@@ -221,7 +215,7 @@ static int read_config_word(struct pci_bus *bus, unsigned int devfn,
221} 215}
222 216
223static int read_config_dword(struct pci_bus *bus, unsigned int devfn, 217static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
224 int where, u32 * val) 218 int where, u32 *val)
225{ 219{
226 int ret; 220 int ret;
227 221
@@ -229,9 +223,8 @@ static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
229 return ret; 223 return ret;
230} 224}
231 225
232static int 226static int write_config_byte(struct pci_bus *bus, unsigned int devfn,
233write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, 227 int where, u8 val)
234 u8 val)
235{ 228{
236 u32 data = 0; 229 u32 data = 0;
237 230
@@ -239,7 +232,7 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
239 return -1; 232 return -1;
240 233
241 data = (data & ~(0xff << ((where & 3) << 3))) | 234 data = (data & ~(0xff << ((where & 3) << 3))) |
242 (val << ((where & 3) << 3)); 235 (val << ((where & 3) << 3));
243 236
244 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 237 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
245 return -1; 238 return -1;
@@ -247,9 +240,8 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
247 return PCIBIOS_SUCCESSFUL; 240 return PCIBIOS_SUCCESSFUL;
248} 241}
249 242
250static int 243static int write_config_word(struct pci_bus *bus, unsigned int devfn,
251write_config_word(struct pci_bus *bus, unsigned int devfn, int where, 244 int where, u16 val)
252 u16 val)
253{ 245{
254 u32 data = 0; 246 u32 data = 0;
255 247
@@ -257,18 +249,16 @@ write_config_word(struct pci_bus *bus, unsigned int devfn, int where,
257 return -1; 249 return -1;
258 250
259 data = (data & ~(0xffff << ((where & 3) << 3))) | 251 data = (data & ~(0xffff << ((where & 3) << 3))) |
260 (val << ((where & 3) << 3)); 252 (val << ((where & 3) << 3));
261 253
262 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 254 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
263 return -1; 255 return -1;
264 256
265
266 return PCIBIOS_SUCCESSFUL; 257 return PCIBIOS_SUCCESSFUL;
267} 258}
268 259
269static int 260static int write_config_dword(struct pci_bus *bus, unsigned int devfn,
270write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, 261 int where, u32 val)
271 u32 val)
272{ 262{
273 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val)) 263 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
274 return -1; 264 return -1;
@@ -277,18 +267,20 @@ write_config_dword(struct pci_bus *bus, unsigned int devfn, int where,
277} 267}
278 268
279static int config_read(struct pci_bus *bus, unsigned int devfn, 269static int config_read(struct pci_bus *bus, unsigned int devfn,
280 int where, int size, u32 * val) 270 int where, int size, u32 *val)
281{ 271{
282 switch (size) { 272 switch (size) {
283 case 1: { 273 case 1: {
284 u8 _val; 274 u8 _val;
285 int rc = read_config_byte(bus, devfn, where, &_val); 275 int rc = read_config_byte(bus, devfn, where, &_val);
276
286 *val = _val; 277 *val = _val;
287 return rc; 278 return rc;
288 } 279 }
289 case 2: { 280 case 2: {
290 u16 _val; 281 u16 _val;
291 int rc = read_config_word(bus, devfn, where, &_val); 282 int rc = read_config_word(bus, devfn, where, &_val);
283
292 *val = _val; 284 *val = _val;
293 return rc; 285 return rc;
294 } 286 }
@@ -310,7 +302,6 @@ static int config_write(struct pci_bus *bus, unsigned int devfn,
310 } 302 }
311} 303}
312 304
313
314struct pci_ops au1x_pci_ops = { 305struct pci_ops au1x_pci_ops = {
315 config_read, 306 config_read,
316 config_write 307 config_write
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
index ab96a2d7f4c4..11769b55438c 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
@@ -126,9 +126,6 @@ static irqreturn_t hwbutton_handler(int irq, void *data)
126 struct hwbutton_interrupt *hirq = data; 126 struct hwbutton_interrupt *hirq = data;
127 unsigned long cic_ext = *CIC_EXT_CFG_REG; 127 unsigned long cic_ext = *CIC_EXT_CFG_REG;
128 128
129 if (irq != hirq->irq)
130 return IRQ_NONE;
131
132 if (CIC_EXT_IS_ACTIVE_HI(cic_ext, hirq->eirq)) { 129 if (CIC_EXT_IS_ACTIVE_HI(cic_ext, hirq->eirq)) {
133 /* Interrupt: pin is now HI */ 130 /* Interrupt: pin is now HI */
134 CIC_EXT_SET_ACTIVE_LO(cic_ext, hirq->eirq); 131 CIC_EXT_SET_ACTIVE_LO(cic_ext, hirq->eirq);
@@ -164,7 +161,7 @@ static int msp_hwbutton_register(struct hwbutton_interrupt *hirq)
164 *CIC_EXT_CFG_REG = cic_ext; 161 *CIC_EXT_CFG_REG = cic_ext;
165 162
166 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED, 163 return request_irq(hirq->irq, hwbutton_handler, IRQF_DISABLED,
167 hirq->name, (void *)hirq); 164 hirq->name, hirq);
168} 165}
169 166
170static int __init msp_hwbutton_setup(void) 167static int __init msp_hwbutton_setup(void)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 25d3baf0ebc4..9cebc9e7da63 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -158,7 +158,7 @@ static void rt_set_mode(enum clock_event_mode mode,
158 } 158 }
159} 159}
160 160
161unsigned int rt_timer_irq; 161int rt_timer_irq;
162 162
163static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id) 163static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
164{ 164{
@@ -219,7 +219,7 @@ static void __cpuinit hub_rt_clock_event_init(void)
219 219
220static void __init hub_rt_clock_event_global_init(void) 220static void __init hub_rt_clock_event_global_init(void)
221{ 221{
222 unsigned int irq; 222 int irq;
223 223
224 do { 224 do {
225 smp_wmb(); 225 smp_wmb();
diff --git a/arch/mn10300/boot/install.sh b/arch/mn10300/boot/install.sh
index 072951c83976..abba30971191 100644
--- a/arch/mn10300/boot/install.sh
+++ b/arch/mn10300/boot/install.sh
@@ -26,42 +26,42 @@ rm -fr $4/../usr/include/linux $4/../usr/include/asm
26install -c -m 0755 $2 $4/vmlinuz 26install -c -m 0755 $2 $4/vmlinuz
27install -c -m 0755 $5 $4/boot.rom 27install -c -m 0755 $5 $4/boot.rom
28install -c -m 0755 -d $4/../usr/include/linux 28install -c -m 0755 -d $4/../usr/include/linux
29cd $TOPDIR/include/linux 29cd ${srctree}/include/linux
30for i in `find . -maxdepth 1 -name '*.h' -print`; do 30for i in `find . -maxdepth 1 -name '*.h' -print`; do
31 install -c -m 0644 $i $4/../usr/include/linux 31 install -c -m 0644 $i $4/../usr/include/linux
32done 32done
33install -c -m 0755 -d $4/../usr/include/linux/byteorder 33install -c -m 0755 -d $4/../usr/include/linux/byteorder
34cd $TOPDIR/include/linux/byteorder 34cd ${srctree}/include/linux/byteorder
35for i in `find . -name '*.h' -print`; do 35for i in `find . -name '*.h' -print`; do
36 install -c -m 0644 $i $4/../usr/include/linux/byteorder 36 install -c -m 0644 $i $4/../usr/include/linux/byteorder
37done 37done
38install -c -m 0755 -d $4/../usr/include/linux/lockd 38install -c -m 0755 -d $4/../usr/include/linux/lockd
39cd $TOPDIR/include/linux/lockd 39cd ${srctree}/include/linux/lockd
40for i in `find . -name '*.h' -print`; do 40for i in `find . -name '*.h' -print`; do
41 install -c -m 0644 $i $4/../usr/include/linux/lockd 41 install -c -m 0644 $i $4/../usr/include/linux/lockd
42done 42done
43install -c -m 0755 -d $4/../usr/include/linux/netfilter_ipv4 43install -c -m 0755 -d $4/../usr/include/linux/netfilter_ipv4
44cd $TOPDIR/include/linux/netfilter_ipv4 44cd ${srctree}/include/linux/netfilter_ipv4
45for i in `find . -name '*.h' -print`; do 45for i in `find . -name '*.h' -print`; do
46 install -c -m 0644 $i $4/../usr/include/linux/netfilter_ipv4 46 install -c -m 0644 $i $4/../usr/include/linux/netfilter_ipv4
47done 47done
48install -c -m 0755 -d $4/../usr/include/linux/nfsd 48install -c -m 0755 -d $4/../usr/include/linux/nfsd
49cd $TOPDIR/include/linux/nfsd 49cd ${srctree}/include/linux/nfsd
50for i in `find . -name '*.h' -print`; do 50for i in `find . -name '*.h' -print`; do
51 install -c -m 0644 $i $4/../usr/include/linux/nfsd/$i 51 install -c -m 0644 $i $4/../usr/include/linux/nfsd/$i
52done 52done
53install -c -m 0755 -d $4/../usr/include/linux/raid 53install -c -m 0755 -d $4/../usr/include/linux/raid
54cd $TOPDIR/include/linux/raid 54cd ${srctree}/include/linux/raid
55for i in `find . -name '*.h' -print`; do 55for i in `find . -name '*.h' -print`; do
56 install -c -m 0644 $i $4/../usr/include/linux/raid 56 install -c -m 0644 $i $4/../usr/include/linux/raid
57done 57done
58install -c -m 0755 -d $4/../usr/include/linux/sunrpc 58install -c -m 0755 -d $4/../usr/include/linux/sunrpc
59cd $TOPDIR/include/linux/sunrpc 59cd ${srctree}/include/linux/sunrpc
60for i in `find . -name '*.h' -print`; do 60for i in `find . -name '*.h' -print`; do
61 install -c -m 0644 $i $4/../usr/include/linux/sunrpc 61 install -c -m 0644 $i $4/../usr/include/linux/sunrpc
62done 62done
63install -c -m 0755 -d $4/../usr/include/asm 63install -c -m 0755 -d $4/../usr/include/asm
64cd $TOPDIR/include/asm 64cd ${srctree}/include/asm
65for i in `find . -name '*.h' -print`; do 65for i in `find . -name '*.h' -print`; do
66 install -c -m 0644 $i $4/../usr/include/asm 66 install -c -m 0644 $i $4/../usr/include/asm
67done 67done
diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S
index 38a1c1b8d4e8..f0b18ce89842 100644
--- a/arch/parisc/hpux/gate.S
+++ b/arch/parisc/hpux/gate.S
@@ -13,9 +13,10 @@
13#include <asm/unistd.h> 13#include <asm/unistd.h>
14#include <asm/errno.h> 14#include <asm/errno.h>
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h>
16 17
17 .level LEVEL 18 .level LEVEL
18 .text 19 __HEAD
19 20
20 .import hpux_call_table 21 .import hpux_call_table
21 .import hpux_syscall_exit,code 22 .import hpux_syscall_exit,code
diff --git a/arch/parisc/hpux/wrappers.S b/arch/parisc/hpux/wrappers.S
index 58c53c879c02..ccd3a50c0995 100644
--- a/arch/parisc/hpux/wrappers.S
+++ b/arch/parisc/hpux/wrappers.S
@@ -28,9 +28,10 @@
28#include <asm/assembly.h> 28#include <asm/assembly.h>
29#include <asm/signal.h> 29#include <asm/signal.h>
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h>
31 32
32 .level LEVEL 33 .level LEVEL
33 .text 34 __HEAD
34 35
35 /* These should probably go in a header file somewhere. 36 /* These should probably go in a header file somewhere.
36 * They are duplicated in kernel/wrappers.S 37 * They are duplicated in kernel/wrappers.S
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index 1f6585a56f97..016d3fc4111c 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -4,9 +4,6 @@
4 4
5extra-y := init_task.o head.o vmlinux.lds 5extra-y := init_task.o head.o vmlinux.lds
6 6
7AFLAGS_entry.o := -traditional
8AFLAGS_pacache.o := -traditional
9
10obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ 7obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
11 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ 8 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
12 ptrace.o hardware.o inventory.o drivers.o \ 9 ptrace.o hardware.o inventory.o drivers.o \
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 111d47284eac..5d0837458c19 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -38,18 +38,11 @@
38#include <asm/thread_info.h> 38#include <asm/thread_info.h>
39 39
40#include <linux/linkage.h> 40#include <linux/linkage.h>
41#include <linux/init.h>
41 42
42#ifdef CONFIG_64BIT 43#ifdef CONFIG_64BIT
43#define CMPIB cmpib,*
44#define CMPB cmpb,*
45#define COND(x) *x
46
47 .level 2.0w 44 .level 2.0w
48#else 45#else
49#define CMPIB cmpib,
50#define CMPB cmpb,
51#define COND(x) x
52
53 .level 2.0 46 .level 2.0
54#endif 47#endif
55 48
@@ -629,7 +622,7 @@
629 * the static part of the kernel address space. 622 * the static part of the kernel address space.
630 */ 623 */
631 624
632 .text 625 __HEAD
633 626
634 .align PAGE_SIZE 627 .align PAGE_SIZE
635 628
@@ -957,9 +950,9 @@ intr_check_sig:
957 * Only do signals if we are returning to user space 950 * Only do signals if we are returning to user space
958 */ 951 */
959 LDREG PT_IASQ0(%r16), %r20 952 LDREG PT_IASQ0(%r16), %r20
960 CMPIB=,n 0,%r20,intr_restore /* backward */ 953 cmpib,COND(=),n 0,%r20,intr_restore /* backward */
961 LDREG PT_IASQ1(%r16), %r20 954 LDREG PT_IASQ1(%r16), %r20
962 CMPIB=,n 0,%r20,intr_restore /* backward */ 955 cmpib,COND(=),n 0,%r20,intr_restore /* backward */
963 956
964 copy %r0, %r25 /* long in_syscall = 0 */ 957 copy %r0, %r25 /* long in_syscall = 0 */
965#ifdef CONFIG_64BIT 958#ifdef CONFIG_64BIT
@@ -1013,10 +1006,10 @@ intr_do_resched:
1013 * we jump back to intr_restore. 1006 * we jump back to intr_restore.
1014 */ 1007 */
1015 LDREG PT_IASQ0(%r16), %r20 1008 LDREG PT_IASQ0(%r16), %r20
1016 CMPIB= 0, %r20, intr_do_preempt 1009 cmpib,COND(=) 0, %r20, intr_do_preempt
1017 nop 1010 nop
1018 LDREG PT_IASQ1(%r16), %r20 1011 LDREG PT_IASQ1(%r16), %r20
1019 CMPIB= 0, %r20, intr_do_preempt 1012 cmpib,COND(=) 0, %r20, intr_do_preempt
1020 nop 1013 nop
1021 1014
1022#ifdef CONFIG_64BIT 1015#ifdef CONFIG_64BIT
@@ -1045,7 +1038,7 @@ intr_do_preempt:
1045 /* current_thread_info()->preempt_count */ 1038 /* current_thread_info()->preempt_count */
1046 mfctl %cr30, %r1 1039 mfctl %cr30, %r1
1047 LDREG TI_PRE_COUNT(%r1), %r19 1040 LDREG TI_PRE_COUNT(%r1), %r19
1048 CMPIB<> 0, %r19, intr_restore /* if preempt_count > 0 */ 1041 cmpib,COND(<>) 0, %r19, intr_restore /* if preempt_count > 0 */
1049 nop /* prev insn branched backwards */ 1042 nop /* prev insn branched backwards */
1050 1043
1051 /* check if we interrupted a critical path */ 1044 /* check if we interrupted a critical path */
@@ -1064,7 +1057,7 @@ intr_do_preempt:
1064 */ 1057 */
1065 1058
1066intr_extint: 1059intr_extint:
1067 CMPIB=,n 0,%r16,1f 1060 cmpib,COND(=),n 0,%r16,1f
1068 1061
1069 get_stack_use_cr30 1062 get_stack_use_cr30
1070 b,n 2f 1063 b,n 2f
@@ -1099,7 +1092,7 @@ ENDPROC(syscall_exit_rfi)
1099 1092
1100ENTRY(intr_save) /* for os_hpmc */ 1093ENTRY(intr_save) /* for os_hpmc */
1101 mfsp %sr7,%r16 1094 mfsp %sr7,%r16
1102 CMPIB=,n 0,%r16,1f 1095 cmpib,COND(=),n 0,%r16,1f
1103 get_stack_use_cr30 1096 get_stack_use_cr30
1104 b 2f 1097 b 2f
1105 copy %r8,%r26 1098 copy %r8,%r26
@@ -1121,7 +1114,7 @@ ENTRY(intr_save) /* for os_hpmc */
1121 * adjust isr/ior below. 1114 * adjust isr/ior below.
1122 */ 1115 */
1123 1116
1124 CMPIB=,n 6,%r26,skip_save_ior 1117 cmpib,COND(=),n 6,%r26,skip_save_ior
1125 1118
1126 1119
1127 mfctl %cr20, %r16 /* isr */ 1120 mfctl %cr20, %r16 /* isr */
@@ -1450,11 +1443,11 @@ nadtlb_emulate:
1450 bb,>=,n %r9,26,nadtlb_nullify /* m bit not set, just nullify */ 1443 bb,>=,n %r9,26,nadtlb_nullify /* m bit not set, just nullify */
1451 BL get_register,%r25 1444 BL get_register,%r25
1452 extrw,u %r9,15,5,%r8 /* Get index register # */ 1445 extrw,u %r9,15,5,%r8 /* Get index register # */
1453 CMPIB=,n -1,%r1,nadtlb_fault /* have to use slow path */ 1446 cmpib,COND(=),n -1,%r1,nadtlb_fault /* have to use slow path */
1454 copy %r1,%r24 1447 copy %r1,%r24
1455 BL get_register,%r25 1448 BL get_register,%r25
1456 extrw,u %r9,10,5,%r8 /* Get base register # */ 1449 extrw,u %r9,10,5,%r8 /* Get base register # */
1457 CMPIB=,n -1,%r1,nadtlb_fault /* have to use slow path */ 1450 cmpib,COND(=),n -1,%r1,nadtlb_fault /* have to use slow path */
1458 BL set_register,%r25 1451 BL set_register,%r25
1459 add,l %r1,%r24,%r1 /* doesn't affect c/b bits */ 1452 add,l %r1,%r24,%r1 /* doesn't affect c/b bits */
1460 1453
@@ -1486,7 +1479,7 @@ nadtlb_probe_check:
1486 cmpb,<>,n %r16,%r17,nadtlb_fault /* Must be probe,[rw]*/ 1479 cmpb,<>,n %r16,%r17,nadtlb_fault /* Must be probe,[rw]*/
1487 BL get_register,%r25 /* Find the target register */ 1480 BL get_register,%r25 /* Find the target register */
1488 extrw,u %r9,31,5,%r8 /* Get target register */ 1481 extrw,u %r9,31,5,%r8 /* Get target register */
1489 CMPIB=,n -1,%r1,nadtlb_fault /* have to use slow path */ 1482 cmpib,COND(=),n -1,%r1,nadtlb_fault /* have to use slow path */
1490 BL set_register,%r25 1483 BL set_register,%r25
1491 copy %r0,%r1 /* Write zero to target register */ 1484 copy %r0,%r1 /* Write zero to target register */
1492 b nadtlb_nullify /* Nullify return insn */ 1485 b nadtlb_nullify /* Nullify return insn */
@@ -1570,12 +1563,12 @@ dbit_trap_20w:
1570 L3_ptep ptp,pte,t0,va,dbit_fault 1563 L3_ptep ptp,pte,t0,va,dbit_fault
1571 1564
1572#ifdef CONFIG_SMP 1565#ifdef CONFIG_SMP
1573 CMPIB=,n 0,spc,dbit_nolock_20w 1566 cmpib,COND(=),n 0,spc,dbit_nolock_20w
1574 load32 PA(pa_dbit_lock),t0 1567 load32 PA(pa_dbit_lock),t0
1575 1568
1576dbit_spin_20w: 1569dbit_spin_20w:
1577 LDCW 0(t0),t1 1570 LDCW 0(t0),t1
1578 cmpib,= 0,t1,dbit_spin_20w 1571 cmpib,COND(=) 0,t1,dbit_spin_20w
1579 nop 1572 nop
1580 1573
1581dbit_nolock_20w: 1574dbit_nolock_20w:
@@ -1586,7 +1579,7 @@ dbit_nolock_20w:
1586 1579
1587 idtlbt pte,prot 1580 idtlbt pte,prot
1588#ifdef CONFIG_SMP 1581#ifdef CONFIG_SMP
1589 CMPIB=,n 0,spc,dbit_nounlock_20w 1582 cmpib,COND(=),n 0,spc,dbit_nounlock_20w
1590 ldi 1,t1 1583 ldi 1,t1
1591 stw t1,0(t0) 1584 stw t1,0(t0)
1592 1585
@@ -1606,7 +1599,7 @@ dbit_trap_11:
1606 L2_ptep ptp,pte,t0,va,dbit_fault 1599 L2_ptep ptp,pte,t0,va,dbit_fault
1607 1600
1608#ifdef CONFIG_SMP 1601#ifdef CONFIG_SMP
1609 CMPIB=,n 0,spc,dbit_nolock_11 1602 cmpib,COND(=),n 0,spc,dbit_nolock_11
1610 load32 PA(pa_dbit_lock),t0 1603 load32 PA(pa_dbit_lock),t0
1611 1604
1612dbit_spin_11: 1605dbit_spin_11:
@@ -1628,7 +1621,7 @@ dbit_nolock_11:
1628 1621
1629 mtsp t1, %sr1 /* Restore sr1 */ 1622 mtsp t1, %sr1 /* Restore sr1 */
1630#ifdef CONFIG_SMP 1623#ifdef CONFIG_SMP
1631 CMPIB=,n 0,spc,dbit_nounlock_11 1624 cmpib,COND(=),n 0,spc,dbit_nounlock_11
1632 ldi 1,t1 1625 ldi 1,t1
1633 stw t1,0(t0) 1626 stw t1,0(t0)
1634 1627
@@ -1646,7 +1639,7 @@ dbit_trap_20:
1646 L2_ptep ptp,pte,t0,va,dbit_fault 1639 L2_ptep ptp,pte,t0,va,dbit_fault
1647 1640
1648#ifdef CONFIG_SMP 1641#ifdef CONFIG_SMP
1649 CMPIB=,n 0,spc,dbit_nolock_20 1642 cmpib,COND(=),n 0,spc,dbit_nolock_20
1650 load32 PA(pa_dbit_lock),t0 1643 load32 PA(pa_dbit_lock),t0
1651 1644
1652dbit_spin_20: 1645dbit_spin_20:
@@ -1665,7 +1658,7 @@ dbit_nolock_20:
1665 idtlbt pte,prot 1658 idtlbt pte,prot
1666 1659
1667#ifdef CONFIG_SMP 1660#ifdef CONFIG_SMP
1668 CMPIB=,n 0,spc,dbit_nounlock_20 1661 cmpib,COND(=),n 0,spc,dbit_nounlock_20
1669 ldi 1,t1 1662 ldi 1,t1
1670 stw t1,0(t0) 1663 stw t1,0(t0)
1671 1664
@@ -1994,7 +1987,7 @@ ENTRY(syscall_exit)
1994 1987
1995 /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */ 1988 /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */
1996 ldo -PER_HPUX(%r19), %r19 1989 ldo -PER_HPUX(%r19), %r19
1997 CMPIB<>,n 0,%r19,1f 1990 cmpib,COND(<>),n 0,%r19,1f
1998 1991
1999 /* Save other hpux returns if personality is PER_HPUX */ 1992 /* Save other hpux returns if personality is PER_HPUX */
2000 STREG %r22,TASK_PT_GR22(%r1) 1993 STREG %r22,TASK_PT_GR22(%r1)
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index ec2482dc1beb..5680a2c3b13d 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -32,7 +32,7 @@ ENTRY(boot_args)
32 .word 0 /* arg3 */ 32 .word 0 /* arg3 */
33END(boot_args) 33END(boot_args)
34 34
35 .section .text.head 35 __HEAD
36 .align 4 36 .align 4
37 .import init_thread_union,data 37 .import init_thread_union,data
38 .import fault_vector_20,code /* IVA parisc 2.0 32 bit */ 38 .import fault_vector_20,code /* IVA parisc 2.0 32 bit */
diff --git a/arch/parisc/kernel/hpmc.S b/arch/parisc/kernel/hpmc.S
index 2cbf13b3ef11..068322eb8c9b 100644
--- a/arch/parisc/kernel/hpmc.S
+++ b/arch/parisc/kernel/hpmc.S
@@ -47,6 +47,7 @@
47#include <asm/pdc.h> 47#include <asm/pdc.h>
48 48
49#include <linux/linkage.h> 49#include <linux/linkage.h>
50#include <linux/init.h>
50 51
51 /* 52 /*
52 * stack for os_hpmc, the HPMC handler. 53 * stack for os_hpmc, the HPMC handler.
@@ -76,7 +77,7 @@ ENTRY(hpmc_pim_data)
76 .block HPMC_PIM_DATA_SIZE 77 .block HPMC_PIM_DATA_SIZE
77END(hpmc_pim_data) 78END(hpmc_pim_data)
78 79
79 .text 80 __HEAD
80 81
81 .import intr_save, code 82 .import intr_save, code
82ENTRY(os_hpmc) 83ENTRY(os_hpmc)
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index 4845a6444633..bd1f7f1ff74e 100644
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -499,7 +499,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs,
499 dev->addr = kmalloc(num_addrs * sizeof(unsigned long), GFP_KERNEL); 499 dev->addr = kmalloc(num_addrs * sizeof(unsigned long), GFP_KERNEL);
500 if(!dev->addr) { 500 if(!dev->addr) {
501 printk(KERN_ERR "%s %s(): memory allocation failure\n", 501 printk(KERN_ERR "%s %s(): memory allocation failure\n",
502 __FILE__, __FUNCTION__); 502 __FILE__, __func__);
503 return; 503 return;
504 } 504 }
505 505
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index 5901092e0196..e3246a5ca74f 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -37,8 +37,9 @@
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/cache.h> 38#include <asm/cache.h>
39#include <linux/linkage.h> 39#include <linux/linkage.h>
40#include <linux/init.h>
40 41
41 .text 42 __HEAD
42 .align 128 43 .align 128
43 44
44ENTRY(flush_tlb_all_local) 45ENTRY(flush_tlb_all_local)
@@ -85,7 +86,7 @@ ENTRY(flush_tlb_all_local)
85 LDREG ITLB_OFF_COUNT(%r1), %arg2 86 LDREG ITLB_OFF_COUNT(%r1), %arg2
86 LDREG ITLB_LOOP(%r1), %arg3 87 LDREG ITLB_LOOP(%r1), %arg3
87 88
88 ADDIB= -1, %arg3, fitoneloop /* Preadjust and test */ 89 addib,COND(=) -1, %arg3, fitoneloop /* Preadjust and test */
89 movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */ 90 movb,<,n %arg3, %r31, fitdone /* If loop < 0, skip */
90 copy %arg0, %r28 /* Init base addr */ 91 copy %arg0, %r28 /* Init base addr */
91 92
@@ -95,14 +96,14 @@ fitmanyloop: /* Loop if LOOP >= 2 */
95 copy %arg2, %r29 /* Init middle loop count */ 96 copy %arg2, %r29 /* Init middle loop count */
96 97
97fitmanymiddle: /* Loop if LOOP >= 2 */ 98fitmanymiddle: /* Loop if LOOP >= 2 */
98 ADDIB> -1, %r31, fitmanymiddle /* Adjusted inner loop decr */ 99 addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */
99 pitlbe 0(%sr1, %r28) 100 pitlbe 0(%sr1, %r28)
100 pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */ 101 pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */
101 ADDIB> -1, %r29, fitmanymiddle /* Middle loop decr */ 102 addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */
102 copy %arg3, %r31 /* Re-init inner loop count */ 103 copy %arg3, %r31 /* Re-init inner loop count */
103 104
104 movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */ 105 movb,tr %arg0, %r28, fitmanyloop /* Re-init base addr */
105 ADDIB<=,n -1, %r22, fitdone /* Outer loop count decr */ 106 addib,COND(<=),n -1, %r22, fitdone /* Outer loop count decr */
106 107
107fitoneloop: /* Loop if LOOP = 1 */ 108fitoneloop: /* Loop if LOOP = 1 */
108 mtsp %r20, %sr1 109 mtsp %r20, %sr1
@@ -110,10 +111,10 @@ fitoneloop: /* Loop if LOOP = 1 */
110 copy %arg2, %r29 /* init middle loop count */ 111 copy %arg2, %r29 /* init middle loop count */
111 112
112fitonemiddle: /* Loop if LOOP = 1 */ 113fitonemiddle: /* Loop if LOOP = 1 */
113 ADDIB> -1, %r29, fitonemiddle /* Middle loop count decr */ 114 addib,COND(>) -1, %r29, fitonemiddle /* Middle loop count decr */
114 pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */ 115 pitlbe,m %arg1(%sr1, %r28) /* pitlbe for one loop */
115 116
116 ADDIB> -1, %r22, fitoneloop /* Outer loop count decr */ 117 addib,COND(>) -1, %r22, fitoneloop /* Outer loop count decr */
117 add %r21, %r20, %r20 /* increment space */ 118 add %r21, %r20, %r20 /* increment space */
118 119
119fitdone: 120fitdone:
@@ -128,7 +129,7 @@ fitdone:
128 LDREG DTLB_OFF_COUNT(%r1), %arg2 129 LDREG DTLB_OFF_COUNT(%r1), %arg2
129 LDREG DTLB_LOOP(%r1), %arg3 130 LDREG DTLB_LOOP(%r1), %arg3
130 131
131 ADDIB= -1, %arg3, fdtoneloop /* Preadjust and test */ 132 addib,COND(=) -1, %arg3, fdtoneloop /* Preadjust and test */
132 movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */ 133 movb,<,n %arg3, %r31, fdtdone /* If loop < 0, skip */
133 copy %arg0, %r28 /* Init base addr */ 134 copy %arg0, %r28 /* Init base addr */
134 135
@@ -138,14 +139,14 @@ fdtmanyloop: /* Loop if LOOP >= 2 */
138 copy %arg2, %r29 /* Init middle loop count */ 139 copy %arg2, %r29 /* Init middle loop count */
139 140
140fdtmanymiddle: /* Loop if LOOP >= 2 */ 141fdtmanymiddle: /* Loop if LOOP >= 2 */
141 ADDIB> -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */ 142 addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */
142 pdtlbe 0(%sr1, %r28) 143 pdtlbe 0(%sr1, %r28)
143 pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */ 144 pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */
144 ADDIB> -1, %r29, fdtmanymiddle /* Middle loop decr */ 145 addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */
145 copy %arg3, %r31 /* Re-init inner loop count */ 146 copy %arg3, %r31 /* Re-init inner loop count */
146 147
147 movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */ 148 movb,tr %arg0, %r28, fdtmanyloop /* Re-init base addr */
148 ADDIB<=,n -1, %r22,fdtdone /* Outer loop count decr */ 149 addib,COND(<=),n -1, %r22,fdtdone /* Outer loop count decr */
149 150
150fdtoneloop: /* Loop if LOOP = 1 */ 151fdtoneloop: /* Loop if LOOP = 1 */
151 mtsp %r20, %sr1 152 mtsp %r20, %sr1
@@ -153,10 +154,10 @@ fdtoneloop: /* Loop if LOOP = 1 */
153 copy %arg2, %r29 /* init middle loop count */ 154 copy %arg2, %r29 /* init middle loop count */
154 155
155fdtonemiddle: /* Loop if LOOP = 1 */ 156fdtonemiddle: /* Loop if LOOP = 1 */
156 ADDIB> -1, %r29, fdtonemiddle /* Middle loop count decr */ 157 addib,COND(>) -1, %r29, fdtonemiddle /* Middle loop count decr */
157 pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */ 158 pdtlbe,m %arg1(%sr1, %r28) /* pdtlbe for one loop */
158 159
159 ADDIB> -1, %r22, fdtoneloop /* Outer loop count decr */ 160 addib,COND(>) -1, %r22, fdtoneloop /* Outer loop count decr */
160 add %r21, %r20, %r20 /* increment space */ 161 add %r21, %r20, %r20 /* increment space */
161 162
162 163
@@ -209,18 +210,18 @@ ENTRY(flush_instruction_cache_local)
209 LDREG ICACHE_COUNT(%r1), %arg2 210 LDREG ICACHE_COUNT(%r1), %arg2
210 LDREG ICACHE_LOOP(%r1), %arg3 211 LDREG ICACHE_LOOP(%r1), %arg3
211 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/ 212 rsm PSW_SM_I, %r22 /* No mmgt ops during loop*/
212 ADDIB= -1, %arg3, fioneloop /* Preadjust and test */ 213 addib,COND(=) -1, %arg3, fioneloop /* Preadjust and test */
213 movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */ 214 movb,<,n %arg3, %r31, fisync /* If loop < 0, do sync */
214 215
215fimanyloop: /* Loop if LOOP >= 2 */ 216fimanyloop: /* Loop if LOOP >= 2 */
216 ADDIB> -1, %r31, fimanyloop /* Adjusted inner loop decr */ 217 addib,COND(>) -1, %r31, fimanyloop /* Adjusted inner loop decr */
217 fice %r0(%sr1, %arg0) 218 fice %r0(%sr1, %arg0)
218 fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */ 219 fice,m %arg1(%sr1, %arg0) /* Last fice and addr adjust */
219 movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */ 220 movb,tr %arg3, %r31, fimanyloop /* Re-init inner loop count */
220 ADDIB<=,n -1, %arg2, fisync /* Outer loop decr */ 221 addib,COND(<=),n -1, %arg2, fisync /* Outer loop decr */
221 222
222fioneloop: /* Loop if LOOP = 1 */ 223fioneloop: /* Loop if LOOP = 1 */
223 ADDIB> -1, %arg2, fioneloop /* Outer loop count decr */ 224 addib,COND(>) -1, %arg2, fioneloop /* Outer loop count decr */
224 fice,m %arg1(%sr1, %arg0) /* Fice for one loop */ 225 fice,m %arg1(%sr1, %arg0) /* Fice for one loop */
225 226
226fisync: 227fisync:
@@ -250,18 +251,18 @@ ENTRY(flush_data_cache_local)
250 LDREG DCACHE_COUNT(%r1), %arg2 251 LDREG DCACHE_COUNT(%r1), %arg2
251 LDREG DCACHE_LOOP(%r1), %arg3 252 LDREG DCACHE_LOOP(%r1), %arg3
252 rsm PSW_SM_I, %r22 253 rsm PSW_SM_I, %r22
253 ADDIB= -1, %arg3, fdoneloop /* Preadjust and test */ 254 addib,COND(=) -1, %arg3, fdoneloop /* Preadjust and test */
254 movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */ 255 movb,<,n %arg3, %r31, fdsync /* If loop < 0, do sync */
255 256
256fdmanyloop: /* Loop if LOOP >= 2 */ 257fdmanyloop: /* Loop if LOOP >= 2 */
257 ADDIB> -1, %r31, fdmanyloop /* Adjusted inner loop decr */ 258 addib,COND(>) -1, %r31, fdmanyloop /* Adjusted inner loop decr */
258 fdce %r0(%sr1, %arg0) 259 fdce %r0(%sr1, %arg0)
259 fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */ 260 fdce,m %arg1(%sr1, %arg0) /* Last fdce and addr adjust */
260 movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */ 261 movb,tr %arg3, %r31, fdmanyloop /* Re-init inner loop count */
261 ADDIB<=,n -1, %arg2, fdsync /* Outer loop decr */ 262 addib,COND(<=),n -1, %arg2, fdsync /* Outer loop decr */
262 263
263fdoneloop: /* Loop if LOOP = 1 */ 264fdoneloop: /* Loop if LOOP = 1 */
264 ADDIB> -1, %arg2, fdoneloop /* Outer loop count decr */ 265 addib,COND(>) -1, %arg2, fdoneloop /* Outer loop count decr */
265 fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */ 266 fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */
266 267
267fdsync: 268fdsync:
@@ -342,7 +343,7 @@ ENTRY(copy_user_page_asm)
342 * non-taken backward branch. Note that .+4 is a backwards branch. 343 * non-taken backward branch. Note that .+4 is a backwards branch.
343 * The ldd should only get executed if the branch is taken. 344 * The ldd should only get executed if the branch is taken.
344 */ 345 */
345 ADDIB>,n -1, %r1, 1b /* bundle 10 */ 346 addib,COND(>),n -1, %r1, 1b /* bundle 10 */
346 ldd 0(%r25), %r19 /* start next loads */ 347 ldd 0(%r25), %r19 /* start next loads */
347 348
348#else 349#else
@@ -391,7 +392,7 @@ ENTRY(copy_user_page_asm)
391 stw %r21, 56(%r26) 392 stw %r21, 56(%r26)
392 stw %r22, 60(%r26) 393 stw %r22, 60(%r26)
393 ldo 64(%r26), %r26 394 ldo 64(%r26), %r26
394 ADDIB>,n -1, %r1, 1b 395 addib,COND(>),n -1, %r1, 1b
395 ldw 0(%r25), %r19 396 ldw 0(%r25), %r19
396#endif 397#endif
397 bv %r0(%r2) 398 bv %r0(%r2)
@@ -515,7 +516,7 @@ ENTRY(copy_user_page_asm)
515 stw %r21, 56(%r28) 516 stw %r21, 56(%r28)
516 stw %r22, 60(%r28) 517 stw %r22, 60(%r28)
517 ldo 64(%r28), %r28 518 ldo 64(%r28), %r28
518 ADDIB> -1, %r1,1b 519 addib,COND(>) -1, %r1,1b
519 ldo 64(%r29), %r29 520 ldo 64(%r29), %r29
520 521
521 bv %r0(%r2) 522 bv %r0(%r2)
@@ -574,7 +575,7 @@ ENTRY(__clear_user_page_asm)
574 std %r0, 104(%r28) 575 std %r0, 104(%r28)
575 std %r0, 112(%r28) 576 std %r0, 112(%r28)
576 std %r0, 120(%r28) 577 std %r0, 120(%r28)
577 ADDIB> -1, %r1, 1b 578 addib,COND(>) -1, %r1, 1b
578 ldo 128(%r28), %r28 579 ldo 128(%r28), %r28
579 580
580#else /* ! CONFIG_64BIT */ 581#else /* ! CONFIG_64BIT */
@@ -597,7 +598,7 @@ ENTRY(__clear_user_page_asm)
597 stw %r0, 52(%r28) 598 stw %r0, 52(%r28)
598 stw %r0, 56(%r28) 599 stw %r0, 56(%r28)
599 stw %r0, 60(%r28) 600 stw %r0, 60(%r28)
600 ADDIB> -1, %r1, 1b 601 addib,COND(>) -1, %r1, 1b
601 ldo 64(%r28), %r28 602 ldo 64(%r28), %r28
602#endif /* CONFIG_64BIT */ 603#endif /* CONFIG_64BIT */
603 604
@@ -640,7 +641,7 @@ ENTRY(flush_kernel_dcache_page_asm)
640 fdc,m %r23(%r26) 641 fdc,m %r23(%r26)
641 fdc,m %r23(%r26) 642 fdc,m %r23(%r26)
642 fdc,m %r23(%r26) 643 fdc,m %r23(%r26)
643 CMPB<< %r26, %r25,1b 644 cmpb,COND(<<) %r26, %r25,1b
644 fdc,m %r23(%r26) 645 fdc,m %r23(%r26)
645 646
646 sync 647 sync
@@ -683,7 +684,7 @@ ENTRY(flush_user_dcache_page)
683 fdc,m %r23(%sr3, %r26) 684 fdc,m %r23(%sr3, %r26)
684 fdc,m %r23(%sr3, %r26) 685 fdc,m %r23(%sr3, %r26)
685 fdc,m %r23(%sr3, %r26) 686 fdc,m %r23(%sr3, %r26)
686 CMPB<< %r26, %r25,1b 687 cmpb,COND(<<) %r26, %r25,1b
687 fdc,m %r23(%sr3, %r26) 688 fdc,m %r23(%sr3, %r26)
688 689
689 sync 690 sync
@@ -726,7 +727,7 @@ ENTRY(flush_user_icache_page)
726 fic,m %r23(%sr3, %r26) 727 fic,m %r23(%sr3, %r26)
727 fic,m %r23(%sr3, %r26) 728 fic,m %r23(%sr3, %r26)
728 fic,m %r23(%sr3, %r26) 729 fic,m %r23(%sr3, %r26)
729 CMPB<< %r26, %r25,1b 730 cmpb,COND(<<) %r26, %r25,1b
730 fic,m %r23(%sr3, %r26) 731 fic,m %r23(%sr3, %r26)
731 732
732 sync 733 sync
@@ -769,7 +770,7 @@ ENTRY(purge_kernel_dcache_page)
769 pdc,m %r23(%r26) 770 pdc,m %r23(%r26)
770 pdc,m %r23(%r26) 771 pdc,m %r23(%r26)
771 pdc,m %r23(%r26) 772 pdc,m %r23(%r26)
772 CMPB<< %r26, %r25, 1b 773 cmpb,COND(<<) %r26, %r25, 1b
773 pdc,m %r23(%r26) 774 pdc,m %r23(%r26)
774 775
775 sync 776 sync
@@ -833,7 +834,7 @@ ENTRY(flush_alias_page)
833 fdc,m %r23(%r28) 834 fdc,m %r23(%r28)
834 fdc,m %r23(%r28) 835 fdc,m %r23(%r28)
835 fdc,m %r23(%r28) 836 fdc,m %r23(%r28)
836 CMPB<< %r28, %r29, 1b 837 cmpb,COND(<<) %r28, %r29, 1b
837 fdc,m %r23(%r28) 838 fdc,m %r23(%r28)
838 839
839 sync 840 sync
@@ -856,7 +857,7 @@ flush_user_dcache_range_asm:
856 ldo -1(%r23), %r21 857 ldo -1(%r23), %r21
857 ANDCM %r26, %r21, %r26 858 ANDCM %r26, %r21, %r26
858 859
8591: CMPB<<,n %r26, %r25, 1b 8601: cmpb,COND(<<),n %r26, %r25, 1b
860 fdc,m %r23(%sr3, %r26) 861 fdc,m %r23(%sr3, %r26)
861 862
862 sync 863 sync
@@ -877,7 +878,7 @@ ENTRY(flush_kernel_dcache_range_asm)
877 ldo -1(%r23), %r21 878 ldo -1(%r23), %r21
878 ANDCM %r26, %r21, %r26 879 ANDCM %r26, %r21, %r26
879 880
8801: CMPB<<,n %r26, %r25,1b 8811: cmpb,COND(<<),n %r26, %r25,1b
881 fdc,m %r23(%r26) 882 fdc,m %r23(%r26)
882 883
883 sync 884 sync
@@ -899,7 +900,7 @@ ENTRY(flush_user_icache_range_asm)
899 ldo -1(%r23), %r21 900 ldo -1(%r23), %r21
900 ANDCM %r26, %r21, %r26 901 ANDCM %r26, %r21, %r26
901 902
9021: CMPB<<,n %r26, %r25,1b 9031: cmpb,COND(<<),n %r26, %r25,1b
903 fic,m %r23(%sr3, %r26) 904 fic,m %r23(%sr3, %r26)
904 905
905 sync 906 sync
@@ -942,7 +943,7 @@ ENTRY(flush_kernel_icache_page)
942 fic,m %r23(%sr4, %r26) 943 fic,m %r23(%sr4, %r26)
943 fic,m %r23(%sr4, %r26) 944 fic,m %r23(%sr4, %r26)
944 fic,m %r23(%sr4, %r26) 945 fic,m %r23(%sr4, %r26)
945 CMPB<< %r26, %r25, 1b 946 cmpb,COND(<<) %r26, %r25, 1b
946 fic,m %r23(%sr4, %r26) 947 fic,m %r23(%sr4, %r26)
947 948
948 sync 949 sync
@@ -963,7 +964,7 @@ ENTRY(flush_kernel_icache_range_asm)
963 ldo -1(%r23), %r21 964 ldo -1(%r23), %r21
964 ANDCM %r26, %r21, %r26 965 ANDCM %r26, %r21, %r26
965 966
9661: CMPB<<,n %r26, %r25, 1b 9671: cmpb,COND(<<),n %r26, %r25, 1b
967 fic,m %r23(%sr4, %r26) 968 fic,m %r23(%sr4, %r26)
968 969
969 sync 970 sync
diff --git a/arch/parisc/kernel/perf_asm.S b/arch/parisc/kernel/perf_asm.S
index 43874ca3ed67..d411dfb5b6d1 100644
--- a/arch/parisc/kernel/perf_asm.S
+++ b/arch/parisc/kernel/perf_asm.S
@@ -20,6 +20,8 @@
20 */ 20 */
21 21
22#include <asm/assembly.h> 22#include <asm/assembly.h>
23
24#include <linux/init.h>
23#include <linux/linkage.h> 25#include <linux/linkage.h>
24 26
25#ifdef CONFIG_64BIT 27#ifdef CONFIG_64BIT
@@ -41,7 +43,7 @@
41; The coprocessor only needs to be enabled when 43; The coprocessor only needs to be enabled when
42; starting/stopping the coprocessor with the pmenb/pmdis. 44; starting/stopping the coprocessor with the pmenb/pmdis.
43; 45;
44 .text 46 __HEAD
45 47
46ENTRY(perf_intrigue_enable_perf_counters) 48ENTRY(perf_intrigue_enable_perf_counters)
47 .proc 49 .proc
diff --git a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S
index 7a92695d95a6..47fbdae6efd5 100644
--- a/arch/parisc/kernel/real2.S
+++ b/arch/parisc/kernel/real2.S
@@ -12,6 +12,7 @@
12#include <asm/assembly.h> 12#include <asm/assembly.h>
13 13
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/init.h>
15 16
16 .section .bss 17 .section .bss
17 .export real_stack 18 .export real_stack
@@ -39,7 +40,7 @@ save_cr_end:
39/************************ 32-bit real-mode calls ***********************/ 40/************************ 32-bit real-mode calls ***********************/
40/* This can be called in both narrow and wide kernels */ 41/* This can be called in both narrow and wide kernels */
41 42
42 .text 43 __HEAD
43 44
44 /* unsigned long real32_call_asm(unsigned int *sp, 45 /* unsigned long real32_call_asm(unsigned int *sp,
45 * unsigned int *arg0p, 46 * unsigned int *arg0p,
@@ -113,7 +114,7 @@ ENDPROC(real32_call_asm)
113# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where) 114# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where)
114# define POP_CR(r, where) LDREG,mb -REG_SZ(where), %r1 ! mtctl %r1, r 115# define POP_CR(r, where) LDREG,mb -REG_SZ(where), %r1 ! mtctl %r1, r
115 116
116 .text 117 __HEAD
117save_control_regs: 118save_control_regs:
118 load32 PA(save_cr_space), %r28 119 load32 PA(save_cr_space), %r28
119 PUSH_CR(%cr24, %r28) 120 PUSH_CR(%cr24, %r28)
@@ -145,7 +146,7 @@ restore_control_regs:
145/* rfi_virt2real() and rfi_real2virt() could perhaps be adapted for 146/* rfi_virt2real() and rfi_real2virt() could perhaps be adapted for
146 * more general-purpose use by the several places which need RFIs 147 * more general-purpose use by the several places which need RFIs
147 */ 148 */
148 .text 149 __HEAD
149 .align 128 150 .align 128
150rfi_virt2real: 151rfi_virt2real:
151 /* switch to real mode... */ 152 /* switch to real mode... */
@@ -180,7 +181,7 @@ rfi_v2r_1:
180 bv 0(%r2) 181 bv 0(%r2)
181 nop 182 nop
182 183
183 .text 184 __HEAD
184 .align 128 185 .align 128
185rfi_real2virt: 186rfi_real2virt:
186 rsm PSW_SM_I,%r0 187 rsm PSW_SM_I,%r0
@@ -218,7 +219,7 @@ rfi_r2v_1:
218 219
219/************************ 64-bit real-mode calls ***********************/ 220/************************ 64-bit real-mode calls ***********************/
220/* This is only usable in wide kernels right now and will probably stay so */ 221/* This is only usable in wide kernels right now and will probably stay so */
221 .text 222 __HEAD
222 /* unsigned long real64_call_asm(unsigned long *sp, 223 /* unsigned long real64_call_asm(unsigned long *sp,
223 * unsigned long *arg0p, 224 * unsigned long *arg0p,
224 * unsigned long fn) 225 * unsigned long fn)
@@ -276,7 +277,7 @@ ENDPROC(real64_call_asm)
276 277
277#endif 278#endif
278 279
279 .text 280 __HEAD
280 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html 281 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html
281 ** GCC 3.3 and later has a new function in libgcc.a for 282 ** GCC 3.3 and later has a new function in libgcc.a for
282 ** comparing function pointers. 283 ** comparing function pointers.
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 69b6eebc466e..ae509d8cd03f 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -17,6 +17,7 @@
17#include <asm/processor.h> 17#include <asm/processor.h>
18 18
19#include <linux/linkage.h> 19#include <linux/linkage.h>
20#include <linux/init.h>
20 21
21 /* We fill the empty parts of the gateway page with 22 /* We fill the empty parts of the gateway page with
22 * something that will kill the kernel or a 23 * something that will kill the kernel or a
@@ -26,7 +27,7 @@
26 27
27 .level LEVEL 28 .level LEVEL
28 29
29 .text 30 __HEAD
30 31
31 .import syscall_exit,code 32 .import syscall_exit,code
32 .import syscall_exit_rfi,code 33 .import syscall_exit_rfi,code
@@ -636,7 +637,7 @@ END(sys_call_table64)
636 All light-weight-syscall atomic operations 637 All light-weight-syscall atomic operations
637 will use this set of locks 638 will use this set of locks
638 */ 639 */
639 .section .data 640 .section .data, "aw"
640 .align PAGE_SIZE 641 .align PAGE_SIZE
641ENTRY(lws_lock_start) 642ENTRY(lws_lock_start)
642 /* lws locks */ 643 /* lws locks */
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 9dc6dc42f9cf..675f1d098f05 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -275,7 +275,7 @@ KERN_CRIT " || ||\n");
275 275
276 /* Wot's wrong wif bein' racy? */ 276 /* Wot's wrong wif bein' racy? */
277 if (current->thread.flags & PARISC_KERNEL_DEATH) { 277 if (current->thread.flags & PARISC_KERNEL_DEATH) {
278 printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__); 278 printk(KERN_CRIT "%s() recursion detected.\n", __func__);
279 local_irq_enable(); 279 local_irq_enable();
280 while (1); 280 while (1);
281 } 281 }
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index aebf3c168871..e6f4b7a4b7e3 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -30,7 +30,7 @@
30/* #define DEBUG_UNALIGNED 1 */ 30/* #define DEBUG_UNALIGNED 1 */
31 31
32#ifdef DEBUG_UNALIGNED 32#ifdef DEBUG_UNALIGNED
33#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __FUNCTION__ ); printk(KERN_DEBUG fmt, ##args ); } while (0) 33#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __func__ ); printk(KERN_DEBUG fmt, ##args ); } while (0)
34#else 34#else
35#define DPRINTF(fmt, args...) 35#define DPRINTF(fmt, args...)
36#endif 36#endif
@@ -460,7 +460,8 @@ void handle_unaligned(struct pt_regs *regs)
460 goto force_sigbus; 460 goto force_sigbus;
461 } 461 }
462 462
463 if (unaligned_count > 5 && jiffies - last_time > 5*HZ) { 463 if (unaligned_count > 5 &&
464 time_after(jiffies, last_time + 5 * HZ)) {
464 unaligned_count = 0; 465 unaligned_count = 0;
465 last_time = jiffies; 466 last_time = jiffies;
466 } 467 }
diff --git a/arch/parisc/lib/fixup.S b/arch/parisc/lib/fixup.S
index d172d4245cdc..4821ad6d5269 100644
--- a/arch/parisc/lib/fixup.S
+++ b/arch/parisc/lib/fixup.S
@@ -23,6 +23,7 @@
23#include <asm/assembly.h> 23#include <asm/assembly.h>
24#include <asm/errno.h> 24#include <asm/errno.h>
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26#include <linux/init.h>
26 27
27#ifdef CONFIG_SMP 28#ifdef CONFIG_SMP
28 .macro get_fault_ip t1 t2 29 .macro get_fault_ip t1 t2
@@ -55,7 +56,7 @@
55 56
56 .level LEVEL 57 .level LEVEL
57 58
58 .text 59 __HEAD
59 .section .fixup, "ax" 60 .section .fixup, "ax"
60 61
61 /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */ 62 /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */
diff --git a/arch/parisc/lib/lusercopy.S b/arch/parisc/lib/lusercopy.S
index 1bd23ccec17b..b0d885350846 100644
--- a/arch/parisc/lib/lusercopy.S
+++ b/arch/parisc/lib/lusercopy.S
@@ -33,11 +33,12 @@
33 */ 33 */
34 34
35 35
36 .text
37
38#include <asm/assembly.h> 36#include <asm/assembly.h>
39#include <asm/errno.h> 37#include <asm/errno.h>
40#include <linux/linkage.h> 38#include <linux/linkage.h>
39#include <linux/init.h>
40
41 __HEAD
41 42
42 /* 43 /*
43 * get_sr gets the appropriate space value into 44 * get_sr gets the appropriate space value into
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index d22042d33100..2d68431fc22e 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -91,7 +91,7 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
91#define THRESHOLD 16 91#define THRESHOLD 16
92 92
93#ifdef DEBUG_MEMCPY 93#ifdef DEBUG_MEMCPY
94#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __FUNCTION__ ); printk(KERN_DEBUG fmt, ##args ); } while (0) 94#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __func__ ); printk(KERN_DEBUG fmt, ##args ); } while (0)
95#else 95#else
96#define DPRINTF(fmt, args...) 96#define DPRINTF(fmt, args...)
97#endif 97#endif
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 1f012843150f..78fe252b92c3 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -555,8 +555,6 @@ void show_mem(void)
555 555
556 printk(KERN_INFO "Mem-info:\n"); 556 printk(KERN_INFO "Mem-info:\n");
557 show_free_areas(); 557 show_free_areas();
558 printk(KERN_INFO "Free swap: %6ldkB\n",
559 nr_swap_pages<<(PAGE_SHIFT-10));
560#ifndef CONFIG_DISCONTIGMEM 558#ifndef CONFIG_DISCONTIGMEM
561 i = max_mapnr; 559 i = max_mapnr;
562 while (i-- > 0) { 560 while (i-- > 0) {
@@ -606,7 +604,7 @@ void show_mem(void)
606 int i, j; 604 int i, j;
607 605
608 for (i = 0; i < npmem_ranges; i++) { 606 for (i = 0; i < npmem_ranges; i++) {
609 zl = node_zonelist(i); 607 zl = node_zonelist(i, 0);
610 for (j = 0; j < MAX_NR_ZONES; j++) { 608 for (j = 0; j < MAX_NR_ZONES; j++) {
611 struct zoneref *z; 609 struct zoneref *z;
612 struct zone *zone; 610 struct zone *zone;
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index eac8e1b59496..1e7802cc31ae 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -268,6 +268,33 @@
268 interrupt-parent = <&ipic>; 268 interrupt-parent = <&ipic>;
269 }; 269 };
270 270
271 dma@82a8 {
272 #address-cells = <1>;
273 #size-cells = <1>;
274 compatible = "fsl,mpc8349-dma";
275 reg = <0x82a8 4>;
276 ranges = <0 0x8100 0x1a8>;
277 interrupt-parent = <&ipic>;
278 interrupts = <0x47 8>;
279 cell-index = <0>;
280 dma-channel@0 {
281 compatible = "fsl,mpc8349-dma-channel";
282 reg = <0 0x80>;
283 };
284 dma-channel@80 {
285 compatible = "fsl,mpc8349-dma-channel";
286 reg = <0x80 0x80>;
287 };
288 dma-channel@100 {
289 compatible = "fsl,mpc8349-dma-channel";
290 reg = <0x100 0x80>;
291 };
292 dma-channel@180 {
293 compatible = "fsl,mpc8349-dma-channel";
294 reg = <0x180 0x28>;
295 };
296 };
297
271 /* IPIC 298 /* IPIC
272 * interrupts cell = <intr #, sense> 299 * interrupts cell = <intr #, sense>
273 * sense values match linux IORESOURCE_IRQ_* defines: 300 * sense values match linux IORESOURCE_IRQ_* defines:
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index bba234eb14a9..08a780d89807 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -46,9 +46,63 @@
46 reg = <0x00000000 0x20000000>; // 512M at 0x0 46 reg = <0x00000000 0x20000000>; // 512M at 0x0
47 }; 47 };
48 48
49 board-control@e8000000 { 49 localbus@e0005000 {
50 compatible = "fsl,fpga-pixis"; 50 #address-cells = <2>;
51 reg = <0xe8000000 32>; // pixis at 0xe8000000 51 #size-cells = <1>;
52 compatible = "fsl,mpc8610-elbc", "fsl,elbc", "simple-bus";
53 reg = <0xe0005000 0x1000>;
54 interrupts = <19 2>;
55 interrupt-parent = <&mpic>;
56 ranges = <0 0 0xf8000000 0x08000000
57 1 0 0xf0000000 0x08000000
58 2 0 0xe8400000 0x00008000
59 4 0 0xe8440000 0x00008000
60 5 0 0xe8480000 0x00008000
61 6 0 0xe84c0000 0x00008000
62 3 0 0xe8000000 0x00000020>;
63
64 flash@0,0 {
65 compatible = "cfi-flash";
66 reg = <0 0 0x8000000>;
67 bank-width = <2>;
68 device-width = <1>;
69 };
70
71 flash@1,0 {
72 compatible = "cfi-flash";
73 reg = <1 0 0x8000000>;
74 bank-width = <2>;
75 device-width = <1>;
76 };
77
78 flash@2,0 {
79 compatible = "fsl,mpc8610-fcm-nand",
80 "fsl,elbc-fcm-nand";
81 reg = <2 0 0x8000>;
82 };
83
84 flash@4,0 {
85 compatible = "fsl,mpc8610-fcm-nand",
86 "fsl,elbc-fcm-nand";
87 reg = <4 0 0x8000>;
88 };
89
90 flash@5,0 {
91 compatible = "fsl,mpc8610-fcm-nand",
92 "fsl,elbc-fcm-nand";
93 reg = <5 0 0x8000>;
94 };
95
96 flash@6,0 {
97 compatible = "fsl,mpc8610-fcm-nand",
98 "fsl,elbc-fcm-nand";
99 reg = <6 0 0x8000>;
100 };
101
102 board-control@3,0 {
103 compatible = "fsl,fpga-pixis";
104 reg = <3 0 0x20>;
105 };
52 }; 106 };
53 107
54 soc@e0000000 { 108 soc@e0000000 {
diff --git a/arch/powerpc/boot/dts/sbc8548.dts b/arch/powerpc/boot/dts/sbc8548.dts
index b86e65d926c1..22d967178fe9 100644
--- a/arch/powerpc/boot/dts/sbc8548.dts
+++ b/arch/powerpc/boot/dts/sbc8548.dts
@@ -52,6 +52,99 @@
52 reg = <0x00000000 0x10000000>; 52 reg = <0x00000000 0x10000000>;
53 }; 53 };
54 54
55 localbus@e0000000 {
56 #address-cells = <2>;
57 #size-cells = <1>;
58 compatible = "simple-bus";
59 reg = <0xe0000000 0x5000>;
60 interrupt-parent = <&mpic>;
61
62 ranges = <0x0 0x0 0xff800000 0x00800000 /*8MB Flash*/
63 0x3 0x0 0xf0000000 0x04000000 /*64MB SDRAM*/
64 0x4 0x0 0xf4000000 0x04000000 /*64MB SDRAM*/
65 0x5 0x0 0xf8000000 0x00b10000 /* EPLD */
66 0x6 0x0 0xfb800000 0x04000000>; /*64MB Flash*/
67
68
69 flash@0,0 {
70 #address-cells = <1>;
71 #size-cells = <1>;
72 compatible = "cfi-flash";
73 reg = <0x0 0x0 0x800000>;
74 bank-width = <1>;
75 device-width = <1>;
76 partition@0x0 {
77 label = "space";
78 reg = <0x00000000 0x00100000>;
79 };
80 partition@0x100000 {
81 label = "bootloader";
82 reg = <0x00100000 0x00700000>;
83 read-only;
84 };
85 };
86
87 epld@5,0 {
88 compatible = "wrs,epld-localbus";
89 #address-cells = <2>;
90 #size-cells = <1>;
91 reg = <0x5 0x0 0x00b10000>;
92 ranges = <
93 0x0 0x0 0x5 0x000000 0x1fff /* LED */
94 0x1 0x0 0x5 0x100000 0x1fff /* Switches */
95 0x3 0x0 0x5 0x300000 0x1fff /* HW Rev. */
96 0xb 0x0 0x5 0xb00000 0x1fff /* EEPROM */
97 >;
98
99 led@0,0 {
100 compatible = "led";
101 reg = <0x0 0x0 0x1fff>;
102 };
103
104 switches@1,0 {
105 compatible = "switches";
106 reg = <0x1 0x0 0x1fff>;
107 };
108
109 hw-rev@3,0 {
110 compatible = "hw-rev";
111 reg = <0x3 0x0 0x1fff>;
112 };
113
114 eeprom@b,0 {
115 compatible = "eeprom";
116 reg = <0xb 0 0x1fff>;
117 };
118
119 };
120
121 alt-flash@6,0 {
122 #address-cells = <1>;
123 #size-cells = <1>;
124 reg = <0x6 0x0 0x04000000>;
125 compatible = "cfi-flash";
126 bank-width = <4>;
127 device-width = <1>;
128 partition@0x0 {
129 label = "bootloader";
130 reg = <0x00000000 0x00100000>;
131 read-only;
132 };
133 partition@0x00100000 {
134 label = "file-system";
135 reg = <0x00100000 0x01f00000>;
136 };
137 partition@0x02000000 {
138 label = "boot-config";
139 reg = <0x02000000 0x00100000>;
140 };
141 partition@0x02100000 {
142 label = "space";
143 reg = <0x02100000 0x01f00000>;
144 };
145 };
146 };
147
55 soc8548@e0000000 { 148 soc8548@e0000000 {
56 #address-cells = <1>; 149 #address-cells = <1>;
57 #size-cells = <1>; 150 #size-cells = <1>;
@@ -59,6 +152,7 @@
59 ranges = <0x00000000 0xe0000000 0x00100000>; 152 ranges = <0x00000000 0xe0000000 0x00100000>;
60 reg = <0xe0000000 0x00001000>; // CCSRBAR 153 reg = <0xe0000000 0x00001000>; // CCSRBAR
61 bus-frequency = <0>; 154 bus-frequency = <0>;
155 compatible = "simple-bus";
62 156
63 memory-controller@2000 { 157 memory-controller@2000 {
64 compatible = "fsl,8548-memory-controller"; 158 compatible = "fsl,8548-memory-controller";
diff --git a/arch/powerpc/configs/mpc8610_hpcd_defconfig b/arch/powerpc/configs/mpc8610_hpcd_defconfig
index 9270afe7594d..7e5b9ce58d89 100644
--- a/arch/powerpc/configs/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/mpc8610_hpcd_defconfig
@@ -358,7 +358,93 @@ CONFIG_FW_LOADER=y
358# CONFIG_DEBUG_DEVRES is not set 358# CONFIG_DEBUG_DEVRES is not set
359# CONFIG_SYS_HYPERVISOR is not set 359# CONFIG_SYS_HYPERVISOR is not set
360# CONFIG_CONNECTOR is not set 360# CONFIG_CONNECTOR is not set
361# CONFIG_MTD is not set 361CONFIG_MTD=y
362# CONFIG_MTD_DEBUG is not set
363# CONFIG_MTD_CONCAT is not set
364CONFIG_MTD_PARTITIONS=y
365# CONFIG_MTD_REDBOOT_PARTS is not set
366CONFIG_MTD_CMDLINE_PARTS=y
367# CONFIG_MTD_OF_PARTS is not set
368# CONFIG_MTD_AR7_PARTS is not set
369
370#
371# User Modules And Translation Layers
372#
373CONFIG_MTD_CHAR=y
374CONFIG_MTD_BLKDEVS=y
375CONFIG_MTD_BLOCK=y
376# CONFIG_FTL is not set
377# CONFIG_NFTL is not set
378# CONFIG_INFTL is not set
379# CONFIG_RFD_FTL is not set
380# CONFIG_SSFDC is not set
381# CONFIG_MTD_OOPS is not set
382
383#
384# RAM/ROM/Flash chip drivers
385#
386CONFIG_MTD_CFI=y
387# CONFIG_MTD_JEDECPROBE is not set
388CONFIG_MTD_GEN_PROBE=y
389# CONFIG_MTD_CFI_ADV_OPTIONS is not set
390CONFIG_MTD_MAP_BANK_WIDTH_1=y
391CONFIG_MTD_MAP_BANK_WIDTH_2=y
392CONFIG_MTD_MAP_BANK_WIDTH_4=y
393# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
394# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
395# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
396CONFIG_MTD_CFI_I1=y
397CONFIG_MTD_CFI_I2=y
398# CONFIG_MTD_CFI_I4 is not set
399# CONFIG_MTD_CFI_I8 is not set
400# CONFIG_MTD_CFI_INTELEXT is not set
401CONFIG_MTD_CFI_AMDSTD=y
402# CONFIG_MTD_CFI_STAA is not set
403CONFIG_MTD_CFI_UTIL=y
404# CONFIG_MTD_RAM is not set
405# CONFIG_MTD_ROM is not set
406# CONFIG_MTD_ABSENT is not set
407
408#
409# Mapping drivers for chip access
410#
411# CONFIG_MTD_COMPLEX_MAPPINGS is not set
412# CONFIG_MTD_PHYSMAP is not set
413CONFIG_MTD_PHYSMAP_OF=y
414# CONFIG_MTD_INTEL_VR_NOR is not set
415# CONFIG_MTD_PLATRAM is not set
416
417#
418# Self-contained MTD device drivers
419#
420# CONFIG_MTD_PMC551 is not set
421# CONFIG_MTD_SLRAM is not set
422# CONFIG_MTD_PHRAM is not set
423# CONFIG_MTD_MTDRAM is not set
424# CONFIG_MTD_BLOCK2MTD is not set
425
426#
427# Disk-On-Chip Device Drivers
428#
429# CONFIG_MTD_DOC2000 is not set
430# CONFIG_MTD_DOC2001 is not set
431# CONFIG_MTD_DOC2001PLUS is not set
432CONFIG_MTD_NAND=y
433# CONFIG_MTD_NAND_VERIFY_WRITE is not set
434# CONFIG_MTD_NAND_ECC_SMC is not set
435# CONFIG_MTD_NAND_MUSEUM_IDS is not set
436CONFIG_MTD_NAND_IDS=y
437# CONFIG_MTD_NAND_DISKONCHIP is not set
438# CONFIG_MTD_NAND_CAFE is not set
439# CONFIG_MTD_NAND_NANDSIM is not set
440# CONFIG_MTD_NAND_PLATFORM is not set
441CONFIG_MTD_NAND_FSL_ELBC=y
442# CONFIG_MTD_ONENAND is not set
443
444#
445# UBI - Unsorted block images
446#
447# CONFIG_MTD_UBI is not set
362CONFIG_OF_DEVICE=y 448CONFIG_OF_DEVICE=y
363# CONFIG_PARPORT is not set 449# CONFIG_PARPORT is not set
364CONFIG_BLK_DEV=y 450CONFIG_BLK_DEV=y
@@ -567,14 +653,11 @@ CONFIG_MII=y
567# CONFIG_NET_VENDOR_3COM is not set 653# CONFIG_NET_VENDOR_3COM is not set
568CONFIG_NET_TULIP=y 654CONFIG_NET_TULIP=y
569# CONFIG_DE2104X is not set 655# CONFIG_DE2104X is not set
570CONFIG_TULIP=y 656# CONFIG_TULIP is not set
571# CONFIG_TULIP_MWI is not set
572CONFIG_TULIP_MMIO=y
573# CONFIG_TULIP_NAPI is not set
574# CONFIG_DE4X5 is not set 657# CONFIG_DE4X5 is not set
575# CONFIG_WINBOND_840 is not set 658# CONFIG_WINBOND_840 is not set
576# CONFIG_DM9102 is not set 659# CONFIG_DM9102 is not set
577# CONFIG_ULI526X is not set 660CONFIG_ULI526X=y
578# CONFIG_HP100 is not set 661# CONFIG_HP100 is not set
579# CONFIG_IBM_NEW_EMAC_ZMII is not set 662# CONFIG_IBM_NEW_EMAC_ZMII is not set
580# CONFIG_IBM_NEW_EMAC_RGMII is not set 663# CONFIG_IBM_NEW_EMAC_RGMII is not set
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index d14cebf62bb0..2346d271fbfd 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -105,6 +105,9 @@ PHONY += systbl_chk
105systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i 105systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
106 $(call cmd,systbl_chk) 106 $(call cmd,systbl_chk)
107 107
108
109ifeq ($(CONFIG_PPC_MERGE),y)
110
108$(obj)/built-in.o: prom_init_check 111$(obj)/built-in.o: prom_init_check
109 112
110quiet_cmd_prom_init_check = CALL $< 113quiet_cmd_prom_init_check = CALL $<
@@ -114,4 +117,7 @@ PHONY += prom_init_check
114prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o 117prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o
115 $(call cmd,prom_init_check) 118 $(call cmd,prom_init_check)
116 119
120endif
121
122
117clean-files := vmlinux.lds 123clean-files := vmlinux.lds
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 81738a4b3c3a..e44d5530f0a6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1484,6 +1484,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1484 .dcache_bsize = 32, 1484 .dcache_bsize = 32,
1485 .machine_check = machine_check_e200, 1485 .machine_check = machine_check_e200,
1486 .platform = "ppc5554", 1486 .platform = "ppc5554",
1487 }
1487#endif /* CONFIG_E200 */ 1488#endif /* CONFIG_E200 */
1488#ifdef CONFIG_E500 1489#ifdef CONFIG_E500
1489 { /* e500 */ 1490 { /* e500 */
@@ -1533,6 +1534,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1533 .dcache_bsize = 32, 1534 .dcache_bsize = 32,
1534 .machine_check = machine_check_e500, 1535 .machine_check = machine_check_e500,
1535 .platform = "powerpc", 1536 .platform = "powerpc",
1537 }
1536#endif /* CONFIG_E500 */ 1538#endif /* CONFIG_E500 */
1537#endif /* CONFIG_PPC32 */ 1539#endif /* CONFIG_PPC32 */
1538}; 1540};
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index f1d2cdc5331b..c71d37dc6a88 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -10,6 +10,7 @@ ifeq ($(CONFIG_PPC_MERGE),y)
10obj-y := string.o alloc.o \ 10obj-y := string.o alloc.o \
11 checksum_$(CONFIG_WORD_SIZE).o 11 checksum_$(CONFIG_WORD_SIZE).o
12obj-$(CONFIG_PPC32) += div64.o copy_32.o 12obj-$(CONFIG_PPC32) += div64.o copy_32.o
13obj-$(CONFIG_HAS_IOMEM) += devres.o
13endif 14endif
14 15
15obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ 16obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
@@ -23,4 +24,3 @@ obj-$(CONFIG_SMP) += locks.o
23endif 24endif
24 25
25obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o 26obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
26obj-$(CONFIG_HAS_IOMEM) += devres.o
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 2b5a399f6fa6..0f2d239d94c4 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -94,6 +94,9 @@ unsigned long htab_hash_mask;
94int mmu_linear_psize = MMU_PAGE_4K; 94int mmu_linear_psize = MMU_PAGE_4K;
95int mmu_virtual_psize = MMU_PAGE_4K; 95int mmu_virtual_psize = MMU_PAGE_4K;
96int mmu_vmalloc_psize = MMU_PAGE_4K; 96int mmu_vmalloc_psize = MMU_PAGE_4K;
97#ifdef CONFIG_SPARSEMEM_VMEMMAP
98int mmu_vmemmap_psize = MMU_PAGE_4K;
99#endif
97int mmu_io_psize = MMU_PAGE_4K; 100int mmu_io_psize = MMU_PAGE_4K;
98int mmu_kernel_ssize = MMU_SEGSIZE_256M; 101int mmu_kernel_ssize = MMU_SEGSIZE_256M;
99int mmu_highuser_ssize = MMU_SEGSIZE_256M; 102int mmu_highuser_ssize = MMU_SEGSIZE_256M;
@@ -387,11 +390,32 @@ static void __init htab_init_page_sizes(void)
387 } 390 }
388#endif /* CONFIG_PPC_64K_PAGES */ 391#endif /* CONFIG_PPC_64K_PAGES */
389 392
393#ifdef CONFIG_SPARSEMEM_VMEMMAP
394 /* We try to use 16M pages for vmemmap if that is supported
395 * and we have at least 1G of RAM at boot
396 */
397 if (mmu_psize_defs[MMU_PAGE_16M].shift &&
398 lmb_phys_mem_size() >= 0x40000000)
399 mmu_vmemmap_psize = MMU_PAGE_16M;
400 else if (mmu_psize_defs[MMU_PAGE_64K].shift)
401 mmu_vmemmap_psize = MMU_PAGE_64K;
402 else
403 mmu_vmemmap_psize = MMU_PAGE_4K;
404#endif /* CONFIG_SPARSEMEM_VMEMMAP */
405
390 printk(KERN_DEBUG "Page orders: linear mapping = %d, " 406 printk(KERN_DEBUG "Page orders: linear mapping = %d, "
391 "virtual = %d, io = %d\n", 407 "virtual = %d, io = %d"
408#ifdef CONFIG_SPARSEMEM_VMEMMAP
409 ", vmemmap = %d"
410#endif
411 "\n",
392 mmu_psize_defs[mmu_linear_psize].shift, 412 mmu_psize_defs[mmu_linear_psize].shift,
393 mmu_psize_defs[mmu_virtual_psize].shift, 413 mmu_psize_defs[mmu_virtual_psize].shift,
394 mmu_psize_defs[mmu_io_psize].shift); 414 mmu_psize_defs[mmu_io_psize].shift
415#ifdef CONFIG_SPARSEMEM_VMEMMAP
416 ,mmu_psize_defs[mmu_vmemmap_psize].shift
417#endif
418 );
395 419
396#ifdef CONFIG_HUGETLB_PAGE 420#ifdef CONFIG_HUGETLB_PAGE
397 /* Init large page size. Currently, we pick 16M or 1M depending 421 /* Init large page size. Currently, we pick 16M or 1M depending
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index c5ac532a0161..6aa65375abf5 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -19,6 +19,8 @@
19 * 19 *
20 */ 20 */
21 21
22#undef DEBUG
23
22#include <linux/signal.h> 24#include <linux/signal.h>
23#include <linux/sched.h> 25#include <linux/sched.h>
24#include <linux/kernel.h> 26#include <linux/kernel.h>
@@ -208,12 +210,12 @@ int __meminit vmemmap_populated(unsigned long start, int page_size)
208} 210}
209 211
210int __meminit vmemmap_populate(struct page *start_page, 212int __meminit vmemmap_populate(struct page *start_page,
211 unsigned long nr_pages, int node) 213 unsigned long nr_pages, int node)
212{ 214{
213 unsigned long mode_rw; 215 unsigned long mode_rw;
214 unsigned long start = (unsigned long)start_page; 216 unsigned long start = (unsigned long)start_page;
215 unsigned long end = (unsigned long)(start_page + nr_pages); 217 unsigned long end = (unsigned long)(start_page + nr_pages);
216 unsigned long page_size = 1 << mmu_psize_defs[mmu_linear_psize].shift; 218 unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
217 219
218 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX; 220 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
219 221
@@ -235,11 +237,11 @@ int __meminit vmemmap_populate(struct page *start_page,
235 start, p, __pa(p)); 237 start, p, __pa(p));
236 238
237 mapped = htab_bolt_mapping(start, start + page_size, 239 mapped = htab_bolt_mapping(start, start + page_size,
238 __pa(p), mode_rw, mmu_linear_psize, 240 __pa(p), mode_rw, mmu_vmemmap_psize,
239 mmu_kernel_ssize); 241 mmu_kernel_ssize);
240 BUG_ON(mapped < 0); 242 BUG_ON(mapped < 0);
241 } 243 }
242 244
243 return 0; 245 return 0;
244} 246}
245#endif 247#endif /* CONFIG_SPARSEMEM_VMEMMAP */
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index cf8705e32d60..89497fb04280 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -28,7 +28,7 @@
28#include <asm/udbg.h> 28#include <asm/udbg.h>
29 29
30#ifdef DEBUG 30#ifdef DEBUG
31#define DBG(fmt...) udbg_printf(fmt) 31#define DBG(fmt...) printk(fmt)
32#else 32#else
33#define DBG pr_debug 33#define DBG pr_debug
34#endif 34#endif
@@ -263,13 +263,19 @@ void slb_initialize(void)
263 extern unsigned int *slb_miss_kernel_load_linear; 263 extern unsigned int *slb_miss_kernel_load_linear;
264 extern unsigned int *slb_miss_kernel_load_io; 264 extern unsigned int *slb_miss_kernel_load_io;
265 extern unsigned int *slb_compare_rr_to_size; 265 extern unsigned int *slb_compare_rr_to_size;
266#ifdef CONFIG_SPARSEMEM_VMEMMAP
267 extern unsigned int *slb_miss_kernel_load_vmemmap;
268 unsigned long vmemmap_llp;
269#endif
266 270
267 /* Prepare our SLB miss handler based on our page size */ 271 /* Prepare our SLB miss handler based on our page size */
268 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; 272 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
269 io_llp = mmu_psize_defs[mmu_io_psize].sllp; 273 io_llp = mmu_psize_defs[mmu_io_psize].sllp;
270 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp; 274 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp;
271 get_paca()->vmalloc_sllp = SLB_VSID_KERNEL | vmalloc_llp; 275 get_paca()->vmalloc_sllp = SLB_VSID_KERNEL | vmalloc_llp;
272 276#ifdef CONFIG_SPARSEMEM_VMEMMAP
277 vmemmap_llp = mmu_psize_defs[mmu_vmemmap_psize].sllp;
278#endif
273 if (!slb_encoding_inited) { 279 if (!slb_encoding_inited) {
274 slb_encoding_inited = 1; 280 slb_encoding_inited = 1;
275 patch_slb_encoding(slb_miss_kernel_load_linear, 281 patch_slb_encoding(slb_miss_kernel_load_linear,
@@ -281,6 +287,12 @@ void slb_initialize(void)
281 287
282 DBG("SLB: linear LLP = %04lx\n", linear_llp); 288 DBG("SLB: linear LLP = %04lx\n", linear_llp);
283 DBG("SLB: io LLP = %04lx\n", io_llp); 289 DBG("SLB: io LLP = %04lx\n", io_llp);
290
291#ifdef CONFIG_SPARSEMEM_VMEMMAP
292 patch_slb_encoding(slb_miss_kernel_load_vmemmap,
293 SLB_VSID_KERNEL | vmemmap_llp);
294 DBG("SLB: vmemmap LLP = %04lx\n", vmemmap_llp);
295#endif
284 } 296 }
285 297
286 get_paca()->stab_rr = SLB_NUM_BOLTED; 298 get_paca()->stab_rr = SLB_NUM_BOLTED;
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index 657f6b37e9df..bc44dc4b5c67 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -47,8 +47,7 @@ _GLOBAL(slb_allocate_realmode)
47 * it to VSID 0, which is reserved as a bad VSID - one which 47 * it to VSID 0, which is reserved as a bad VSID - one which
48 * will never have any pages in it. */ 48 * will never have any pages in it. */
49 49
50 /* Check if hitting the linear mapping of the vmalloc/ioremap 50 /* Check if hitting the linear mapping or some other kernel space
51 * kernel space
52 */ 51 */
53 bne cr7,1f 52 bne cr7,1f
54 53
@@ -62,7 +61,18 @@ BEGIN_FTR_SECTION
62END_FTR_SECTION_IFCLR(CPU_FTR_1T_SEGMENT) 61END_FTR_SECTION_IFCLR(CPU_FTR_1T_SEGMENT)
63 b slb_finish_load_1T 62 b slb_finish_load_1T
64 63
651: /* vmalloc/ioremap mapping encoding bits, the "li" instructions below 641:
65#ifdef CONFIG_SPARSEMEM_VMEMMAP
66 /* Check virtual memmap region. To be patches at kernel boot */
67 cmpldi cr0,r9,0xf
68 bne 1f
69_GLOBAL(slb_miss_kernel_load_vmemmap)
70 li r11,0
71 b 6f
721:
73#endif /* CONFIG_SPARSEMEM_VMEMMAP */
74
75 /* vmalloc/ioremap mapping encoding bits, the "li" instructions below
66 * will be patched by the kernel at boot 76 * will be patched by the kernel at boot
67 */ 77 */
68BEGIN_FTR_SECTION 78BEGIN_FTR_SECTION
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 25f8bc75e838..43a459f63e31 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -32,6 +32,7 @@
32#include <linux/fsl_devices.h> 32#include <linux/fsl_devices.h>
33#include <linux/of_platform.h> 33#include <linux/of_platform.h>
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35#include <linux/phy.h>
35 36
36#include <asm/system.h> 37#include <asm/system.h>
37#include <asm/atomic.h> 38#include <asm/atomic.h>
@@ -56,6 +57,95 @@
56#define DBG(fmt...) 57#define DBG(fmt...)
57#endif 58#endif
58 59
60#define MV88E1111_SCR 0x10
61#define MV88E1111_SCR_125CLK 0x0010
62static int mpc8568_fixup_125_clock(struct phy_device *phydev)
63{
64 int scr;
65 int err;
66
67 /* Workaround for the 125 CLK Toggle */
68 scr = phy_read(phydev, MV88E1111_SCR);
69
70 if (scr < 0)
71 return scr;
72
73 err = phy_write(phydev, MV88E1111_SCR, scr & ~(MV88E1111_SCR_125CLK));
74
75 if (err)
76 return err;
77
78 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
79
80 if (err)
81 return err;
82
83 scr = phy_read(phydev, MV88E1111_SCR);
84
85 if (scr < 0)
86 return err;
87
88 err = phy_write(phydev, MV88E1111_SCR, scr | 0x0008);
89
90 return err;
91}
92
93static int mpc8568_mds_phy_fixups(struct phy_device *phydev)
94{
95 int temp;
96 int err;
97
98 /* Errata */
99 err = phy_write(phydev,29, 0x0006);
100
101 if (err)
102 return err;
103
104 temp = phy_read(phydev, 30);
105
106 if (temp < 0)
107 return temp;
108
109 temp = (temp & (~0x8000)) | 0x4000;
110 err = phy_write(phydev,30, temp);
111
112 if (err)
113 return err;
114
115 err = phy_write(phydev,29, 0x000a);
116
117 if (err)
118 return err;
119
120 temp = phy_read(phydev, 30);
121
122 if (temp < 0)
123 return temp;
124
125 temp = phy_read(phydev, 30);
126
127 if (temp < 0)
128 return temp;
129
130 temp &= ~0x0020;
131
132 err = phy_write(phydev,30,temp);
133
134 if (err)
135 return err;
136
137 /* Disable automatic MDI/MDIX selection */
138 temp = phy_read(phydev, 16);
139
140 if (temp < 0)
141 return temp;
142
143 temp &= ~0x0060;
144 err = phy_write(phydev,16,temp);
145
146 return err;
147}
148
59/* ************************************************************************ 149/* ************************************************************************
60 * 150 *
61 * Setup the architecture 151 * Setup the architecture
@@ -64,7 +154,7 @@
64static void __init mpc85xx_mds_setup_arch(void) 154static void __init mpc85xx_mds_setup_arch(void)
65{ 155{
66 struct device_node *np; 156 struct device_node *np;
67 static u8 *bcsr_regs = NULL; 157 static u8 __iomem *bcsr_regs = NULL;
68 158
69 if (ppc_md.progress) 159 if (ppc_md.progress)
70 ppc_md.progress("mpc85xx_mds_setup_arch()", 0); 160 ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
@@ -138,6 +228,35 @@ static void __init mpc85xx_mds_setup_arch(void)
138#endif /* CONFIG_QUICC_ENGINE */ 228#endif /* CONFIG_QUICC_ENGINE */
139} 229}
140 230
231
232static int __init board_fixups(void)
233{
234 char phy_id[BUS_ID_SIZE];
235 char *compstrs[2] = {"fsl,gianfar-mdio", "fsl,ucc-mdio"};
236 struct device_node *mdio;
237 struct resource res;
238 int i;
239
240 for (i = 0; i < ARRAY_SIZE(compstrs); i++) {
241 mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
242
243 of_address_to_resource(mdio, 0, &res);
244 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1);
245
246 phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock);
247 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
248
249 /* Register a workaround for errata */
250 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 7);
251 phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
252
253 of_node_put(mdio);
254 }
255
256 return 0;
257}
258machine_arch_initcall(mpc85xx_mds, board_fixups);
259
141static struct of_device_id mpc85xx_ids[] = { 260static struct of_device_id mpc85xx_ids[] = {
142 { .type = "soc", }, 261 { .type = "soc", },
143 { .compatible = "soc", }, 262 { .compatible = "soc", },
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index 488facb99fe8..b9246ea0928a 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -49,6 +49,8 @@
49#include <sysdev/fsl_soc.h> 49#include <sysdev/fsl_soc.h>
50#include <sysdev/fsl_pci.h> 50#include <sysdev/fsl_pci.h>
51 51
52static int sbc_rev;
53
52static void __init sbc8548_pic_init(void) 54static void __init sbc8548_pic_init(void)
53{ 55{
54 struct mpic *mpic; 56 struct mpic *mpic;
@@ -79,6 +81,30 @@ static void __init sbc8548_pic_init(void)
79 mpic_init(mpic); 81 mpic_init(mpic);
80} 82}
81 83
84/* Extract the HW Rev from the EPLD on the board */
85static int __init sbc8548_hw_rev(void)
86{
87 struct device_node *np;
88 struct resource res;
89 unsigned int *rev;
90 int board_rev = 0;
91
92 np = of_find_compatible_node(NULL, NULL, "hw-rev");
93 if (np == NULL) {
94 printk("No HW-REV found in DTB.\n");
95 return -ENODEV;
96 }
97
98 of_address_to_resource(np, 0, &res);
99 of_node_put(np);
100
101 rev = ioremap(res.start,sizeof(unsigned int));
102 board_rev = (*rev) >> 28;
103 iounmap(rev);
104
105 return board_rev;
106}
107
82/* 108/*
83 * Setup the architecture 109 * Setup the architecture
84 */ 110 */
@@ -104,6 +130,7 @@ static void __init sbc8548_setup_arch(void)
104 } 130 }
105 } 131 }
106#endif 132#endif
133 sbc_rev = sbc8548_hw_rev();
107} 134}
108 135
109static void sbc8548_show_cpuinfo(struct seq_file *m) 136static void sbc8548_show_cpuinfo(struct seq_file *m)
@@ -115,7 +142,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
115 svid = mfspr(SPRN_SVR); 142 svid = mfspr(SPRN_SVR);
116 143
117 seq_printf(m, "Vendor\t\t: Wind River\n"); 144 seq_printf(m, "Vendor\t\t: Wind River\n");
118 seq_printf(m, "Machine\t\t: SBC8548\n"); 145 seq_printf(m, "Machine\t\t: SBC8548 v%d\n", sbc_rev);
119 seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 146 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
120 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 147 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
121 148
@@ -130,6 +157,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
130static struct of_device_id __initdata of_bus_ids[] = { 157static struct of_device_id __initdata of_bus_ids[] = {
131 { .name = "soc", }, 158 { .name = "soc", },
132 { .type = "soc", }, 159 { .type = "soc", },
160 { .compatible = "simple-bus", },
133 {}, 161 {},
134}; 162};
135 163
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 5e1e8cf14e75..dea13208bf64 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -43,6 +43,7 @@ static unsigned char *pixis_bdcfg0, *pixis_arch;
43 43
44static struct of_device_id __initdata mpc8610_ids[] = { 44static struct of_device_id __initdata mpc8610_ids[] = {
45 { .compatible = "fsl,mpc8610-immr", }, 45 { .compatible = "fsl,mpc8610-immr", },
46 { .compatible = "simple-bus", },
46 {} 47 {}
47}; 48};
48 49
@@ -216,11 +217,21 @@ void mpc8610hpcd_set_gamma_table(int monitor_port, char *gamma_table_base)
216 } 217 }
217} 218}
218 219
220#define PX_BRDCFG0_DVISEL (1 << 3)
221#define PX_BRDCFG0_DLINK (1 << 4)
222#define PX_BRDCFG0_DIU_MASK (PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK)
223
219void mpc8610hpcd_set_monitor_port(int monitor_port) 224void mpc8610hpcd_set_monitor_port(int monitor_port)
220{ 225{
221 static const u8 bdcfg[] = {0xBD, 0xB5, 0xA5}; 226 static const u8 bdcfg[] = {
227 PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK,
228 PX_BRDCFG0_DLINK,
229 0,
230 };
231
222 if (monitor_port < 3) 232 if (monitor_port < 3)
223 *pixis_bdcfg0 = bdcfg[monitor_port]; 233 clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK,
234 bdcfg[monitor_port]);
224} 235}
225 236
226void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) 237void mpc8610hpcd_set_pixel_clock(unsigned int pixclock)
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 3b84e8be314c..b5f84e8f0899 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -118,7 +118,7 @@ static void iowa_##name at \
118#undef DEF_PCI_AC_RET 118#undef DEF_PCI_AC_RET
119#undef DEF_PCI_AC_NORET 119#undef DEF_PCI_AC_NORET
120 120
121static struct ppc_pci_io __initdata iowa_pci_io = { 121static const struct ppc_pci_io __devinitconst iowa_pci_io = {
122 122
123#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) .name = iowa_##name, 123#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) .name = iowa_##name,
124#define DEF_PCI_AC_NORET(name, at, al, space, aa) .name = iowa_##name, 124#define DEF_PCI_AC_NORET(name, at, al, space, aa) .name = iowa_##name,
@@ -146,7 +146,7 @@ static void __iomem *iowa_ioremap(unsigned long addr, unsigned long size,
146} 146}
147 147
148/* Regist new bus to support workaround */ 148/* Regist new bus to support workaround */
149void __init iowa_register_bus(struct pci_controller *phb, 149void __devinit iowa_register_bus(struct pci_controller *phb,
150 struct ppc_pci_io *ops, 150 struct ppc_pci_io *ops,
151 int (*initfunc)(struct iowa_bus *, void *), void *data) 151 int (*initfunc)(struct iowa_bus *, void *), void *data)
152{ 152{
@@ -173,7 +173,7 @@ void __init iowa_register_bus(struct pci_controller *phb,
173} 173}
174 174
175/* enable IO workaround */ 175/* enable IO workaround */
176void __init io_workaround_init(void) 176void __devinit io_workaround_init(void)
177{ 177{
178 static int io_workaround_inited; 178 static int io_workaround_inited;
179 179
diff --git a/arch/powerpc/platforms/cell/io-workarounds.h b/arch/powerpc/platforms/cell/io-workarounds.h
index 79d8ed3d510f..6efc7782ebf2 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.h
+++ b/arch/powerpc/platforms/cell/io-workarounds.h
@@ -31,9 +31,9 @@ struct iowa_bus {
31 void *private; 31 void *private;
32}; 32};
33 33
34void __init io_workaround_init(void); 34void __devinit io_workaround_init(void);
35void __init iowa_register_bus(struct pci_controller *, struct ppc_pci_io *, 35void __devinit iowa_register_bus(struct pci_controller *, struct ppc_pci_io *,
36 int (*)(struct iowa_bus *, void *), void *); 36 int (*)(struct iowa_bus *, void *), void *);
37struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR); 37struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
38struct iowa_bus *iowa_pio_find_bus(unsigned long); 38struct iowa_bus *iowa_pio_find_bus(unsigned long);
39 39
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 80911a373400..c81341ff75b5 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -32,6 +32,7 @@
32#include <linux/marker.h> 32#include <linux/marker.h>
33 33
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/time.h>
35#include <asm/spu.h> 36#include <asm/spu.h>
36#include <asm/spu_info.h> 37#include <asm/spu_info.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2e411f23462b..745dd51ec37f 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -659,7 +659,7 @@ static struct spu *find_victim(struct spu_context *ctx)
659 659
660 victim->stats.invol_ctx_switch++; 660 victim->stats.invol_ctx_switch++;
661 spu->stats.invol_ctx_switch++; 661 spu->stats.invol_ctx_switch++;
662 if (test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) 662 if (test_bit(SPU_SCHED_SPU_RUN, &victim->sched_flags))
663 spu_add_to_rq(victim); 663 spu_add_to_rq(victim);
664 664
665 mutex_unlock(&victim->state_mutex); 665 mutex_unlock(&victim->state_mutex);
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 8df7f0e4c3a6..2352d139b262 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -43,7 +43,7 @@ KBUILD_AFLAGS += $(cpu-as-y)
43KBUILD_CFLAGS += $(cpu-as-y) 43KBUILD_CFLAGS += $(cpu-as-y)
44 44
45# Default to the common case. 45# Default to the common case.
46KBUILD_DEFCONFIG := common_defconfig 46KBUILD_DEFCONFIG := ebony_defconfig
47 47
48head-y := arch/ppc/kernel/head.o 48head-y := arch/ppc/kernel/head.o
49head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o 49head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 16ac11ca7ba0..602c268fc8a2 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -24,6 +24,7 @@
24#include <asm/checksum.h> 24#include <asm/checksum.h>
25#include <asm/pgtable.h> 25#include <asm/pgtable.h>
26#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
27#include <asm/cacheflush.h>
27#include <linux/adb.h> 28#include <linux/adb.h>
28#include <linux/cuda.h> 29#include <linux/cuda.h>
29#include <linux/pmu.h> 30#include <linux/pmu.h>
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index bfddfdee0b65..51e8094f52d6 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -36,6 +36,7 @@
36#include <asm/nvram.h> 36#include <asm/nvram.h>
37#include <asm/xmon.h> 37#include <asm/xmon.h>
38#include <asm/ocp.h> 38#include <asm/ocp.h>
39#include <asm/irq.h>
39 40
40#define USES_PPC_SYS (defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \ 41#define USES_PPC_SYS (defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \
41 defined(CONFIG_PPC_MPC52xx)) 42 defined(CONFIG_PPC_MPC52xx))
diff --git a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c
index 18495e754e30..d687b0f8763b 100644
--- a/arch/ppc/platforms/residual.c
+++ b/arch/ppc/platforms/residual.c
@@ -38,6 +38,7 @@
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/ioport.h> 39#include <linux/ioport.h>
40#include <linux/pci.h> 40#include <linux/pci.h>
41#include <linux/proc_fs.h>
41 42
42#include <asm/sections.h> 43#include <asm/sections.h>
43#include <asm/mmu.h> 44#include <asm/mmu.h>
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index dff0568e67ec..c93d1296cc0a 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -71,7 +71,7 @@ static ssize_t debug_input(struct file *file, const char __user *user_buf,
71 size_t user_len, loff_t * offset); 71 size_t user_len, loff_t * offset);
72static int debug_open(struct inode *inode, struct file *file); 72static int debug_open(struct inode *inode, struct file *file);
73static int debug_close(struct inode *inode, struct file *file); 73static int debug_close(struct inode *inode, struct file *file);
74static debug_info_t* debug_info_create(char *name, int pages_per_area, 74static debug_info_t *debug_info_create(const char *name, int pages_per_area,
75 int nr_areas, int buf_size, mode_t mode); 75 int nr_areas, int buf_size, mode_t mode);
76static void debug_info_get(debug_info_t *); 76static void debug_info_get(debug_info_t *);
77static void debug_info_put(debug_info_t *); 77static void debug_info_put(debug_info_t *);
@@ -234,8 +234,8 @@ fail_malloc_areas:
234 */ 234 */
235 235
236static debug_info_t* 236static debug_info_t*
237debug_info_alloc(char *name, int pages_per_area, int nr_areas, int buf_size, 237debug_info_alloc(const char *name, int pages_per_area, int nr_areas,
238 int level, int mode) 238 int buf_size, int level, int mode)
239{ 239{
240 debug_info_t* rc; 240 debug_info_t* rc;
241 241
@@ -326,8 +326,8 @@ debug_info_free(debug_info_t* db_info){
326 */ 326 */
327 327
328static debug_info_t* 328static debug_info_t*
329debug_info_create(char *name, int pages_per_area, int nr_areas, int buf_size, 329debug_info_create(const char *name, int pages_per_area, int nr_areas,
330 mode_t mode) 330 int buf_size, mode_t mode)
331{ 331{
332 debug_info_t* rc; 332 debug_info_t* rc;
333 333
@@ -684,9 +684,9 @@ debug_close(struct inode *inode, struct file *file)
684 * - Returns handle for debug area 684 * - Returns handle for debug area
685 */ 685 */
686 686
687debug_info_t *debug_register_mode(char *name, int pages_per_area, int nr_areas, 687debug_info_t *debug_register_mode(const char *name, int pages_per_area,
688 int buf_size, mode_t mode, uid_t uid, 688 int nr_areas, int buf_size, mode_t mode,
689 gid_t gid) 689 uid_t uid, gid_t gid)
690{ 690{
691 debug_info_t *rc = NULL; 691 debug_info_t *rc = NULL;
692 692
@@ -722,8 +722,8 @@ EXPORT_SYMBOL(debug_register_mode);
722 * - returns handle for debug area 722 * - returns handle for debug area
723 */ 723 */
724 724
725debug_info_t *debug_register(char *name, int pages_per_area, int nr_areas, 725debug_info_t *debug_register(const char *name, int pages_per_area,
726 int buf_size) 726 int nr_areas, int buf_size)
727{ 727{
728 return debug_register_mode(name, pages_per_area, nr_areas, buf_size, 728 return debug_register_mode(name, pages_per_area, nr_areas, buf_size,
729 S_IRUSR | S_IWUSR, 0, 0); 729 S_IRUSR | S_IWUSR, 0, 0);
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index c59a86dca584..e7c5bfb7c755 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -25,6 +25,7 @@ int show_interrupts(struct seq_file *p, void *v)
25 static const char *intrclass_names[] = { "EXT", "I/O", }; 25 static const char *intrclass_names[] = { "EXT", "I/O", };
26 int i = *(loff_t *) v, j; 26 int i = *(loff_t *) v, j;
27 27
28 get_online_cpus();
28 if (i == 0) { 29 if (i == 0) {
29 seq_puts(p, " "); 30 seq_puts(p, " ");
30 for_each_online_cpu(j) 31 for_each_online_cpu(j)
@@ -43,7 +44,7 @@ int show_interrupts(struct seq_file *p, void *v)
43 seq_putc(p, '\n'); 44 seq_putc(p, '\n');
44 45
45 } 46 }
46 47 put_online_cpus();
47 return 0; 48 return 0;
48} 49}
49 50
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 0aeb290060d9..1f4228948dc4 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -139,7 +139,6 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
139 if (wait) 139 if (wait)
140 data.finished = CPU_MASK_NONE; 140 data.finished = CPU_MASK_NONE;
141 141
142 spin_lock(&call_lock);
143 call_data = &data; 142 call_data = &data;
144 143
145 for_each_cpu_mask(cpu, map) 144 for_each_cpu_mask(cpu, map)
@@ -151,7 +150,6 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
151 if (wait) 150 if (wait)
152 while (!cpus_equal(map, data.finished)) 151 while (!cpus_equal(map, data.finished))
153 cpu_relax(); 152 cpu_relax();
154 spin_unlock(&call_lock);
155out: 153out:
156 if (local) { 154 if (local) {
157 local_irq_disable(); 155 local_irq_disable();
@@ -177,11 +175,11 @@ int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
177{ 175{
178 cpumask_t map; 176 cpumask_t map;
179 177
180 preempt_disable(); 178 spin_lock(&call_lock);
181 map = cpu_online_map; 179 map = cpu_online_map;
182 cpu_clear(smp_processor_id(), map); 180 cpu_clear(smp_processor_id(), map);
183 __smp_call_function_map(func, info, nonatomic, wait, map); 181 __smp_call_function_map(func, info, nonatomic, wait, map);
184 preempt_enable(); 182 spin_unlock(&call_lock);
185 return 0; 183 return 0;
186} 184}
187EXPORT_SYMBOL(smp_call_function); 185EXPORT_SYMBOL(smp_call_function);
@@ -202,10 +200,10 @@ EXPORT_SYMBOL(smp_call_function);
202int smp_call_function_single(int cpu, void (*func) (void *info), void *info, 200int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
203 int nonatomic, int wait) 201 int nonatomic, int wait)
204{ 202{
205 preempt_disable(); 203 spin_lock(&call_lock);
206 __smp_call_function_map(func, info, nonatomic, wait, 204 __smp_call_function_map(func, info, nonatomic, wait,
207 cpumask_of_cpu(cpu)); 205 cpumask_of_cpu(cpu));
208 preempt_enable(); 206 spin_unlock(&call_lock);
209 return 0; 207 return 0;
210} 208}
211EXPORT_SYMBOL(smp_call_function_single); 209EXPORT_SYMBOL(smp_call_function_single);
@@ -228,10 +226,10 @@ EXPORT_SYMBOL(smp_call_function_single);
228int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info, 226int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
229 int wait) 227 int wait)
230{ 228{
231 preempt_disable(); 229 spin_lock(&call_lock);
232 cpu_clear(smp_processor_id(), mask); 230 cpu_clear(smp_processor_id(), mask);
233 __smp_call_function_map(func, info, 0, wait, mask); 231 __smp_call_function_map(func, info, 0, wait, mask);
234 preempt_enable(); 232 spin_unlock(&call_lock);
235 return 0; 233 return 0;
236} 234}
237EXPORT_SYMBOL(smp_call_function_mask); 235EXPORT_SYMBOL(smp_call_function_mask);
@@ -592,7 +590,9 @@ int __cpuinit start_secondary(void *cpuvoid)
592 pfault_init(); 590 pfault_init();
593 591
594 /* Mark this cpu as online */ 592 /* Mark this cpu as online */
593 spin_lock(&call_lock);
595 cpu_set(smp_processor_id(), cpu_online_map); 594 cpu_set(smp_processor_id(), cpu_online_map);
595 spin_unlock(&call_lock);
596 /* Switch on interrupts */ 596 /* Switch on interrupts */
597 local_irq_enable(); 597 local_irq_enable();
598 /* Print info about this processor */ 598 /* Print info about this processor */
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index beccacf907f3..ea2804808f39 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -27,19 +27,12 @@ struct memory_segment {
27 27
28static LIST_HEAD(mem_segs); 28static LIST_HEAD(mem_segs);
29 29
30static void __ref *vmem_alloc_pages(unsigned int order) 30static pud_t *vmem_pud_alloc(void)
31{
32 if (slab_is_available())
33 return (void *)__get_free_pages(GFP_KERNEL, order);
34 return alloc_bootmem_pages((1 << order) * PAGE_SIZE);
35}
36
37static inline pud_t *vmem_pud_alloc(void)
38{ 31{
39 pud_t *pud = NULL; 32 pud_t *pud = NULL;
40 33
41#ifdef CONFIG_64BIT 34#ifdef CONFIG_64BIT
42 pud = vmem_alloc_pages(2); 35 pud = vmemmap_alloc_block(PAGE_SIZE * 4, 0);
43 if (!pud) 36 if (!pud)
44 return NULL; 37 return NULL;
45 clear_table((unsigned long *) pud, _REGION3_ENTRY_EMPTY, PAGE_SIZE * 4); 38 clear_table((unsigned long *) pud, _REGION3_ENTRY_EMPTY, PAGE_SIZE * 4);
@@ -47,12 +40,12 @@ static inline pud_t *vmem_pud_alloc(void)
47 return pud; 40 return pud;
48} 41}
49 42
50static inline pmd_t *vmem_pmd_alloc(void) 43static pmd_t *vmem_pmd_alloc(void)
51{ 44{
52 pmd_t *pmd = NULL; 45 pmd_t *pmd = NULL;
53 46
54#ifdef CONFIG_64BIT 47#ifdef CONFIG_64BIT
55 pmd = vmem_alloc_pages(2); 48 pmd = vmemmap_alloc_block(PAGE_SIZE * 4, 0);
56 if (!pmd) 49 if (!pmd)
57 return NULL; 50 return NULL;
58 clear_table((unsigned long *) pmd, _SEGMENT_ENTRY_EMPTY, PAGE_SIZE * 4); 51 clear_table((unsigned long *) pmd, _SEGMENT_ENTRY_EMPTY, PAGE_SIZE * 4);
@@ -60,7 +53,7 @@ static inline pmd_t *vmem_pmd_alloc(void)
60 return pmd; 53 return pmd;
61} 54}
62 55
63static pte_t __init_refok *vmem_pte_alloc(void) 56static pte_t __ref *vmem_pte_alloc(void)
64{ 57{
65 pte_t *pte; 58 pte_t *pte;
66 59
@@ -214,7 +207,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
214 if (pte_none(*pt_dir)) { 207 if (pte_none(*pt_dir)) {
215 unsigned long new_page; 208 unsigned long new_page;
216 209
217 new_page =__pa(vmem_alloc_pages(0)); 210 new_page =__pa(vmemmap_alloc_block(PAGE_SIZE, 0));
218 if (!new_page) 211 if (!new_page)
219 goto out; 212 goto out;
220 pte = pfn_pte(new_page >> PAGE_SHIFT, PAGE_KERNEL); 213 pte = pfn_pte(new_page >> PAGE_SHIFT, PAGE_KERNEL);
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index d453c3a1c79f..832641bbd47d 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -330,14 +330,6 @@ static char *ebin_to_mem(const char *buf, char *mem, int count)
330 return mem; 330 return mem;
331} 331}
332 332
333/* Pack a hex byte */
334static char *pack_hex_byte(char *pkt, int byte)
335{
336 *pkt++ = hexchars[(byte >> 4) & 0xf];
337 *pkt++ = hexchars[(byte & 0xf)];
338 return pkt;
339}
340
341/* Scan for the start char '$', read the packet and check the checksum */ 333/* Scan for the start char '$', read the packet and check the checksum */
342static void get_packet(char *buffer, int buflen) 334static void get_packet(char *buffer, int buflen)
343{ 335{
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 57d1bbdd0bd2..4bcfe54f878d 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1306,6 +1306,8 @@ ret_from_fork:
1306 .align 4 1306 .align 4
1307 .globl linux_sparc_syscall 1307 .globl linux_sparc_syscall
1308linux_sparc_syscall: 1308linux_sparc_syscall:
1309 sethi %hi(PSR_SYSCALL), %l4
1310 or %l0, %l4, %l0
1309 /* Direct access to user regs, must faster. */ 1311 /* Direct access to user regs, must faster. */
1310 cmp %g1, NR_SYSCALLS 1312 cmp %g1, NR_SYSCALLS
1311 bgeu linux_sparc_ni_syscall 1313 bgeu linux_sparc_ni_syscall
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 36431f377dee..da48d248cc17 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -638,11 +638,6 @@ asmlinkage int sparc_execve(struct pt_regs *regs)
638 (char __user * __user *)regs->u_regs[base + UREG_I2], 638 (char __user * __user *)regs->u_regs[base + UREG_I2],
639 regs); 639 regs);
640 putname(filename); 640 putname(filename);
641 if (error == 0) {
642 task_lock(current);
643 current->ptrace &= ~PT_DTRACE;
644 task_unlock(current);
645 }
646out: 641out:
647 return error; 642 return error;
648} 643}
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 7f44ae69b29e..81f3b929743f 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -170,8 +170,8 @@ static int genregs32_set(struct task_struct *target,
170 switch (pos) { 170 switch (pos) {
171 case 32: /* PSR */ 171 case 32: /* PSR */
172 psr = regs->psr; 172 psr = regs->psr;
173 psr &= ~PSR_ICC; 173 psr &= ~(PSR_ICC | PSR_SYSCALL);
174 psr |= (reg & PSR_ICC); 174 psr |= (reg & (PSR_ICC | PSR_SYSCALL));
175 regs->psr = psr; 175 regs->psr = psr;
176 break; 176 break;
177 case 33: /* PC */ 177 case 33: /* PC */
@@ -441,6 +441,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
441 break; 441 break;
442 442
443 default: 443 default:
444 if (request == PTRACE_SPARC_DETACH)
445 request = PTRACE_DETACH;
444 ret = ptrace_request(child, request, addr, data); 446 ret = ptrace_request(child, request, addr, data);
445 break; 447 break;
446 } 448 }
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S
index 77ca6fd81253..ab818cdc4cc0 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap.S
@@ -50,8 +50,9 @@ rtrap_7win_patch5: and %g1, 0x7f, %g1
50ret_trap_entry: 50ret_trap_entry:
51ret_trap_lockless_ipi: 51ret_trap_lockless_ipi:
52 andcc %t_psr, PSR_PS, %g0 52 andcc %t_psr, PSR_PS, %g0
53 sethi %hi(PSR_SYSCALL), %g1
53 be 1f 54 be 1f
54 nop 55 andn %t_psr, %g1, %t_psr
55 56
56 wr %t_psr, 0x0, %psr 57 wr %t_psr, 0x0, %psr
57 b ret_trap_kernel 58 b ret_trap_kernel
@@ -73,7 +74,6 @@ signal_p:
73 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 74 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
74 75
75 mov %l5, %o1 76 mov %l5, %o1
76 mov %l6, %o2
77 call do_signal 77 call do_signal
78 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr 78 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr
79 79
@@ -81,6 +81,8 @@ signal_p:
81 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 81 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
82 clr %l6 82 clr %l6
83ret_trap_continue: 83ret_trap_continue:
84 sethi %hi(PSR_SYSCALL), %g1
85 andn %t_psr, %g1, %t_psr
84 wr %t_psr, 0x0, %psr 86 wr %t_psr, 0x0, %psr
85 WRITE_PAUSE 87 WRITE_PAUSE
86 88
@@ -137,8 +139,9 @@ ret_trap_userwins_ok:
137 LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc) 139 LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc)
138 or %t_pc, %t_npc, %g2 140 or %t_pc, %t_npc, %g2
139 andcc %g2, 0x3, %g0 141 andcc %g2, 0x3, %g0
142 sethi %hi(PSR_SYSCALL), %g2
140 be 1f 143 be 1f
141 nop 144 andn %t_psr, %g2, %t_psr
142 145
143 b ret_trap_unaligned_pc 146 b ret_trap_unaligned_pc
144 add %sp, STACKFRAME_SZ, %o0 147 add %sp, STACKFRAME_SZ, %o0
@@ -201,6 +204,8 @@ rtrap_patch5: and %g1, 0xff, %g1
2011: 2041:
202 LOAD_PT_ALL(sp, t_psr, t_pc, t_npc, g1) 205 LOAD_PT_ALL(sp, t_psr, t_pc, t_npc, g1)
2032: 2062:
207 sethi %hi(PSR_SYSCALL), %twin_tmp1
208 andn %t_psr, %twin_tmp1, %t_psr
204 wr %t_psr, 0x0, %psr 209 wr %t_psr, 0x0, %psr
205 WRITE_PAUSE 210 WRITE_PAUSE
206 211
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 368157926d24..3fd1df9f9ba7 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -145,6 +145,9 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
145 regs->psr = (up_psr & ~(PSR_ICC | PSR_EF)) 145 regs->psr = (up_psr & ~(PSR_ICC | PSR_EF))
146 | (regs->psr & (PSR_ICC | PSR_EF)); 146 | (regs->psr & (PSR_ICC | PSR_EF));
147 147
148 /* Prevent syscall restart. */
149 pt_regs_clear_syscall(regs);
150
148 err |= __get_user(fpu_save, &sf->fpu_save); 151 err |= __get_user(fpu_save, &sf->fpu_save);
149 152
150 if (fpu_save) 153 if (fpu_save)
@@ -199,6 +202,9 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
199 202
200 regs->psr = (regs->psr & ~PSR_ICC) | (psr & PSR_ICC); 203 regs->psr = (regs->psr & ~PSR_ICC) | (psr & PSR_ICC);
201 204
205 /* Prevent syscall restart. */
206 pt_regs_clear_syscall(regs);
207
202 err |= __get_user(fpu_save, &sf->fpu_save); 208 err |= __get_user(fpu_save, &sf->fpu_save);
203 209
204 if (fpu_save) 210 if (fpu_save)
@@ -507,26 +513,36 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
507 * want to handle. Thus you cannot kill init even with a SIGKILL even by 513 * want to handle. Thus you cannot kill init even with a SIGKILL even by
508 * mistake. 514 * mistake.
509 */ 515 */
510asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int restart_syscall) 516asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0)
511{ 517{
512 siginfo_t info;
513 struct sparc_deliver_cookie cookie;
514 struct k_sigaction ka; 518 struct k_sigaction ka;
515 int signr; 519 int restart_syscall;
516 sigset_t *oldset; 520 sigset_t *oldset;
521 siginfo_t info;
522 int signr;
517 523
518 cookie.restart_syscall = restart_syscall; 524 if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C))
519 cookie.orig_i0 = orig_i0; 525 restart_syscall = 1;
526 else
527 restart_syscall = 0;
520 528
521 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 529 if (test_thread_flag(TIF_RESTORE_SIGMASK))
522 oldset = &current->saved_sigmask; 530 oldset = &current->saved_sigmask;
523 else 531 else
524 oldset = &current->blocked; 532 oldset = &current->blocked;
525 533
526 signr = get_signal_to_deliver(&info, &ka, regs, &cookie); 534 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
535
536 /* If the debugger messes with the program counter, it clears
537 * the software "in syscall" bit, directing us to not perform
538 * a syscall restart.
539 */
540 if (restart_syscall && !pt_regs_is_syscall(regs))
541 restart_syscall = 0;
542
527 if (signr > 0) { 543 if (signr > 0) {
528 if (cookie.restart_syscall) 544 if (restart_syscall)
529 syscall_restart(cookie.orig_i0, regs, &ka.sa); 545 syscall_restart(orig_i0, regs, &ka.sa);
530 handle_signal(signr, &ka, &info, oldset, regs); 546 handle_signal(signr, &ka, &info, oldset, regs);
531 547
532 /* a signal was successfully delivered; the saved 548 /* a signal was successfully delivered; the saved
@@ -538,16 +554,16 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest
538 clear_thread_flag(TIF_RESTORE_SIGMASK); 554 clear_thread_flag(TIF_RESTORE_SIGMASK);
539 return; 555 return;
540 } 556 }
541 if (cookie.restart_syscall && 557 if (restart_syscall &&
542 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 558 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
543 regs->u_regs[UREG_I0] == ERESTARTSYS || 559 regs->u_regs[UREG_I0] == ERESTARTSYS ||
544 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 560 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
545 /* replay the system call when we are done */ 561 /* replay the system call when we are done */
546 regs->u_regs[UREG_I0] = cookie.orig_i0; 562 regs->u_regs[UREG_I0] = orig_i0;
547 regs->pc -= 4; 563 regs->pc -= 4;
548 regs->npc -= 4; 564 regs->npc -= 4;
549 } 565 }
550 if (cookie.restart_syscall && 566 if (restart_syscall &&
551 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 567 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
552 regs->u_regs[UREG_G1] = __NR_restart_syscall; 568 regs->u_regs[UREG_G1] = __NR_restart_syscall;
553 regs->pc -= 4; 569 regs->pc -= 4;
@@ -599,27 +615,3 @@ do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr,
599out: 615out:
600 return ret; 616 return ret;
601} 617}
602
603void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
604{
605 struct sparc_deliver_cookie *cp = cookie;
606
607 if (cp->restart_syscall &&
608 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
609 regs->u_regs[UREG_I0] == ERESTARTSYS ||
610 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
611 /* replay the system call when we are done */
612 regs->u_regs[UREG_I0] = cp->orig_i0;
613 regs->pc -= 4;
614 regs->npc -= 4;
615 cp->restart_syscall = 0;
616 }
617
618 if (cp->restart_syscall &&
619 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
620 regs->u_regs[UREG_G1] = __NR_restart_syscall;
621 regs->pc -= 4;
622 regs->npc -= 4;
623 cp->restart_syscall = 0;
624 }
625}
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index e995491c4436..3c6b49a53ae8 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -219,7 +219,7 @@ out:
219 return err; 219 return err;
220} 220}
221 221
222int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) 222int sparc_mmap_check(unsigned long addr, unsigned long len)
223{ 223{
224 if (ARCH_SUN4C_SUN4 && 224 if (ARCH_SUN4C_SUN4 &&
225 (len > 0x20000000 || 225 (len > 0x20000000 ||
@@ -295,52 +295,14 @@ asmlinkage unsigned long sparc_mremap(unsigned long addr,
295 unsigned long old_len, unsigned long new_len, 295 unsigned long old_len, unsigned long new_len,
296 unsigned long flags, unsigned long new_addr) 296 unsigned long flags, unsigned long new_addr)
297{ 297{
298 struct vm_area_struct *vma;
299 unsigned long ret = -EINVAL; 298 unsigned long ret = -EINVAL;
300 if (ARCH_SUN4C_SUN4) { 299
301 if (old_len > 0x20000000 || new_len > 0x20000000) 300 if (unlikely(sparc_mmap_check(addr, old_len)))
302 goto out; 301 goto out;
303 if (addr < 0xe0000000 && addr + old_len > 0x20000000) 302 if (unlikely(sparc_mmap_check(new_addr, new_len)))
304 goto out;
305 }
306 if (old_len > TASK_SIZE - PAGE_SIZE ||
307 new_len > TASK_SIZE - PAGE_SIZE)
308 goto out; 303 goto out;
309 down_write(&current->mm->mmap_sem); 304 down_write(&current->mm->mmap_sem);
310 if (flags & MREMAP_FIXED) {
311 if (ARCH_SUN4C_SUN4 &&
312 new_addr < 0xe0000000 &&
313 new_addr + new_len > 0x20000000)
314 goto out_sem;
315 if (new_addr + new_len > TASK_SIZE - PAGE_SIZE)
316 goto out_sem;
317 } else if ((ARCH_SUN4C_SUN4 && addr < 0xe0000000 &&
318 addr + new_len > 0x20000000) ||
319 addr + new_len > TASK_SIZE - PAGE_SIZE) {
320 unsigned long map_flags = 0;
321 struct file *file = NULL;
322
323 ret = -ENOMEM;
324 if (!(flags & MREMAP_MAYMOVE))
325 goto out_sem;
326
327 vma = find_vma(current->mm, addr);
328 if (vma) {
329 if (vma->vm_flags & VM_SHARED)
330 map_flags |= MAP_SHARED;
331 file = vma->vm_file;
332 }
333
334 new_addr = get_unmapped_area(file, addr, new_len,
335 vma ? vma->vm_pgoff : 0,
336 map_flags);
337 ret = new_addr;
338 if (new_addr & ~PAGE_MASK)
339 goto out_sem;
340 flags |= MREMAP_FIXED;
341 }
342 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 305 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
343out_sem:
344 up_write(&current->mm->mmap_sem); 306 up_write(&current->mm->mmap_sem);
345out: 307out:
346 return ret; 308 return ret;
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index aff93c9d13f4..76eb832527f2 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/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.25 3# Linux kernel version: 2.6.26-rc2
4# Sat Apr 26 03:11:06 2008 4# Fri May 16 13:36:07 2008
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -74,6 +74,7 @@ CONFIG_SYSCTL=y
74# CONFIG_EMBEDDED is not set 74# CONFIG_EMBEDDED is not set
75CONFIG_UID16=y 75CONFIG_UID16=y
76CONFIG_SYSCTL_SYSCALL=y 76CONFIG_SYSCTL_SYSCALL=y
77CONFIG_SYSCTL_SYSCALL_CHECK=y
77CONFIG_KALLSYMS=y 78CONFIG_KALLSYMS=y
78# CONFIG_KALLSYMS_ALL is not set 79# CONFIG_KALLSYMS_ALL is not set
79# CONFIG_KALLSYMS_EXTRA_PASS is not set 80# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -103,12 +104,14 @@ CONFIG_KPROBES=y
103CONFIG_KRETPROBES=y 104CONFIG_KRETPROBES=y
104CONFIG_HAVE_KPROBES=y 105CONFIG_HAVE_KPROBES=y
105CONFIG_HAVE_KRETPROBES=y 106CONFIG_HAVE_KRETPROBES=y
107# CONFIG_HAVE_DMA_ATTRS is not set
106CONFIG_PROC_PAGE_MONITOR=y 108CONFIG_PROC_PAGE_MONITOR=y
107CONFIG_SLABINFO=y 109CONFIG_SLABINFO=y
108CONFIG_RT_MUTEXES=y 110CONFIG_RT_MUTEXES=y
109# CONFIG_TINY_SHMEM is not set 111# CONFIG_TINY_SHMEM is not set
110CONFIG_BASE_SMALL=0 112CONFIG_BASE_SMALL=0
111CONFIG_MODULES=y 113CONFIG_MODULES=y
114# CONFIG_MODULE_FORCE_LOAD is not set
112CONFIG_MODULE_UNLOAD=y 115CONFIG_MODULE_UNLOAD=y
113CONFIG_MODULE_FORCE_UNLOAD=y 116CONFIG_MODULE_FORCE_UNLOAD=y
114CONFIG_MODVERSIONS=y 117CONFIG_MODVERSIONS=y
@@ -170,6 +173,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
170CONFIG_SPARSEMEM_EXTREME=y 173CONFIG_SPARSEMEM_EXTREME=y
171CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 174CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
172CONFIG_SPARSEMEM_VMEMMAP=y 175CONFIG_SPARSEMEM_VMEMMAP=y
176CONFIG_PAGEFLAGS_EXTENDED=y
173CONFIG_SPLIT_PTLOCK_CPUS=4 177CONFIG_SPLIT_PTLOCK_CPUS=4
174CONFIG_MIGRATION=y 178CONFIG_MIGRATION=y
175CONFIG_RESOURCES_64BIT=y 179CONFIG_RESOURCES_64BIT=y
@@ -402,7 +406,6 @@ CONFIG_IDEPCI_PCIBUS_ORDER=y
402CONFIG_BLK_DEV_IDEDMA_PCI=y 406CONFIG_BLK_DEV_IDEDMA_PCI=y
403# CONFIG_BLK_DEV_AEC62XX is not set 407# CONFIG_BLK_DEV_AEC62XX is not set
404CONFIG_BLK_DEV_ALI15X3=y 408CONFIG_BLK_DEV_ALI15X3=y
405# CONFIG_WDC_ALI15X3 is not set
406# CONFIG_BLK_DEV_AMD74XX is not set 409# CONFIG_BLK_DEV_AMD74XX is not set
407# CONFIG_BLK_DEV_CMD64X is not set 410# CONFIG_BLK_DEV_CMD64X is not set
408# CONFIG_BLK_DEV_TRIFLEX is not set 411# CONFIG_BLK_DEV_TRIFLEX is not set
@@ -609,6 +612,7 @@ CONFIG_NIU=m
609# CONFIG_MLX4_CORE is not set 612# CONFIG_MLX4_CORE is not set
610# CONFIG_TEHUTI is not set 613# CONFIG_TEHUTI is not set
611# CONFIG_BNX2X is not set 614# CONFIG_BNX2X is not set
615# CONFIG_SFC is not set
612# CONFIG_TR is not set 616# CONFIG_TR is not set
613 617
614# 618#
@@ -717,6 +721,7 @@ CONFIG_VT=y
717CONFIG_VT_CONSOLE=y 721CONFIG_VT_CONSOLE=y
718CONFIG_HW_CONSOLE=y 722CONFIG_HW_CONSOLE=y
719# CONFIG_VT_HW_CONSOLE_BINDING is not set 723# CONFIG_VT_HW_CONSOLE_BINDING is not set
724# CONFIG_DEVKMEM is not set
720# CONFIG_SERIAL_NONSTANDARD is not set 725# CONFIG_SERIAL_NONSTANDARD is not set
721# CONFIG_NOZOMI is not set 726# CONFIG_NOZOMI is not set
722 727
@@ -793,12 +798,7 @@ CONFIG_I2C_ALGOBIT=y
793# CONFIG_I2C_DEBUG_ALGO is not set 798# CONFIG_I2C_DEBUG_ALGO is not set
794# CONFIG_I2C_DEBUG_BUS is not set 799# CONFIG_I2C_DEBUG_BUS is not set
795# CONFIG_I2C_DEBUG_CHIP is not set 800# CONFIG_I2C_DEBUG_CHIP is not set
796
797#
798# SPI support
799#
800# CONFIG_SPI is not set 801# CONFIG_SPI is not set
801# CONFIG_SPI_MASTER is not set
802# CONFIG_W1 is not set 802# CONFIG_W1 is not set
803# CONFIG_POWER_SUPPLY is not set 803# CONFIG_POWER_SUPPLY is not set
804CONFIG_HWMON=y 804CONFIG_HWMON=y
@@ -873,8 +873,17 @@ CONFIG_SSB_POSSIBLE=y
873# 873#
874# Multimedia devices 874# Multimedia devices
875# 875#
876
877#
878# Multimedia core support
879#
876# CONFIG_VIDEO_DEV is not set 880# CONFIG_VIDEO_DEV is not set
877# CONFIG_DVB_CORE is not set 881# CONFIG_DVB_CORE is not set
882# CONFIG_VIDEO_MEDIA is not set
883
884#
885# Multimedia drivers
886#
878# CONFIG_DAB is not set 887# CONFIG_DAB is not set
879 888
880# 889#
@@ -893,8 +902,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
893# CONFIG_FB_SYS_FILLRECT is not set 902# CONFIG_FB_SYS_FILLRECT is not set
894# CONFIG_FB_SYS_COPYAREA is not set 903# CONFIG_FB_SYS_COPYAREA is not set
895# CONFIG_FB_SYS_IMAGEBLIT is not set 904# CONFIG_FB_SYS_IMAGEBLIT is not set
905# CONFIG_FB_FOREIGN_ENDIAN is not set
896# CONFIG_FB_SYS_FOPS is not set 906# CONFIG_FB_SYS_FOPS is not set
897CONFIG_FB_DEFERRED_IO=y
898# CONFIG_FB_SVGALIB is not set 907# CONFIG_FB_SVGALIB is not set
899# CONFIG_FB_MACMODES is not set 908# CONFIG_FB_MACMODES is not set
900# CONFIG_FB_BACKLIGHT is not set 909# CONFIG_FB_BACKLIGHT is not set
@@ -1100,6 +1109,10 @@ CONFIG_SND_SUN_CS4231=m
1100# 1109#
1101 1110
1102# 1111#
1112# SoC Audio for the Texas Instruments OMAP
1113#
1114
1115#
1103# Open Sound System 1116# Open Sound System
1104# 1117#
1105# CONFIG_SOUND_PRIME is not set 1118# CONFIG_SOUND_PRIME is not set
@@ -1135,10 +1148,12 @@ CONFIG_USB_DEVICEFS=y
1135# 1148#
1136# USB Host Controller Drivers 1149# USB Host Controller Drivers
1137# 1150#
1151# CONFIG_USB_C67X00_HCD is not set
1138CONFIG_USB_EHCI_HCD=m 1152CONFIG_USB_EHCI_HCD=m
1139# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1153# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1140# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1154# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1141# CONFIG_USB_ISP116X_HCD is not set 1155# CONFIG_USB_ISP116X_HCD is not set
1156# CONFIG_USB_ISP1760_HCD is not set
1142CONFIG_USB_OHCI_HCD=y 1157CONFIG_USB_OHCI_HCD=y
1143# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1158# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1144# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1159# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1173,6 +1188,7 @@ CONFIG_USB_STORAGE=m
1173# CONFIG_USB_STORAGE_ALAUDA is not set 1188# CONFIG_USB_STORAGE_ALAUDA is not set
1174# CONFIG_USB_STORAGE_ONETOUCH is not set 1189# CONFIG_USB_STORAGE_ONETOUCH is not set
1175# CONFIG_USB_STORAGE_KARMA is not set 1190# CONFIG_USB_STORAGE_KARMA is not set
1191# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1176# CONFIG_USB_LIBUSUAL is not set 1192# CONFIG_USB_LIBUSUAL is not set
1177 1193
1178# 1194#
@@ -1214,6 +1230,7 @@ CONFIG_USB_STORAGE=m
1214# CONFIG_MMC is not set 1230# CONFIG_MMC is not set
1215# CONFIG_MEMSTICK is not set 1231# CONFIG_MEMSTICK is not set
1216# CONFIG_NEW_LEDS is not set 1232# CONFIG_NEW_LEDS is not set
1233# CONFIG_ACCESSIBILITY is not set
1217# CONFIG_INFINIBAND is not set 1234# CONFIG_INFINIBAND is not set
1218# CONFIG_RTC_CLASS is not set 1235# CONFIG_RTC_CLASS is not set
1219# CONFIG_UIO is not set 1236# CONFIG_UIO is not set
@@ -1367,6 +1384,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1367CONFIG_PRINTK_TIME=y 1384CONFIG_PRINTK_TIME=y
1368# CONFIG_ENABLE_WARN_DEPRECATED is not set 1385# CONFIG_ENABLE_WARN_DEPRECATED is not set
1369CONFIG_ENABLE_MUST_CHECK=y 1386CONFIG_ENABLE_MUST_CHECK=y
1387CONFIG_FRAME_WARN=2048
1370CONFIG_MAGIC_SYSRQ=y 1388CONFIG_MAGIC_SYSRQ=y
1371# CONFIG_UNUSED_SYMBOLS is not set 1389# CONFIG_UNUSED_SYMBOLS is not set
1372CONFIG_DEBUG_FS=y 1390CONFIG_DEBUG_FS=y
@@ -1377,6 +1395,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1377# CONFIG_SCHED_DEBUG is not set 1395# CONFIG_SCHED_DEBUG is not set
1378CONFIG_SCHEDSTATS=y 1396CONFIG_SCHEDSTATS=y
1379# CONFIG_TIMER_STATS is not set 1397# CONFIG_TIMER_STATS is not set
1398# CONFIG_DEBUG_OBJECTS is not set
1380# CONFIG_SLUB_DEBUG_ON is not set 1399# CONFIG_SLUB_DEBUG_ON is not set
1381# CONFIG_SLUB_STATS is not set 1400# CONFIG_SLUB_STATS is not set
1382# CONFIG_DEBUG_RT_MUTEXES is not set 1401# CONFIG_DEBUG_RT_MUTEXES is not set
@@ -1402,6 +1421,8 @@ CONFIG_DEBUG_BUGVERBOSE=y
1402# CONFIG_LKDTM is not set 1421# CONFIG_LKDTM is not set
1403# CONFIG_FAULT_INJECTION is not set 1422# CONFIG_FAULT_INJECTION is not set
1404# CONFIG_SAMPLES is not set 1423# CONFIG_SAMPLES is not set
1424CONFIG_HAVE_ARCH_KGDB=y
1425# CONFIG_KGDB is not set
1405# CONFIG_DEBUG_STACK_USAGE is not set 1426# CONFIG_DEBUG_STACK_USAGE is not set
1406# CONFIG_DEBUG_DCFLUSH is not set 1427# CONFIG_DEBUG_DCFLUSH is not set
1407# CONFIG_STACK_DEBUG is not set 1428# CONFIG_STACK_DEBUG is not set
@@ -1503,6 +1524,7 @@ CONFIG_CRYPTO_HW=y
1503# Library routines 1524# Library routines
1504# 1525#
1505CONFIG_BITREVERSE=y 1526CONFIG_BITREVERSE=y
1527# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1506CONFIG_CRC_CCITT=m 1528CONFIG_CRC_CCITT=m
1507CONFIG_CRC16=m 1529CONFIG_CRC16=m
1508# CONFIG_CRC_ITU_T is not set 1530# CONFIG_CRC_ITU_T is not set
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S
index b49d3b60bc0c..f25e1da3fd03 100644
--- a/arch/sparc64/kernel/etrap.S
+++ b/arch/sparc64/kernel/etrap.S
@@ -27,11 +27,12 @@
27 27
28 .text 28 .text
29 .align 64 29 .align 64
30 .globl etrap, etrap_irq, etraptl1 30 .globl etrap_syscall, etrap, etrap_irq, etraptl1
31etrap: rdpr %pil, %g2 31etrap: rdpr %pil, %g2
32etrap_irq: 32etrap_irq: clr %g3
33 TRAP_LOAD_THREAD_REG(%g6, %g1) 33etrap_syscall: TRAP_LOAD_THREAD_REG(%g6, %g1)
34 rdpr %tstate, %g1 34 rdpr %tstate, %g1
35 or %g1, %g3, %g1
35 sllx %g2, 20, %g3 36 sllx %g2, 20, %g3
36 andcc %g1, TSTATE_PRIV, %g0 37 andcc %g1, TSTATE_PRIV, %g0
37 or %g1, %g3, %g1 38 or %g1, %g3, %g1
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index e9fc0aa2da38..f6c9fc92921d 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -287,11 +287,11 @@ static int genregs64_set(struct task_struct *target,
287 32 * sizeof(u64), 287 32 * sizeof(u64),
288 33 * sizeof(u64)); 288 33 * sizeof(u64));
289 if (!ret) { 289 if (!ret) {
290 /* Only the condition codes can be modified 290 /* Only the condition codes and the "in syscall"
291 * in the %tstate register. 291 * state can be modified in the %tstate register.
292 */ 292 */
293 tstate &= (TSTATE_ICC | TSTATE_XCC); 293 tstate &= (TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL);
294 regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC); 294 regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL);
295 regs->tstate |= tstate; 295 regs->tstate |= tstate;
296 } 296 }
297 } 297 }
@@ -657,8 +657,10 @@ static int genregs32_set(struct task_struct *target,
657 switch (pos) { 657 switch (pos) {
658 case 32: /* PSR */ 658 case 32: /* PSR */
659 tstate = regs->tstate; 659 tstate = regs->tstate;
660 tstate &= ~(TSTATE_ICC | TSTATE_XCC); 660 tstate &= ~(TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL);
661 tstate |= psr_to_tstate_icc(reg); 661 tstate |= psr_to_tstate_icc(reg);
662 if (reg & PSR_SYSCALL)
663 tstate |= TSTATE_SYSCALL;
662 regs->tstate = tstate; 664 regs->tstate = tstate;
663 break; 665 break;
664 case 33: /* PC */ 666 case 33: /* PC */
@@ -944,6 +946,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
944 break; 946 break;
945 947
946 default: 948 default:
949 if (request == PTRACE_SPARC_DETACH)
950 request = PTRACE_DETACH;
947 ret = compat_ptrace_request(child, request, addr, data); 951 ret = compat_ptrace_request(child, request, addr, data);
948 break; 952 break;
949 } 953 }
@@ -1036,6 +1040,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1036 break; 1040 break;
1037 1041
1038 default: 1042 default:
1043 if (request == PTRACE_SPARC_DETACH)
1044 request = PTRACE_DETACH;
1039 ret = ptrace_request(child, request, addr, data); 1045 ret = ptrace_request(child, request, addr, data);
1040 break; 1046 break;
1041 } 1047 }
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index ecf6753b204a..16689b2930db 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -46,7 +46,7 @@ __handle_user_windows:
46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
47 ldx [%g6 + TI_FLAGS], %l0 47 ldx [%g6 + TI_FLAGS], %l0
48 48
491: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 491: andcc %l0, _TIF_SIGPENDING, %g0
50 be,pt %xcc, __handle_user_windows_continue 50 be,pt %xcc, __handle_user_windows_continue
51 nop 51 nop
52 mov %l5, %o1 52 mov %l5, %o1
@@ -86,7 +86,7 @@ __handle_perfctrs:
86 wrpr %g0, RTRAP_PSTATE, %pstate 86 wrpr %g0, RTRAP_PSTATE, %pstate
87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
88 ldx [%g6 + TI_FLAGS], %l0 88 ldx [%g6 + TI_FLAGS], %l0
891: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 891: andcc %l0, _TIF_SIGPENDING, %g0
90 90
91 be,pt %xcc, __handle_perfctrs_continue 91 be,pt %xcc, __handle_perfctrs_continue
92 sethi %hi(TSTATE_PEF), %o0 92 sethi %hi(TSTATE_PEF), %o0
@@ -195,7 +195,7 @@ __handle_preemption_continue:
195 andcc %l1, %o0, %g0 195 andcc %l1, %o0, %g0
196 andcc %l0, _TIF_NEED_RESCHED, %g0 196 andcc %l0, _TIF_NEED_RESCHED, %g0
197 bne,pn %xcc, __handle_preemption 197 bne,pn %xcc, __handle_preemption
198 andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 198 andcc %l0, _TIF_SIGPENDING, %g0
199 bne,pn %xcc, __handle_signal 199 bne,pn %xcc, __handle_signal
200__handle_signal_continue: 200__handle_signal_continue:
201 ldub [%g6 + TI_WSAVED], %o2 201 ldub [%g6 + TI_WSAVED], %o2
@@ -257,6 +257,7 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1
257 wr %o3, %g0, %y 257 wr %o3, %g0, %y
258 wrpr %l4, 0x0, %pil 258 wrpr %l4, 0x0, %pil
259 wrpr %g0, 0x1, %tl 259 wrpr %g0, 0x1, %tl
260 andn %l1, TSTATE_SYSCALL, %l1
260 wrpr %l1, %g0, %tstate 261 wrpr %l1, %g0, %tstate
261 wrpr %l2, %g0, %tpc 262 wrpr %l2, %g0, %tpc
262 wrpr %o2, %g0, %tnpc 263 wrpr %o2, %g0, %tnpc
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index 07c0443ea3f5..6e4dc67d16af 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -247,7 +247,9 @@ static long _sigpause_common(old_sigset_t set)
247 247
248 current->state = TASK_INTERRUPTIBLE; 248 current->state = TASK_INTERRUPTIBLE;
249 schedule(); 249 schedule();
250 set_thread_flag(TIF_RESTORE_SIGMASK); 250
251 set_restore_sigmask();
252
251 return -ERESTARTNOHAND; 253 return -ERESTARTNOHAND;
252} 254}
253 255
@@ -333,7 +335,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
333 regs->tnpc = tnpc; 335 regs->tnpc = tnpc;
334 336
335 /* Prevent syscall restart. */ 337 /* Prevent syscall restart. */
336 pt_regs_clear_trap_type(regs); 338 pt_regs_clear_syscall(regs);
337 339
338 sigdelsetmask(&set, ~_BLOCKABLE); 340 sigdelsetmask(&set, ~_BLOCKABLE);
339 spin_lock_irq(&current->sighand->siglock); 341 spin_lock_irq(&current->sighand->siglock);
@@ -499,7 +501,7 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka,
499} 501}
500 502
501static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, 503static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
502 struct sigaction *sa) 504 struct sigaction *sa)
503{ 505{
504 switch (regs->u_regs[UREG_I0]) { 506 switch (regs->u_regs[UREG_I0]) {
505 case ERESTART_RESTARTBLOCK: 507 case ERESTART_RESTARTBLOCK:
@@ -525,21 +527,19 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
525 */ 527 */
526static void do_signal(struct pt_regs *regs, unsigned long orig_i0) 528static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
527{ 529{
528 struct signal_deliver_cookie cookie;
529 struct k_sigaction ka; 530 struct k_sigaction ka;
531 int restart_syscall;
530 sigset_t *oldset; 532 sigset_t *oldset;
531 siginfo_t info; 533 siginfo_t info;
532 int signr; 534 int signr;
533 535
534 if (pt_regs_is_syscall(regs) && 536 if (pt_regs_is_syscall(regs) &&
535 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { 537 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
536 pt_regs_clear_trap_type(regs); 538 restart_syscall = 1;
537 cookie.restart_syscall = 1;
538 } else 539 } else
539 cookie.restart_syscall = 0; 540 restart_syscall = 0;
540 cookie.orig_i0 = orig_i0;
541 541
542 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 542 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
543 oldset = &current->saved_sigmask; 543 oldset = &current->saved_sigmask;
544 else 544 else
545 oldset = &current->blocked; 545 oldset = &current->blocked;
@@ -547,77 +547,62 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
547#ifdef CONFIG_COMPAT 547#ifdef CONFIG_COMPAT
548 if (test_thread_flag(TIF_32BIT)) { 548 if (test_thread_flag(TIF_32BIT)) {
549 extern void do_signal32(sigset_t *, struct pt_regs *, 549 extern void do_signal32(sigset_t *, struct pt_regs *,
550 struct signal_deliver_cookie *); 550 int restart_syscall,
551 do_signal32(oldset, regs, &cookie); 551 unsigned long orig_i0);
552 do_signal32(oldset, regs, restart_syscall, orig_i0);
552 return; 553 return;
553 } 554 }
554#endif 555#endif
555 556
556 signr = get_signal_to_deliver(&info, &ka, regs, &cookie); 557 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
558
559 /* If the debugger messes with the program counter, it clears
560 * the software "in syscall" bit, directing us to not perform
561 * a syscall restart.
562 */
563 if (restart_syscall && !pt_regs_is_syscall(regs))
564 restart_syscall = 0;
565
557 if (signr > 0) { 566 if (signr > 0) {
558 if (cookie.restart_syscall) 567 if (restart_syscall)
559 syscall_restart(cookie.orig_i0, regs, &ka.sa); 568 syscall_restart(orig_i0, regs, &ka.sa);
560 handle_signal(signr, &ka, &info, oldset, regs); 569 handle_signal(signr, &ka, &info, oldset, regs);
561 570
562 /* a signal was successfully delivered; the saved 571 /* A signal was successfully delivered; the saved
563 * sigmask will have been stored in the signal frame, 572 * sigmask will have been stored in the signal frame,
564 * and will be restored by sigreturn, so we can simply 573 * and will be restored by sigreturn, so we can simply
565 * clear the TIF_RESTORE_SIGMASK flag. 574 * clear the TS_RESTORE_SIGMASK flag.
566 */ 575 */
567 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 576 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
568 clear_thread_flag(TIF_RESTORE_SIGMASK);
569 return; 577 return;
570 } 578 }
571 if (cookie.restart_syscall && 579 if (restart_syscall &&
572 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 580 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
573 regs->u_regs[UREG_I0] == ERESTARTSYS || 581 regs->u_regs[UREG_I0] == ERESTARTSYS ||
574 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 582 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
575 /* replay the system call when we are done */ 583 /* replay the system call when we are done */
576 regs->u_regs[UREG_I0] = cookie.orig_i0; 584 regs->u_regs[UREG_I0] = orig_i0;
577 regs->tpc -= 4; 585 regs->tpc -= 4;
578 regs->tnpc -= 4; 586 regs->tnpc -= 4;
579 } 587 }
580 if (cookie.restart_syscall && 588 if (restart_syscall &&
581 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 589 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
582 regs->u_regs[UREG_G1] = __NR_restart_syscall; 590 regs->u_regs[UREG_G1] = __NR_restart_syscall;
583 regs->tpc -= 4; 591 regs->tpc -= 4;
584 regs->tnpc -= 4; 592 regs->tnpc -= 4;
585 } 593 }
586 594
587 /* if there's no signal to deliver, we just put the saved sigmask 595 /* If there's no signal to deliver, we just put the saved sigmask
588 * back 596 * back
589 */ 597 */
590 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 598 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
591 clear_thread_flag(TIF_RESTORE_SIGMASK); 599 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
592 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 600 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
593 } 601 }
594} 602}
595 603
596void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) 604void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags)
597{ 605{
598 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 606 if (thread_info_flags & _TIF_SIGPENDING)
599 do_signal(regs, orig_i0); 607 do_signal(regs, orig_i0);
600} 608}
601
602void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
603{
604 struct signal_deliver_cookie *cp = cookie;
605
606 if (cp->restart_syscall &&
607 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
608 regs->u_regs[UREG_I0] == ERESTARTSYS ||
609 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
610 /* replay the system call when we are done */
611 regs->u_regs[UREG_I0] = cp->orig_i0;
612 regs->tpc -= 4;
613 regs->tnpc -= 4;
614 cp->restart_syscall = 0;
615 }
616 if (cp->restart_syscall &&
617 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
618 regs->u_regs[UREG_G1] = __NR_restart_syscall;
619 regs->tpc -= 4;
620 regs->tnpc -= 4;
621 cp->restart_syscall = 0;
622 }
623}
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 0f6b7b156efd..97cdd1bf4a10 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -269,7 +269,7 @@ void do_sigreturn32(struct pt_regs *regs)
269 regs->tstate |= psr_to_tstate_icc(psr); 269 regs->tstate |= psr_to_tstate_icc(psr);
270 270
271 /* Prevent syscall restart. */ 271 /* Prevent syscall restart. */
272 pt_regs_clear_trap_type(regs); 272 pt_regs_clear_syscall(regs);
273 273
274 err |= __get_user(fpu_save, &sf->fpu_save); 274 err |= __get_user(fpu_save, &sf->fpu_save);
275 if (fpu_save) 275 if (fpu_save)
@@ -355,7 +355,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
355 regs->tstate |= psr_to_tstate_icc(psr); 355 regs->tstate |= psr_to_tstate_icc(psr);
356 356
357 /* Prevent syscall restart. */ 357 /* Prevent syscall restart. */
358 pt_regs_clear_trap_type(regs); 358 pt_regs_clear_syscall(regs);
359 359
360 err |= __get_user(fpu_save, &sf->fpu_save); 360 err |= __get_user(fpu_save, &sf->fpu_save);
361 if (fpu_save) 361 if (fpu_save)
@@ -768,48 +768,55 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
768 * mistake. 768 * mistake.
769 */ 769 */
770void do_signal32(sigset_t *oldset, struct pt_regs * regs, 770void do_signal32(sigset_t *oldset, struct pt_regs * regs,
771 struct signal_deliver_cookie *cookie) 771 int restart_syscall, unsigned long orig_i0)
772{ 772{
773 struct k_sigaction ka; 773 struct k_sigaction ka;
774 siginfo_t info; 774 siginfo_t info;
775 int signr; 775 int signr;
776 776
777 signr = get_signal_to_deliver(&info, &ka, regs, cookie); 777 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
778
779 /* If the debugger messes with the program counter, it clears
780 * the "in syscall" bit, directing us to not perform a syscall
781 * restart.
782 */
783 if (restart_syscall && !pt_regs_is_syscall(regs))
784 restart_syscall = 0;
785
778 if (signr > 0) { 786 if (signr > 0) {
779 if (cookie->restart_syscall) 787 if (restart_syscall)
780 syscall_restart32(cookie->orig_i0, regs, &ka.sa); 788 syscall_restart32(orig_i0, regs, &ka.sa);
781 handle_signal32(signr, &ka, &info, oldset, regs); 789 handle_signal32(signr, &ka, &info, oldset, regs);
782 790
783 /* a signal was successfully delivered; the saved 791 /* A signal was successfully delivered; the saved
784 * sigmask will have been stored in the signal frame, 792 * sigmask will have been stored in the signal frame,
785 * and will be restored by sigreturn, so we can simply 793 * and will be restored by sigreturn, so we can simply
786 * clear the TIF_RESTORE_SIGMASK flag. 794 * clear the TS_RESTORE_SIGMASK flag.
787 */ 795 */
788 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 796 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
789 clear_thread_flag(TIF_RESTORE_SIGMASK);
790 return; 797 return;
791 } 798 }
792 if (cookie->restart_syscall && 799 if (restart_syscall &&
793 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 800 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
794 regs->u_regs[UREG_I0] == ERESTARTSYS || 801 regs->u_regs[UREG_I0] == ERESTARTSYS ||
795 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 802 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
796 /* replay the system call when we are done */ 803 /* replay the system call when we are done */
797 regs->u_regs[UREG_I0] = cookie->orig_i0; 804 regs->u_regs[UREG_I0] = orig_i0;
798 regs->tpc -= 4; 805 regs->tpc -= 4;
799 regs->tnpc -= 4; 806 regs->tnpc -= 4;
800 } 807 }
801 if (cookie->restart_syscall && 808 if (restart_syscall &&
802 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 809 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
803 regs->u_regs[UREG_G1] = __NR_restart_syscall; 810 regs->u_regs[UREG_G1] = __NR_restart_syscall;
804 regs->tpc -= 4; 811 regs->tpc -= 4;
805 regs->tnpc -= 4; 812 regs->tnpc -= 4;
806 } 813 }
807 814
808 /* if there's no signal to deliver, we just put the saved sigmask 815 /* If there's no signal to deliver, we just put the saved sigmask
809 * back 816 * back
810 */ 817 */
811 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 818 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
812 clear_thread_flag(TIF_RESTORE_SIGMASK); 819 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
813 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 820 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
814 } 821 }
815} 822}
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 0dbc941f130e..ac1bff58c1ac 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -542,8 +542,7 @@ asmlinkage long sparc64_personality(unsigned long personality)
542 return ret; 542 return ret;
543} 543}
544 544
545int sparc64_mmap_check(unsigned long addr, unsigned long len, 545int sparc64_mmap_check(unsigned long addr, unsigned long len)
546 unsigned long flags)
547{ 546{
548 if (test_thread_flag(TIF_32BIT)) { 547 if (test_thread_flag(TIF_32BIT)) {
549 if (len >= STACK_TOP32) 548 if (len >= STACK_TOP32)
@@ -609,46 +608,19 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr,
609 unsigned long old_len, unsigned long new_len, 608 unsigned long old_len, unsigned long new_len,
610 unsigned long flags, unsigned long new_addr) 609 unsigned long flags, unsigned long new_addr)
611{ 610{
612 struct vm_area_struct *vma;
613 unsigned long ret = -EINVAL; 611 unsigned long ret = -EINVAL;
614 612
615 if (test_thread_flag(TIF_32BIT)) 613 if (test_thread_flag(TIF_32BIT))
616 goto out; 614 goto out;
617 if (unlikely(new_len >= VA_EXCLUDE_START)) 615 if (unlikely(new_len >= VA_EXCLUDE_START))
618 goto out; 616 goto out;
619 if (unlikely(invalid_64bit_range(addr, old_len))) 617 if (unlikely(sparc64_mmap_check(addr, old_len)))
618 goto out;
619 if (unlikely(sparc64_mmap_check(new_addr, new_len)))
620 goto out; 620 goto out;
621 621
622 down_write(&current->mm->mmap_sem); 622 down_write(&current->mm->mmap_sem);
623 if (flags & MREMAP_FIXED) {
624 if (invalid_64bit_range(new_addr, new_len))
625 goto out_sem;
626 } else if (invalid_64bit_range(addr, new_len)) {
627 unsigned long map_flags = 0;
628 struct file *file = NULL;
629
630 ret = -ENOMEM;
631 if (!(flags & MREMAP_MAYMOVE))
632 goto out_sem;
633
634 vma = find_vma(current->mm, addr);
635 if (vma) {
636 if (vma->vm_flags & VM_SHARED)
637 map_flags |= MAP_SHARED;
638 file = vma->vm_file;
639 }
640
641 /* MREMAP_FIXED checked above. */
642 new_addr = get_unmapped_area(file, addr, new_len,
643 vma ? vma->vm_pgoff : 0,
644 map_flags);
645 ret = new_addr;
646 if (new_addr & ~PAGE_MASK)
647 goto out_sem;
648 flags |= MREMAP_FIXED;
649 }
650 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 623 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
651out_sem:
652 up_write(&current->mm->mmap_sem); 624 up_write(&current->mm->mmap_sem);
653out: 625out:
654 return ret; 626 return ret;
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 1aa4288125f2..ba5bd626b39e 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -867,44 +867,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
867 unsigned long old_len, unsigned long new_len, 867 unsigned long old_len, unsigned long new_len,
868 unsigned long flags, u32 __new_addr) 868 unsigned long flags, u32 __new_addr)
869{ 869{
870 struct vm_area_struct *vma;
871 unsigned long ret = -EINVAL; 870 unsigned long ret = -EINVAL;
872 unsigned long new_addr = __new_addr; 871 unsigned long new_addr = __new_addr;
873 872
874 if (old_len > STACK_TOP32 || new_len > STACK_TOP32) 873 if (unlikely(sparc64_mmap_check(addr, old_len)))
875 goto out; 874 goto out;
876 if (addr > STACK_TOP32 - old_len) 875 if (unlikely(sparc64_mmap_check(new_addr, new_len)))
877 goto out; 876 goto out;
878 down_write(&current->mm->mmap_sem); 877 down_write(&current->mm->mmap_sem);
879 if (flags & MREMAP_FIXED) {
880 if (new_addr > STACK_TOP32 - new_len)
881 goto out_sem;
882 } else if (addr > STACK_TOP32 - new_len) {
883 unsigned long map_flags = 0;
884 struct file *file = NULL;
885
886 ret = -ENOMEM;
887 if (!(flags & MREMAP_MAYMOVE))
888 goto out_sem;
889
890 vma = find_vma(current->mm, addr);
891 if (vma) {
892 if (vma->vm_flags & VM_SHARED)
893 map_flags |= MAP_SHARED;
894 file = vma->vm_file;
895 }
896
897 /* MREMAP_FIXED checked above. */
898 new_addr = get_unmapped_area(file, addr, new_len,
899 vma ? vma->vm_pgoff : 0,
900 map_flags);
901 ret = new_addr;
902 if (new_addr & ~PAGE_MASK)
903 goto out_sem;
904 flags |= MREMAP_FIXED;
905 }
906 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 878 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
907out_sem:
908 up_write(&current->mm->mmap_sem); 879 up_write(&current->mm->mmap_sem);
909out: 880out:
910 return ret; 881 return ret;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index ec3e2c72302a..3c7b9471eafb 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -610,8 +610,6 @@ static void __init remap_kernel(void)
610 610
611static void __init inherit_prom_mappings(void) 611static void __init inherit_prom_mappings(void)
612{ 612{
613 read_obp_translations();
614
615 /* Now fixup OBP's idea about where we really are mapped. */ 613 /* Now fixup OBP's idea about where we really are mapped. */
616 printk("Remapping the kernel... "); 614 printk("Remapping the kernel... ");
617 remap_kernel(); 615 remap_kernel();
@@ -770,7 +768,7 @@ static void __init find_ramdisk(unsigned long phys_base)
770 initrd_start = ramdisk_image; 768 initrd_start = ramdisk_image;
771 initrd_end = ramdisk_image + sparc_ramdisk_size; 769 initrd_end = ramdisk_image + sparc_ramdisk_size;
772 770
773 lmb_reserve(initrd_start, initrd_end); 771 lmb_reserve(initrd_start, sparc_ramdisk_size);
774 772
775 initrd_start += PAGE_OFFSET; 773 initrd_start += PAGE_OFFSET;
776 initrd_end += PAGE_OFFSET; 774 initrd_end += PAGE_OFFSET;
@@ -1747,7 +1745,17 @@ void __init paging_init(void)
1747 1745
1748 lmb_init(); 1746 lmb_init();
1749 1747
1750 /* Find available physical memory... */ 1748 /* Find available physical memory...
1749 *
1750 * Read it twice in order to work around a bug in openfirmware.
1751 * The call to grab this table itself can cause openfirmware to
1752 * allocate memory, which in turn can take away some space from
1753 * the list of available memory. Reading it twice makes sure
1754 * we really do get the final value.
1755 */
1756 read_obp_translations();
1757 read_obp_memory("reg", &pall[0], &pall_ents);
1758 read_obp_memory("available", &pavail[0], &pavail_ents);
1751 read_obp_memory("available", &pavail[0], &pavail_ents); 1759 read_obp_memory("available", &pavail[0], &pavail_ents);
1752 1760
1753 phys_base = 0xffffffffffffffffUL; 1761 phys_base = 0xffffffffffffffffUL;
@@ -1788,8 +1796,6 @@ void __init paging_init(void)
1788 1796
1789 inherit_prom_mappings(); 1797 inherit_prom_mappings();
1790 1798
1791 read_obp_memory("reg", &pall[0], &pall_ents);
1792
1793 init_kpte_bitmap(); 1799 init_kpte_bitmap();
1794 1800
1795 /* Ok, we can use our TLB miss and window trap handlers safely. */ 1801 /* Ok, we can use our TLB miss and window trap handlers safely. */
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 3a4b396d7979..1b238ebae6b3 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -145,14 +145,14 @@ config LEGACY_PTYS
145 systems, it is safe to say N. 145 systems, it is safe to say N.
146 146
147config RAW_DRIVER 147config RAW_DRIVER
148 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)" 148 tristate "RAW driver (/dev/raw/rawN)"
149 depends on BLOCK
149 help 150 help
150 The raw driver permits block devices to be bound to /dev/raw/rawN. 151 The raw driver permits block devices to be bound to /dev/raw/rawN.
151 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O. 152 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
152 See the raw(8) manpage for more details. 153 See the raw(8) manpage for more details.
153 154
154 The raw driver is deprecated and will be removed soon. 155 Applications should preferably open the device (eg /dev/hda1)
155 Applications should simply open the device (eg /dev/hda1)
156 with the O_DIRECT flag. 156 with the O_DIRECT flag.
157 157
158config MAX_RAW_DEVS 158config MAX_RAW_DEVS
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 025764089ac8..cfeb3f4a44af 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -11,6 +11,7 @@
11#include <termios.h> 11#include <termios.h>
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
14#include "os.h" 15#include "os.h"
15#include "um_malloc.h" 16#include "um_malloc.h"
16#include "user.h" 17#include "user.h"
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index ca8c9e11a39b..f5701fd2ef90 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -8,7 +8,7 @@
8 8
9static inline void *cow_malloc(int size) 9static inline void *cow_malloc(int size)
10{ 10{
11 return kmalloc(size, UM_GFP_KERNEL); 11 return uml_kmalloc(size, UM_GFP_KERNEL);
12} 12}
13 13
14static inline void cow_free(void *ptr) 14static inline void cow_free(void *ptr)
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index f23c109a055c..f8e85e0bdace 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
34{ 34{
35 struct sockaddr_un *sun; 35 struct sockaddr_un *sun;
36 36
37 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 37 sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
38 if (sun == NULL) { 38 if (sun == NULL) {
39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " 39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
40 "failed\n"); 40 "failed\n");
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
83 goto out_close; 83 goto out_close;
84 } 84 }
85 85
86 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 86 sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
87 if (sun == NULL) { 87 if (sun == NULL) {
88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " 88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
89 "failed\n"); 89 "failed\n");
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 0a2bb5b64b82..f5a981a16240 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 43 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
44 if (data == NULL) 44 if (data == NULL)
45 return NULL; 45 return NULL;
46 46
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index ff1b22b69e9c..368219cc2366 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -154,7 +154,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
154 case SNDCTL_DSP_SUBDIVIDE: 154 case SNDCTL_DSP_SUBDIVIDE:
155 case SNDCTL_DSP_SETFRAGMENT: 155 case SNDCTL_DSP_SETFRAGMENT:
156 if (get_user(data, (int __user *) arg)) 156 if (get_user(data, (int __user *) arg))
157 return EFAULT; 157 return -EFAULT;
158 break; 158 break;
159 default: 159 default:
160 break; 160 break;
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 5f647d7a7292..ee19e91568a2 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -15,6 +15,7 @@
15#include <unistd.h> 15#include <unistd.h>
16#include <errno.h> 16#include <errno.h>
17#include <netinet/in.h> 17#include <netinet/in.h>
18#include "kern_constants.h"
18#include "mcast.h" 19#include "mcast.h"
19#include "net_user.h" 20#include "net_user.h"
20#include "um_malloc.h" 21#include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
24{ 25{
25 struct sockaddr_in *sin; 26 struct sockaddr_in *sin;
26 27
27 sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL); 28 sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
28 if (sin == NULL) { 29 if (sin == NULL) {
29 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in " 30 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
30 "failed\n"); 31 "failed\n");
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index abf2653f5517..9415dd9e63ef 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char *addr,
222 netmask[2], netmask[3]); 222 netmask[2], netmask[3]);
223 223
224 output_len = UM_KERN_PAGE_SIZE; 224 output_len = UM_KERN_PAGE_SIZE;
225 output = kmalloc(output_len, UM_GFP_KERNEL); 225 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
226 if (output == NULL) 226 if (output == NULL)
227 printk(UM_KERN_ERR "change : failed to allocate output " 227 printk(UM_KERN_ERR "change : failed to allocate output "
228 "buffer\n"); 228 "buffer\n");
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index d269ca387f10..b49bf56a56aa 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -47,7 +47,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)
47 if (kern_data == NULL) 47 if (kern_data == NULL)
48 return NULL; 48 return NULL;
49 49
50 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 50 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
51 if (data == NULL) 51 if (data == NULL)
52 goto err; 52 goto err;
53 53
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index 49c79dda6046..1113911dcb2b 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
29{ 29{
30 struct pty_chan *data; 30 struct pty_chan *data;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 35
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index 71f0959c1535..4949044773ba 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -1,4 +1,5 @@
1/* Copyright (C) 2005 Jeff Dike <jdike@addtoit.com> */ 1/* Copyright (C) 2005 - 2008 Jeff Dike <jdike@{linux.intel,addtoit}.com> */
2
2/* Much of this ripped from drivers/char/hw_random.c, see there for other 3/* Much of this ripped from drivers/char/hw_random.c, see there for other
3 * copyright. 4 * copyright.
4 * 5 *
@@ -8,16 +9,18 @@
8#include <linux/sched.h> 9#include <linux/sched.h>
9#include <linux/module.h> 10#include <linux/module.h>
10#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/interrupt.h>
11#include <linux/miscdevice.h> 13#include <linux/miscdevice.h>
12#include <linux/delay.h> 14#include <linux/delay.h>
13#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include "irq_kern.h"
14#include "os.h" 17#include "os.h"
15 18
16/* 19/*
17 * core module and version information 20 * core module and version information
18 */ 21 */
19#define RNG_VERSION "1.0.0" 22#define RNG_VERSION "1.0.0"
20#define RNG_MODULE_NAME "random" 23#define RNG_MODULE_NAME "hw_random"
21 24
22#define RNG_MISCDEV_MINOR 183 /* official */ 25#define RNG_MISCDEV_MINOR 183 /* official */
23 26
@@ -26,47 +29,67 @@
26 * protects against a module being loaded twice at the same time. 29 * protects against a module being loaded twice at the same time.
27 */ 30 */
28static int random_fd = -1; 31static int random_fd = -1;
32static DECLARE_WAIT_QUEUE_HEAD(host_read_wait);
29 33
30static int rng_dev_open (struct inode *inode, struct file *filp) 34static int rng_dev_open (struct inode *inode, struct file *filp)
31{ 35{
32 /* enforce read-only access to this chrdev */ 36 /* enforce read-only access to this chrdev */
33 if ((filp->f_mode & FMODE_READ) == 0) 37 if ((filp->f_mode & FMODE_READ) == 0)
34 return -EINVAL; 38 return -EINVAL;
35 if (filp->f_mode & FMODE_WRITE) 39 if ((filp->f_mode & FMODE_WRITE) != 0)
36 return -EINVAL; 40 return -EINVAL;
37 41
38 return 0; 42 return 0;
39} 43}
40 44
45static atomic_t host_sleep_count = ATOMIC_INIT(0);
46
41static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, 47static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
42 loff_t * offp) 48 loff_t *offp)
43{ 49{
44 u32 data; 50 u32 data;
45 int n, ret = 0, have_data; 51 int n, ret = 0, have_data;
46 52
47 while(size){ 53 while (size) {
48 n = os_read_file(random_fd, &data, sizeof(data)); 54 n = os_read_file(random_fd, &data, sizeof(data));
49 if(n > 0){ 55 if (n > 0) {
50 have_data = n; 56 have_data = n;
51 while (have_data && size) { 57 while (have_data && size) {
52 if (put_user((u8)data, buf++)) { 58 if (put_user((u8) data, buf++)) {
53 ret = ret ? : -EFAULT; 59 ret = ret ? : -EFAULT;
54 break; 60 break;
55 } 61 }
56 size--; 62 size--;
57 ret++; 63 ret++;
58 have_data--; 64 have_data--;
59 data>>=8; 65 data >>= 8;
60 } 66 }
61 } 67 }
62 else if(n == -EAGAIN){ 68 else if (n == -EAGAIN) {
63 if (filp->f_flags & O_NONBLOCK) 69 DECLARE_WAITQUEUE(wait, current);
64 return ret ? : -EAGAIN; 70
65 71 if (filp->f_flags & O_NONBLOCK)
66 if(need_resched()) 72 return ret ? : -EAGAIN;
67 schedule_timeout_interruptible(1); 73
68 } 74 atomic_inc(&host_sleep_count);
69 else return n; 75 reactivate_fd(random_fd, RANDOM_IRQ);
76 add_sigio_fd(random_fd);
77
78 add_wait_queue(&host_read_wait, &wait);
79 set_task_state(current, TASK_INTERRUPTIBLE);
80
81 schedule();
82 set_task_state(current, TASK_RUNNING);
83 remove_wait_queue(&host_read_wait, &wait);
84
85 if (atomic_dec_and_test(&host_sleep_count)) {
86 ignore_sigio_fd(random_fd);
87 deactivate_fd(random_fd, RANDOM_IRQ);
88 }
89 }
90 else
91 return n;
92
70 if (signal_pending (current)) 93 if (signal_pending (current))
71 return ret ? : -ERESTARTSYS; 94 return ret ? : -ERESTARTSYS;
72 } 95 }
@@ -86,6 +109,13 @@ static struct miscdevice rng_miscdev = {
86 &rng_chrdev_ops, 109 &rng_chrdev_ops,
87}; 110};
88 111
112static irqreturn_t random_interrupt(int irq, void *data)
113{
114 wake_up(&host_read_wait);
115
116 return IRQ_HANDLED;
117}
118
89/* 119/*
90 * rng_init - initialize RNG module 120 * rng_init - initialize RNG module
91 */ 121 */
@@ -93,28 +123,33 @@ static int __init rng_init (void)
93{ 123{
94 int err; 124 int err;
95 125
96 err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0); 126 err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0);
97 if(err < 0) 127 if (err < 0)
98 goto out; 128 goto out;
99 129
100 random_fd = err; 130 random_fd = err;
101 131
102 err = os_set_fd_block(random_fd, 0); 132 err = um_request_irq(RANDOM_IRQ, random_fd, IRQ_READ, random_interrupt,
103 if(err) 133 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "random",
134 NULL);
135 if (err)
104 goto err_out_cleanup_hw; 136 goto err_out_cleanup_hw;
105 137
138 sigio_broken(random_fd, 1);
139
106 err = misc_register (&rng_miscdev); 140 err = misc_register (&rng_miscdev);
107 if (err) { 141 if (err) {
108 printk (KERN_ERR RNG_MODULE_NAME ": misc device register failed\n"); 142 printk (KERN_ERR RNG_MODULE_NAME ": misc device register "
143 "failed\n");
109 goto err_out_cleanup_hw; 144 goto err_out_cleanup_hw;
110 } 145 }
146out:
147 return err;
111 148
112 out: 149err_out_cleanup_hw:
113 return err; 150 os_close_file(random_fd);
114 151 random_fd = -1;
115 err_out_cleanup_hw: 152 goto out;
116 random_fd = -1;
117 goto out;
118} 153}
119 154
120/* 155/*
@@ -122,6 +157,7 @@ static int __init rng_init (void)
122 */ 157 */
123static void __exit rng_cleanup (void) 158static void __exit rng_cleanup (void)
124{ 159{
160 os_close_file(random_fd);
125 misc_deregister (&rng_miscdev); 161 misc_deregister (&rng_miscdev);
126} 162}
127 163
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 8b80505a3fb0..a1c2d2c98a94 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -96,7 +96,7 @@ static int slip_tramp(char **argv, int fd)
96 pid = err; 96 pid = err;
97 97
98 output_len = UM_KERN_PAGE_SIZE; 98 output_len = UM_KERN_PAGE_SIZE;
99 output = kmalloc(output_len, UM_GFP_KERNEL); 99 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
100 if (output == NULL) { 100 if (output == NULL) {
101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output " 101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output "
102 "buffer\n"); 102 "buffer\n");
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index c930fedc5172..495858a090e4 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
29 } 29 }
30 str++; 30 str++;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 *data = ((struct tty_chan) { .dev = str, 35 *data = ((struct tty_chan) { .dev = str,
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 5e45e39a8a8d..44ad1607be2d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1178,8 +1178,8 @@ static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
1178 * by one word. Thanks to Lynn Kerby for the fix and James McMechan 1178 * by one word. Thanks to Lynn Kerby for the fix and James McMechan
1179 * for the original diagnosis. 1179 * for the original diagnosis.
1180 */ 1180 */
1181 if(*cow_offset == ((bitmap_len + sizeof(unsigned long) - 1) / 1181 if (*cow_offset == (DIV_ROUND_UP(bitmap_len,
1182 sizeof(unsigned long) - 1)) 1182 sizeof(unsigned long)) - 1))
1183 (*cow_offset)--; 1183 (*cow_offset)--;
1184 1184
1185 bitmap_words[0] = bitmap[*cow_offset]; 1185 bitmap_words[0] = bitmap[*cow_offset];
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 8a1c18a9b240..da2caa5a21ef 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -30,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
30{ 30{
31 struct xterm_chan *data; 31 struct xterm_chan *data;
32 32
33 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 33 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
34 if (data == NULL) 34 if (data == NULL)
35 return NULL; 35 return NULL;
36 *data = ((struct xterm_chan) { .pid = -1, 36 *data = ((struct xterm_chan) { .pid = -1,
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h
index cac542d8ff70..58e852dfb0ce 100644
--- a/arch/um/include/as-layout.h
+++ b/arch/um/include/as-layout.h
@@ -23,16 +23,16 @@
23 */ 23 */
24 24
25#ifdef __ASSEMBLY__ 25#ifdef __ASSEMBLY__
26#define _AC(X, Y) (Y) 26#define _UML_AC(X, Y) (Y)
27#else 27#else
28#define __AC(X, Y) (X (Y)) 28#define __UML_AC(X, Y) (X(Y))
29#define _AC(X, Y) __AC(X, Y) 29#define _UML_AC(X, Y) __UML_AC(X, Y)
30#endif 30#endif
31 31
32#define STUB_START _AC(, 0x100000) 32#define STUB_START _UML_AC(, 0x100000)
33#define STUB_CODE _AC((unsigned long), STUB_START) 33#define STUB_CODE _UML_AC((unsigned long), STUB_START)
34#define STUB_DATA _AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE) 34#define STUB_DATA _UML_AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE)
35#define STUB_END _AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE) 35#define STUB_END _UML_AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE)
36 36
37#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
38 38
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 979b73e6352d..311a0d3d93af 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -58,11 +58,11 @@ struct line {
58}; 58};
59 59
60#define LINE_INIT(str, d) \ 60#define LINE_INIT(str, d) \
61 { .count_lock = SPIN_LOCK_UNLOCKED, \ 61 { .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
62 .init_str = str, \ 62 .init_str = str, \
63 .init_pri = INIT_STATIC, \ 63 .init_pri = INIT_STATIC, \
64 .valid = 1, \ 64 .valid = 1, \
65 .lock = SPIN_LOCK_UNLOCKED, \ 65 .lock = __SPIN_LOCK_UNLOCKED((str).lock), \
66 .driver = d } 66 .driver = d }
67 67
68extern void line_close(struct tty_struct *tty, struct file * filp); 68extern void line_close(struct tty_struct *tty, struct file * filp);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 32c799e3a495..e2716ac8889a 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -290,6 +290,7 @@ extern void os_set_ioignore(void);
290extern int add_sigio_fd(int fd); 290extern int add_sigio_fd(int fd);
291extern int ignore_sigio_fd(int fd); 291extern int ignore_sigio_fd(int fd);
292extern void maybe_sigio_broken(int fd, int read); 292extern void maybe_sigio_broken(int fd, int read);
293extern void sigio_broken(int fd, int read);
293 294
294/* sys-x86_64/prctl.c */ 295/* sys-x86_64/prctl.c */
295extern int os_arch_prctl(int pid, int code, unsigned long *addr); 296extern int os_arch_prctl(int pid, int code, unsigned long *addr);
diff --git a/arch/um/include/process.h b/arch/um/include/process.h
index 5af9157ff54f..bb873a51262e 100644
--- a/arch/um/include/process.h
+++ b/arch/um/include/process.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -8,18 +8,10 @@
8 8
9#include <signal.h> 9#include <signal.h>
10 10
11extern void sig_handler(int sig, struct sigcontext sc); 11/* Copied from linux/compiler-gcc.h since we can't include it directly */
12extern void alarm_handler(int sig, struct sigcontext sc); 12#define barrier() __asm__ __volatile__("": : :"memory")
13 13
14#endif 14extern void sig_handler(int sig, struct sigcontext *sc);
15extern void alarm_handler(int sig, struct sigcontext *sc);
15 16
16/* 17#endif
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/skas_ptrace.h b/arch/um/include/skas_ptrace.h
index cd2327d09c8d..3d31bbacd016 100644
--- a/arch/um/include/skas_ptrace.h
+++ b/arch/um/include/skas_ptrace.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -12,14 +12,3 @@
12#include "sysdep/skas_ptrace.h" 12#include "sysdep/skas_ptrace.h"
13 13
14#endif 14#endif
15
16/*
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
index 75650723c38f..ef56247e4143 100644
--- a/arch/um/include/sysdep-i386/ptrace_user.h
+++ b/arch/um/include/sysdep-i386/ptrace_user.h
@@ -41,38 +41,10 @@
41#define PT_SP_OFFSET PT_OFFSET(UESP) 41#define PT_SP_OFFSET PT_OFFSET(UESP)
42#define PT_SP(regs) ((regs)[UESP]) 42#define PT_SP(regs) ((regs)[UESP])
43 43
44#define FP_SIZE ((HOST_XFP_SIZE > HOST_FP_SIZE) ? HOST_XFP_SIZE : HOST_FP_SIZE) 44#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
45 45
46#ifndef FRAME_SIZE 46#ifndef FRAME_SIZE
47#define FRAME_SIZE (17) 47#define FRAME_SIZE (17)
48#endif 48#endif
49#define FRAME_SIZE_OFFSET (FRAME_SIZE * sizeof(unsigned long))
50
51#define FP_FRAME_SIZE (27)
52#define FPX_FRAME_SIZE (128)
53
54#ifdef PTRACE_GETREGS
55#define UM_HAVE_GETREGS
56#endif
57
58#ifdef PTRACE_SETREGS
59#define UM_HAVE_SETREGS
60#endif
61
62#ifdef PTRACE_GETFPREGS
63#define UM_HAVE_GETFPREGS
64#endif
65
66#ifdef PTRACE_SETFPREGS
67#define UM_HAVE_SETFPREGS
68#endif
69
70#ifdef PTRACE_GETFPXREGS
71#define UM_HAVE_GETFPXREGS
72#endif
73
74#ifdef PTRACE_SETFPXREGS
75#define UM_HAVE_SETFPXREGS
76#endif
77 49
78#endif 50#endif
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
index 67e77122aa45..f583c87111a0 100644
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -10,7 +10,7 @@
10 10
11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2) 11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
12 12
13#define GET_FAULTINFO_FROM_SC(fi,sc) \ 13#define GET_FAULTINFO_FROM_SC(fi, sc) \
14 { \ 14 { \
15 (fi).cr2 = SC_CR2(sc); \ 15 (fi).cr2 = SC_CR2(sc); \
16 (fi).error_code = SC_ERR(sc); \ 16 (fi).error_code = SC_ERR(sc); \
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h
index 45c0bd881cb3..4dbccdb58f48 100644
--- a/arch/um/include/sysdep-x86_64/ptrace_user.h
+++ b/arch/um/include/sysdep-x86_64/ptrace_user.h
@@ -48,7 +48,8 @@
48#define PT_ORIG_RAX_OFFSET (ORIG_RAX) 48#define PT_ORIG_RAX_OFFSET (ORIG_RAX)
49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)]) 49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)])
50 50
51/* x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though 51/*
52 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
52 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the 53 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
53 * 2.4 name and value for 2.4 host compatibility. 54 * 2.4 name and value for 2.4 host compatibility.
54 */ 55 */
@@ -56,7 +57,8 @@
56#define PTRACE_OLDSETOPTIONS 21 57#define PTRACE_OLDSETOPTIONS 21
57#endif 58#endif
58 59
59/* These are before the system call, so the system call number is RAX 60/*
61 * These are before the system call, so the system call number is RAX
60 * rather than ORIG_RAX, and arg4 is R10 rather than RCX 62 * rather than ORIG_RAX, and arg4 is R10 rather than RCX
61 */ 63 */
62#define REGS_SYSCALL_NR PT_INDEX(RAX) 64#define REGS_SYSCALL_NR PT_INDEX(RAX)
@@ -73,14 +75,3 @@
73#define FP_SIZE (HOST_FP_SIZE) 75#define FP_SIZE (HOST_FP_SIZE)
74 76
75#endif 77#endif
76
77/*
78 * Overrides for Emacs so that we follow Linus's tabbing style.
79 * Emacs will notice this stuff at the end of the file and automatically
80 * adjust the settings for this buffer only. This must remain at the end
81 * of the file.
82 * ---------------------------------------------------------------------------
83 * Local variables:
84 * c-file-style: "linux"
85 * End:
86 */
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h
index 0ad17cb83d96..c554d706d106 100644
--- a/arch/um/include/um_malloc.h
+++ b/arch/um/include/um_malloc.h
@@ -8,15 +8,12 @@
8 8
9#include "kern_constants.h" 9#include "kern_constants.h"
10 10
11extern void *__kmalloc(int size, int flags); 11extern void *uml_kmalloc(int size, int flags);
12static inline void *kmalloc(int size, int flags)
13{
14 return __kmalloc(size, flags);
15}
16
17extern void kfree(const void *ptr); 12extern void kfree(const void *ptr);
18 13
19extern void *vmalloc(unsigned long size); 14extern void *vmalloc(unsigned long size);
20extern void vfree(void *ptr); 15extern void vfree(void *ptr);
21 16
22#endif /* __UM_MALLOC_H__ */ 17#endif /* __UM_MALLOC_H__ */
18
19
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 26090b7f323e..9975e1ab44fb 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
4OUTPUT_ARCH(ELF_ARCH) 5OUTPUT_ARCH(ELF_ARCH)
@@ -21,7 +22,7 @@ SECTIONS
21 _einittext = .; 22 _einittext = .;
22 } 23 }
23 24
24 . = ALIGN(4096); 25 . = ALIGN(PAGE_SIZE);
25 26
26 /* Read-only sections, merged into text segment: */ 27 /* Read-only sections, merged into text segment: */
27 .hash : { *(.hash) } 28 .hash : { *(.hash) }
@@ -68,9 +69,9 @@ SECTIONS
68 /* .gnu.warning sections are handled specially by elf32.em. */ 69 /* .gnu.warning sections are handled specially by elf32.em. */
69 *(.gnu.warning) 70 *(.gnu.warning)
70 71
71 . = ALIGN(4096); 72 . = ALIGN(PAGE_SIZE);
72 } =0x90909090 73 } =0x90909090
73 . = ALIGN(4096); 74 . = ALIGN(PAGE_SIZE);
74 .syscall_stub : { 75 .syscall_stub : {
75 __syscall_stub_start = .; 76 __syscall_stub_start = .;
76 *(.__syscall_stub*) 77 *(.__syscall_stub*)
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 2eea1ff235e6..b0ee64622ff7 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -375,3 +375,8 @@ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
375 return pmd; 375 return pmd;
376} 376}
377#endif 377#endif
378
379void *uml_kmalloc(int size, int flags)
380{
381 return kmalloc(size, flags);
382}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 0d0cea2ac98d..c3e2f369c33c 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -75,7 +75,7 @@ static irqreturn_t um_timer(int irq, void *dev)
75 75
76static cycle_t itimer_read(void) 76static cycle_t itimer_read(void)
77{ 77{
78 return os_nsecs(); 78 return os_nsecs() / 1000;
79} 79}
80 80
81static struct clocksource itimer_clocksource = { 81static struct clocksource itimer_clocksource = {
@@ -83,7 +83,7 @@ static struct clocksource itimer_clocksource = {
83 .rating = 300, 83 .rating = 300,
84 .read = itimer_read, 84 .read = itimer_read,
85 .mask = CLOCKSOURCE_MASK(64), 85 .mask = CLOCKSOURCE_MASK(64),
86 .mult = 1, 86 .mult = 1000,
87 .shift = 0, 87 .shift = 0,
88 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 88 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
89}; 89};
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 56deed623446..9db85b2ce698 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -150,7 +150,7 @@ __uml_setup("root=", uml_root_setup,
150static int __init no_skas_debug_setup(char *line, int *add) 150static int __init no_skas_debug_setup(char *line, int *add)
151{ 151{
152 printf("'debug' is not necessary to gdb UML in skas mode - run \n"); 152 printf("'debug' is not necessary to gdb UML in skas mode - run \n");
153 printf("'gdb linux'"); 153 printf("'gdb linux'\n");
154 154
155 return 0; 155 return 0;
156} 156}
@@ -258,6 +258,7 @@ int __init linux_main(int argc, char **argv)
258{ 258{
259 unsigned long avail, diff; 259 unsigned long avail, diff;
260 unsigned long virtmem_size, max_physmem; 260 unsigned long virtmem_size, max_physmem;
261 unsigned long stack;
261 unsigned int i; 262 unsigned int i;
262 int add; 263 int add;
263 char * mode; 264 char * mode;
@@ -348,7 +349,9 @@ int __init linux_main(int argc, char **argv)
348 } 349 }
349 350
350 virtmem_size = physmem_size; 351 virtmem_size = physmem_size;
351 avail = TASK_SIZE - start_vm; 352 stack = (unsigned long) argv;
353 stack &= ~(1024 * 1024 - 1);
354 avail = stack - start_vm;
352 if (physmem_size > avail) 355 if (physmem_size > avail)
353 virtmem_size = avail; 356 virtmem_size = avail;
354 end_vm = start_vm + virtmem_size; 357 end_vm = start_vm + virtmem_size;
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 5828c1d54505..11b835248b86 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
4OUTPUT_ARCH(ELF_ARCH) 5OUTPUT_ARCH(ELF_ARCH)
@@ -26,7 +27,7 @@ SECTIONS
26 INIT_TEXT 27 INIT_TEXT
27 _einittext = .; 28 _einittext = .;
28 } 29 }
29 . = ALIGN(4096); 30 . = ALIGN(PAGE_SIZE);
30 31
31 .text : 32 .text :
32 { 33 {
@@ -39,7 +40,7 @@ SECTIONS
39 *(.gnu.linkonce.t*) 40 *(.gnu.linkonce.t*)
40 } 41 }
41 42
42 . = ALIGN(4096); 43 . = ALIGN(PAGE_SIZE);
43 .syscall_stub : { 44 .syscall_stub : {
44 __syscall_stub_start = .; 45 __syscall_stub_start = .;
45 *(.__syscall_stub*) 46 *(.__syscall_stub*)
@@ -79,7 +80,7 @@ SECTIONS
79 .sdata : { *(.sdata) } 80 .sdata : { *(.sdata) }
80 _edata = .; 81 _edata = .;
81 PROVIDE (edata = .); 82 PROVIDE (edata = .);
82 . = ALIGN(0x1000); 83 . = ALIGN(PAGE_SIZE);
83 .sbss : 84 .sbss :
84 { 85 {
85 __bss_start = .; 86 __bss_start = .;
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index 6fb0b174f538..cc72cb2c1af6 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -52,7 +52,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
52 return; 52 return;
53 } 53 }
54 54
55 output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL); 55 output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
56 if (output == NULL) 56 if (output == NULL)
57 printk(UM_KERN_ERR "etap_change : Failed to allocate output " 57 printk(UM_KERN_ERR "etap_change : Failed to allocate output "
58 "buffer\n"); 58 "buffer\n");
@@ -165,7 +165,7 @@ static int etap_open(void *data)
165 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], 165 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
166 control_fds[1], data_fds[0], data_fds[1]); 166 control_fds[1], data_fds[0], data_fds[1]);
167 output_len = UM_KERN_PAGE_SIZE; 167 output_len = UM_KERN_PAGE_SIZE;
168 output = kmalloc(output_len, UM_GFP_KERNEL); 168 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
169 read_output(control_fds[0], output, output_len); 169 read_output(control_fds[0], output, output_len);
170 170
171 if (output == NULL) 171 if (output == NULL)
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index f25c29a12d00..74ca7aabf4e1 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -71,8 +71,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
71 data.pre_data = pre_data; 71 data.pre_data = pre_data;
72 data.argv = argv; 72 data.argv = argv;
73 data.fd = fds[1]; 73 data.fd = fds[1];
74 data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) : 74 data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
75 kmalloc(PATH_MAX, UM_GFP_KERNEL); 75 uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
76 pid = clone(helper_child, (void *) sp, CLONE_VM, &data); 76 pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
77 if (pid < 0) { 77 if (pid < 0) {
78 ret = -errno; 78 ret = -errno;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index abb9b0ffd960..eee69b9f52c9 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -199,7 +199,7 @@ void *__wrap_malloc(int size)
199 return __real_malloc(size); 199 return __real_malloc(size);
200 else if (size <= UM_KERN_PAGE_SIZE) 200 else if (size <= UM_KERN_PAGE_SIZE)
201 /* finding contiguous pages can be hard*/ 201 /* finding contiguous pages can be hard*/
202 ret = kmalloc(size, UM_GFP_KERNEL); 202 ret = uml_kmalloc(size, UM_GFP_KERNEL);
203 else ret = vmalloc(size); 203 else ret = vmalloc(size);
204 204
205 /* 205 /*
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index abf47a7c4abd..eb8f2e4be192 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -15,6 +15,7 @@
15#include "kern_util.h" 15#include "kern_util.h"
16#include "init.h" 16#include "init.h"
17#include "os.h" 17#include "os.h"
18#include "process.h"
18#include "sigio.h" 19#include "sigio.h"
19#include "um_malloc.h" 20#include "um_malloc.h"
20#include "user.h" 21#include "user.h"
@@ -109,7 +110,7 @@ static int need_poll(struct pollfds *polls, int n)
109 if (n <= polls->size) 110 if (n <= polls->size)
110 return 0; 111 return 0;
111 112
112 new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC); 113 new = uml_kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
113 if (new == NULL) { 114 if (new == NULL) {
114 printk(UM_KERN_ERR "need_poll : failed to allocate new " 115 printk(UM_KERN_ERR "need_poll : failed to allocate new "
115 "pollfds\n"); 116 "pollfds\n");
@@ -243,7 +244,7 @@ static struct pollfd *setup_initial_poll(int fd)
243{ 244{
244 struct pollfd *p; 245 struct pollfd *p;
245 246
246 p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL); 247 p = uml_kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
247 if (p == NULL) { 248 if (p == NULL) {
248 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate " 249 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate "
249 "poll\n"); 250 "poll\n");
@@ -338,20 +339,10 @@ out_close1:
338 close(l_write_sigio_fds[1]); 339 close(l_write_sigio_fds[1]);
339} 340}
340 341
341/* Changed during early boot */ 342void sigio_broken(int fd, int read)
342static int pty_output_sigio = 0;
343static int pty_close_sigio = 0;
344
345void maybe_sigio_broken(int fd, int read)
346{ 343{
347 int err; 344 int err;
348 345
349 if (!isatty(fd))
350 return;
351
352 if ((read || pty_output_sigio) && (!read || pty_close_sigio))
353 return;
354
355 write_sigio_workaround(); 346 write_sigio_workaround();
356 347
357 sigio_lock(); 348 sigio_lock();
@@ -370,6 +361,21 @@ out:
370 sigio_unlock(); 361 sigio_unlock();
371} 362}
372 363
364/* Changed during early boot */
365static int pty_output_sigio;
366static int pty_close_sigio;
367
368void maybe_sigio_broken(int fd, int read)
369{
370 if (!isatty(fd))
371 return;
372
373 if ((read || pty_output_sigio) && (!read || pty_close_sigio))
374 return;
375
376 sigio_broken(fd, read);
377}
378
373static void sigio_cleanup(void) 379static void sigio_cleanup(void)
374{ 380{
375 if (write_sigio_pid == -1) 381 if (write_sigio_pid == -1)
@@ -383,7 +389,7 @@ static void sigio_cleanup(void)
383__uml_exitcall(sigio_cleanup); 389__uml_exitcall(sigio_cleanup);
384 390
385/* Used as a flag during SIGIO testing early in boot */ 391/* Used as a flag during SIGIO testing early in boot */
386static volatile int got_sigio = 0; 392static int got_sigio;
387 393
388static void __init handler(int sig) 394static void __init handler(int sig)
389{ 395{
@@ -498,7 +504,8 @@ static void tty_output(int master, int slave)
498 if (errno != EAGAIN) 504 if (errno != EAGAIN)
499 printk(UM_KERN_ERR "tty_output : write failed, errno = %d\n", 505 printk(UM_KERN_ERR "tty_output : write failed, errno = %d\n",
500 errno); 506 errno);
501 while (((n = read(slave, buf, sizeof(buf))) > 0) && !got_sigio) 507 while (((n = read(slave, buf, sizeof(buf))) > 0) &&
508 !({ barrier(); got_sigio; }))
502 ; 509 ;
503 510
504 if (got_sigio) { 511 if (got_sigio) {
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 3f1694b134cb..5aade6027e40 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -12,6 +12,7 @@
12#include "as-layout.h" 12#include "as-layout.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "os.h" 14#include "os.h"
15#include "process.h"
15#include "sysdep/barrier.h" 16#include "sysdep/barrier.h"
16#include "sysdep/sigcontext.h" 17#include "sysdep/sigcontext.h"
17#include "user.h" 18#include "user.h"
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 1e8cba6550a9..6be028ca1817 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -442,7 +442,7 @@ void userspace(struct uml_pt_regs *regs)
442 unblock_signals(); 442 unblock_signals();
443 break; 443 break;
444 default: 444 default:
445 printk(UM_KERN_ERR "userspace - child stopped " 445 printk(UM_KERN_ERR "userspace - child stopped "
446 "with signal %d\n", sig); 446 "with signal %d\n", sig);
447 fatal_sigsegv(); 447 fatal_sigsegv();
448 } 448 }
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 997d01944f91..b4b36e0f2e89 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -23,6 +23,7 @@
23#include "mem_user.h" 23#include "mem_user.h"
24#include "ptrace_user.h" 24#include "ptrace_user.h"
25#include "registers.h" 25#include "registers.h"
26#include "skas.h"
26#include "skas_ptrace.h" 27#include "skas_ptrace.h"
27 28
28static void ptrace_child(void) 29static void ptrace_child(void)
@@ -140,14 +141,27 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
140} 141}
141 142
142/* Changed only during early boot */ 143/* Changed only during early boot */
143int ptrace_faultinfo = 1; 144int ptrace_faultinfo;
144int ptrace_ldt = 1; 145static int disable_ptrace_faultinfo;
145int proc_mm = 1; 146
146int skas_needs_stub = 0; 147int ptrace_ldt;
148static int disable_ptrace_ldt;
149
150int proc_mm;
151static int disable_proc_mm;
152
153int have_switch_mm;
154static int disable_switch_mm;
155
156int skas_needs_stub;
147 157
148static int __init skas0_cmd_param(char *str, int* add) 158static int __init skas0_cmd_param(char *str, int* add)
149{ 159{
150 ptrace_faultinfo = proc_mm = 0; 160 disable_ptrace_faultinfo = 1;
161 disable_ptrace_ldt = 1;
162 disable_proc_mm = 1;
163 disable_switch_mm = 1;
164
151 return 0; 165 return 0;
152} 166}
153 167
@@ -157,15 +171,12 @@ static int __init mode_skas0_cmd_param(char *str, int* add)
157 __attribute__((alias("skas0_cmd_param"))); 171 __attribute__((alias("skas0_cmd_param")));
158 172
159__uml_setup("skas0", skas0_cmd_param, 173__uml_setup("skas0", skas0_cmd_param,
160 "skas0\n" 174"skas0\n"
161 " Disables SKAS3 usage, so that SKAS0 is used, unless \n" 175" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used\n\n");
162 " you specify mode=tt.\n\n");
163 176
164__uml_setup("mode=skas0", mode_skas0_cmd_param, 177__uml_setup("mode=skas0", mode_skas0_cmd_param,
165 "mode=skas0\n" 178"mode=skas0\n"
166 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n" 179" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used.\n\n");
167 " specify mode=tt. Note that this was recently added - on \n"
168 " older kernels you must use simply \"skas0\".\n\n");
169 180
170/* Changed only during early boot */ 181/* Changed only during early boot */
171static int force_sysemu_disabled = 0; 182static int force_sysemu_disabled = 0;
@@ -360,7 +371,7 @@ void __init os_early_checks(void)
360 371
361static int __init noprocmm_cmd_param(char *str, int* add) 372static int __init noprocmm_cmd_param(char *str, int* add)
362{ 373{
363 proc_mm = 0; 374 disable_proc_mm = 1;
364 return 0; 375 return 0;
365} 376}
366 377
@@ -372,7 +383,7 @@ __uml_setup("noprocmm", noprocmm_cmd_param,
372 383
373static int __init noptracefaultinfo_cmd_param(char *str, int* add) 384static int __init noptracefaultinfo_cmd_param(char *str, int* add)
374{ 385{
375 ptrace_faultinfo = 0; 386 disable_ptrace_faultinfo = 1;
376 return 0; 387 return 0;
377} 388}
378 389
@@ -384,7 +395,7 @@ __uml_setup("noptracefaultinfo", noptracefaultinfo_cmd_param,
384 395
385static int __init noptraceldt_cmd_param(char *str, int* add) 396static int __init noptraceldt_cmd_param(char *str, int* add)
386{ 397{
387 ptrace_ldt = 0; 398 disable_ptrace_ldt = 1;
388 return 0; 399 return 0;
389} 400}
390 401
@@ -404,17 +415,15 @@ static inline void check_skas3_ptrace_faultinfo(void)
404 415
405 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 416 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
406 if (n < 0) { 417 if (n < 0) {
407 ptrace_faultinfo = 0;
408 if (errno == EIO) 418 if (errno == EIO)
409 non_fatal("not found\n"); 419 non_fatal("not found\n");
410 else 420 else
411 perror("not found"); 421 perror("not found");
412 } 422 } else if (disable_ptrace_faultinfo)
423 non_fatal("found but disabled on command line\n");
413 else { 424 else {
414 if (!ptrace_faultinfo) 425 ptrace_faultinfo = 1;
415 non_fatal("found but disabled on command line\n"); 426 non_fatal("found\n");
416 else
417 non_fatal("found\n");
418 } 427 }
419 428
420 stop_ptraced_child(pid, 1, 1); 429 stop_ptraced_child(pid, 1, 1);
@@ -437,38 +446,30 @@ static inline void check_skas3_ptrace_ldt(void)
437 if (n < 0) { 446 if (n < 0) {
438 if (errno == EIO) 447 if (errno == EIO)
439 non_fatal("not found\n"); 448 non_fatal("not found\n");
440 else { 449 else
441 perror("not found"); 450 perror("not found");
442 } 451 } else if (disable_ptrace_ldt)
443 ptrace_ldt = 0; 452 non_fatal("found, but use is disabled\n");
444 }
445 else { 453 else {
446 if (ptrace_ldt) 454 ptrace_ldt = 1;
447 non_fatal("found\n"); 455 non_fatal("found\n");
448 else
449 non_fatal("found, but use is disabled\n");
450 } 456 }
451 457
452 stop_ptraced_child(pid, 1, 1); 458 stop_ptraced_child(pid, 1, 1);
453#else
454 /* PTRACE_LDT might be disabled via cmdline option.
455 * We want to override this, else we might use the stub
456 * without real need
457 */
458 ptrace_ldt = 1;
459#endif 459#endif
460} 460}
461 461
462static inline void check_skas3_proc_mm(void) 462static inline void check_skas3_proc_mm(void)
463{ 463{
464 non_fatal(" - /proc/mm..."); 464 non_fatal(" - /proc/mm...");
465 if (access("/proc/mm", W_OK) < 0) { 465 if (access("/proc/mm", W_OK) < 0)
466 proc_mm = 0;
467 perror("not found"); 466 perror("not found");
468 } 467 else if (disable_proc_mm)
469 else if (!proc_mm)
470 non_fatal("found but disabled on command line\n"); 468 non_fatal("found but disabled on command line\n");
471 else non_fatal("found\n"); 469 else {
470 proc_mm = 1;
471 non_fatal("found\n");
472 }
472} 473}
473 474
474void can_do_skas(void) 475void can_do_skas(void)
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index b613473b3ec1..c6183e7aec3d 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7#include <errno.h> 7#include <errno.h>
8#include <asm/user.h>
8#include "kern_constants.h" 9#include "kern_constants.h"
9#include "longjmp.h" 10#include "longjmp.h"
10#include "user.h" 11#include "user.h"
@@ -74,10 +75,10 @@ int put_fp_registers(int pid, unsigned long *regs)
74 75
75void arch_init_registers(int pid) 76void arch_init_registers(int pid)
76{ 77{
77 unsigned long fpx_regs[HOST_XFP_SIZE]; 78 struct user_fxsr_struct fpx_regs;
78 int err; 79 int err;
79 80
80 err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs); 81 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs);
81 if (!err) 82 if (!err)
82 return; 83 return;
83 84
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index e49280599465..bee98f466d66 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -9,7 +9,9 @@
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include "kern_constants.h" 11#include "kern_constants.h"
12#include "kern_util.h"
12#include "os.h" 13#include "os.h"
14#include "process.h"
13#include "user.h" 15#include "user.h"
14 16
15int set_interval(void) 17int set_interval(void)
@@ -58,12 +60,17 @@ static inline long long timeval_to_ns(const struct timeval *tv)
58long long disable_timer(void) 60long long disable_timer(void)
59{ 61{
60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); 62 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
63 int remain, max = UM_NSEC_PER_SEC / UM_HZ;
61 64
62 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) 65 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
63 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 66 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
64 "errno = %d\n", errno); 67 "errno = %d\n", errno);
65 68
66 return timeval_to_ns(&time.it_value); 69 remain = timeval_to_ns(&time.it_value);
70 if (remain > max)
71 remain = max;
72
73 return remain;
67} 74}
68 75
69long long os_nsecs(void) 76long long os_nsecs(void)
@@ -79,7 +86,44 @@ static int after_sleep_interval(struct timespec *ts)
79{ 86{
80 return 0; 87 return 0;
81} 88}
89
90static void deliver_alarm(void)
91{
92 alarm_handler(SIGVTALRM, NULL);
93}
94
95static unsigned long long sleep_time(unsigned long long nsecs)
96{
97 return nsecs;
98}
99
82#else 100#else
101unsigned long long last_tick;
102unsigned long long skew;
103
104static void deliver_alarm(void)
105{
106 unsigned long long this_tick = os_nsecs();
107 int one_tick = UM_NSEC_PER_SEC / UM_HZ;
108
109 if (last_tick == 0)
110 last_tick = this_tick - one_tick;
111
112 skew += this_tick - last_tick;
113
114 while (skew >= one_tick) {
115 alarm_handler(SIGVTALRM, NULL);
116 skew -= one_tick;
117 }
118
119 last_tick = this_tick;
120}
121
122static unsigned long long sleep_time(unsigned long long nsecs)
123{
124 return nsecs > skew ? nsecs - skew : 0;
125}
126
83static inline long long timespec_to_us(const struct timespec *ts) 127static inline long long timespec_to_us(const struct timespec *ts)
84{ 128{
85 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) + 129 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
@@ -102,6 +146,8 @@ static int after_sleep_interval(struct timespec *ts)
102 */ 146 */
103 if (start_usecs > usec) 147 if (start_usecs > usec)
104 start_usecs = usec; 148 start_usecs = usec;
149
150 start_usecs -= skew / UM_NSEC_PER_USEC;
105 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, 151 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC,
106 .tv_usec = start_usecs % UM_USEC_PER_SEC }); 152 .tv_usec = start_usecs % UM_USEC_PER_SEC });
107 interval = ((struct itimerval) { { 0, usec }, tv }); 153 interval = ((struct itimerval) { { 0, usec }, tv });
@@ -113,8 +159,6 @@ static int after_sleep_interval(struct timespec *ts)
113} 159}
114#endif 160#endif
115 161
116extern void alarm_handler(int sig, struct sigcontext *sc);
117
118void idle_sleep(unsigned long long nsecs) 162void idle_sleep(unsigned long long nsecs)
119{ 163{
120 struct timespec ts; 164 struct timespec ts;
@@ -126,10 +170,12 @@ void idle_sleep(unsigned long long nsecs)
126 */ 170 */
127 if (nsecs == 0) 171 if (nsecs == 0)
128 nsecs = UM_NSEC_PER_SEC / UM_HZ; 172 nsecs = UM_NSEC_PER_SEC / UM_HZ;
173
174 nsecs = sleep_time(nsecs);
129 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC, 175 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
130 .tv_nsec = nsecs % UM_NSEC_PER_SEC }); 176 .tv_nsec = nsecs % UM_NSEC_PER_SEC });
131 177
132 if (nanosleep(&ts, &ts) == 0) 178 if (nanosleep(&ts, &ts) == 0)
133 alarm_handler(SIGVTALRM, NULL); 179 deliver_alarm();
134 after_sleep_interval(&ts); 180 after_sleep_interval(&ts);
135} 181}
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 6b4499906a6c..c9b176534d65 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -148,14 +148,13 @@ int peek_user(struct task_struct *child, long addr, long data)
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 long fpregs[HOST_FP_SIZE]; 151 struct user_i387_struct fpregs;
152 152
153 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 153 err = save_fp_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
154 err = save_fp_registers(userspace_pid[cpu], fpregs);
155 if (err) 154 if (err)
156 return err; 155 return err;
157 156
158 n = copy_to_user(buf, fpregs, sizeof(fpregs)); 157 n = copy_to_user(buf, &fpregs, sizeof(fpregs));
159 if(n > 0) 158 if(n > 0)
160 return -EFAULT; 159 return -EFAULT;
161 160
@@ -165,27 +164,26 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
165int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 164int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
166{ 165{
167 int n, cpu = ((struct thread_info *) child->stack)->cpu; 166 int n, cpu = ((struct thread_info *) child->stack)->cpu;
168 long fpregs[HOST_FP_SIZE]; 167 struct user_i387_struct fpregs;
169 168
170 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 169 n = copy_from_user(&fpregs, buf, sizeof(fpregs));
171 n = copy_from_user(fpregs, buf, sizeof(fpregs));
172 if (n > 0) 170 if (n > 0)
173 return -EFAULT; 171 return -EFAULT;
174 172
175 return restore_fp_registers(userspace_pid[cpu], fpregs); 173 return restore_fp_registers(userspace_pid[cpu],
174 (unsigned long *) &fpregs);
176} 175}
177 176
178int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 177int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
179{ 178{
180 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
181 long fpregs[HOST_XFP_SIZE]; 180 struct user_fxsr_struct fpregs;
182 181
183 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 182 err = save_fpx_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
184 err = save_fpx_registers(userspace_pid[cpu], fpregs);
185 if (err) 183 if (err)
186 return err; 184 return err;
187 185
188 n = copy_to_user(buf, fpregs, sizeof(fpregs)); 186 n = copy_to_user(buf, &fpregs, sizeof(fpregs));
189 if(n > 0) 187 if(n > 0)
190 return -EFAULT; 188 return -EFAULT;
191 189
@@ -195,14 +193,14 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
195int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 193int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
196{ 194{
197 int n, cpu = ((struct thread_info *) child->stack)->cpu; 195 int n, cpu = ((struct thread_info *) child->stack)->cpu;
198 long fpregs[HOST_XFP_SIZE]; 196 struct user_fxsr_struct fpregs;
199 197
200 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 198 n = copy_from_user(&fpregs, buf, sizeof(fpregs));
201 n = copy_from_user(fpregs, buf, sizeof(fpregs));
202 if (n > 0) 199 if (n > 0)
203 return -EFAULT; 200 return -EFAULT;
204 201
205 return restore_fpx_registers(userspace_pid[cpu], fpregs); 202 return restore_fpx_registers(userspace_pid[cpu],
203 (unsigned long *) &fpregs);
206} 204}
207 205
208long subarch_ptrace(struct task_struct *child, long request, long addr, 206long subarch_ptrace(struct task_struct *child, long request, long addr,
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 39bd32bf84f0..5f883bfe773f 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -22,7 +22,7 @@ void foo(void)
22 OFFSET(HOST_SC_CR2, sigcontext, cr2); 22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
23 23
24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); 24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
25 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct)); 25 DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct));
26 26
27 DEFINE(HOST_IP, EIP); 27 DEFINE(HOST_IP, EIP);
28 DEFINE(HOST_SP, UESP); 28 DEFINE(HOST_SP, UESP);
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 2f3443c6e859..973585414a66 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -24,7 +24,6 @@ void foo(void)
24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); 24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
25 25
26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
27 DEFINE(HOST_XFP_SIZE, 0);
28 DEFINE_LONGS(HOST_RBX, RBX); 27 DEFINE_LONGS(HOST_RBX, RBX);
29 DEFINE_LONGS(HOST_RCX, RCX); 28 DEFINE_LONGS(HOST_RCX, RCX);
30 DEFINE_LONGS(HOST_RDI, RDI); 29 DEFINE_LONGS(HOST_RDI, RDI);
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.lds.S b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
index 22fab6c4be15..7da00b799cda 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.lds.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
@@ -12,11 +12,6 @@ ENTRY(_start)
12 12
13SECTIONS 13SECTIONS
14{ 14{
15 . = HEADER_OFFSET;
16 .header : {
17 *(.header)
18 }
19
20 . = 0; 15 . = 0;
21 .text : { 16 .text : {
22 *(.text*) 17 *(.text*)
@@ -50,6 +45,11 @@ SECTIONS
50 __bss_end = .; 45 __bss_end = .;
51 } 46 }
52 47
48 . = HEADER_OFFSET;
49 .header : {
50 *(.header)
51 }
52
53 . = ALIGN(16); 53 . = ALIGN(16);
54 _end = .; 54 _end = .;
55 55
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 0c37f16b6950..c5ef1af8e79d 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -385,11 +385,13 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
385 if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) 385 if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory))
386 return memory; 386 return memory;
387 387
388 if (!dev) 388 if (!dev) {
389 dev = &fallback_dev; 389 dev = &fallback_dev;
390 gfp |= GFP_DMA;
391 }
390 dma_mask = dev->coherent_dma_mask; 392 dma_mask = dev->coherent_dma_mask;
391 if (dma_mask == 0) 393 if (dma_mask == 0)
392 dma_mask = DMA_32BIT_MASK; 394 dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK;
393 395
394 /* Device not DMA able */ 396 /* Device not DMA able */
395 if (dev->dma_mask == NULL) 397 if (dev->dma_mask == NULL)
@@ -403,7 +405,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
403 larger than 16MB and in this case we have a chance of 405 larger than 16MB and in this case we have a chance of
404 finding fitting memory in the next higher zone first. If 406 finding fitting memory in the next higher zone first. If
405 not retry with true GFP_DMA. -AK */ 407 not retry with true GFP_DMA. -AK */
406 if (dma_mask <= DMA_32BIT_MASK) 408 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA))
407 gfp |= GFP_DMA32; 409 gfp |= GFP_DMA32;
408#endif 410#endif
409 411
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 67e9b4a1e89d..ba370dc8685b 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -99,15 +99,6 @@ static void mwait_idle(void)
99 local_irq_enable(); 99 local_irq_enable();
100} 100}
101 101
102
103static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
104{
105 if (force_mwait)
106 return 1;
107 /* Any C1 states supported? */
108 return c->cpuid_level >= 5 && ((cpuid_edx(5) >> 4) & 0xf) > 0;
109}
110
111/* 102/*
112 * On SMP it's slightly faster (but much more power-consuming!) 103 * On SMP it's slightly faster (but much more power-consuming!)
113 * to poll the ->work.need_resched flag instead of waiting for the 104 * to poll the ->work.need_resched flag instead of waiting for the
@@ -119,6 +110,33 @@ static void poll_idle(void)
119 cpu_relax(); 110 cpu_relax();
120} 111}
121 112
113/*
114 * mwait selection logic:
115 *
116 * It depends on the CPU. For AMD CPUs that support MWAIT this is
117 * wrong. Family 0x10 and 0x11 CPUs will enter C1 on HLT. Powersavings
118 * then depend on a clock divisor and current Pstate of the core. If
119 * all cores of a processor are in halt state (C1) the processor can
120 * enter the C1E (C1 enhanced) state. If mwait is used this will never
121 * happen.
122 *
123 * idle=mwait overrides this decision and forces the usage of mwait.
124 */
125static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
126{
127 if (force_mwait)
128 return 1;
129
130 if (c->x86_vendor == X86_VENDOR_AMD) {
131 switch(c->x86) {
132 case 0x10:
133 case 0x11:
134 return 0;
135 }
136 }
137 return 1;
138}
139
122void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 140void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
123{ 141{
124 static int selected; 142 static int selected;
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index fb03ef380f0e..a7835f282936 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1303,6 +1303,9 @@ static const struct user_regset_view user_x86_64_view = {
1303#define genregs32_get genregs_get 1303#define genregs32_get genregs_get
1304#define genregs32_set genregs_set 1304#define genregs32_set genregs_set
1305 1305
1306#define user_i387_ia32_struct user_i387_struct
1307#define user32_fxsr_struct user_fxsr_struct
1308
1306#endif /* CONFIG_X86_64 */ 1309#endif /* CONFIG_X86_64 */
1307 1310
1308#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION 1311#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
@@ -1315,13 +1318,13 @@ static const struct user_regset x86_32_regsets[] = {
1315 }, 1318 },
1316 [REGSET_FP] = { 1319 [REGSET_FP] = {
1317 .core_note_type = NT_PRFPREG, 1320 .core_note_type = NT_PRFPREG,
1318 .n = sizeof(struct user_i387_struct) / sizeof(u32), 1321 .n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
1319 .size = sizeof(u32), .align = sizeof(u32), 1322 .size = sizeof(u32), .align = sizeof(u32),
1320 .active = fpregs_active, .get = fpregs_get, .set = fpregs_set 1323 .active = fpregs_active, .get = fpregs_get, .set = fpregs_set
1321 }, 1324 },
1322 [REGSET_XFP] = { 1325 [REGSET_XFP] = {
1323 .core_note_type = NT_PRXFPREG, 1326 .core_note_type = NT_PRXFPREG,
1324 .n = sizeof(struct user_i387_struct) / sizeof(u32), 1327 .n = sizeof(struct user32_fxsr_struct) / sizeof(u32),
1325 .size = sizeof(u32), .align = sizeof(u32), 1328 .size = sizeof(u32), .align = sizeof(u32),
1326 .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set 1329 .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
1327 }, 1330 },
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c0c68c18a788..6f80b852a196 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -12,6 +12,7 @@
12#include <asm/mpspec.h> 12#include <asm/mpspec.h>
13#include <asm/apicdef.h> 13#include <asm/apicdef.h>
14 14
15#ifdef CONFIG_X86_LOCAL_APIC
15unsigned int num_processors; 16unsigned int num_processors;
16unsigned disabled_cpus __cpuinitdata; 17unsigned disabled_cpus __cpuinitdata;
17/* Processor that is doing the boot up */ 18/* Processor that is doing the boot up */
@@ -23,8 +24,9 @@ EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
23 24
24/* Bitmask of physically existing CPUs */ 25/* Bitmask of physically existing CPUs */
25physid_mask_t phys_cpu_present_map; 26physid_mask_t phys_cpu_present_map;
27#endif
26 28
27#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_SMP) 29#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_X86_SMP)
28/* 30/*
29 * Copy data used in early init routines from the initial arrays to the 31 * Copy data used in early init routines from the initial arrays to the
30 * per cpu data areas. These arrays then become expendable and the 32 * per cpu data areas. These arrays then become expendable and the
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index f2fc8feb727d..6dff1286ad8a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -951,7 +951,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
951static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c) 951static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c)
952{ 952{
953 if (c->x86 == 0x6 && c->x86_model >= 0xf) 953 if (c->x86 == 0x6 && c->x86_model >= 0xf)
954 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 954 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
955} 955}
956 956
957static void __cpuinit init_centaur(struct cpuinfo_x86 *c) 957static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 8f75893a6467..0cb7aadc87cd 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -231,7 +231,8 @@ native_smp_call_function_mask(cpumask_t mask,
231 wmb(); 231 wmb();
232 232
233 /* Send a message to other CPUs */ 233 /* Send a message to other CPUs */
234 if (cpus_equal(mask, allbutself)) 234 if (cpus_equal(mask, allbutself) &&
235 cpus_equal(cpu_online_map, cpu_callout_map))
235 send_IPI_allbutself(CALL_FUNCTION_VECTOR); 236 send_IPI_allbutself(CALL_FUNCTION_VECTOR);
236 else 237 else
237 send_IPI_mask(mask, CALL_FUNCTION_VECTOR); 238 send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 6b087ab6cd8f..38988491c622 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -86,6 +86,7 @@ void *x86_bios_cpu_apicid_early_ptr;
86 86
87#ifdef CONFIG_X86_32 87#ifdef CONFIG_X86_32
88u8 apicid_2_node[MAX_APICID]; 88u8 apicid_2_node[MAX_APICID];
89static int low_mappings;
89#endif 90#endif
90 91
91/* State of each CPU */ 92/* State of each CPU */
@@ -326,6 +327,12 @@ static void __cpuinit start_secondary(void *unused)
326 enable_8259A_irq(0); 327 enable_8259A_irq(0);
327 } 328 }
328 329
330#ifdef CONFIG_X86_32
331 while (low_mappings)
332 cpu_relax();
333 __flush_tlb_all();
334#endif
335
329 /* This must be done before setting cpu_online_map */ 336 /* This must be done before setting cpu_online_map */
330 set_cpu_sibling_map(raw_smp_processor_id()); 337 set_cpu_sibling_map(raw_smp_processor_id());
331 wmb(); 338 wmb();
@@ -1040,14 +1047,20 @@ int __cpuinit native_cpu_up(unsigned int cpu)
1040#ifdef CONFIG_X86_32 1047#ifdef CONFIG_X86_32
1041 /* init low mem mapping */ 1048 /* init low mem mapping */
1042 clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY, 1049 clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY,
1043 min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); 1050 min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
1044 flush_tlb_all(); 1051 flush_tlb_all();
1045#endif 1052 low_mappings = 1;
1046 1053
1047 err = do_boot_cpu(apicid, cpu); 1054 err = do_boot_cpu(apicid, cpu);
1048 if (err < 0) { 1055
1056 zap_low_mappings();
1057 low_mappings = 0;
1058#else
1059 err = do_boot_cpu(apicid, cpu);
1060#endif
1061 if (err) {
1049 Dprintk("do_boot_cpu failed %d\n", err); 1062 Dprintk("do_boot_cpu failed %d\n", err);
1050 return err; 1063 return -EIO;
1051 } 1064 }
1052 1065
1053 /* 1066 /*
@@ -1259,9 +1272,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
1259 setup_ioapic_dest(); 1272 setup_ioapic_dest();
1260#endif 1273#endif
1261 check_nmi_watchdog(); 1274 check_nmi_watchdog();
1262#ifdef CONFIG_X86_32
1263 zap_low_mappings();
1264#endif
1265} 1275}
1266 1276
1267#ifdef CONFIG_HOTPLUG_CPU 1277#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index 58882f9f2637..f6c05d0410fb 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -2,6 +2,7 @@
2 All C exports should go in the respective C files. */ 2 All C exports should go in the respective C files. */
3 3
4#include <linux/module.h> 4#include <linux/module.h>
5#include <net/checksum.h>
5#include <linux/smp.h> 6#include <linux/smp.h>
6 7
7#include <asm/processor.h> 8#include <asm/processor.h>
@@ -29,6 +30,8 @@ EXPORT_SYMBOL(__copy_from_user_inatomic);
29EXPORT_SYMBOL(copy_page); 30EXPORT_SYMBOL(copy_page);
30EXPORT_SYMBOL(clear_page); 31EXPORT_SYMBOL(clear_page);
31 32
33EXPORT_SYMBOL(csum_partial);
34
32/* 35/*
33 * Export string functions. We normally rely on gcc builtin for most of these, 36 * Export string functions. We normally rely on gcc builtin for most of these,
34 * but gcc sometimes decides not to inline them. 37 * but gcc sometimes decides not to inline them.
diff --git a/arch/x86/lib/csum-partial_64.c b/arch/x86/lib/csum-partial_64.c
index bc503f506903..bf51144d97e1 100644
--- a/arch/x86/lib/csum-partial_64.c
+++ b/arch/x86/lib/csum-partial_64.c
@@ -136,8 +136,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
136 (__force u32)sum); 136 (__force u32)sum);
137} 137}
138 138
139EXPORT_SYMBOL(csum_partial);
140
141/* 139/*
142 * this routine is used for miscellaneous IP-like checksums, mainly 140 * this routine is used for miscellaneous IP-like checksums, mainly
143 * in icmp.c 141 * in icmp.c
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index de236e419cb5..ec30d10154b6 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -438,8 +438,6 @@ void zap_low_mappings(void)
438{ 438{
439 int i; 439 int i;
440 440
441 save_pg_dir();
442
443 /* 441 /*
444 * Zap initial low-memory mappings. 442 * Zap initial low-memory mappings.
445 * 443 *
@@ -663,16 +661,8 @@ void __init mem_init(void)
663 test_wp_bit(); 661 test_wp_bit();
664 662
665 cpa_init(); 663 cpa_init();
666 664 save_pg_dir();
667 /*
668 * Subtle. SMP is doing it's boot stuff late (because it has to
669 * fork idle threads) - but it also needs low mappings for the
670 * protected-mode entry to work. We zap these entries only after
671 * the WP-bit has been tested.
672 */
673#ifndef CONFIG_SMP
674 zap_low_mappings(); 665 zap_low_mappings();
675#endif
676} 666}
677 667
678#ifdef CONFIG_MEMORY_HOTPLUG 668#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 60adbe22efa0..de3a99812450 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -28,7 +28,7 @@
28#ifdef CONFIG_X86_PAT 28#ifdef CONFIG_X86_PAT
29int __read_mostly pat_wc_enabled = 1; 29int __read_mostly pat_wc_enabled = 1;
30 30
31void __init pat_disable(char *reason) 31void __cpuinit pat_disable(char *reason)
32{ 32{
33 pat_wc_enabled = 0; 33 pat_wc_enabled = 0;
34 printk(KERN_INFO "%s\n", reason); 34 printk(KERN_INFO "%s\n", reason);
@@ -555,7 +555,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
555 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", 555 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
556 current->comm, current->pid, 556 current->comm, current->pid,
557 cattr_name(flags), 557 cattr_name(flags),
558 offset, offset + size); 558 offset, (unsigned long long)(offset + size));
559 return 0; 559 return 0;
560 } 560 }
561 561
@@ -576,7 +576,7 @@ void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
576 "%s:%d /dev/mem expected mapping type %s for %Lx-%Lx, got %s\n", 576 "%s:%d /dev/mem expected mapping type %s for %Lx-%Lx, got %s\n",
577 current->comm, current->pid, 577 current->comm, current->pid,
578 cattr_name(want_flags), 578 cattr_name(want_flags),
579 addr, addr + size, 579 addr, (unsigned long long)(addr + size),
580 cattr_name(flags)); 580 cattr_name(flags));
581 } 581 }
582} 582}
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 8af0f0bae2af..10fb308fded8 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -301,15 +301,13 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
301 prot = pgprot_val(vma->vm_page_prot); 301 prot = pgprot_val(vma->vm_page_prot);
302 if (pat_wc_enabled && write_combine) 302 if (pat_wc_enabled && write_combine)
303 prot |= _PAGE_CACHE_WC; 303 prot |= _PAGE_CACHE_WC;
304 else if (pat_wc_enabled) 304 else if (pat_wc_enabled || boot_cpu_data.x86 > 3)
305 /* 305 /*
306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now. 306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
307 * To avoid attribute conflicts, request UC MINUS here 307 * To avoid attribute conflicts, request UC MINUS here
308 * aswell. 308 * aswell.
309 */ 309 */
310 prot |= _PAGE_CACHE_UC_MINUS; 310 prot |= _PAGE_CACHE_UC_MINUS;
311 else if (boot_cpu_data.x86 > 3)
312 prot |= _PAGE_CACHE_UC;
313 311
314 vma->vm_page_prot = __pgprot(prot); 312 vma->vm_page_prot = __pgprot(prot);
315 313