00460f41ff
Implement atomic64_t and its ops for FRV. Tested with the following patch: diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c index 55e4fab..086d50d 100644 --- a/arch/frv/kernel/setup.c +++ b/arch/frv/kernel/setup.c @@ -746,6 +746,52 @@ static void __init parse_cmdline_early(char *cmdline) } /* end parse_cmdline_early() */ +static atomic64_t xxx; + +static void test_atomic64(void) +{ + atomic64_set(&xxx, 0x12300000023LL); + + mb(); + BUG_ON(atomic64_read(&xxx) != 0x12300000023LL); + mb(); + if (atomic64_inc_return(&xxx) != 0x12300000024LL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != 0x12300000024LL); + mb(); + if (atomic64_sub_return(0x36900000050LL, &xxx) != -0x2460000002cLL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != -0x2460000002cLL); + mb(); + if (atomic64_dec_return(&xxx) != -0x2460000002dLL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != -0x2460000002dLL); + mb(); + if (atomic64_add_return(0x36800000001LL, &xxx) != 0x121ffffffd4LL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != 0x121ffffffd4LL); + mb(); + if (atomic64_cmpxchg(&xxx, 0x123456789abcdefLL, 0x121ffffffd4LL) != 0x121ffffffd4LL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != 0x121ffffffd4LL); + mb(); + if (atomic64_cmpxchg(&xxx, 0x121ffffffd4LL, 0x123456789abcdefLL) != 0x121ffffffd4LL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != 0x123456789abcdefLL); + mb(); + if (atomic64_xchg(&xxx, 0xabcdef123456789LL) != 0x123456789abcdefLL) + BUG(); + mb(); + BUG_ON(atomic64_read(&xxx) != 0xabcdef123456789LL); + mb(); +} + /*****************************************************************************/ /* * @@ -845,6 +891,8 @@ void __init setup_arch(char **cmdline_p) // asm volatile("movgs %0,timerd" :: "r"(10000000)); // __set_HSR(0, __get_HSR(0) | HSR0_ETMD); + test_atomic64(); + } /* end setup_arch() */ #if 0 Note that this doesn't cover all the trivial wrappers, but does cover all the substantial implementations. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
115 lines
3.0 KiB
C
115 lines
3.0 KiB
C
#include <linux/module.h>
|
|
#include <linux/linkage.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/string.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/user.h>
|
|
#include <linux/elfcore.h>
|
|
#include <linux/in6.h>
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <asm/setup.h>
|
|
#include <asm/pgalloc.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/io.h>
|
|
#include <asm/checksum.h>
|
|
#include <asm/hardirq.h>
|
|
#include <asm/cacheflush.h>
|
|
|
|
extern long __memcpy_user(void *dst, const void *src, size_t count);
|
|
extern long __memset_user(void *dst, const void *src, size_t count);
|
|
|
|
/* platform dependent support */
|
|
|
|
EXPORT_SYMBOL(__ioremap);
|
|
EXPORT_SYMBOL(iounmap);
|
|
|
|
EXPORT_SYMBOL(ip_fast_csum);
|
|
|
|
#if 0
|
|
EXPORT_SYMBOL(local_irq_count);
|
|
EXPORT_SYMBOL(local_bh_count);
|
|
#endif
|
|
EXPORT_SYMBOL(kernel_thread);
|
|
|
|
EXPORT_SYMBOL(__res_bus_clock_speed_HZ);
|
|
EXPORT_SYMBOL(__page_offset);
|
|
EXPORT_SYMBOL(__memcpy_user);
|
|
EXPORT_SYMBOL(__memset_user);
|
|
EXPORT_SYMBOL(frv_dcache_writeback);
|
|
EXPORT_SYMBOL(frv_cache_invalidate);
|
|
EXPORT_SYMBOL(frv_icache_invalidate);
|
|
EXPORT_SYMBOL(frv_cache_wback_inv);
|
|
|
|
#ifndef CONFIG_MMU
|
|
EXPORT_SYMBOL(memory_start);
|
|
EXPORT_SYMBOL(memory_end);
|
|
#endif
|
|
|
|
EXPORT_SYMBOL(__debug_bug_trap);
|
|
|
|
/* The following are special because they're not called
|
|
explicitly (the C compiler generates them). Fortunately,
|
|
their interface isn't gonna change any time soon now, so
|
|
it's OK to leave it out of version control. */
|
|
EXPORT_SYMBOL(memcpy);
|
|
EXPORT_SYMBOL(memset);
|
|
|
|
EXPORT_SYMBOL(__outsl_ns);
|
|
EXPORT_SYMBOL(__insl_ns);
|
|
|
|
#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
|
|
EXPORT_SYMBOL(atomic_test_and_ANDNOT_mask);
|
|
EXPORT_SYMBOL(atomic_test_and_OR_mask);
|
|
EXPORT_SYMBOL(atomic_test_and_XOR_mask);
|
|
EXPORT_SYMBOL(atomic_add_return);
|
|
EXPORT_SYMBOL(atomic_sub_return);
|
|
EXPORT_SYMBOL(__xchg_32);
|
|
EXPORT_SYMBOL(__cmpxchg_32);
|
|
#endif
|
|
EXPORT_SYMBOL(atomic64_add_return);
|
|
EXPORT_SYMBOL(atomic64_sub_return);
|
|
EXPORT_SYMBOL(__xchg_64);
|
|
EXPORT_SYMBOL(__cmpxchg_64);
|
|
|
|
EXPORT_SYMBOL(__debug_bug_printk);
|
|
EXPORT_SYMBOL(__delay_loops_MHz);
|
|
|
|
/*
|
|
* libgcc functions - functions that are used internally by the
|
|
* compiler... (prototypes are not correct though, but that
|
|
* doesn't really matter since they're not versioned).
|
|
*/
|
|
extern void __gcc_bcmp(void);
|
|
extern void __ashldi3(void);
|
|
extern void __ashrdi3(void);
|
|
extern void __cmpdi2(void);
|
|
extern void __divdi3(void);
|
|
extern void __lshrdi3(void);
|
|
extern void __moddi3(void);
|
|
extern void __muldi3(void);
|
|
extern void __mulll(void);
|
|
extern void __umulll(void);
|
|
extern void __negdi2(void);
|
|
extern void __ucmpdi2(void);
|
|
extern void __udivdi3(void);
|
|
extern void __udivmoddi4(void);
|
|
extern void __umoddi3(void);
|
|
|
|
/* gcc lib functions */
|
|
//EXPORT_SYMBOL(__gcc_bcmp);
|
|
EXPORT_SYMBOL(__ashldi3);
|
|
EXPORT_SYMBOL(__ashrdi3);
|
|
//EXPORT_SYMBOL(__cmpdi2);
|
|
//EXPORT_SYMBOL(__divdi3);
|
|
EXPORT_SYMBOL(__lshrdi3);
|
|
//EXPORT_SYMBOL(__moddi3);
|
|
EXPORT_SYMBOL(__muldi3);
|
|
EXPORT_SYMBOL(__mulll);
|
|
EXPORT_SYMBOL(__umulll);
|
|
EXPORT_SYMBOL(__negdi2);
|
|
EXPORT_SYMBOL(__ucmpdi2);
|
|
//EXPORT_SYMBOL(__udivdi3);
|
|
//EXPORT_SYMBOL(__udivmoddi4);
|
|
//EXPORT_SYMBOL(__umoddi3);
|