1 #ifndef __PARISC_SYSTEM_H
2 #define __PARISC_SYSTEM_H
6 /* The program status word as bitfields. */
37 #define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW))
41 extern struct task_struct
*_switch_to(struct task_struct
*, struct task_struct
*);
43 #define prepare_to_switch() do { } while(0)
44 #define switch_to(prev, next, last) do { \
45 (last) = _switch_to(prev, next); \
48 /* borrowed this from sparc64 -- probably the SMP case is hosed for us */
51 #define smp_rmb() rmb()
52 #define smp_wmb() wmb()
54 /* This is simply the barrier() macro from linux/kernel.h but when serial.c
55 * uses tqueue.h uses smp_mb() defined using barrier(), linux/kernel.h
56 * hasn't yet been included yet so it fails, thus repeating the macro here.
58 #define smp_mb() __asm__ __volatile__("":::"memory");
59 #define smp_rmb() __asm__ __volatile__("":::"memory");
60 #define smp_wmb() __asm__ __volatile__("":::"memory");
63 /* interrupt control */
64 #define __save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory")
65 #define __restore_flags(x) __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory")
66 #define __cli() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
67 #define __sti() __asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
69 #define local_irq_save(x) \
70 __asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" )
71 #define local_irq_restore(x) \
72 __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory" )
73 #define local_irq_disable() __cli()
74 #define local_irq_enable() __sti()
80 #define save_flags(x) __save_flags(x)
81 #define restore_flags(x) __restore_flags(x)
85 #define mfctl(reg) ({ \
87 __asm__ __volatile__( \
88 "mfctl " #reg ",%0" : \
94 #define mtctl(gr, cr) \
95 __asm__ __volatile__("mtctl %0,%1" \
99 /* these are here to de-mystefy the calling code, and to provide hooks */
100 /* which I needed for debugging EIEM problems -PB */
101 #define get_eiem() mfctl(15)
102 static inline void set_eiem(unsigned long val
)
107 #define mfsp(reg) ({ \
109 __asm__ __volatile__( \
110 "mfsp " #reg ",%0" : \
116 #define mtsp(gr, cr) \
117 __asm__ __volatile__("mtsp %0,%1" \
119 : "r" (gr), "i" (cr))
122 #define mb() __asm__ __volatile__ ("sync" : : :"memory")
125 extern unsigned long __xchg(unsigned long, unsigned long *, int);
127 #define xchg(ptr,x) \
128 (__typeof__(*(ptr)))__xchg((unsigned long)(x),(unsigned long*)(ptr),sizeof(*(ptr)))
130 /* LDCW, the only atomic read-write operation PA-RISC has. Sigh. */
131 #define __ldcw(a) ({ \
133 __asm__ __volatile__("ldcw 0(%1),%0" : "=r" (__ret) : "r" (a)); \
139 * Your basic SMP spinlocks, allowing only a single CPU anywhere
143 volatile unsigned int __attribute__((aligned(16))) lock
;