diff options
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r-- | arch/blackfin/include/asm/byteorder.h | 1 | ||||
-rw-r--r-- | arch/blackfin/include/asm/cachectl.h | 20 | ||||
-rw-r--r-- | arch/blackfin/include/asm/fcntl.h | 17 | ||||
-rw-r--r-- | arch/blackfin/include/asm/ioctls.h | 7 | ||||
-rw-r--r-- | arch/blackfin/include/asm/mutex.h | 1 | ||||
-rw-r--r-- | arch/blackfin/include/asm/poll.h | 16 | ||||
-rw-r--r-- | arch/blackfin/include/asm/posix_types.h | 33 | ||||
-rw-r--r-- | arch/blackfin/include/asm/sigcontext.h | 61 | ||||
-rw-r--r-- | arch/blackfin/include/asm/siginfo.h | 41 | ||||
-rw-r--r-- | arch/blackfin/include/asm/signal.h | 7 | ||||
-rw-r--r-- | arch/blackfin/include/asm/stat.h | 69 | ||||
-rw-r--r-- | arch/blackfin/include/asm/swab.h | 50 | ||||
-rw-r--r-- | arch/blackfin/include/asm/system.h | 192 |
13 files changed, 515 insertions, 0 deletions
diff --git a/arch/blackfin/include/asm/byteorder.h b/arch/blackfin/include/asm/byteorder.h new file mode 100644 index 00000000000..9558416d578 --- /dev/null +++ b/arch/blackfin/include/asm/byteorder.h | |||
@@ -0,0 +1 @@ | |||
#include <linux/byteorder/little_endian.h> | |||
diff --git a/arch/blackfin/include/asm/cachectl.h b/arch/blackfin/include/asm/cachectl.h new file mode 100644 index 00000000000..03255df6c1e --- /dev/null +++ b/arch/blackfin/include/asm/cachectl.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * based on the mips/cachectl.h | ||
3 | * | ||
4 | * Copyright 2010 Analog Devices Inc. | ||
5 | * Copyright (C) 1994, 1995, 1996 by Ralf Baechle | ||
6 | * | ||
7 | * Licensed under the GPL-2 or later. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_CACHECTL | ||
11 | #define _ASM_CACHECTL | ||
12 | |||
13 | /* | ||
14 | * Options for cacheflush system call | ||
15 | */ | ||
16 | #define ICACHE (1<<0) /* flush instruction cache */ | ||
17 | #define DCACHE (1<<1) /* writeback and flush data cache */ | ||
18 | #define BCACHE (ICACHE|DCACHE) /* flush both caches */ | ||
19 | |||
20 | #endif /* _ASM_CACHECTL */ | ||
diff --git a/arch/blackfin/include/asm/fcntl.h b/arch/blackfin/include/asm/fcntl.h new file mode 100644 index 00000000000..251c911d59c --- /dev/null +++ b/arch/blackfin/include/asm/fcntl.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2008 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | */ | ||
6 | |||
7 | #ifndef _BFIN_FCNTL_H | ||
8 | #define _BFIN_FCNTL_H | ||
9 | |||
10 | #define O_DIRECTORY 040000 /* must be a directory */ | ||
11 | #define O_NOFOLLOW 0100000 /* don't follow links */ | ||
12 | #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ | ||
13 | #define O_LARGEFILE 0400000 | ||
14 | |||
15 | #include <asm-generic/fcntl.h> | ||
16 | |||
17 | #endif | ||
diff --git a/arch/blackfin/include/asm/ioctls.h b/arch/blackfin/include/asm/ioctls.h new file mode 100644 index 00000000000..eca8d75b0a8 --- /dev/null +++ b/arch/blackfin/include/asm/ioctls.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ARCH_BFIN_IOCTLS_H__ | ||
2 | #define __ARCH_BFIN_IOCTLS_H__ | ||
3 | |||
4 | #define FIOQSIZE 0x545E | ||
5 | #include <asm-generic/ioctls.h> | ||
6 | |||
7 | #endif | ||
diff --git a/arch/blackfin/include/asm/mutex.h b/arch/blackfin/include/asm/mutex.h new file mode 100644 index 00000000000..ff6101aa2c7 --- /dev/null +++ b/arch/blackfin/include/asm/mutex.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/mutex-dec.h> | |||
diff --git a/arch/blackfin/include/asm/poll.h b/arch/blackfin/include/asm/poll.h new file mode 100644 index 00000000000..072d8966c5c --- /dev/null +++ b/arch/blackfin/include/asm/poll.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2009 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef __BFIN_POLL_H | ||
9 | #define __BFIN_POLL_H | ||
10 | |||
11 | #define POLLWRNORM 4 /* POLLOUT */ | ||
12 | #define POLLWRBAND 256 | ||
13 | |||
14 | #include <asm-generic/poll.h> | ||
15 | |||
16 | #endif | ||
diff --git a/arch/blackfin/include/asm/posix_types.h b/arch/blackfin/include/asm/posix_types.h new file mode 100644 index 00000000000..41bc1875c4d --- /dev/null +++ b/arch/blackfin/include/asm/posix_types.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2009 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | */ | ||
6 | |||
7 | #ifndef __ARCH_BFIN_POSIX_TYPES_H | ||
8 | #define __ARCH_BFIN_POSIX_TYPES_H | ||
9 | |||
10 | typedef unsigned short __kernel_mode_t; | ||
11 | #define __kernel_mode_t __kernel_mode_t | ||
12 | |||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned int __kernel_ipc_pid_t; | ||
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | ||
18 | |||
19 | typedef unsigned long __kernel_size_t; | ||
20 | typedef long __kernel_ssize_t; | ||
21 | typedef int __kernel_ptrdiff_t; | ||
22 | #define __kernel_size_t __kernel_size_t | ||
23 | |||
24 | typedef unsigned short __kernel_old_uid_t; | ||
25 | typedef unsigned short __kernel_old_gid_t; | ||
26 | #define __kernel_old_uid_t __kernel_old_uid_t | ||
27 | |||
28 | typedef unsigned short __kernel_old_dev_t; | ||
29 | #define __kernel_old_dev_t __kernel_old_dev_t | ||
30 | |||
31 | #include <asm-generic/posix_types.h> | ||
32 | |||
33 | #endif | ||
diff --git a/arch/blackfin/include/asm/sigcontext.h b/arch/blackfin/include/asm/sigcontext.h new file mode 100644 index 00000000000..906bdc1f5fd --- /dev/null +++ b/arch/blackfin/include/asm/sigcontext.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2008 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASM_BLACKFIN_SIGCONTEXT_H | ||
8 | #define _ASM_BLACKFIN_SIGCONTEXT_H | ||
9 | |||
10 | /* Add new entries at the end of the structure only. */ | ||
11 | struct sigcontext { | ||
12 | unsigned long sc_r0; | ||
13 | unsigned long sc_r1; | ||
14 | unsigned long sc_r2; | ||
15 | unsigned long sc_r3; | ||
16 | unsigned long sc_r4; | ||
17 | unsigned long sc_r5; | ||
18 | unsigned long sc_r6; | ||
19 | unsigned long sc_r7; | ||
20 | unsigned long sc_p0; | ||
21 | unsigned long sc_p1; | ||
22 | unsigned long sc_p2; | ||
23 | unsigned long sc_p3; | ||
24 | unsigned long sc_p4; | ||
25 | unsigned long sc_p5; | ||
26 | unsigned long sc_usp; | ||
27 | unsigned long sc_a0w; | ||
28 | unsigned long sc_a1w; | ||
29 | unsigned long sc_a0x; | ||
30 | unsigned long sc_a1x; | ||
31 | unsigned long sc_astat; | ||
32 | unsigned long sc_rets; | ||
33 | unsigned long sc_pc; | ||
34 | unsigned long sc_retx; | ||
35 | unsigned long sc_fp; | ||
36 | unsigned long sc_i0; | ||
37 | unsigned long sc_i1; | ||
38 | unsigned long sc_i2; | ||
39 | unsigned long sc_i3; | ||
40 | unsigned long sc_m0; | ||
41 | unsigned long sc_m1; | ||
42 | unsigned long sc_m2; | ||
43 | unsigned long sc_m3; | ||
44 | unsigned long sc_l0; | ||
45 | unsigned long sc_l1; | ||
46 | unsigned long sc_l2; | ||
47 | unsigned long sc_l3; | ||
48 | unsigned long sc_b0; | ||
49 | unsigned long sc_b1; | ||
50 | unsigned long sc_b2; | ||
51 | unsigned long sc_b3; | ||
52 | unsigned long sc_lc0; | ||
53 | unsigned long sc_lc1; | ||
54 | unsigned long sc_lt0; | ||
55 | unsigned long sc_lt1; | ||
56 | unsigned long sc_lb0; | ||
57 | unsigned long sc_lb1; | ||
58 | unsigned long sc_seqstat; | ||
59 | }; | ||
60 | |||
61 | #endif | ||
diff --git a/arch/blackfin/include/asm/siginfo.h b/arch/blackfin/include/asm/siginfo.h new file mode 100644 index 00000000000..3e81306394e --- /dev/null +++ b/arch/blackfin/include/asm/siginfo.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2008 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | */ | ||
6 | |||
7 | #ifndef _BFIN_SIGINFO_H | ||
8 | #define _BFIN_SIGINFO_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <asm-generic/siginfo.h> | ||
12 | |||
13 | #define UID16_SIGINFO_COMPAT_NEEDED | ||
14 | |||
15 | #define si_uid16 _sifields._kill._uid | ||
16 | |||
17 | #define ILL_ILLPARAOP (__SI_FAULT|2) /* illegal opcode combine ********** */ | ||
18 | #define ILL_ILLEXCPT (__SI_FAULT|4) /* unrecoverable exception ********** */ | ||
19 | #define ILL_CPLB_VI (__SI_FAULT|9) /* D/I CPLB protect violation ******** */ | ||
20 | #define ILL_CPLB_MISS (__SI_FAULT|10) /* D/I CPLB miss ******** */ | ||
21 | #define ILL_CPLB_MULHIT (__SI_FAULT|11) /* D/I CPLB multiple hit ******** */ | ||
22 | |||
23 | /* | ||
24 | * SIGBUS si_codes | ||
25 | */ | ||
26 | #define BUS_OPFETCH (__SI_FAULT|4) /* error from instruction fetch ******** */ | ||
27 | |||
28 | /* | ||
29 | * SIGTRAP si_codes | ||
30 | */ | ||
31 | #define TRAP_STEP (__SI_FAULT|1) /* single-step breakpoint************* */ | ||
32 | #define TRAP_TRACEFLOW (__SI_FAULT|2) /* trace buffer overflow ************* */ | ||
33 | #define TRAP_WATCHPT (__SI_FAULT|3) /* watchpoint match ************* */ | ||
34 | #define TRAP_ILLTRAP (__SI_FAULT|4) /* illegal trap ************* */ | ||
35 | |||
36 | /* | ||
37 | * SIGSEGV si_codes | ||
38 | */ | ||
39 | #define SEGV_STACKFLOW (__SI_FAULT|3) /* stack overflow */ | ||
40 | |||
41 | #endif | ||
diff --git a/arch/blackfin/include/asm/signal.h b/arch/blackfin/include/asm/signal.h new file mode 100644 index 00000000000..77a3bf37b69 --- /dev/null +++ b/arch/blackfin/include/asm/signal.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _BLACKFIN_SIGNAL_H | ||
2 | #define _BLACKFIN_SIGNAL_H | ||
3 | |||
4 | #define SA_RESTORER 0x04000000 | ||
5 | #include <asm-generic/signal.h> | ||
6 | |||
7 | #endif | ||
diff --git a/arch/blackfin/include/asm/stat.h b/arch/blackfin/include/asm/stat.h new file mode 100644 index 00000000000..2e27665c4e9 --- /dev/null +++ b/arch/blackfin/include/asm/stat.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2006 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2. | ||
5 | */ | ||
6 | |||
7 | #ifndef _BFIN_STAT_H | ||
8 | #define _BFIN_STAT_H | ||
9 | |||
10 | struct stat { | ||
11 | unsigned short st_dev; | ||
12 | unsigned short __pad1; | ||
13 | unsigned long st_ino; | ||
14 | unsigned short st_mode; | ||
15 | unsigned short st_nlink; | ||
16 | unsigned short st_uid; | ||
17 | unsigned short st_gid; | ||
18 | unsigned short st_rdev; | ||
19 | unsigned short __pad2; | ||
20 | unsigned long st_size; | ||
21 | unsigned long st_blksize; | ||
22 | unsigned long st_blocks; | ||
23 | unsigned long st_atime; | ||
24 | unsigned long __unused1; | ||
25 | unsigned long st_mtime; | ||
26 | unsigned long __unused2; | ||
27 | unsigned long st_ctime; | ||
28 | unsigned long __unused3; | ||
29 | unsigned long __unused4; | ||
30 | unsigned long __unused5; | ||
31 | }; | ||
32 | |||
33 | /* This matches struct stat64 in glibc2.1, hence the absolutely | ||
34 | * insane amounts of padding around dev_t's. | ||
35 | */ | ||
36 | struct stat64 { | ||
37 | unsigned long long st_dev; | ||
38 | unsigned char __pad1[4]; | ||
39 | |||
40 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
41 | unsigned long __st_ino; | ||
42 | |||
43 | unsigned int st_mode; | ||
44 | unsigned int st_nlink; | ||
45 | |||
46 | unsigned long st_uid; | ||
47 | unsigned long st_gid; | ||
48 | |||
49 | unsigned long long st_rdev; | ||
50 | unsigned char __pad2[4]; | ||
51 | |||
52 | long long st_size; | ||
53 | unsigned long st_blksize; | ||
54 | |||
55 | long long st_blocks; /* Number 512-byte blocks allocated. */ | ||
56 | |||
57 | unsigned long st_atime; | ||
58 | unsigned long st_atime_nsec; | ||
59 | |||
60 | unsigned long st_mtime; | ||
61 | unsigned long st_mtime_nsec; | ||
62 | |||
63 | unsigned long st_ctime; | ||
64 | unsigned long st_ctime_nsec; | ||
65 | |||
66 | unsigned long long st_ino; | ||
67 | }; | ||
68 | |||
69 | #endif /* _BFIN_STAT_H */ | ||
diff --git a/arch/blackfin/include/asm/swab.h b/arch/blackfin/include/asm/swab.h new file mode 100644 index 00000000000..89de6507ca2 --- /dev/null +++ b/arch/blackfin/include/asm/swab.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | */ | ||
6 | |||
7 | #ifndef _BLACKFIN_SWAB_H | ||
8 | #define _BLACKFIN_SWAB_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <asm-generic/swab.h> | ||
12 | |||
13 | #ifdef __GNUC__ | ||
14 | |||
15 | static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx) | ||
16 | { | ||
17 | __u32 tmp; | ||
18 | __asm__("%1 = %0 >> 8 (V);\n\t" | ||
19 | "%0 = %0 << 8 (V);\n\t" | ||
20 | "%0 = %0 | %1;\n\t" | ||
21 | : "+d"(xx), "=&d"(tmp)); | ||
22 | return xx; | ||
23 | } | ||
24 | #define __arch_swahb32 __arch_swahb32 | ||
25 | |||
26 | static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx) | ||
27 | { | ||
28 | __u32 rv; | ||
29 | __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx)); | ||
30 | return rv; | ||
31 | } | ||
32 | #define __arch_swahw32 __arch_swahw32 | ||
33 | |||
34 | static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx) | ||
35 | { | ||
36 | return __arch_swahb32(__arch_swahw32(xx)); | ||
37 | } | ||
38 | #define __arch_swab32 __arch_swab32 | ||
39 | |||
40 | static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx) | ||
41 | { | ||
42 | __u32 xw = xx; | ||
43 | __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw)); | ||
44 | return (__u16)xw; | ||
45 | } | ||
46 | #define __arch_swab16 __arch_swab16 | ||
47 | |||
48 | #endif /* __GNUC__ */ | ||
49 | |||
50 | #endif /* _BLACKFIN_SWAB_H */ | ||
diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/system.h new file mode 100644 index 00000000000..44bd0cced72 --- /dev/null +++ b/arch/blackfin/include/asm/system.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2009 Analog Devices Inc. | ||
3 | * Tony Kou (tonyko@lineo.ca) | ||
4 | * | ||
5 | * Licensed under the GPL-2 or later | ||
6 | */ | ||
7 | |||
8 | #ifndef _BLACKFIN_SYSTEM_H | ||
9 | #define _BLACKFIN_SYSTEM_H | ||
10 | |||
11 | #include <linux/linkage.h> | ||
12 | #include <linux/irqflags.h> | ||
13 | #include <mach/anomaly.h> | ||
14 | #include <asm/cache.h> | ||
15 | #include <asm/pda.h> | ||
16 | #include <asm/irq.h> | ||
17 | |||
18 | /* | ||
19 | * Force strict CPU ordering. | ||
20 | */ | ||
21 | #define nop() __asm__ __volatile__ ("nop;\n\t" : : ) | ||
22 | #define smp_mb() mb() | ||
23 | #define smp_rmb() rmb() | ||
24 | #define smp_wmb() wmb() | ||
25 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
26 | #define smp_read_barrier_depends() read_barrier_depends() | ||
27 | |||
28 | #ifdef CONFIG_SMP | ||
29 | asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value); | ||
30 | asmlinkage unsigned long __raw_xchg_2_asm(volatile void *ptr, unsigned long value); | ||
31 | asmlinkage unsigned long __raw_xchg_4_asm(volatile void *ptr, unsigned long value); | ||
32 | asmlinkage unsigned long __raw_cmpxchg_1_asm(volatile void *ptr, | ||
33 | unsigned long new, unsigned long old); | ||
34 | asmlinkage unsigned long __raw_cmpxchg_2_asm(volatile void *ptr, | ||
35 | unsigned long new, unsigned long old); | ||
36 | asmlinkage unsigned long __raw_cmpxchg_4_asm(volatile void *ptr, | ||
37 | unsigned long new, unsigned long old); | ||
38 | |||
39 | #ifdef __ARCH_SYNC_CORE_DCACHE | ||
40 | /* Force Core data cache coherence */ | ||
41 | # define mb() do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0) | ||
42 | # define rmb() do { barrier(); smp_check_barrier(); } while (0) | ||
43 | # define wmb() do { barrier(); smp_mark_barrier(); } while (0) | ||
44 | # define read_barrier_depends() do { barrier(); smp_check_barrier(); } while (0) | ||
45 | #else | ||
46 | # define mb() barrier() | ||
47 | # define rmb() barrier() | ||
48 | # define wmb() barrier() | ||
49 | # define read_barrier_depends() do { } while (0) | ||
50 | #endif | ||
51 | |||
52 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | ||
53 | int size) | ||
54 | { | ||
55 | unsigned long tmp; | ||
56 | |||
57 | switch (size) { | ||
58 | case 1: | ||
59 | tmp = __raw_xchg_1_asm(ptr, x); | ||
60 | break; | ||
61 | case 2: | ||
62 | tmp = __raw_xchg_2_asm(ptr, x); | ||
63 | break; | ||
64 | case 4: | ||
65 | tmp = __raw_xchg_4_asm(ptr, x); | ||
66 | break; | ||
67 | } | ||
68 | |||
69 | return tmp; | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
74 | * store NEW in MEM. Return the initial value in MEM. Success is | ||
75 | * indicated by comparing RETURN with OLD. | ||
76 | */ | ||
77 | static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | ||
78 | unsigned long new, int size) | ||
79 | { | ||
80 | unsigned long tmp; | ||
81 | |||
82 | switch (size) { | ||
83 | case 1: | ||
84 | tmp = __raw_cmpxchg_1_asm(ptr, new, old); | ||
85 | break; | ||
86 | case 2: | ||
87 | tmp = __raw_cmpxchg_2_asm(ptr, new, old); | ||
88 | break; | ||
89 | case 4: | ||
90 | tmp = __raw_cmpxchg_4_asm(ptr, new, old); | ||
91 | break; | ||
92 | } | ||
93 | |||
94 | return tmp; | ||
95 | } | ||
96 | #define cmpxchg(ptr, o, n) \ | ||
97 | ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ | ||
98 | (unsigned long)(n), sizeof(*(ptr)))) | ||
99 | |||
100 | #else /* !CONFIG_SMP */ | ||
101 | |||
102 | #define mb() barrier() | ||
103 | #define rmb() barrier() | ||
104 | #define wmb() barrier() | ||
105 | #define read_barrier_depends() do { } while (0) | ||
106 | |||
107 | struct __xchg_dummy { | ||
108 | unsigned long a[100]; | ||
109 | }; | ||
110 | #define __xg(x) ((volatile struct __xchg_dummy *)(x)) | ||
111 | |||
112 | #include <mach/blackfin.h> | ||
113 | |||
114 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | ||
115 | int size) | ||
116 | { | ||
117 | unsigned long tmp = 0; | ||
118 | unsigned long flags; | ||
119 | |||
120 | flags = hard_local_irq_save(); | ||
121 | |||
122 | switch (size) { | ||
123 | case 1: | ||
124 | __asm__ __volatile__ | ||
125 | ("%0 = b%2 (z);\n\t" | ||
126 | "b%2 = %1;\n\t" | ||
127 | : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
128 | break; | ||
129 | case 2: | ||
130 | __asm__ __volatile__ | ||
131 | ("%0 = w%2 (z);\n\t" | ||
132 | "w%2 = %1;\n\t" | ||
133 | : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
134 | break; | ||
135 | case 4: | ||
136 | __asm__ __volatile__ | ||
137 | ("%0 = %2;\n\t" | ||
138 | "%2 = %1;\n\t" | ||
139 | : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
140 | break; | ||
141 | } | ||
142 | hard_local_irq_restore(flags); | ||
143 | return tmp; | ||
144 | } | ||
145 | |||
146 | #include <asm-generic/cmpxchg-local.h> | ||
147 | |||
148 | /* | ||
149 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
150 | * them available. | ||
151 | */ | ||
152 | #define cmpxchg_local(ptr, o, n) \ | ||
153 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
154 | (unsigned long)(n), sizeof(*(ptr)))) | ||
155 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
156 | |||
157 | #include <asm-generic/cmpxchg.h> | ||
158 | |||
159 | #endif /* !CONFIG_SMP */ | ||
160 | |||
161 | #define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
162 | #define tas(ptr) ((void)xchg((ptr), 1)) | ||
163 | |||
164 | #define prepare_to_switch() do { } while(0) | ||
165 | |||
166 | /* | ||
167 | * switch_to(n) should switch tasks to task ptr, first checking that | ||
168 | * ptr isn't the current task, in which case it does nothing. | ||
169 | */ | ||
170 | |||
171 | #include <asm/l1layout.h> | ||
172 | #include <asm/mem_map.h> | ||
173 | |||
174 | asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next); | ||
175 | |||
176 | #ifndef CONFIG_SMP | ||
177 | #define switch_to(prev,next,last) \ | ||
178 | do { \ | ||
179 | memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \ | ||
180 | sizeof *L1_SCRATCH_TASK_INFO); \ | ||
181 | memcpy (L1_SCRATCH_TASK_INFO, &task_thread_info(next)->l1_task_info, \ | ||
182 | sizeof *L1_SCRATCH_TASK_INFO); \ | ||
183 | (last) = resume (prev, next); \ | ||
184 | } while (0) | ||
185 | #else | ||
186 | #define switch_to(prev, next, last) \ | ||
187 | do { \ | ||
188 | (last) = resume(prev, next); \ | ||
189 | } while (0) | ||
190 | #endif | ||
191 | |||
192 | #endif /* _BLACKFIN_SYSTEM_H */ | ||