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
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>
16 #include <asm-generic/cmpxchg.h>
17 #include <asm-generic/cmpxchg-local.h>
19 #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
24 extern struct task_struct *_switch_to(struct thread_info *prev,
25 struct thread_info *next);
27 #define switch_to(prev, next, last) \
29 (last) = _switch_to(task_thread_info(prev), \
30 task_thread_info(next)); \
33 #define smp_read_barrier_depends() do {} while (0)
34 #define read_barrier_depends() do {} while (0)
36 #define nop() asm volatile ("nop")
37 #define mb() barrier()
40 #define set_mb(var, value) do { var = value; mb(); } while (0)
41 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
44 #define smp_rmb() rmb()
45 #define smp_wmb() wmb()
47 void show_trace(struct task_struct *task, unsigned long *stack);
48 void __bad_xchg(volatile void *ptr, int size);
50 static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
58 local_irq_save(flags);
59 ret = *(volatile unsigned char *)ptr;
60 *(volatile unsigned char *)ptr = x;
61 local_irq_restore(flags);
65 local_irq_save(flags);
66 ret = *(volatile unsigned long *)ptr;
67 *(volatile unsigned long *)ptr = x;
68 local_irq_restore(flags);
71 __bad_xchg(ptr, size), ret = 0;
78 void disable_hlt(void);
79 void enable_hlt(void);
80 void default_idle(void);
82 #define xchg(ptr, x) \
83 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
85 void free_init_pages(char *what, unsigned long begin, unsigned long end);
86 void free_initmem(void);
88 extern void ret_from_fork(void);
90 #ifdef CONFIG_DEBUG_FS
91 extern struct dentry *of_debugfs_root;
94 #define arch_align_stack(x) (x)
96 #endif /* _ASM_MICROBLAZE_SYSTEM_H */