aboutsummaryrefslogtreecommitdiffstats
path: root/arch/hexagon/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/hexagon/include/asm')
-rw-r--r--arch/hexagon/include/asm/atomic.h1
-rw-r--r--arch/hexagon/include/asm/barrier.h41
-rw-r--r--arch/hexagon/include/asm/bitops.h1
-rw-r--r--arch/hexagon/include/asm/cmpxchg.h (renamed from arch/hexagon/include/asm/system.h)46
-rw-r--r--arch/hexagon/include/asm/exec.h28
-rw-r--r--arch/hexagon/include/asm/switch_to.h34
6 files changed, 109 insertions, 42 deletions
diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h
index e220f905303..3e258043337 100644
--- a/arch/hexagon/include/asm/atomic.h
+++ b/arch/hexagon/include/asm/atomic.h
@@ -23,6 +23,7 @@
23#define _ASM_ATOMIC_H 23#define _ASM_ATOMIC_H
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26#include <asm/cmpxchg.h>
26 27
27#define ATOMIC_INIT(i) { (i) } 28#define ATOMIC_INIT(i) { (i) }
28#define atomic_set(v, i) ((v)->counter = (i)) 29#define atomic_set(v, i) ((v)->counter = (i))
diff --git a/arch/hexagon/include/asm/barrier.h b/arch/hexagon/include/asm/barrier.h
new file mode 100644
index 00000000000..a4ed6e26cb1
--- /dev/null
+++ b/arch/hexagon/include/asm/barrier.h
@@ -0,0 +1,41 @@
1/*
2 * Memory barrier definitions for the Hexagon architecture
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#ifndef _ASM_BARRIER_H
22#define _ASM_BARRIER_H
23
24#define rmb() barrier()
25#define read_barrier_depends() barrier()
26#define wmb() barrier()
27#define mb() barrier()
28#define smp_rmb() barrier()
29#define smp_read_barrier_depends() barrier()
30#define smp_wmb() barrier()
31#define smp_mb() barrier()
32#define smp_mb__before_atomic_dec() barrier()
33#define smp_mb__after_atomic_dec() barrier()
34#define smp_mb__before_atomic_inc() barrier()
35#define smp_mb__after_atomic_inc() barrier()
36
37/* Set a value and use a memory barrier. Used by the scheduler somewhere. */
38#define set_mb(var, value) \
39 do { var = value; mb(); } while (0)
40
41#endif /* _ASM_BARRIER_H */
diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h
index d23461e080f..4caa649ad78 100644
--- a/arch/hexagon/include/asm/bitops.h
+++ b/arch/hexagon/include/asm/bitops.h
@@ -24,7 +24,6 @@
24 24
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <asm/byteorder.h> 26#include <asm/byteorder.h>
27#include <asm/system.h>
28#include <asm/atomic.h> 27#include <asm/atomic.h>
29 28
30#ifdef __KERNEL__ 29#ifdef __KERNEL__
diff --git a/arch/hexagon/include/asm/system.h b/arch/hexagon/include/asm/cmpxchg.h
index 323ed1dd65e..c5f9527e1df 100644
--- a/arch/hexagon/include/asm/system.h
+++ b/arch/hexagon/include/asm/cmpxchg.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * System level definitions for the Hexagon architecture 2 * xchg/cmpxchg operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 * 5 *
6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 8 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation. 9 * only version 2 as published by the Free Software Foundation.
@@ -18,37 +19,8 @@
18 * 02110-1301, USA. 19 * 02110-1301, USA.
19 */ 20 */
20 21
21#ifndef _ASM_SYSTEM_H 22#ifndef _ASM_CMPXCHG_H
22#define _ASM_SYSTEM_H 23#define _ASM_CMPXCHG_H
23
24#include <linux/linkage.h>
25#include <linux/irqflags.h>
26#include <asm/atomic.h>
27#include <asm/hexagon_vm.h>
28
29struct thread_struct;
30
31extern struct task_struct *__switch_to(struct task_struct *,
32 struct task_struct *,
33 struct task_struct *);
34
35#define switch_to(p, n, r) do {\
36 r = __switch_to((p), (n), (r));\
37} while (0)
38
39
40#define rmb() barrier()
41#define read_barrier_depends() barrier()
42#define wmb() barrier()
43#define mb() barrier()
44#define smp_rmb() barrier()
45#define smp_read_barrier_depends() barrier()
46#define smp_wmb() barrier()
47#define smp_mb() barrier()
48#define smp_mb__before_atomic_dec() barrier()
49#define smp_mb__after_atomic_dec() barrier()
50#define smp_mb__before_atomic_inc() barrier()
51#define smp_mb__after_atomic_inc() barrier()
52 24
53/* 25/*
54 * __xchg - atomically exchange a register and a memory location 26 * __xchg - atomically exchange a register and a memory location
@@ -87,10 +59,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
87#define xchg(ptr, v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v), (ptr), \ 59#define xchg(ptr, v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v), (ptr), \
88 sizeof(*(ptr)))) 60 sizeof(*(ptr))))
89 61
90/* Set a value and use a memory barrier. Used by the scheduler somewhere. */
91#define set_mb(var, value) \
92 do { var = value; mb(); } while (0)
93
94/* 62/*
95 * see rt-mutex-design.txt; cmpxchg supposedly checks if *ptr == A and swaps. 63 * see rt-mutex-design.txt; cmpxchg supposedly checks if *ptr == A and swaps.
96 * looks just like atomic_cmpxchg on our arch currently with a bunch of 64 * looks just like atomic_cmpxchg on our arch currently with a bunch of
@@ -119,8 +87,4 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
119 __oldval; \ 87 __oldval; \
120}) 88})
121 89
122/* Should probably shoot for an 8-byte aligned stack pointer */ 90#endif /* _ASM_CMPXCHG_H */
123#define STACK_MASK (~7)
124#define arch_align_stack(x) (x & STACK_MASK)
125
126#endif
diff --git a/arch/hexagon/include/asm/exec.h b/arch/hexagon/include/asm/exec.h
new file mode 100644
index 00000000000..350e6d497d4
--- /dev/null
+++ b/arch/hexagon/include/asm/exec.h
@@ -0,0 +1,28 @@
1/*
2 * Process execution related definitions for the Hexagon architecture
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#ifndef _ASM_EXEC_H
22#define _ASM_EXEC_H
23
24/* Should probably shoot for an 8-byte aligned stack pointer */
25#define STACK_MASK (~7)
26#define arch_align_stack(x) (x & STACK_MASK)
27
28#endif /* _ASM_EXEC_H */
diff --git a/arch/hexagon/include/asm/switch_to.h b/arch/hexagon/include/asm/switch_to.h
new file mode 100644
index 00000000000..28ca0dfb606
--- /dev/null
+++ b/arch/hexagon/include/asm/switch_to.h
@@ -0,0 +1,34 @@
1/*
2 * Task switching definitions for the Hexagon architecture
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#ifndef _ASM_SWITCH_TO_H
22#define _ASM_SWITCH_TO_H
23
24struct thread_struct;
25
26extern struct task_struct *__switch_to(struct task_struct *,
27 struct task_struct *,
28 struct task_struct *);
29
30#define switch_to(p, n, r) do {\
31 r = __switch_to((p), (n), (r));\
32} while (0)
33
34#endif /* _ASM_SWITCH_TO_H */