2 * arch/ubicom32/include/asm/system.h
3 * Low level switching definitions.
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
23 * Ubicom32 implementation derived from (with many thanks):
28 #ifndef _ASM_UBICOM32_SYSTEM_H
29 #define _ASM_UBICOM32_SYSTEM_H
31 #include <linux/irqflags.h>
32 #include <linux/linkage.h>
33 #include <asm/segment.h>
34 #include <asm/entry.h>
37 #include <asm/percpu.h>
38 #include <asm/ubicom32-common.h>
39 #include <asm/processor.h>
42 * switch_to(n) should switch tasks to task ptr, first checking that
43 * ptr isn't the current task, in which case it does nothing.
45 asmlinkage
void resume(void);
46 extern void *__switch_to(struct task_struct
*prev
,
47 struct thread_struct
*prev_switch
,
48 struct thread_struct
*next_switch
);
51 * We will need a per linux thread sw_ksp for the switch_to macro to
52 * track the kernel stack pointer for the current thread on that linux thread.
54 #define switch_to(prev,next,last) \
58 __switch_to(prev, &prev->thread, &next->thread); \
63 * Force strict CPU ordering.
64 * Not really required on ubicom32...
66 #define nop() asm volatile ("nop"::)
67 #define mb() asm volatile ("" : : :"memory")
68 #define rmb() asm volatile ("" : : :"memory")
69 #define wmb() asm volatile ("" : : :"memory")
70 #define set_mb(var, value) ({ (var) = (value); wmb(); })
74 #define smp_rmb() rmb()
75 #define smp_wmb() wmb()
76 #define smp_read_barrier_depends() read_barrier_depends()
79 #define smp_rmb() rmb()
80 #define smp_wmb() wmb()
81 #define smp_read_barrier_depends() do { } while(0)
84 #define read_barrier_depends() ((void)0)
87 * The following defines change how the scheduler calls the switch_to()
90 * 1) The first causes the runqueue to be unlocked on entry to
91 * switch_to(). Since our ctx code does not play with the runqueue
92 * we do not need it unlocked.
94 * 2) The later turns interrupts on during a ctxsw to reduce the latency of
95 * interrupts during ctx. At this point in the port, we believe that this
96 * latency is not a problem since we have very little code to perform a ctxsw.
98 // #define __ARCH_WANT_UNLOCKED_CTXSW
99 // #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
101 #endif /* _ASM_UBICOM32_SYSTEM_H */