18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_ARCHRANDOM_H 38c2ecf20Sopenharmony_ci#define _ASM_POWERPC_ARCHRANDOM_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_RANDOM 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <asm/machdep.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cistatic inline bool __must_check arch_get_random_long(unsigned long *v) 108c2ecf20Sopenharmony_ci{ 118c2ecf20Sopenharmony_ci return false; 128c2ecf20Sopenharmony_ci} 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistatic inline bool __must_check arch_get_random_int(unsigned int *v) 158c2ecf20Sopenharmony_ci{ 168c2ecf20Sopenharmony_ci return false; 178c2ecf20Sopenharmony_ci} 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic inline bool __must_check arch_get_random_seed_long(unsigned long *v) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci if (ppc_md.get_random_seed) 228c2ecf20Sopenharmony_ci return ppc_md.get_random_seed(v); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci return false; 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistatic inline bool __must_check arch_get_random_seed_int(unsigned int *v) 288c2ecf20Sopenharmony_ci{ 298c2ecf20Sopenharmony_ci unsigned long val; 308c2ecf20Sopenharmony_ci bool rc; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci rc = arch_get_random_seed_long(&val); 338c2ecf20Sopenharmony_ci if (rc) 348c2ecf20Sopenharmony_ci *v = val; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci return rc; 378c2ecf20Sopenharmony_ci} 388c2ecf20Sopenharmony_ci#endif /* CONFIG_ARCH_RANDOM */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_POWERNV 418c2ecf20Sopenharmony_ciint powernv_hwrng_present(void); 428c2ecf20Sopenharmony_ciint powernv_get_random_long(unsigned long *v); 438c2ecf20Sopenharmony_ciint powernv_get_random_real_mode(unsigned long *v); 448c2ecf20Sopenharmony_ci#else 458c2ecf20Sopenharmony_cistatic inline int powernv_hwrng_present(void) { return 0; } 468c2ecf20Sopenharmony_cistatic inline int powernv_get_random_real_mode(unsigned long *v) { return 0; } 478c2ecf20Sopenharmony_ci#endif 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_ARCHRANDOM_H */ 50