[PATCH] x86_64: Only let user select PM timer support when EMBEDDED
[linux-2.6/x86.git] / include / asm-arm26 / system.h
blobca4ccfc4b578cc44184667aaac94b5b0d9764022
1 #ifndef __ASM_ARM_SYSTEM_H
2 #define __ASM_ARM_SYSTEM_H
4 #ifdef __KERNEL__
6 #include <linux/config.h>
8 /*
9 * This is used to ensure the compiler did actually allocate the register we
10 * asked it for some inline assembly sequences. Apparently we can't trust
11 * the compiler from one version to another so a bit of paranoia won't hurt.
12 * This string is meant to be concatenated with the inline asm string and
13 * will cause compilation to stop on mismatch. (From ARM32 - may come in handy)
15 #define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
17 #ifndef __ASSEMBLY__
19 #include <linux/linkage.h>
21 struct thread_info;
22 struct task_struct;
24 #if 0
25 /* information about the system we're running on */
26 extern unsigned int system_rev;
27 extern unsigned int system_serial_low;
28 extern unsigned int system_serial_high;
29 extern unsigned int mem_fclk_21285;
31 FIXME - sort this
33 * We need to turn the caches off before calling the reset vector - RiscOS
34 * messes up if we don't
36 #define proc_hard_reset() cpu_proc_fin()
38 #endif
40 struct pt_regs;
42 void die(const char *msg, struct pt_regs *regs, int err)
43 __attribute__((noreturn));
45 void die_if_kernel(const char *str, struct pt_regs *regs, int err);
47 void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
48 struct pt_regs *),
49 int sig, const char *name);
51 #include <asm/proc-fns.h>
53 #define xchg(ptr,x) \
54 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
56 #define tas(ptr) (xchg((ptr),1))
58 extern asmlinkage void __backtrace(void);
60 #define set_cr(x) \
61 __asm__ __volatile__( \
62 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \
63 : : "r" (x) : "cc")
65 #define get_cr() \
66 ({ \
67 unsigned int __val; \
68 __asm__ __volatile__( \
69 "mrc p15, 0, %0, c1, c0, 0 @ get CR" \
70 : "=r" (__val) : : "cc"); \
71 __val; \
74 extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
75 extern unsigned long cr_alignment; /* defined in entry-armv.S */
77 #define UDBG_UNDEFINED (1 << 0)
78 #define UDBG_SYSCALL (1 << 1)
79 #define UDBG_BADABORT (1 << 2)
80 #define UDBG_SEGV (1 << 3)
81 #define UDBG_BUS (1 << 4)
83 extern unsigned int user_debug;
85 #define vectors_base() (0)
87 #define mb() __asm__ __volatile__ ("" : : : "memory")
88 #define rmb() mb()
89 #define wmb() mb()
90 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
92 #define read_barrier_depends() do { } while(0)
93 #define set_mb(var, value) do { var = value; mb(); } while (0)
94 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
97 * We assume knowledge of how
98 * spin_unlock_irq() and friends are implemented. This avoids
99 * us needlessly decrementing and incrementing the preempt count.
101 #define prepare_arch_switch(rq,next) local_irq_enable()
102 #define finish_arch_switch(rq,prev) spin_unlock(&(rq)->lock)
103 #define task_running(rq,p) ((rq)->curr == (p))
106 * switch_to(prev, next) should switch from task `prev' to `next'
107 * `prev' will never be the same as `next'. schedule() itself
108 * contains the memory barrier to tell GCC not to cache `current'.
110 extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
112 #define switch_to(prev,next,last) \
113 do { \
114 last = __switch_to(prev,task_thread_info(prev),task_thread_info(next)); \
115 } while (0)
118 * On SMP systems, when the scheduler does migration-cost autodetection,
119 * it needs a way to flush as much of the CPU's caches as possible.
121 * TODO: fill this in!
123 static inline void sched_cacheflush(void)
128 * Save the current interrupt enable state & disable IRQs
130 #define local_irq_save(x) \
131 do { \
132 unsigned long temp; \
133 __asm__ __volatile__( \
134 " mov %0, pc @ save_flags_cli\n" \
135 " orr %1, %0, #0x08000000\n" \
136 " and %0, %0, #0x0c000000\n" \
137 " teqp %1, #0\n" \
138 : "=r" (x), "=r" (temp) \
140 : "memory"); \
141 } while (0)
144 * Enable IRQs (sti)
146 #define local_irq_enable() \
147 do { \
148 unsigned long temp; \
149 __asm__ __volatile__( \
150 " mov %0, pc @ sti\n" \
151 " bic %0, %0, #0x08000000\n" \
152 " teqp %0, #0\n" \
153 : "=r" (temp) \
155 : "memory"); \
156 } while(0)
159 * Disable IRQs (cli)
161 #define local_irq_disable() \
162 do { \
163 unsigned long temp; \
164 __asm__ __volatile__( \
165 " mov %0, pc @ cli\n" \
166 " orr %0, %0, #0x08000000\n" \
167 " teqp %0, #0\n" \
168 : "=r" (temp) \
170 : "memory"); \
171 } while(0)
173 /* Enable FIQs (stf) */
175 #define __stf() do { \
176 unsigned long temp; \
177 __asm__ __volatile__( \
178 " mov %0, pc @ stf\n" \
179 " bic %0, %0, #0x04000000\n" \
180 " teqp %0, #0\n" \
181 : "=r" (temp)); \
182 } while(0)
184 /* Disable FIQs (clf) */
186 #define __clf() do { \
187 unsigned long temp; \
188 __asm__ __volatile__( \
189 " mov %0, pc @ clf\n" \
190 " orr %0, %0, #0x04000000\n" \
191 " teqp %0, #0\n" \
192 : "=r" (temp)); \
193 } while(0)
197 * Save the current interrupt enable state.
199 #define local_save_flags(x) \
200 do { \
201 __asm__ __volatile__( \
202 " mov %0, pc @ save_flags\n" \
203 " and %0, %0, #0x0c000000\n" \
204 : "=r" (x)); \
205 } while (0)
209 * restore saved IRQ & FIQ state
211 #define local_irq_restore(x) \
212 do { \
213 unsigned long temp; \
214 __asm__ __volatile__( \
215 " mov %0, pc @ restore_flags\n" \
216 " bic %0, %0, #0x0c000000\n" \
217 " orr %0, %0, %1\n" \
218 " teqp %0, #0\n" \
219 : "=&r" (temp) \
220 : "r" (x) \
221 : "memory"); \
222 } while (0)
225 #ifdef CONFIG_SMP
226 #error SMP not supported
227 #endif
229 #define smp_mb() barrier()
230 #define smp_rmb() barrier()
231 #define smp_wmb() barrier()
232 #define smp_read_barrier_depends() do { } while(0)
234 #define clf() __clf()
235 #define stf() __stf()
237 #define irqs_disabled() \
238 ({ \
239 unsigned long flags; \
240 local_save_flags(flags); \
241 flags & PSR_I_BIT; \
244 static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
246 extern void __bad_xchg(volatile void *, int);
248 switch (size) {
249 case 1: return cpu_xchg_1(x, ptr);
250 case 4: return cpu_xchg_4(x, ptr);
251 default: __bad_xchg(ptr, size);
253 return 0;
256 #endif /* __ASSEMBLY__ */
258 #define arch_align_stack(x) (x)
260 #endif /* __KERNEL__ */
262 #endif