aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPhilippe Gerum <rpm@xenomai.org>2009-10-27 17:05:31 -0400
committerMike Frysinger <vapier@gentoo.org>2009-12-15 00:15:12 -0500
commitd2685fb7b4df2850359d6ee297269a285886032d (patch)
treefada248782a4bd8e774836ee40ee0bc672bad4a8 /arch
parentab843c7940394584d5ec548f443cb431c0752ca5 (diff)
Blackfin/ipipe: prepare status bitops for SMP support
Signed-off-by: Philippe Gerum <rpm@xenomai.org> Signed-off-by: Li Yi <yi.li@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/include/asm/ipipe.h10
-rw-r--r--arch/blackfin/include/asm/ipipe_base.h26
-rw-r--r--arch/blackfin/kernel/ipipe.c67
3 files changed, 76 insertions, 27 deletions
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index 4617ba66278f..07bd2e65ab5b 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -124,16 +124,6 @@ static inline int __ipipe_check_tickdev(const char *devname)
124 return 1; 124 return 1;
125} 125}
126 126
127static inline void __ipipe_lock_root(void)
128{
129 set_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
130}
131
132static inline void __ipipe_unlock_root(void)
133{
134 clear_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
135}
136
137void __ipipe_enable_pipeline(void); 127void __ipipe_enable_pipeline(void);
138 128
139#define __ipipe_hook_critical_ipi(ipd) do { } while (0) 129#define __ipipe_hook_critical_ipi(ipd) do { } while (0)
diff --git a/arch/blackfin/include/asm/ipipe_base.h b/arch/blackfin/include/asm/ipipe_base.h
index 490098f532a7..00409201d9ed 100644
--- a/arch/blackfin/include/asm/ipipe_base.h
+++ b/arch/blackfin/include/asm/ipipe_base.h
@@ -51,23 +51,15 @@
51 51
52extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */ 52extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */
53 53
54#define __ipipe_stall_root() \ 54void __ipipe_stall_root(void);
55 do { \ 55
56 volatile unsigned long *p = &__ipipe_root_status; \ 56unsigned long __ipipe_test_and_stall_root(void);
57 set_bit(0, p); \ 57
58 } while (0) 58unsigned long __ipipe_test_root(void);
59 59
60#define __ipipe_test_and_stall_root() \ 60void __ipipe_lock_root(void);
61 ({ \ 61
62 volatile unsigned long *p = &__ipipe_root_status; \ 62void __ipipe_unlock_root(void);
63 test_and_set_bit(0, p); \
64 })
65
66#define __ipipe_test_root() \
67 ({ \
68 const unsigned long *p = &__ipipe_root_status; \
69 test_bit(0, p); \
70 })
71 63
72#endif /* !__ASSEMBLY__ */ 64#endif /* !__ASSEMBLY__ */
73 65
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
index 5d7382396dc0..a77307a4473b 100644
--- a/arch/blackfin/kernel/ipipe.c
+++ b/arch/blackfin/kernel/ipipe.c
@@ -335,3 +335,70 @@ void __ipipe_enable_root_irqs_hw(void)
335 __clear_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status)); 335 __clear_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status));
336 bfin_sti(bfin_irq_flags); 336 bfin_sti(bfin_irq_flags);
337} 337}
338
339/*
340 * We could use standard atomic bitops in the following root status
341 * manipulation routines, but let's prepare for SMP support in the
342 * same move, preventing CPU migration as required.
343 */
344void __ipipe_stall_root(void)
345{
346 unsigned long *p, flags;
347
348 local_irq_save_hw(flags);
349 p = &__ipipe_root_status;
350 __set_bit(IPIPE_STALL_FLAG, p);
351 local_irq_restore_hw(flags);
352}
353EXPORT_SYMBOL(__ipipe_stall_root);
354
355unsigned long __ipipe_test_and_stall_root(void)
356{
357 unsigned long *p, flags;
358 int x;
359
360 local_irq_save_hw(flags);
361 p = &__ipipe_root_status;
362 x = __test_and_set_bit(IPIPE_STALL_FLAG, p);
363 local_irq_restore_hw(flags);
364
365 return x;
366}
367EXPORT_SYMBOL(__ipipe_test_and_stall_root);
368
369unsigned long __ipipe_test_root(void)
370{
371 const unsigned long *p;
372 unsigned long flags;
373 int x;
374
375 local_irq_save_hw_smp(flags);
376 p = &__ipipe_root_status;
377 x = test_bit(IPIPE_STALL_FLAG, p);
378 local_irq_restore_hw_smp(flags);
379
380 return x;
381}
382EXPORT_SYMBOL(__ipipe_test_root);
383
384void __ipipe_lock_root(void)
385{
386 unsigned long *p, flags;
387
388 local_irq_save_hw(flags);
389 p = &__ipipe_root_status;
390 __set_bit(IPIPE_SYNCDEFER_FLAG, p);
391 local_irq_restore_hw(flags);
392}
393EXPORT_SYMBOL(__ipipe_lock_root);
394
395void __ipipe_unlock_root(void)
396{
397 unsigned long *p, flags;
398
399 local_irq_save_hw(flags);
400 p = &__ipipe_root_status;
401 __clear_bit(IPIPE_SYNCDEFER_FLAG, p);
402 local_irq_restore_hw(flags);
403}
404EXPORT_SYMBOL(__ipipe_unlock_root);