aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris')
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c1
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c1
-rw-r--r--arch/cris/arch-v10/drivers/i2c.c1
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c1
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c1
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c1
-rw-r--r--arch/cris/arch-v10/kernel/dma.c1
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c1
-rw-r--r--arch/cris/arch-v10/kernel/process.c1
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c1
-rw-r--r--arch/cris/arch-v10/kernel/setup.c1
-rw-r--r--arch/cris/arch-v10/kernel/signal.c1
-rw-r--r--arch/cris/arch-v10/kernel/traps.c1
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c1
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c1
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c1
-rw-r--r--arch/cris/arch-v32/kernel/debugport.c1
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c1
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c1
-rw-r--r--arch/cris/arch-v32/mach-a3/dma.c1
-rw-r--r--arch/cris/arch-v32/mach-fs/dma.c1
-rw-r--r--arch/cris/include/arch-v10/arch/elf.h2
-rw-r--r--arch/cris/include/arch-v32/arch/elf.h2
-rw-r--r--arch/cris/include/arch-v32/arch/system.h10
-rw-r--r--arch/cris/include/asm/atomic.h2
-rw-r--r--arch/cris/include/asm/barrier.h25
-rw-r--r--arch/cris/include/asm/bitops.h1
-rw-r--r--arch/cris/include/asm/cmpxchg.h53
-rw-r--r--arch/cris/include/asm/exec.h6
-rw-r--r--arch/cris/include/asm/processor.h11
-rw-r--r--arch/cris/include/asm/switch_to.h12
-rw-r--r--arch/cris/include/asm/system.h94
-rw-r--r--arch/cris/kernel/irq.c1
-rw-r--r--arch/cris/kernel/process.c1
-rw-r--r--arch/cris/kernel/ptrace.c1
-rw-r--r--arch/cris/kernel/setup.c1
-rw-r--r--arch/cris/kernel/traps.c1
-rw-r--r--arch/cris/mm/fault.c1
38 files changed, 126 insertions, 119 deletions
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index 3d655dcc65da..74f99c688c8d 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -24,7 +24,6 @@
24#include <linux/capability.h> 24#include <linux/capability.h>
25 25
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <arch/svinto.h> 27#include <arch/svinto.h>
29#include <asm/io.h> 28#include <asm/io.h>
30#include <asm/rtc.h> 29#include <asm/rtc.h>
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index a276f0811731..609d5510410e 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -24,7 +24,6 @@
24#include <asm/etraxgpio.h> 24#include <asm/etraxgpio.h>
25#include <arch/svinto.h> 25#include <arch/svinto.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/system.h>
28#include <asm/irq.h> 27#include <asm/irq.h>
29#include <arch/io_interface_mux.h> 28#include <arch/io_interface_mux.h>
30 29
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index c413539d4205..b3d1f9ed1b98 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -22,7 +22,6 @@
22 22
23#include <asm/etraxi2c.h> 23#include <asm/etraxi2c.h>
24 24
25#include <asm/system.h>
26#include <arch/svinto.h> 25#include <arch/svinto.h>
27#include <asm/io.h> 26#include <asm/io.h>
28#include <asm/delay.h> 27#include <asm/delay.h>
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index 1391b731ad1c..9da056860c92 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -29,7 +29,6 @@
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30 30
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <asm/system.h>
33#include <asm/io.h> 32#include <asm/io.h>
34#include <asm/rtc.h> 33#include <asm/rtc.h>
35 34
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index 466af40c5822..c4b71710fb0e 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -27,7 +27,6 @@
27#include <asm/io.h> 27#include <asm/io.h>
28#include <arch/svinto.h> 28#include <arch/svinto.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <asm/sync_serial.h> 30#include <asm/sync_serial.h>
32#include <arch/io_interface_mux.h> 31#include <arch/io_interface_mux.h>
33 32
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 99851ba8e5fa..f932c85fbde4 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -18,7 +18,6 @@
18#include <linux/major.h> 18#include <linux/major.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/tty.h> 20#include <linux/tty.h>
21#include <asm/system.h>
22#include <arch/svinto.h> 21#include <arch/svinto.h>
23#include <asm/io.h> /* Get SIMCOUT. */ 22#include <asm/io.h> /* Get SIMCOUT. */
24 23
diff --git a/arch/cris/arch-v10/kernel/dma.c b/arch/cris/arch-v10/kernel/dma.c
index d31504b4a19e..5795047359b2 100644
--- a/arch/cris/arch-v10/kernel/dma.c
+++ b/arch/cris/arch-v10/kernel/dma.c
@@ -8,6 +8,7 @@
8 8
9#include <asm/dma.h> 9#include <asm/dma.h>
10#include <arch/svinto.h> 10#include <arch/svinto.h>
11#include <arch/system.h>
11 12
12/* Macro to access ETRAX 100 registers */ 13/* Macro to access ETRAX 100 registers */
13#define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \ 14#define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
index 29f97e962795..ad64cd1c861a 100644
--- a/arch/cris/arch-v10/kernel/io_interface_mux.c
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -14,6 +14,7 @@
14#include <arch/svinto.h> 14#include <arch/svinto.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <arch/io_interface_mux.h> 16#include <arch/io_interface_mux.h>
17#include <arch/system.h>
17 18
18 19
19#define DBG(s) 20#define DBG(s)
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index 9a57db6907f5..bee8df43c201 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -16,6 +16,7 @@
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <arch/svinto.h> 17#include <arch/svinto.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <arch/system.h>
19 20
20#ifdef CONFIG_ETRAX_GPIO 21#ifdef CONFIG_ETRAX_GPIO
21void etrax_gpio_wake_up_check(void); /* drivers/gpio.c */ 22void etrax_gpio_wake_up_check(void); /* drivers/gpio.c */
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index 320065f3cbe5..bfddfb99401f 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -15,7 +15,6 @@
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/system.h>
19#include <asm/processor.h> 18#include <asm/processor.h>
20 19
21/* 20/*
diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
index de27b50b72a2..4f96d71b5154 100644
--- a/arch/cris/arch-v10/kernel/setup.c
+++ b/arch/cris/arch-v10/kernel/setup.c
@@ -14,6 +14,7 @@
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#include <linux/param.h>
17#include <arch/system.h>
17 18
18#ifdef CONFIG_PROC_FS 19#ifdef CONFIG_PROC_FS
19#define HAS_FPU 0x0001 20#define HAS_FPU 0x0001
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index e78fe49a9849..289c584ba499 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -27,6 +27,7 @@
27#include <asm/processor.h> 27#include <asm/processor.h>
28#include <asm/ucontext.h> 28#include <asm/ucontext.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <arch/system.h>
30 31
31#define DEBUG_SIG 0 32#define DEBUG_SIG 0
32 33
diff --git a/arch/cris/arch-v10/kernel/traps.c b/arch/cris/arch-v10/kernel/traps.c
index 8bebb96bbca1..7001beda716c 100644
--- a/arch/cris/arch-v10/kernel/traps.c
+++ b/arch/cris/arch-v10/kernel/traps.c
@@ -11,6 +11,7 @@
11#include <linux/ptrace.h> 11#include <linux/ptrace.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <arch/sv_addr_ag.h> 13#include <arch/sv_addr_ag.h>
14#include <arch/system.h>
14 15
15void 16void
16show_registers(struct pt_regs *regs) 17show_registers(struct pt_regs *regs)
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index ddb23996f11a..3b2c82ce8147 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -36,7 +36,6 @@
36 36
37#include <asm/etraxi2c.h> 37#include <asm/etraxi2c.h>
38 38
39#include <asm/system.h>
40#include <asm/io.h> 39#include <asm/io.h>
41#include <asm/delay.h> 40#include <asm/delay.h>
42 41
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index c845831e2225..0b86deedacb9 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -31,7 +31,6 @@
31#include <hwregs/gio_defs.h> 31#include <hwregs/gio_defs.h>
32#include <hwregs/intr_vect_defs.h> 32#include <hwregs/intr_vect_defs.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/system.h>
35#include <asm/irq.h> 34#include <asm/irq.h>
36#include <mach/pinmux.h> 35#include <mach/pinmux.h>
37 36
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index ee90d2659be7..a2ac0917f1a6 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -30,7 +30,6 @@
30#include <hwregs/gio_defs.h> 30#include <hwregs/gio_defs.h>
31#include <hwregs/intr_vect_defs.h> 31#include <hwregs/intr_vect_defs.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/system.h>
34#include <asm/irq.h> 33#include <asm/irq.h>
35 34
36#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 35#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/kernel/debugport.c b/arch/cris/arch-v32/kernel/debugport.c
index 794b364d9f7d..610909b003f6 100644
--- a/arch/cris/arch-v32/kernel/debugport.c
+++ b/arch/cris/arch-v32/kernel/debugport.c
@@ -4,7 +4,6 @@
4 4
5#include <linux/console.h> 5#include <linux/console.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <asm/system.h>
8#include <hwregs/reg_rdwr.h> 7#include <hwregs/reg_rdwr.h>
9#include <hwregs/reg_map.h> 8#include <hwregs/reg_map.h>
10#include <hwregs/ser_defs.h> 9#include <hwregs/ser_defs.h>
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
index 111caa1a2efb..ab1551ee43c5 100644
--- a/arch/cris/arch-v32/kernel/fasttimer.c
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18 18
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <asm/system.h>
21 20
22#include <hwregs/reg_map.h> 21#include <hwregs/reg_map.h>
23#include <hwregs/reg_rdwr.h> 22#include <hwregs/reg_rdwr.h>
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index 511ece94a574..f7ad9e8637df 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -15,7 +15,6 @@
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/system.h>
19#include <asm/processor.h> 18#include <asm/processor.h>
20#include <arch/hwregs/supp_reg.h> 19#include <arch/hwregs/supp_reg.h>
21 20
diff --git a/arch/cris/arch-v32/mach-a3/dma.c b/arch/cris/arch-v32/mach-a3/dma.c
index f35e4f65f4ef..47c64bf40eae 100644
--- a/arch/cris/arch-v32/mach-a3/dma.c
+++ b/arch/cris/arch-v32/mach-a3/dma.c
@@ -9,7 +9,6 @@
9#include <hwregs/clkgen_defs.h> 9#include <hwregs/clkgen_defs.h>
10#include <hwregs/strmux_defs.h> 10#include <hwregs/strmux_defs.h>
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <asm/system.h>
13#include <arbiter.h> 12#include <arbiter.h>
14 13
15static char used_dma_channels[MAX_DMA_CHANNELS]; 14static char used_dma_channels[MAX_DMA_CHANNELS];
diff --git a/arch/cris/arch-v32/mach-fs/dma.c b/arch/cris/arch-v32/mach-fs/dma.c
index 2d970d7505c9..fc6416a671ea 100644
--- a/arch/cris/arch-v32/mach-fs/dma.c
+++ b/arch/cris/arch-v32/mach-fs/dma.c
@@ -9,7 +9,6 @@
9#include <hwregs/config_defs.h> 9#include <hwregs/config_defs.h>
10#include <hwregs/strmux_defs.h> 10#include <hwregs/strmux_defs.h>
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <asm/system.h>
13#include <mach/arbiter.h> 12#include <mach/arbiter.h>
14 13
15static char used_dma_channels[MAX_DMA_CHANNELS]; 14static char used_dma_channels[MAX_DMA_CHANNELS];
diff --git a/arch/cris/include/arch-v10/arch/elf.h b/arch/cris/include/arch-v10/arch/elf.h
index 1c38ee728b17..1eb638aeddb4 100644
--- a/arch/cris/include/arch-v10/arch/elf.h
+++ b/arch/cris/include/arch-v10/arch/elf.h
@@ -1,6 +1,8 @@
1#ifndef __ASMCRIS_ARCH_ELF_H 1#ifndef __ASMCRIS_ARCH_ELF_H
2#define __ASMCRIS_ARCH_ELF_H 2#define __ASMCRIS_ARCH_ELF_H
3 3
4#include <arch/system.h>
5
4#define ELF_MACH EF_CRIS_VARIANT_ANY_V0_V10 6#define ELF_MACH EF_CRIS_VARIANT_ANY_V0_V10
5 7
6/* 8/*
diff --git a/arch/cris/include/arch-v32/arch/elf.h b/arch/cris/include/arch-v32/arch/elf.h
index 1324e505a4d8..c46d58291166 100644
--- a/arch/cris/include/arch-v32/arch/elf.h
+++ b/arch/cris/include/arch-v32/arch/elf.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_CRIS_ELF_H 1#ifndef _ASM_CRIS_ELF_H
2#define _ASM_CRIS_ELF_H 2#define _ASM_CRIS_ELF_H
3 3
4#include <arch/system.h>
5
4#define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32 6#define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32
5 7
6/* 8/*
diff --git a/arch/cris/include/arch-v32/arch/system.h b/arch/cris/include/arch-v32/arch/system.h
index 76cea99eaa60..db853fb3a458 100644
--- a/arch/cris/include/arch-v32/arch/system.h
+++ b/arch/cris/include/arch-v32/arch/system.h
@@ -34,14 +34,4 @@ static inline unsigned long rdsp(void)
34/* Write the user-mode stack pointer. */ 34/* Write the user-mode stack pointer. */
35#define wrusp(usp) __asm__ __volatile__ ("move %0, $usp" : : "rm" (usp)) 35#define wrusp(usp) __asm__ __volatile__ ("move %0, $usp" : : "rm" (usp))
36 36
37#define nop() __asm__ __volatile__ ("nop");
38
39#define xchg(ptr,x) \
40 ((__typeof__(*(ptr)))__xchg((unsigned long) (x),(ptr),sizeof(*(ptr))))
41
42#define tas(ptr) (xchg((ptr),1))
43
44struct __xchg_dummy { unsigned long a[100]; };
45#define __xg(x) ((struct __xchg_dummy *)(x))
46
47#endif /* _ASM_CRIS_ARCH_SYSTEM_H */ 37#endif /* _ASM_CRIS_ARCH_SYSTEM_H */
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h
index bbf093814db2..1056a5dfe04f 100644
--- a/arch/cris/include/asm/atomic.h
+++ b/arch/cris/include/asm/atomic.h
@@ -5,7 +5,7 @@
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <asm/system.h> 8#include <asm/cmpxchg.h>
9#include <arch/atomic.h> 9#include <arch/atomic.h>
10 10
11/* 11/*
diff --git a/arch/cris/include/asm/barrier.h b/arch/cris/include/asm/barrier.h
new file mode 100644
index 000000000000..198ad7fa6b25
--- /dev/null
+++ b/arch/cris/include/asm/barrier.h
@@ -0,0 +1,25 @@
1#ifndef __ASM_CRIS_BARRIER_H
2#define __ASM_CRIS_BARRIER_H
3
4#define nop() __asm__ __volatile__ ("nop");
5
6#define barrier() __asm__ __volatile__("": : :"memory")
7#define mb() barrier()
8#define rmb() mb()
9#define wmb() mb()
10#define read_barrier_depends() do { } while(0)
11#define set_mb(var, value) do { var = value; mb(); } while (0)
12
13#ifdef CONFIG_SMP
14#define smp_mb() mb()
15#define smp_rmb() rmb()
16#define smp_wmb() wmb()
17#define smp_read_barrier_depends() read_barrier_depends()
18#else
19#define smp_mb() barrier()
20#define smp_rmb() barrier()
21#define smp_wmb() barrier()
22#define smp_read_barrier_depends() do { } while(0)
23#endif
24
25#endif /* __ASM_CRIS_BARRIER_H */
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h
index a78a2d70cd8b..184066ceb1f6 100644
--- a/arch/cris/include/asm/bitops.h
+++ b/arch/cris/include/asm/bitops.h
@@ -19,7 +19,6 @@
19#endif 19#endif
20 20
21#include <arch/bitops.h> 21#include <arch/bitops.h>
22#include <asm/system.h>
23#include <linux/atomic.h> 22#include <linux/atomic.h>
24#include <linux/compiler.h> 23#include <linux/compiler.h>
25 24
diff --git a/arch/cris/include/asm/cmpxchg.h b/arch/cris/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..b756dac8aa3f
--- /dev/null
+++ b/arch/cris/include/asm/cmpxchg.h
@@ -0,0 +1,53 @@
1#ifndef __ASM_CRIS_CMPXCHG__
2#define __ASM_CRIS_CMPXCHG__
3
4#include <linux/irqflags.h>
5
6static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
7{
8 /* since Etrax doesn't have any atomic xchg instructions, we need to disable
9 irq's (if enabled) and do it with move.d's */
10 unsigned long flags,temp;
11 local_irq_save(flags); /* save flags, including irq enable bit and shut off irqs */
12 switch (size) {
13 case 1:
14 *((unsigned char *)&temp) = x;
15 x = *(unsigned char *)ptr;
16 *(unsigned char *)ptr = *((unsigned char *)&temp);
17 break;
18 case 2:
19 *((unsigned short *)&temp) = x;
20 x = *(unsigned short *)ptr;
21 *(unsigned short *)ptr = *((unsigned short *)&temp);
22 break;
23 case 4:
24 temp = x;
25 x = *(unsigned long *)ptr;
26 *(unsigned long *)ptr = temp;
27 break;
28 }
29 local_irq_restore(flags); /* restore irq enable bit */
30 return x;
31}
32
33#define xchg(ptr,x) \
34 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
35
36#define tas(ptr) (xchg((ptr),1))
37
38#include <asm-generic/cmpxchg-local.h>
39
40/*
41 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
42 * them available.
43 */
44#define cmpxchg_local(ptr, o, n) \
45 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
46 (unsigned long)(n), sizeof(*(ptr))))
47#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
48
49#ifndef CONFIG_SMP
50#include <asm-generic/cmpxchg.h>
51#endif
52
53#endif /* __ASM_CRIS_CMPXCHG__ */
diff --git a/arch/cris/include/asm/exec.h b/arch/cris/include/asm/exec.h
new file mode 100644
index 000000000000..9665dab7e25b
--- /dev/null
+++ b/arch/cris/include/asm/exec.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_CRIS_EXEC_H
2#define __ASM_CRIS_EXEC_H
3
4#define arch_align_stack(x) (x)
5
6#endif /* __ASM_CRIS_EXEC_H */
diff --git a/arch/cris/include/asm/processor.h b/arch/cris/include/asm/processor.h
index 3f7248f7a1c9..4210d72a6667 100644
--- a/arch/cris/include/asm/processor.h
+++ b/arch/cris/include/asm/processor.h
@@ -10,10 +10,10 @@
10#ifndef __ASM_CRIS_PROCESSOR_H 10#ifndef __ASM_CRIS_PROCESSOR_H
11#define __ASM_CRIS_PROCESSOR_H 11#define __ASM_CRIS_PROCESSOR_H
12 12
13#include <asm/system.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/ptrace.h> 14#include <asm/ptrace.h>
16#include <arch/processor.h> 15#include <arch/processor.h>
16#include <arch/system.h>
17 17
18struct task_struct; 18struct task_struct;
19 19
@@ -72,4 +72,13 @@ static inline void release_thread(struct task_struct *dead_task)
72 72
73#define cpu_relax() barrier() 73#define cpu_relax() barrier()
74 74
75/*
76 * disable hlt during certain critical i/o operations
77 */
78#define HAVE_DISABLE_HLT
79void disable_hlt(void);
80void enable_hlt(void);
81
82void default_idle(void);
83
75#endif /* __ASM_CRIS_PROCESSOR_H */ 84#endif /* __ASM_CRIS_PROCESSOR_H */
diff --git a/arch/cris/include/asm/switch_to.h b/arch/cris/include/asm/switch_to.h
new file mode 100644
index 000000000000..d842e1163ba1
--- /dev/null
+++ b/arch/cris/include/asm/switch_to.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_CRIS_SWITCH_TO_H
2#define __ASM_CRIS_SWITCH_TO_H
3
4/* the switch_to macro calls resume, an asm function in entry.S which does the actual
5 * task switching.
6 */
7
8extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int);
9#define switch_to(prev,next,last) last = resume(prev,next, \
10 (int)&((struct task_struct *)0)->thread)
11
12#endif /* __ASM_CRIS_SWITCH_TO_H */
diff --git a/arch/cris/include/asm/system.h b/arch/cris/include/asm/system.h
index ea10592f7d75..a7f40578587c 100644
--- a/arch/cris/include/asm/system.h
+++ b/arch/cris/include/asm/system.h
@@ -1,89 +1,5 @@
1#ifndef __ASM_CRIS_SYSTEM_H 1/* FILE TO BE DELETED. DO NOT ADD STUFF HERE! */
2#define __ASM_CRIS_SYSTEM_H 2#include <asm/barrier.h>
3 3#include <asm/cmpxchg.h>
4#include <linux/irqflags.h> 4#include <asm/exec.h>
5#include <arch/system.h> 5#include <asm/switch_to.h>
6
7/* the switch_to macro calls resume, an asm function in entry.S which does the actual
8 * task switching.
9 */
10
11extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int);
12#define switch_to(prev,next,last) last = resume(prev,next, \
13 (int)&((struct task_struct *)0)->thread)
14
15#define barrier() __asm__ __volatile__("": : :"memory")
16#define mb() barrier()
17#define rmb() mb()
18#define wmb() mb()
19#define read_barrier_depends() do { } while(0)
20#define set_mb(var, value) do { var = value; mb(); } while (0)
21
22#ifdef CONFIG_SMP
23#define smp_mb() mb()
24#define smp_rmb() rmb()
25#define smp_wmb() wmb()
26#define smp_read_barrier_depends() read_barrier_depends()
27#else
28#define smp_mb() barrier()
29#define smp_rmb() barrier()
30#define smp_wmb() barrier()
31#define smp_read_barrier_depends() do { } while(0)
32#endif
33
34#define iret()
35
36/*
37 * disable hlt during certain critical i/o operations
38 */
39#define HAVE_DISABLE_HLT
40void disable_hlt(void);
41void enable_hlt(void);
42
43static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
44{
45 /* since Etrax doesn't have any atomic xchg instructions, we need to disable
46 irq's (if enabled) and do it with move.d's */
47 unsigned long flags,temp;
48 local_irq_save(flags); /* save flags, including irq enable bit and shut off irqs */
49 switch (size) {
50 case 1:
51 *((unsigned char *)&temp) = x;
52 x = *(unsigned char *)ptr;
53 *(unsigned char *)ptr = *((unsigned char *)&temp);
54 break;
55 case 2:
56 *((unsigned short *)&temp) = x;
57 x = *(unsigned short *)ptr;
58 *(unsigned short *)ptr = *((unsigned short *)&temp);
59 break;
60 case 4:
61 temp = x;
62 x = *(unsigned long *)ptr;
63 *(unsigned long *)ptr = temp;
64 break;
65 }
66 local_irq_restore(flags); /* restore irq enable bit */
67 return x;
68}
69
70#include <asm-generic/cmpxchg-local.h>
71
72/*
73 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
74 * them available.
75 */
76#define cmpxchg_local(ptr, o, n) \
77 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
78 (unsigned long)(n), sizeof(*(ptr))))
79#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
80
81#ifndef CONFIG_SMP
82#include <asm-generic/cmpxchg.h>
83#endif
84
85#define arch_align_stack(x) (x)
86
87void default_idle(void);
88
89#endif
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 788eb2248916..d36836dbbc07 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -36,6 +36,7 @@
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37 37
38#include <asm/io.h> 38#include <asm/io.h>
39#include <arch/system.h>
39 40
40/* called by the assembler IRQ entry functions defined in irq.h 41/* called by the assembler IRQ entry functions defined in irq.h
41 * to dispatch the interrupts to registered handlers 42 * to dispatch the interrupts to registered handlers
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index d8f50ff6fadd..891dad85e8bd 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -16,7 +16,6 @@
16#include <asm/pgtable.h> 16#include <asm/pgtable.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/system.h>
20#include <linux/module.h> 19#include <linux/module.h>
21#include <linux/spinlock.h> 20#include <linux/spinlock.h>
22#include <linux/init_task.h> 21#include <linux/init_task.h>
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index 48b0f3912632..d114ad3da9b1 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -21,7 +21,6 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/system.h>
25#include <asm/processor.h> 24#include <asm/processor.h>
26 25
27 26
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index b712f4934c4b..32c3d248868e 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -20,6 +20,7 @@
20#include <linux/pfn.h> 20#include <linux/pfn.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <asm/setup.h> 22#include <asm/setup.h>
23#include <arch/system.h>
23 24
24/* 25/*
25 * Setup options 26 * Setup options
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index 8da53f34c7a7..a11ad3229f8c 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <arch/system.h>
20 21
21extern void arch_enable_nmi(void); 22extern void arch_enable_nmi(void);
22extern void stop_watchdog(void); 23extern void stop_watchdog(void);
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 9dcac8ec8fa0..b4760d86e1bb 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -9,6 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/wait.h> 10#include <linux/wait.h>
11#include <asm/uaccess.h> 11#include <asm/uaccess.h>
12#include <arch/system.h>
12 13
13extern int find_fixup_code(struct pt_regs *); 14extern int find_fixup_code(struct pt_regs *);
14extern void die_if_kernel(const char *, struct pt_regs *, long); 15extern void die_if_kernel(const char *, struct pt_regs *, long);