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