xref: /linux/arch/powerpc/include/asm/archrandom.h (revision 3e731203153de1c06a8b7a4f15061e9051c09a6f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_ARCHRANDOM_H
3 #define _ASM_POWERPC_ARCHRANDOM_H
4 
5 #ifdef CONFIG_ARCH_RANDOM
6 
7 bool __must_check arch_get_random_seed_long(unsigned long *v);
8 
9 static inline bool __must_check arch_get_random_long(unsigned long *v)
10 {
11 	return false;
12 }
13 
14 static inline bool __must_check arch_get_random_int(unsigned int *v)
15 {
16 	return false;
17 }
18 
19 
20 static inline bool __must_check arch_get_random_seed_int(unsigned int *v)
21 {
22 	unsigned long val;
23 	bool rc;
24 
25 	rc = arch_get_random_seed_long(&val);
26 	if (rc)
27 		*v = val;
28 
29 	return rc;
30 }
31 #endif /* CONFIG_ARCH_RANDOM */
32 
33 #ifdef CONFIG_PPC_POWERNV
34 int powernv_hwrng_present(void);
35 int powernv_get_random_long(unsigned long *v);
36 int powernv_get_random_real_mode(unsigned long *v);
37 #else
38 static inline int powernv_hwrng_present(void) { return 0; }
39 static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; }
40 #endif
41 
42 #endif /* _ASM_POWERPC_ARCHRANDOM_H */
43