qcedev_smmu.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* Qti (or) Qualcomm Technologies Inc CE device driver.
  2. *
  3. * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 and
  7. * only version 2 as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef _DRIVERS_CRYPTO_PARSE_H_
  15. #define _DRIVERS_CRYPTO_PARSE_H_
  16. #include <asm/dma-iommu.h>
  17. #include <linux/dma-buf.h>
  18. #include <linux/dma-direction.h>
  19. #include <linux/iommu.h>
  20. #include <linux/msm_dma_iommu_mapping.h>
  21. #include <linux/msm_ion.h>
  22. #include <linux/of.h>
  23. #include <linux/of_platform.h>
  24. #include <linux/slab.h>
  25. #include <linux/types.h>
  26. struct context_bank_info {
  27. struct list_head list;
  28. const char *name;
  29. u32 buffer_type;
  30. u32 start_addr;
  31. u32 size;
  32. bool is_secure;
  33. struct device *dev;
  34. struct dma_iommu_mapping *mapping;
  35. };
  36. enum qcedev_mem_type {
  37. MEM_ION,
  38. };
  39. struct qcedev_mem_client {
  40. enum qcedev_mem_type mtype;
  41. void *client;
  42. };
  43. struct dma_mapping_info {
  44. struct device *dev;
  45. struct dma_iommu_mapping *mapping;
  46. struct sg_table *table;
  47. struct dma_buf_attachment *attach;
  48. struct dma_buf *buf;
  49. };
  50. struct qcedev_ion_buf_info {
  51. struct ion_handle *hndl;
  52. struct dma_mapping_info mapping_info;
  53. ion_phys_addr_t iova;
  54. unsigned long mapped_buf_size;
  55. };
  56. struct qcedev_reg_buf_info {
  57. struct list_head list;
  58. union {
  59. struct qcedev_ion_buf_info ion_buf;
  60. };
  61. atomic_t ref_count;
  62. };
  63. struct qcedev_buffer_list {
  64. struct list_head list;
  65. struct mutex lock;
  66. };
  67. int qcedev_parse_context_bank(struct platform_device *pdev);
  68. struct qcedev_mem_client *qcedev_mem_new_client(enum qcedev_mem_type mtype);
  69. void qcedev_mem_delete_client(struct qcedev_mem_client *mem_client);
  70. int qcedev_check_and_map_buffer(void *qce_hndl,
  71. int fd, unsigned int offset, unsigned int fd_size,
  72. unsigned long long *vaddr);
  73. int qcedev_check_and_unmap_buffer(void *handle, int fd);
  74. extern struct qcedev_reg_buf_info *global_binfo_in;
  75. extern struct qcedev_reg_buf_info *global_binfo_out;
  76. extern struct qcedev_reg_buf_info *global_binfo_res;
  77. #endif