platform_def.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLATFORM_DEF_H
  7. #define PLATFORM_DEF_H
  8. #include <common/interrupt_props.h>
  9. #include <drivers/arm/gic_common.h>
  10. #include <lib/utils_def.h>
  11. #include "mt8173_def.h"
  12. /*******************************************************************************
  13. * Platform binary types for linking
  14. ******************************************************************************/
  15. #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
  16. #define PLATFORM_LINKER_ARCH aarch64
  17. /*******************************************************************************
  18. * Generic platform constants
  19. ******************************************************************************/
  20. /* Size of cacheable stacks */
  21. #if defined(IMAGE_BL1)
  22. #define PLATFORM_STACK_SIZE 0x440
  23. #elif defined(IMAGE_BL2)
  24. #define PLATFORM_STACK_SIZE 0x400
  25. #elif defined(IMAGE_BL31)
  26. #define PLATFORM_STACK_SIZE 0x800
  27. #elif defined(IMAGE_BL32)
  28. #define PLATFORM_STACK_SIZE 0x440
  29. #endif
  30. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  31. #define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
  32. #define PLAT_MAX_PWR_LVL U(2)
  33. #define PLAT_MAX_RET_STATE U(1)
  34. #define PLAT_MAX_OFF_STATE U(2)
  35. #define PLATFORM_SYSTEM_COUNT U(1)
  36. #define PLATFORM_CLUSTER_COUNT U(2)
  37. #define PLATFORM_CLUSTER0_CORE_COUNT U(4)
  38. #define PLATFORM_CLUSTER1_CORE_COUNT U(2)
  39. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
  40. PLATFORM_CLUSTER0_CORE_COUNT)
  41. #define PLATFORM_MAX_CPUS_PER_CLUSTER U(4)
  42. #define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \
  43. PLATFORM_CLUSTER_COUNT + \
  44. PLATFORM_CORE_COUNT)
  45. #define SOC_CHIP_ID U(0x8173)
  46. /*******************************************************************************
  47. * Platform memory map related constants
  48. ******************************************************************************/
  49. /*
  50. * MT8173 SRAM memory layout
  51. * 0x100000 +-------------------+
  52. * | shared mem (4KB) |
  53. * 0x101000 +-------------------+
  54. * | |
  55. * | BL3-1 (124KB) |
  56. * | |
  57. * 0x120000 +-------------------+
  58. * | reserved (64KB) |
  59. * 0x130000 +-------------------+
  60. */
  61. /* TF txet, ro, rw, xlat table, coherent memory ... etc.
  62. * Size: release: 128KB, debug: 128KB
  63. */
  64. #define TZRAM_BASE (0x100000)
  65. #if DEBUG
  66. #define TZRAM_SIZE (0x20000)
  67. #else
  68. #define TZRAM_SIZE (0x20000)
  69. #endif
  70. /* Reserved: 64KB */
  71. #define TZRAM2_BASE (TZRAM_BASE + TZRAM_SIZE)
  72. #define TZRAM2_SIZE (0x10000)
  73. /*******************************************************************************
  74. * BL31 specific defines.
  75. ******************************************************************************/
  76. /*
  77. * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
  78. * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
  79. * little space for growth.
  80. */
  81. #define BL31_BASE (TZRAM_BASE + 0x1000)
  82. #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
  83. #define TZRAM2_LIMIT (TZRAM2_BASE + TZRAM2_SIZE)
  84. /*******************************************************************************
  85. * Platform specific page table and MMU setup constants
  86. ******************************************************************************/
  87. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  88. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  89. #define MAX_XLAT_TABLES 4
  90. #define MAX_MMAP_REGIONS 16
  91. /*******************************************************************************
  92. * Declarations and constants to access the mailboxes safely. Each mailbox is
  93. * aligned on the biggest cache line size in the platform. This is known only
  94. * to the platform as it might have a combination of integrated and external
  95. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  96. * line at any cache level. They could belong to different cpus/clusters &
  97. * get written while being protected by different locks causing corruption of
  98. * a valid mailbox address.
  99. ******************************************************************************/
  100. #define CACHE_WRITEBACK_SHIFT 6
  101. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  102. #define PLAT_ARM_GICD_BASE BASE_GICD_BASE
  103. #define PLAT_ARM_GICC_BASE BASE_GICC_BASE
  104. #define PLAT_ARM_G1S_IRQ_PROPS(grp) \
  105. INTR_PROP_DESC(MT_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
  106. GIC_INTR_CFG_EDGE), \
  107. INTR_PROP_DESC(MT_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
  108. GIC_INTR_CFG_EDGE), \
  109. INTR_PROP_DESC(MT_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
  110. GIC_INTR_CFG_EDGE), \
  111. INTR_PROP_DESC(MT_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
  112. GIC_INTR_CFG_EDGE), \
  113. INTR_PROP_DESC(MT_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
  114. GIC_INTR_CFG_EDGE), \
  115. INTR_PROP_DESC(MT_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
  116. GIC_INTR_CFG_EDGE), \
  117. INTR_PROP_DESC(MT_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
  118. GIC_INTR_CFG_EDGE), \
  119. INTR_PROP_DESC(MT_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
  120. GIC_INTR_CFG_EDGE)
  121. #define PLAT_ARM_G0_IRQ_PROPS(grp)
  122. #endif /* PLATFORM_DEF_H */