xref: /linux/tools/testing/selftests/riscv/hwprobe/hwprobe.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef SELFTEST_RISCV_HWPROBE_H
3 #define SELFTEST_RISCV_HWPROBE_H
4 #include <stddef.h>
5 #include <asm/hwprobe.h>
6 
7 #if __BYTE_ORDER == __BIG_ENDIAN
8 # define le32_bswap(_x)				\
9 	((((_x) & 0x000000ffU) << 24) |		\
10 	 (((_x) & 0x0000ff00U) <<  8) |		\
11 	 (((_x) & 0x00ff0000U) >>  8) |		\
12 	 (((_x) & 0xff000000U) >> 24))
13 #else
14 # define le32_bswap(_x) (_x)
15 #endif
16 
17 /*
18  * Rather than relying on having a new enough libc to define this, just do it
19  * ourselves.  This way we don't need to be coupled to a new-enough libc to
20  * contain the call.
21  */
22 long riscv_hwprobe(struct riscv_hwprobe *pairs, size_t pair_count,
23 		   size_t cpusetsize, unsigned long *cpus, unsigned int flags);
24 
25 #endif
26