platform_def.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 <plat/common/common_def.h>
  10. #include <rk3328_def.h>
  11. /*******************************************************************************
  12. * Platform binary types for linking
  13. ******************************************************************************/
  14. #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
  15. #define PLATFORM_LINKER_ARCH aarch64
  16. /*******************************************************************************
  17. * Generic platform constants
  18. ******************************************************************************/
  19. /* Size of cacheable stacks */
  20. #if defined(IMAGE_BL1)
  21. #define PLATFORM_STACK_SIZE 0x440
  22. #elif defined(IMAGE_BL2)
  23. #define PLATFORM_STACK_SIZE 0x400
  24. #elif defined(IMAGE_BL31)
  25. #define PLATFORM_STACK_SIZE 0x800
  26. #elif defined(IMAGE_BL32)
  27. #define PLATFORM_STACK_SIZE 0x440
  28. #endif
  29. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  30. #define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
  31. #define PLATFORM_SYSTEM_COUNT 1
  32. #define PLATFORM_CLUSTER_COUNT U(1)
  33. #define PLATFORM_CLUSTER0_CORE_COUNT U(4)
  34. #define PLATFORM_CLUSTER1_CORE_COUNT U(0)
  35. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
  36. PLATFORM_CLUSTER0_CORE_COUNT)
  37. #define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \
  38. PLATFORM_CLUSTER_COUNT + \
  39. PLATFORM_CORE_COUNT)
  40. #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2
  41. #define PLAT_RK_CLST_TO_CPUID_SHIFT 6
  42. /*
  43. * This macro defines the deepest retention state possible. A higher state
  44. * id will represent an invalid or a power down state.
  45. */
  46. #define PLAT_MAX_RET_STATE U(1)
  47. /*
  48. * This macro defines the deepest power down states possible. Any state ID
  49. * higher than this is invalid.
  50. */
  51. #define PLAT_MAX_OFF_STATE U(2)
  52. /*******************************************************************************
  53. * Platform memory map related constants
  54. ******************************************************************************/
  55. /* TF text, ro, rw, Size: 1MB */
  56. #define TZRAM_BASE (0x0)
  57. #define TZRAM_SIZE (0x100000)
  58. /*******************************************************************************
  59. * BL31 specific defines.
  60. ******************************************************************************/
  61. /*
  62. * Put BL3-1 at the top of the Trusted RAM
  63. */
  64. #define BL31_BASE (TZRAM_BASE + 0x40000)
  65. #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
  66. /*******************************************************************************
  67. * Platform specific page table and MMU setup constants
  68. ******************************************************************************/
  69. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  70. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  71. #define MAX_XLAT_TABLES 9
  72. #define MAX_MMAP_REGIONS 33
  73. /*******************************************************************************
  74. * Declarations and constants to access the mailboxes safely. Each mailbox is
  75. * aligned on the biggest cache line size in the platform. This is known only
  76. * to the platform as it might have a combination of integrated and external
  77. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  78. * line at any cache level. They could belong to different cpus/clusters &
  79. * get written while being protected by different locks causing corruption of
  80. * a valid mailbox address.
  81. ******************************************************************************/
  82. #define CACHE_WRITEBACK_SHIFT 6
  83. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  84. /*
  85. * Define GICD and GICC and GICR base
  86. */
  87. #define PLAT_RK_GICD_BASE RK3328_GICD_BASE
  88. #define PLAT_RK_GICC_BASE RK3328_GICC_BASE
  89. #define PLAT_RK_UART_BASE UART2_BASE
  90. #define PLAT_RK_UART_CLOCK RK3328_UART_CLOCK
  91. #define PLAT_RK_UART_BAUDRATE RK3328_BAUDRATE
  92. #define PLAT_RK_PRIMARY_CPU 0x0
  93. #define PSRAM_DO_DDR_RESUME 0
  94. #define PSRAM_CHECK_WAKEUP_CPU 0
  95. #endif /* PLATFORM_DEF_H */