platform_def.h 4.4 KB

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