fsl_pamu_domain.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. *
  4. * Copyright (C) 2013 Freescale Semiconductor, Inc.
  5. */
  6. #ifndef __FSL_PAMU_DOMAIN_H
  7. #define __FSL_PAMU_DOMAIN_H
  8. #include "fsl_pamu.h"
  9. struct dma_window {
  10. phys_addr_t paddr;
  11. u64 size;
  12. int valid;
  13. int prot;
  14. };
  15. struct fsl_dma_domain {
  16. /*
  17. * Indicates the geometry size for the domain.
  18. * This would be set when the geometry is
  19. * configured for the domain.
  20. */
  21. dma_addr_t geom_size;
  22. /*
  23. * Number of windows assocaited with this domain.
  24. * During domain initialization, it is set to the
  25. * the maximum number of subwindows allowed for a LIODN.
  26. * Minimum value for this is 1 indicating a single PAMU
  27. * window, without any sub windows. Value can be set/
  28. * queried by set_attr/get_attr API for DOMAIN_ATTR_WINDOWS.
  29. * Value can only be set once the geometry has been configured.
  30. */
  31. u32 win_cnt;
  32. /*
  33. * win_arr contains information of the configured
  34. * windows for a domain. This is allocated only
  35. * when the number of windows for the domain are
  36. * set.
  37. */
  38. struct dma_window *win_arr;
  39. /* list of devices associated with the domain */
  40. struct list_head devices;
  41. /* dma_domain states:
  42. * mapped - A particular mapping has been created
  43. * within the configured geometry.
  44. * enabled - DMA has been enabled for the given
  45. * domain. This translates to setting of the
  46. * valid bit for the primary PAACE in the PAMU
  47. * PAACT table. Domain geometry should be set and
  48. * it must have a valid mapping before DMA can be
  49. * enabled for it.
  50. *
  51. */
  52. int mapped;
  53. int enabled;
  54. /* stash_id obtained from the stash attribute details */
  55. u32 stash_id;
  56. struct pamu_stash_attribute dma_stash;
  57. u32 snoop_id;
  58. struct iommu_domain iommu_domain;
  59. spinlock_t domain_lock;
  60. };
  61. /* domain-device relationship */
  62. struct device_domain_info {
  63. struct list_head link; /* link to domain siblings */
  64. struct device *dev;
  65. u32 liodn;
  66. struct fsl_dma_domain *domain; /* pointer to domain */
  67. };
  68. #endif /* __FSL_PAMU_DOMAIN_H */