2 * Copyright 2013, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
6 #ifndef _SELFTESTS_POWERPC_UTILS_H
7 #define _SELFTESTS_POWERPC_UTILS_H
9 #define __cacheline_aligned __attribute__((aligned(128)))
13 #include <linux/auxvec.h>
16 /* Avoid headaches with PRI?64 - just use %ll? always */
17 typedef unsigned long long u64;
18 typedef signed long long s64;
20 /* Just for familiarity */
25 void test_harness_set_timeout(uint64_t time);
26 int test_harness(int (test_function)(void), char *name);
27 extern void *get_auxv_entry(int type);
28 int pick_online_cpu(void);
30 static inline bool have_hwcap(unsigned long ftr)
32 return ((unsigned long)get_auxv_entry(AT_HWCAP) & ftr) == ftr;
36 static inline bool have_hwcap2(unsigned long ftr2)
38 return ((unsigned long)get_auxv_entry(AT_HWCAP2) & ftr2) == ftr2;
41 static inline bool have_hwcap2(unsigned long ftr2)
47 /* Yes, this is evil */
52 "[FAIL] Test FAILED on line %d\n", __LINE__); \
57 /* The test harness uses this, yes it's gross */
58 #define MAGIC_SKIP_RETURN_VALUE 99
64 "[SKIP] Test skipped on line %d\n", __LINE__); \
65 return MAGIC_SKIP_RETURN_VALUE; \
70 #define str(s) _str(s)
73 #ifndef PPC_FEATURE2_ARCH_3_00
74 #define PPC_FEATURE2_ARCH_3_00 0x00800000
77 #endif /* _SELFTESTS_POWERPC_UTILS_H */