Loading...
Note: File does not exist in v6.13.7.
1/*
2 * Copyright 2013, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
4 */
5
6#ifndef _SELFTESTS_POWERPC_UTILS_H
7#define _SELFTESTS_POWERPC_UTILS_H
8
9#include <stdint.h>
10#include <stdbool.h>
11#include <linux/auxvec.h>
12
13/* Avoid headaches with PRI?64 - just use %ll? always */
14typedef unsigned long long u64;
15typedef signed long long s64;
16
17/* Just for familiarity */
18typedef uint32_t u32;
19typedef uint16_t u16;
20typedef uint8_t u8;
21
22
23int test_harness(int (test_function)(void), char *name);
24extern void *get_auxv_entry(int type);
25int pick_online_cpu(void);
26
27static inline bool have_hwcap2(unsigned long ftr2)
28{
29 return ((unsigned long)get_auxv_entry(AT_HWCAP2) & ftr2) == ftr2;
30}
31
32/* Yes, this is evil */
33#define FAIL_IF(x) \
34do { \
35 if ((x)) { \
36 fprintf(stderr, \
37 "[FAIL] Test FAILED on line %d\n", __LINE__); \
38 return 1; \
39 } \
40} while (0)
41
42/* The test harness uses this, yes it's gross */
43#define MAGIC_SKIP_RETURN_VALUE 99
44
45#define SKIP_IF(x) \
46do { \
47 if ((x)) { \
48 fprintf(stderr, \
49 "[SKIP] Test skipped on line %d\n", __LINE__); \
50 return MAGIC_SKIP_RETURN_VALUE; \
51 } \
52} while (0)
53
54#define _str(s) #s
55#define str(s) _str(s)
56
57#endif /* _SELFTESTS_POWERPC_UTILS_H */