GNU Linux-libre 4.9.337-gnu1
[releases.git] / arch / powerpc / include / asm / archrandom.h
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 bool arch_get_random_long(unsigned long *v)
9 {
10         return false;
11 }
12
13 static inline bool arch_get_random_int(unsigned int *v)
14 {
15         return false;
16 }
17
18 static inline bool arch_get_random_seed_long(unsigned long *v)
19 {
20         if (ppc_md.get_random_seed)
21                 return ppc_md.get_random_seed(v);
22
23         return false;
24 }
25
26 static inline bool arch_get_random_seed_int(unsigned int *v)
27 {
28         unsigned long val;
29         bool rc;
30
31         rc = arch_get_random_seed_long(&val);
32         if (rc)
33                 *v = val;
34
35         return rc;
36 }
37 #endif /* CONFIG_ARCH_RANDOM */
38
39 #ifdef CONFIG_PPC_POWERNV
40 int powernv_hwrng_present(void);
41 int powernv_get_random_long(unsigned long *v);
42 int powernv_get_random_real_mode(unsigned long *v);
43 #else
44 static inline int powernv_hwrng_present(void) { return 0; }
45 static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; }
46 #endif
47
48 #endif /* _ASM_POWERPC_ARCHRANDOM_H */