platform_def.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * Copyright (c) 2017-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 <arch.h>
  9. #include <common/interrupt_props.h>
  10. #include <common/tbbr/tbbr_img_def.h>
  11. #include <drivers/arm/gic_common.h>
  12. #include <lib/utils_def.h>
  13. #include <plat/common/common_def.h>
  14. #include "hi3798cv200.h"
  15. #include "poplar_layout.h" /* BL memory region sizes, etc */
  16. /* Special value used to verify platform parameters from BL2 to BL3-1 */
  17. #define POPLAR_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL
  18. #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
  19. #define PLATFORM_LINKER_ARCH aarch64
  20. #define POPLAR_CRASH_UART_BASE PL011_UART0_BASE
  21. #define POPLAR_CRASH_UART_CLK_IN_HZ PL011_UART0_CLK_IN_HZ
  22. #define POPLAR_CONSOLE_BAUDRATE PL011_BAUDRATE
  23. /* Generic platform constants */
  24. #define PLATFORM_STACK_SIZE (0x800)
  25. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  26. #define BOOT_EMMC_NAME "l-loader.bin"
  27. #define PLATFORM_CACHE_LINE_SIZE (64)
  28. #define PLATFORM_CLUSTER_COUNT U(1)
  29. #define PLATFORM_CORE_COUNT U(4)
  30. #define PLATFORM_MAX_CPUS_PER_CLUSTER U(4)
  31. /* IO framework user */
  32. #define MAX_IO_DEVICES (4)
  33. #define MAX_IO_HANDLES (4)
  34. #define MAX_IO_BLOCK_DEVICES U(2)
  35. /* Memory size options */
  36. #define POPLAR_DRAM_SIZE_1G 0
  37. #define POPLAR_DRAM_SIZE_2G 1
  38. /* Memory map related constants */
  39. #define DDR_BASE (0x00000000)
  40. #if (POPLAR_DRAM_SIZE_ID == POPLAR_DRAM_SIZE_2G)
  41. #define DDR_SIZE (0x80000000)
  42. #elif (POPLAR_DRAM_SIZE_ID == POPLAR_DRAM_SIZE_1G)
  43. #define DDR_SIZE (0x40000000)
  44. #else
  45. #error "Currently unsupported POPLAR_DRAM_SIZE_ID value"
  46. #endif
  47. #define DEVICE_BASE (0xF0000000)
  48. #define DEVICE_SIZE (0x0F000000)
  49. #define TEE_SEC_MEM_BASE (0x70000000)
  50. #define TEE_SEC_MEM_SIZE (0x10000000)
  51. /* Memory location options for TSP */
  52. #define POPLAR_SRAM_ID 0
  53. #define POPLAR_DRAM_ID 1
  54. /*
  55. * DDR for OP-TEE (26MB from 0x02400000 -0x04000000) is divided in several
  56. * regions:
  57. * - Secure DDR (default is the top 16MB) used by OP-TEE
  58. * - Non-secure DDR (4MB) reserved for OP-TEE's future use
  59. * - Secure DDR (4MB aligned on 4MB) for OP-TEE's "Secure Data Path" feature
  60. * - Non-secure DDR used by OP-TEE (shared memory and padding) (4MB)
  61. */
  62. #define DDR_SEC_SIZE 0x01000000
  63. #define DDR_SEC_BASE 0x03000000
  64. /*
  65. * BL3-2 specific defines.
  66. */
  67. /*
  68. * The TSP currently executes from TZC secured area of DRAM.
  69. */
  70. #define BL32_DRAM_BASE 0x03000000
  71. #define BL32_DRAM_LIMIT 0x04000000
  72. #ifdef SPD_opteed
  73. /* Load pageable part of OP-TEE at end of allocated DRAM space for BL32 */
  74. #define POPLAR_OPTEE_PAGEABLE_LOAD_SIZE 0x400000 /* 4MB */
  75. #define POPLAR_OPTEE_PAGEABLE_LOAD_BASE (BL32_DRAM_LIMIT - POPLAR_OPTEE_PAGEABLE_LOAD_SIZE) /* 0x03C0_0000 */
  76. #endif
  77. #if (POPLAR_TSP_RAM_LOCATION_ID == POPLAR_DRAM_ID)
  78. #define TSP_SEC_MEM_BASE BL32_DRAM_BASE
  79. #define TSP_SEC_MEM_SIZE (BL32_DRAM_LIMIT - BL32_DRAM_BASE)
  80. #define BL32_BASE BL32_DRAM_BASE
  81. #define BL32_LIMIT BL32_DRAM_LIMIT
  82. #elif (POPLAR_TSP_RAM_LOCATION_ID == POPLAR_SRAM_ID)
  83. #error "SRAM storage of TSP payload is currently unsupported"
  84. #else
  85. #error "Currently unsupported POPLAR_TSP_LOCATION_ID value"
  86. #endif
  87. /* BL32 is mandatory in AArch32 */
  88. #ifdef __aarch64__
  89. #ifdef SPD_none
  90. #undef BL32_BASE
  91. #endif /* SPD_none */
  92. #endif
  93. #define POPLAR_EMMC_DATA_BASE U(0x02200000)
  94. #define POPLAR_EMMC_DATA_SIZE EMMC_DESC_SIZE
  95. #define POPLAR_EMMC_DESC_BASE (POPLAR_EMMC_DATA_BASE + POPLAR_EMMC_DATA_SIZE)
  96. #define POPLAR_EMMC_DESC_SIZE EMMC_DESC_SIZE
  97. #define PLAT_POPLAR_NS_IMAGE_OFFSET 0x37000000
  98. /* Page table and MMU setup constants */
  99. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  100. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  101. #define MAX_XLAT_TABLES (4)
  102. #define MAX_MMAP_REGIONS (16)
  103. #define CACHE_WRITEBACK_SHIFT (6)
  104. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  105. /* Power states */
  106. #define PLAT_MAX_PWR_LVL (MPIDR_AFFLVL1)
  107. #define PLAT_MAX_OFF_STATE U(2)
  108. #define PLAT_MAX_RET_STATE U(1)
  109. /* Interrupt controller */
  110. #define POPLAR_GICD_BASE GICD_BASE
  111. #define POPLAR_GICC_BASE GICC_BASE
  112. #define POPLAR_G1S_IRQ_PROPS(grp) \
  113. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
  114. GIC_INTR_CFG_LEVEL), \
  115. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
  116. GIC_INTR_CFG_LEVEL), \
  117. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
  118. GIC_INTR_CFG_LEVEL), \
  119. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
  120. GIC_INTR_CFG_LEVEL), \
  121. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
  122. GIC_INTR_CFG_LEVEL), \
  123. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
  124. GIC_INTR_CFG_LEVEL), \
  125. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
  126. GIC_INTR_CFG_LEVEL), \
  127. INTR_PROP_DESC(HISI_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
  128. GIC_INTR_CFG_LEVEL), \
  129. INTR_PROP_DESC(HISI_IRQ_SEC_TIMER0, GIC_HIGHEST_SEC_PRIORITY, grp, \
  130. GIC_INTR_CFG_LEVEL), \
  131. INTR_PROP_DESC(HISI_IRQ_SEC_TIMER1, GIC_HIGHEST_SEC_PRIORITY, grp, \
  132. GIC_INTR_CFG_LEVEL), \
  133. INTR_PROP_DESC(HISI_IRQ_SEC_TIMER2, GIC_HIGHEST_SEC_PRIORITY, grp, \
  134. GIC_INTR_CFG_LEVEL), \
  135. INTR_PROP_DESC(HISI_IRQ_SEC_TIMER3, GIC_HIGHEST_SEC_PRIORITY, grp, \
  136. GIC_INTR_CFG_LEVEL), \
  137. INTR_PROP_DESC(HISI_IRQ_SEC_AXI, GIC_HIGHEST_SEC_PRIORITY, grp, \
  138. GIC_INTR_CFG_LEVEL)
  139. #define POPLAR_G0_IRQ_PROPS(grp)
  140. #endif /* PLATFORM_DEF_H */