aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-iop32x/n2100.c11
-rw-r--r--arch/cris/Kconfig19
-rw-r--r--arch/cris/arch-v10/defconfig2
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig3
-rw-r--r--arch/cris/arch-v10/drivers/axisflashmap.c8
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c15
-rw-r--r--arch/cris/arch-v10/kernel/entry.S77
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c327
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c2
-rw-r--r--arch/cris/arch-v10/kernel/irq.c59
-rw-r--r--arch/cris/arch-v10/kernel/setup.c5
-rw-r--r--arch/cris/arch-v10/kernel/time.c11
-rw-r--r--arch/cris/arch-v10/lib/memset.c82
-rw-r--r--arch/cris/arch-v10/lib/string.c54
-rw-r--r--arch/cris/arch-v10/lib/usercopy.c314
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig2
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c9
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c2
-rw-r--r--arch/cris/arch-v32/kernel/cache.c33
-rw-r--r--arch/cris/arch-v32/kernel/cacheflush.S94
-rw-r--r--arch/cris/arch-v32/kernel/io.c2
-rw-r--r--arch/cris/arch-v32/kernel/setup.c6
-rw-r--r--arch/cris/defconfig78
-rw-r--r--arch/cris/kernel/crisksyms.c17
-rw-r--r--arch/cris/kernel/irq.c6
-rw-r--r--arch/cris/kernel/process.c5
-rw-r--r--arch/cris/kernel/ptrace.c6
-rw-r--r--arch/cris/kernel/sys_cris.c1
-rw-r--r--arch/cris/kernel/time.c10
-rw-r--r--arch/ia64/kernel/efi.c6
-rw-r--r--arch/mips/kernel/irixsig.c1
-rw-r--r--arch/mips/vr41xx/common/icu.c2
-rw-r--r--arch/powerpc/Makefile3
-rw-r--r--arch/powerpc/kernel/btext.c4
-rw-r--r--arch/powerpc/kernel/entry_32.S6
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/powerpc/mm/init_64.c16
-rw-r--r--arch/powerpc/mm/tlb_64.c2
-rw-r--r--arch/powerpc/sysdev/cpm_common.c4
-rw-r--r--arch/ppc/kernel/entry.S6
-rw-r--r--arch/um/Makefile6
-rw-r--r--arch/um/drivers/net_kern.c14
-rw-r--r--arch/um/include/user.h13
-rw-r--r--arch/um/kernel/irq.c13
-rw-r--r--arch/um/kernel/skas/clone.c1
-rw-r--r--arch/um/os-Linux/file.c3
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c18
-rw-r--r--arch/x86/kernel/i387_64.c9
-rw-r--r--arch/x86/lib/delay_32.c3
-rw-r--r--arch/x86/lib/delay_64.c11
50 files changed, 790 insertions, 613 deletions
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 1873bd8cd1b2..bc91d6e66bc4 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/f75375s.h>
19#include <linux/delay.h> 20#include <linux/delay.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/pci.h> 22#include <linux/pci.h>
@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = {
200 .resource = &n2100_uart_resource, 201 .resource = &n2100_uart_resource,
201}; 202};
202 203
204static struct f75375s_platform_data n2100_f75375s = {
205 .pwm = { 255, 255 },
206 .pwm_enable = { 0, 0 },
207};
208
203static struct i2c_board_info __initdata n2100_i2c_devices[] = { 209static struct i2c_board_info __initdata n2100_i2c_devices[] = {
204 { 210 {
205 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 211 I2C_BOARD_INFO("rtc-rs5c372", 0x32),
206 .type = "rs5c372b", 212 .type = "rs5c372b",
207 }, 213 },
214 {
215 I2C_BOARD_INFO("f75375", 0x2e),
216 .type = "f75375",
217 .platform_data = &n2100_f75375s,
218 },
208}; 219};
209 220
210/* 221/*
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 21900a9378bb..222da1501f47 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -13,6 +13,10 @@ config ZONE_DMA
13 bool 13 bool
14 default y 14 default y
15 15
16config NO_DMA
17 bool
18 default y
19
16config RWSEM_GENERIC_SPINLOCK 20config RWSEM_GENERIC_SPINLOCK
17 bool 21 bool
18 default y 22 default y
@@ -57,6 +61,10 @@ menu "General setup"
57 61
58source "fs/Kconfig.binfmt" 62source "fs/Kconfig.binfmt"
59 63
64config GENERIC_HARDIRQS
65 bool
66 default y
67
60config ETRAX_CMDLINE 68config ETRAX_CMDLINE
61 string "Kernel command line" 69 string "Kernel command line"
62 default "root=/dev/mtdblock3" 70 default "root=/dev/mtdblock3"
@@ -149,7 +157,8 @@ source "net/Kconfig"
149 157
150# bring in ETRAX built-in drivers 158# bring in ETRAX built-in drivers
151menu "Drivers for built-in interfaces" 159menu "Drivers for built-in interfaces"
152source arch/cris/arch-v10/drivers/Kconfig 160# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
161source arch/cris/arch/drivers/Kconfig
153 162
154endmenu 163endmenu
155 164
@@ -180,6 +189,10 @@ source "drivers/isdn/Kconfig"
180 189
181source "drivers/telephony/Kconfig" 190source "drivers/telephony/Kconfig"
182 191
192source "drivers/i2c/Kconfig"
193
194source "drivers/rtc/Kconfig"
195
183# 196#
184# input before char - char/joystick depends on it. As does USB. 197# input before char - char/joystick depends on it. As does USB.
185# 198#
@@ -194,6 +207,10 @@ source "fs/Kconfig"
194 207
195source "sound/Kconfig" 208source "sound/Kconfig"
196 209
210source "drivers/pcmcia/Kconfig"
211
212source "drivers/pci/Kconfig"
213
197source "drivers/usb/Kconfig" 214source "drivers/usb/Kconfig"
198 215
199source "kernel/Kconfig.instrumentation" 216source "kernel/Kconfig.instrumentation"
diff --git a/arch/cris/arch-v10/defconfig b/arch/cris/arch-v10/defconfig
index 710c20ba2be7..572f11926399 100644
--- a/arch/cris/arch-v10/defconfig
+++ b/arch/cris/arch-v10/defconfig
@@ -99,7 +99,6 @@ CONFIG_MTD=y
99CONFIG_MTD_CFI=y 99CONFIG_MTD_CFI=y
100# CONFIG_MTD_CFI_INTELEXT is not set 100# CONFIG_MTD_CFI_INTELEXT is not set
101CONFIG_MTD_CFI_AMDSTD=y 101CONFIG_MTD_CFI_AMDSTD=y
102CONFIG_MTD_AMDSTD=y
103CONFIG_MTD_CHAR=y 102CONFIG_MTD_CHAR=y
104CONFIG_MTD_BLOCK=y 103CONFIG_MTD_BLOCK=y
105CONFIG_ETRAX_I2C=y 104CONFIG_ETRAX_I2C=y
@@ -145,7 +144,6 @@ CONFIG_MTD_CFI=y
145# CONFIG_MTD_CFI_GEOMETRY is not set 144# CONFIG_MTD_CFI_GEOMETRY is not set
146# CONFIG_MTD_CFI_INTELEXT is not set 145# CONFIG_MTD_CFI_INTELEXT is not set
147CONFIG_MTD_CFI_AMDSTD=y 146CONFIG_MTD_CFI_AMDSTD=y
148CONFIG_MTD_AMDSTD=y
149# CONFIG_MTD_SHARP is not set 147# CONFIG_MTD_SHARP is not set
150# CONFIG_MTD_PHYSMAP is not set 148# CONFIG_MTD_PHYSMAP is not set
151# CONFIG_MTD_NORA is not set 149# CONFIG_MTD_NORA is not set
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 03e2e68f947d..faf8b4d3ca01 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -2,6 +2,7 @@ config ETRAX_ETHERNET
2 bool "Ethernet support" 2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V10 3 depends on ETRAX_ARCH_V10
4 select NET_ETHERNET 4 select NET_ETHERNET
5 select MII
5 help 6 help
6 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 7 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
7 controller. 8 controller.
@@ -605,8 +606,6 @@ config ETRAX_AXISFLASHMAP
605 select MTD 606 select MTD
606 select MTD_CFI 607 select MTD_CFI
607 select MTD_CFI_AMDSTD 608 select MTD_CFI_AMDSTD
608 select MTD_OBSOLETE_CHIPS
609 select MTD_AMDSTD
610 select MTD_CHAR 609 select MTD_CHAR
611 select MTD_BLOCK 610 select MTD_BLOCK
612 select MTD_PARTITIONS 611 select MTD_PARTITIONS
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
index efd7b0f3a910..ea3cf2e39a14 100644
--- a/arch/cris/arch-v10/drivers/axisflashmap.c
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c
@@ -312,12 +312,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
312 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", 312 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
313 map_cs->name, map_cs->size, map_cs->map_priv_1); 313 map_cs->name, map_cs->size, map_cs->map_priv_1);
314 314
315#ifdef CONFIG_MTD_AMDSTD
316 mtd_cs = do_map_probe("amd_flash", map_cs);
317#endif
318#ifdef CONFIG_MTD_CFI 315#ifdef CONFIG_MTD_CFI
316 mtd_cs = do_map_probe("cfi_probe", map_cs);
317#endif
318#ifdef CONFIG_MTD_JEDECPROBE
319 if (!mtd_cs) { 319 if (!mtd_cs) {
320 mtd_cs = do_map_probe("cfi_probe", map_cs); 320 mtd_cs = do_map_probe("jedec_probe", map_cs);
321 } 321 }
322#endif 322#endif
323 323
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index f389ed6998fe..0d347a705835 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -297,8 +297,10 @@ gpio_poll(struct file *file,
297 data = *R_PORT_PB_DATA; 297 data = *R_PORT_PB_DATA;
298 else if (priv->minor == GPIO_MINOR_G) 298 else if (priv->minor == GPIO_MINOR_G)
299 data = *R_PORT_G_DATA; 299 data = *R_PORT_G_DATA;
300 else 300 else {
301 spin_unlock(&gpio_lock);
301 return 0; 302 return 0;
303 }
302 304
303 if ((data & priv->highalarm) || 305 if ((data & priv->highalarm) ||
304 (~data & priv->lowalarm)) { 306 (~data & priv->lowalarm)) {
@@ -381,18 +383,21 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
381 383
382 ssize_t retval = count; 384 ssize_t retval = count;
383 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { 385 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) {
384 return -EFAULT; 386 retval = -EFAULT;
387 goto out;
385 } 388 }
386 389
387 if (!access_ok(VERIFY_READ, buf, count)) { 390 if (!access_ok(VERIFY_READ, buf, count)) {
388 return -EFAULT; 391 retval = -EFAULT;
392 goto out;
389 } 393 }
390 clk_mask = priv->clk_mask; 394 clk_mask = priv->clk_mask;
391 data_mask = priv->data_mask; 395 data_mask = priv->data_mask;
392 /* It must have been configured using the IO_CFG_WRITE_MODE */ 396 /* It must have been configured using the IO_CFG_WRITE_MODE */
393 /* Perhaps a better error code? */ 397 /* Perhaps a better error code? */
394 if (clk_mask == 0 || data_mask == 0) { 398 if (clk_mask == 0 || data_mask == 0) {
395 return -EPERM; 399 retval = -EPERM;
400 goto out;
396 } 401 }
397 write_msb = priv->write_msb; 402 write_msb = priv->write_msb;
398 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb)); 403 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb));
@@ -425,6 +430,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
425 } 430 }
426 } 431 }
427 } 432 }
433out:
428 spin_unlock(&gpio_lock); 434 spin_unlock(&gpio_lock);
429 return retval; 435 return retval;
430} 436}
@@ -506,6 +512,7 @@ gpio_release(struct inode *inode, struct file *filp)
506 while (p) { 512 while (p) {
507 if (p->highalarm | p->lowalarm) { 513 if (p->highalarm | p->lowalarm) {
508 gpio_some_alarms = 1; 514 gpio_some_alarms = 1;
515 spin_unlock(&gpio_lock);
509 return 0; 516 return 0;
510 } 517 }
511 p = p->next; 518 p = p->next;
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index c5844cb70f09..ec62c951fa3c 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -500,9 +500,8 @@ _work_notifysig:
500 ;; deal with pending signals and notify-resume requests 500 ;; deal with pending signals and notify-resume requests
501 501
502 move.d $r9, $r10 ; do_notify_resume syscall/irq param 502 move.d $r9, $r10 ; do_notify_resume syscall/irq param
503 moveq 0, $r11 ; oldset param - 0 in this case 503 move.d $sp, $r11 ; the regs param
504 move.d $sp, $r12 ; the regs param 504 move.d $r1, $r12 ; the thread_info_flags parameter
505 move.d $r1, $r13 ; the thread_info_flags parameter
506 jsr do_notify_resume 505 jsr do_notify_resume
507 506
508 ba _Rexit 507 ba _Rexit
@@ -678,13 +677,19 @@ IRQ1_interrupt:
678 push $r10 ; push orig_r10 677 push $r10 ; push orig_r10
679 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 678 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
680 679
680 ;; If there is a glitch on the NMI pin shorter than ~100ns
681 ;; (i.e. non-active by the time we get here) then the nmi_pin bit
682 ;; in R_IRQ_MASK0_RD will already be cleared. The watchdog_nmi bit
683 ;; is cleared by us however (when feeding the watchdog), which is why
684 ;; we use that bit to determine what brought us here.
685
681 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog? 686 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
682 and.d 0x80000000, $r1 687 and.d (1<<30), $r1
683 beq wdog 688 bne wdog
684 move.d $sp, $r10 689 move.d $sp, $r10
685 jsr handle_nmi 690 jsr handle_nmi
686 setf m ; Enable NMI again 691 setf m ; Enable NMI again
687 retb ; Return from NMI 692 ba _Rexit ; Return the standard way
688 nop 693 nop
689wdog: 694wdog:
690#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 695#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
@@ -775,22 +780,9 @@ multiple_interrupt:
775 push $r10 ; push orig_r10 780 push $r10 ; push orig_r10
776 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 781 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
777 782
778 moveq 2, $r2 ; first bit we care about is the timer0 irq 783 move.d $sp, $r10
779 move.d [R_VECT_MASK_RD], $r0; read the irq bits that triggered the multiple irq 784 jsr do_multiple_IRQ
780 move.d $r0, [R_VECT_MASK_CLR] ; Block all active IRQs
7811:
782 btst $r2, $r0 ; check for the irq given by bit r2
783 bpl 2f
784 move.d $r2, $r10 ; First argument to do_IRQ
785 move.d $sp, $r11 ; second argument to do_IRQ
786 jsr do_IRQ
7872:
788 addq 1, $r2 ; next vector bit
789 cmp.b 32, $r2
790 bne 1b ; process all irq's up to and including number 31
791 moveq 0, $r9 ; make ret_from_intr realise we came from an ir
792 785
793 move.d $r0, [R_VECT_MASK_SET] ; Unblock all the IRQs
794 jump ret_from_intr 786 jump ret_from_intr
795 787
796do_sigtrap: 788do_sigtrap:
@@ -837,6 +829,13 @@ _ugdb_handle_breakpoint:
837 ba do_sigtrap ; SIGTRAP the offending process. 829 ba do_sigtrap ; SIGTRAP the offending process.
838 pop $dccr ; Restore dccr in delay slot. 830 pop $dccr ; Restore dccr in delay slot.
839 831
832 .global kernel_execve
833kernel_execve:
834 move.d __NR_execve, $r9
835 break 13
836 ret
837 nop
838
840 .data 839 .data
841 840
842hw_bp_trigs: 841hw_bp_trigs:
@@ -1135,6 +1134,42 @@ sys_call_table:
1135 .long sys_add_key 1134 .long sys_add_key
1136 .long sys_request_key 1135 .long sys_request_key
1137 .long sys_keyctl 1136 .long sys_keyctl
1137 .long sys_ioprio_set
1138 .long sys_ioprio_get /* 290 */
1139 .long sys_inotify_init
1140 .long sys_inotify_add_watch
1141 .long sys_inotify_rm_watch
1142 .long sys_migrate_pages
1143 .long sys_openat /* 295 */
1144 .long sys_mkdirat
1145 .long sys_mknodat
1146 .long sys_fchownat
1147 .long sys_futimesat
1148 .long sys_fstatat64 /* 300 */
1149 .long sys_unlinkat
1150 .long sys_renameat
1151 .long sys_linkat
1152 .long sys_symlinkat
1153 .long sys_readlinkat /* 305 */
1154 .long sys_fchmodat
1155 .long sys_faccessat
1156 .long sys_pselect6
1157 .long sys_ppoll
1158 .long sys_unshare /* 310 */
1159 .long sys_set_robust_list
1160 .long sys_get_robust_list
1161 .long sys_splice
1162 .long sys_sync_file_range
1163 .long sys_tee /* 315 */
1164 .long sys_vmsplice
1165 .long sys_move_pages
1166 .long sys_getcpu
1167 .long sys_epoll_pwait
1168 .long sys_utimensat /* 320 */
1169 .long sys_signalfd
1170 .long sys_timerfd
1171 .long sys_eventfd
1172 .long sys_fallocate
1138 1173
1139 /* 1174 /*
1140 * NOTE!! This doesn't have to be exact - we just have 1175 * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index d3ea052e5ee1..c1a3a2100ee7 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -1,97 +1,9 @@
1/* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $ 1/*
2 * linux/arch/cris/kernel/fasttimer.c 2 * linux/arch/cris/kernel/fasttimer.c
3 * 3 *
4 * Fast timers for ETRAX100/ETRAX100LX 4 * Fast timers for ETRAX100/ETRAX100LX
5 * This may be useful in other OS than Linux so use 2 space indentation...
6 * 5 *
7 * $Log: fasttimer.c,v $ 6 * Copyright (C) 2000-2007 Axis Communications AB, Lund, Sweden
8 * Revision 1.9 2005/03/04 08:16:16 starvik
9 * Merge of Linux 2.6.11.
10 *
11 * Revision 1.8 2005/01/05 06:09:29 starvik
12 * cli()/sti() will be obsolete in 2.6.11.
13 *
14 * Revision 1.7 2005/01/03 13:35:46 starvik
15 * Removed obsolete stuff.
16 * Mark fast timer IRQ as not shared.
17 *
18 * Revision 1.6 2004/05/14 10:18:39 starvik
19 * Export fast_timer_list
20 *
21 * Revision 1.5 2004/05/14 07:58:01 starvik
22 * Merge of changes from 2.4
23 *
24 * Revision 1.4 2003/07/04 08:27:41 starvik
25 * Merge of Linux 2.5.74
26 *
27 * Revision 1.3 2002/12/12 08:26:32 starvik
28 * Don't use C-comments inside CVS comments
29 *
30 * Revision 1.2 2002/12/11 15:42:02 starvik
31 * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
32 *
33 * Revision 1.1 2002/11/18 07:58:06 starvik
34 * Fast timers (from Linux 2.4)
35 *
36 * Revision 1.5 2002/10/15 06:21:39 starvik
37 * Added call to init_waitqueue_head
38 *
39 * Revision 1.4 2002/05/28 17:47:59 johana
40 * Added del_fast_timer()
41 *
42 * Revision 1.3 2002/05/28 16:16:07 johana
43 * Handle empty fast_timer_list
44 *
45 * Revision 1.2 2002/05/27 15:38:42 johana
46 * Made it compile without warnings on Linux 2.4.
47 * (includes, wait_queue, PROC_FS and snprintf)
48 *
49 * Revision 1.1 2002/05/27 15:32:25 johana
50 * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree.
51 *
52 * Revision 1.8 2001/11/27 13:50:40 pkj
53 * Disable interrupts while stopping the timer and while modifying the
54 * list of active timers in timer1_handler() as it may be interrupted
55 * by other interrupts (e.g., the serial interrupt) which may add fast
56 * timers.
57 *
58 * Revision 1.7 2001/11/22 11:50:32 pkj
59 * * Only store information about the last 16 timers.
60 * * proc_fasttimer_read() now uses an allocated buffer, since it
61 * requires more space than just a page even for only writing the
62 * last 16 timers. The buffer is only allocated on request, so
63 * unless /proc/fasttimer is read, it is never allocated.
64 * * Renamed fast_timer_started to fast_timers_started to match
65 * fast_timers_added and fast_timers_expired.
66 * * Some clean-up.
67 *
68 * Revision 1.6 2000/12/13 14:02:08 johana
69 * Removed volatile for fast_timer_list
70 *
71 * Revision 1.5 2000/12/13 13:55:35 johana
72 * Added DEBUG_LOG, added som cli() and cleanup
73 *
74 * Revision 1.4 2000/12/05 13:48:50 johana
75 * Added range check when writing proc file, modified timer int handling
76 *
77 * Revision 1.3 2000/11/23 10:10:20 johana
78 * More debug/logging possibilities.
79 * Moved GET_JIFFIES_USEC() to timex.h and time.c
80 *
81 * Revision 1.2 2000/11/01 13:41:04 johana
82 * Clean up and bugfixes.
83 * Created new do_gettimeofday_fast() that gets a timeval struct
84 * with time based on jiffies and *R_TIMER0_DATA, uses a table
85 * for fast conversion of timer value to microseconds.
86 * (Much faster the standard do_gettimeofday() and we don't really
87 * want to use the true time - we want the "uptime" so timers don't screw up
88 * when we change the time.
89 * TODO: Add efficient support for continuous timers as well.
90 *
91 * Revision 1.1 2000/10/26 15:49:16 johana
92 * Added fasttimer, highresolution timers.
93 *
94 * Copyright (C) 2000,2001 2002 Axis Communications AB, Lund, Sweden
95 */ 7 */
96 8
97#include <linux/errno.h> 9#include <linux/errno.h>
@@ -125,7 +37,7 @@
125 37
126#ifdef FAST_TIMER_SANITY_CHECKS 38#ifdef FAST_TIMER_SANITY_CHECKS
127#define SANITYCHECK(x) x 39#define SANITYCHECK(x) x
128static int sanity_failed = 0; 40static int sanity_failed;
129#else 41#else
130#define SANITYCHECK(x) 42#define SANITYCHECK(x)
131#endif 43#endif
@@ -134,15 +46,13 @@ static int sanity_failed = 0;
134#define D2(x) 46#define D2(x)
135#define DP(x) 47#define DP(x)
136 48
137#define __INLINE__ inline 49static unsigned int fast_timer_running;
138 50static unsigned int fast_timers_added;
139static int fast_timer_running = 0; 51static unsigned int fast_timers_started;
140static int fast_timers_added = 0; 52static unsigned int fast_timers_expired;
141static int fast_timers_started = 0; 53static unsigned int fast_timers_deleted;
142static int fast_timers_expired = 0; 54static unsigned int fast_timer_is_init;
143static int fast_timers_deleted = 0; 55static unsigned int fast_timer_ints;
144static int fast_timer_is_init = 0;
145static int fast_timer_ints = 0;
146 56
147struct fast_timer *fast_timer_list = NULL; 57struct fast_timer *fast_timer_list = NULL;
148 58
@@ -150,8 +60,8 @@ struct fast_timer *fast_timer_list = NULL;
150#define DEBUG_LOG_MAX 128 60#define DEBUG_LOG_MAX 128
151static const char * debug_log_string[DEBUG_LOG_MAX]; 61static const char * debug_log_string[DEBUG_LOG_MAX];
152static unsigned long debug_log_value[DEBUG_LOG_MAX]; 62static unsigned long debug_log_value[DEBUG_LOG_MAX];
153static int debug_log_cnt = 0; 63static unsigned int debug_log_cnt;
154static int debug_log_cnt_wrapped = 0; 64static unsigned int debug_log_cnt_wrapped;
155 65
156#define DEBUG_LOG(string, value) \ 66#define DEBUG_LOG(string, value) \
157{ \ 67{ \
@@ -206,45 +116,29 @@ int timer_freq_settings[NUM_TIMER_STATS];
206int timer_delay_settings[NUM_TIMER_STATS]; 116int timer_delay_settings[NUM_TIMER_STATS];
207 117
208/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */ 118/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */
209void __INLINE__ do_gettimeofday_fast(struct timeval *tv) 119inline void do_gettimeofday_fast(struct fasttime_t *tv)
210{ 120{
211 unsigned long sec = jiffies; 121 tv->tv_jiff = jiffies;
212 unsigned long usec = GET_JIFFIES_USEC(); 122 tv->tv_usec = GET_JIFFIES_USEC();
213
214 usec += (sec % HZ) * (1000000 / HZ);
215 sec = sec / HZ;
216
217 if (usec > 1000000)
218 {
219 usec -= 1000000;
220 sec++;
221 }
222 tv->tv_sec = sec;
223 tv->tv_usec = usec;
224} 123}
225 124
226int __INLINE__ timeval_cmp(struct timeval *t0, struct timeval *t1) 125inline int fasttime_cmp(struct fasttime_t *t0, struct fasttime_t *t1)
227{ 126{
228 if (t0->tv_sec < t1->tv_sec) 127 /* Compare jiffies. Takes care of wrapping */
229 { 128 if (time_before(t0->tv_jiff, t1->tv_jiff))
230 return -1; 129 return -1;
231 } 130 else if (time_after(t0->tv_jiff, t1->tv_jiff))
232 else if (t0->tv_sec > t1->tv_sec) 131 return 1;
233 { 132
234 return 1; 133 /* Compare us */
235 } 134 if (t0->tv_usec < t1->tv_usec)
236 if (t0->tv_usec < t1->tv_usec) 135 return -1;
237 { 136 else if (t0->tv_usec > t1->tv_usec)
238 return -1; 137 return 1;
239 } 138 return 0;
240 else if (t0->tv_usec > t1->tv_usec)
241 {
242 return 1;
243 }
244 return 0;
245} 139}
246 140
247void __INLINE__ start_timer1(unsigned long delay_us) 141inline void start_timer1(unsigned long delay_us)
248{ 142{
249 int freq_index = 0; /* This is the lowest resolution */ 143 int freq_index = 0; /* This is the lowest resolution */
250 unsigned long upper_limit = MAX_DELAY_US; 144 unsigned long upper_limit = MAX_DELAY_US;
@@ -285,7 +179,7 @@ void __INLINE__ start_timer1(unsigned long delay_us)
285 timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index; 179 timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index;
286 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us; 180 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us;
287 181
288 D1(printk("start_timer1 : %d us freq: %i div: %i\n", 182 D1(printk(KERN_DEBUG "start_timer1 : %d us freq: %i div: %i\n",
289 delay_us, freq_index, div)); 183 delay_us, freq_index, div));
290 /* Clear timer1 irq */ 184 /* Clear timer1 irq */
291 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); 185 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr);
@@ -340,7 +234,7 @@ void start_one_shot_timer(struct fast_timer *t,
340 printk(KERN_WARNING 234 printk(KERN_WARNING
341 "timer name: %s data: 0x%08lX already in list!\n", name, data); 235 "timer name: %s data: 0x%08lX already in list!\n", name, data);
342 sanity_failed++; 236 sanity_failed++;
343 return; 237 goto done;
344 } 238 }
345 else 239 else
346 { 240 {
@@ -356,11 +250,11 @@ void start_one_shot_timer(struct fast_timer *t,
356 t->name = name; 250 t->name = name;
357 251
358 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000; 252 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000;
359 t->tv_expires.tv_sec = t->tv_set.tv_sec + delay_us / 1000000; 253 t->tv_expires.tv_jiff = t->tv_set.tv_jiff + delay_us / 1000000 / HZ;
360 if (t->tv_expires.tv_usec > 1000000) 254 if (t->tv_expires.tv_usec > 1000000)
361 { 255 {
362 t->tv_expires.tv_usec -= 1000000; 256 t->tv_expires.tv_usec -= 1000000;
363 t->tv_expires.tv_sec++; 257 t->tv_expires.tv_jiff += HZ;
364 } 258 }
365#ifdef FAST_TIMER_LOG 259#ifdef FAST_TIMER_LOG
366 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t; 260 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t;
@@ -368,7 +262,7 @@ void start_one_shot_timer(struct fast_timer *t,
368 fast_timers_added++; 262 fast_timers_added++;
369 263
370 /* Check if this should timeout before anything else */ 264 /* Check if this should timeout before anything else */
371 if (tmp == NULL || timeval_cmp(&t->tv_expires, &tmp->tv_expires) < 0) 265 if (tmp == NULL || fasttime_cmp(&t->tv_expires, &tmp->tv_expires) < 0)
372 { 266 {
373 /* Put first in list and modify the timer value */ 267 /* Put first in list and modify the timer value */
374 t->prev = NULL; 268 t->prev = NULL;
@@ -384,8 +278,8 @@ void start_one_shot_timer(struct fast_timer *t,
384 start_timer1(delay_us); 278 start_timer1(delay_us);
385 } else { 279 } else {
386 /* Put in correct place in list */ 280 /* Put in correct place in list */
387 while (tmp->next && 281 while (tmp->next && fasttime_cmp(&t->tv_expires,
388 timeval_cmp(&t->tv_expires, &tmp->next->tv_expires) > 0) 282 &tmp->next->tv_expires) > 0)
389 { 283 {
390 tmp = tmp->next; 284 tmp = tmp->next;
391 } 285 }
@@ -401,6 +295,7 @@ void start_one_shot_timer(struct fast_timer *t,
401 295
402 D2(printk("start_one_shot_timer: %d us done\n", delay_us)); 296 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
403 297
298done:
404 local_irq_restore(flags); 299 local_irq_restore(flags);
405} /* start_one_shot_timer */ 300} /* start_one_shot_timer */
406 301
@@ -444,11 +339,18 @@ int del_fast_timer(struct fast_timer * t)
444/* Timer 1 interrupt handler */ 339/* Timer 1 interrupt handler */
445 340
446static irqreturn_t 341static irqreturn_t
447timer1_handler(int irq, void *dev_id, struct pt_regs *regs) 342timer1_handler(int irq, void *dev_id)
448{ 343{
449 struct fast_timer *t; 344 struct fast_timer *t;
450 unsigned long flags; 345 unsigned long flags;
451 346
347 /* We keep interrupts disabled not only when we modify the
348 * fast timer list, but any time we hold a reference to a
349 * timer in the list, since del_fast_timer may be called
350 * from (another) interrupt context. Thus, the only time
351 * when interrupts are enabled is when calling the timer
352 * callback function.
353 */
452 local_irq_save(flags); 354 local_irq_save(flags);
453 355
454 /* Clear timer1 irq */ 356 /* Clear timer1 irq */
@@ -466,18 +368,19 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
466 fast_timer_running = 0; 368 fast_timer_running = 0;
467 fast_timer_ints++; 369 fast_timer_ints++;
468 370
469 local_irq_restore(flags);
470
471 t = fast_timer_list; 371 t = fast_timer_list;
472 while (t) 372 while (t)
473 { 373 {
474 struct timeval tv; 374 struct fasttime_t tv;
375 fast_timer_function_type *f;
376 unsigned long d;
475 377
476 /* Has it really expired? */ 378 /* Has it really expired? */
477 do_gettimeofday_fast(&tv); 379 do_gettimeofday_fast(&tv);
478 D1(printk("t: %is %06ius\n", tv.tv_sec, tv.tv_usec)); 380 D1(printk(KERN_DEBUG "t: %is %06ius\n",
381 tv.tv_jiff, tv.tv_usec));
479 382
480 if (timeval_cmp(&t->tv_expires, &tv) <= 0) 383 if (fasttime_cmp(&t->tv_expires, &tv) <= 0)
481 { 384 {
482 /* Yes it has expired */ 385 /* Yes it has expired */
483#ifdef FAST_TIMER_LOG 386#ifdef FAST_TIMER_LOG
@@ -486,7 +389,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
486 fast_timers_expired++; 389 fast_timers_expired++;
487 390
488 /* Remove this timer before call, since it may reuse the timer */ 391 /* Remove this timer before call, since it may reuse the timer */
489 local_irq_save(flags);
490 if (t->prev) 392 if (t->prev)
491 { 393 {
492 t->prev->next = t->next; 394 t->prev->next = t->next;
@@ -501,16 +403,23 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
501 } 403 }
502 t->prev = NULL; 404 t->prev = NULL;
503 t->next = NULL; 405 t->next = NULL;
504 local_irq_restore(flags);
505 406
506 if (t->function != NULL) 407 /* Save function callback data before enabling
507 { 408 * interrupts, since the timer may be removed and
508 t->function(t->data); 409 * we don't know how it was allocated
509 } 410 * (e.g. ->function and ->data may become overwritten
510 else 411 * after deletion if the timer was stack-allocated).
511 { 412 */
413 f = t->function;
414 d = t->data;
415
416 if (f != NULL) {
417 /* Run callback with interrupts enabled. */
418 local_irq_restore(flags);
419 f(d);
420 local_irq_save(flags);
421 } else
512 DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints); 422 DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints);
513 }
514 } 423 }
515 else 424 else
516 { 425 {
@@ -518,16 +427,20 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
518 D1(printk(".\n")); 427 D1(printk(".\n"));
519 } 428 }
520 429
521 local_irq_save(flags);
522 if ((t = fast_timer_list) != NULL) 430 if ((t = fast_timer_list) != NULL)
523 { 431 {
524 /* Start next timer.. */ 432 /* Start next timer.. */
525 long us; 433 long us = 0;
526 struct timeval tv; 434 struct fasttime_t tv;
527 435
528 do_gettimeofday_fast(&tv); 436 do_gettimeofday_fast(&tv);
529 us = ((t->tv_expires.tv_sec - tv.tv_sec) * 1000000 + 437
530 t->tv_expires.tv_usec - tv.tv_usec); 438 /* time_after_eq takes care of wrapping */
439 if (time_after_eq(t->tv_expires.tv_jiff, tv.tv_jiff))
440 us = ((t->tv_expires.tv_jiff - tv.tv_jiff) *
441 1000000 / HZ + t->tv_expires.tv_usec -
442 tv.tv_usec);
443
531 if (us > 0) 444 if (us > 0)
532 { 445 {
533 if (!fast_timer_running) 446 if (!fast_timer_running)
@@ -537,7 +450,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
537#endif 450#endif
538 start_timer1(us); 451 start_timer1(us);
539 } 452 }
540 local_irq_restore(flags);
541 break; 453 break;
542 } 454 }
543 else 455 else
@@ -548,9 +460,10 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
548 D1(printk("e! %d\n", us)); 460 D1(printk("e! %d\n", us));
549 } 461 }
550 } 462 }
551 local_irq_restore(flags);
552 } 463 }
553 464
465 local_irq_restore(flags);
466
554 if (!t) 467 if (!t)
555 { 468 {
556 D1(printk("t1 stop!\n")); 469 D1(printk("t1 stop!\n"));
@@ -575,28 +488,17 @@ static void wake_up_func(unsigned long data)
575void schedule_usleep(unsigned long us) 488void schedule_usleep(unsigned long us)
576{ 489{
577 struct fast_timer t; 490 struct fast_timer t;
578#ifdef DECLARE_WAITQUEUE
579 wait_queue_head_t sleep_wait; 491 wait_queue_head_t sleep_wait;
580 init_waitqueue_head(&sleep_wait); 492 init_waitqueue_head(&sleep_wait);
581 {
582 DECLARE_WAITQUEUE(wait, current);
583#else
584 struct wait_queue *sleep_wait = NULL;
585 struct wait_queue wait = { current, NULL };
586#endif
587 493
588 D1(printk("schedule_usleep(%d)\n", us)); 494 D1(printk("schedule_usleep(%d)\n", us));
589 add_wait_queue(&sleep_wait, &wait);
590 set_current_state(TASK_INTERRUPTIBLE);
591 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us, 495 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us,
592 "usleep"); 496 "usleep");
593 schedule(); 497 /* Uninterruptible sleep on the fast timer. (The condition is somewhat
594 set_current_state(TASK_RUNNING); 498 * redundant since the timer is what wakes us up.) */
595 remove_wait_queue(&sleep_wait, &wait); 499 wait_event(sleep_wait, !fast_timer_pending(&t));
500
596 D1(printk("done schedule_usleep(%d)\n", us)); 501 D1(printk("done schedule_usleep(%d)\n", us));
597#ifdef DECLARE_WAITQUEUE
598 }
599#endif
600} 502}
601 503
602#ifdef CONFIG_PROC_FS 504#ifdef CONFIG_PROC_FS
@@ -616,7 +518,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
616 unsigned long flags; 518 unsigned long flags;
617 int i = 0; 519 int i = 0;
618 int num_to_show; 520 int num_to_show;
619 struct timeval tv; 521 struct fasttime_t tv;
620 struct fast_timer *t, *nextt; 522 struct fast_timer *t, *nextt;
621 static char *bigbuf = NULL; 523 static char *bigbuf = NULL;
622 static unsigned long used; 524 static unsigned long used;
@@ -624,7 +526,8 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
624 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) 526 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
625 { 527 {
626 used = 0; 528 used = 0;
627 bigbuf[0] = '\0'; 529 if (buf)
530 buf[0] = '\0';
628 return 0; 531 return 0;
629 } 532 }
630 533
@@ -646,7 +549,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
646 used += sprintf(bigbuf + used, "Fast timer running: %s\n", 549 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
647 fast_timer_running ? "yes" : "no"); 550 fast_timer_running ? "yes" : "no");
648 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", 551 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
649 (unsigned long)tv.tv_sec, 552 (unsigned long)tv.tv_jiff,
650 (unsigned long)tv.tv_usec); 553 (unsigned long)tv.tv_usec);
651#ifdef FAST_TIMER_SANITY_CHECKS 554#ifdef FAST_TIMER_SANITY_CHECKS
652 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 555 used += sprintf(bigbuf + used, "Sanity failed: %i\n",
@@ -696,9 +599,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
696 "d: %6li us data: 0x%08lX" 599 "d: %6li us data: 0x%08lX"
697 "\n", 600 "\n",
698 t->name, 601 t->name,
699 (unsigned long)t->tv_set.tv_sec, 602 (unsigned long)t->tv_set.tv_jiff,
700 (unsigned long)t->tv_set.tv_usec, 603 (unsigned long)t->tv_set.tv_usec,
701 (unsigned long)t->tv_expires.tv_sec, 604 (unsigned long)t->tv_expires.tv_jiff,
702 (unsigned long)t->tv_expires.tv_usec, 605 (unsigned long)t->tv_expires.tv_usec,
703 t->delay_us, 606 t->delay_us,
704 t->data 607 t->data
@@ -718,9 +621,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
718 "d: %6li us data: 0x%08lX" 621 "d: %6li us data: 0x%08lX"
719 "\n", 622 "\n",
720 t->name, 623 t->name,
721 (unsigned long)t->tv_set.tv_sec, 624 (unsigned long)t->tv_set.tv_jiff,
722 (unsigned long)t->tv_set.tv_usec, 625 (unsigned long)t->tv_set.tv_usec,
723 (unsigned long)t->tv_expires.tv_sec, 626 (unsigned long)t->tv_expires.tv_jiff,
724 (unsigned long)t->tv_expires.tv_usec, 627 (unsigned long)t->tv_expires.tv_usec,
725 t->delay_us, 628 t->delay_us,
726 t->data 629 t->data
@@ -738,9 +641,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
738 "d: %6li us data: 0x%08lX" 641 "d: %6li us data: 0x%08lX"
739 "\n", 642 "\n",
740 t->name, 643 t->name,
741 (unsigned long)t->tv_set.tv_sec, 644 (unsigned long)t->tv_set.tv_jiff,
742 (unsigned long)t->tv_set.tv_usec, 645 (unsigned long)t->tv_set.tv_usec,
743 (unsigned long)t->tv_expires.tv_sec, 646 (unsigned long)t->tv_expires.tv_jiff,
744 (unsigned long)t->tv_expires.tv_usec, 647 (unsigned long)t->tv_expires.tv_usec,
745 t->delay_us, 648 t->delay_us,
746 t->data 649 t->data
@@ -761,15 +664,15 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
761/* " func: 0x%08lX" */ 664/* " func: 0x%08lX" */
762 "\n", 665 "\n",
763 t->name, 666 t->name,
764 (unsigned long)t->tv_set.tv_sec, 667 (unsigned long)t->tv_set.tv_jiff,
765 (unsigned long)t->tv_set.tv_usec, 668 (unsigned long)t->tv_set.tv_usec,
766 (unsigned long)t->tv_expires.tv_sec, 669 (unsigned long)t->tv_expires.tv_jiff,
767 (unsigned long)t->tv_expires.tv_usec, 670 (unsigned long)t->tv_expires.tv_usec,
768 t->delay_us, 671 t->delay_us,
769 t->data 672 t->data
770/* , t->function */ 673/* , t->function */
771 ); 674 );
772 local_irq_disable(); 675 local_irq_save(flags);
773 if (t->next != nextt) 676 if (t->next != nextt)
774 { 677 {
775 printk(KERN_WARNING "timer removed!\n"); 678 printk(KERN_WARNING "timer removed!\n");
@@ -798,7 +701,7 @@ static volatile int num_test_timeout = 0;
798static struct fast_timer tr[10]; 701static struct fast_timer tr[10];
799static int exp_num[10]; 702static int exp_num[10];
800 703
801static struct timeval tv_exp[100]; 704static struct fasttime_t tv_exp[100];
802 705
803static void test_timeout(unsigned long data) 706static void test_timeout(unsigned long data)
804{ 707{
@@ -836,7 +739,7 @@ static void fast_timer_test(void)
836 int prev_num; 739 int prev_num;
837 int j; 740 int j;
838 741
839 struct timeval tv, tv0, tv1, tv2; 742 struct fasttime_t tv, tv0, tv1, tv2;
840 743
841 printk("fast_timer_test() start\n"); 744 printk("fast_timer_test() start\n");
842 do_gettimeofday_fast(&tv); 745 do_gettimeofday_fast(&tv);
@@ -849,7 +752,8 @@ static void fast_timer_test(void)
849 { 752 {
850 do_gettimeofday_fast(&tv_exp[j]); 753 do_gettimeofday_fast(&tv_exp[j]);
851 } 754 }
852 printk("fast_timer_test() %is %06i\n", tv.tv_sec, tv.tv_usec); 755 printk(KERN_DEBUG "fast_timer_test() %is %06i\n",
756 tv.tv_jiff, tv.tv_usec);
853 757
854 for (j = 0; j < 1000; j++) 758 for (j = 0; j < 1000; j++)
855 { 759 {
@@ -858,12 +762,12 @@ static void fast_timer_test(void)
858 } 762 }
859 for (j = 0; j < 100; j++) 763 for (j = 0; j < 100; j++)
860 { 764 {
861 printk("%i.%i %i.%i %i.%i %i.%i %i.%i\n", 765 printk(KERN_DEBUG "%i.%i %i.%i %i.%i %i.%i %i.%i\n",
862 tv_exp[j].tv_sec,tv_exp[j].tv_usec, 766 tv_exp[j].tv_jiff, tv_exp[j].tv_usec,
863 tv_exp[j+1].tv_sec,tv_exp[j+1].tv_usec, 767 tv_exp[j+1].tv_jiff, tv_exp[j+1].tv_usec,
864 tv_exp[j+2].tv_sec,tv_exp[j+2].tv_usec, 768 tv_exp[j+2].tv_jiff, tv_exp[j+2].tv_usec,
865 tv_exp[j+3].tv_sec,tv_exp[j+3].tv_usec, 769 tv_exp[j+3].tv_jiff, tv_exp[j+3].tv_usec,
866 tv_exp[j+4].tv_sec,tv_exp[j+4].tv_usec); 770 tv_exp[j+4].tv_jiff, tv_exp[j+4].tv_usec);
867 j += 4; 771 j += 4;
868 } 772 }
869 do_gettimeofday_fast(&tv0); 773 do_gettimeofday_fast(&tv0);
@@ -895,9 +799,12 @@ static void fast_timer_test(void)
895 } 799 }
896 } 800 }
897 do_gettimeofday_fast(&tv2); 801 do_gettimeofday_fast(&tv2);
898 printk("Timers started %is %06i\n", tv0.tv_sec, tv0.tv_usec); 802 printk(KERN_DEBUG "Timers started %is %06i\n",
899 printk("Timers started at %is %06i\n", tv1.tv_sec, tv1.tv_usec); 803 tv0.tv_jiff, tv0.tv_usec);
900 printk("Timers done %is %06i\n", tv2.tv_sec, tv2.tv_usec); 804 printk(KERN_DEBUG "Timers started at %is %06i\n",
805 tv1.tv_jiff, tv1.tv_usec);
806 printk(KERN_DEBUG "Timers done %is %06i\n",
807 tv2.tv_jiff, tv2.tv_usec);
901 DP(printk("buf0:\n"); 808 DP(printk("buf0:\n");
902 printk(buf0); 809 printk(buf0);
903 printk("buf1:\n"); 810 printk("buf1:\n");
@@ -919,9 +826,9 @@ static void fast_timer_test(void)
919 printk("%-10s set: %6is %06ius exp: %6is %06ius " 826 printk("%-10s set: %6is %06ius exp: %6is %06ius "
920 "data: 0x%08X func: 0x%08X\n", 827 "data: 0x%08X func: 0x%08X\n",
921 t->name, 828 t->name,
922 t->tv_set.tv_sec, 829 t->tv_set.tv_jiff,
923 t->tv_set.tv_usec, 830 t->tv_set.tv_usec,
924 t->tv_expires.tv_sec, 831 t->tv_expires.tv_jiff,
925 t->tv_expires.tv_usec, 832 t->tv_expires.tv_usec,
926 t->data, 833 t->data,
927 t->function 834 t->function
@@ -929,10 +836,12 @@ static void fast_timer_test(void)
929 836
930 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n", 837 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n",
931 t->delay_us, 838 t->delay_us,
932 tv_exp[j].tv_sec, 839 tv_exp[j].tv_jiff,
933 tv_exp[j].tv_usec, 840 tv_exp[j].tv_usec,
934 exp_num[j], 841 exp_num[j],
935 (tv_exp[j].tv_sec - t->tv_expires.tv_sec)*1000000 + tv_exp[j].tv_usec - t->tv_expires.tv_usec); 842 (tv_exp[j].tv_jiff - t->tv_expires.tv_jiff) *
843 1000000 + tv_exp[j].tv_usec -
844 t->tv_expires.tv_usec);
936 } 845 }
937 proc_fasttimer_read(buf5, NULL, 0, 0, 0); 846 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
938 printk("buf5 after all done:\n"); 847 printk("buf5 after all done:\n");
@@ -942,7 +851,7 @@ static void fast_timer_test(void)
942#endif 851#endif
943 852
944 853
945void fast_timer_init(void) 854int fast_timer_init(void)
946{ 855{
947 /* For some reason, request_irq() hangs when called froom time_init() */ 856 /* For some reason, request_irq() hangs when called froom time_init() */
948 if (!fast_timer_is_init) 857 if (!fast_timer_is_init)
@@ -975,4 +884,6 @@ void fast_timer_init(void)
975 fast_timer_test(); 884 fast_timer_test();
976#endif 885#endif
977 } 886 }
887 return 0;
978} 888}
889__initcall(fast_timer_init);
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
index 29d48ad00df9..3a9114e89edf 100644
--- a/arch/cris/arch-v10/kernel/io_interface_mux.c
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_
304static struct if_group *get_group(const unsigned char groups) 304static struct if_group *get_group(const unsigned char groups)
305{ 305{
306 int i; 306 int i;
307 for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) { 307 for (i = 0; i < ARRAY_SIZE(if_groups); i++) {
308 if (groups & if_groups[i].group) { 308 if (groups & if_groups[i].group) {
309 return &if_groups[i]; 309 return &if_groups[i];
310 } 310 }
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index 845c95f6e871..e06ab0050d37 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -12,10 +12,16 @@
12 */ 12 */
13 13
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/current.h>
15#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/interrupt.h>
16#include <linux/kernel.h> 18#include <linux/kernel.h>
17#include <linux/init.h> 19#include <linux/init.h>
18 20
21/* From kgdb.c. */
22extern void kgdb_init(void);
23extern void breakpoint(void);
24
19#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); 25#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
20#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); 26#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
21 27
@@ -75,8 +81,8 @@ BUILD_IRQ(12, 0x1000)
75BUILD_IRQ(13, 0x2000) 81BUILD_IRQ(13, 0x2000)
76void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */ 82void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */
77void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */ 83void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */
78BUILD_IRQ(16, 0x10000) 84BUILD_IRQ(16, 0x10000 | 0x20000) /* ethernet tx interrupt needs to block rx */
79BUILD_IRQ(17, 0x20000) 85BUILD_IRQ(17, 0x20000 | 0x10000) /* ...and vice versa */
80BUILD_IRQ(18, 0x40000) 86BUILD_IRQ(18, 0x40000)
81BUILD_IRQ(19, 0x80000) 87BUILD_IRQ(19, 0x80000)
82BUILD_IRQ(20, 0x100000) 88BUILD_IRQ(20, 0x100000)
@@ -147,6 +153,55 @@ void system_call(void); /* from entry.S */
147void do_sigtrap(void); /* from entry.S */ 153void do_sigtrap(void); /* from entry.S */
148void gdb_handle_breakpoint(void); /* from entry.S */ 154void gdb_handle_breakpoint(void); /* from entry.S */
149 155
156extern void do_IRQ(int irq, struct pt_regs * regs);
157
158/* Handle multiple IRQs */
159void do_multiple_IRQ(struct pt_regs* regs)
160{
161 int bit;
162 unsigned masked;
163 unsigned mask;
164 unsigned ethmask = 0;
165
166 /* Get interrupts to mask and handle */
167 mask = masked = *R_VECT_MASK_RD;
168
169 /* Never mask timer IRQ */
170 mask &= ~(IO_MASK(R_VECT_MASK_RD, timer0));
171
172 /*
173 * If either ethernet interrupt (rx or tx) is active then block
174 * the other one too. Unblock afterwards also.
175 */
176 if (mask &
177 (IO_STATE(R_VECT_MASK_RD, dma0, active) |
178 IO_STATE(R_VECT_MASK_RD, dma1, active))) {
179 ethmask = (IO_MASK(R_VECT_MASK_RD, dma0) |
180 IO_MASK(R_VECT_MASK_RD, dma1));
181 }
182
183 /* Block them */
184 *R_VECT_MASK_CLR = (mask | ethmask);
185
186 /* An extra irq_enter here to prevent softIRQs to run after
187 * each do_IRQ. This will decrease the interrupt latency.
188 */
189 irq_enter();
190
191 /* Handle all IRQs */
192 for (bit = 2; bit < 32; bit++) {
193 if (masked & (1 << bit)) {
194 do_IRQ(bit, regs);
195 }
196 }
197
198 /* This irq_exit() will trigger the soft IRQs. */
199 irq_exit();
200
201 /* Unblock the IRQs again */
202 *R_VECT_MASK_SET = (masked | ethmask);
203}
204
150/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and 205/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and
151 setting the irq vector table. 206 setting the irq vector table.
152*/ 207*/
diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
index 682ef955aec4..de27b50b72a2 100644
--- a/arch/cris/arch-v10/kernel/setup.c
+++ b/arch/cris/arch-v10/kernel/setup.c
@@ -13,6 +13,7 @@
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/param.h>
16 17
17#ifdef CONFIG_PROC_FS 18#ifdef CONFIG_PROC_FS
18#define HAS_FPU 0x0001 19#define HAS_FPU 0x0001
@@ -56,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v)
56 57
57 revision = rdvr(); 58 revision = rdvr();
58 59
59 if (revision >= sizeof cpu_info/sizeof *cpu_info) 60 if (revision >= ARRAY_SIZE(cpu_info))
60 info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; 61 info = &cpu_info[ARRAY_SIZE(cpu_info) - 1];
61 else 62 else
62 info = &cpu_info[revision]; 63 info = &cpu_info[revision];
63 64
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 575a14bb1106..5976f6199c47 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -1,5 +1,4 @@
1/* $Id: time.c,v 1.5 2004/09/29 06:12:46 starvik Exp $ 1/*
2 *
3 * linux/arch/cris/arch-v10/kernel/time.c 2 * linux/arch/cris/arch-v10/kernel/time.c
4 * 3 *
5 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
@@ -20,6 +19,7 @@
20#include <asm/io.h> 19#include <asm/io.h>
21#include <asm/delay.h> 20#include <asm/delay.h>
22#include <asm/rtc.h> 21#include <asm/rtc.h>
22#include <asm/irq_regs.h>
23 23
24/* define this if you need to use print_timestamp */ 24/* define this if you need to use print_timestamp */
25/* it will make jiffies at 96 hz instead of 100 hz though */ 25/* it will make jiffies at 96 hz instead of 100 hz though */
@@ -201,8 +201,9 @@ static long last_rtc_update = 0;
201extern void cris_do_profile(struct pt_regs *regs); 201extern void cris_do_profile(struct pt_regs *regs);
202 202
203static inline irqreturn_t 203static inline irqreturn_t
204timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 204timer_interrupt(int irq, void *dev_id)
205{ 205{
206 struct pt_regs *regs = get_irq_regs();
206 /* acknowledge the timer irq */ 207 /* acknowledge the timer irq */
207 208
208#ifdef USE_CASCADE_TIMERS 209#ifdef USE_CASCADE_TIMERS
@@ -221,9 +222,11 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
221#endif 222#endif
222 223
223 /* reset watchdog otherwise it resets us! */ 224 /* reset watchdog otherwise it resets us! */
224
225 reset_watchdog(); 225 reset_watchdog();
226 226
227 /* Update statistics. */
228 update_process_times(user_mode(regs));
229
227 /* call the real timer interrupt handler */ 230 /* call the real timer interrupt handler */
228 231
229 do_timer(1); 232 do_timer(1);
diff --git a/arch/cris/arch-v10/lib/memset.c b/arch/cris/arch-v10/lib/memset.c
index 82bb66839171..42c1101043a3 100644
--- a/arch/cris/arch-v10/lib/memset.c
+++ b/arch/cris/arch-v10/lib/memset.c
@@ -66,7 +66,7 @@ void *memset(void *pdst,
66 66
67 { 67 {
68 register char *dst __asm__ ("r13") = pdst; 68 register char *dst __asm__ ("r13") = pdst;
69 69
70 /* This is NONPORTABLE, but since this whole routine is */ 70 /* This is NONPORTABLE, but since this whole routine is */
71 /* grossly nonportable that doesn't matter. */ 71 /* grossly nonportable that doesn't matter. */
72 72
@@ -110,52 +110,52 @@ void *memset(void *pdst,
110 If you want to check that the allocation was right; then 110 If you want to check that the allocation was right; then
111 check the equalities in the first comment. It should say 111 check the equalities in the first comment. It should say
112 "r13=r13, r12=r12, r11=r11" */ 112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile (" 113 __asm__ volatile ("\n\
114 ;; Check that the following is true (same register names on 114 ;; Check that the following is true (same register names on \n\
115 ;; both sides of equal sign, as in r8=r8): 115 ;; both sides of equal sign, as in r8=r8): \n\
116 ;; %0=r13, %1=r12, %4=r11 116 ;; %0=r13, %1=r12, %4=r11 \n\
117 ;; 117 ;; \n\
118 ;; Save the registers we'll clobber in the movem process 118 ;; Save the registers we'll clobber in the movem process \n\
119 ;; on the stack. Don't mention them to gcc, it will only be 119 ;; on the stack. Don't mention them to gcc, it will only be \n\
120 ;; upset. 120 ;; upset. \n\
121 subq 11*4,$sp 121 subq 11*4,$sp \n\
122 movem $r10,[$sp] 122 movem $r10,[$sp] \n\
123 123 \n\
124 move.d $r11,$r0 124 move.d $r11,$r0 \n\
125 move.d $r11,$r1 125 move.d $r11,$r1 \n\
126 move.d $r11,$r2 126 move.d $r11,$r2 \n\
127 move.d $r11,$r3 127 move.d $r11,$r3 \n\
128 move.d $r11,$r4 128 move.d $r11,$r4 \n\
129 move.d $r11,$r5 129 move.d $r11,$r5 \n\
130 move.d $r11,$r6 130 move.d $r11,$r6 \n\
131 move.d $r11,$r7 131 move.d $r11,$r7 \n\
132 move.d $r11,$r8 132 move.d $r11,$r8 \n\
133 move.d $r11,$r9 133 move.d $r11,$r9 \n\
134 move.d $r11,$r10 134 move.d $r11,$r10 \n\
135 135 \n\
136 ;; Now we've got this: 136 ;; Now we've got this: \n\
137 ;; r13 - dst 137 ;; r13 - dst \n\
138 ;; r12 - n 138 ;; r12 - n \n\
139 139 \n\
140 ;; Update n for the first loop 140 ;; Update n for the first loop \n\
141 subq 12*4,$r12 141 subq 12*4,$r12 \n\
1420: 1420: \n\
143 subq 12*4,$r12 143 subq 12*4,$r12 \n\
144 bge 0b 144 bge 0b \n\
145 movem $r11,[$r13+] 145 movem $r11,[$r13+] \n\
146 146 \n\
147 addq 12*4,$r12 ;; compensate for last loop underflowing n 147 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
148 148 \n\
149 ;; Restore registers from stack 149 ;; Restore registers from stack \n\
150 movem [$sp+],$r10" 150 movem [$sp+],$r10"
151 151
152 /* Outputs */ : "=r" (dst), "=r" (n) 152 /* Outputs */ : "=r" (dst), "=r" (n)
153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); 153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc));
154 154
155 } 155 }
156 156
157 /* Either we directly starts copying, using dword copying 157 /* Either we directly starts copying, using dword copying
158 in a loop, or we copy as much as possible with 'movem' 158 in a loop, or we copy as much as possible with 'movem'
159 and then the last block (<44 bytes) is copied here. 159 and then the last block (<44 bytes) is copied here.
160 This will work since 'movem' will have updated src,dst,n. */ 160 This will work since 'movem' will have updated src,dst,n. */
161 161
diff --git a/arch/cris/arch-v10/lib/string.c b/arch/cris/arch-v10/lib/string.c
index 15d6662b03b1..7161a2bef4fe 100644
--- a/arch/cris/arch-v10/lib/string.c
+++ b/arch/cris/arch-v10/lib/string.c
@@ -95,33 +95,33 @@ void *memcpy(void *pdst,
95 If you want to check that the allocation was right; then 95 If you want to check that the allocation was right; then
96 check the equalities in the first comment. It should say 96 check the equalities in the first comment. It should say
97 "r13=r13, r11=r11, r12=r12" */ 97 "r13=r13, r11=r11, r12=r12" */
98 __asm__ volatile (" 98 __asm__ volatile ("\n\
99 ;; Check that the following is true (same register names on 99 ;; Check that the following is true (same register names on \n\
100 ;; both sides of equal sign, as in r8=r8): 100 ;; both sides of equal sign, as in r8=r8): \n\
101 ;; %0=r13, %1=r11, %2=r12 101 ;; %0=r13, %1=r11, %2=r12 \n\
102 ;; 102 ;; \n\
103 ;; Save the registers we'll use in the movem process 103 ;; Save the registers we'll use in the movem process \n\
104 ;; on the stack. 104 ;; on the stack. \n\
105 subq 11*4,$sp 105 subq 11*4,$sp \n\
106 movem $r10,[$sp] 106 movem $r10,[$sp] \n\
107 107 \n\
108 ;; Now we've got this: 108 ;; Now we've got this: \n\
109 ;; r11 - src 109 ;; r11 - src \n\
110 ;; r13 - dst 110 ;; r13 - dst \n\
111 ;; r12 - n 111 ;; r12 - n \n\
112 112 \n\
113 ;; Update n for the first loop 113 ;; Update n for the first loop \n\
114 subq 44,$r12 114 subq 44,$r12 \n\
1150: 1150: \n\
116 movem [$r11+],$r10 116 movem [$r11+],$r10 \n\
117 subq 44,$r12 117 subq 44,$r12 \n\
118 bge 0b 118 bge 0b \n\
119 movem $r10,[$r13+] 119 movem $r10,[$r13+] \n\
120 120 \n\
121 addq 44,$r12 ;; compensate for last loop underflowing n 121 addq 44,$r12 ;; compensate for last loop underflowing n \n\
122 122 \n\
123 ;; Restore registers from stack 123 ;; Restore registers from stack \n\
124 movem [$sp+],$r10" 124 movem [$sp+],$r10"
125 125
126 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) 126 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n)
127 /* Inputs */ : "0" (dst), "1" (src), "2" (n)); 127 /* Inputs */ : "0" (dst), "1" (src), "2" (n));
diff --git a/arch/cris/arch-v10/lib/usercopy.c b/arch/cris/arch-v10/lib/usercopy.c
index a12c708afc9a..b8e6c0430e5b 100644
--- a/arch/cris/arch-v10/lib/usercopy.c
+++ b/arch/cris/arch-v10/lib/usercopy.c
@@ -92,58 +92,58 @@ __copy_user (void __user *pdst, const void *psrc, unsigned long pn)
92 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ 92 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
93 .err \n\ 93 .err \n\
94 .endif \n\ 94 .endif \n\
95 95 \n\
96 ;; Save the registers we'll use in the movem process 96 ;; Save the registers we'll use in the movem process \n\
97 ;; on the stack. 97 ;; on the stack. \n\
98 subq 11*4,$sp 98 subq 11*4,$sp \n\
99 movem $r10,[$sp] 99 movem $r10,[$sp] \n\
100 100 \n\
101 ;; Now we've got this: 101 ;; Now we've got this: \n\
102 ;; r11 - src 102 ;; r11 - src \n\
103 ;; r13 - dst 103 ;; r13 - dst \n\
104 ;; r12 - n 104 ;; r12 - n \n\
105 105 \n\
106 ;; Update n for the first loop 106 ;; Update n for the first loop \n\
107 subq 44,$r12 107 subq 44,$r12 \n\
108 108 \n\
109; Since the noted PC of a faulting instruction in a delay-slot of a taken 109; Since the noted PC of a faulting instruction in a delay-slot of a taken \n\
110; branch, is that of the branch target, we actually point at the from-movem 110; branch, is that of the branch target, we actually point at the from-movem \n\
111; for this case. There is no ambiguity here; if there was a fault in that 111; for this case. There is no ambiguity here; if there was a fault in that \n\
112; instruction (meaning a kernel oops), the faulted PC would be the address 112; instruction (meaning a kernel oops), the faulted PC would be the address \n\
113; after *that* movem. 113; after *that* movem. \n\
114 114 \n\
1150: 1150: \n\
116 movem [$r11+],$r10 116 movem [$r11+],$r10 \n\
117 subq 44,$r12 117 subq 44,$r12 \n\
118 bge 0b 118 bge 0b \n\
119 movem $r10,[$r13+] 119 movem $r10,[$r13+] \n\
1201: 1201: \n\
121 addq 44,$r12 ;; compensate for last loop underflowing n 121 addq 44,$r12 ;; compensate for last loop underflowing n \n\
122 122 \n\
123 ;; Restore registers from stack 123 ;; Restore registers from stack \n\
124 movem [$sp+],$r10 124 movem [$sp+],$r10 \n\
1252: 1252: \n\
126 .section .fixup,\"ax\" 126 .section .fixup,\"ax\" \n\
127 127 \n\
128; To provide a correct count in r10 of bytes that failed to be copied, 128; To provide a correct count in r10 of bytes that failed to be copied, \n\
129; we jump back into the loop if the loop-branch was taken. There is no 129; we jump back into the loop if the loop-branch was taken. There is no \n\
130; performance penalty for sany use; the program will segfault soon enough. 130; performance penalty for sany use; the program will segfault soon enough.\n\
131 131 \n\
1323: 1323: \n\
133 move.d [$sp],$r10 133 move.d [$sp],$r10 \n\
134 addq 44,$r10 134 addq 44,$r10 \n\
135 move.d $r10,[$sp] 135 move.d $r10,[$sp] \n\
136 jump 0b 136 jump 0b \n\
1374: 1374: \n\
138 movem [$sp+],$r10 138 movem [$sp+],$r10 \n\
139 addq 44,$r10 139 addq 44,$r10 \n\
140 addq 44,$r12 140 addq 44,$r12 \n\
141 jump 2b 141 jump 2b \n\
142 142 \n\
143 .previous 143 .previous \n\
144 .section __ex_table,\"a\" 144 .section __ex_table,\"a\" \n\
145 .dword 0b,3b 145 .dword 0b,3b \n\
146 .dword 1b,4b 146 .dword 1b,4b \n\
147 .previous" 147 .previous"
148 148
149 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) 149 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
@@ -253,59 +253,59 @@ __copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
253 If you want to check that the allocation was right; then 253 If you want to check that the allocation was right; then
254 check the equalities in the first comment. It should say 254 check the equalities in the first comment. It should say
255 "r13=r13, r11=r11, r12=r12" */ 255 "r13=r13, r11=r11, r12=r12" */
256 __asm__ volatile (" 256 __asm__ volatile ("\n\
257 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ 257 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
258 .err \n\ 258 .err \n\
259 .endif \n\ 259 .endif \n\
260 260 \n\
261 ;; Save the registers we'll use in the movem process 261 ;; Save the registers we'll use in the movem process \n\
262 ;; on the stack. 262 ;; on the stack. \n\
263 subq 11*4,$sp 263 subq 11*4,$sp \n\
264 movem $r10,[$sp] 264 movem $r10,[$sp] \n\
265 265 \n\
266 ;; Now we've got this: 266 ;; Now we've got this: \n\
267 ;; r11 - src 267 ;; r11 - src \n\
268 ;; r13 - dst 268 ;; r13 - dst \n\
269 ;; r12 - n 269 ;; r12 - n \n\
270 270 \n\
271 ;; Update n for the first loop 271 ;; Update n for the first loop \n\
272 subq 44,$r12 272 subq 44,$r12 \n\
2730: 2730: \n\
274 movem [$r11+],$r10 274 movem [$r11+],$r10 \n\
2751: 2751: \n\
276 subq 44,$r12 276 subq 44,$r12 \n\
277 bge 0b 277 bge 0b \n\
278 movem $r10,[$r13+] 278 movem $r10,[$r13+] \n\
279 279 \n\
280 addq 44,$r12 ;; compensate for last loop underflowing n 280 addq 44,$r12 ;; compensate for last loop underflowing n \n\
281 281 \n\
282 ;; Restore registers from stack 282 ;; Restore registers from stack \n\
283 movem [$sp+],$r10 283 movem [$sp+],$r10 \n\
2844: 2844: \n\
285 .section .fixup,\"ax\" 285 .section .fixup,\"ax\" \n\
286 286 \n\
287;; Do not jump back into the loop if we fail. For some uses, we get a 287;; Do not jump back into the loop if we fail. For some uses, we get a \n\
288;; page fault somewhere on the line. Without checking for page limits, 288;; page fault somewhere on the line. Without checking for page limits, \n\
289;; we don't know where, but we need to copy accurately and keep an 289;; we don't know where, but we need to copy accurately and keep an \n\
290;; accurate count; not just clear the whole line. To do that, we fall 290;; accurate count; not just clear the whole line. To do that, we fall \n\
291;; down in the code below, proceeding with smaller amounts. It should 291;; down in the code below, proceeding with smaller amounts. It should \n\
292;; be kept in mind that we have to cater to code like what at one time 292;; be kept in mind that we have to cater to code like what at one time \n\
293;; was in fs/super.c: 293;; was in fs/super.c: \n\
294;; i = size - copy_from_user((void *)page, data, size); 294;; i = size - copy_from_user((void *)page, data, size); \n\
295;; which would cause repeated faults while clearing the remainder of 295;; which would cause repeated faults while clearing the remainder of \n\
296;; the SIZE bytes at PAGE after the first fault. 296;; the SIZE bytes at PAGE after the first fault. \n\
297;; A caveat here is that we must not fall through from a failing page 297;; A caveat here is that we must not fall through from a failing page \n\
298;; to a valid page. 298;; to a valid page. \n\
299 299 \n\
3003: 3003: \n\
301 movem [$sp+],$r10 301 movem [$sp+],$r10 \n\
302 addq 44,$r12 ;; Get back count before faulting point. 302 addq 44,$r12 ;; Get back count before faulting point. \n\
303 subq 44,$r11 ;; Get back pointer to faulting movem-line. 303 subq 44,$r11 ;; Get back pointer to faulting movem-line. \n\
304 jump 4b ;; Fall through, pretending the fault didn't happen. 304 jump 4b ;; Fall through, pretending the fault didn't happen.\n\
305 305 \n\
306 .previous 306 .previous \n\
307 .section __ex_table,\"a\" 307 .section __ex_table,\"a\" \n\
308 .dword 1b,3b 308 .dword 1b,3b \n\
309 .previous" 309 .previous"
310 310
311 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) 311 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
@@ -425,64 +425,64 @@ __do_clear_user (void __user *pto, unsigned long pn)
425 If you want to check that the allocation was right; then 425 If you want to check that the allocation was right; then
426 check the equalities in the first comment. It should say 426 check the equalities in the first comment. It should say
427 something like "r13=r13, r11=r11, r12=r12". */ 427 something like "r13=r13, r11=r11, r12=r12". */
428 __asm__ volatile (" 428 __asm__ volatile ("\n\
429 .ifnc %0%1%2,$r13$r12$r10 \n\ 429 .ifnc %0%1%2,$r13$r12$r10 \n\
430 .err \n\ 430 .err \n\
431 .endif \n\ 431 .endif \n\
432 432 \n\
433 ;; Save the registers we'll clobber in the movem process 433 ;; Save the registers we'll clobber in the movem process \n\
434 ;; on the stack. Don't mention them to gcc, it will only be 434 ;; on the stack. Don't mention them to gcc, it will only be \n\
435 ;; upset. 435 ;; upset. \n\
436 subq 11*4,$sp 436 subq 11*4,$sp \n\
437 movem $r10,[$sp] 437 movem $r10,[$sp] \n\
438 438 \n\
439 clear.d $r0 439 clear.d $r0 \n\
440 clear.d $r1 440 clear.d $r1 \n\
441 clear.d $r2 441 clear.d $r2 \n\
442 clear.d $r3 442 clear.d $r3 \n\
443 clear.d $r4 443 clear.d $r4 \n\
444 clear.d $r5 444 clear.d $r5 \n\
445 clear.d $r6 445 clear.d $r6 \n\
446 clear.d $r7 446 clear.d $r7 \n\
447 clear.d $r8 447 clear.d $r8 \n\
448 clear.d $r9 448 clear.d $r9 \n\
449 clear.d $r10 449 clear.d $r10 \n\
450 clear.d $r11 450 clear.d $r11 \n\
451 451 \n\
452 ;; Now we've got this: 452 ;; Now we've got this: \n\
453 ;; r13 - dst 453 ;; r13 - dst \n\
454 ;; r12 - n 454 ;; r12 - n \n\
455 455 \n\
456 ;; Update n for the first loop 456 ;; Update n for the first loop \n\
457 subq 12*4,$r12 457 subq 12*4,$r12 \n\
4580: 4580: \n\
459 subq 12*4,$r12 459 subq 12*4,$r12 \n\
460 bge 0b 460 bge 0b \n\
461 movem $r11,[$r13+] 461 movem $r11,[$r13+] \n\
4621: 4621: \n\
463 addq 12*4,$r12 ;; compensate for last loop underflowing n 463 addq 12*4,$r12 ;; compensate for last loop underflowing n\n\
464 464 \n\
465 ;; Restore registers from stack 465 ;; Restore registers from stack \n\
466 movem [$sp+],$r10 466 movem [$sp+],$r10 \n\
4672: 4672: \n\
468 .section .fixup,\"ax\" 468 .section .fixup,\"ax\" \n\
4693: 4693: \n\
470 move.d [$sp],$r10 470 move.d [$sp],$r10 \n\
471 addq 12*4,$r10 471 addq 12*4,$r10 \n\
472 move.d $r10,[$sp] 472 move.d $r10,[$sp] \n\
473 clear.d $r10 473 clear.d $r10 \n\
474 jump 0b 474 jump 0b \n\
475 475 \n\
4764: 4764: \n\
477 movem [$sp+],$r10 477 movem [$sp+],$r10 \n\
478 addq 12*4,$r10 478 addq 12*4,$r10 \n\
479 addq 12*4,$r12 479 addq 12*4,$r12 \n\
480 jump 2b 480 jump 2b \n\
481 481 \n\
482 .previous 482 .previous \n\
483 .section __ex_table,\"a\" 483 .section __ex_table,\"a\" \n\
484 .dword 0b,3b 484 .dword 0b,3b \n\
485 .dword 1b,4b 485 .dword 1b,4b \n\
486 .previous" 486 .previous"
487 487
488 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn) 488 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn)
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index cc6ba5423754..7f72d7c9e1ce 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -362,8 +362,6 @@ config ETRAX_AXISFLASHMAP
362 select MTD 362 select MTD
363 select MTD_CFI 363 select MTD_CFI
364 select MTD_CFI_AMDSTD 364 select MTD_CFI_AMDSTD
365 select MTD_OBSOLETE_CHIPS
366 select MTD_AMDSTD
367 select MTD_CHAR 365 select MTD_CHAR
368 select MTD_BLOCK 366 select MTD_BLOCK
369 select MTD_PARTITIONS 367 select MTD_PARTITIONS
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 3ec12ea44e8e..c5ff95e18269 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -190,13 +190,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", 190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
191 map_cs->name, map_cs->size, map_cs->map_priv_1); 191 map_cs->name, map_cs->size, map_cs->map_priv_1);
192 192
193#ifdef CONFIG_MTD_AMDSTD
194 mtd_cs = do_map_probe("amd_flash", map_cs);
195#endif
196#ifdef CONFIG_MTD_CFI 193#ifdef CONFIG_MTD_CFI
197 if (!mtd_cs) {
198 mtd_cs = do_map_probe("cfi_probe", map_cs); 194 mtd_cs = do_map_probe("cfi_probe", map_cs);
199 } 195#endif
196#ifdef CONFIG_MTD_JEDECPROBE
197 if (!mtd_cs)
198 mtd_cs = do_map_probe("jedec_probe", map_cs);
200#endif 199#endif
201 200
202 return mtd_cs; 201 return mtd_cs;
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index df89298aafc4..d581b0a92a3f 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -185,7 +185,7 @@ static struct sync_port ports[]=
185 } 185 }
186}; 186};
187 187
188#define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) 188#define NUMBER_OF_PORTS ARRAY_SIZE(ports)
189 189
190static const struct file_operations sync_serial_fops = { 190static const struct file_operations sync_serial_fops = {
191 .owner = THIS_MODULE, 191 .owner = THIS_MODULE,
diff --git a/arch/cris/arch-v32/kernel/cache.c b/arch/cris/arch-v32/kernel/cache.c
new file mode 100644
index 000000000000..80da7b88a72b
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/cache.c
@@ -0,0 +1,33 @@
1#include <linux/module.h>
2#include <asm/io.h>
3#include <asm/arch/cache.h>
4#include <asm/arch/hwregs/dma.h>
5
6/* This file is used to workaround a cache bug, Guinness TR 106. */
7
8inline void flush_dma_descr(struct dma_descr_data *descr, int flush_buf)
9{
10 /* Flush descriptor to make sure we get correct in_eop and after. */
11 asm volatile ("ftagd [%0]" :: "r" (descr));
12 /* Flush buffer pointed out by descriptor. */
13 if (flush_buf)
14 cris_flush_cache_range(phys_to_virt((unsigned)descr->buf),
15 (unsigned)(descr->after - descr->buf));
16}
17EXPORT_SYMBOL(flush_dma_descr);
18
19void flush_dma_list(struct dma_descr_data *descr)
20{
21 while (1) {
22 flush_dma_descr(descr, 1);
23 if (descr->eol)
24 break;
25 descr = phys_to_virt((unsigned)descr->next);
26 }
27}
28EXPORT_SYMBOL(flush_dma_list);
29
30/* From cacheflush.S */
31EXPORT_SYMBOL(cris_flush_cache);
32/* From cacheflush.S */
33EXPORT_SYMBOL(cris_flush_cache_range);
diff --git a/arch/cris/arch-v32/kernel/cacheflush.S b/arch/cris/arch-v32/kernel/cacheflush.S
new file mode 100644
index 000000000000..956e8fb82f01
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/cacheflush.S
@@ -0,0 +1,94 @@
1 .global cris_flush_cache_range
2cris_flush_cache_range:
3 move.d 1024, $r12
4 cmp.d $r11, $r12
5 bhi cris_flush_1KB
6 nop
7 add.d $r10, $r11
8 ftagd [$r10]
9cris_flush_last:
10 addq 32, $r10
11 cmp.d $r11, $r10
12 blt cris_flush_last
13 ftagd [$r10]
14 ret
15 nop
16cris_flush_1KB:
17 ftagd [$r10]
18 addq 32, $r10
19 ftagd [$r10]
20 addq 32, $r10
21 ftagd [$r10]
22 addq 32, $r10
23 ftagd [$r10]
24 addq 32, $r10
25 ftagd [$r10]
26 addq 32, $r10
27 ftagd [$r10]
28 addq 32, $r10
29 ftagd [$r10]
30 addq 32, $r10
31 ftagd [$r10]
32 addq 32, $r10
33 ftagd [$r10]
34 addq 32, $r10
35 ftagd [$r10]
36 addq 32, $r10
37 ftagd [$r10]
38 addq 32, $r10
39 ftagd [$r10]
40 addq 32, $r10
41 ftagd [$r10]
42 addq 32, $r10
43 ftagd [$r10]
44 addq 32, $r10
45 ftagd [$r10]
46 addq 32, $r10
47 ftagd [$r10]
48 addq 32, $r10
49 ftagd [$r10]
50 addq 32, $r10
51 ftagd [$r10]
52 addq 32, $r10
53 ftagd [$r10]
54 addq 32, $r10
55 ftagd [$r10]
56 addq 32, $r10
57 ftagd [$r10]
58 addq 32, $r10
59 ftagd [$r10]
60 addq 32, $r10
61 ftagd [$r10]
62 addq 32, $r10
63 ftagd [$r10]
64 addq 32, $r10
65 ftagd [$r10]
66 addq 32, $r10
67 ftagd [$r10]
68 addq 32, $r10
69 ftagd [$r10]
70 addq 32, $r10
71 ftagd [$r10]
72 addq 32, $r10
73 ftagd [$r10]
74 addq 32, $r10
75 ftagd [$r10]
76 addq 32, $r10
77 ftagd [$r10]
78 addq 32, $r10
79 ftagd [$r10]
80 addq 32, $r10
81 ba cris_flush_cache_range
82 sub.d $r12, $r11
83
84 .global cris_flush_cache
85cris_flush_cache:
86 moveq 0, $r10
87cris_flush_line:
88 move.d 16*1024, $r11
89 addq 16, $r10
90 cmp.d $r10, $r11
91 blt cris_flush_line
92 fidxd [$r10]
93 ret
94 nop
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c
index dfbfcb8d2585..a22a9e02e093 100644
--- a/arch/cris/arch-v32/kernel/io.c
+++ b/arch/cris/arch-v32/kernel/io.c
@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] =
49 } 49 }
50}; 50};
51 51
52#define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport) 52#define NBR_OF_PORTS ARRAY_SIZE(crisv32_ioports)
53 53
54struct crisv32_iopin crisv32_led1_green; 54struct crisv32_iopin crisv32_led1_green;
55struct crisv32_iopin crisv32_led1_red; 55struct crisv32_iopin crisv32_led1_red;
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
index 4662f363df63..72e9e8331f63 100644
--- a/arch/cris/arch-v32/kernel/setup.c
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v)
54{ 54{
55 int i; 55 int i;
56 int cpu = (int)v - 1; 56 int cpu = (int)v - 1;
57 int entries;
58 unsigned long revision; 57 unsigned long revision;
59 struct cpu_info *info; 58 struct cpu_info *info;
60 59
61 entries = sizeof cpinfo / sizeof(struct cpu_info); 60 info = &cpinfo[ARRAY_SIZE(cpinfo) - 1];
62 info = &cpinfo[entries - 1];
63 61
64#ifdef CONFIG_SMP 62#ifdef CONFIG_SMP
65 if (!cpu_online(cpu)) 63 if (!cpu_online(cpu))
@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v)
68 66
69 revision = rdvr(); 67 revision = rdvr();
70 68
71 for (i = 0; i < entries; i++) { 69 for (i = 0; i < ARRAY_SIZE(cpinfo); i++) {
72 if (cpinfo[i].rev == revision) { 70 if (cpinfo[i].rev == revision) {
73 info = &cpinfo[i]; 71 info = &cpinfo[i];
74 break; 72 break;
diff --git a/arch/cris/defconfig b/arch/cris/defconfig
index 142a10818af3..9c33ae659934 100644
--- a/arch/cris/defconfig
+++ b/arch/cris/defconfig
@@ -226,8 +226,6 @@ CONFIG_MTD_CFI_UTIL=y
226CONFIG_MTD_RAM=y 226CONFIG_MTD_RAM=y
227# CONFIG_MTD_ROM is not set 227# CONFIG_MTD_ROM is not set
228# CONFIG_MTD_ABSENT is not set 228# CONFIG_MTD_ABSENT is not set
229CONFIG_MTD_OBSOLETE_CHIPS=y
230CONFIG_MTD_AMDSTD=y
231# CONFIG_MTD_SHARP is not set 229# CONFIG_MTD_SHARP is not set
232# CONFIG_MTD_JEDEC is not set 230# CONFIG_MTD_JEDEC is not set
233 231
@@ -276,6 +274,7 @@ CONFIG_MTDRAM_ABS_POS=0x0
276# CONFIG_BLK_DEV_FD is not set 274# CONFIG_BLK_DEV_FD is not set
277# CONFIG_BLK_DEV_COW_COMMON is not set 275# CONFIG_BLK_DEV_COW_COMMON is not set
278# CONFIG_BLK_DEV_LOOP is not set 276# CONFIG_BLK_DEV_LOOP is not set
277# CONFIG_BLK_DEV_CRYPTOLOOP is not set
279# CONFIG_BLK_DEV_NBD is not set 278# CONFIG_BLK_DEV_NBD is not set
280# CONFIG_BLK_DEV_UB is not set 279# CONFIG_BLK_DEV_UB is not set
281CONFIG_BLK_DEV_RAM=y 280CONFIG_BLK_DEV_RAM=y
@@ -302,16 +301,14 @@ CONFIG_IOSCHED_CFQ=y
302# 301#
303# ATA/ATAPI/MFM/RLL support 302# ATA/ATAPI/MFM/RLL support
304# 303#
305CONFIG_IDE=y 304# CONFIG_IDE is not set
306CONFIG_BLK_DEV_IDE=y 305# CONFIG_PARIDE is not set
307 306
308# 307#
309# Please see Documentation/ide.txt for help/info on IDE drives 308# Please see Documentation/ide.txt for help/info on IDE drives
310# 309#
311# CONFIG_BLK_DEV_IDE_SATA is not set 310# CONFIG_BLK_DEV_IDE_SATA is not set
312CONFIG_BLK_DEV_IDEDISK=y
313# CONFIG_IDEDISK_MULTI_MODE is not set 311# CONFIG_IDEDISK_MULTI_MODE is not set
314CONFIG_BLK_DEV_IDECD=y
315# CONFIG_BLK_DEV_IDETAPE is not set 312# CONFIG_BLK_DEV_IDETAPE is not set
316# CONFIG_BLK_DEV_IDEFLOPPY is not set 313# CONFIG_BLK_DEV_IDEFLOPPY is not set
317# CONFIG_IDE_TASK_IOCTL is not set 314# CONFIG_IDE_TASK_IOCTL is not set
@@ -321,7 +318,6 @@ CONFIG_BLK_DEV_IDECD=y
321# 318#
322# CONFIG_IDE_GENERIC is not set 319# CONFIG_IDE_GENERIC is not set
323# CONFIG_IDE_ARM is not set 320# CONFIG_IDE_ARM is not set
324CONFIG_BLK_DEV_IDEDMA=y
325# CONFIG_IDEDMA_AUTO is not set 321# CONFIG_IDEDMA_AUTO is not set
326# CONFIG_BLK_DEV_HD is not set 322# CONFIG_BLK_DEV_HD is not set
327 323
@@ -329,6 +325,7 @@ CONFIG_BLK_DEV_IDEDMA=y
329# SCSI device support 325# SCSI device support
330# 326#
331# CONFIG_SCSI is not set 327# CONFIG_SCSI is not set
328# CONFIG_ISCSI_TCP is not set
332 329
333# 330#
334# IEEE 1394 (FireWire) support 331# IEEE 1394 (FireWire) support
@@ -414,26 +411,11 @@ CONFIG_NETFILTER=y
414# CONFIG_NET_POLL_CONTROLLER is not set 411# CONFIG_NET_POLL_CONTROLLER is not set
415# CONFIG_HAMRADIO is not set 412# CONFIG_HAMRADIO is not set
416# CONFIG_IRDA is not set 413# CONFIG_IRDA is not set
417CONFIG_BT=y 414# CONFIG_AF_RXRPC is not set
418CONFIG_BT_L2CAP=y 415# CONFIG_AF_RXRPC_DEBUG is not set
419# CONFIG_BT_SCO is not set 416# CONFIG_BT is not set
420CONFIG_BT_RFCOMM=y 417# CONFIG_I2C is not set
421# CONFIG_BT_RFCOMM_TTY is not set 418
422CONFIG_BT_BNEP=y
423# CONFIG_BT_BNEP_MC_FILTER is not set
424# CONFIG_BT_BNEP_PROTO_FILTER is not set
425# CONFIG_BT_HIDP is not set
426
427#
428# Bluetooth device drivers
429#
430CONFIG_BT_HCIUSB=y
431# CONFIG_BT_HCIUSB_SCO is not set
432# CONFIG_BT_HCIUART is not set
433# CONFIG_BT_HCIBCM203X is not set
434# CONFIG_BT_HCIBPA10X is not set
435# CONFIG_BT_HCIBFUSB is not set
436# CONFIG_BT_HCIVHCI is not set
437CONFIG_NETDEVICES=y 419CONFIG_NETDEVICES=y
438# CONFIG_DUMMY is not set 420# CONFIG_DUMMY is not set
439# CONFIG_BONDING is not set 421# CONFIG_BONDING is not set
@@ -485,31 +467,17 @@ CONFIG_NET_ETHERNET=y
485# 467#
486# Input device support 468# Input device support
487# 469#
488CONFIG_INPUT=y 470# CONFIG_INPUT is not set
489
490#
491# Userland interfaces
492#
493CONFIG_INPUT_MOUSEDEV=y
494CONFIG_INPUT_MOUSEDEV_PSAUX=y
495CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
496CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
497# CONFIG_INPUT_JOYDEV is not set
498# CONFIG_INPUT_TSDEV is not set
499# CONFIG_INPUT_EVDEV is not set
500# CONFIG_INPUT_EVBUG is not set
501 471
502# 472#
503# Input I/O drivers 473# Input I/O drivers
504# 474#
505# CONFIG_GAMEPORT is not set
506CONFIG_SOUND_GAMEPORT=y
507CONFIG_SERIO=y 475CONFIG_SERIO=y
508# CONFIG_SERIO_I8042 is not set 476# CONFIG_SERIO_I8042 is not set
509# CONFIG_SERIO_SERPORT is not set 477# CONFIG_SERIO_SERPORT is not set
510# CONFIG_SERIO_CT82C710 is not set 478# CONFIG_SERIO_LIBPS2 is not set
511CONFIG_SERIO_LIBPS2=y
512# CONFIG_SERIO_RAW is not set 479# CONFIG_SERIO_RAW is not set
480# CONFIG_GAMEPORT is not set
513 481
514# 482#
515# Input Device Drivers 483# Input Device Drivers
@@ -525,6 +493,7 @@ CONFIG_MOUSE_PS2=y
525# CONFIG_MOUSE_SERIAL is not set 493# CONFIG_MOUSE_SERIAL is not set
526# CONFIG_MOUSE_VSXXXAA is not set 494# CONFIG_MOUSE_VSXXXAA is not set
527# CONFIG_INPUT_JOYSTICK is not set 495# CONFIG_INPUT_JOYSTICK is not set
496# CONFIG_INPUT_TABLET is not set
528# CONFIG_INPUT_TOUCHSCREEN is not set 497# CONFIG_INPUT_TOUCHSCREEN is not set
529# CONFIG_INPUT_MISC is not set 498# CONFIG_INPUT_MISC is not set
530 499
@@ -542,6 +511,8 @@ CONFIG_MOUSE_PS2=y
542# 511#
543# Non-8250 serial port support 512# Non-8250 serial port support
544# 513#
514CONFIG_SERIAL_CORE=y
515CONFIG_SERIAL_CORE_CONSOLE=y
545CONFIG_UNIX98_PTYS=y 516CONFIG_UNIX98_PTYS=y
546CONFIG_LEGACY_PTYS=y 517CONFIG_LEGACY_PTYS=y
547CONFIG_LEGACY_PTY_COUNT=256 518CONFIG_LEGACY_PTY_COUNT=256
@@ -559,6 +530,8 @@ CONFIG_LEGACY_PTY_COUNT=256
559# CONFIG_GEN_RTC is not set 530# CONFIG_GEN_RTC is not set
560# CONFIG_DTLK is not set 531# CONFIG_DTLK is not set
561# CONFIG_R3964 is not set 532# CONFIG_R3964 is not set
533# CONFIG_RTC_LIB is not set
534# CONFIG_RTC_CLASS is not set
562 535
563# 536#
564# Ftape, the floppy tape device driver 537# Ftape, the floppy tape device driver
@@ -660,7 +633,9 @@ CONFIG_NFS_V3=y
660# CONFIG_NFSD is not set 633# CONFIG_NFSD is not set
661CONFIG_LOCKD=y 634CONFIG_LOCKD=y
662CONFIG_LOCKD_V4=y 635CONFIG_LOCKD_V4=y
636CONFIG_NFS_COMMON=y
663CONFIG_SUNRPC=y 637CONFIG_SUNRPC=y
638# CONFIG_SUNRPC_BIND34 is not set
664# CONFIG_RPCSEC_GSS_KRB5 is not set 639# CONFIG_RPCSEC_GSS_KRB5 is not set
665# CONFIG_RPCSEC_GSS_SPKM3 is not set 640# CONFIG_RPCSEC_GSS_SPKM3 is not set
666# CONFIG_SMB_FS is not set 641# CONFIG_SMB_FS is not set
@@ -686,9 +661,21 @@ CONFIG_MSDOS_PARTITION=y
686# CONFIG_SOUND is not set 661# CONFIG_SOUND is not set
687 662
688# 663#
664# Generic devices
665#
666# CONFIG_SND_MPU401_UART is not set
667# CONFIG_SND_DUMMY is not set
668# CONFIG_SND_VIRMIDI is not set
669# CONFIG_SND_MTPAV is not set
670# CONFIG_SND_SERIAL_U16550 is not set
671# CONFIG_SND_MPU401 is not set
672
673#
689# PCCARD (PCMCIA/CardBus) support 674# PCCARD (PCMCIA/CardBus) support
690# 675#
691# CONFIG_PCCARD is not set 676# CONFIG_PCCARD is not set
677# CONFIG_PARPORT_PC_PCMCIA is not set
678# CONFIG_NET_PCMCIA is not set
692 679
693# 680#
694# PC-card bridges 681# PC-card bridges
@@ -734,6 +721,7 @@ CONFIG_USB_DEVICEFS=y
734# USB Input Devices 721# USB Input Devices
735# 722#
736# CONFIG_USB_HID is not set 723# CONFIG_USB_HID is not set
724# HID_SUPPORT is not set
737 725
738# 726#
739# USB HID Boot Protocol drivers 727# USB HID Boot Protocol drivers
@@ -829,7 +817,7 @@ CONFIG_USB_RTL8150=y
829 817
830# 818#
831# Hardware crypto devices 819# Hardware crypto devices
832# 820# CONFIG_CRYPTO_HW is not set
833 821
834# 822#
835# Library routines 823# Library routines
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 105bb5ed48f7..62f0e752915a 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -27,6 +27,7 @@ extern void __Mod(void);
27extern void __ashldi3(void); 27extern void __ashldi3(void);
28extern void __ashrdi3(void); 28extern void __ashrdi3(void);
29extern void __lshrdi3(void); 29extern void __lshrdi3(void);
30extern void __negdi2(void);
30extern void iounmap(volatile void * __iomem); 31extern void iounmap(volatile void * __iomem);
31 32
32/* Platform dependent support */ 33/* Platform dependent support */
@@ -34,19 +35,6 @@ EXPORT_SYMBOL(kernel_thread);
34EXPORT_SYMBOL(get_cmos_time); 35EXPORT_SYMBOL(get_cmos_time);
35EXPORT_SYMBOL(loops_per_usec); 36EXPORT_SYMBOL(loops_per_usec);
36 37
37/* String functions */
38EXPORT_SYMBOL(memcmp);
39EXPORT_SYMBOL(memmove);
40EXPORT_SYMBOL(strstr);
41EXPORT_SYMBOL(strcpy);
42EXPORT_SYMBOL(strchr);
43EXPORT_SYMBOL(strcmp);
44EXPORT_SYMBOL(strlen);
45EXPORT_SYMBOL(strcat);
46EXPORT_SYMBOL(strncat);
47EXPORT_SYMBOL(strncmp);
48EXPORT_SYMBOL(strncpy);
49
50/* Math functions */ 38/* Math functions */
51EXPORT_SYMBOL(__Udiv); 39EXPORT_SYMBOL(__Udiv);
52EXPORT_SYMBOL(__Umod); 40EXPORT_SYMBOL(__Umod);
@@ -55,6 +43,7 @@ EXPORT_SYMBOL(__Mod);
55EXPORT_SYMBOL(__ashldi3); 43EXPORT_SYMBOL(__ashldi3);
56EXPORT_SYMBOL(__ashrdi3); 44EXPORT_SYMBOL(__ashrdi3);
57EXPORT_SYMBOL(__lshrdi3); 45EXPORT_SYMBOL(__lshrdi3);
46EXPORT_SYMBOL(__negdi2);
58 47
59/* Memory functions */ 48/* Memory functions */
60EXPORT_SYMBOL(__ioremap); 49EXPORT_SYMBOL(__ioremap);
@@ -84,4 +73,4 @@ EXPORT_SYMBOL(start_one_shot_timer);
84EXPORT_SYMBOL(del_fast_timer); 73EXPORT_SYMBOL(del_fast_timer);
85EXPORT_SYMBOL(schedule_usleep); 74EXPORT_SYMBOL(schedule_usleep);
86#endif 75#endif
87 76EXPORT_SYMBOL(csum_partial);
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 5c27ff86121b..2dfac8c79090 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * linux/arch/cris/kernel/irq.c 3 * linux/arch/cris/kernel/irq.c
4 * 4 *
5 * Copyright (c) 2000,2001 Axis Communications AB 5 * Copyright (c) 2000,2007 Axis Communications AB
6 * 6 *
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
@@ -92,14 +92,16 @@ skip:
92asmlinkage void do_IRQ(int irq, struct pt_regs * regs) 92asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
93{ 93{
94 unsigned long sp; 94 unsigned long sp;
95 struct pt_regs *old_regs = set_irq_regs(regs);
95 irq_enter(); 96 irq_enter();
96 sp = rdsp(); 97 sp = rdsp();
97 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) { 98 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
98 printk("do_IRQ: stack overflow: %lX\n", sp); 99 printk("do_IRQ: stack overflow: %lX\n", sp);
99 show_stack(NULL, (unsigned long *)sp); 100 show_stack(NULL, (unsigned long *)sp);
100 } 101 }
101 __do_IRQ(irq, regs); 102 __do_IRQ(irq);
102 irq_exit(); 103 irq_exit();
104 set_irq_regs(old_regs);
103} 105}
104 106
105void weird_irq(void) 107void weird_irq(void)
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 123451c44154..9ca558fc5bc8 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -195,6 +195,11 @@ EXPORT_SYMBOL(enable_hlt);
195 */ 195 */
196void (*pm_idle)(void); 196void (*pm_idle)(void);
197 197
198extern void default_idle(void);
199
200void (*pm_power_off)(void);
201EXPORT_SYMBOL(pm_power_off);
202
198/* 203/*
199 * The idle thread. There's no useful work to be 204 * The idle thread. There's no useful work to be
200 * done, so just try to conserve power and have a 205 * done, so just try to conserve power and have a
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index 1085d037027b..3ccd20e85dce 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -81,13 +81,13 @@
81/* notification of userspace execution resumption 81/* notification of userspace execution resumption
82 * - triggered by current->work.notify_resume 82 * - triggered by current->work.notify_resume
83 */ 83 */
84extern int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); 84extern int do_signal(int canrestart, struct pt_regs *regs);
85 85
86 86
87void do_notify_resume(int canrestart, sigset_t *oldset, struct pt_regs *regs, 87void do_notify_resume(int canrestart, struct pt_regs *regs,
88 __u32 thread_info_flags ) 88 __u32 thread_info_flags )
89{ 89{
90 /* deal with pending signal delivery */ 90 /* deal with pending signal delivery */
91 if (thread_info_flags & _TIF_SIGPENDING) 91 if (thread_info_flags & _TIF_SIGPENDING)
92 do_signal(canrestart,oldset,regs); 92 do_signal(canrestart,regs);
93} 93}
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 514359b8122e..8b9984197edc 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/fs.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
17#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
18#include <linux/sem.h> 19#include <linux/sem.h>
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index acfd04559405..7a2cc7efbcf8 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -171,10 +171,6 @@ get_cmos_time(void)
171 mon = CMOS_READ(RTC_MONTH); 171 mon = CMOS_READ(RTC_MONTH);
172 year = CMOS_READ(RTC_YEAR); 172 year = CMOS_READ(RTC_YEAR);
173 173
174 printk(KERN_DEBUG
175 "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n",
176 sec, min, hour, day, mon, year);
177
178 BCD_TO_BIN(sec); 174 BCD_TO_BIN(sec);
179 BCD_TO_BIN(min); 175 BCD_TO_BIN(min);
180 BCD_TO_BIN(hour); 176 BCD_TO_BIN(hour);
@@ -207,12 +203,12 @@ void
207cris_do_profile(struct pt_regs* regs) 203cris_do_profile(struct pt_regs* regs)
208{ 204{
209 205
210#if CONFIG_SYSTEM_PROFILER 206#ifdef CONFIG_SYSTEM_PROFILER
211 cris_profile_sample(regs); 207 cris_profile_sample(regs);
212#endif 208#endif
213 209
214#if CONFIG_PROFILING 210#ifdef CONFIG_PROFILING
215 profile_tick(CPU_PROFILING, regs); 211 profile_tick(CPU_PROFILING);
216#endif 212#endif
217} 213}
218 214
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 5181bf551f3c..8e8f8b6193ee 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1113 if (md->num_pages == 0) /* should not happen */ 1113 if (md->num_pages == 0) /* should not happen */
1114 continue; 1114 continue;
1115 1115
1116 flags = IORESOURCE_MEM; 1116 flags = IORESOURCE_MEM | IORESOURCE_BUSY;
1117 switch (md->type) { 1117 switch (md->type) {
1118 1118
1119 case EFI_MEMORY_MAPPED_IO: 1119 case EFI_MEMORY_MAPPED_IO:
@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1135 1135
1136 case EFI_ACPI_MEMORY_NVS: 1136 case EFI_ACPI_MEMORY_NVS:
1137 name = "ACPI Non-volatile Storage"; 1137 name = "ACPI Non-volatile Storage";
1138 flags |= IORESOURCE_BUSY;
1139 break; 1138 break;
1140 1139
1141 case EFI_UNUSABLE_MEMORY: 1140 case EFI_UNUSABLE_MEMORY:
1142 name = "reserved"; 1141 name = "reserved";
1143 flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED; 1142 flags |= IORESOURCE_DISABLED;
1144 break; 1143 break;
1145 1144
1146 case EFI_RESERVED_TYPE: 1145 case EFI_RESERVED_TYPE:
@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1149 case EFI_ACPI_RECLAIM_MEMORY: 1148 case EFI_ACPI_RECLAIM_MEMORY:
1150 default: 1149 default:
1151 name = "reserved"; 1150 name = "reserved";
1152 flags |= IORESOURCE_BUSY;
1153 break; 1151 break;
1154 } 1152 }
1155 1153
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 33506ff25910..5b10ac133ec8 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -430,6 +430,7 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t __user *new,
430 break; 430 break;
431 431
432 default: 432 default:
433 spin_unlock_irq(&current->sighand->siglock);
433 return -EINVAL; 434 return -EINVAL;
434 } 435 }
435 recalc_sigpending(); 436 recalc_sigpending();
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 1899601e5862..3f23d9fda662 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -525,6 +525,7 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign)
525 intassign1 |= (uint16_t)assign << 9; 525 intassign1 |= (uint16_t)assign << 9;
526 break; 526 break;
527 default: 527 default:
528 spin_unlock_irq(&desc->lock);
528 return -EINVAL; 529 return -EINVAL;
529 } 530 }
530 531
@@ -592,6 +593,7 @@ static inline int set_sysint2_assign(unsigned int irq, unsigned char assign)
592 intassign3 |= (uint16_t)assign << 12; 593 intassign3 |= (uint16_t)assign << 12;
593 break; 594 break;
594 default: 595 default:
596 spin_unlock_irq(&desc->lock);
595 return -EINVAL; 597 return -EINVAL;
596 } 598 }
597 599
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 4e165342210a..bd87626c1f60 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -107,6 +107,9 @@ endif
107# No AltiVec instruction when building kernel 107# No AltiVec instruction when building kernel
108KBUILD_CFLAGS += $(call cc-option,-mno-altivec) 108KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
109 109
110# No SPE instruction when building kernel
111KBUILD_CFLAGS += $(call cc-option,-mno-spe)
112
110# Enable unit-at-a-time mode when possible. It shrinks the 113# Enable unit-at-a-time mode when possible. It shrinks the
111# kernel considerably. 114# kernel considerably.
112KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) 115KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 3ef51fb6f107..9c74fdf29eec 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -186,7 +186,9 @@ int btext_initialize(struct device_node *np)
186 pitch = *prop; 186 pitch = *prop;
187 if (pitch == 1) 187 if (pitch == 1)
188 pitch = 0x1000; 188 pitch = 0x1000;
189 prop = of_get_property(np, "address", NULL); 189 prop = of_get_property(np, "linux,bootx-addr", NULL);
190 if (prop == NULL)
191 prop = of_get_property(np, "address", NULL);
190 if (prop) 192 if (prop)
191 address = *prop; 193 address = *prop;
192 194
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index a7572cf464bd..69a91bd46115 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -251,6 +251,9 @@ syscall_exit_cont:
251 bne- 2f 251 bne- 2f
2521: 2521:
253#endif /* CONFIG_44x */ 253#endif /* CONFIG_44x */
254BEGIN_FTR_SECTION
255 lwarx r7,0,r1
256END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
254 stwcx. r0,0,r1 /* to clear the reservation */ 257 stwcx. r0,0,r1 /* to clear the reservation */
255 lwz r4,_LINK(r1) 258 lwz r4,_LINK(r1)
256 lwz r5,_CCR(r1) 259 lwz r5,_CCR(r1)
@@ -717,6 +720,9 @@ restore:
717 mtctr r11 720 mtctr r11
718 721
719 PPC405_ERR77(0,r1) 722 PPC405_ERR77(0,r1)
723BEGIN_FTR_SECTION
724 lwarx r11,0,r1
725END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
720 stwcx. r0,0,r1 /* to clear the reservation */ 726 stwcx. r0,0,r1 /* to clear the reservation */
721 727
722#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 728#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 4beb6329dfb7..c0d77723ba11 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -829,7 +829,7 @@ static void register_decrementer_clockevent(int cpu)
829 *dec = decrementer_clockevent; 829 *dec = decrementer_clockevent;
830 dec->cpumask = cpumask_of_cpu(cpu); 830 dec->cpumask = cpumask_of_cpu(cpu);
831 831
832 printk(KERN_INFO "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", 832 printk(KERN_DEBUG "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n",
833 dec->name, dec->mult, dec->shift, cpu); 833 dec->name, dec->mult, dec->shift, cpu);
834 834
835 clockevents_register_device(dec); 835 clockevents_register_device(dec);
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index d9c82d3d6482..c0f5cff77035 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -19,8 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#undef DEBUG
23
24#include <linux/signal.h> 22#include <linux/signal.h>
25#include <linux/sched.h> 23#include <linux/sched.h>
26#include <linux/kernel.h> 24#include <linux/kernel.h>
@@ -66,12 +64,6 @@
66 64
67#include "mmu_decl.h" 65#include "mmu_decl.h"
68 66
69#ifdef DEBUG
70#define DBG(fmt...) printk(fmt)
71#else
72#define DBG(fmt...)
73#endif
74
75#if PGTABLE_RANGE > USER_VSID_RANGE 67#if PGTABLE_RANGE > USER_VSID_RANGE
76#warning Limited user VSID range means pagetable space is wasted 68#warning Limited user VSID range means pagetable space is wasted
77#endif 69#endif
@@ -175,8 +167,8 @@ void pgtable_cache_init(void)
175 int size = pgtable_cache_size[i]; 167 int size = pgtable_cache_size[i];
176 const char *name = pgtable_cache_name[i]; 168 const char *name = pgtable_cache_name[i];
177 169
178 DBG("Allocating page table cache %s (#%d) " 170 pr_debug("Allocating page table cache %s (#%d) "
179 "for size: %08x...\n", name, i, size); 171 "for size: %08x...\n", name, i, size);
180 pgtable_cache[i] = kmem_cache_create(name, 172 pgtable_cache[i] = kmem_cache_create(name,
181 size, size, 173 size, size,
182 SLAB_PANIC, 174 SLAB_PANIC,
@@ -239,8 +231,8 @@ int __meminit vmemmap_populate(struct page *start_page,
239 if (!p) 231 if (!p)
240 return -ENOMEM; 232 return -ENOMEM;
241 233
242 printk(KERN_WARNING "vmemmap %08lx allocated at %p, " 234 pr_debug("vmemmap %08lx allocated at %p, physical %08lx.\n",
243 "physical %08lx.\n", start, p, __pa(p)); 235 start, p, __pa(p));
244 236
245 mapped = htab_bolt_mapping(start, start + page_size, 237 mapped = htab_bolt_mapping(start, start + page_size,
246 __pa(p), mode_rw, mmu_linear_psize, 238 __pa(p), mode_rw, mmu_linear_psize,
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index eafbca52bff9..e2d867ce1c7e 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -54,12 +54,10 @@ unsigned long pte_freelist_forced_free;
54 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ 54 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
55 / sizeof(pgtable_free_t)) 55 / sizeof(pgtable_free_t))
56 56
57#ifdef CONFIG_SMP
58static void pte_free_smp_sync(void *arg) 57static void pte_free_smp_sync(void *arg)
59{ 58{
60 /* Do nothing, just ensure we sync with all CPUs */ 59 /* Do nothing, just ensure we sync with all CPUs */
61} 60}
62#endif
63 61
64/* This is only called when we are critically out of memory 62/* This is only called when we are critically out of memory
65 * (and fail to get a page in pte_free_tlb). 63 * (and fail to get a page in pte_free_tlb).
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 66c8ad4cfce6..165981c87786 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -77,8 +77,6 @@ int __init cpm_muram_init(void)
77 int i = 0; 77 int i = 0;
78 int ret = 0; 78 int ret = 0;
79 79
80 printk("cpm_muram_init\n");
81
82 spin_lock_init(&cpm_muram_lock); 80 spin_lock_init(&cpm_muram_lock);
83 /* initialize the info header */ 81 /* initialize the info header */
84 rh_init(&cpm_muram_info, 1, 82 rh_init(&cpm_muram_info, 1,
@@ -193,7 +191,7 @@ void __iomem *cpm_muram_addr(unsigned long offset)
193EXPORT_SYMBOL(cpm_muram_addr); 191EXPORT_SYMBOL(cpm_muram_addr);
194 192
195/** 193/**
196 * cpm_muram_phys - turn a muram virtual address into a DMA address 194 * cpm_muram_dma - turn a muram virtual address into a DMA address
197 * @offset: virtual address from cpm_muram_addr() to convert 195 * @offset: virtual address from cpm_muram_addr() to convert
198 */ 196 */
199dma_addr_t cpm_muram_dma(void __iomem *addr) 197dma_addr_t cpm_muram_dma(void __iomem *addr)
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index b19bfef2034d..59e77eb63338 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -251,6 +251,9 @@ syscall_exit_cont:
251 bne- 2f 251 bne- 2f
2521: 2521:
253#endif /* CONFIG_44x */ 253#endif /* CONFIG_44x */
254BEGIN_FTR_SECTION
255 lwarx r7,0,r1
256END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
254 stwcx. r0,0,r1 /* to clear the reservation */ 257 stwcx. r0,0,r1 /* to clear the reservation */
255 lwz r4,_LINK(r1) 258 lwz r4,_LINK(r1)
256 lwz r5,_CCR(r1) 259 lwz r5,_CCR(r1)
@@ -713,6 +716,9 @@ restore:
713 mtctr r11 716 mtctr r11
714 717
715 PPC405_ERR77(0,r1) 718 PPC405_ERR77(0,r1)
719BEGIN_FTR_SECTION
720 lwarx r11,0,r1
721END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
716 stwcx. r0,0,r1 /* to clear the reservation */ 722 stwcx. r0,0,r1 /* to clear the reservation */
717 723
718#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 724#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 768a5d14b755..31999bc1c8a4 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
168 $(Q)mkdir -p $(objtree)/include/asm-um 168 $(Q)mkdir -p $(objtree)/include/asm-um
169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch 169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
170else 170else
171 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(HEADER_ARCH) arch 171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(SUBARCH) arch
172endif 172endif
173 173
174$(objtree)/$(ARCH_DIR)/include: 174$(objtree)/$(ARCH_DIR)/include:
@@ -180,7 +180,7 @@ $(ARCH_DIR)/include/sysdep: $(objtree)/$(ARCH_DIR)/include
180ifneq ($(KBUILD_SRC),) 180ifneq ($(KBUILD_SRC),)
181 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep 181 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
182else 182else
183 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep 183 $(Q)cd $(ARCH_DIR)/include && ln -fsn sysdep-$(SUBARCH) sysdep
184endif 184endif
185 185
186$(ARCH_DIR)/os: 186$(ARCH_DIR)/os:
@@ -188,7 +188,7 @@ $(ARCH_DIR)/os:
188ifneq ($(KBUILD_SRC),) 188ifneq ($(KBUILD_SRC),)
189 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os 189 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os
190else 190else
191 $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os 191 $(Q)cd $(ARCH_DIR) && ln -fsn os-$(OS) os
192endif 192endif
193 193
194# Generated files 194# Generated files
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 8c01fa81a1ae..73681f14f9fc 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -753,6 +753,7 @@ static struct mc_device net_mc = {
753 .remove = net_remove, 753 .remove = net_remove,
754}; 754};
755 755
756#ifdef CONFIG_INET
756static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, 757static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
757 void *ptr) 758 void *ptr)
758{ 759{
@@ -789,14 +790,13 @@ struct notifier_block uml_inetaddr_notifier = {
789 .notifier_call = uml_inetaddr_event, 790 .notifier_call = uml_inetaddr_event,
790}; 791};
791 792
792static int uml_net_init(void) 793static void inet_register(void)
793{ 794{
794 struct list_head *ele; 795 struct list_head *ele;
795 struct uml_net_private *lp; 796 struct uml_net_private *lp;
796 struct in_device *ip; 797 struct in_device *ip;
797 struct in_ifaddr *in; 798 struct in_ifaddr *in;
798 799
799 mconsole_register_dev(&net_mc);
800 register_inetaddr_notifier(&uml_inetaddr_notifier); 800 register_inetaddr_notifier(&uml_inetaddr_notifier);
801 801
802 /* Devices may have been opened already, so the uml_inetaddr_notifier 802 /* Devices may have been opened already, so the uml_inetaddr_notifier
@@ -816,7 +816,17 @@ static int uml_net_init(void)
816 } 816 }
817 } 817 }
818 spin_unlock(&opened_lock); 818 spin_unlock(&opened_lock);
819}
820#else
821static inline void inet_register(void)
822{
823}
824#endif
819 825
826static int uml_net_init(void)
827{
828 mconsole_register_dev(&net_mc);
829 inet_register();
820 return 0; 830 return 0;
821} 831}
822 832
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index 99033ff28a78..1723fac6f40d 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -1,11 +1,13 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __USER_H__ 6#ifndef __USER_H__
7#define __USER_H__ 7#define __USER_H__
8 8
9#include "uml-config.h"
10
9/* 11/*
10 * The usual definition - copied here because the kernel provides its own, 12 * The usual definition - copied here because the kernel provides its own,
11 * fancier, type-safe, definition. Using that one would require 13 * fancier, type-safe, definition. Using that one would require
@@ -23,8 +25,17 @@
23 25
24extern void panic(const char *fmt, ...) 26extern void panic(const char *fmt, ...)
25 __attribute__ ((format (printf, 1, 2))); 27 __attribute__ ((format (printf, 1, 2)));
28
29#ifdef UML_CONFIG_PRINTK
26extern int printk(const char *fmt, ...) 30extern int printk(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2))); 31 __attribute__ ((format (printf, 1, 2)));
32#else
33static inline int printk(const char *fmt, ...)
34{
35 return 0;
36}
37#endif
38
28extern void schedule(void); 39extern void schedule(void);
29extern int in_aton(char *str); 40extern int in_aton(char *str);
30extern int open_gdb_chan(void); 41extern int open_gdb_chan(void);
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 70c2d625b070..ba11ccd6a8a3 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -347,14 +347,15 @@ int um_request_irq(unsigned int irq, int fd, int type,
347{ 347{
348 int err; 348 int err;
349 349
350 err = request_irq(irq, handler, irqflags, devname, dev_id); 350 if (fd != -1) {
351 if (err)
352 return err;
353
354 if (fd != -1)
355 err = activate_fd(irq, fd, type, dev_id); 351 err = activate_fd(irq, fd, type, dev_id);
356 return err; 352 if (err)
353 return err;
354 }
355
356 return request_irq(irq, handler, irqflags, devname, dev_id);
357} 357}
358
358EXPORT_SYMBOL(um_request_irq); 359EXPORT_SYMBOL(um_request_irq);
359EXPORT_SYMBOL(reactivate_fd); 360EXPORT_SYMBOL(reactivate_fd);
360 361
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index d119f4f7d897..8d07a7acb909 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -3,7 +3,6 @@
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <sys/time.h> 4#include <sys/time.h>
5#include <asm/unistd.h> 5#include <asm/unistd.h>
6#include <asm/page.h>
7#include "as-layout.h" 6#include "as-layout.h"
8#include "ptrace_user.h" 7#include "ptrace_user.h"
9#include "skas.h" 8#include "skas.h"
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index b542a3a021bf..f83462758627 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -496,8 +496,7 @@ int os_rcv_fd(int fd, int *helper_pid_out)
496 n = recvmsg(fd, &msg, 0); 496 n = recvmsg(fd, &msg, 0);
497 if(n < 0) 497 if(n < 0)
498 return -errno; 498 return -errno;
499 499 else if(n != iov.iov_len)
500 else if(n != sizeof(iov.iov_len))
501 *helper_pid_out = -1; 500 *helper_pid_out = -1;
502 501
503 cmsg = CMSG_FIRSTHDR(&msg); 502 cmsg = CMSG_FIRSTHDR(&msg);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index b9f802e35209..447b351f1f2a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -802,6 +802,8 @@ static struct sysdev_attribute *mce_attributes[] = {
802 NULL 802 NULL
803}; 803};
804 804
805static cpumask_t mce_device_initialized = CPU_MASK_NONE;
806
805/* Per cpu sysdev init. All of the cpus still share the same ctl bank */ 807/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
806static __cpuinit int mce_create_device(unsigned int cpu) 808static __cpuinit int mce_create_device(unsigned int cpu)
807{ 809{
@@ -825,6 +827,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
825 if (err) 827 if (err)
826 goto error; 828 goto error;
827 } 829 }
830 cpu_set(cpu, mce_device_initialized);
828 831
829 return 0; 832 return 0;
830error: 833error:
@@ -841,10 +844,14 @@ static void mce_remove_device(unsigned int cpu)
841{ 844{
842 int i; 845 int i;
843 846
847 if (!cpu_isset(cpu, mce_device_initialized))
848 return;
849
844 for (i = 0; mce_attributes[i]; i++) 850 for (i = 0; mce_attributes[i]; i++)
845 sysdev_remove_file(&per_cpu(device_mce,cpu), 851 sysdev_remove_file(&per_cpu(device_mce,cpu),
846 mce_attributes[i]); 852 mce_attributes[i]);
847 sysdev_unregister(&per_cpu(device_mce,cpu)); 853 sysdev_unregister(&per_cpu(device_mce,cpu));
854 cpu_clear(cpu, mce_device_initialized);
848} 855}
849 856
850/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 857/* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -852,21 +859,18 @@ static int
852mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 859mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
853{ 860{
854 unsigned int cpu = (unsigned long)hcpu; 861 unsigned int cpu = (unsigned long)hcpu;
855 int err = 0;
856 862
857 switch (action) { 863 switch (action) {
858 case CPU_UP_PREPARE: 864 case CPU_ONLINE:
859 case CPU_UP_PREPARE_FROZEN: 865 case CPU_ONLINE_FROZEN:
860 err = mce_create_device(cpu); 866 mce_create_device(cpu);
861 break; 867 break;
862 case CPU_UP_CANCELED:
863 case CPU_UP_CANCELED_FROZEN:
864 case CPU_DEAD: 868 case CPU_DEAD:
865 case CPU_DEAD_FROZEN: 869 case CPU_DEAD_FROZEN:
866 mce_remove_device(cpu); 870 mce_remove_device(cpu);
867 break; 871 break;
868 } 872 }
869 return err ? NOTIFY_BAD : NOTIFY_OK; 873 return NOTIFY_OK;
870} 874}
871 875
872static struct notifier_block mce_cpu_notifier = { 876static struct notifier_block mce_cpu_notifier = {
diff --git a/arch/x86/kernel/i387_64.c b/arch/x86/kernel/i387_64.c
index 56c1f1147109..bfaff28fb134 100644
--- a/arch/x86/kernel/i387_64.c
+++ b/arch/x86/kernel/i387_64.c
@@ -92,13 +92,14 @@ int save_i387(struct _fpstate __user *buf)
92 if (task_thread_info(tsk)->status & TS_USEDFPU) { 92 if (task_thread_info(tsk)->status & TS_USEDFPU) {
93 err = save_i387_checking((struct i387_fxsave_struct __user *)buf); 93 err = save_i387_checking((struct i387_fxsave_struct __user *)buf);
94 if (err) return err; 94 if (err) return err;
95 task_thread_info(tsk)->status &= ~TS_USEDFPU;
95 stts(); 96 stts();
96 } else { 97 } else {
97 if (__copy_to_user(buf, &tsk->thread.i387.fxsave, 98 if (__copy_to_user(buf, &tsk->thread.i387.fxsave,
98 sizeof(struct i387_fxsave_struct))) 99 sizeof(struct i387_fxsave_struct)))
99 return -1; 100 return -1;
100 } 101 }
101 return 1; 102 return 1;
102} 103}
103 104
104/* 105/*
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c
index 952e7a89c2ac..aad9d95469dc 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay_32.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/preempt.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
16 17
17#include <asm/processor.h> 18#include <asm/processor.h>
@@ -42,11 +43,13 @@ static void delay_tsc(unsigned long loops)
42{ 43{
43 unsigned long bclock, now; 44 unsigned long bclock, now;
44 45
46 preempt_disable(); /* TSC's are per-cpu */
45 rdtscl(bclock); 47 rdtscl(bclock);
46 do { 48 do {
47 rep_nop(); 49 rep_nop();
48 rdtscl(now); 50 rdtscl(now);
49 } while ((now-bclock) < loops); 51 } while ((now-bclock) < loops);
52 preempt_enable();
50} 53}
51 54
52/* 55/*
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
index 0ebbfb9e7c7f..45cdd3fbd91c 100644
--- a/arch/x86/lib/delay_64.c
+++ b/arch/x86/lib/delay_64.c
@@ -10,7 +10,9 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/preempt.h>
13#include <linux/delay.h> 14#include <linux/delay.h>
15
14#include <asm/delay.h> 16#include <asm/delay.h>
15#include <asm/msr.h> 17#include <asm/msr.h>
16 18
@@ -27,14 +29,15 @@ int read_current_timer(unsigned long *timer_value)
27void __delay(unsigned long loops) 29void __delay(unsigned long loops)
28{ 30{
29 unsigned bclock, now; 31 unsigned bclock, now;
30 32
33 preempt_disable(); /* TSC's are pre-cpu */
31 rdtscl(bclock); 34 rdtscl(bclock);
32 do 35 do {
33 {
34 rep_nop(); 36 rep_nop();
35 rdtscl(now); 37 rdtscl(now);
36 } 38 }
37 while((now-bclock) < loops); 39 while ((now-bclock) < loops);
40 preempt_enable();
38} 41}
39EXPORT_SYMBOL(__delay); 42EXPORT_SYMBOL(__delay);
40 43