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#include <asm/machdep.h>
8
9static inline bool __must_check arch_get_random_long(unsigned long *v)
10{
11	return false;
12}
13
14static inline bool __must_check arch_get_random_int(unsigned int *v)
15{
16	return false;
17}
18
19static inline bool __must_check 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 false;
25}
26
27static inline bool __must_check arch_get_random_seed_int(unsigned int *v)
28{
29	unsigned long val;
30	bool rc;
31
32	rc = arch_get_random_seed_long(&val);
33	if (rc)
34		*v = val;
35
36	return rc;
37}
38#endif /* CONFIG_ARCH_RANDOM */
39
40#ifdef CONFIG_PPC_POWERNV
41int powernv_hwrng_present(void);
42int powernv_get_random_long(unsigned long *v);
43int powernv_get_random_real_mode(unsigned long *v);
44#else
45static inline int powernv_hwrng_present(void) { return 0; }
46static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; }
47#endif
48
49#endif /* _ASM_POWERPC_ARCHRANDOM_H */
50