Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / microblaze / include / asm / system.h
blob5a433cbaafb3296f1c9df2239e9b4ed513b95418
1 /*
2 * Copyright (C) 2006 Atmark Techno, Inc.
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
9 #ifndef _ASM_MICROBLAZE_SYSTEM_H
10 #define _ASM_MICROBLAZE_SYSTEM_H
12 #include <asm/registers.h>
13 #include <asm/setup.h>
14 #include <asm/irqflags.h>
15 #include <asm/cache.h>
17 #include <asm-generic/cmpxchg.h>
18 #include <asm-generic/cmpxchg-local.h>
20 struct task_struct;
21 struct thread_info;
23 extern struct task_struct *_switch_to(struct thread_info *prev,
24 struct thread_info *next);
26 #define switch_to(prev, next, last) \
27 do { \
28 (last) = _switch_to(task_thread_info(prev), \
29 task_thread_info(next)); \
30 } while (0)
32 #define smp_read_barrier_depends() do {} while (0)
33 #define read_barrier_depends() do {} while (0)
35 #define nop() asm volatile ("nop")
36 #define mb() barrier()
37 #define rmb() mb()
38 #define wmb() mb()
39 #define set_mb(var, value) do { var = value; mb(); } while (0)
40 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
42 #define smp_mb() mb()
43 #define smp_rmb() rmb()
44 #define smp_wmb() wmb()
46 void __bad_xchg(volatile void *ptr, int size);
48 static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
49 int size)
51 unsigned long ret;
52 unsigned long flags;
54 switch (size) {
55 case 1:
56 local_irq_save(flags);
57 ret = *(volatile unsigned char *)ptr;
58 *(volatile unsigned char *)ptr = x;
59 local_irq_restore(flags);
60 break;
62 case 4:
63 local_irq_save(flags);
64 ret = *(volatile unsigned long *)ptr;
65 *(volatile unsigned long *)ptr = x;
66 local_irq_restore(flags);
67 break;
68 default:
69 __bad_xchg(ptr, size), ret = 0;
70 break;
73 return ret;
76 void disable_hlt(void);
77 void enable_hlt(void);
78 void default_idle(void);
80 #define xchg(ptr, x) \
81 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
83 void free_init_pages(char *what, unsigned long begin, unsigned long end);
84 void free_initmem(void);
85 extern char *klimit;
86 extern void ret_from_fork(void);
88 extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
89 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
91 #ifdef CONFIG_DEBUG_FS
92 extern struct dentry *of_debugfs_root;
93 #endif
95 #define arch_align_stack(x) (x)
97 #endif /* _ASM_MICROBLAZE_SYSTEM_H */