tzc_dmc620.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef TZC_DMC620_H
  7. #define TZC_DMC620_H
  8. #include <lib/utils_def.h>
  9. /* DMC-620 memc register offsets */
  10. #define DMC620_MEMC_STATUS U(0x0000)
  11. #define DMC620_MEMC_CMD U(0x0008)
  12. /* Mask value to check the status of memc_cmd register */
  13. #define DMC620_MEMC_CMD_MASK U(0x00000007)
  14. /* memc_cmd register's action values */
  15. #define DMC620_MEMC_CMD_GO U(0x00000003)
  16. #define DMC620_MEMC_CMD_EXECUTE U(0x00000004)
  17. /* Address offsets of access address next region 0 registers */
  18. #define DMC620_ACC_ADDR_MIN_31_00_NEXT_BASE U(0x0080)
  19. #define DMC620_ACC_ADDR_MIN_47_32_NEXT_BASE U(0x0084)
  20. #define DMC620_ACC_ADDR_MAX_31_00_NEXT_BASE U(0x0088)
  21. #define DMC620_ACC_ADDR_MAX_47_32_NEXT_BASE U(0x008c)
  22. /* Length of one block of access address next register region */
  23. #define DMC620_ACC_ADDR_NEXT_SIZE U(0x0010)
  24. /* Address offsets of access address next registers */
  25. #define DMC620_ACC_ADDR_MIN_31_00_NEXT(region_no) \
  26. (DMC620_ACC_ADDR_MIN_31_00_NEXT_BASE + \
  27. ((region_no) * DMC620_ACC_ADDR_NEXT_SIZE))
  28. #define DMC620_ACC_ADDR_MIN_47_32_NEXT(region_no) \
  29. (DMC620_ACC_ADDR_MIN_47_32_NEXT_BASE + \
  30. ((region_no) * DMC620_ACC_ADDR_NEXT_SIZE))
  31. #define DMC620_ACC_ADDR_MAX_31_00_NEXT(region_no) \
  32. (DMC620_ACC_ADDR_MAX_31_00_NEXT_BASE + \
  33. ((region_no) * DMC620_ACC_ADDR_NEXT_SIZE))
  34. #define DMC620_ACC_ADDR_MAX_47_32_NEXT(region_no) \
  35. (DMC620_ACC_ADDR_MAX_47_32_NEXT_BASE + \
  36. ((region_no) * DMC620_ACC_ADDR_NEXT_SIZE))
  37. /* Number of TZC address regions in DMC-620 */
  38. #define DMC620_ACC_ADDR_COUNT U(8)
  39. /* Width of access address registers */
  40. #define DMC620_ACC_ADDR_WIDTH U(32)
  41. /* Peripheral ID registers offsets */
  42. #define DMC620_PERIPHERAL_ID_0 U(0x1fe0)
  43. /* Default values in id registers */
  44. #define DMC620_PERIPHERAL_ID_0_VALUE U(0x00000054)
  45. /* Secure access region attributes. */
  46. #define TZC_DMC620_REGION_NS_RD U(0x00000001)
  47. #define TZC_DMC620_REGION_NS_WR U(0x00000002)
  48. #define TZC_DMC620_REGION_NS_RDWR \
  49. (TZC_DMC620_REGION_NS_RD | TZC_DMC620_REGION_NS_WR)
  50. #define TZC_DMC620_REGION_S_RD U(0x00000004)
  51. #define TZC_DMC620_REGION_S_WR U(0x00000008)
  52. #define TZC_DMC620_REGION_S_RDWR \
  53. (TZC_DMC620_REGION_S_RD | TZC_DMC620_REGION_S_WR)
  54. #define TZC_DMC620_REGION_S_NS_RDWR \
  55. (TZC_DMC620_REGION_NS_RDWR | TZC_DMC620_REGION_S_RDWR)
  56. /*
  57. * Contains pointer to the base addresses of all the DMC-620 instances.
  58. * 'dmc_count' specifies the number of DMC base addresses contained in the
  59. * array pointed to by dmc_base.
  60. */
  61. typedef struct tzc_dmc620_driver_data {
  62. const uintptr_t *dmc_base;
  63. const unsigned int dmc_count;
  64. } tzc_dmc620_driver_data_t;
  65. /*
  66. * Contains region base, region top addresses and corresponding attributes
  67. * for configuring TZC access region registers.
  68. */
  69. typedef struct tzc_dmc620_acc_addr_data {
  70. const unsigned long long region_base;
  71. const unsigned long long region_top;
  72. const unsigned int sec_attr;
  73. } tzc_dmc620_acc_addr_data_t;
  74. /*
  75. * Contains platform specific data for configuring TZC region base and
  76. * region top address. 'acc_addr_count' specifies the number of
  77. * valid entries in 'plat_acc_addr_data' array.
  78. */
  79. typedef struct tzc_dmc620_config_data {
  80. const tzc_dmc620_driver_data_t *plat_drv_data;
  81. const tzc_dmc620_acc_addr_data_t *plat_acc_addr_data;
  82. const uint8_t acc_addr_count;
  83. } tzc_dmc620_config_data_t;
  84. /* Function prototypes */
  85. void arm_tzc_dmc620_setup(const tzc_dmc620_config_data_t *plat_config_data);
  86. #endif /* TZC_DMC620_H */