platform_def.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice, this
  8. * list of conditions and the following disclaimer.
  9. *
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and/or other materials provided with the distribution.
  13. *
  14. * Neither the name of ARM nor the names of its contributors may be used
  15. * to endorse or promote products derived from this software without specific
  16. * prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  22. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef __PLATFORM_DEF_H__
  31. #define __PLATFORM_DEF_H__
  32. #include <arch.h>
  33. #include "../fvp_def.h"
  34. /*******************************************************************************
  35. * Platform binary types for linking
  36. ******************************************************************************/
  37. #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
  38. #define PLATFORM_LINKER_ARCH aarch64
  39. /*******************************************************************************
  40. * Generic platform constants
  41. ******************************************************************************/
  42. /* Size of cacheable stacks */
  43. #if DEBUG_XLAT_TABLE
  44. #define PLATFORM_STACK_SIZE 0x800
  45. #elif IMAGE_BL1
  46. #define PLATFORM_STACK_SIZE 0x440
  47. #elif IMAGE_BL2
  48. #define PLATFORM_STACK_SIZE 0x400
  49. #elif IMAGE_BL31
  50. #define PLATFORM_STACK_SIZE 0x400
  51. #elif IMAGE_BL32
  52. #define PLATFORM_STACK_SIZE 0x440
  53. #endif
  54. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  55. /* Trusted Boot Firmware BL2 */
  56. #define BL2_IMAGE_NAME "bl2.bin"
  57. /* EL3 Runtime Firmware BL31 */
  58. #define BL31_IMAGE_NAME "bl31.bin"
  59. /* Secure Payload BL32 (Trusted OS) */
  60. #define BL32_IMAGE_NAME "bl32.bin"
  61. /* Non-Trusted Firmware BL33 */
  62. #define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */
  63. #define PLATFORM_CACHE_LINE_SIZE 64
  64. #define PLATFORM_CLUSTER_COUNT 2ull
  65. #define PLATFORM_CLUSTER0_CORE_COUNT 4
  66. #define PLATFORM_CLUSTER1_CORE_COUNT 4
  67. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
  68. PLATFORM_CLUSTER0_CORE_COUNT)
  69. #define PLATFORM_MAX_CPUS_PER_CLUSTER 4
  70. #define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \
  71. PLATFORM_CORE_COUNT)
  72. #define MAX_IO_DEVICES 3
  73. #define MAX_IO_HANDLES 4
  74. /*******************************************************************************
  75. * BL1 specific defines.
  76. * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
  77. * addresses.
  78. ******************************************************************************/
  79. #define BL1_RO_BASE FVP_TRUSTED_ROM_BASE
  80. #define BL1_RO_LIMIT (FVP_TRUSTED_ROM_BASE \
  81. + FVP_TRUSTED_ROM_SIZE)
  82. /*
  83. * Put BL1 RW at the top of the Trusted SRAM. BL1_RW_BASE is calculated using
  84. * the current BL1 RW debug size plus a little space for growth.
  85. */
  86. #define BL1_RW_BASE (FVP_TRUSTED_SRAM_BASE \
  87. + FVP_TRUSTED_SRAM_SIZE - 0x6000)
  88. #define BL1_RW_LIMIT (FVP_TRUSTED_SRAM_BASE \
  89. + FVP_TRUSTED_SRAM_SIZE)
  90. /*******************************************************************************
  91. * BL2 specific defines.
  92. ******************************************************************************/
  93. /*
  94. * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug
  95. * size plus a little space for growth.
  96. */
  97. #define BL2_BASE (BL31_BASE - 0xC000)
  98. #define BL2_LIMIT BL31_BASE
  99. /*******************************************************************************
  100. * BL31 specific defines.
  101. ******************************************************************************/
  102. /*
  103. * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the
  104. * current BL3-1 debug size plus a little space for growth.
  105. */
  106. #define BL31_BASE (FVP_TRUSTED_SRAM_BASE \
  107. + FVP_TRUSTED_SRAM_SIZE - 0x1D000)
  108. #define BL31_PROGBITS_LIMIT BL1_RW_BASE
  109. #define BL31_LIMIT (FVP_TRUSTED_SRAM_BASE \
  110. + FVP_TRUSTED_SRAM_SIZE)
  111. /*******************************************************************************
  112. * BL32 specific defines.
  113. ******************************************************************************/
  114. /*
  115. * On FVP, the TSP can execute either from Trusted SRAM or Trusted DRAM.
  116. */
  117. #if FVP_TSP_RAM_LOCATION_ID == FVP_IN_TRUSTED_SRAM
  118. # define TSP_SEC_MEM_BASE FVP_TRUSTED_SRAM_BASE
  119. # define TSP_SEC_MEM_SIZE FVP_TRUSTED_SRAM_SIZE
  120. # define TSP_PROGBITS_LIMIT BL2_BASE
  121. # define BL32_BASE FVP_TRUSTED_SRAM_BASE
  122. # define BL32_LIMIT BL31_BASE
  123. #elif FVP_TSP_RAM_LOCATION_ID == FVP_IN_TRUSTED_DRAM
  124. # define TSP_SEC_MEM_BASE FVP_TRUSTED_DRAM_BASE
  125. # define TSP_SEC_MEM_SIZE FVP_TRUSTED_DRAM_SIZE
  126. # define BL32_BASE FVP_TRUSTED_DRAM_BASE
  127. # define BL32_LIMIT (FVP_TRUSTED_DRAM_BASE + (1 << 21))
  128. #else
  129. # error "Unsupported FVP_TSP_RAM_LOCATION_ID value"
  130. #endif
  131. /*
  132. * ID of the secure physical generic timer interrupt used by the TSP.
  133. */
  134. #define TSP_IRQ_SEC_PHY_TIMER IRQ_SEC_PHY_TIMER
  135. /*******************************************************************************
  136. * Platform specific page table and MMU setup constants
  137. ******************************************************************************/
  138. #define ADDR_SPACE_SIZE (1ull << 32)
  139. #define MAX_XLAT_TABLES 2
  140. #define MAX_MMAP_REGIONS 16
  141. /*******************************************************************************
  142. * Declarations and constants to access the mailboxes safely. Each mailbox is
  143. * aligned on the biggest cache line size in the platform. This is known only
  144. * to the platform as it might have a combination of integrated and external
  145. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  146. * line at any cache level. They could belong to different cpus/clusters &
  147. * get written while being protected by different locks causing corruption of
  148. * a valid mailbox address.
  149. ******************************************************************************/
  150. #define CACHE_WRITEBACK_SHIFT 6
  151. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  152. #if !USE_COHERENT_MEM
  153. /*******************************************************************************
  154. * Size of the per-cpu data in bytes that should be reserved in the generic
  155. * per-cpu data structure for the FVP port.
  156. ******************************************************************************/
  157. #define PLAT_PCPU_DATA_SIZE 2
  158. #endif
  159. #endif /* __PLATFORM_DEF_H__ */