Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_CRIS_SYSTEM_H |
| 2 | #define __ASM_CRIS_SYSTEM_H |
| 3 | |
| 4 | #include <asm/arch/system.h> |
| 5 | |
| 6 | /* the switch_to macro calls resume, an asm function in entry.S which does the actual |
| 7 | * task switching. |
| 8 | */ |
| 9 | |
| 10 | extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #define switch_to(prev,next,last) last = resume(prev,next, \ |
| 12 | (int)&((struct task_struct *)0)->thread) |
| 13 | |
| 14 | #define barrier() __asm__ __volatile__("": : :"memory") |
| 15 | #define mb() barrier() |
| 16 | #define rmb() mb() |
| 17 | #define wmb() mb() |
| 18 | #define read_barrier_depends() do { } while(0) |
| 19 | #define set_mb(var, value) do { var = value; mb(); } while (0) |
| 20 | #define set_wmb(var, value) do { var = value; wmb(); } 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 |
| 40 | void disable_hlt(void); |
| 41 | void enable_hlt(void); |
| 42 | |
Adrian Bunk | d9b5444 | 2005-11-07 00:58:44 -0800 | [diff] [blame] | 43 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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_save_flags(flags); /* save flags, including irq enable bit */ |
| 49 | local_irq_disable(); /* shut off irq's */ |
| 50 | switch (size) { |
| 51 | case 1: |
| 52 | *((unsigned char *)&temp) = x; |
| 53 | x = *(unsigned char *)ptr; |
| 54 | *(unsigned char *)ptr = *((unsigned char *)&temp); |
| 55 | break; |
| 56 | case 2: |
| 57 | *((unsigned short *)&temp) = x; |
| 58 | x = *(unsigned short *)ptr; |
| 59 | *(unsigned short *)ptr = *((unsigned short *)&temp); |
| 60 | break; |
| 61 | case 4: |
| 62 | temp = x; |
| 63 | x = *(unsigned long *)ptr; |
| 64 | *(unsigned long *)ptr = temp; |
| 65 | break; |
| 66 | } |
| 67 | local_irq_restore(flags); /* restore irq enable bit */ |
| 68 | return x; |
| 69 | } |
| 70 | |
| 71 | #define arch_align_stack(x) (x) |
| 72 | |
Adrian Bunk | cdb0452 | 2006-03-24 03:15:57 -0800 | [diff] [blame] | 73 | void default_idle(void); |
| 74 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | #endif |