platform_def.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #ifndef PLATFORM_DEF_H
  8. #define PLATFORM_DEF_H
  9. #include <arch.h>
  10. #include <plat_common.h>
  11. #include "versal_def.h"
  12. /*******************************************************************************
  13. * Generic platform constants
  14. ******************************************************************************/
  15. /* Size of cacheable stacks */
  16. #define PLATFORM_STACK_SIZE U(0x440)
  17. #define PLATFORM_CORE_COUNT U(2)
  18. #define PLAT_MAX_PWR_LVL U(1)
  19. #define PLAT_MAX_RET_STATE U(1)
  20. #define PLAT_MAX_OFF_STATE U(2)
  21. /*******************************************************************************
  22. * BL31 specific defines.
  23. ******************************************************************************/
  24. /*
  25. * Put BL31 at the top of the Trusted SRAM (just below the shared memory, if
  26. * present). BL31_BASE is calculated using the current BL31 debug size plus a
  27. * little space for growth.
  28. */
  29. #ifndef VERSAL_ATF_MEM_BASE
  30. # define BL31_BASE U(0xfffe0000)
  31. # define BL31_LIMIT U(0x100000000)
  32. #else
  33. # define BL31_BASE U(VERSAL_ATF_MEM_BASE)
  34. # define BL31_LIMIT U(VERSAL_ATF_MEM_BASE + VERSAL_ATF_MEM_SIZE)
  35. # ifdef VERSAL_ATF_MEM_PROGBITS_SIZE
  36. # define BL31_PROGBITS_LIMIT U(VERSAL_ATF_MEM_BASE + VERSAL_ATF_MEM_PROGBITS_SIZE)
  37. # endif
  38. #endif
  39. /*******************************************************************************
  40. * BL32 specific defines.
  41. ******************************************************************************/
  42. #ifndef VERSAL_BL32_MEM_BASE
  43. # define BL32_BASE U(0x60000000)
  44. # define BL32_LIMIT U(0x80000000)
  45. #else
  46. # define BL32_BASE U(VERSAL_BL32_MEM_BASE)
  47. # define BL32_LIMIT U(VERSAL_BL32_MEM_BASE + VERSAL_BL32_MEM_SIZE)
  48. #endif
  49. /*******************************************************************************
  50. * BL33 specific defines.
  51. ******************************************************************************/
  52. #ifndef PRELOADED_BL33_BASE
  53. # define PLAT_ARM_NS_IMAGE_BASE U(0x8000000)
  54. #else
  55. # define PLAT_ARM_NS_IMAGE_BASE U(PRELOADED_BL33_BASE)
  56. #endif
  57. /*******************************************************************************
  58. * TSP specific defines.
  59. ******************************************************************************/
  60. #define TSP_SEC_MEM_BASE BL32_BASE
  61. #define TSP_SEC_MEM_SIZE (BL32_LIMIT - BL32_BASE)
  62. /* ID of the secure physical generic timer interrupt used by the TSP */
  63. #define TSP_IRQ_SEC_PHY_TIMER ARM_IRQ_SEC_PHY_TIMER
  64. /*******************************************************************************
  65. * Platform specific page table and MMU setup constants
  66. ******************************************************************************/
  67. #if (BL31_BASE >= (1ULL << 32U))
  68. /* Address range in High DDR and HBM memory range */
  69. #define PLAT_ADDR_SPACE_SHIFT U(42)
  70. #else
  71. /* Address range in OCM and Low DDR memory range */
  72. #define PLAT_ADDR_SPACE_SHIFT U(32)
  73. #endif
  74. #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << PLAT_ADDR_SPACE_SHIFT)
  75. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << PLAT_ADDR_SPACE_SHIFT)
  76. #define XILINX_OF_BOARD_DTB_MAX_SIZE U(0x200000)
  77. #define PLAT_OCM_BASE U(0xFFFE0000)
  78. #define PLAT_OCM_LIMIT U(0xFFFFFFFF)
  79. #define IS_TFA_IN_OCM(x) ((x >= PLAT_OCM_BASE) && (x < PLAT_OCM_LIMIT))
  80. #ifndef MAX_MMAP_REGIONS
  81. #if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE))
  82. #define MAX_MMAP_REGIONS 9
  83. #else
  84. #define MAX_MMAP_REGIONS 8
  85. #endif
  86. #endif
  87. #ifndef MAX_XLAT_TABLES
  88. #if !IS_TFA_IN_OCM(BL31_BASE)
  89. #define MAX_XLAT_TABLES 9
  90. #else
  91. #define MAX_XLAT_TABLES 5
  92. #endif
  93. #endif
  94. #define CACHE_WRITEBACK_SHIFT 6
  95. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  96. #define PLAT_ARM_GICD_BASE U(0xF9000000)
  97. #define PLAT_ARM_GICR_BASE U(0xF9080000)
  98. /*
  99. * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3
  100. * terminology. On a GICv2 system or mode, the lists will be merged and treated
  101. * as Group 0 interrupts.
  102. */
  103. #define PLAT_VERSAL_G1S_IRQS VERSAL_IRQ_SEC_PHY_TIMER
  104. #define PLAT_VERSAL_G0_IRQS VERSAL_IRQ_SEC_PHY_TIMER
  105. #define PLAT_VERSAL_IPI_IRQ U(62)
  106. #define PLAT_VERSAL_G1S_IRQ_PROPS(grp) \
  107. INTR_PROP_DESC(VERSAL_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, grp, \
  108. GIC_INTR_CFG_LEVEL)
  109. #define PLAT_VERSAL_G0_IRQ_PROPS(grp) \
  110. INTR_PROP_DESC(PLAT_VERSAL_IPI_IRQ, GIC_HIGHEST_SEC_PRIORITY, grp, \
  111. GIC_INTR_CFG_EDGE), \
  112. INTR_PROP_DESC(CPU_PWR_DOWN_REQ_INTR, GIC_HIGHEST_SEC_PRIORITY, grp, \
  113. GIC_INTR_CFG_EDGE)
  114. #define IRQ_MAX 142U
  115. #endif /* PLATFORM_DEF_H */