trusty.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2013 Google, Inc.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  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 __LINUX_TRUSTY_TRUSTY_H
  15. #define __LINUX_TRUSTY_TRUSTY_H
  16. #include <linux/kernel.h>
  17. #include <linux/trusty/sm_err.h>
  18. #include <linux/device.h>
  19. #include <linux/pagemap.h>
  20. #ifdef CONFIG_TRUSTY
  21. #ifdef CONFIG_TRUSTY_INTERRUPT_MAP
  22. extern void handle_trusty_ipi(int ipinr);
  23. #endif
  24. s32 trusty_std_call32(struct device *dev, u32 smcnr, u32 a0, u32 a1, u32 a2);
  25. s32 trusty_fast_call32(struct device *dev, u32 smcnr, u32 a0, u32 a1, u32 a2);
  26. #ifdef CONFIG_64BIT
  27. s64 trusty_fast_call64(struct device *dev, u64 smcnr, u64 a0, u64 a1, u64 a2);
  28. #endif
  29. #else
  30. static inline s32 trusty_std_call32(struct device *dev, u32 smcnr,
  31. u32 a0, u32 a1, u32 a2)
  32. {
  33. return SM_ERR_UNDEFINED_SMC;
  34. }
  35. static inline s32 trusty_fast_call32(struct device *dev, u32 smcnr,
  36. u32 a0, u32 a1, u32 a2)
  37. {
  38. return SM_ERR_UNDEFINED_SMC;
  39. }
  40. #ifdef CONFIG_64BIT
  41. static inline s64 trusty_fast_call64(struct device *dev,
  42. u64 smcnr, u64 a0, u64 a1, u64 a2)
  43. {
  44. return SM_ERR_UNDEFINED_SMC;
  45. }
  46. #endif
  47. #endif
  48. struct notifier_block;
  49. enum {
  50. TRUSTY_CALL_PREPARE,
  51. TRUSTY_CALL_RETURNED,
  52. };
  53. int trusty_call_notifier_register(struct device *dev,
  54. struct notifier_block *n);
  55. int trusty_call_notifier_unregister(struct device *dev,
  56. struct notifier_block *n);
  57. const char *trusty_version_str_get(struct device *dev);
  58. u32 trusty_get_api_version(struct device *dev);
  59. struct ns_mem_page_info {
  60. uint64_t attr;
  61. };
  62. int trusty_encode_page_info(struct ns_mem_page_info *inf,
  63. struct page *page, pgprot_t pgprot);
  64. int trusty_call32_mem_buf(struct device *dev, u32 smcnr,
  65. struct page *page, u32 size,
  66. pgprot_t pgprot);
  67. #endif