1 #ifndef __ASM_ARM_SYSTEM_H
2 #define __ASM_ARM_SYSTEM_H
3 
4 #ifdef __KERNEL__
5 
6 #include <linux/config.h>
7 #include <linux/kernel.h>
8 
9 /* information about the system we're running on */
10 extern unsigned int system_rev;
11 extern unsigned int system_serial_low;
12 extern unsigned int system_serial_high;
13 extern unsigned int mem_fclk_21285;
14 
15 /*
16  * This tells us if we have an ISA bridge
17  * present in a PCI system.
18  */
19 #ifdef CONFIG_PCI
20 extern int have_isa_bridge;
21 #else
22 #define have_isa_bridge		(0)
23 #endif
24 
25 struct pt_regs;
26 
27 void die(const char *msg, struct pt_regs *regs, int err)
28 		__attribute__((noreturn));
29 
30 void die_if_kernel(const char *str, struct pt_regs *regs, int err);
31 
32 #include <asm/proc-fns.h>
33 
34 #define xchg(ptr,x) \
35 	((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
36 
37 #define tas(ptr) (xchg((ptr),1))
38 
39 extern asmlinkage void __backtrace(void);
40 
41 /*
42  * Include processor dependent parts
43  */
44 #include <asm/proc/system.h>
45 
46 #define mb() __asm__ __volatile__ ("" : : : "memory")
47 #define rmb() mb()
48 #define wmb() mb()
49 #define set_mb(var, value)  do { var = value; mb(); } while (0)
50 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
51 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
52 
53 #define prepare_to_switch()    do { } while(0)
54 
55 /*
56  * switch_to(prev, next) should switch from task `prev' to `next'
57  * `prev' will never be the same as `next'.
58  * The `mb' is to tell GCC not to cache `current' across this call.
59  */
60 extern struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next);
61 
62 #define switch_to(prev,next,last)		\
63 	do {			 		\
64 		last = __switch_to(prev,next);	\
65 		mb();				\
66 	} while (0)
67 
68 /* For spinlocks etc */
69 #define __save_flags_cli(x)	local_irq_save(x)
70 #define __save_flags(x)		local_save_flags(x)
71 #define __restore_flags(x)	local_irq_restore(x)
72 #define __cli()			local_irq_disable()
73 #define __sti()			local_irq_enable()
74 
75 #ifdef CONFIG_SMP
76 #error SMP not supported
77 
78 #define smp_mb()		mb()
79 #define smp_rmb()		rmb()
80 #define smp_wmb()		wmb()
81 
82 #else
83 
84 #define smp_mb()		barrier()
85 #define smp_rmb()		barrier()
86 #define smp_wmb()		barrier()
87 
88 #define cli()			local_irq_disable()
89 #define sti()			local_irq_enable()
90 #define clf()			__clf()
91 #define stf()			__stf()
92 #define save_flags(x)		local_save_flags(x)
93 #define restore_flags(x)	local_irq_restore(x)
94 #define save_flags_cli(x)	local_irq_save(x)
95 #define save_and_cli(x)		local_irq_save(x)
96 #define save_and_sti(x)		local_irq_set(x)
97 
98 #endif /* CONFIG_SMP */
99 
100 #endif /* __KERNEL__ */
101 
102 #endif
103