fvp_drtm_dma_prot.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2022, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdbool.h>
  7. #include <stddef.h>
  8. #include <drivers/arm/smmu_v3.h>
  9. #include <lib/utils_def.h>
  10. #include <plat/arm/common/arm_config.h>
  11. #include <plat/common/platform.h>
  12. #include <platform_def.h>
  13. /**
  14. * Array mentioning number of SMMUs supported by FVP
  15. */
  16. static const uintptr_t fvp_smmus[] = {
  17. PLAT_FVP_SMMUV3_BASE,
  18. };
  19. bool plat_has_non_host_platforms(void)
  20. {
  21. /* FVP base platforms typically have GPU, as per FVP Reference guide */
  22. return true;
  23. }
  24. bool plat_has_unmanaged_dma_peripherals(void)
  25. {
  26. /*
  27. * FVP Reference guide does not show devices that are described as
  28. * DMA-capable but not managed by an SMMU in the FVP documentation.
  29. * However, the SMMU seems to have only been introduced in the RevC
  30. * revision.
  31. */
  32. return (arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) == 0;
  33. }
  34. unsigned int plat_get_total_smmus(void)
  35. {
  36. if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) {
  37. return ARRAY_SIZE(fvp_smmus);
  38. } else {
  39. return 0;
  40. }
  41. }
  42. void plat_enumerate_smmus(const uintptr_t **smmus_out,
  43. size_t *smmu_count_out)
  44. {
  45. if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) {
  46. *smmus_out = fvp_smmus;
  47. *smmu_count_out = ARRAY_SIZE(fvp_smmus);
  48. } else {
  49. *smmus_out = NULL;
  50. *smmu_count_out = 0;
  51. }
  52. }
  53. /* DRTM DMA Protection Features */
  54. static const plat_drtm_dma_prot_features_t dma_prot_features = {
  55. .max_num_mem_prot_regions = 0, /* No protection regions are present */
  56. .dma_protection_support = 0x1 /* Complete DMA protection only */
  57. };
  58. const plat_drtm_dma_prot_features_t *plat_drtm_get_dma_prot_features(void)
  59. {
  60. return &dma_prot_features;
  61. }
  62. uint64_t plat_drtm_dma_prot_get_max_table_bytes(void)
  63. {
  64. return 0U;
  65. }