aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-03-03 05:31:09 -0500
committerPaul Mackerras <paulus@samba.org>2008-03-03 05:31:09 -0500
commit3cecdda3f169f22f324f78fd544beee68e3cc6a4 (patch)
treee7c2995ddc2690d1be695a1525bcd16d3965548d /arch
parentb9c64498f53e0f4d90eec03048f73ac215bb6f79 (diff)
parentda40451bba23b51eaca4170a095891646ce72104 (diff)
Merge branch 'for-2.6.25' of master.kernel.org:/pub/scm/linux/kernel/git/arnd/cell-2.6 into merge
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/mach-omap1/board-sx1.c2
-rw-r--r--arch/arm/mach-pxa/cpu-pxa.c2
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c8
-rw-r--r--arch/arm/mach-pxa/zylonite.c2
-rw-r--r--arch/arm/mm/mmap.c2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c2
-rw-r--r--arch/avr32/kernel/process.c4
-rw-r--r--arch/avr32/mm/fault.c2
-rw-r--r--arch/blackfin/Makefile5
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig18
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig6
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig6
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig6
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig1
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c15
-rw-r--r--arch/blackfin/kernel/gptimers.c8
-rw-r--r--arch/blackfin/kernel/setup.c5
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S34
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c60
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c21
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c43
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c18
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c45
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c25
-rw-r--r--arch/blackfin/mach-bf548/dma.c2
-rw-r--r--arch/blackfin/mach-bf548/head.S9
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c16
-rw-r--r--arch/blackfin/mach-common/dpmc.S137
-rw-r--r--arch/blackfin/mach-common/ints-priority.c174
-rw-r--r--arch/blackfin/mm/init.c4
-rw-r--r--arch/powerpc/oprofile/op_model_cell.c2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c151
-rw-r--r--arch/powerpc/platforms/cell/setup.c7
-rw-r--r--arch/powerpc/platforms/celleb/beat.h3
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/drivers/dma/dma-sh.c2
-rw-r--r--arch/sh/drivers/heartbeat.c2
-rw-r--r--arch/sh/drivers/pci/ops-dreamcast.c44
-rw-r--r--arch/sh/kernel/cpu/sh2/setup-sh7619.c2
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7203.c4
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7203.c2
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7206.c2
-rw-r--r--arch/sh/kernel/cpu/sh3/probe.c4
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7705.c2
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh770x.c8
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7710.c2
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7720.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh4-202.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7760.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7343.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7770.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-shx3.c2
-rw-r--r--arch/sparc/kernel/led.c3
-rw-r--r--arch/sparc64/kernel/ds.c14
-rw-r--r--arch/sparc64/kernel/hvtramp.S4
-rw-r--r--arch/sparc64/kernel/iommu.c3
-rw-r--r--arch/sparc64/kernel/kprobes.c2
-rw-r--r--arch/sparc64/kernel/mdesc.c2
-rw-r--r--arch/sparc64/kernel/power.c3
-rw-r--r--arch/sparc64/kernel/process.c77
-rw-r--r--arch/sparc64/kernel/smp.c2
-rw-r--r--arch/sparc64/kernel/trampoline.S4
-rw-r--r--arch/sparc64/kernel/traps.c2
-rw-r--r--arch/sparc64/mm/fault.c14
-rw-r--r--arch/sparc64/mm/init.c3
-rw-r--r--arch/um/kernel/process.c2
-rw-r--r--arch/x86/Kconfig.cpu14
-rw-r--r--arch/x86/boot/memory.c9
-rw-r--r--arch/x86/kernel/asm-offsets_32.c4
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c9
-rw-r--r--arch/x86/kernel/cpu/transmeta.c7
-rw-r--r--arch/x86/kernel/entry_64.S6
-rw-r--r--arch/x86/kernel/head_32.S2
-rw-r--r--arch/x86/kernel/head_64.S22
-rw-r--r--arch/x86/kernel/hpet.c4
-rw-r--r--arch/x86/kernel/init_task.c1
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c8
-rw-r--r--arch/x86/kernel/ptrace.c12
-rw-r--r--arch/x86/kernel/setup_64.c2
-rw-r--r--arch/x86/kernel/smpboot_64.c2
-rw-r--r--arch/x86/kernel/stacktrace.c4
-rw-r--r--arch/x86/kernel/tls.c8
-rw-r--r--arch/x86/kernel/tsc_32.c3
-rw-r--r--arch/x86/kernel/vsyscall_64.c49
-rw-r--r--arch/x86/lguest/boot.c12
-rw-r--r--arch/x86/mm/init_64.c13
-rw-r--r--arch/x86/mm/ioremap.c2
-rw-r--r--arch/x86/mm/pageattr.c105
-rw-r--r--arch/x86/vdso/Makefile4
-rw-r--r--arch/x86/xen/enlighten.c1
100 files changed, 619 insertions, 772 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9619c43783ff..16b82e1272b0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -939,7 +939,8 @@ config KEXEC
939 939
940config ATAGS_PROC 940config ATAGS_PROC
941 bool "Export atags in procfs" 941 bool "Export atags in procfs"
942 default n 942 depends on KEXEC
943 default y
943 help 944 help
944 Should the atags used to boot the kernel be exported in an "atags" 945 Should the atags used to boot the kernel be exported in an "atags"
945 file in procfs. Useful with kexec. 946 file in procfs. Useful with kexec.
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 1c7f09aedf07..e473fa6d4a5f 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -61,6 +61,7 @@ int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
61 data[0] = regoffset; /* register num */ 61 data[0] = regoffset; /* register num */
62 data[1] = value; /* register data */ 62 data[1] = value; /* register data */
63 err = i2c_transfer(adap, msg, 1); 63 err = i2c_transfer(adap, msg, 1);
64 i2c_put_adapter(adap);
64 if (err >= 0) 65 if (err >= 0)
65 return 0; 66 return 0;
66 return err; 67 return err;
@@ -91,6 +92,7 @@ int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value)
91 msg->buf = data; 92 msg->buf = data;
92 err = i2c_transfer(adap, msg, 1); 93 err = i2c_transfer(adap, msg, 1);
93 *value = data[0]; 94 *value = data[0];
95 i2c_put_adapter(adap);
94 96
95 if (err >= 0) 97 if (err >= 0)
96 return 0; 98 return 0;
diff --git a/arch/arm/mach-pxa/cpu-pxa.c b/arch/arm/mach-pxa/cpu-pxa.c
index 939a3867f77c..4b21479332ae 100644
--- a/arch/arm/mach-pxa/cpu-pxa.c
+++ b/arch/arm/mach-pxa/cpu-pxa.c
@@ -43,7 +43,7 @@
43 43
44#ifdef DEBUG 44#ifdef DEBUG
45static unsigned int freq_debug; 45static unsigned int freq_debug;
46MODULE_PARM(freq_debug, "i"); 46module_param(freq_debug, uint, 0);
47MODULE_PARM_DESC(freq_debug, "Set the debug messages to on=1/off=0"); 47MODULE_PARM_DESC(freq_debug, "Set the debug messages to on=1/off=0");
48#else 48#else
49#define freq_debug 0 49#define freq_debug 0
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 7cd9ef8deb02..35f25fdaeba3 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -129,28 +129,20 @@ static void clk_pxa3xx_cken_enable(struct clk *clk)
129{ 129{
130 unsigned long mask = 1ul << (clk->cken & 0x1f); 130 unsigned long mask = 1ul << (clk->cken & 0x1f);
131 131
132 local_irq_disable();
133
134 if (clk->cken < 32) 132 if (clk->cken < 32)
135 CKENA |= mask; 133 CKENA |= mask;
136 else 134 else
137 CKENB |= mask; 135 CKENB |= mask;
138
139 local_irq_enable();
140} 136}
141 137
142static void clk_pxa3xx_cken_disable(struct clk *clk) 138static void clk_pxa3xx_cken_disable(struct clk *clk)
143{ 139{
144 unsigned long mask = 1ul << (clk->cken & 0x1f); 140 unsigned long mask = 1ul << (clk->cken & 0x1f);
145 141
146 local_irq_disable();
147
148 if (clk->cken < 32) 142 if (clk->cken < 32)
149 CKENA &= ~mask; 143 CKENA &= ~mask;
150 else 144 else
151 CKENB &= ~mask; 145 CKENB &= ~mask;
152
153 local_irq_enable();
154} 146}
155 147
156static const struct clkops clk_pxa3xx_cken_ops = { 148static const struct clkops clk_pxa3xx_cken_ops = {
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 7731d50dd86c..afd2cbfca0d9 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -58,7 +58,7 @@ static struct platform_device smc91x_device = {
58 .resource = smc91x_resources, 58 .resource = smc91x_resources,
59}; 59};
60 60
61#if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULES) 61#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
62static void zylonite_backlight_power(int on) 62static void zylonite_backlight_power(int on)
63{ 63{
64 gpio_set_value(gpio_backlight, on); 64 gpio_set_value(gpio_backlight, on);
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 2728b0e7d2bb..3f6dc40b8353 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -120,6 +120,8 @@ full_search:
120 */ 120 */
121int valid_phys_addr_range(unsigned long addr, size_t size) 121int valid_phys_addr_range(unsigned long addr, size_t size)
122{ 122{
123 if (addr < PHYS_OFFSET)
124 return 0;
123 if (addr + size > __pa(high_memory)) 125 if (addr + size > __pa(high_memory))
124 return 0; 126 return 0;
125 127
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index 5a77030e07a0..e765a8652b3e 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -129,7 +129,7 @@ static int __init atstk1004_init(void)
129#ifdef CONFIG_BOARD_ATSTK100X_SPI1 129#ifdef CONFIG_BOARD_ATSTK100X_SPI1
130 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 130 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
131#endif 131#endif
132#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 132#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
133 at32_add_device_mci(0); 133 at32_add_device_mci(0);
134#endif 134#endif
135 at32_add_device_lcdc(0, &atstk1000_lcdc_data, 135 at32_add_device_lcdc(0, &atstk1000_lcdc_data,
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index eaaa69bbdc38..7f4af0b1e111 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -11,6 +11,7 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/ptrace.h> 12#include <linux/ptrace.h>
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/tick.h>
14#include <linux/uaccess.h> 15#include <linux/uaccess.h>
15#include <linux/unistd.h> 16#include <linux/unistd.h>
16 17
@@ -30,8 +31,10 @@ void cpu_idle(void)
30{ 31{
31 /* endless idle loop with no priority at all */ 32 /* endless idle loop with no priority at all */
32 while (1) { 33 while (1) {
34 tick_nohz_stop_sched_tick();
33 while (!need_resched()) 35 while (!need_resched())
34 cpu_idle_sleep(); 36 cpu_idle_sleep();
37 tick_nohz_restart_sched_tick();
35 preempt_enable_no_resched(); 38 preempt_enable_no_resched();
36 schedule(); 39 schedule();
37 preempt_disable(); 40 preempt_disable();
@@ -345,6 +348,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
345 p->thread.cpu_context.ksp = (unsigned long)childregs; 348 p->thread.cpu_context.ksp = (unsigned long)childregs;
346 p->thread.cpu_context.pc = (unsigned long)ret_from_fork; 349 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
347 350
351 clear_tsk_thread_flag(p, TIF_DEBUG);
348 if ((clone_flags & CLONE_PTRACE) && test_thread_flag(TIF_DEBUG)) 352 if ((clone_flags & CLONE_PTRACE) && test_thread_flag(TIF_DEBUG))
349 ocd_enable(p); 353 ocd_enable(p);
350 354
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index 6560cb18b4e3..ce4e4296b954 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -189,6 +189,8 @@ no_context:
189 189
190 page = sysreg_read(PTBR); 190 page = sysreg_read(PTBR);
191 printk(KERN_ALERT "ptbr = %08lx", page); 191 printk(KERN_ALERT "ptbr = %08lx", page);
192 if (address >= TASK_SIZE)
193 page = (unsigned long)swapper_pg_dir;
192 if (page) { 194 if (page) {
193 page = ((unsigned long *)page)[address >> 22]; 195 page = ((unsigned long *)page)[address >> 22];
194 printk(" pgd = %08lx", page); 196 printk(" pgd = %08lx", page);
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index fe254f886a6e..75eba2ca7881 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -98,8 +98,11 @@ drivers-$(CONFIG_OPROFILE) += arch/$(ARCH)/oprofile/
98# them changed. We use .mach to indicate when they were updated 98# them changed. We use .mach to indicate when they were updated
99# last, otherwise make uses the target directory mtime. 99# last, otherwise make uses the target directory mtime.
100 100
101 show_mach_symlink = :
102 quiet_show_mach_symlink = echo ' SYMLINK include/asm-$(ARCH)/mach-$(MACHINE) -> include/asm-$(ARCH)/mach'
103silent_show_mach_symlink = :
101include/asm-blackfin/.mach: $(wildcard include/config/arch/*.h) include/config/auto.conf 104include/asm-blackfin/.mach: $(wildcard include/config/arch/*.h) include/config/auto.conf
102 @echo ' SYMLINK include/asm-$(ARCH)/mach-$(MACHINE) -> include/asm-$(ARCH)/mach' 105 @$($(quiet)show_mach_symlink)
103ifneq ($(KBUILD_SRC),) 106ifneq ($(KBUILD_SRC),)
104 $(Q)mkdir -p include/asm-$(ARCH) 107 $(Q)mkdir -p include/asm-$(ARCH)
105 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH)/mach-$(MACHINE) include/asm-$(ARCH)/mach 108 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH)/mach-$(MACHINE) include/asm-$(ARCH)/mach
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index d59ee1530bd4..ae320dcfedef 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,7 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.14 3# Linux kernel version: 2.6.22.16
4# Thu Nov 29 17:32:47 2007
5# 4#
6# CONFIG_MMU is not set 5# CONFIG_MMU is not set
7# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -116,7 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
116# Processor and Board Settings 115# Processor and Board Settings
117# 116#
118# CONFIG_BF522 is not set 117# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set
119# CONFIG_BF525 is not set 120# CONFIG_BF525 is not set
121# CONFIG_BF526 is not set
120CONFIG_BF527=y 122CONFIG_BF527=y
121# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
122# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
@@ -306,6 +308,7 @@ CONFIG_BFIN_DCACHE=y
306# CONFIG_BFIN_WB is not set 308# CONFIG_BFIN_WB is not set
307CONFIG_BFIN_WT=y 309CONFIG_BFIN_WT=y
308CONFIG_L1_MAX_PIECE=16 310CONFIG_L1_MAX_PIECE=16
311# CONFIG_MPU is not set
309 312
310# 313#
311# Asynchonous Memory Configuration 314# Asynchonous Memory Configuration
@@ -354,6 +357,7 @@ CONFIG_BINFMT_ZFLAT=y
354# Power management options 357# Power management options
355# 358#
356# CONFIG_PM is not set 359# CONFIG_PM is not set
360# CONFIG_PM_WAKEUP_BY_GPIO is not set
357 361
358# 362#
359# Networking 363# Networking
@@ -496,7 +500,6 @@ CONFIG_MTD_CFI_I2=y
496# CONFIG_MTD_CFI_INTELEXT is not set 500# CONFIG_MTD_CFI_INTELEXT is not set
497# CONFIG_MTD_CFI_AMDSTD is not set 501# CONFIG_MTD_CFI_AMDSTD is not set
498# CONFIG_MTD_CFI_STAA is not set 502# CONFIG_MTD_CFI_STAA is not set
499CONFIG_MTD_MW320D=m
500CONFIG_MTD_RAM=y 503CONFIG_MTD_RAM=y
501CONFIG_MTD_ROM=m 504CONFIG_MTD_ROM=m
502# CONFIG_MTD_ABSENT is not set 505# CONFIG_MTD_ABSENT is not set
@@ -506,9 +509,6 @@ CONFIG_MTD_ROM=m
506# 509#
507CONFIG_MTD_COMPLEX_MAPPINGS=y 510CONFIG_MTD_COMPLEX_MAPPINGS=y
508# CONFIG_MTD_PHYSMAP is not set 511# CONFIG_MTD_PHYSMAP is not set
509CONFIG_MTD_BF5xx=m
510CONFIG_BFIN_FLASH_SIZE=0x400000
511CONFIG_EBIU_FLASH_BASE=0x20000000
512# CONFIG_MTD_UCLINUX is not set 512# CONFIG_MTD_UCLINUX is not set
513# CONFIG_MTD_PLATRAM is not set 513# CONFIG_MTD_PLATRAM is not set
514 514
@@ -684,7 +684,6 @@ CONFIG_INPUT_MISC=y
684# CONFIG_INPUT_POWERMATE is not set 684# CONFIG_INPUT_POWERMATE is not set
685# CONFIG_INPUT_YEALINK is not set 685# CONFIG_INPUT_YEALINK is not set
686# CONFIG_INPUT_UINPUT is not set 686# CONFIG_INPUT_UINPUT is not set
687# CONFIG_BF53X_PFBUTTONS is not set
688# CONFIG_TWI_KEYPAD is not set 687# CONFIG_TWI_KEYPAD is not set
689 688
690# 689#
@@ -702,12 +701,12 @@ CONFIG_INPUT_MISC=y
702# CONFIG_BF5xx_PPIFCD is not set 701# CONFIG_BF5xx_PPIFCD is not set
703# CONFIG_BFIN_SIMPLE_TIMER is not set 702# CONFIG_BFIN_SIMPLE_TIMER is not set
704# CONFIG_BF5xx_PPI is not set 703# CONFIG_BF5xx_PPI is not set
704CONFIG_BFIN_OTP=y
705# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
705# CONFIG_BFIN_SPORT is not set 706# CONFIG_BFIN_SPORT is not set
706# CONFIG_BFIN_TIMER_LATENCY is not set 707# CONFIG_BFIN_TIMER_LATENCY is not set
707# CONFIG_TWI_LCD is not set 708# CONFIG_TWI_LCD is not set
708# CONFIG_AD5304 is not set 709# CONFIG_AD5304 is not set
709# CONFIG_BF5xx_TEA5764 is not set
710# CONFIG_BF5xx_FBDMA is not set
711# CONFIG_VT is not set 710# CONFIG_VT is not set
712# CONFIG_SERIAL_NONSTANDARD is not set 711# CONFIG_SERIAL_NONSTANDARD is not set
713 712
@@ -772,7 +771,6 @@ CONFIG_I2C_CHARDEV=m
772# 771#
773# I2C Hardware Bus support 772# I2C Hardware Bus support
774# 773#
775# CONFIG_I2C_BLACKFIN_GPIO is not set
776CONFIG_I2C_BLACKFIN_TWI=m 774CONFIG_I2C_BLACKFIN_TWI=m
777CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 775CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
778# CONFIG_I2C_GPIO is not set 776# CONFIG_I2C_GPIO is not set
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 811711f59a25..9621caa60b5f 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -322,10 +322,9 @@ CONFIG_PM=y
322# CONFIG_PM_LEGACY is not set 322# CONFIG_PM_LEGACY is not set
323# CONFIG_PM_DEBUG is not set 323# CONFIG_PM_DEBUG is not set
324# CONFIG_PM_SYSFS_DEPRECATED is not set 324# CONFIG_PM_SYSFS_DEPRECATED is not set
325CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 325CONFIG_PM_BFIN_SLEEP_DEEPER=y
326# CONFIG_PM_BFIN_SLEEP is not set
326# CONFIG_PM_WAKEUP_BY_GPIO is not set 327# CONFIG_PM_WAKEUP_BY_GPIO is not set
327# CONFIG_PM_WAKEUP_GPIO_API is not set
328CONFIG_PM_WAKEUP_SIC_IWR=0x80
329 328
330# 329#
331# CPU Frequency scaling 330# CPU Frequency scaling
@@ -697,7 +696,6 @@ CONFIG_SERIAL_BFIN_DMA=y
697# CONFIG_SERIAL_BFIN_PIO is not set 696# CONFIG_SERIAL_BFIN_PIO is not set
698CONFIG_SERIAL_BFIN_UART0=y 697CONFIG_SERIAL_BFIN_UART0=y
699# CONFIG_BFIN_UART0_CTSRTS is not set 698# CONFIG_BFIN_UART0_CTSRTS is not set
700# CONFIG_SERIAL_BFIN_UART1 is not set
701CONFIG_SERIAL_CORE=y 699CONFIG_SERIAL_CORE=y
702CONFIG_SERIAL_CORE_CONSOLE=y 700CONFIG_SERIAL_CORE_CONSOLE=y
703# CONFIG_SERIAL_BFIN_SPORT is not set 701# CONFIG_SERIAL_BFIN_SPORT is not set
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 198f4123af4b..b51e76ce7f4f 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -323,10 +323,9 @@ CONFIG_PM=y
323# CONFIG_PM_LEGACY is not set 323# CONFIG_PM_LEGACY is not set
324# CONFIG_PM_DEBUG is not set 324# CONFIG_PM_DEBUG is not set
325# CONFIG_PM_SYSFS_DEPRECATED is not set 325# CONFIG_PM_SYSFS_DEPRECATED is not set
326CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 326CONFIG_PM_BFIN_SLEEP_DEEPER=y
327# CONFIG_PM_BFIN_SLEEP is not set
327# CONFIG_PM_WAKEUP_BY_GPIO is not set 328# CONFIG_PM_WAKEUP_BY_GPIO is not set
328# CONFIG_PM_WAKEUP_GPIO_API is not set
329CONFIG_PM_WAKEUP_SIC_IWR=0x80
330 329
331# 330#
332# CPU Frequency scaling 331# CPU Frequency scaling
@@ -714,7 +713,6 @@ CONFIG_SERIAL_BFIN_DMA=y
714# CONFIG_SERIAL_BFIN_PIO is not set 713# CONFIG_SERIAL_BFIN_PIO is not set
715CONFIG_SERIAL_BFIN_UART0=y 714CONFIG_SERIAL_BFIN_UART0=y
716# CONFIG_BFIN_UART0_CTSRTS is not set 715# CONFIG_BFIN_UART0_CTSRTS is not set
717# CONFIG_SERIAL_BFIN_UART1 is not set
718CONFIG_SERIAL_CORE=y 716CONFIG_SERIAL_CORE=y
719CONFIG_SERIAL_CORE_CONSOLE=y 717CONFIG_SERIAL_CORE_CONSOLE=y
720# CONFIG_SERIAL_BFIN_SPORT is not set 718# CONFIG_SERIAL_BFIN_SPORT is not set
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index b37ccc681e7a..d45fa535dad7 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -330,10 +330,9 @@ CONFIG_PM=y
330# CONFIG_PM_LEGACY is not set 330# CONFIG_PM_LEGACY is not set
331# CONFIG_PM_DEBUG is not set 331# CONFIG_PM_DEBUG is not set
332# CONFIG_PM_SYSFS_DEPRECATED is not set 332# CONFIG_PM_SYSFS_DEPRECATED is not set
333CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 333CONFIG_PM_BFIN_SLEEP_DEEPER=y
334# CONFIG_PM_BFIN_SLEEP is not set
334# CONFIG_PM_WAKEUP_BY_GPIO is not set 335# CONFIG_PM_WAKEUP_BY_GPIO is not set
335# CONFIG_PM_WAKEUP_GPIO_API is not set
336CONFIG_PM_WAKEUP_SIC_IWR=0x8
337 336
338# 337#
339# CPU Frequency scaling 338# CPU Frequency scaling
@@ -1013,6 +1012,7 @@ CONFIG_SND_BFIN_AD73311_SE=4
1013CONFIG_SND_SOC_AC97_BUS=y 1012CONFIG_SND_SOC_AC97_BUS=y
1014CONFIG_SND_SOC=m 1013CONFIG_SND_SOC=m
1015CONFIG_SND_BF5XX_SOC=m 1014CONFIG_SND_BF5XX_SOC=m
1015CONFIG_SND_MMAP_SUPPORT=y
1016CONFIG_SND_BF5XX_SOC_AC97=m 1016CONFIG_SND_BF5XX_SOC_AC97=m
1017# CONFIG_SND_BF5XX_SOC_WM8750 is not set 1017# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1018# CONFIG_SND_BF5XX_SOC_WM8731 is not set 1018# CONFIG_SND_BF5XX_SOC_WM8731 is not set
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index fd702161ef59..c9707f7665ad 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -396,6 +396,7 @@ CONFIG_BINFMT_ZFLAT=y
396# Power management options 396# Power management options
397# 397#
398# CONFIG_PM is not set 398# CONFIG_PM is not set
399# CONFIG_PM_WAKEUP_BY_GPIO is not set
399 400
400# 401#
401# CPU Frequency scaling 402# CPU Frequency scaling
@@ -1075,6 +1076,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
1075CONFIG_SND_SOC_AC97_BUS=y 1076CONFIG_SND_SOC_AC97_BUS=y
1076CONFIG_SND_SOC=y 1077CONFIG_SND_SOC=y
1077CONFIG_SND_BF5XX_SOC=y 1078CONFIG_SND_BF5XX_SOC=y
1079CONFIG_SND_MMAP_SUPPORT=y
1078CONFIG_SND_BF5XX_SOC_AC97=y 1080CONFIG_SND_BF5XX_SOC_AC97=y
1079CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y 1081CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1080# CONFIG_SND_BF5XX_SOC_WM8750 is not set 1082# CONFIG_SND_BF5XX_SOC_WM8750 is not set
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 8546994939fb..4d8a63331309 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -367,6 +367,7 @@ CONFIG_BINFMT_ZFLAT=y
367# Power management options 367# Power management options
368# 368#
369# CONFIG_PM is not set 369# CONFIG_PM is not set
370# CONFIG_PM_WAKEUP_BY_GPIO is not set
370 371
371# 372#
372# Networking 373# Networking
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 5453bc3664fc..8fd5d22cec34 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -105,13 +105,14 @@ int request_dma(unsigned int channel, char *device_id)
105 mutex_unlock(&(dma_ch[channel].dmalock)); 105 mutex_unlock(&(dma_ch[channel].dmalock));
106 106
107#ifdef CONFIG_BF54x 107#ifdef CONFIG_BF54x
108 if (channel >= CH_UART2_RX && channel <= CH_UART3_TX && 108 if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) {
109 strncmp(device_id, "BFIN_UART", 9) == 0) 109 if (strncmp(device_id, "BFIN_UART", 9) == 0)
110 dma_ch[channel].regs->peripheral_map |= 110 dma_ch[channel].regs->peripheral_map |=
111 (channel - CH_UART2_RX + 0xC); 111 (channel - CH_UART2_RX + 0xC);
112 else 112 else
113 dma_ch[channel].regs->peripheral_map |= 113 dma_ch[channel].regs->peripheral_map |=
114 (channel - CH_UART2_RX + 0x6); 114 (channel - CH_UART2_RX + 0x6);
115 }
115#endif 116#endif
116 117
117 dma_ch[channel].device_id = device_id; 118 dma_ch[channel].device_id = device_id;
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c
index 5cf4bdb1df3b..1904d8b53328 100644
--- a/arch/blackfin/kernel/gptimers.c
+++ b/arch/blackfin/kernel/gptimers.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * bfin_gptimers.c - derived from bf53x_timers.c 2 * gptimers.c - Blackfin General Purpose Timer core API
3 * Driver for General Purpose Timer functions on the Blackfin processor
4 * 3 *
5 * Copyright (C) 2005 John DeHority 4 * Copyright (c) 2005-2008 Analog Devices Inc.
6 * Copyright (C) 2006 Hella Aglaia GmbH (awe@aglaia-gmbh.de) 5 * Copyright (C) 2005 John DeHority
6 * Copyright (C) 2006 Hella Aglaia GmbH (awe@aglaia-gmbh.de)
7 * 7 *
8 * Licensed under the GPLv2. 8 * Licensed under the GPLv2.
9 */ 9 */
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 8229b1090eb9..2255c289a714 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -32,6 +32,7 @@
32static DEFINE_PER_CPU(struct cpu, cpu_devices); 32static DEFINE_PER_CPU(struct cpu, cpu_devices);
33 33
34u16 _bfin_swrst; 34u16 _bfin_swrst;
35EXPORT_SYMBOL(_bfin_swrst);
35 36
36unsigned long memory_start, memory_end, physical_mem_end; 37unsigned long memory_start, memory_end, physical_mem_end;
37unsigned long reserved_mem_dcache_on; 38unsigned long reserved_mem_dcache_on;
@@ -514,6 +515,7 @@ static __init void memory_setup(void)
514 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); 515 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
515 516
516 printk(KERN_INFO "Memory map:\n" 517 printk(KERN_INFO "Memory map:\n"
518 KERN_INFO " fixedcode = 0x%p-0x%p\n"
517 KERN_INFO " text = 0x%p-0x%p\n" 519 KERN_INFO " text = 0x%p-0x%p\n"
518 KERN_INFO " rodata = 0x%p-0x%p\n" 520 KERN_INFO " rodata = 0x%p-0x%p\n"
519 KERN_INFO " bss = 0x%p-0x%p\n" 521 KERN_INFO " bss = 0x%p-0x%p\n"
@@ -527,7 +529,8 @@ static __init void memory_setup(void)
527#if DMA_UNCACHED_REGION > 0 529#if DMA_UNCACHED_REGION > 0
528 KERN_INFO " DMA Zone = 0x%p-0x%p\n" 530 KERN_INFO " DMA Zone = 0x%p-0x%p\n"
529#endif 531#endif
530 , _stext, _etext, 532 , (void *)FIXED_CODE_START, (void *)FIXED_CODE_END,
533 _stext, _etext,
531 __start_rodata, __end_rodata, 534 __start_rodata, __end_rodata,
532 __bss_start, __bss_stop, 535 __bss_start, __bss_stop,
533 _sdata, _edata, 536 _sdata, _edata,
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index aed832540b3b..cb01a9de2680 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -147,44 +147,64 @@ SECTIONS
147 147
148 __l1_lma_start = .; 148 __l1_lma_start = .;
149 149
150#if L1_CODE_LENGTH
151# define LDS_L1_CODE *(.l1.text)
152#else
153# define LDS_L1_CODE
154#endif
150 .text_l1 L1_CODE_START : AT(LOADADDR(.init.ramfs) + SIZEOF(.init.ramfs)) 155 .text_l1 L1_CODE_START : AT(LOADADDR(.init.ramfs) + SIZEOF(.init.ramfs))
151 { 156 {
152 . = ALIGN(4); 157 . = ALIGN(4);
153 __stext_l1 = .; 158 __stext_l1 = .;
154 *(.l1.text) 159 LDS_L1_CODE
155
156 . = ALIGN(4); 160 . = ALIGN(4);
157 __etext_l1 = .; 161 __etext_l1 = .;
158 } 162 }
159 163
164#if L1_DATA_A_LENGTH
165# define LDS_L1_A_DATA *(.l1.data)
166# define LDS_L1_A_BSS *(.l1.bss)
167# define LDS_L1_A_CACHE *(.data_l1.cacheline_aligned)
168#else
169# define LDS_L1_A_DATA
170# define LDS_L1_A_BSS
171# define LDS_L1_A_CACHE
172#endif
160 .data_l1 L1_DATA_A_START : AT(LOADADDR(.text_l1) + SIZEOF(.text_l1)) 173 .data_l1 L1_DATA_A_START : AT(LOADADDR(.text_l1) + SIZEOF(.text_l1))
161 { 174 {
162 . = ALIGN(4); 175 . = ALIGN(4);
163 __sdata_l1 = .; 176 __sdata_l1 = .;
164 *(.l1.data) 177 LDS_L1_A_DATA
165 __edata_l1 = .; 178 __edata_l1 = .;
166 179
167 . = ALIGN(4); 180 . = ALIGN(4);
168 __sbss_l1 = .; 181 __sbss_l1 = .;
169 *(.l1.bss) 182 LDS_L1_A_BSS
170 183
171 . = ALIGN(32); 184 . = ALIGN(32);
172 *(.data_l1.cacheline_aligned) 185 LDS_L1_A_CACHE
173 186
174 . = ALIGN(4); 187 . = ALIGN(4);
175 __ebss_l1 = .; 188 __ebss_l1 = .;
176 } 189 }
177 190
191#if L1_DATA_B_LENGTH
192# define LDS_L1_B_DATA *(.l1.data.B)
193# define LDS_L1_B_BSS *(.l1.bss.B)
194#else
195# define LDS_L1_B_DATA
196# define LDS_L1_B_BSS
197#endif
178 .data_b_l1 L1_DATA_B_START : AT(LOADADDR(.data_l1) + SIZEOF(.data_l1)) 198 .data_b_l1 L1_DATA_B_START : AT(LOADADDR(.data_l1) + SIZEOF(.data_l1))
179 { 199 {
180 . = ALIGN(4); 200 . = ALIGN(4);
181 __sdata_b_l1 = .; 201 __sdata_b_l1 = .;
182 *(.l1.data.B) 202 LDS_L1_B_DATA
183 __edata_b_l1 = .; 203 __edata_b_l1 = .;
184 204
185 . = ALIGN(4); 205 . = ALIGN(4);
186 __sbss_b_l1 = .; 206 __sbss_b_l1 = .;
187 *(.l1.bss.B) 207 LDS_L1_B_BSS
188 208
189 . = ALIGN(4); 209 . = ALIGN(4);
190 __ebss_b_l1 = .; 210 __ebss_b_l1 = .;
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 337515fba612..cf4bc0d83355 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -180,8 +180,8 @@ static struct mtd_partition partition_info[] = {
180 }, 180 },
181 { 181 {
182 .name = "File System", 182 .name = "File System",
183 .offset = 4 * SIZE_1M, 183 .offset = MTDPART_OFS_APPEND,
184 .size = (256 - 4) * SIZE_1M, 184 .size = MTDPART_SIZ_FULL,
185 }, 185 },
186}; 186};
187 187
@@ -422,11 +422,11 @@ static struct mtd_partition bfin_spi_flash_partitions[] = {
422 }, { 422 }, {
423 .name = "kernel", 423 .name = "kernel",
424 .size = 0xe0000, 424 .size = 0xe0000,
425 .offset = 0x20000 425 .offset = MTDPART_OFS_APPEND,
426 }, { 426 }, {
427 .name = "file system", 427 .name = "file system",
428 .size = 0x700000, 428 .size = MTDPART_SIZ_FULL,
429 .offset = 0x00100000, 429 .offset = MTDPART_OFS_APPEND,
430 } 430 }
431}; 431};
432 432
@@ -484,13 +484,6 @@ static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
484}; 484};
485#endif 485#endif
486 486
487#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
488static struct bfin5xx_spi_chip ad5304_chip_info = {
489 .enable_dma = 0,
490 .bits_per_word = 16,
491};
492#endif
493
494#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 487#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
495static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 488static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
496 .enable_dma = 0, 489 .enable_dma = 0,
@@ -611,17 +604,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
611 .mode = SPI_MODE_3, 604 .mode = SPI_MODE_3,
612 }, 605 },
613#endif 606#endif
614#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
615 {
616 .modalias = "ad5304_spi",
617 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
618 .bus_num = 0,
619 .chip_select = 2,
620 .platform_data = NULL,
621 .controller_data = &ad5304_chip_info,
622 .mode = SPI_MODE_2,
623 },
624#endif
625#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 607#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
626 { 608 {
627 .modalias = "ad7877", 609 .modalias = "ad7877",
@@ -818,6 +800,19 @@ static struct platform_device bfin_device_gpiokeys = {
818}; 800};
819#endif 801#endif
820 802
803static struct resource bfin_gpios_resources = {
804 .start = 0,
805 .end = MAX_BLACKFIN_GPIOS - 1,
806 .flags = IORESOURCE_IRQ,
807};
808
809static struct platform_device bfin_gpios_device = {
810 .name = "simple-gpio",
811 .id = -1,
812 .num_resources = 1,
813 .resource = &bfin_gpios_resources,
814};
815
821static struct platform_device *stamp_devices[] __initdata = { 816static struct platform_device *stamp_devices[] __initdata = {
822#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) 817#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
823 &bf5xx_nand_device, 818 &bf5xx_nand_device,
@@ -895,6 +890,8 @@ static struct platform_device *stamp_devices[] __initdata = {
895#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 890#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
896 &bfin_device_gpiokeys, 891 &bfin_device_gpiokeys,
897#endif 892#endif
893
894 &bfin_gpios_device,
898}; 895};
899 896
900static int __init stamp_init(void) 897static int __init stamp_init(void)
@@ -921,13 +918,18 @@ void native_machine_restart(char *cmd)
921 bfin_gpio_reset_spi0_ssel1(); 918 bfin_gpio_reset_spi0_ssel1();
922} 919}
923 920
924/*
925 * Currently the MAC address is saved in Flash by U-Boot
926 */
927#define FLASH_MAC 0x203f0000
928void bfin_get_ether_addr(char *addr) 921void bfin_get_ether_addr(char *addr)
929{ 922{
930 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); 923 /* the MAC is stored in OTP memory page 0xDF */
931 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); 924 u32 ret;
925 u64 otp_mac;
926 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
927
928 ret = otp_read(0xDF, 0x00, &otp_mac);
929 if (!(ret & 0x1)) {
930 char *otp_mac_p = (char *)&otp_mac;
931 for (ret = 0; ret < 6; ++ret)
932 addr[ret] = otp_mac_p[5 - ret];
933 }
932} 934}
933EXPORT_SYMBOL(bfin_get_ether_addr); 935EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 2b09aa39f565..241b5a20a36a 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -99,11 +99,11 @@ static struct mtd_partition bfin_spi_flash_partitions[] = {
99 }, { 99 }, {
100 .name = "kernel", 100 .name = "kernel",
101 .size = 0xe0000, 101 .size = 0xe0000,
102 .offset = 0x20000 102 .offset = MTDPART_OFS_APPEND,
103 }, { 103 }, {
104 .name = "file system", 104 .name = "file system",
105 .size = 0x700000, 105 .size = MTDPART_SIZ_FULL,
106 .offset = 0x00100000, 106 .offset = MTDPART_OFS_APPEND,
107 } 107 }
108}; 108};
109 109
@@ -298,6 +298,19 @@ static struct platform_device bfin_device_gpiokeys = {
298}; 298};
299#endif 299#endif
300 300
301static struct resource bfin_gpios_resources = {
302 .start = 0,
303 .end = MAX_BLACKFIN_GPIOS - 1,
304 .flags = IORESOURCE_IRQ,
305};
306
307static struct platform_device bfin_gpios_device = {
308 .name = "simple-gpio",
309 .id = -1,
310 .num_resources = 1,
311 .resource = &bfin_gpios_resources,
312};
313
301#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) 314#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
302#include <linux/i2c-gpio.h> 315#include <linux/i2c-gpio.h>
303 316
@@ -350,6 +363,8 @@ static struct platform_device *ezkit_devices[] __initdata = {
350#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) 363#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
351 &i2c_gpio_device, 364 &i2c_gpio_device,
352#endif 365#endif
366
367 &bfin_gpios_device,
353}; 368};
354 369
355static int __init ezkit_init(void) 370static int __init ezkit_init(void)
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index a645f6fd091b..b2ac4816ae62 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -112,7 +112,7 @@ static struct platform_device net2272_bfin_device = {
112static struct mtd_partition stamp_partitions[] = { 112static struct mtd_partition stamp_partitions[] = {
113 { 113 {
114 .name = "Bootloader", 114 .name = "Bootloader",
115 .size = 0x20000, 115 .size = 0x40000,
116 .offset = 0, 116 .offset = 0,
117 }, { 117 }, {
118 .name = "Kernel", 118 .name = "Kernel",
@@ -160,17 +160,17 @@ static struct platform_device stamp_flash_device = {
160static struct mtd_partition bfin_spi_flash_partitions[] = { 160static struct mtd_partition bfin_spi_flash_partitions[] = {
161 { 161 {
162 .name = "bootloader", 162 .name = "bootloader",
163 .size = 0x00020000, 163 .size = 0x00040000,
164 .offset = 0, 164 .offset = 0,
165 .mask_flags = MTD_CAP_ROM 165 .mask_flags = MTD_CAP_ROM
166 }, { 166 }, {
167 .name = "kernel", 167 .name = "kernel",
168 .size = 0xe0000, 168 .size = 0xe0000,
169 .offset = 0x20000 169 .offset = MTDPART_OFS_APPEND,
170 }, { 170 }, {
171 .name = "file system", 171 .name = "file system",
172 .size = 0x700000, 172 .size = MTDPART_SIZ_FULL,
173 .offset = 0x00100000, 173 .offset = MTDPART_OFS_APPEND,
174 } 174 }
175}; 175};
176 176
@@ -212,13 +212,6 @@ static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
212}; 212};
213#endif 213#endif
214 214
215#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
216static struct bfin5xx_spi_chip ad5304_chip_info = {
217 .enable_dma = 0,
218 .bits_per_word = 16,
219};
220#endif
221
222#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 215#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
223static struct bfin5xx_spi_chip spi_mmc_chip_info = { 216static struct bfin5xx_spi_chip spi_mmc_chip_info = {
224 .enable_dma = 1, 217 .enable_dma = 1,
@@ -308,17 +301,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
308 }, 301 },
309#endif 302#endif
310 303
311#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
312 {
313 .modalias = "ad5304_spi",
314 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
315 .bus_num = 0,
316 .chip_select = 2,
317 .platform_data = NULL,
318 .controller_data = &ad5304_chip_info,
319 .mode = SPI_MODE_2,
320 },
321#endif
322#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) 304#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
323 { 305 {
324 .modalias = "spidev", 306 .modalias = "spidev",
@@ -457,6 +439,19 @@ static struct platform_device bfin_device_gpiokeys = {
457}; 439};
458#endif 440#endif
459 441
442static struct resource bfin_gpios_resources = {
443 .start = 0,
444 .end = MAX_BLACKFIN_GPIOS - 1,
445 .flags = IORESOURCE_IRQ,
446};
447
448static struct platform_device bfin_gpios_device = {
449 .name = "simple-gpio",
450 .id = -1,
451 .num_resources = 1,
452 .resource = &bfin_gpios_resources,
453};
454
460#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) 455#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
461#include <linux/i2c-gpio.h> 456#include <linux/i2c-gpio.h>
462 457
@@ -518,6 +513,8 @@ static struct platform_device *stamp_devices[] __initdata = {
518#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) 513#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
519 &i2c_gpio_device, 514 &i2c_gpio_device,
520#endif 515#endif
516
517 &bfin_gpios_device,
521 &stamp_flash_device, 518 &stamp_flash_device,
522}; 519};
523 520
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 8a3397db1d21..c95395ba7bfa 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -371,13 +371,6 @@ static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
371}; 371};
372#endif 372#endif
373 373
374#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
375static struct bfin5xx_spi_chip ad5304_chip_info = {
376 .enable_dma = 0,
377 .bits_per_word = 16,
378};
379#endif
380
381#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 374#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
382static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 375static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
383 .enable_dma = 0, 376 .enable_dma = 0,
@@ -483,17 +476,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
483 .mode = SPI_MODE_3, 476 .mode = SPI_MODE_3,
484 }, 477 },
485#endif 478#endif
486#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
487 {
488 .modalias = "ad5304_spi",
489 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
490 .bus_num = 0,
491 .chip_select = 2,
492 .platform_data = NULL,
493 .controller_data = &ad5304_chip_info,
494 .mode = SPI_MODE_2,
495 },
496#endif
497#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 479#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
498 { 480 {
499 .modalias = "ad7877", 481 .modalias = "ad7877",
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 9e2277e0d25c..ea83148993da 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -128,6 +128,19 @@ static struct platform_device bfin_device_gpiokeys = {
128}; 128};
129#endif 129#endif
130 130
131static struct resource bfin_gpios_resources = {
132 .start = 0,
133 .end = MAX_BLACKFIN_GPIOS - 1,
134 .flags = IORESOURCE_IRQ,
135};
136
137static struct platform_device bfin_gpios_device = {
138 .name = "simple-gpio",
139 .id = -1,
140 .num_resources = 1,
141 .resource = &bfin_gpios_resources,
142};
143
131#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 144#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
132static struct resource bfin_pcmcia_cf_resources[] = { 145static struct resource bfin_pcmcia_cf_resources[] = {
133 { 146 {
@@ -343,7 +356,7 @@ static struct platform_device net2272_bfin_device = {
343static struct mtd_partition stamp_partitions[] = { 356static struct mtd_partition stamp_partitions[] = {
344 { 357 {
345 .name = "Bootloader", 358 .name = "Bootloader",
346 .size = 0x20000, 359 .size = 0x40000,
347 .offset = 0, 360 .offset = 0,
348 }, { 361 }, {
349 .name = "Kernel", 362 .name = "Kernel",
@@ -351,7 +364,7 @@ static struct mtd_partition stamp_partitions[] = {
351 .offset = MTDPART_OFS_APPEND, 364 .offset = MTDPART_OFS_APPEND,
352 }, { 365 }, {
353 .name = "RootFS", 366 .name = "RootFS",
354 .size = 0x400000 - 0x20000 - 0xE0000 - 0x10000, 367 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
355 .offset = MTDPART_OFS_APPEND, 368 .offset = MTDPART_OFS_APPEND,
356 }, { 369 }, {
357 .name = "MAC Address", 370 .name = "MAC Address",
@@ -391,17 +404,17 @@ static struct platform_device stamp_flash_device = {
391static struct mtd_partition bfin_spi_flash_partitions[] = { 404static struct mtd_partition bfin_spi_flash_partitions[] = {
392 { 405 {
393 .name = "bootloader", 406 .name = "bootloader",
394 .size = 0x00020000, 407 .size = 0x00040000,
395 .offset = 0, 408 .offset = 0,
396 .mask_flags = MTD_CAP_ROM 409 .mask_flags = MTD_CAP_ROM
397 }, { 410 }, {
398 .name = "kernel", 411 .name = "kernel",
399 .size = 0xe0000, 412 .size = 0xe0000,
400 .offset = 0x20000 413 .offset = MTDPART_OFS_APPEND,
401 }, { 414 }, {
402 .name = "file system", 415 .name = "file system",
403 .size = 0x700000, 416 .size = MTDPART_SIZ_FULL,
404 .offset = 0x00100000, 417 .offset = MTDPART_OFS_APPEND,
405 } 418 }
406}; 419};
407 420
@@ -459,13 +472,6 @@ static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
459}; 472};
460#endif 473#endif
461 474
462#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
463static struct bfin5xx_spi_chip ad5304_chip_info = {
464 .enable_dma = 0,
465 .bits_per_word = 16,
466};
467#endif
468
469#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 475#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
470static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 476static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
471 .enable_dma = 0, 477 .enable_dma = 0,
@@ -578,17 +584,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
578 .mode = SPI_MODE_3, 584 .mode = SPI_MODE_3,
579 }, 585 },
580#endif 586#endif
581#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
582 {
583 .modalias = "ad5304_spi",
584 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
585 .bus_num = 0,
586 .chip_select = 2,
587 .platform_data = NULL,
588 .controller_data = &ad5304_chip_info,
589 .mode = SPI_MODE_2,
590 },
591#endif
592#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 587#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
593 { 588 {
594 .modalias = "ad7877", 589 .modalias = "ad7877",
@@ -821,6 +816,8 @@ static struct platform_device *stamp_devices[] __initdata = {
821#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 816#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
822 &bfin_device_gpiokeys, 817 &bfin_device_gpiokeys,
823#endif 818#endif
819
820 &bfin_gpios_device,
824 &stamp_flash_device, 821 &stamp_flash_device,
825}; 822};
826 823
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 916e963e83ba..a0950c1fd800 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -285,8 +285,8 @@ static struct mtd_partition partition_info[] = {
285 }, 285 },
286 { 286 {
287 .name = "File System", 287 .name = "File System",
288 .offset = 4 * SIZE_1M, 288 .offset = MTDPART_OFS_APPEND,
289 .size = (256 - 4) * SIZE_1M, 289 .size = MTDPART_SIZ_FULL,
290 }, 290 },
291}; 291};
292 292
@@ -333,7 +333,7 @@ static struct platform_device bf54x_sdh_device = {
333static struct mtd_partition ezkit_partitions[] = { 333static struct mtd_partition ezkit_partitions[] = {
334 { 334 {
335 .name = "Bootloader", 335 .name = "Bootloader",
336 .size = 0x20000, 336 .size = 0x40000,
337 .offset = 0, 337 .offset = 0,
338 }, { 338 }, {
339 .name = "Kernel", 339 .name = "Kernel",
@@ -381,8 +381,8 @@ static struct mtd_partition bfin_spi_flash_partitions[] = {
381 .mask_flags = MTD_CAP_ROM 381 .mask_flags = MTD_CAP_ROM
382 }, { 382 }, {
383 .name = "linux kernel", 383 .name = "linux kernel",
384 .size = 0x1c0000, 384 .size = MTDPART_SIZ_FULL,
385 .offset = 0x40000 385 .offset = MTDPART_OFS_APPEND,
386 } 386 }
387}; 387};
388 388
@@ -594,6 +594,19 @@ static struct platform_device bfin_device_gpiokeys = {
594}; 594};
595#endif 595#endif
596 596
597static struct resource bfin_gpios_resources = {
598 .start = 0,
599 .end = MAX_BLACKFIN_GPIOS - 1,
600 .flags = IORESOURCE_IRQ,
601};
602
603static struct platform_device bfin_gpios_device = {
604 .name = "simple-gpio",
605 .id = -1,
606 .num_resources = 1,
607 .resource = &bfin_gpios_resources,
608};
609
597static struct platform_device *ezkit_devices[] __initdata = { 610static struct platform_device *ezkit_devices[] __initdata = {
598#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 611#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
599 &rtc_device, 612 &rtc_device,
@@ -646,6 +659,8 @@ static struct platform_device *ezkit_devices[] __initdata = {
646#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 659#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
647 &bfin_device_gpiokeys, 660 &bfin_device_gpiokeys,
648#endif 661#endif
662
663 &bfin_gpios_device,
649 &ezkit_flash_device, 664 &ezkit_flash_device,
650}; 665};
651 666
diff --git a/arch/blackfin/mach-bf548/dma.c b/arch/blackfin/mach-bf548/dma.c
index 374803a8d2e8..f5479298bb79 100644
--- a/arch/blackfin/mach-bf548/dma.c
+++ b/arch/blackfin/mach-bf548/dma.c
@@ -27,6 +27,8 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30#include <linux/module.h>
31
30#include <asm/blackfin.h> 32#include <asm/blackfin.h>
31#include <asm/dma.h> 33#include <asm/dma.h>
32 34
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
index 74fe258421a5..46222a75321a 100644
--- a/arch/blackfin/mach-bf548/head.S
+++ b/arch/blackfin/mach-bf548/head.S
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h>
31#include <asm/blackfin.h> 32#include <asm/blackfin.h>
32#include <asm/trace.h> 33#include <asm/trace.h>
33#if CONFIG_BFIN_KERNEL_CLOCK 34#if CONFIG_BFIN_KERNEL_CLOCK
@@ -44,10 +45,9 @@
44 45
45#define INITIAL_STACK 0xFFB01000 46#define INITIAL_STACK 0xFFB01000
46 47
47.text 48__INIT
48 49
49ENTRY(__start) 50ENTRY(__start)
50ENTRY(__stext)
51 /* R0: argument of command line string, passed from uboot, save it */ 51 /* R0: argument of command line string, passed from uboot, save it */
52 R7 = R0; 52 R7 = R0;
53 /* Enable Cycle Counter and Nesting Of Interrupts */ 53 /* Enable Cycle Counter and Nesting Of Interrupts */
@@ -213,6 +213,7 @@ ENTRY(__stext)
213 213
214.LWAIT_HERE: 214.LWAIT_HERE:
215 jump .LWAIT_HERE; 215 jump .LWAIT_HERE;
216ENDPROC(__start)
216 217
217ENTRY(_real_start) 218ENTRY(_real_start)
218 [ -- sp ] = reti; 219 [ -- sp ] = reti;
@@ -285,6 +286,9 @@ ENTRY(_real_start)
285 call _start_kernel; 286 call _start_kernel;
286.L_exit: 287.L_exit:
287 jump.s .L_exit; 288 jump.s .L_exit;
289ENDPROC(_real_start)
290
291__FINIT
288 292
289.section .l1.text 293.section .l1.text
290#if CONFIG_BFIN_KERNEL_CLOCK 294#if CONFIG_BFIN_KERNEL_CLOCK
@@ -450,6 +454,7 @@ ENTRY(_start_dma_code)
450 SSYNC; 454 SSYNC;
451 455
452 RTS; 456 RTS;
457ENDPROC(_start_dma_code)
453#endif /* CONFIG_BFIN_KERNEL_CLOCK */ 458#endif /* CONFIG_BFIN_KERNEL_CLOCK */
454 459
455.data 460.data
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 43c1b0982819..d357f648d963 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -223,7 +223,7 @@ static struct platform_device bfin_uart_device = {
223static struct mtd_partition ezkit_partitions[] = { 223static struct mtd_partition ezkit_partitions[] = {
224 { 224 {
225 .name = "Bootloader", 225 .name = "Bootloader",
226 .size = 0x20000, 226 .size = 0x40000,
227 .offset = 0, 227 .offset = 0,
228 }, { 228 }, {
229 .name = "Kernel", 229 .name = "Kernel",
@@ -389,6 +389,19 @@ static struct platform_device bfin_device_gpiokeys = {
389}; 389};
390#endif 390#endif
391 391
392static struct resource bfin_gpios_resources = {
393 .start = 0,
394 .end = MAX_BLACKFIN_GPIOS - 1,
395 .flags = IORESOURCE_IRQ,
396};
397
398static struct platform_device bfin_gpios_device = {
399 .name = "simple-gpio",
400 .id = -1,
401 .num_resources = 1,
402 .resource = &bfin_gpios_resources,
403};
404
392#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) 405#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
393#include <linux/i2c-gpio.h> 406#include <linux/i2c-gpio.h>
394 407
@@ -446,6 +459,7 @@ static struct platform_device *ezkit_devices[] __initdata = {
446 &isp1362_hcd_device, 459 &isp1362_hcd_device,
447#endif 460#endif
448 461
462 &bfin_gpios_device,
449 &ezkit_flash_device, 463 &ezkit_flash_device,
450}; 464};
451 465
diff --git a/arch/blackfin/mach-common/dpmc.S b/arch/blackfin/mach-common/dpmc.S
index b80ddd8b232d..9d45aa3265b1 100644
--- a/arch/blackfin/mach-common/dpmc.S
+++ b/arch/blackfin/mach-common/dpmc.S
@@ -31,140 +31,6 @@
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34.text
35
36ENTRY(_unmask_wdog_wakeup_evt)
37 [--SP] = ( R7:0, P5:0 );
38#if defined(CONFIG_BF561)
39 P0.H = hi(SICA_IWR1);
40 P0.L = lo(SICA_IWR1);
41#elif defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
42 P0.h = HI(SIC_IWR0);
43 P0.l = LO(SIC_IWR0);
44#else
45 P0.h = HI(SIC_IWR);
46 P0.l = LO(SIC_IWR);
47#endif
48 R7 = [P0];
49#if defined(CONFIG_BF561)
50 BITSET(R7, 27);
51#else
52 BITSET(R7,(IRQ_WATCH - IVG7));
53#endif
54 [P0] = R7;
55 SSYNC;
56
57 ( R7:0, P5:0 ) = [SP++];
58 RTS;
59
60.LWRITE_TO_STAT:
61 /* When watch dog timer is enabled, a write to STAT will load the
62 * contents of CNT to STAT
63 */
64 R7 = 0x0000(z);
65#if defined(CONFIG_BF561)
66 P0.h = HI(WDOGA_STAT);
67 P0.l = LO(WDOGA_STAT);
68#else
69 P0.h = HI(WDOG_STAT);
70 P0.l = LO(WDOG_STAT);
71#endif
72 [P0] = R7;
73 SSYNC;
74 JUMP .LSKIP_WRITE_TO_STAT;
75
76ENTRY(_program_wdog_timer)
77 [--SP] = ( R7:0, P5:0 );
78#if defined(CONFIG_BF561)
79 P0.h = HI(WDOGA_CNT);
80 P0.l = LO(WDOGA_CNT);
81#else
82 P0.h = HI(WDOG_CNT);
83 P0.l = LO(WDOG_CNT);
84#endif
85 [P0] = R0;
86 SSYNC;
87
88#if defined(CONFIG_BF561)
89 P0.h = HI(WDOGA_CTL);
90 P0.l = LO(WDOGA_CTL);
91#else
92 P0.h = HI(WDOG_CTL);
93 P0.l = LO(WDOG_CTL);
94#endif
95 R7 = W[P0](Z);
96 CC = BITTST(R7,1);
97 if !CC JUMP .LWRITE_TO_STAT;
98 CC = BITTST(R7,2);
99 if !CC JUMP .LWRITE_TO_STAT;
100
101.LSKIP_WRITE_TO_STAT:
102#if defined(CONFIG_BF561)
103 P0.h = HI(WDOGA_CTL);
104 P0.l = LO(WDOGA_CTL);
105#else
106 P0.h = HI(WDOG_CTL);
107 P0.l = LO(WDOG_CTL);
108#endif
109 R7 = W[P0](Z);
110 BITCLR(R7,1); /* Enable GP event */
111 BITSET(R7,2);
112 W[P0] = R7.L;
113 SSYNC;
114 NOP;
115
116 R7 = W[P0](Z);
117 BITCLR(R7,4); /* Enable the wdog counter */
118 W[P0] = R7.L;
119 SSYNC;
120
121 ( R7:0, P5:0 ) = [SP++];
122 RTS;
123
124ENTRY(_clear_wdog_wakeup_evt)
125 [--SP] = ( R7:0, P5:0 );
126
127#if defined(CONFIG_BF561)
128 P0.h = HI(WDOGA_CTL);
129 P0.l = LO(WDOGA_CTL);
130#else
131 P0.h = HI(WDOG_CTL);
132 P0.l = LO(WDOG_CTL);
133#endif
134 R7 = 0x0AD6(Z);
135 W[P0] = R7.L;
136 SSYNC;
137
138 R7 = W[P0](Z);
139 BITSET(R7,15);
140 W[P0] = R7.L;
141 SSYNC;
142
143 R7 = W[P0](Z);
144 BITSET(R7,1);
145 BITSET(R7,2);
146 W[P0] = R7.L;
147 SSYNC;
148
149 ( R7:0, P5:0 ) = [SP++];
150 RTS;
151
152ENTRY(_disable_wdog_timer)
153 [--SP] = ( R7:0, P5:0 );
154#if defined(CONFIG_BF561)
155 P0.h = HI(WDOGA_CTL);
156 P0.l = LO(WDOGA_CTL);
157#else
158 P0.h = HI(WDOG_CTL);
159 P0.l = LO(WDOG_CTL);
160#endif
161 R7 = 0xAD6(Z);
162 W[P0] = R7.L;
163 SSYNC;
164 ( R7:0, P5:0 ) = [SP++];
165 RTS;
166
167#if !defined(CONFIG_BF561)
168 34
169.section .l1.text 35.section .l1.text
170 36
@@ -459,10 +325,12 @@ ENTRY(_set_sic_iwr)
459 RTS; 325 RTS;
460 326
461ENTRY(_set_rtc_istat) 327ENTRY(_set_rtc_istat)
328#ifndef CONFIG_BF561
462 P0.H = hi(RTC_ISTAT); 329 P0.H = hi(RTC_ISTAT);
463 P0.L = lo(RTC_ISTAT); 330 P0.L = lo(RTC_ISTAT);
464 w[P0] = R0.L; 331 w[P0] = R0.L;
465 SSYNC; 332 SSYNC;
333#endif
466 RTS; 334 RTS;
467 335
468ENTRY(_test_pll_locked) 336ENTRY(_test_pll_locked)
@@ -473,4 +341,3 @@ ENTRY(_test_pll_locked)
473 CC = BITTST(R0,5); 341 CC = BITTST(R0,5);
474 IF !CC JUMP 1b; 342 IF !CC JUMP 1b;
475 RTS; 343 RTS;
476#endif
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 880595afe98d..225ef14af75e 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -74,7 +74,7 @@ unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */
74#endif 74#endif
75 75
76struct ivgx { 76struct ivgx {
77 /* irq number for request_irq, available in mach-bf533/irq.h */ 77 /* irq number for request_irq, available in mach-bf5xx/irq.h */
78 unsigned int irqno; 78 unsigned int irqno;
79 /* corresponding bit in the SIC_ISR register */ 79 /* corresponding bit in the SIC_ISR register */
80 unsigned int isrflag; 80 unsigned int isrflag;
@@ -86,7 +86,6 @@ struct ivg_slice {
86 struct ivgx *istop; 86 struct ivgx *istop;
87} ivg7_13[IVG13 - IVG7 + 1]; 87} ivg7_13[IVG13 - IVG7 + 1];
88 88
89static void search_IAR(void);
90 89
91/* 90/*
92 * Search SIC_IAR and fill tables with the irqvalues 91 * Search SIC_IAR and fill tables with the irqvalues
@@ -120,10 +119,10 @@ static void __init search_IAR(void)
120} 119}
121 120
122/* 121/*
123 * This is for BF533 internal IRQs 122 * This is for core internal IRQs
124 */ 123 */
125 124
126static void ack_noop(unsigned int irq) 125static void bfin_ack_noop(unsigned int irq)
127{ 126{
128 /* Dummy function. */ 127 /* Dummy function. */
129} 128}
@@ -156,11 +155,11 @@ static void bfin_internal_mask_irq(unsigned int irq)
156{ 155{
157#ifdef CONFIG_BF53x 156#ifdef CONFIG_BF53x
158 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & 157 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
159 ~(1 << (irq - (IRQ_CORETMR + 1)))); 158 ~(1 << SIC_SYSIRQ(irq)));
160#else 159#else
161 unsigned mask_bank, mask_bit; 160 unsigned mask_bank, mask_bit;
162 mask_bank = (irq - (IRQ_CORETMR + 1)) / 32; 161 mask_bank = SIC_SYSIRQ(irq) / 32;
163 mask_bit = (irq - (IRQ_CORETMR + 1)) % 32; 162 mask_bit = SIC_SYSIRQ(irq) % 32;
164 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & 163 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) &
165 ~(1 << mask_bit)); 164 ~(1 << mask_bit));
166#endif 165#endif
@@ -171,11 +170,11 @@ static void bfin_internal_unmask_irq(unsigned int irq)
171{ 170{
172#ifdef CONFIG_BF53x 171#ifdef CONFIG_BF53x
173 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 172 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() |
174 (1 << (irq - (IRQ_CORETMR + 1)))); 173 (1 << SIC_SYSIRQ(irq)));
175#else 174#else
176 unsigned mask_bank, mask_bit; 175 unsigned mask_bank, mask_bit;
177 mask_bank = (irq - (IRQ_CORETMR + 1)) / 32; 176 mask_bank = SIC_SYSIRQ(irq) / 32;
178 mask_bit = (irq - (IRQ_CORETMR + 1)) % 32; 177 mask_bit = SIC_SYSIRQ(irq) % 32;
179 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) | 178 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) |
180 (1 << mask_bit)); 179 (1 << mask_bit));
181#endif 180#endif
@@ -187,8 +186,8 @@ int bfin_internal_set_wake(unsigned int irq, unsigned int state)
187{ 186{
188 unsigned bank, bit; 187 unsigned bank, bit;
189 unsigned long flags; 188 unsigned long flags;
190 bank = (irq - (IRQ_CORETMR + 1)) / 32; 189 bank = SIC_SYSIRQ(irq) / 32;
191 bit = (irq - (IRQ_CORETMR + 1)) % 32; 190 bit = SIC_SYSIRQ(irq) % 32;
192 191
193 local_irq_save(flags); 192 local_irq_save(flags);
194 193
@@ -204,15 +203,18 @@ int bfin_internal_set_wake(unsigned int irq, unsigned int state)
204#endif 203#endif
205 204
206static struct irq_chip bfin_core_irqchip = { 205static struct irq_chip bfin_core_irqchip = {
207 .ack = ack_noop, 206 .ack = bfin_ack_noop,
208 .mask = bfin_core_mask_irq, 207 .mask = bfin_core_mask_irq,
209 .unmask = bfin_core_unmask_irq, 208 .unmask = bfin_core_unmask_irq,
210}; 209};
211 210
212static struct irq_chip bfin_internal_irqchip = { 211static struct irq_chip bfin_internal_irqchip = {
213 .ack = ack_noop, 212 .ack = bfin_ack_noop,
214 .mask = bfin_internal_mask_irq, 213 .mask = bfin_internal_mask_irq,
215 .unmask = bfin_internal_unmask_irq, 214 .unmask = bfin_internal_unmask_irq,
215 .mask_ack = bfin_internal_mask_irq,
216 .disable = bfin_internal_mask_irq,
217 .enable = bfin_internal_unmask_irq,
216#ifdef CONFIG_PM 218#ifdef CONFIG_PM
217 .set_wake = bfin_internal_set_wake, 219 .set_wake = bfin_internal_set_wake,
218#endif 220#endif
@@ -221,38 +223,23 @@ static struct irq_chip bfin_internal_irqchip = {
221#ifdef BF537_GENERIC_ERROR_INT_DEMUX 223#ifdef BF537_GENERIC_ERROR_INT_DEMUX
222static int error_int_mask; 224static int error_int_mask;
223 225
224static void bfin_generic_error_ack_irq(unsigned int irq)
225{
226
227}
228
229static void bfin_generic_error_mask_irq(unsigned int irq) 226static void bfin_generic_error_mask_irq(unsigned int irq)
230{ 227{
231 error_int_mask &= ~(1L << (irq - IRQ_PPI_ERROR)); 228 error_int_mask &= ~(1L << (irq - IRQ_PPI_ERROR));
232 229
233 if (!error_int_mask) { 230 if (!error_int_mask)
234 local_irq_disable(); 231 bfin_internal_mask_irq(IRQ_GENERIC_ERROR);
235 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
236 ~(1 << (IRQ_GENERIC_ERROR -
237 (IRQ_CORETMR + 1))));
238 SSYNC();
239 local_irq_enable();
240 }
241} 232}
242 233
243static void bfin_generic_error_unmask_irq(unsigned int irq) 234static void bfin_generic_error_unmask_irq(unsigned int irq)
244{ 235{
245 local_irq_disable(); 236 bfin_internal_unmask_irq(IRQ_GENERIC_ERROR);
246 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 1 <<
247 (IRQ_GENERIC_ERROR - (IRQ_CORETMR + 1)));
248 SSYNC();
249 local_irq_enable();
250
251 error_int_mask |= 1L << (irq - IRQ_PPI_ERROR); 237 error_int_mask |= 1L << (irq - IRQ_PPI_ERROR);
252} 238}
253 239
254static struct irq_chip bfin_generic_error_irqchip = { 240static struct irq_chip bfin_generic_error_irqchip = {
255 .ack = bfin_generic_error_ack_irq, 241 .ack = bfin_ack_noop,
242 .mask_ack = bfin_generic_error_mask_irq,
256 .mask = bfin_generic_error_mask_irq, 243 .mask = bfin_generic_error_mask_irq,
257 .unmask = bfin_generic_error_unmask_irq, 244 .unmask = bfin_generic_error_unmask_irq,
258}; 245};
@@ -608,7 +595,7 @@ static struct pin_int_t *pint[NR_PINT_SYS_IRQS] = {
608 (struct pin_int_t *)PINT3_MASK_SET, 595 (struct pin_int_t *)PINT3_MASK_SET,
609}; 596};
610 597
611unsigned short get_irq_base(u8 bank, u8 bmap) 598inline unsigned short get_irq_base(u8 bank, u8 bmap)
612{ 599{
613 600
614 u16 irq_base; 601 u16 irq_base;
@@ -969,17 +956,12 @@ int __init init_arch_irq(void)
969#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 956#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
970 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); 957 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL);
971 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); 958 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL);
972 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
973 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
974# ifdef CONFIG_BF54x 959# ifdef CONFIG_BF54x
975 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 960 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
976 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
977# endif 961# endif
978#else 962#else
979 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 963 bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
980 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
981#endif 964#endif
982 SSYNC();
983 965
984 local_irq_disable(); 966 local_irq_disable();
985 967
@@ -1001,90 +983,53 @@ int __init init_arch_irq(void)
1001 set_irq_chip(irq, &bfin_core_irqchip); 983 set_irq_chip(irq, &bfin_core_irqchip);
1002 else 984 else
1003 set_irq_chip(irq, &bfin_internal_irqchip); 985 set_irq_chip(irq, &bfin_internal_irqchip);
1004#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1005 if (irq != IRQ_GENERIC_ERROR) {
1006#endif
1007 986
1008 switch (irq) { 987 switch (irq) {
1009#if defined(CONFIG_BF53x) 988#if defined(CONFIG_BF53x)
1010 case IRQ_PROG_INTA: 989 case IRQ_PROG_INTA:
1011 set_irq_chained_handler(irq,
1012 bfin_demux_gpio_irq);
1013 break;
1014# if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) 990# if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE))
1015 case IRQ_MAC_RX: 991 case IRQ_MAC_RX:
1016 set_irq_chained_handler(irq,
1017 bfin_demux_gpio_irq);
1018 break;
1019# endif 992# endif
1020#elif defined(CONFIG_BF54x) 993#elif defined(CONFIG_BF54x)
1021 case IRQ_PINT0: 994 case IRQ_PINT0:
1022 set_irq_chained_handler(irq, 995 case IRQ_PINT1:
1023 bfin_demux_gpio_irq); 996 case IRQ_PINT2:
1024 break; 997 case IRQ_PINT3:
1025 case IRQ_PINT1:
1026 set_irq_chained_handler(irq,
1027 bfin_demux_gpio_irq);
1028 break;
1029 case IRQ_PINT2:
1030 set_irq_chained_handler(irq,
1031 bfin_demux_gpio_irq);
1032 break;
1033 case IRQ_PINT3:
1034 set_irq_chained_handler(irq,
1035 bfin_demux_gpio_irq);
1036 break;
1037#elif defined(CONFIG_BF52x) 998#elif defined(CONFIG_BF52x)
1038 case IRQ_PORTF_INTA: 999 case IRQ_PORTF_INTA:
1039 set_irq_chained_handler(irq, 1000 case IRQ_PORTG_INTA:
1040 bfin_demux_gpio_irq); 1001 case IRQ_PORTH_INTA:
1041 break;
1042 case IRQ_PORTG_INTA:
1043 set_irq_chained_handler(irq,
1044 bfin_demux_gpio_irq);
1045 break;
1046 case IRQ_PORTH_INTA:
1047 set_irq_chained_handler(irq,
1048 bfin_demux_gpio_irq);
1049 break;
1050#elif defined(CONFIG_BF561) 1002#elif defined(CONFIG_BF561)
1051 case IRQ_PROG0_INTA: 1003 case IRQ_PROG0_INTA:
1052 set_irq_chained_handler(irq, 1004 case IRQ_PROG1_INTA:
1053 bfin_demux_gpio_irq); 1005 case IRQ_PROG2_INTA:
1054 break;
1055 case IRQ_PROG1_INTA:
1056 set_irq_chained_handler(irq,
1057 bfin_demux_gpio_irq);
1058 break;
1059 case IRQ_PROG2_INTA:
1060 set_irq_chained_handler(irq,
1061 bfin_demux_gpio_irq);
1062 break;
1063#endif 1006#endif
1064 default: 1007 set_irq_chained_handler(irq,
1065 set_irq_handler(irq, handle_simple_irq); 1008 bfin_demux_gpio_irq);
1066 break; 1009 break;
1067 }
1068
1069#ifdef BF537_GENERIC_ERROR_INT_DEMUX 1010#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1070 } else { 1011 case IRQ_GENERIC_ERROR:
1071 set_irq_handler(irq, bfin_demux_error_irq); 1012 set_irq_handler(irq, bfin_demux_error_irq);
1072 } 1013
1014 break;
1073#endif 1015#endif
1016 default:
1017 set_irq_handler(irq, handle_simple_irq);
1018 break;
1019 }
1074 } 1020 }
1021
1075#ifdef BF537_GENERIC_ERROR_INT_DEMUX 1022#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1076 for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++) { 1023 for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++)
1077 set_irq_chip(irq, &bfin_generic_error_irqchip); 1024 set_irq_chip_and_handler(irq, &bfin_generic_error_irqchip,
1078 set_irq_handler(irq, handle_level_irq); 1025 handle_level_irq);
1079 }
1080#endif 1026#endif
1081 1027
1082 for (irq = GPIO_IRQ_BASE; irq < NR_IRQS; irq++) { 1028 /* if configured as edge, then will be changed to do_edge_IRQ */
1029 for (irq = GPIO_IRQ_BASE; irq < NR_IRQS; irq++)
1030 set_irq_chip_and_handler(irq, &bfin_gpio_irqchip,
1031 handle_level_irq);
1083 1032
1084 set_irq_chip(irq, &bfin_gpio_irqchip);
1085 /* if configured as edge, then will be changed to do_edge_IRQ */
1086 set_irq_handler(irq, handle_level_irq);
1087 }
1088 1033
1089 bfin_write_IMASK(0); 1034 bfin_write_IMASK(0);
1090 CSYNC(); 1035 CSYNC();
@@ -1106,6 +1051,16 @@ int __init init_arch_irq(void)
1106 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1051 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
1107 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1052 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
1108 1053
1054#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
1055 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
1056 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
1057# ifdef CONFIG_BF54x
1058 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
1059# endif
1060#else
1061 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
1062#endif
1063
1109 return 0; 1064 return 0;
1110} 1065}
1111 1066
@@ -1122,7 +1077,6 @@ void do_irq(int vec, struct pt_regs *fp)
1122#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 1077#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
1123 unsigned long sic_status[3]; 1078 unsigned long sic_status[3];
1124 1079
1125 SSYNC();
1126 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); 1080 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0();
1127 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); 1081 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1();
1128#ifdef CONFIG_BF54x 1082#ifdef CONFIG_BF54x
@@ -1138,7 +1092,7 @@ void do_irq(int vec, struct pt_regs *fp)
1138 } 1092 }
1139#else 1093#else
1140 unsigned long sic_status; 1094 unsigned long sic_status;
1141 SSYNC(); 1095
1142 sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); 1096 sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
1143 1097
1144 for (;; ivg++) { 1098 for (;; ivg++) {
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 1f516c55bde6..ec3141fefd20 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -181,7 +181,7 @@ void __init mem_init(void)
181 } 181 }
182} 182}
183 183
184static __init void free_init_pages(const char *what, unsigned long begin, unsigned long end) 184static void __init free_init_pages(const char *what, unsigned long begin, unsigned long end)
185{ 185{
186 unsigned long addr; 186 unsigned long addr;
187 /* next to check that the page we free is not a partial page */ 187 /* next to check that the page we free is not a partial page */
@@ -203,7 +203,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
203} 203}
204#endif 204#endif
205 205
206void __init free_initmem(void) 206void __init_refok free_initmem(void)
207{ 207{
208#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU 208#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
209 free_init_pages("unused kernel memory", 209 free_init_pages("unused kernel memory",
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index 13929771bee7..9eed1f68fcab 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -1151,7 +1151,7 @@ static void cell_handle_interrupt(struct pt_regs *regs,
1151 for (i = 0; i < num_counters; ++i) { 1151 for (i = 0; i < num_counters; ++i) {
1152 if ((interrupt_mask & CBE_PM_CTR_OVERFLOW_INTR(i)) 1152 if ((interrupt_mask & CBE_PM_CTR_OVERFLOW_INTR(i))
1153 && ctr[i].enabled) { 1153 && ctr[i].enabled) {
1154 oprofile_add_pc(pc, is_kernel, i); 1154 oprofile_add_ext_sample(pc, regs, i, is_kernel);
1155 cbe_write_ctr(cpu, i, reset_value[i]); 1155 cbe_write_ctr(cpu, i, reset_value[i]);
1156 } 1156 }
1157 } 1157 }
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index edab631a8dcb..20ea0e118f24 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -113,7 +113,7 @@
113 113
114/* IOMMU sizing */ 114/* IOMMU sizing */
115#define IO_SEGMENT_SHIFT 28 115#define IO_SEGMENT_SHIFT 28
116#define IO_PAGENO_BITS (IO_SEGMENT_SHIFT - IOMMU_PAGE_SHIFT) 116#define IO_PAGENO_BITS(shift) (IO_SEGMENT_SHIFT - (shift))
117 117
118/* The high bit needs to be set on every DMA address */ 118/* The high bit needs to be set on every DMA address */
119#define SPIDER_DMA_OFFSET 0x80000000ul 119#define SPIDER_DMA_OFFSET 0x80000000ul
@@ -123,7 +123,6 @@ struct iommu_window {
123 struct cbe_iommu *iommu; 123 struct cbe_iommu *iommu;
124 unsigned long offset; 124 unsigned long offset;
125 unsigned long size; 125 unsigned long size;
126 unsigned long pte_offset;
127 unsigned int ioid; 126 unsigned int ioid;
128 struct iommu_table table; 127 struct iommu_table table;
129}; 128};
@@ -200,7 +199,7 @@ static void tce_build_cell(struct iommu_table *tbl, long index, long npages,
200 (window->ioid & IOPTE_IOID_Mask); 199 (window->ioid & IOPTE_IOID_Mask);
201#endif 200#endif
202 201
203 io_pte = (unsigned long *)tbl->it_base + (index - window->pte_offset); 202 io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
204 203
205 for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE) 204 for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE)
206 io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask); 205 io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask);
@@ -232,7 +231,7 @@ static void tce_free_cell(struct iommu_table *tbl, long index, long npages)
232 | (window->ioid & IOPTE_IOID_Mask); 231 | (window->ioid & IOPTE_IOID_Mask);
233#endif 232#endif
234 233
235 io_pte = (unsigned long *)tbl->it_base + (index - window->pte_offset); 234 io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
236 235
237 for (i = 0; i < npages; i++) 236 for (i = 0; i < npages; i++)
238 io_pte[i] = pte; 237 io_pte[i] = pte;
@@ -307,76 +306,84 @@ static int cell_iommu_find_ioc(int nid, unsigned long *base)
307 return -ENODEV; 306 return -ENODEV;
308} 307}
309 308
310static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu, 309static void cell_iommu_setup_stab(struct cbe_iommu *iommu,
311 unsigned long dbase, unsigned long dsize, 310 unsigned long dbase, unsigned long dsize,
312 unsigned long fbase, unsigned long fsize) 311 unsigned long fbase, unsigned long fsize)
313{ 312{
314 struct page *page; 313 struct page *page;
315 int i; 314 unsigned long segments, stab_size;
316 unsigned long reg, segments, pages_per_segment, ptab_size, stab_size,
317 n_pte_pages, base;
318
319 base = dbase;
320 if (fsize != 0)
321 base = min(fbase, dbase);
322 315
323 segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT; 316 segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT;
324 pages_per_segment = 1ull << IO_PAGENO_BITS;
325 317
326 pr_debug("%s: iommu[%d]: segments: %lu, pages per segment: %lu\n", 318 pr_debug("%s: iommu[%d]: segments: %lu\n",
327 __FUNCTION__, iommu->nid, segments, pages_per_segment); 319 __FUNCTION__, iommu->nid, segments);
328 320
329 /* set up the segment table */ 321 /* set up the segment table */
330 stab_size = segments * sizeof(unsigned long); 322 stab_size = segments * sizeof(unsigned long);
331 page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(stab_size)); 323 page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(stab_size));
332 BUG_ON(!page); 324 BUG_ON(!page);
333 iommu->stab = page_address(page); 325 iommu->stab = page_address(page);
334 clear_page(iommu->stab); 326 memset(iommu->stab, 0, stab_size);
327}
328
329static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
330 unsigned long base, unsigned long size, unsigned long gap_base,
331 unsigned long gap_size, unsigned long page_shift)
332{
333 struct page *page;
334 int i;
335 unsigned long reg, segments, pages_per_segment, ptab_size,
336 n_pte_pages, start_seg, *ptab;
337
338 start_seg = base >> IO_SEGMENT_SHIFT;
339 segments = size >> IO_SEGMENT_SHIFT;
340 pages_per_segment = 1ull << IO_PAGENO_BITS(page_shift);
341 /* PTEs for each segment must start on a 4K bounday */
342 pages_per_segment = max(pages_per_segment,
343 (1 << 12) / sizeof(unsigned long));
335 344
336 /* ... and the page tables. Since these are contiguous, we can treat
337 * the page tables as one array of ptes, like pSeries does.
338 */
339 ptab_size = segments * pages_per_segment * sizeof(unsigned long); 345 ptab_size = segments * pages_per_segment * sizeof(unsigned long);
340 pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __FUNCTION__, 346 pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __FUNCTION__,
341 iommu->nid, ptab_size, get_order(ptab_size)); 347 iommu->nid, ptab_size, get_order(ptab_size));
342 page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(ptab_size)); 348 page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(ptab_size));
343 BUG_ON(!page); 349 BUG_ON(!page);
344 350
345 iommu->ptab = page_address(page); 351 ptab = page_address(page);
346 memset(iommu->ptab, 0, ptab_size); 352 memset(ptab, 0, ptab_size);
347 353
348 /* allocate a bogus page for the end of each mapping */ 354 /* number of 4K pages needed for a page table */
349 page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0); 355 n_pte_pages = (pages_per_segment * sizeof(unsigned long)) >> 12;
350 BUG_ON(!page);
351 iommu->pad_page = page_address(page);
352 clear_page(iommu->pad_page);
353
354 /* number of pages needed for a page table */
355 n_pte_pages = (pages_per_segment *
356 sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT;
357 356
358 pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n", 357 pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n",
359 __FUNCTION__, iommu->nid, iommu->stab, iommu->ptab, 358 __FUNCTION__, iommu->nid, iommu->stab, ptab,
360 n_pte_pages); 359 n_pte_pages);
361 360
362 /* initialise the STEs */ 361 /* initialise the STEs */
363 reg = IOSTE_V | ((n_pte_pages - 1) << 5); 362 reg = IOSTE_V | ((n_pte_pages - 1) << 5);
364 363
365 if (IOMMU_PAGE_SIZE == 0x1000) 364 switch (page_shift) {
366 reg |= IOSTE_PS_4K; 365 case 12: reg |= IOSTE_PS_4K; break;
367 else if (IOMMU_PAGE_SIZE == 0x10000) 366 case 16: reg |= IOSTE_PS_64K; break;
368 reg |= IOSTE_PS_64K; 367 case 20: reg |= IOSTE_PS_1M; break;
369 else { 368 case 24: reg |= IOSTE_PS_16M; break;
370 extern void __unknown_page_size_error(void); 369 default: BUG();
371 __unknown_page_size_error();
372 } 370 }
373 371
372 gap_base = gap_base >> IO_SEGMENT_SHIFT;
373 gap_size = gap_size >> IO_SEGMENT_SHIFT;
374
374 pr_debug("Setting up IOMMU stab:\n"); 375 pr_debug("Setting up IOMMU stab:\n");
375 for (i = base >> IO_SEGMENT_SHIFT; i < segments; i++) { 376 for (i = start_seg; i < (start_seg + segments); i++) {
376 iommu->stab[i] = reg | 377 if (i >= gap_base && i < (gap_base + gap_size)) {
377 (__pa(iommu->ptab) + n_pte_pages * IOMMU_PAGE_SIZE * i); 378 pr_debug("\toverlap at %d, skipping\n", i);
379 continue;
380 }
381 iommu->stab[i] = reg | (__pa(ptab) + (n_pte_pages << 12) *
382 (i - start_seg));
378 pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]); 383 pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]);
379 } 384 }
385
386 return ptab;
380} 387}
381 388
382static void cell_iommu_enable_hardware(struct cbe_iommu *iommu) 389static void cell_iommu_enable_hardware(struct cbe_iommu *iommu)
@@ -423,7 +430,9 @@ static void cell_iommu_enable_hardware(struct cbe_iommu *iommu)
423static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, 430static void cell_iommu_setup_hardware(struct cbe_iommu *iommu,
424 unsigned long base, unsigned long size) 431 unsigned long base, unsigned long size)
425{ 432{
426 cell_iommu_setup_page_tables(iommu, base, size, 0, 0); 433 cell_iommu_setup_stab(iommu, base, size, 0, 0);
434 iommu->ptab = cell_iommu_alloc_ptab(iommu, base, size, 0, 0,
435 IOMMU_PAGE_SHIFT);
427 cell_iommu_enable_hardware(iommu); 436 cell_iommu_enable_hardware(iommu);
428} 437}
429 438
@@ -464,6 +473,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
464 unsigned long pte_offset) 473 unsigned long pte_offset)
465{ 474{
466 struct iommu_window *window; 475 struct iommu_window *window;
476 struct page *page;
467 u32 ioid; 477 u32 ioid;
468 478
469 ioid = cell_iommu_get_ioid(np); 479 ioid = cell_iommu_get_ioid(np);
@@ -475,13 +485,11 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
475 window->size = size; 485 window->size = size;
476 window->ioid = ioid; 486 window->ioid = ioid;
477 window->iommu = iommu; 487 window->iommu = iommu;
478 window->pte_offset = pte_offset;
479 488
480 window->table.it_blocksize = 16; 489 window->table.it_blocksize = 16;
481 window->table.it_base = (unsigned long)iommu->ptab; 490 window->table.it_base = (unsigned long)iommu->ptab;
482 window->table.it_index = iommu->nid; 491 window->table.it_index = iommu->nid;
483 window->table.it_offset = (offset >> IOMMU_PAGE_SHIFT) + 492 window->table.it_offset = (offset >> IOMMU_PAGE_SHIFT) + pte_offset;
484 window->pte_offset;
485 window->table.it_size = size >> IOMMU_PAGE_SHIFT; 493 window->table.it_size = size >> IOMMU_PAGE_SHIFT;
486 494
487 iommu_init_table(&window->table, iommu->nid); 495 iommu_init_table(&window->table, iommu->nid);
@@ -504,6 +512,11 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
504 * This code also assumes that we have a window that starts at 0, 512 * This code also assumes that we have a window that starts at 0,
505 * which is the case on all spider based blades. 513 * which is the case on all spider based blades.
506 */ 514 */
515 page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0);
516 BUG_ON(!page);
517 iommu->pad_page = page_address(page);
518 clear_page(iommu->pad_page);
519
507 __set_bit(0, window->table.it_map); 520 __set_bit(0, window->table.it_map);
508 tce_build_cell(&window->table, window->table.it_offset, 1, 521 tce_build_cell(&window->table, window->table.it_offset, 1,
509 (unsigned long)iommu->pad_page, DMA_TO_DEVICE); 522 (unsigned long)iommu->pad_page, DMA_TO_DEVICE);
@@ -549,7 +562,7 @@ static void cell_dma_dev_setup_iommu(struct device *dev)
549 archdata->dma_data = &window->table; 562 archdata->dma_data = &window->table;
550} 563}
551 564
552static void cell_dma_dev_setup_static(struct device *dev); 565static void cell_dma_dev_setup_fixed(struct device *dev);
553 566
554static void cell_dma_dev_setup(struct device *dev) 567static void cell_dma_dev_setup(struct device *dev)
555{ 568{
@@ -557,7 +570,7 @@ static void cell_dma_dev_setup(struct device *dev)
557 570
558 /* Order is important here, these are not mutually exclusive */ 571 /* Order is important here, these are not mutually exclusive */
559 if (get_dma_ops(dev) == &dma_iommu_fixed_ops) 572 if (get_dma_ops(dev) == &dma_iommu_fixed_ops)
560 cell_dma_dev_setup_static(dev); 573 cell_dma_dev_setup_fixed(dev);
561 else if (get_pci_dma_ops() == &dma_iommu_ops) 574 else if (get_pci_dma_ops() == &dma_iommu_ops)
562 cell_dma_dev_setup_iommu(dev); 575 cell_dma_dev_setup_iommu(dev);
563 else if (get_pci_dma_ops() == &dma_direct_ops) 576 else if (get_pci_dma_ops() == &dma_direct_ops)
@@ -858,7 +871,7 @@ static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask)
858 return 0; 871 return 0;
859} 872}
860 873
861static void cell_dma_dev_setup_static(struct device *dev) 874static void cell_dma_dev_setup_fixed(struct device *dev)
862{ 875{
863 struct dev_archdata *archdata = &dev->archdata; 876 struct dev_archdata *archdata = &dev->archdata;
864 u64 addr; 877 u64 addr;
@@ -869,35 +882,45 @@ static void cell_dma_dev_setup_static(struct device *dev)
869 dev_dbg(dev, "iommu: fixed addr = %lx\n", addr); 882 dev_dbg(dev, "iommu: fixed addr = %lx\n", addr);
870} 883}
871 884
885static void insert_16M_pte(unsigned long addr, unsigned long *ptab,
886 unsigned long base_pte)
887{
888 unsigned long segment, offset;
889
890 segment = addr >> IO_SEGMENT_SHIFT;
891 offset = (addr >> 24) - (segment << IO_PAGENO_BITS(24));
892 ptab = ptab + (segment * (1 << 12) / sizeof(unsigned long));
893
894 pr_debug("iommu: addr %lx ptab %p segment %lx offset %lx\n",
895 addr, ptab, segment, offset);
896
897 ptab[offset] = base_pte | (__pa(addr) & IOPTE_RPN_Mask);
898}
899
872static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu, 900static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu,
873 struct device_node *np, unsigned long dbase, unsigned long dsize, 901 struct device_node *np, unsigned long dbase, unsigned long dsize,
874 unsigned long fbase, unsigned long fsize) 902 unsigned long fbase, unsigned long fsize)
875{ 903{
876 unsigned long base_pte, uaddr, *io_pte; 904 unsigned long base_pte, uaddr, ioaddr, *ptab;
877 int i;
878 905
879 dma_iommu_fixed_base = fbase; 906 ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize, 24);
880 907
881 /* convert from bytes into page table indices */ 908 dma_iommu_fixed_base = fbase;
882 dbase = dbase >> IOMMU_PAGE_SHIFT;
883 dsize = dsize >> IOMMU_PAGE_SHIFT;
884 fbase = fbase >> IOMMU_PAGE_SHIFT;
885 fsize = fsize >> IOMMU_PAGE_SHIFT;
886 909
887 pr_debug("iommu: mapping 0x%lx pages from 0x%lx\n", fsize, fbase); 910 pr_debug("iommu: mapping 0x%lx pages from 0x%lx\n", fsize, fbase);
888 911
889 io_pte = iommu->ptab;
890 base_pte = IOPTE_PP_W | IOPTE_PP_R | IOPTE_M | IOPTE_SO_RW 912 base_pte = IOPTE_PP_W | IOPTE_PP_R | IOPTE_M | IOPTE_SO_RW
891 | (cell_iommu_get_ioid(np) & IOPTE_IOID_Mask); 913 | (cell_iommu_get_ioid(np) & IOPTE_IOID_Mask);
892 914
893 uaddr = 0; 915 for (uaddr = 0; uaddr < fsize; uaddr += (1 << 24)) {
894 for (i = fbase; i < fbase + fsize; i++, uaddr += IOMMU_PAGE_SIZE) {
895 /* Don't touch the dynamic region */ 916 /* Don't touch the dynamic region */
896 if (i >= dbase && i < (dbase + dsize)) { 917 ioaddr = uaddr + fbase;
897 pr_debug("iommu: static/dynamic overlap, skipping\n"); 918 if (ioaddr >= dbase && ioaddr < (dbase + dsize)) {
919 pr_debug("iommu: fixed/dynamic overlap, skipping\n");
898 continue; 920 continue;
899 } 921 }
900 io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask); 922
923 insert_16M_pte(uaddr, ptab, base_pte);
901 } 924 }
902 925
903 mb(); 926 mb();
@@ -995,7 +1018,9 @@ static int __init cell_iommu_fixed_mapping_init(void)
995 "fixed window 0x%lx-0x%lx\n", iommu->nid, dbase, 1018 "fixed window 0x%lx-0x%lx\n", iommu->nid, dbase,
996 dbase + dsize, fbase, fbase + fsize); 1019 dbase + dsize, fbase, fbase + fsize);
997 1020
998 cell_iommu_setup_page_tables(iommu, dbase, dsize, fbase, fsize); 1021 cell_iommu_setup_stab(iommu, dbase, dsize, fbase, fsize);
1022 iommu->ptab = cell_iommu_alloc_ptab(iommu, dbase, dsize, 0, 0,
1023 IOMMU_PAGE_SHIFT);
999 cell_iommu_setup_fixed_ptab(iommu, np, dbase, dsize, 1024 cell_iommu_setup_fixed_ptab(iommu, np, dbase, dsize,
1000 fbase, fsize); 1025 fbase, fsize);
1001 cell_iommu_enable_hardware(iommu); 1026 cell_iommu_enable_hardware(iommu);
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index a7f609b3b876..dda34650cb07 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -149,6 +149,11 @@ static void __init cell_init_irq(void)
149 mpic_init_IRQ(); 149 mpic_init_IRQ();
150} 150}
151 151
152static void __init cell_set_dabrx(void)
153{
154 mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER);
155}
156
152static void __init cell_setup_arch(void) 157static void __init cell_setup_arch(void)
153{ 158{
154#ifdef CONFIG_SPU_BASE 159#ifdef CONFIG_SPU_BASE
@@ -158,6 +163,8 @@ static void __init cell_setup_arch(void)
158 163
159 cbe_regs_init(); 164 cbe_regs_init();
160 165
166 cell_set_dabrx();
167
161#ifdef CONFIG_CBE_RAS 168#ifdef CONFIG_CBE_RAS
162 cbe_ras_init(); 169 cbe_ras_init();
163#endif 170#endif
diff --git a/arch/powerpc/platforms/celleb/beat.h b/arch/powerpc/platforms/celleb/beat.h
index b2e292df13ca..ac82ac35b991 100644
--- a/arch/powerpc/platforms/celleb/beat.h
+++ b/arch/powerpc/platforms/celleb/beat.h
@@ -21,9 +21,6 @@
21#ifndef _CELLEB_BEAT_H 21#ifndef _CELLEB_BEAT_H
22#define _CELLEB_BEAT_H 22#define _CELLEB_BEAT_H
23 23
24#define DABRX_KERNEL (1UL<<1)
25#define DABRX_USER (1UL<<0)
26
27int64_t beat_get_term_char(uint64_t,uint64_t*,uint64_t*,uint64_t*); 24int64_t beat_get_term_char(uint64_t,uint64_t*,uint64_t*,uint64_t*);
28int64_t beat_put_term_char(uint64_t,uint64_t,uint64_t,uint64_t); 25int64_t beat_put_term_char(uint64_t,uint64_t,uint64_t,uint64_t);
29int64_t beat_repository_encode(int, const char *, uint64_t[4]); 26int64_t beat_repository_encode(int, const char *, uint64_t[4]);
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b3400b5ad5c6..783cfbbf87ca 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -330,6 +330,7 @@ config CPU_SUBTYPE_SH5_101
330 330
331config CPU_SUBTYPE_SH5_103 331config CPU_SUBTYPE_SH5_103
332 bool "Support SH5-103 processor" 332 bool "Support SH5-103 processor"
333 select CPU_SH5
333 334
334endchoice 335endchoice
335 336
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 5c3359756a92..71ff3d6f26e2 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -90,7 +90,7 @@ static irqreturn_t dma_tei(int irq, void *dev_id)
90 90
91static int sh_dmac_request_dma(struct dma_channel *chan) 91static int sh_dmac_request_dma(struct dma_channel *chan)
92{ 92{
93 if (unlikely(!chan->flags & DMA_TEI_CAPABLE)) 93 if (unlikely(!(chan->flags & DMA_TEI_CAPABLE)))
94 return 0; 94 return 0;
95 95
96 return request_irq(get_dmte_irq(chan->chan), dma_tei, 96 return request_irq(get_dmte_irq(chan->chan), dma_tei,
diff --git a/arch/sh/drivers/heartbeat.c b/arch/sh/drivers/heartbeat.c
index b76a14f12ce2..ab77b0e0fa0e 100644
--- a/arch/sh/drivers/heartbeat.c
+++ b/arch/sh/drivers/heartbeat.c
@@ -93,7 +93,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
93 } 93 }
94 94
95 hd->base = ioremap_nocache(res->start, res->end - res->start + 1); 95 hd->base = ioremap_nocache(res->start, res->end - res->start + 1);
96 if (!unlikely(hd->base)) { 96 if (unlikely(!hd->base)) {
97 dev_err(&pdev->dev, "ioremap failed\n"); 97 dev_err(&pdev->dev, "ioremap failed\n");
98 98
99 if (!pdev->dev.platform_data) 99 if (!pdev->dev.platform_data)
diff --git a/arch/sh/drivers/pci/ops-dreamcast.c b/arch/sh/drivers/pci/ops-dreamcast.c
index 0dac87b19624..e1284fc69361 100644
--- a/arch/sh/drivers/pci/ops-dreamcast.c
+++ b/arch/sh/drivers/pci/ops-dreamcast.c
@@ -83,9 +83,9 @@ static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int
83 return PCIBIOS_DEVICE_NOT_FOUND; 83 return PCIBIOS_DEVICE_NOT_FOUND;
84 84
85 switch (size) { 85 switch (size) {
86 case 1: *val = ctrl_inb(GAPSPCI_BBA_CONFIG+where); break; 86 case 1: *val = inb(GAPSPCI_BBA_CONFIG+where); break;
87 case 2: *val = ctrl_inw(GAPSPCI_BBA_CONFIG+where); break; 87 case 2: *val = inw(GAPSPCI_BBA_CONFIG+where); break;
88 case 4: *val = ctrl_inl(GAPSPCI_BBA_CONFIG+where); break; 88 case 4: *val = inl(GAPSPCI_BBA_CONFIG+where); break;
89 } 89 }
90 90
91 return PCIBIOS_SUCCESSFUL; 91 return PCIBIOS_SUCCESSFUL;
@@ -97,9 +97,9 @@ static int gapspci_write(struct pci_bus *bus, unsigned int devfn, int where, int
97 return PCIBIOS_DEVICE_NOT_FOUND; 97 return PCIBIOS_DEVICE_NOT_FOUND;
98 98
99 switch (size) { 99 switch (size) {
100 case 1: ctrl_outb(( u8)val, GAPSPCI_BBA_CONFIG+where); break; 100 case 1: outb(( u8)val, GAPSPCI_BBA_CONFIG+where); break;
101 case 2: ctrl_outw((u16)val, GAPSPCI_BBA_CONFIG+where); break; 101 case 2: outw((u16)val, GAPSPCI_BBA_CONFIG+where); break;
102 case 4: ctrl_outl((u32)val, GAPSPCI_BBA_CONFIG+where); break; 102 case 4: outl((u32)val, GAPSPCI_BBA_CONFIG+where); break;
103 } 103 }
104 104
105 return PCIBIOS_SUCCESSFUL; 105 return PCIBIOS_SUCCESSFUL;
@@ -127,36 +127,36 @@ int __init gapspci_init(void)
127 */ 127 */
128 128
129 for (i=0; i<16; i++) 129 for (i=0; i<16; i++)
130 idbuf[i] = ctrl_inb(GAPSPCI_REGS+i); 130 idbuf[i] = inb(GAPSPCI_REGS+i);
131 131
132 if (strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16)) 132 if (strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16))
133 return -ENODEV; 133 return -ENODEV;
134 134
135 ctrl_outl(0x5a14a501, GAPSPCI_REGS+0x18); 135 outl(0x5a14a501, GAPSPCI_REGS+0x18);
136 136
137 for (i=0; i<1000000; i++) 137 for (i=0; i<1000000; i++)
138 ; 138 ;
139 139
140 if (ctrl_inl(GAPSPCI_REGS+0x18) != 1) 140 if (inl(GAPSPCI_REGS+0x18) != 1)
141 return -EINVAL; 141 return -EINVAL;
142 142
143 ctrl_outl(0x01000000, GAPSPCI_REGS+0x20); 143 outl(0x01000000, GAPSPCI_REGS+0x20);
144 ctrl_outl(0x01000000, GAPSPCI_REGS+0x24); 144 outl(0x01000000, GAPSPCI_REGS+0x24);
145 145
146 ctrl_outl(GAPSPCI_DMA_BASE, GAPSPCI_REGS+0x28); 146 outl(GAPSPCI_DMA_BASE, GAPSPCI_REGS+0x28);
147 ctrl_outl(GAPSPCI_DMA_BASE+GAPSPCI_DMA_SIZE, GAPSPCI_REGS+0x2c); 147 outl(GAPSPCI_DMA_BASE+GAPSPCI_DMA_SIZE, GAPSPCI_REGS+0x2c);
148 148
149 ctrl_outl(1, GAPSPCI_REGS+0x14); 149 outl(1, GAPSPCI_REGS+0x14);
150 ctrl_outl(1, GAPSPCI_REGS+0x34); 150 outl(1, GAPSPCI_REGS+0x34);
151 151
152 /* Setting Broadband Adapter */ 152 /* Setting Broadband Adapter */
153 ctrl_outw(0xf900, GAPSPCI_BBA_CONFIG+0x06); 153 outw(0xf900, GAPSPCI_BBA_CONFIG+0x06);
154 ctrl_outl(0x00000000, GAPSPCI_BBA_CONFIG+0x30); 154 outl(0x00000000, GAPSPCI_BBA_CONFIG+0x30);
155 ctrl_outb(0x00, GAPSPCI_BBA_CONFIG+0x3c); 155 outb(0x00, GAPSPCI_BBA_CONFIG+0x3c);
156 ctrl_outb(0xf0, GAPSPCI_BBA_CONFIG+0x0d); 156 outb(0xf0, GAPSPCI_BBA_CONFIG+0x0d);
157 ctrl_outw(0x0006, GAPSPCI_BBA_CONFIG+0x04); 157 outw(0x0006, GAPSPCI_BBA_CONFIG+0x04);
158 ctrl_outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10); 158 outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10);
159 ctrl_outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14); 159 outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14);
160 160
161 return 0; 161 return 0;
162} 162}
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
index b230eb278cef..cc530f4d84d6 100644
--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15enum { 15enum {
16 UNUSED = 0, 16 UNUSED = 0,
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
index 3feb95a4fcbc..fb781329848a 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
@@ -21,8 +21,8 @@
21#include <asm/freq.h> 21#include <asm/freq.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24const static int pll1rate[]={8,12,16,0}; 24static const int pll1rate[]={8,12,16,0};
25const static int pfc_divisors[]={1,2,3,4,6,8,12}; 25static const int pfc_divisors[]={1,2,3,4,6,8,12};
26#define ifc_divisors pfc_divisors 26#define ifc_divisors pfc_divisors
27 27
28#if (CONFIG_SH_CLK_MD == 0) 28#if (CONFIG_SH_CLK_MD == 0)
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
index db6ef5cecde1..e98dc4450352 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15enum { 15enum {
16 UNUSED = 0, 16 UNUSED = 0,
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
index a564425b905f..e6d4ec445dd8 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15enum { 15enum {
16 UNUSED = 0, 16 UNUSED = 0,
diff --git a/arch/sh/kernel/cpu/sh3/probe.c b/arch/sh/kernel/cpu/sh3/probe.c
index fcc80bb7bee7..10f2a760c5ee 100644
--- a/arch/sh/kernel/cpu/sh3/probe.c
+++ b/arch/sh/kernel/cpu/sh3/probe.c
@@ -94,9 +94,9 @@ int __uses_jump_to_uncached detect_cpu_and_cache_system(void)
94 boot_cpu_data.dcache.way_incr = (1 << 13); 94 boot_cpu_data.dcache.way_incr = (1 << 13);
95 boot_cpu_data.dcache.entry_mask = 0x1ff0; 95 boot_cpu_data.dcache.entry_mask = 0x1ff0;
96 boot_cpu_data.dcache.sets = 512; 96 boot_cpu_data.dcache.sets = 512;
97 ctrl_outl(CCR_CACHE_32KB, CCR3); 97 ctrl_outl(CCR_CACHE_32KB, CCR3_REG);
98#else 98#else
99 ctrl_outl(CCR_CACHE_16KB, CCR3); 99 ctrl_outl(CCR_CACHE_16KB, CCR3_REG);
100#endif 100#endif
101#endif 101#endif
102 } 102 }
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
index dd0a20a685f7..f581534cb732 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <asm/sci.h> 15#include <linux/serial_sci.h>
16#include <asm/rtc.h> 16#include <asm/rtc.h>
17 17
18enum { 18enum {
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
index 969804bb523b..d3733b13ea52 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -16,7 +16,7 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/serial.h> 18#include <linux/serial.h>
19#include <asm/sci.h> 19#include <linux/serial_sci.h>
20 20
21enum { 21enum {
22 UNUSED = 0, 22 UNUSED = 0,
@@ -123,15 +123,15 @@ static struct resource rtc_resources[] = {
123 .flags = IORESOURCE_IO, 123 .flags = IORESOURCE_IO,
124 }, 124 },
125 [1] = { 125 [1] = {
126 .start = 20, 126 .start = 21,
127 .flags = IORESOURCE_IRQ, 127 .flags = IORESOURCE_IRQ,
128 }, 128 },
129 [2] = { 129 [2] = {
130 .start = 21, 130 .start = 22,
131 .flags = IORESOURCE_IRQ, 131 .flags = IORESOURCE_IRQ,
132 }, 132 },
133 [3] = { 133 [3] = {
134 .start = 22, 134 .start = 20,
135 .flags = IORESOURCE_IRQ, 135 .flags = IORESOURCE_IRQ,
136 }, 136 },
137}; 137};
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
index 0cc0e2bf135d..7406c9ad9259 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <asm/sci.h> 15#include <linux/serial_sci.h>
16#include <asm/rtc.h> 16#include <asm/rtc.h>
17 17
18enum { 18enum {
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
index 3855ea4c21c8..8028082527c5 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -16,7 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/serial.h> 17#include <linux/serial.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <asm/sci.h> 19#include <linux/serial_sci.h>
20#include <asm/rtc.h> 20#include <asm/rtc.h>
21 21
22#define INTC_ICR1 0xA4140010UL 22#define INTC_ICR1 0xA4140010UL
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
index dab193293f20..7371abf64f80 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15static struct plat_sci_port sci_platform_data[] = { 15static struct plat_sci_port sci_platform_data[] = {
16 { 16 {
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index ae3603aca615..ec884039b914 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/serial.h> 13#include <linux/serial.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/sci.h> 15#include <linux/serial_sci.h>
16 16
17static struct resource rtc_resources[] = { 17static struct resource rtc_resources[] = {
18 [0] = { 18 [0] = {
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
index 85f81579b97e..254c5c55ab91 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15enum { 15enum {
16 UNUSED = 0, 16 UNUSED = 0,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
index c0a3f079dfdc..6d4f50cd4aaf 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15static struct plat_sci_port sci_platform_data[] = { 15static struct plat_sci_port sci_platform_data[] = {
16 { 16 {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 967e8b69a2f8..f26b5cdad0d1 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -12,7 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <asm/sci.h> 15#include <linux/serial_sci.h>
16 16
17static struct plat_sci_port sci_platform_data[] = { 17static struct plat_sci_port sci_platform_data[] = {
18 { 18 {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 73c778d40d13..b98b4bc93ec9 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -10,9 +10,9 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h>
13#include <linux/mm.h> 14#include <linux/mm.h>
14#include <asm/mmzone.h> 15#include <asm/mmzone.h>
15#include <asm/sci.h>
16 16
17static struct resource usbf_resources[] = { 17static struct resource usbf_resources[] = {
18 [0] = { 18 [0] = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index eabd5386812d..07c988dc9de6 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/serial.h> 13#include <linux/serial.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/sci.h> 15#include <linux/serial_sci.h>
16 16
17static struct resource rtc_resources[] = { 17static struct resource rtc_resources[] = {
18 [0] = { 18 [0] = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
index 32f4f59a837b..b9cec48b1808 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
@@ -10,7 +10,7 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <asm/sci.h> 13#include <linux/serial_sci.h>
14 14
15static struct plat_sci_port sci_platform_data[] = { 15static struct plat_sci_port sci_platform_data[] = {
16 { 16 {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index 293004b526ff..18dbbe23fea1 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -11,7 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <asm/sci.h> 14#include <linux/serial_sci.h>
15 15
16static struct resource rtc_resources[] = { 16static struct resource rtc_resources[] = {
17 [0] = { 17 [0] = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index 74b60e96cdf4..621e7329ec63 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -10,10 +10,10 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h>
13#include <linux/io.h> 14#include <linux/io.h>
14#include <linux/mm.h> 15#include <linux/mm.h>
15#include <asm/mmzone.h> 16#include <asm/mmzone.h>
16#include <asm/sci.h>
17 17
18static struct plat_sci_port sci_platform_data[] = { 18static struct plat_sci_port sci_platform_data[] = {
19 { 19 {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
index 4dc958b6b314..bd35f32534b9 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
@@ -10,9 +10,9 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h>
13#include <linux/io.h> 14#include <linux/io.h>
14#include <asm/mmzone.h> 15#include <asm/mmzone.h>
15#include <asm/sci.h>
16 16
17static struct plat_sci_port sci_platform_data[] = { 17static struct plat_sci_port sci_platform_data[] = {
18 { 18 {
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c
index 313d1620ae8e..59e9344e7a0d 100644
--- a/arch/sparc/kernel/led.c
+++ b/arch/sparc/kernel/led.c
@@ -3,6 +3,9 @@
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <linux/string.h> 5#include <linux/string.h>
6#include <linux/jiffies.h>
7#include <linux/timer.h>
8#include <linux/uaccess.h>
6 9
7#include <asm/auxio.h> 10#include <asm/auxio.h>
8 11
diff --git a/arch/sparc64/kernel/ds.c b/arch/sparc64/kernel/ds.c
index eeb5a2fc788d..bd76482077be 100644
--- a/arch/sparc64/kernel/ds.c
+++ b/arch/sparc64/kernel/ds.c
@@ -525,10 +525,10 @@ static void dr_cpu_mark(struct ds_data *resp, int cpu, int ncpus,
525 } 525 }
526} 526}
527 527
528static int dr_cpu_configure(struct ds_info *dp, 528static int __cpuinit dr_cpu_configure(struct ds_info *dp,
529 struct ds_cap_state *cp, 529 struct ds_cap_state *cp,
530 u64 req_num, 530 u64 req_num,
531 cpumask_t *mask) 531 cpumask_t *mask)
532{ 532{
533 struct ds_data *resp; 533 struct ds_data *resp;
534 int resp_len, ncpus, cpu; 534 int resp_len, ncpus, cpu;
@@ -623,9 +623,9 @@ static int dr_cpu_unconfigure(struct ds_info *dp,
623 return 0; 623 return 0;
624} 624}
625 625
626static void dr_cpu_data(struct ds_info *dp, 626static void __cpuinit dr_cpu_data(struct ds_info *dp,
627 struct ds_cap_state *cp, 627 struct ds_cap_state *cp,
628 void *buf, int len) 628 void *buf, int len)
629{ 629{
630 struct ds_data *data = buf; 630 struct ds_data *data = buf;
631 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1); 631 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1);
diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc64/kernel/hvtramp.S
index b692e044a463..0236c43772fa 100644
--- a/arch/sparc64/kernel/hvtramp.S
+++ b/arch/sparc64/kernel/hvtramp.S
@@ -3,6 +3,8 @@
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#include <linux/init.h>
7
6#include <asm/thread_info.h> 8#include <asm/thread_info.h>
7#include <asm/hypervisor.h> 9#include <asm/hypervisor.h>
8#include <asm/scratchpad.h> 10#include <asm/scratchpad.h>
@@ -13,7 +15,7 @@
13#include <asm/head.h> 15#include <asm/head.h>
14#include <asm/asi.h> 16#include <asm/asi.h>
15 17
16 .text 18 __CPUINIT
17 .align 8 19 .align 8
18 .globl hv_cpu_startup, hv_cpu_startup_end 20 .globl hv_cpu_startup, hv_cpu_startup_end
19 21
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index 0e347ff812a3..fbaab3497bfd 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -134,7 +134,8 @@ unsigned long iommu_range_alloc(struct device *dev,
134 else 134 else
135 boundary_size = ALIGN(1UL << 32, 1 << IO_PAGE_SHIFT); 135 boundary_size = ALIGN(1UL << 32, 1 << IO_PAGE_SHIFT);
136 136
137 n = iommu_area_alloc(arena->map, limit, start, npages, 0, 137 n = iommu_area_alloc(arena->map, limit, start, npages,
138 iommu->page_table_map_base >> IO_PAGE_SHIFT,
138 boundary_size >> IO_PAGE_SHIFT, 0); 139 boundary_size >> IO_PAGE_SHIFT, 0);
139 if (n == -1) { 140 if (n == -1) {
140 if (likely(pass < 1)) { 141 if (likely(pass < 1)) {
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index 34fc3ddd5002..f43b5d755354 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -465,8 +465,6 @@ void __kprobes jprobe_return(void)
465 465
466extern void jprobe_return_trap_instruction(void); 466extern void jprobe_return_trap_instruction(void);
467 467
468extern void __show_regs(struct pt_regs * regs);
469
470int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 468int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
471{ 469{
472 u32 *addr = (u32 *) regs->tpc; 470 u32 *addr = (u32 *) regs->tpc;
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 856659bb1311..910083589569 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -758,7 +758,7 @@ static void __devinit get_mondo_data(struct mdesc_handle *hp, u64 mp,
758 get_one_mondo_bits(val, &tb->nonresum_qmask, 2); 758 get_one_mondo_bits(val, &tb->nonresum_qmask, 2);
759} 759}
760 760
761void __devinit mdesc_fill_in_cpu_data(cpumask_t mask) 761void __cpuinit mdesc_fill_in_cpu_data(cpumask_t mask)
762{ 762{
763 struct mdesc_handle *hp = mdesc_grab(); 763 struct mdesc_handle *hp = mdesc_grab();
764 u64 mp; 764 u64 mp;
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 850cdffdd69c..eae8ca2a6ba5 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -20,6 +20,7 @@
20#include <asm/of_device.h> 20#include <asm/of_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/sstate.h> 22#include <asm/sstate.h>
23#include <asm/reboot.h>
23 24
24#include <linux/unistd.h> 25#include <linux/unistd.h>
25 26
@@ -39,8 +40,6 @@ static irqreturn_t power_handler(int irq, void *dev_id)
39 return IRQ_HANDLED; 40 return IRQ_HANDLED;
40} 41}
41 42
42extern void machine_halt(void);
43extern void machine_alt_power_off(void);
44static void (*poweroff_method)(void) = machine_alt_power_off; 43static void (*poweroff_method)(void) = machine_alt_power_off;
45 44
46void machine_power_off(void) 45void machine_power_off(void)
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 6eceac51ae62..2aafce7dfc0e 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -30,6 +30,7 @@
30#include <linux/tick.h> 30#include <linux/tick.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/cpu.h> 32#include <linux/cpu.h>
33#include <linux/elfcore.h>
33 34
34#include <asm/oplib.h> 35#include <asm/oplib.h>
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
@@ -47,6 +48,8 @@
47#include <asm/unistd.h> 48#include <asm/unistd.h>
48#include <asm/hypervisor.h> 49#include <asm/hypervisor.h>
49#include <asm/sstate.h> 50#include <asm/sstate.h>
51#include <asm/reboot.h>
52#include <asm/syscalls.h>
50 53
51/* #define VERBOSE_SHOWREGS */ 54/* #define VERBOSE_SHOWREGS */
52 55
@@ -211,62 +214,6 @@ static void show_regwindow(struct pt_regs *regs)
211 print_symbol("I7: <%s>\n", rwk->ins[7]); 214 print_symbol("I7: <%s>\n", rwk->ins[7]);
212} 215}
213 216
214void show_stackframe(struct sparc_stackf *sf)
215{
216 unsigned long size;
217 unsigned long *stk;
218 int i;
219
220 printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n"
221 "l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
222 sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3],
223 sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]);
224 printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n"
225 "i4: %016lx i5: %016lx fp: %016lx ret_pc: %016lx\n",
226 sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3],
227 sf->ins[4], sf->ins[5], (unsigned long)sf->fp, sf->callers_pc);
228 printk("sp: %016lx x0: %016lx x1: %016lx x2: %016lx\n"
229 "x3: %016lx x4: %016lx x5: %016lx xx: %016lx\n",
230 (unsigned long)sf->structptr, sf->xargs[0], sf->xargs[1],
231 sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5],
232 sf->xxargs[0]);
233 size = ((unsigned long)sf->fp) - ((unsigned long)sf);
234 size -= STACKFRAME_SZ;
235 stk = (unsigned long *)((unsigned long)sf + STACKFRAME_SZ);
236 i = 0;
237 do {
238 printk("s%d: %016lx\n", i++, *stk++);
239 } while ((size -= sizeof(unsigned long)));
240}
241
242void show_stackframe32(struct sparc_stackf32 *sf)
243{
244 unsigned long size;
245 unsigned *stk;
246 int i;
247
248 printk("l0: %08x l1: %08x l2: %08x l3: %08x\n",
249 sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3]);
250 printk("l4: %08x l5: %08x l6: %08x l7: %08x\n",
251 sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]);
252 printk("i0: %08x i1: %08x i2: %08x i3: %08x\n",
253 sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3]);
254 printk("i4: %08x i5: %08x fp: %08x ret_pc: %08x\n",
255 sf->ins[4], sf->ins[5], sf->fp, sf->callers_pc);
256 printk("sp: %08x x0: %08x x1: %08x x2: %08x\n"
257 "x3: %08x x4: %08x x5: %08x xx: %08x\n",
258 sf->structptr, sf->xargs[0], sf->xargs[1],
259 sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5],
260 sf->xxargs[0]);
261 size = ((unsigned long)sf->fp) - ((unsigned long)sf);
262 size -= STACKFRAME32_SZ;
263 stk = (unsigned *)((unsigned long)sf + STACKFRAME32_SZ);
264 i = 0;
265 do {
266 printk("s%d: %08x\n", i++, *stk++);
267 } while ((size -= sizeof(unsigned)));
268}
269
270#ifdef CONFIG_SMP 217#ifdef CONFIG_SMP
271static DEFINE_SPINLOCK(regdump_lock); 218static DEFINE_SPINLOCK(regdump_lock);
272#endif 219#endif
@@ -354,24 +301,6 @@ void show_regs(struct pt_regs *regs)
354#endif 301#endif
355} 302}
356 303
357void show_regs32(struct pt_regs32 *regs)
358{
359 printk("PSR: %08x PC: %08x NPC: %08x Y: %08x %s\n", regs->psr,
360 regs->pc, regs->npc, regs->y, print_tainted());
361 printk("g0: %08x g1: %08x g2: %08x g3: %08x ",
362 regs->u_regs[0], regs->u_regs[1], regs->u_regs[2],
363 regs->u_regs[3]);
364 printk("g4: %08x g5: %08x g6: %08x g7: %08x\n",
365 regs->u_regs[4], regs->u_regs[5], regs->u_regs[6],
366 regs->u_regs[7]);
367 printk("o0: %08x o1: %08x o2: %08x o3: %08x ",
368 regs->u_regs[8], regs->u_regs[9], regs->u_regs[10],
369 regs->u_regs[11]);
370 printk("o4: %08x o5: %08x sp: %08x ret_pc: %08x\n",
371 regs->u_regs[12], regs->u_regs[13], regs->u_regs[14],
372 regs->u_regs[15]);
373}
374
375unsigned long thread_saved_pc(struct task_struct *tsk) 304unsigned long thread_saved_pc(struct task_struct *tsk)
376{ 305{
377 struct thread_info *ti = task_thread_info(tsk); 306 struct thread_info *ti = task_thread_info(tsk);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index a8052b76df41..cc454731d879 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -86,7 +86,7 @@ extern void setup_sparc64_timer(void);
86 86
87static volatile unsigned long callin_flag = 0; 87static volatile unsigned long callin_flag = 0;
88 88
89void __devinit smp_callin(void) 89void __cpuinit smp_callin(void)
90{ 90{
91 int cpuid = hard_smp_processor_id(); 91 int cpuid = hard_smp_processor_id();
92 92
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 04e81dda13d0..4ae2e525d68b 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -4,6 +4,8 @@
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
5 */ 5 */
6 6
7#include <linux/init.h>
8
7#include <asm/head.h> 9#include <asm/head.h>
8#include <asm/asi.h> 10#include <asm/asi.h>
9#include <asm/lsu.h> 11#include <asm/lsu.h>
@@ -36,7 +38,7 @@ dtlb_load:
36tramp_stack: 38tramp_stack:
37 .skip TRAMP_STACK_SIZE 39 .skip TRAMP_STACK_SIZE
38 40
39 .text 41 __CPUINIT
40 .align 8 42 .align 8
41 .globl sparc64_cpu_startup, sparc64_cpu_startup_end 43 .globl sparc64_cpu_startup, sparc64_cpu_startup_end
42sparc64_cpu_startup: 44sparc64_cpu_startup:
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 2b6abf633343..007f5317c0de 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1791,8 +1791,6 @@ static const char *sun4v_err_type_to_str(u32 type)
1791 }; 1791 };
1792} 1792}
1793 1793
1794extern void __show_regs(struct pt_regs * regs);
1795
1796static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) 1794static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt)
1797{ 1795{
1798 int cnt; 1796 int cnt;
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index e2027f27c0fe..2650d0d33ac2 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -244,16 +244,8 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code,
244 if (regs->tstate & TSTATE_PRIV) { 244 if (regs->tstate & TSTATE_PRIV) {
245 const struct exception_table_entry *entry; 245 const struct exception_table_entry *entry;
246 246
247 if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) { 247 entry = search_exception_tables(regs->tpc);
248 if (insn & 0x2000) 248 if (entry) {
249 asi = (regs->tstate >> 24);
250 else
251 asi = (insn >> 5);
252 }
253
254 /* Look in asi.h: All _S asis have LS bit set */
255 if ((asi & 0x1) &&
256 (entry = search_exception_tables(regs->tpc))) {
257 regs->tpc = entry->fixup; 249 regs->tpc = entry->fixup;
258 regs->tnpc = regs->tpc + 4; 250 regs->tnpc = regs->tpc + 4;
259 return; 251 return;
@@ -294,7 +286,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
294 unsigned long tpc = regs->tpc; 286 unsigned long tpc = regs->tpc;
295 287
296 /* Sanity check the PC. */ 288 /* Sanity check the PC. */
297 if ((tpc >= KERNBASE && tpc < (unsigned long) _etext) || 289 if ((tpc >= KERNBASE && tpc < (unsigned long) __init_end) ||
298 (tpc >= MODULES_VADDR && tpc < MODULES_END)) { 290 (tpc >= MODULES_VADDR && tpc < MODULES_END)) {
299 /* Valid, no problems... */ 291 /* Valid, no problems... */
300 } else { 292 } else {
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 9e6bca266d88..b5c30416fdac 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -1010,7 +1010,8 @@ static struct linux_prom64_registers pall[MAX_BANKS] __initdata;
1010static int pall_ents __initdata; 1010static int pall_ents __initdata;
1011 1011
1012#ifdef CONFIG_DEBUG_PAGEALLOC 1012#ifdef CONFIG_DEBUG_PAGEALLOC
1013static unsigned long kernel_map_range(unsigned long pstart, unsigned long pend, pgprot_t prot) 1013static unsigned long __ref kernel_map_range(unsigned long pstart,
1014 unsigned long pend, pgprot_t prot)
1014{ 1015{
1015 unsigned long vstart = PAGE_OFFSET + pstart; 1016 unsigned long vstart = PAGE_OFFSET + pstart;
1016 unsigned long vend = PAGE_OFFSET + pend; 1017 unsigned long vend = PAGE_OFFSET + pend;
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fc50d2f959d1..e8cb9ff183e9 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -128,8 +128,6 @@ void *get_current(void)
128 return current; 128 return current;
129} 129}
130 130
131extern void schedule_tail(struct task_struct *prev);
132
133/* 131/*
134 * This is called magically, by its address being stuffed in a jmp_buf 132 * This is called magically, by its address being stuffed in a jmp_buf
135 * and being longjmp-d to. 133 * and being longjmp-d to.
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index e09a6b73a1aa..6d50064db182 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -377,6 +377,19 @@ config X86_OOSTORE
377 def_bool y 377 def_bool y
378 depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR 378 depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR
379 379
380#
381# P6_NOPs are a relatively minor optimization that require a family >=
382# 6 processor, except that it is broken on certain VIA chips.
383# Furthermore, AMD chips prefer a totally different sequence of NOPs
384# (which work on all CPUs). As a result, disallow these if we're
385# compiling X86_GENERIC but not X86_64 (these NOPs do work on all
386# x86-64 capable chips); the list of processors in the right-hand clause
387# are the cores that benefit from this optimization.
388#
389config X86_P6_NOP
390 def_bool y
391 depends on (X86_64 || !X86_GENERIC) && (M686 || MPENTIUMII || MPENTIUMIII || MPENTIUMM || MCORE2 || PENTIUM4)
392
380config X86_TSC 393config X86_TSC
381 def_bool y 394 def_bool y
382 depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64 395 depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64
@@ -390,6 +403,7 @@ config X86_CMOV
390config X86_MINIMUM_CPU_FAMILY 403config X86_MINIMUM_CPU_FAMILY
391 int 404 int
392 default "64" if X86_64 405 default "64" if X86_64
406 default "6" if X86_32 && X86_P6_NOP
393 default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK) 407 default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK)
394 default "3" 408 default "3"
395 409
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index 378353956b5d..e77d89f9e8aa 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -37,6 +37,12 @@ static int detect_memory_e820(void)
37 "=m" (*desc) 37 "=m" (*desc)
38 : "D" (desc), "d" (SMAP), "a" (0xe820)); 38 : "D" (desc), "d" (SMAP), "a" (0xe820));
39 39
40 /* BIOSes which terminate the chain with CF = 1 as opposed
41 to %ebx = 0 don't always report the SMAP signature on
42 the final, failing, probe. */
43 if (err)
44 break;
45
40 /* Some BIOSes stop returning SMAP in the middle of 46 /* Some BIOSes stop returning SMAP in the middle of
41 the search loop. We don't know exactly how the BIOS 47 the search loop. We don't know exactly how the BIOS
42 screwed up the map at that point, we might have a 48 screwed up the map at that point, we might have a
@@ -47,9 +53,6 @@ static int detect_memory_e820(void)
47 break; 53 break;
48 } 54 }
49 55
50 if (err)
51 break;
52
53 count++; 56 count++;
54 desc++; 57 desc++;
55 } while (next && count < E820MAX); 58 } while (next && count < E820MAX);
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index a33d53017997..8ea040124f7d 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -128,13 +128,11 @@ void foo(void)
128 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); 128 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
129#endif 129#endif
130 130
131#ifdef CONFIG_LGUEST_GUEST 131#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
132 BLANK(); 132 BLANK();
133 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled); 133 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
134 OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir); 134 OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
135#endif
136 135
137#ifdef CONFIG_LGUEST
138 BLANK(); 136 BLANK();
139 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc); 137 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
140 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc); 138 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index f86a3c4a2669..a38aafaefc23 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -504,7 +504,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
504 504
505 /* Clear all flags overriden by options */ 505 /* Clear all flags overriden by options */
506 for (i = 0; i < NCAPINTS; i++) 506 for (i = 0; i < NCAPINTS; i++)
507 c->x86_capability[i] ^= cleared_cpu_caps[i]; 507 c->x86_capability[i] &= ~cleared_cpu_caps[i];
508 508
509 /* Init Machine Check Exception if available. */ 509 /* Init Machine Check Exception if available. */
510 mcheck_init(c); 510 mcheck_init(c);
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index b6e136f23d3d..be83336fddba 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -43,6 +43,7 @@
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/msr.h> 45#include <asm/msr.h>
46#include <asm/kvm_para.h>
46#include "mtrr.h" 47#include "mtrr.h"
47 48
48u32 num_var_ranges = 0; 49u32 num_var_ranges = 0;
@@ -649,6 +650,7 @@ static __init int amd_special_default_mtrr(void)
649 650
650/** 651/**
651 * mtrr_trim_uncached_memory - trim RAM not covered by MTRRs 652 * mtrr_trim_uncached_memory - trim RAM not covered by MTRRs
653 * @end_pfn: ending page frame number
652 * 654 *
653 * Some buggy BIOSes don't setup the MTRRs properly for systems with certain 655 * Some buggy BIOSes don't setup the MTRRs properly for systems with certain
654 * memory configurations. This routine checks that the highest MTRR matches 656 * memory configurations. This routine checks that the highest MTRR matches
@@ -688,8 +690,11 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
688 690
689 /* kvm/qemu doesn't have mtrr set right, don't trim them all */ 691 /* kvm/qemu doesn't have mtrr set right, don't trim them all */
690 if (!highest_pfn) { 692 if (!highest_pfn) {
691 printk(KERN_WARNING "WARNING: strange, CPU MTRRs all blank?\n"); 693 if (!kvm_para_available()) {
692 WARN_ON(1); 694 printk(KERN_WARNING
695 "WARNING: strange, CPU MTRRs all blank?\n");
696 WARN_ON(1);
697 }
693 return 0; 698 return 0;
694 } 699 }
695 700
diff --git a/arch/x86/kernel/cpu/transmeta.c b/arch/x86/kernel/cpu/transmeta.c
index 200fb3f9ebfb..e8b422c1c512 100644
--- a/arch/x86/kernel/cpu/transmeta.c
+++ b/arch/x86/kernel/cpu/transmeta.c
@@ -76,13 +76,6 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c)
76 /* All Transmeta CPUs have a constant TSC */ 76 /* All Transmeta CPUs have a constant TSC */
77 set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability); 77 set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
78 78
79 /* If we can run i686 user-space code, call us an i686 */
80#define USER686 ((1 << X86_FEATURE_TSC)|\
81 (1 << X86_FEATURE_CX8)|\
82 (1 << X86_FEATURE_CMOV))
83 if (c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686)
84 c->x86 = 6;
85
86#ifdef CONFIG_SYSCTL 79#ifdef CONFIG_SYSCTL
87 /* randomize_va_space slows us down enormously; 80 /* randomize_va_space slows us down enormously;
88 it probably triggers retranslation of x86->native bytecode */ 81 it probably triggers retranslation of x86->native bytecode */
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 2ad9a1bc6a73..c20c9e7e08dd 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -453,6 +453,7 @@ ENTRY(stub_execve)
453 CFI_REGISTER rip, r11 453 CFI_REGISTER rip, r11
454 SAVE_REST 454 SAVE_REST
455 FIXUP_TOP_OF_STACK %r11 455 FIXUP_TOP_OF_STACK %r11
456 movq %rsp, %rcx
456 call sys_execve 457 call sys_execve
457 RESTORE_TOP_OF_STACK %r11 458 RESTORE_TOP_OF_STACK %r11
458 movq %rax,RAX(%rsp) 459 movq %rax,RAX(%rsp)
@@ -1036,15 +1037,16 @@ ENDPROC(child_rip)
1036 * rdi: name, rsi: argv, rdx: envp 1037 * rdi: name, rsi: argv, rdx: envp
1037 * 1038 *
1038 * We want to fallback into: 1039 * We want to fallback into:
1039 * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs) 1040 * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs *regs)
1040 * 1041 *
1041 * do_sys_execve asm fallback arguments: 1042 * do_sys_execve asm fallback arguments:
1042 * rdi: name, rsi: argv, rdx: envp, fake frame on the stack 1043 * rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack
1043 */ 1044 */
1044ENTRY(kernel_execve) 1045ENTRY(kernel_execve)
1045 CFI_STARTPROC 1046 CFI_STARTPROC
1046 FAKE_STACK_FRAME $0 1047 FAKE_STACK_FRAME $0
1047 SAVE_ALL 1048 SAVE_ALL
1049 movq %rsp,%rcx
1048 call sys_execve 1050 call sys_execve
1049 movq %rax, RAX(%rsp) 1051 movq %rax, RAX(%rsp)
1050 RESTORE_REST 1052 RESTORE_REST
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 25eb98540a41..fd8ca53943a8 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -606,7 +606,7 @@ ENTRY(_stext)
606.section ".bss.page_aligned","wa" 606.section ".bss.page_aligned","wa"
607 .align PAGE_SIZE_asm 607 .align PAGE_SIZE_asm
608#ifdef CONFIG_X86_PAE 608#ifdef CONFIG_X86_PAE
609ENTRY(swapper_pg_pmd) 609swapper_pg_pmd:
610 .fill 1024*KPMDS,4,0 610 .fill 1024*KPMDS,4,0
611#else 611#else
612ENTRY(swapper_pg_dir) 612ENTRY(swapper_pg_dir)
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index eb415043a929..a007454133a3 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -379,18 +379,24 @@ NEXT_PAGE(level2_ident_pgt)
379 /* Since I easily can, map the first 1G. 379 /* Since I easily can, map the first 1G.
380 * Don't set NX because code runs from these pages. 380 * Don't set NX because code runs from these pages.
381 */ 381 */
382 PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD) 382 PMDS(0, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD)
383 383
384NEXT_PAGE(level2_kernel_pgt) 384NEXT_PAGE(level2_kernel_pgt)
385 /* 40MB kernel mapping. The kernel code cannot be bigger than that. 385 /*
386 When you change this change KERNEL_TEXT_SIZE in page.h too. */ 386 * 128 MB kernel mapping. We spend a full page on this pagetable
387 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ 387 * anyway.
388 PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, KERNEL_TEXT_SIZE/PMD_SIZE) 388 *
389 /* Module mapping starts here */ 389 * The kernel code+data+bss must not be bigger than that.
390 .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0 390 *
391 * (NOTE: at +128MB starts the module area, see MODULES_VADDR.
392 * If you want to increase this then increase MODULES_VADDR
393 * too.)
394 */
395 PMDS(0, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL,
396 KERNEL_IMAGE_SIZE/PMD_SIZE)
391 397
392NEXT_PAGE(level2_spare_pgt) 398NEXT_PAGE(level2_spare_pgt)
393 .fill 512,8,0 399 .fill 512, 8, 0
394 400
395#undef PMDS 401#undef PMDS
396#undef NEXT_PAGE 402#undef NEXT_PAGE
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 429d084e014d..235fd6c77504 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -368,8 +368,8 @@ static int hpet_clocksource_register(void)
368 return 0; 368 return 0;
369} 369}
370 370
371/* 371/**
372 * Try to setup the HPET timer 372 * hpet_enable - Try to setup the HPET timer. Returns 1 on success.
373 */ 373 */
374int __init hpet_enable(void) 374int __init hpet_enable(void)
375{ 375{
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c
index 5b3ce7934363..3d01e47777db 100644
--- a/arch/x86/kernel/init_task.c
+++ b/arch/x86/kernel/init_task.c
@@ -15,6 +15,7 @@ static struct files_struct init_files = INIT_FILES;
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm); 17struct mm_struct init_mm = INIT_MM(init_mm);
18EXPORT_UNUSED_SYMBOL(init_mm); /* will be removed in 2.6.26 */
18 19
19/* 20/*
20 * Initial thread structure. 21 * Initial thread structure.
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index a7d50a547dc2..be3c7a299f02 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -603,11 +603,13 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
603 } 603 }
604#endif 604#endif
605 605
606#ifdef X86_BTS
606 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) 607 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
607 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); 608 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
608 609
609 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) 610 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
610 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); 611 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
612#endif
611 613
612 614
613 if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) { 615 if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) {
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index b0cc8f0136d8..3baf9b9f4c87 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -604,11 +604,13 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
604 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); 604 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max);
605 } 605 }
606 606
607#ifdef X86_BTS
607 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) 608 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
608 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); 609 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
609 610
610 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) 611 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
611 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); 612 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
613#endif
612} 614}
613 615
614/* 616/*
@@ -730,16 +732,16 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
730 */ 732 */
731asmlinkage 733asmlinkage
732long sys_execve(char __user *name, char __user * __user *argv, 734long sys_execve(char __user *name, char __user * __user *argv,
733 char __user * __user *envp, struct pt_regs regs) 735 char __user * __user *envp, struct pt_regs *regs)
734{ 736{
735 long error; 737 long error;
736 char * filename; 738 char * filename;
737 739
738 filename = getname(name); 740 filename = getname(name);
739 error = PTR_ERR(filename); 741 error = PTR_ERR(filename);
740 if (IS_ERR(filename)) 742 if (IS_ERR(filename))
741 return error; 743 return error;
742 error = do_execve(filename, argv, envp, &regs); 744 error = do_execve(filename, argv, envp, regs);
743 putname(filename); 745 putname(filename);
744 return error; 746 return error;
745} 747}
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index d862e396b099..f41fdc98efb1 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -544,6 +544,8 @@ static int ptrace_set_debugreg(struct task_struct *child,
544 return 0; 544 return 0;
545} 545}
546 546
547#ifdef X86_BTS
548
547static int ptrace_bts_get_size(struct task_struct *child) 549static int ptrace_bts_get_size(struct task_struct *child)
548{ 550{
549 if (!child->thread.ds_area_msr) 551 if (!child->thread.ds_area_msr)
@@ -826,6 +828,7 @@ void ptrace_bts_take_timestamp(struct task_struct *tsk,
826 828
827 ptrace_bts_write_record(tsk, &rec); 829 ptrace_bts_write_record(tsk, &rec);
828} 830}
831#endif /* X86_BTS */
829 832
830/* 833/*
831 * Called by kernel/ptrace.c when detaching.. 834 * Called by kernel/ptrace.c when detaching..
@@ -839,7 +842,9 @@ void ptrace_disable(struct task_struct *child)
839 clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); 842 clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
840#endif 843#endif
841 if (child->thread.ds_area_msr) { 844 if (child->thread.ds_area_msr) {
845#ifdef X86_BTS
842 ptrace_bts_realloc(child, 0, 0); 846 ptrace_bts_realloc(child, 0, 0);
847#endif
843 child->thread.debugctlmsr &= ~ds_debugctl_mask(); 848 child->thread.debugctlmsr &= ~ds_debugctl_mask();
844 if (!child->thread.debugctlmsr) 849 if (!child->thread.debugctlmsr)
845 clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR); 850 clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
@@ -961,6 +966,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
961 break; 966 break;
962#endif 967#endif
963 968
969 /*
970 * These bits need more cooking - not enabled yet:
971 */
972#ifdef X86_BTS
964 case PTRACE_BTS_CONFIG: 973 case PTRACE_BTS_CONFIG:
965 ret = ptrace_bts_config 974 ret = ptrace_bts_config
966 (child, data, (struct ptrace_bts_config __user *)addr); 975 (child, data, (struct ptrace_bts_config __user *)addr);
@@ -988,6 +997,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
988 ret = ptrace_bts_drain 997 ret = ptrace_bts_drain
989 (child, data, (struct bts_struct __user *) addr); 998 (child, data, (struct bts_struct __user *) addr);
990 break; 999 break;
1000#endif
991 1001
992 default: 1002 default:
993 ret = ptrace_request(child, request, addr, data); 1003 ret = ptrace_request(child, request, addr, data);
@@ -1226,12 +1236,14 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
1226 case PTRACE_SETOPTIONS: 1236 case PTRACE_SETOPTIONS:
1227 case PTRACE_SET_THREAD_AREA: 1237 case PTRACE_SET_THREAD_AREA:
1228 case PTRACE_GET_THREAD_AREA: 1238 case PTRACE_GET_THREAD_AREA:
1239#ifdef X86_BTS
1229 case PTRACE_BTS_CONFIG: 1240 case PTRACE_BTS_CONFIG:
1230 case PTRACE_BTS_STATUS: 1241 case PTRACE_BTS_STATUS:
1231 case PTRACE_BTS_SIZE: 1242 case PTRACE_BTS_SIZE:
1232 case PTRACE_BTS_GET: 1243 case PTRACE_BTS_GET:
1233 case PTRACE_BTS_CLEAR: 1244 case PTRACE_BTS_CLEAR:
1234 case PTRACE_BTS_DRAIN: 1245 case PTRACE_BTS_DRAIN:
1246#endif
1235 return sys_ptrace(request, pid, addr, data); 1247 return sys_ptrace(request, pid, addr, data);
1236 1248
1237 default: 1249 default:
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 6fd804f07821..7637dc91c79b 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -1021,7 +1021,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1021 1021
1022 /* Clear all flags overriden by options */ 1022 /* Clear all flags overriden by options */
1023 for (i = 0; i < NCAPINTS; i++) 1023 for (i = 0; i < NCAPINTS; i++)
1024 c->x86_capability[i] ^= cleared_cpu_caps[i]; 1024 c->x86_capability[i] &= ~cleared_cpu_caps[i];
1025 1025
1026#ifdef CONFIG_X86_MCE 1026#ifdef CONFIG_X86_MCE
1027 mcheck_init(c); 1027 mcheck_init(c);
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index d53bd6fcb428..0880f2c388a9 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -554,10 +554,10 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
554 int timeout; 554 int timeout;
555 unsigned long start_rip; 555 unsigned long start_rip;
556 struct create_idle c_idle = { 556 struct create_idle c_idle = {
557 .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
558 .cpu = cpu, 557 .cpu = cpu,
559 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), 558 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
560 }; 559 };
560 INIT_WORK(&c_idle.work, do_fork_idle);
561 561
562 /* allocate memory for gdts of secondary cpus. Hotplug is considered */ 562 /* allocate memory for gdts of secondary cpus. Hotplug is considered */
563 if (!cpu_gdt_descr[cpu].address && 563 if (!cpu_gdt_descr[cpu].address &&
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 02f0f61f5b11..c28c342c162f 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -25,6 +25,8 @@ static int save_stack_stack(void *data, char *name)
25static void save_stack_address(void *data, unsigned long addr, int reliable) 25static void save_stack_address(void *data, unsigned long addr, int reliable)
26{ 26{
27 struct stack_trace *trace = data; 27 struct stack_trace *trace = data;
28 if (!reliable)
29 return;
28 if (trace->skip > 0) { 30 if (trace->skip > 0) {
29 trace->skip--; 31 trace->skip--;
30 return; 32 return;
@@ -37,6 +39,8 @@ static void
37save_stack_address_nosched(void *data, unsigned long addr, int reliable) 39save_stack_address_nosched(void *data, unsigned long addr, int reliable)
38{ 40{
39 struct stack_trace *trace = (struct stack_trace *)data; 41 struct stack_trace *trace = (struct stack_trace *)data;
42 if (!reliable)
43 return;
40 if (in_sched_functions(addr)) 44 if (in_sched_functions(addr))
41 return; 45 return;
42 if (trace->skip > 0) { 46 if (trace->skip > 0) {
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 6dfd4e76661a..022bcaa3b42e 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -91,7 +91,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
91 91
92asmlinkage int sys_set_thread_area(struct user_desc __user *u_info) 92asmlinkage int sys_set_thread_area(struct user_desc __user *u_info)
93{ 93{
94 return do_set_thread_area(current, -1, u_info, 1); 94 int ret = do_set_thread_area(current, -1, u_info, 1);
95 prevent_tail_call(ret);
96 return ret;
95} 97}
96 98
97 99
@@ -139,7 +141,9 @@ int do_get_thread_area(struct task_struct *p, int idx,
139 141
140asmlinkage int sys_get_thread_area(struct user_desc __user *u_info) 142asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
141{ 143{
142 return do_get_thread_area(current, -1, u_info); 144 int ret = do_get_thread_area(current, -1, u_info);
145 prevent_tail_call(ret);
146 return ret;
143} 147}
144 148
145int regset_tls_active(struct task_struct *target, 149int regset_tls_active(struct task_struct *target,
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index 43517e324be8..f14cfd9d1f94 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -28,7 +28,8 @@ EXPORT_SYMBOL_GPL(tsc_khz);
28static int __init tsc_setup(char *str) 28static int __init tsc_setup(char *str)
29{ 29{
30 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, " 30 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
31 "cannot disable TSC.\n"); 31 "cannot disable TSC completely.\n");
32 mark_tsc_unstable("user disabled TSC");
32 return 1; 33 return 1;
33} 34}
34#else 35#else
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 3f8242774580..edff4c985485 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -44,11 +44,6 @@
44 44
45#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) 45#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
46#define __syscall_clobber "r11","cx","memory" 46#define __syscall_clobber "r11","cx","memory"
47#define __pa_vsymbol(x) \
48 ({unsigned long v; \
49 extern char __vsyscall_0; \
50 asm("" : "=r" (v) : "0" (x)); \
51 ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); })
52 47
53/* 48/*
54 * vsyscall_gtod_data contains data that is : 49 * vsyscall_gtod_data contains data that is :
@@ -102,7 +97,7 @@ static __always_inline void do_get_tz(struct timezone * tz)
102static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz) 97static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
103{ 98{
104 int ret; 99 int ret;
105 asm volatile("vsysc2: syscall" 100 asm volatile("syscall"
106 : "=a" (ret) 101 : "=a" (ret)
107 : "0" (__NR_gettimeofday),"D" (tv),"S" (tz) 102 : "0" (__NR_gettimeofday),"D" (tv),"S" (tz)
108 : __syscall_clobber ); 103 : __syscall_clobber );
@@ -112,7 +107,7 @@ static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
112static __always_inline long time_syscall(long *t) 107static __always_inline long time_syscall(long *t)
113{ 108{
114 long secs; 109 long secs;
115 asm volatile("vsysc1: syscall" 110 asm volatile("syscall"
116 : "=a" (secs) 111 : "=a" (secs)
117 : "0" (__NR_time),"D" (t) : __syscall_clobber); 112 : "0" (__NR_time),"D" (t) : __syscall_clobber);
118 return secs; 113 return secs;
@@ -228,42 +223,11 @@ long __vsyscall(3) venosys_1(void)
228 223
229#ifdef CONFIG_SYSCTL 224#ifdef CONFIG_SYSCTL
230 225
231#define SYSCALL 0x050f 226static int
232#define NOP2 0x9090 227vsyscall_sysctl_change(ctl_table *ctl, int write, struct file * filp,
233 228 void __user *buffer, size_t *lenp, loff_t *ppos)
234/*
235 * NOP out syscall in vsyscall page when not needed.
236 */
237static int vsyscall_sysctl_change(ctl_table *ctl, int write, struct file * filp,
238 void __user *buffer, size_t *lenp, loff_t *ppos)
239{ 229{
240 extern u16 vsysc1, vsysc2; 230 return proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
241 u16 __iomem *map1;
242 u16 __iomem *map2;
243 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
244 if (!write)
245 return ret;
246 /* gcc has some trouble with __va(__pa()), so just do it this
247 way. */
248 map1 = ioremap(__pa_vsymbol(&vsysc1), 2);
249 if (!map1)
250 return -ENOMEM;
251 map2 = ioremap(__pa_vsymbol(&vsysc2), 2);
252 if (!map2) {
253 ret = -ENOMEM;
254 goto out;
255 }
256 if (!vsyscall_gtod_data.sysctl_enabled) {
257 writew(SYSCALL, map1);
258 writew(SYSCALL, map2);
259 } else {
260 writew(NOP2, map1);
261 writew(NOP2, map2);
262 }
263 iounmap(map2);
264out:
265 iounmap(map1);
266 return ret;
267} 231}
268 232
269static ctl_table kernel_table2[] = { 233static ctl_table kernel_table2[] = {
@@ -279,7 +243,6 @@ static ctl_table kernel_root_table2[] = {
279 .child = kernel_table2 }, 243 .child = kernel_table2 },
280 {} 244 {}
281}; 245};
282
283#endif 246#endif
284 247
285/* Assume __initcall executes before all user space. Hopefully kmod 248/* Assume __initcall executes before all user space. Hopefully kmod
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 5afdde4895dc..cccb38a59653 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -57,6 +57,7 @@
57#include <linux/lguest_launcher.h> 57#include <linux/lguest_launcher.h>
58#include <linux/virtio_console.h> 58#include <linux/virtio_console.h>
59#include <linux/pm.h> 59#include <linux/pm.h>
60#include <asm/lguest.h>
60#include <asm/paravirt.h> 61#include <asm/paravirt.h>
61#include <asm/param.h> 62#include <asm/param.h>
62#include <asm/page.h> 63#include <asm/page.h>
@@ -75,15 +76,6 @@
75 * behaving in simplified but equivalent ways. In particular, the Guest is the 76 * behaving in simplified but equivalent ways. In particular, the Guest is the
76 * same kernel as the Host (or at least, built from the same source code). :*/ 77 * same kernel as the Host (or at least, built from the same source code). :*/
77 78
78/* Declarations for definitions in lguest_guest.S */
79extern char lguest_noirq_start[], lguest_noirq_end[];
80extern const char lgstart_cli[], lgend_cli[];
81extern const char lgstart_sti[], lgend_sti[];
82extern const char lgstart_popf[], lgend_popf[];
83extern const char lgstart_pushf[], lgend_pushf[];
84extern const char lgstart_iret[], lgend_iret[];
85extern void lguest_iret(void);
86
87struct lguest_data lguest_data = { 79struct lguest_data lguest_data = {
88 .hcall_status = { [0 ... LHCALL_RING_SIZE-1] = 0xFF }, 80 .hcall_status = { [0 ... LHCALL_RING_SIZE-1] = 0xFF },
89 .noirq_start = (u32)lguest_noirq_start, 81 .noirq_start = (u32)lguest_noirq_start,
@@ -489,7 +481,7 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
489{ 481{
490 *pmdp = pmdval; 482 *pmdp = pmdval;
491 lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK, 483 lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK,
492 (__pa(pmdp)&(PAGE_SIZE-1))/4, 0); 484 (__pa(pmdp)&(PAGE_SIZE-1)), 0);
493} 485}
494 486
495/* There are a couple of legacy places where the kernel sets a PTE, but we 487/* There are a couple of legacy places where the kernel sets a PTE, but we
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index bb652f5a93fb..a02a14f0f324 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -172,8 +172,9 @@ set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
172} 172}
173 173
174/* 174/*
175 * The head.S code sets up the kernel high mapping from: 175 * The head.S code sets up the kernel high mapping:
176 * __START_KERNEL_map to __START_KERNEL_map + KERNEL_TEXT_SIZE 176 *
177 * from __START_KERNEL_map to __START_KERNEL_map + size (== _end-_text)
177 * 178 *
178 * phys_addr holds the negative offset to the kernel, which is added 179 * phys_addr holds the negative offset to the kernel, which is added
179 * to the compile time generated pmds. This results in invalid pmds up 180 * to the compile time generated pmds. This results in invalid pmds up
@@ -515,14 +516,6 @@ void __init mem_init(void)
515 516
516 /* clear_bss() already clear the empty_zero_page */ 517 /* clear_bss() already clear the empty_zero_page */
517 518
518 /* temporary debugging - double check it's true: */
519 {
520 int i;
521
522 for (i = 0; i < 1024; i++)
523 WARN_ON_ONCE(empty_zero_page[i]);
524 }
525
526 reservedpages = 0; 519 reservedpages = 0;
527 520
528 /* this will put all low memory onto the freelists */ 521 /* this will put all low memory onto the freelists */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 882328efc3db..ac3c959e271d 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -162,7 +162,7 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
162 area->phys_addr = phys_addr; 162 area->phys_addr = phys_addr;
163 vaddr = (unsigned long) area->addr; 163 vaddr = (unsigned long) area->addr;
164 if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) { 164 if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) {
165 remove_vm_area((void *)(vaddr & PAGE_MASK)); 165 free_vm_area(area);
166 return NULL; 166 return NULL;
167 } 167 }
168 168
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 464d8fc21ce6..7049294fb469 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -26,6 +26,7 @@ struct cpa_data {
26 pgprot_t mask_set; 26 pgprot_t mask_set;
27 pgprot_t mask_clr; 27 pgprot_t mask_clr;
28 int numpages; 28 int numpages;
29 int processed;
29 int flushtlb; 30 int flushtlb;
30 unsigned long pfn; 31 unsigned long pfn;
31}; 32};
@@ -44,6 +45,12 @@ static inline unsigned long highmap_end_pfn(void)
44 45
45#endif 46#endif
46 47
48#ifdef CONFIG_DEBUG_PAGEALLOC
49# define debug_pagealloc 1
50#else
51# define debug_pagealloc 0
52#endif
53
47static inline int 54static inline int
48within(unsigned long addr, unsigned long start, unsigned long end) 55within(unsigned long addr, unsigned long start, unsigned long end)
49{ 56{
@@ -284,8 +291,8 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
284 */ 291 */
285 nextpage_addr = (address + psize) & pmask; 292 nextpage_addr = (address + psize) & pmask;
286 numpages = (nextpage_addr - address) >> PAGE_SHIFT; 293 numpages = (nextpage_addr - address) >> PAGE_SHIFT;
287 if (numpages < cpa->numpages) 294 if (numpages < cpa->processed)
288 cpa->numpages = numpages; 295 cpa->processed = numpages;
289 296
290 /* 297 /*
291 * We are safe now. Check whether the new pgprot is the same: 298 * We are safe now. Check whether the new pgprot is the same:
@@ -312,7 +319,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
312 */ 319 */
313 addr = address + PAGE_SIZE; 320 addr = address + PAGE_SIZE;
314 pfn++; 321 pfn++;
315 for (i = 1; i < cpa->numpages; i++, addr += PAGE_SIZE, pfn++) { 322 for (i = 1; i < cpa->processed; i++, addr += PAGE_SIZE, pfn++) {
316 pgprot_t chk_prot = static_protections(new_prot, addr, pfn); 323 pgprot_t chk_prot = static_protections(new_prot, addr, pfn);
317 324
318 if (pgprot_val(chk_prot) != pgprot_val(new_prot)) 325 if (pgprot_val(chk_prot) != pgprot_val(new_prot))
@@ -336,7 +343,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
336 * that we limited the number of possible pages already to 343 * that we limited the number of possible pages already to
337 * the number of pages in the large page. 344 * the number of pages in the large page.
338 */ 345 */
339 if (address == (nextpage_addr - psize) && cpa->numpages == numpages) { 346 if (address == (nextpage_addr - psize) && cpa->processed == numpages) {
340 /* 347 /*
341 * The address is aligned and the number of pages 348 * The address is aligned and the number of pages
342 * covers the full page. 349 * covers the full page.
@@ -355,45 +362,48 @@ out_unlock:
355 362
356static LIST_HEAD(page_pool); 363static LIST_HEAD(page_pool);
357static unsigned long pool_size, pool_pages, pool_low; 364static unsigned long pool_size, pool_pages, pool_low;
358static unsigned long pool_used, pool_failed, pool_refill; 365static unsigned long pool_used, pool_failed;
359 366
360static void cpa_fill_pool(void) 367static void cpa_fill_pool(struct page **ret)
361{ 368{
362 struct page *p;
363 gfp_t gfp = GFP_KERNEL; 369 gfp_t gfp = GFP_KERNEL;
370 unsigned long flags;
371 struct page *p;
364 372
365 /* Do not allocate from interrupt context */
366 if (in_irq() || irqs_disabled())
367 return;
368 /* 373 /*
369 * Check unlocked. I does not matter when we have one more 374 * Avoid recursion (on debug-pagealloc) and also signal
370 * page in the pool. The bit lock avoids recursive pool 375 * our priority to get to these pagetables:
371 * allocations:
372 */ 376 */
373 if (pool_pages >= pool_size || test_and_set_bit_lock(0, &pool_refill)) 377 if (current->flags & PF_MEMALLOC)
374 return; 378 return;
379 current->flags |= PF_MEMALLOC;
375 380
376#ifdef CONFIG_DEBUG_PAGEALLOC
377 /* 381 /*
378 * We could do: 382 * Allocate atomically from atomic contexts:
379 * gfp = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
380 * but this fails on !PREEMPT kernels
381 */ 383 */
382 gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; 384 if (in_atomic() || irqs_disabled() || debug_pagealloc)
383#endif 385 gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN;
384 386
385 while (pool_pages < pool_size) { 387 while (pool_pages < pool_size || (ret && !*ret)) {
386 p = alloc_pages(gfp, 0); 388 p = alloc_pages(gfp, 0);
387 if (!p) { 389 if (!p) {
388 pool_failed++; 390 pool_failed++;
389 break; 391 break;
390 } 392 }
391 spin_lock_irq(&pgd_lock); 393 /*
394 * If the call site needs a page right now, provide it:
395 */
396 if (ret && !*ret) {
397 *ret = p;
398 continue;
399 }
400 spin_lock_irqsave(&pgd_lock, flags);
392 list_add(&p->lru, &page_pool); 401 list_add(&p->lru, &page_pool);
393 pool_pages++; 402 pool_pages++;
394 spin_unlock_irq(&pgd_lock); 403 spin_unlock_irqrestore(&pgd_lock, flags);
395 } 404 }
396 clear_bit_unlock(0, &pool_refill); 405
406 current->flags &= ~PF_MEMALLOC;
397} 407}
398 408
399#define SHIFT_MB (20 - PAGE_SHIFT) 409#define SHIFT_MB (20 - PAGE_SHIFT)
@@ -414,11 +424,15 @@ void __init cpa_init(void)
414 * GiB. Shift MiB to Gib and multiply the result by 424 * GiB. Shift MiB to Gib and multiply the result by
415 * POOL_PAGES_PER_GB: 425 * POOL_PAGES_PER_GB:
416 */ 426 */
417 gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB; 427 if (debug_pagealloc) {
418 pool_size = POOL_PAGES_PER_GB * gb; 428 gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB;
429 pool_size = POOL_PAGES_PER_GB * gb;
430 } else {
431 pool_size = 1;
432 }
419 pool_low = pool_size; 433 pool_low = pool_size;
420 434
421 cpa_fill_pool(); 435 cpa_fill_pool(NULL);
422 printk(KERN_DEBUG 436 printk(KERN_DEBUG
423 "CPA: page pool initialized %lu of %lu pages preallocated\n", 437 "CPA: page pool initialized %lu of %lu pages preallocated\n",
424 pool_pages, pool_size); 438 pool_pages, pool_size);
@@ -440,16 +454,20 @@ static int split_large_page(pte_t *kpte, unsigned long address)
440 spin_lock_irqsave(&pgd_lock, flags); 454 spin_lock_irqsave(&pgd_lock, flags);
441 if (list_empty(&page_pool)) { 455 if (list_empty(&page_pool)) {
442 spin_unlock_irqrestore(&pgd_lock, flags); 456 spin_unlock_irqrestore(&pgd_lock, flags);
443 return -ENOMEM; 457 base = NULL;
458 cpa_fill_pool(&base);
459 if (!base)
460 return -ENOMEM;
461 spin_lock_irqsave(&pgd_lock, flags);
462 } else {
463 base = list_first_entry(&page_pool, struct page, lru);
464 list_del(&base->lru);
465 pool_pages--;
466
467 if (pool_pages < pool_low)
468 pool_low = pool_pages;
444 } 469 }
445 470
446 base = list_first_entry(&page_pool, struct page, lru);
447 list_del(&base->lru);
448 pool_pages--;
449
450 if (pool_pages < pool_low)
451 pool_low = pool_pages;
452
453 /* 471 /*
454 * Check for races, another CPU might have split this page 472 * Check for races, another CPU might have split this page
455 * up for us already: 473 * up for us already:
@@ -555,7 +573,7 @@ repeat:
555 set_pte_atomic(kpte, new_pte); 573 set_pte_atomic(kpte, new_pte);
556 cpa->flushtlb = 1; 574 cpa->flushtlb = 1;
557 } 575 }
558 cpa->numpages = 1; 576 cpa->processed = 1;
559 return 0; 577 return 0;
560 } 578 }
561 579
@@ -566,7 +584,7 @@ repeat:
566 do_split = try_preserve_large_page(kpte, address, cpa); 584 do_split = try_preserve_large_page(kpte, address, cpa);
567 /* 585 /*
568 * When the range fits into the existing large page, 586 * When the range fits into the existing large page,
569 * return. cp->numpages and cpa->tlbflush have been updated in 587 * return. cp->processed and cpa->tlbflush have been updated in
570 * try_large_page: 588 * try_large_page:
571 */ 589 */
572 if (do_split <= 0) 590 if (do_split <= 0)
@@ -645,7 +663,7 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
645 * Store the remaining nr of pages for the large page 663 * Store the remaining nr of pages for the large page
646 * preservation check. 664 * preservation check.
647 */ 665 */
648 cpa->numpages = numpages; 666 cpa->numpages = cpa->processed = numpages;
649 667
650 ret = __change_page_attr(cpa, checkalias); 668 ret = __change_page_attr(cpa, checkalias);
651 if (ret) 669 if (ret)
@@ -662,9 +680,9 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
662 * CPA operation. Either a large page has been 680 * CPA operation. Either a large page has been
663 * preserved or a single page update happened. 681 * preserved or a single page update happened.
664 */ 682 */
665 BUG_ON(cpa->numpages > numpages); 683 BUG_ON(cpa->processed > numpages);
666 numpages -= cpa->numpages; 684 numpages -= cpa->processed;
667 cpa->vaddr += cpa->numpages * PAGE_SIZE; 685 cpa->vaddr += cpa->processed * PAGE_SIZE;
668 } 686 }
669 return 0; 687 return 0;
670} 688}
@@ -734,7 +752,8 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
734 cpa_flush_all(cache); 752 cpa_flush_all(cache);
735 753
736out: 754out:
737 cpa_fill_pool(); 755 cpa_fill_pool(NULL);
756
738 return ret; 757 return ret;
739} 758}
740 759
@@ -897,7 +916,7 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
897 * Try to refill the page pool here. We can do this only after 916 * Try to refill the page pool here. We can do this only after
898 * the tlb flush. 917 * the tlb flush.
899 */ 918 */
900 cpa_fill_pool(); 919 cpa_fill_pool(NULL);
901} 920}
902 921
903#ifdef CONFIG_HIBERNATION 922#ifdef CONFIG_HIBERNATION
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index f385a4b4a484..0a8f4742ef51 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -50,7 +50,9 @@ obj-$(VDSO64-y) += vdso-syms.lds
50sed-vdsosym := -e 's/^00*/0/' \ 50sed-vdsosym := -e 's/^00*/0/' \
51 -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p' 51 -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
52quiet_cmd_vdsosym = VDSOSYM $@ 52quiet_cmd_vdsosym = VDSOSYM $@
53 cmd_vdsosym = $(NM) $< | sed -n $(sed-vdsosym) | LC_ALL=C sort > $@ 53define cmd_vdsosym
54 $(NM) $< | LC_ALL=C sed -n $(sed-vdsosym) | LC_ALL=C sort > $@
55endef
54 56
55$(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE 57$(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
56 $(call if_changed,vdsosym) 58 $(call if_changed,vdsosym)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 49e5358f481a..8b9ee27805fd 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -153,6 +153,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
153 if (*ax == 1) 153 if (*ax == 1)
154 maskedx = ~((1 << X86_FEATURE_APIC) | /* disable APIC */ 154 maskedx = ~((1 << X86_FEATURE_APIC) | /* disable APIC */
155 (1 << X86_FEATURE_ACPI) | /* disable ACPI */ 155 (1 << X86_FEATURE_ACPI) | /* disable ACPI */
156 (1 << X86_FEATURE_SEP) | /* disable SEP */
156 (1 << X86_FEATURE_ACC)); /* thermal monitoring */ 157 (1 << X86_FEATURE_ACC)); /* thermal monitoring */
157 158
158 asm(XEN_EMULATE_PREFIX "cpuid" 159 asm(XEN_EMULATE_PREFIX "cpuid"