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.h72
1 files changed, 21 insertions, 51 deletions
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 5235f875b93..e6e25e2364e 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -30,8 +30,8 @@
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__ ("sync" : : : "memory") 37#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
@@ -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()
@@ -132,6 +139,8 @@ extern void enable_kernel_altivec(void);
132extern void giveup_altivec(struct task_struct *); 139extern void giveup_altivec(struct task_struct *);
133extern void load_up_altivec(struct task_struct *); 140extern void load_up_altivec(struct task_struct *);
134extern int emulate_altivec(struct pt_regs *); 141extern int emulate_altivec(struct pt_regs *);
142extern void __giveup_vsx(struct task_struct *);
143extern void giveup_vsx(struct task_struct *);
135extern void enable_kernel_spe(void); 144extern void enable_kernel_spe(void);
136extern void giveup_spe(struct task_struct *); 145extern void giveup_spe(struct task_struct *);
137extern void load_up_spe(struct task_struct *); 146extern void load_up_spe(struct task_struct *);
@@ -155,6 +164,14 @@ static inline void flush_altivec_to_thread(struct task_struct *t)
155} 164}
156#endif 165#endif
157 166
167#ifdef CONFIG_VSX
168extern void flush_vsx_to_thread(struct task_struct *);
169#else
170static inline void flush_vsx_to_thread(struct task_struct *t)
171{
172}
173#endif
174
158#ifdef CONFIG_SPE 175#ifdef CONFIG_SPE
159extern void flush_spe_to_thread(struct task_struct *); 176extern void flush_spe_to_thread(struct task_struct *);
160#else 177#else
@@ -190,6 +207,7 @@ extern struct task_struct *_switch(struct thread_struct *prev,
190 207
191extern unsigned int rtas_data; 208extern unsigned int rtas_data;
192extern int mem_init_done; /* set on boot once kmalloc can be called */ 209extern int mem_init_done; /* set on boot once kmalloc can be called */
210extern int init_bootmem_done; /* set on !NUMA once bootmem is available */
193extern unsigned long memory_limit; 211extern unsigned long memory_limit;
194extern unsigned long klimit; 212extern unsigned long klimit;
195 213
@@ -518,54 +536,6 @@ extern void reloc_got2(unsigned long);
518 536
519#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) 537#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
520 538
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 539#ifdef CONFIG_VIRT_CPU_ACCOUNTING
570extern void account_system_vtime(struct task_struct *); 540extern void account_system_vtime(struct task_struct *);
571#endif 541#endif