1 /* 2 * Copyright (c) 2015-2024, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef PLATFORM_DEF_H 8 #define PLATFORM_DEF_H 9 10 #include <arch.h> 11 #include <drivers/arm/gic_common.h> 12 #include <lib/utils_def.h> 13 #include <plat/common/common_def.h> 14 15 #include "../stm32mp1_def.h" 16 17 /******************************************************************************* 18 * Generic platform constants 19 ******************************************************************************/ 20 21 /* Size of cacheable stacks */ 22 #if defined(IMAGE_BL32) 23 #define PLATFORM_STACK_SIZE 0x600 24 #else 25 #define PLATFORM_STACK_SIZE 0xC00 26 #endif 27 28 #define STM32MP_PRIMARY_CPU U(0x0) 29 #define STM32MP_SECONDARY_CPU U(0x1) 30 31 #define PLATFORM_CLUSTER_COUNT U(1) 32 #define PLATFORM_CLUSTER0_CORE_COUNT U(2) 33 #define PLATFORM_CLUSTER1_CORE_COUNT U(0) 34 #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \ 35 PLATFORM_CLUSTER0_CORE_COUNT) 36 #define PLATFORM_MAX_CPUS_PER_CLUSTER 2 37 38 #define MAX_IO_DEVICES U(4) 39 #define MAX_IO_HANDLES U(4) 40 #define MAX_IO_BLOCK_DEVICES U(1) 41 #define MAX_IO_MTD_DEVICES U(1) 42 43 /******************************************************************************* 44 * BL2 specific defines. 45 ******************************************************************************/ 46 /* 47 * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug 48 * size plus a little space for growth. 49 */ 50 #define BL2_BASE STM32MP_BL2_BASE 51 #define BL2_LIMIT (STM32MP_BL2_BASE + \ 52 STM32MP_BL2_SIZE) 53 54 #define BL2_RO_BASE STM32MP_BL2_RO_BASE 55 #define BL2_RO_LIMIT (STM32MP_BL2_RO_BASE + \ 56 STM32MP_BL2_RO_SIZE) 57 58 #define BL2_RW_BASE STM32MP_BL2_RW_BASE 59 #define BL2_RW_LIMIT (STM32MP_BL2_RW_BASE + \ 60 STM32MP_BL2_RW_SIZE) 61 /******************************************************************************* 62 * BL32 specific defines. 63 ******************************************************************************/ 64 #if defined(IMAGE_BL32) 65 #if ENABLE_PIE 66 #define BL32_BASE 0 67 #define BL32_LIMIT STM32MP_BL32_SIZE 68 #else 69 #define BL32_BASE STM32MP_BL32_BASE 70 #define BL32_LIMIT (STM32MP_BL32_BASE + \ 71 STM32MP_BL32_SIZE) 72 #endif 73 #endif /* defined(IMAGE_BL32) */ 74 75 /******************************************************************************* 76 * BL33 specific defines. 77 ******************************************************************************/ 78 #define BL33_BASE STM32MP_BL33_BASE 79 80 /* Needed by STM32CubeProgrammer support */ 81 #define DWL_BUFFER_SIZE U(0x01000000) 82 83 /******************************************************************************* 84 * DTB specific defines. 85 ******************************************************************************/ 86 #define DTB_BASE STM32MP_DTB_BASE 87 #define DTB_LIMIT (STM32MP_DTB_BASE + \ 88 STM32MP_DTB_SIZE) 89 90 /******************************************************************************* 91 * Platform specific page table and MMU setup constants 92 ******************************************************************************/ 93 #define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 32) 94 #define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 32) 95 96 /******************************************************************************* 97 * Declarations and constants to access the mailboxes safely. Each mailbox is 98 * aligned on the biggest cache line size in the platform. This is known only 99 * to the platform as it might have a combination of integrated and external 100 * caches. Such alignment ensures that two maiboxes do not sit on the same cache 101 * line at any cache level. They could belong to different cpus/clusters & 102 * get written while being protected by different locks causing corruption of 103 * a valid mailbox address. 104 ******************************************************************************/ 105 #define CACHE_WRITEBACK_SHIFT 6 106 #define CACHE_WRITEBACK_GRANULE (U(1) << CACHE_WRITEBACK_SHIFT) 107 108 /* 109 * Secure Interrupt: based on the standard ARM mapping 110 */ 111 #define ARM_IRQ_SEC_PHY_TIMER U(29) 112 113 #define ARM_IRQ_SEC_SGI_0 U(8) 114 #define ARM_IRQ_SEC_SGI_1 U(9) 115 #define ARM_IRQ_SEC_SGI_2 U(10) 116 #define ARM_IRQ_SEC_SGI_3 U(11) 117 #define ARM_IRQ_SEC_SGI_4 U(12) 118 #define ARM_IRQ_SEC_SGI_5 U(13) 119 #define ARM_IRQ_SEC_SGI_6 U(14) 120 #define ARM_IRQ_SEC_SGI_7 U(15) 121 122 #define STM32MP1_IRQ_TZC400 U(36) 123 #define STM32MP1_IRQ_TAMPSERRS U(229) 124 #define STM32MP1_IRQ_AXIERRIRQ U(244) 125 126 /* 127 * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3 128 * terminology. On a GICv2 system or mode, the lists will be merged and treated 129 * as Group 0 interrupts. 130 */ 131 #define PLATFORM_G1S_PROPS(grp) \ 132 INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, \ 133 GIC_HIGHEST_SEC_PRIORITY, \ 134 grp, GIC_INTR_CFG_LEVEL), \ 135 INTR_PROP_DESC(STM32MP1_IRQ_AXIERRIRQ, \ 136 GIC_HIGHEST_SEC_PRIORITY, \ 137 grp, GIC_INTR_CFG_LEVEL), \ 138 INTR_PROP_DESC(STM32MP1_IRQ_TZC400, \ 139 GIC_HIGHEST_SEC_PRIORITY, \ 140 grp, GIC_INTR_CFG_LEVEL), \ 141 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, \ 142 GIC_HIGHEST_SEC_PRIORITY, \ 143 grp, GIC_INTR_CFG_EDGE), \ 144 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, \ 145 GIC_HIGHEST_SEC_PRIORITY, \ 146 grp, GIC_INTR_CFG_EDGE), \ 147 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, \ 148 GIC_HIGHEST_SEC_PRIORITY, \ 149 grp, GIC_INTR_CFG_EDGE), \ 150 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, \ 151 GIC_HIGHEST_SEC_PRIORITY, \ 152 grp, GIC_INTR_CFG_EDGE), \ 153 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, \ 154 GIC_HIGHEST_SEC_PRIORITY, \ 155 grp, GIC_INTR_CFG_EDGE), \ 156 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, \ 157 GIC_HIGHEST_SEC_PRIORITY, \ 158 grp, GIC_INTR_CFG_EDGE) 159 160 #define PLATFORM_G0_PROPS(grp) \ 161 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, \ 162 GIC_HIGHEST_SEC_PRIORITY, \ 163 grp, GIC_INTR_CFG_EDGE), \ 164 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, \ 165 GIC_HIGHEST_SEC_PRIORITY, \ 166 grp, GIC_INTR_CFG_EDGE) 167 168 /* 169 * Power 170 */ 171 #define PLAT_MAX_PWR_LVL U(1) 172 173 /* Local power state for power domains in Run state. */ 174 #define ARM_LOCAL_STATE_RUN U(0) 175 /* Local power state for retention. Valid only for CPU power domains */ 176 #define ARM_LOCAL_STATE_RET U(1) 177 /* Local power state for power-down. Valid for CPU and cluster power domains */ 178 #define ARM_LOCAL_STATE_OFF U(2) 179 /* 180 * This macro defines the deepest retention state possible. 181 * A higher state id will represent an invalid or a power down state. 182 */ 183 #define PLAT_MAX_RET_STATE ARM_LOCAL_STATE_RET 184 /* 185 * This macro defines the deepest power down states possible. Any state ID 186 * higher than this is invalid. 187 */ 188 #define PLAT_MAX_OFF_STATE ARM_LOCAL_STATE_OFF 189 190 /******************************************************************************* 191 * Size of the per-cpu data in bytes that should be reserved in the generic 192 * per-cpu data structure for the FVP port. 193 ******************************************************************************/ 194 #define PLAT_PCPU_DATA_SIZE 2 195 196 /******************************************************************************* 197 * Number of parallel entry slots in SMT SCMI server entry context. For this 198 * platform, SCMI server is reached through SMC only, hence the number of 199 * entry slots. 200 ******************************************************************************/ 201 #define PLAT_SMT_ENTRY_COUNT PLATFORM_CORE_COUNT 202 203 #endif /* PLATFORM_DEF_H */ 204