msm_rng.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2014, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. */
  14. #ifndef __MSM_RNG_HEADER__
  15. #define __MSM_RNG_HEADER__
  16. #include <linux/semaphore.h>
  17. #include <linux/qcedev.h>
  18. struct _fips_drbg_ctx;
  19. #define FIPS140_DRBG_ENABLED (1)
  20. #define FIPS140_DRBG_DISABLED (0)
  21. #define Q_HW_DRBG_BLOCK_BYTES (32)
  22. extern void fips_reg_drbg_callback(void *src);
  23. struct msm_rng_device {
  24. struct platform_device *pdev;
  25. void __iomem *base;
  26. struct clk *prng_clk;
  27. uint32_t qrng_perf_client;
  28. struct semaphore drbg_sem;
  29. struct fips_drbg_ctx_s *drbg_ctx;
  30. int fips140_drbg_enabled;
  31. };
  32. /*
  33. *
  34. * This function calls hardware random bit generator
  35. * directory and retuns it back to caller.
  36. *
  37. */
  38. int msm_rng_direct_read(struct msm_rng_device *msm_rng_dev, void *data);
  39. #endif