aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/system.h')
-rw-r--r--include/asm-powerpc/system.h76
1 files changed, 24 insertions, 52 deletions
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 2b6559a6d11..d6648c14332 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -30,11 +30,11 @@
30 * 30 *
31 * For wmb(), we use sync since wmb is used in drivers to order 31 * For wmb(), we use sync since wmb is used in drivers to order
32 * stores to system memory with respect to writes to the device. 32 * stores to system memory with respect to writes to the device.
33 * However, smp_wmb() can be a lighter-weight eieio barrier on 33 * However, smp_wmb() can be a lighter-weight lwsync or eieio barrier
34 * SMP since it is only used to order updates to system memory. 34 * on SMP since it is only used to order updates to system memory.
35 */ 35 */
36#define mb() __asm__ __volatile__ ("sync" : : : "memory") 36#define mb() __asm__ __volatile__ ("sync" : : : "memory")
37#define rmb() __asm__ __volatile__ (__stringify(LWSYNC) : : : "memory") 37#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
38#define wmb() __asm__ __volatile__ ("sync" : : : "memory") 38#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
39#define read_barrier_depends() do { } while(0) 39#define read_barrier_depends() do { } while(0)
40 40
@@ -43,9 +43,16 @@
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44#define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */ 44#define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */
45#ifdef CONFIG_SMP 45#ifdef CONFIG_SMP
46
47#ifdef __SUBARCH_HAS_LWSYNC
48# define SMPWMB lwsync
49#else
50# define SMPWMB eieio
51#endif
52
46#define smp_mb() mb() 53#define smp_mb() mb()
47#define smp_rmb() rmb() 54#define smp_rmb() rmb()
48#define smp_wmb() eieio() 55#define smp_wmb() __asm__ __volatile__ (__stringify(SMPWMB) : : :"memory")
49#define smp_read_barrier_depends() read_barrier_depends() 56#define smp_read_barrier_depends() read_barrier_depends()
50#else 57#else
51#define smp_mb() barrier() 58#define smp_mb() barrier()
@@ -103,6 +110,8 @@ static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
103#endif 110#endif
104 111
105extern int set_dabr(unsigned long dabr); 112extern int set_dabr(unsigned long dabr);
113extern void do_dabr(struct pt_regs *regs, unsigned long address,
114 unsigned long error_code);
106extern void print_backtrace(unsigned long *); 115extern void print_backtrace(unsigned long *);
107extern void show_regs(struct pt_regs * regs); 116extern void show_regs(struct pt_regs * regs);
108extern void flush_instruction_cache(void); 117extern void flush_instruction_cache(void);
@@ -132,6 +141,8 @@ extern void enable_kernel_altivec(void);
132extern void giveup_altivec(struct task_struct *); 141extern void giveup_altivec(struct task_struct *);
133extern void load_up_altivec(struct task_struct *); 142extern void load_up_altivec(struct task_struct *);
134extern int emulate_altivec(struct pt_regs *); 143extern int emulate_altivec(struct pt_regs *);
144extern void __giveup_vsx(struct task_struct *);
145extern void giveup_vsx(struct task_struct *);
135extern void enable_kernel_spe(void); 146extern void enable_kernel_spe(void);
136extern void giveup_spe(struct task_struct *); 147extern void giveup_spe(struct task_struct *);
137extern void load_up_spe(struct task_struct *); 148extern void load_up_spe(struct task_struct *);
@@ -155,6 +166,14 @@ static inline void flush_altivec_to_thread(struct task_struct *t)
155} 166}
156#endif 167#endif
157 168
169#ifdef CONFIG_VSX
170extern void flush_vsx_to_thread(struct task_struct *);
171#else
172static inline void flush_vsx_to_thread(struct task_struct *t)
173{
174}
175#endif
176
158#ifdef CONFIG_SPE 177#ifdef CONFIG_SPE
159extern void flush_spe_to_thread(struct task_struct *); 178extern void flush_spe_to_thread(struct task_struct *);
160#else 179#else
@@ -190,6 +209,7 @@ extern struct task_struct *_switch(struct thread_struct *prev,
190 209
191extern unsigned int rtas_data; 210extern unsigned int rtas_data;
192extern int mem_init_done; /* set on boot once kmalloc can be called */ 211extern int mem_init_done; /* set on boot once kmalloc can be called */
212extern int init_bootmem_done; /* set on !NUMA once bootmem is available */
193extern unsigned long memory_limit; 213extern unsigned long memory_limit;
194extern unsigned long klimit; 214extern unsigned long klimit;
195 215
@@ -518,54 +538,6 @@ extern void reloc_got2(unsigned long);
518 538
519#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) 539#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
520 540
521static inline void create_instruction(unsigned long addr, unsigned int instr)
522{
523 unsigned int *p;
524 p = (unsigned int *)addr;
525 *p = instr;
526 asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (p));
527}
528
529/* Flags for create_branch:
530 * "b" == create_branch(addr, target, 0);
531 * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE);
532 * "bl" == create_branch(addr, target, BRANCH_SET_LINK);
533 * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK);
534 */
535#define BRANCH_SET_LINK 0x1
536#define BRANCH_ABSOLUTE 0x2
537
538static inline void create_branch(unsigned long addr,
539 unsigned long target, int flags)
540{
541 unsigned int instruction;
542
543 if (! (flags & BRANCH_ABSOLUTE))
544 target = target - addr;
545
546 /* Mask out the flags and target, so they don't step on each other. */
547 instruction = 0x48000000 | (flags & 0x3) | (target & 0x03FFFFFC);
548
549 create_instruction(addr, instruction);
550}
551
552static inline void create_function_call(unsigned long addr, void * func)
553{
554 unsigned long func_addr;
555
556#ifdef CONFIG_PPC64
557 /*
558 * On PPC64 the function pointer actually points to the function's
559 * descriptor. The first entry in the descriptor is the address
560 * of the function text.
561 */
562 func_addr = *(unsigned long *)func;
563#else
564 func_addr = (unsigned long)func;
565#endif
566 create_branch(addr, func_addr, BRANCH_SET_LINK);
567}
568
569#ifdef CONFIG_VIRT_CPU_ACCOUNTING 541#ifdef CONFIG_VIRT_CPU_ACCOUNTING
570extern void account_system_vtime(struct task_struct *); 542extern void account_system_vtime(struct task_struct *);
571#endif 543#endif