1 #ifndef _ASM_POWERPC_ARCHRANDOM_H
2 #define _ASM_POWERPC_ARCHRANDOM_H
3 
4 #ifdef CONFIG_ARCH_RANDOM
5 
6 #include <asm/machdep.h>
7 
8 static inline int arch_get_random_long(unsigned long *v)
9 {
10 	if (ppc_md.get_random_long)
11 		return ppc_md.get_random_long(v);
12 
13 	return 0;
14 }
15 
16 static inline int arch_get_random_int(unsigned int *v)
17 {
18 	unsigned long val;
19 	int rc;
20 
21 	rc = arch_get_random_long(&val);
22 	if (rc)
23 		*v = val;
24 
25 	return rc;
26 }
27 
28 static inline int arch_has_random(void)
29 {
30 	return !!ppc_md.get_random_long;
31 }
32 
33 static inline int arch_get_random_seed_long(unsigned long *v)
34 {
35 	return 0;
36 }
37 static inline int arch_get_random_seed_int(unsigned int *v)
38 {
39 	return 0;
40 }
41 static inline int arch_has_random_seed(void)
42 {
43 	return 0;
44 }
45 
46 #endif /* CONFIG_ARCH_RANDOM */
47 
48 #ifdef CONFIG_PPC_POWERNV
49 int powernv_hwrng_present(void);
50 int powernv_get_random_long(unsigned long *v);
51 int powernv_get_random_real_mode(unsigned long *v);
52 #else
53 static inline int powernv_hwrng_present(void) { return 0; }
54 static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; }
55 #endif
56 
57 #endif /* _ASM_POWERPC_ARCHRANDOM_H */
58