archrandom.h 1.1 KB

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