versal_def.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
  4. * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef VERSAL_DEF_H
  9. #define VERSAL_DEF_H
  10. #include <plat/arm/common/smccc_def.h>
  11. #include <plat/common/common_def.h>
  12. #define PLATFORM_MASK GENMASK(27U, 24U)
  13. #define PLATFORM_VERSION_MASK GENMASK(31U, 28U)
  14. /* number of interrupt handlers. increase as required */
  15. #define MAX_INTR_EL3 2
  16. /* List all consoles */
  17. #define VERSAL_CONSOLE_ID_none 0
  18. #define VERSAL_CONSOLE_ID_pl011 1
  19. #define VERSAL_CONSOLE_ID_pl011_0 1
  20. #define VERSAL_CONSOLE_ID_pl011_1 2
  21. #define VERSAL_CONSOLE_ID_dcc 3
  22. #define VERSAL_CONSOLE_ID_dtb 4
  23. #define CONSOLE_IS(con) (VERSAL_CONSOLE_ID_ ## con == VERSAL_CONSOLE)
  24. /* Runtime console */
  25. #define RT_CONSOLE_ID_pl011 1
  26. #define RT_CONSOLE_ID_pl011_0 1
  27. #define RT_CONSOLE_ID_pl011_1 2
  28. #define RT_CONSOLE_ID_dcc 3
  29. #define RT_CONSOLE_ID_dtb 4
  30. #define RT_CONSOLE_IS(con) (RT_CONSOLE_ID_ ## con == CONSOLE_RUNTIME)
  31. /* List of platforms */
  32. #define VERSAL_SILICON U(0)
  33. #define VERSAL_SPP U(1)
  34. #define VERSAL_EMU U(2)
  35. #define VERSAL_QEMU U(3)
  36. #define VERSAL_COSIM U(7)
  37. /* Firmware Image Package */
  38. #define VERSAL_PRIMARY_CPU 0
  39. /*******************************************************************************
  40. * memory map related constants
  41. ******************************************************************************/
  42. #define DEVICE0_BASE 0xFF000000
  43. #define DEVICE0_SIZE 0x00E00000
  44. #define DEVICE1_BASE 0xF9000000
  45. #define DEVICE1_SIZE 0x00800000
  46. /*******************************************************************************
  47. * IRQ constants
  48. ******************************************************************************/
  49. #define VERSAL_IRQ_SEC_PHY_TIMER U(29)
  50. #define ARM_IRQ_SEC_PHY_TIMER 29
  51. /*******************************************************************************
  52. * CCI-400 related constants
  53. ******************************************************************************/
  54. #define PLAT_ARM_CCI_BASE 0xFD000000
  55. #define PLAT_ARM_CCI_SIZE 0x00100000
  56. #define PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX 4
  57. #define PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX 5
  58. /*******************************************************************************
  59. * UART related constants
  60. ******************************************************************************/
  61. #define VERSAL_UART0_BASE 0xFF000000
  62. #define VERSAL_UART1_BASE 0xFF010000
  63. #if CONSOLE_IS(pl011) || CONSOLE_IS(dtb)
  64. # define UART_BASE VERSAL_UART0_BASE
  65. # define UART_TYPE CONSOLE_PL011
  66. #elif CONSOLE_IS(pl011_1)
  67. # define UART_BASE VERSAL_UART1_BASE
  68. # define UART_TYPE CONSOLE_PL011
  69. #elif CONSOLE_IS(dcc)
  70. # define UART_BASE 0x0
  71. # define UART_TYPE CONSOLE_DCC
  72. #elif CONSOLE_IS(none)
  73. # define UART_TYPE CONSOLE_NONE
  74. #else
  75. # error "invalid VERSAL_CONSOLE"
  76. #endif
  77. /* Runtime console */
  78. #if defined(CONSOLE_RUNTIME)
  79. #if RT_CONSOLE_IS(pl011) || RT_CONSOLE_IS(dtb)
  80. # define RT_UART_BASE VERSAL_UART0_BASE
  81. # define RT_UART_TYPE CONSOLE_PL011
  82. #elif RT_CONSOLE_IS(pl011_1)
  83. # define RT_UART_BASE VERSAL_UART1_BASE
  84. # define RT_UART_TYPE CONSOLE_PL011
  85. #elif RT_CONSOLE_IS(dcc)
  86. # define RT_UART_BASE 0x0
  87. # define RT_UART_TYPE CONSOLE_DCC
  88. #else
  89. # error "invalid CONSOLE_RUNTIME"
  90. #endif
  91. #endif
  92. /*******************************************************************************
  93. * Platform related constants
  94. ******************************************************************************/
  95. #define UART_BAUDRATE 115200
  96. /* Access control register defines */
  97. #define ACTLR_EL3_L2ACTLR_BIT (1 << 6)
  98. #define ACTLR_EL3_CPUACTLR_BIT (1 << 0)
  99. /* For cpu reset APU space here too 0xFE5F1000 CRF_APB*/
  100. #define CRF_BASE 0xFD1A0000
  101. #define CRF_SIZE 0x00600000
  102. /* CRF registers and bitfields */
  103. #define CRF_RST_APU (CRF_BASE + 0X00000300)
  104. #define CRF_RST_APU_ACPU_RESET (1 << 0)
  105. #define CRF_RST_APU_ACPU_PWRON_RESET (1 << 10)
  106. /* IOU SCNTRS */
  107. #define IOU_SCNTRS_BASE U(0xFF140000)
  108. #define IOU_SCNTRS_BASE_FREQ_OFFSET U(0x20)
  109. /* APU registers and bitfields */
  110. #define FPD_APU_BASE 0xFD5C0000U
  111. #define FPD_APU_CONFIG_0 (FPD_APU_BASE + 0x20U)
  112. #define FPD_APU_RVBAR_L_0 (FPD_APU_BASE + 0x40U)
  113. #define FPD_APU_RVBAR_H_0 (FPD_APU_BASE + 0x44U)
  114. #define FPD_APU_PWRCTL (FPD_APU_BASE + 0x90U)
  115. #define FPD_APU_CONFIG_0_VINITHI_SHIFT 8U
  116. #define APU_0_PWRCTL_CPUPWRDWNREQ_MASK 1U
  117. #define APU_1_PWRCTL_CPUPWRDWNREQ_MASK 2U
  118. /* PMC registers and bitfields */
  119. #define PMC_GLOBAL_BASE 0xF1110000U
  120. #define PMC_GLOBAL_GLOB_GEN_STORAGE4 (PMC_GLOBAL_BASE + 0x40U)
  121. #endif /* VERSAL_DEF_H */