mtk_iommu_priv.h 993 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2022, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef IOMMU_PRIV_H
  7. #define IOMMU_PRIV_H
  8. #include <common/debug.h>
  9. #include <lib/mmio.h>
  10. #include <mtk_sip_svc.h>
  11. #define LARB_CFG_ENTRY(bs, p_nr, dom) \
  12. { .base = (bs), .port_nr = (p_nr), \
  13. .dom_id = (dom), .to_sram = 0, }
  14. #define LARB_CFG_ENTRY_WITH_PATH(bs, p_nr, dom, sram) \
  15. { .base = (bs), .port_nr = (p_nr), \
  16. .dom_id = (dom), .to_sram = (sram), }
  17. #define IFR_MST_CFG_ENTRY(idx, bit) \
  18. { .cfg_addr_idx = (idx), .r_mmu_en_bit = (bit), }
  19. enum IOMMU_ATF_CMD {
  20. IOMMU_ATF_CMD_CONFIG_SMI_LARB, /* For mm master to enable iommu */
  21. IOMMU_ATF_CMD_CONFIG_INFRA_IOMMU, /* For infra master to enable iommu */
  22. IOMMU_ATF_CMD_COUNT,
  23. };
  24. struct mtk_smi_larb_config {
  25. uint32_t base;
  26. uint32_t port_nr;
  27. uint32_t dom_id;
  28. uint32_t to_sram;
  29. uint32_t sec_en_msk;
  30. };
  31. struct mtk_ifr_mst_config {
  32. uint8_t cfg_addr_idx;
  33. uint8_t r_mmu_en_bit;
  34. };
  35. #endif /* IOMMU_PRIV_H */