fsl_pamu_domain.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License, version 2, as
  4. * published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. *
  15. * Copyright (C) 2013 Freescale Semiconductor, Inc.
  16. *
  17. */
  18. #ifndef __FSL_PAMU_DOMAIN_H
  19. #define __FSL_PAMU_DOMAIN_H
  20. #include "fsl_pamu.h"
  21. struct dma_window {
  22. phys_addr_t paddr;
  23. u64 size;
  24. int valid;
  25. int prot;
  26. };
  27. struct fsl_dma_domain {
  28. /*
  29. * Indicates the geometry size for the domain.
  30. * This would be set when the geometry is
  31. * configured for the domain.
  32. */
  33. dma_addr_t geom_size;
  34. /*
  35. * Number of windows assocaited with this domain.
  36. * During domain initialization, it is set to the
  37. * the maximum number of subwindows allowed for a LIODN.
  38. * Minimum value for this is 1 indicating a single PAMU
  39. * window, without any sub windows. Value can be set/
  40. * queried by set_attr/get_attr API for DOMAIN_ATTR_WINDOWS.
  41. * Value can only be set once the geometry has been configured.
  42. */
  43. u32 win_cnt;
  44. /*
  45. * win_arr contains information of the configured
  46. * windows for a domain. This is allocated only
  47. * when the number of windows for the domain are
  48. * set.
  49. */
  50. struct dma_window *win_arr;
  51. /* list of devices associated with the domain */
  52. struct list_head devices;
  53. /* dma_domain states:
  54. * mapped - A particular mapping has been created
  55. * within the configured geometry.
  56. * enabled - DMA has been enabled for the given
  57. * domain. This translates to setting of the
  58. * valid bit for the primary PAACE in the PAMU
  59. * PAACT table. Domain geometry should be set and
  60. * it must have a valid mapping before DMA can be
  61. * enabled for it.
  62. *
  63. */
  64. int mapped;
  65. int enabled;
  66. /* stash_id obtained from the stash attribute details */
  67. u32 stash_id;
  68. struct pamu_stash_attribute dma_stash;
  69. u32 snoop_id;
  70. struct iommu_domain iommu_domain;
  71. spinlock_t domain_lock;
  72. };
  73. /* domain-device relationship */
  74. struct device_domain_info {
  75. struct list_head link; /* link to domain siblings */
  76. struct device *dev;
  77. u32 liodn;
  78. struct fsl_dma_domain *domain; /* pointer to domain */
  79. };
  80. #endif /* __FSL_PAMU_DOMAIN_H */