platform_def.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (c) 2017-2022, 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 <lib/utils_def.h>
  10. #include "../hikey960_def.h"
  11. /* Special value used to verify platform parameters from BL2 to BL3-1 */
  12. #define HIKEY960_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL
  13. /*
  14. * Generic platform constants
  15. */
  16. /* Size of cacheable stacks */
  17. #define PLATFORM_STACK_SIZE 0x1000
  18. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  19. #define PLATFORM_CACHE_LINE_SIZE 64
  20. #define PLATFORM_CLUSTER_COUNT U(2)
  21. #define PLATFORM_CORE_COUNT_PER_CLUSTER U(4)
  22. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER_COUNT * \
  23. PLATFORM_CORE_COUNT_PER_CLUSTER)
  24. #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2
  25. #define PLAT_NUM_PWR_DOMAINS (PLATFORM_CORE_COUNT + \
  26. PLATFORM_CLUSTER_COUNT + 1)
  27. #define PLAT_MAX_RET_STATE U(1)
  28. #define PLAT_MAX_OFF_STATE U(2)
  29. #define MAX_IO_DEVICES 3
  30. #define MAX_IO_HANDLES 4
  31. /* UFS RPMB and UFS User Data */
  32. #define MAX_IO_BLOCK_DEVICES U(2)
  33. /*
  34. * Platform memory map related constants
  35. */
  36. /*
  37. * BL1 specific defines.
  38. */
  39. #define BL1_RO_BASE (0x1AC00000)
  40. #define BL1_RO_LIMIT (BL1_RO_BASE + 0x20000)
  41. #define BL1_RW_BASE (BL1_RO_LIMIT) /* 1AC2_0000 */
  42. #define BL1_RW_SIZE (0x00188000)
  43. #define BL1_RW_LIMIT (0x1B000000)
  44. /*
  45. * BL2 specific defines.
  46. */
  47. #define BL2_BASE (0x1AC00000)
  48. #define BL2_LIMIT (BL2_BASE + 0x58000) /* 1AC5_8000 */
  49. /*
  50. * BL31 specific defines.
  51. */
  52. #define BL31_BASE (BL2_LIMIT) /* 1AC5_8000 */
  53. #define BL31_LIMIT (BL31_BASE + 0x40000) /* 1AC9_8000 */
  54. /*
  55. * BL3-2 specific defines.
  56. */
  57. /*
  58. * The TSP currently executes from TZC secured area of DRAM.
  59. */
  60. #define BL32_DRAM_BASE DDR_SEC_BASE
  61. #define BL32_DRAM_LIMIT (DDR_SEC_BASE+DDR_SEC_SIZE)
  62. #ifdef SPD_opteed
  63. /* Load pageable part of OP-TEE at end of allocated DRAM space for BL32 */
  64. #define HIKEY960_OPTEE_PAGEABLE_LOAD_BASE (BL32_DRAM_LIMIT - HIKEY960_OPTEE_PAGEABLE_LOAD_SIZE) /* 0x3FC0_0000 */
  65. #define HIKEY960_OPTEE_PAGEABLE_LOAD_SIZE 0x400000 /* 4MB */
  66. #endif
  67. #if (HIKEY960_TSP_RAM_LOCATION_ID == HIKEY960_DRAM_ID)
  68. #define TSP_SEC_MEM_BASE BL32_DRAM_BASE
  69. #define TSP_SEC_MEM_SIZE (BL32_DRAM_LIMIT - BL32_DRAM_BASE)
  70. #define BL32_BASE BL32_DRAM_BASE
  71. #define BL32_LIMIT BL32_DRAM_LIMIT
  72. #elif (HIKEY960_TSP_RAM_LOCATION_ID == HIKEY960_SRAM_ID)
  73. #error "SRAM storage of TSP payload is currently unsupported"
  74. #else
  75. #error "Currently unsupported HIKEY960_TSP_LOCATION_ID value"
  76. #endif
  77. /* BL32 is mandatory in AArch32 */
  78. #ifdef __aarch64__
  79. #ifdef SPD_none
  80. #undef BL32_BASE
  81. #endif /* SPD_none */
  82. #endif
  83. #define NS_BL1U_BASE (BL31_LIMIT) /* 1AC9_8000 */
  84. #define NS_BL1U_SIZE (0x00100000)
  85. #define NS_BL1U_LIMIT (NS_BL1U_BASE + NS_BL1U_SIZE)
  86. #define HIKEY960_NS_IMAGE_OFFSET (0x1AC28000) /* offset in l-loader */
  87. #define HIKEY960_NS_TMP_OFFSET (0x1AE00000)
  88. #define SCP_BL2_BASE (0x89C80000)
  89. #define SCP_BL2_SIZE (0x00040000)
  90. /*
  91. * Platform specific page table and MMU setup constants
  92. */
  93. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 36)
  94. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 36)
  95. #if defined(IMAGE_BL1) || defined(IMAGE_BL32)
  96. #define MAX_XLAT_TABLES 3
  97. #endif
  98. #if defined(IMAGE_BL2)
  99. #define MAX_XLAT_TABLES 5
  100. #endif
  101. #if defined(IMAGE_BL31)
  102. #if defined(SPMC_AT_EL3)
  103. #define MAX_XLAT_TABLES 17
  104. #else
  105. #define MAX_XLAT_TABLES 5
  106. #endif
  107. #endif
  108. #define MAX_MMAP_REGIONS 16
  109. /*
  110. * Declarations and constants to access the mailboxes safely. Each mailbox is
  111. * aligned on the biggest cache line size in the platform. This is known only
  112. * to the platform as it might have a combination of integrated and external
  113. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  114. * line at any cache level. They could belong to different cpus/clusters &
  115. * get written while being protected by different locks causing corruption of
  116. * a valid mailbox address.
  117. */
  118. #define CACHE_WRITEBACK_SHIFT 6
  119. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  120. #endif /* PLATFORM_DEF_H */