1c35d59a3SSumit Garg /* 248ab3904SJassi Brar * Copyright (c) 2018-2022, ARM Limited and Contributors. All rights reserved. 3c35d59a3SSumit Garg * 4c35d59a3SSumit Garg * SPDX-License-Identifier: BSD-3-Clause 5c35d59a3SSumit Garg */ 6c35d59a3SSumit Garg 71083b2b3SAntonio Nino Diaz #ifndef PLATFORM_DEF_H 81083b2b3SAntonio Nino Diaz #define PLATFORM_DEF_H 9c35d59a3SSumit Garg 1009d40e0eSAntonio Nino Diaz #include <lib/utils_def.h> 1109d40e0eSAntonio Nino Diaz #include <plat/common/common_def.h> 12c35d59a3SSumit Garg 13007a7a33SSumit Garg /* CPU topology */ 1450dae22eSDeepika Bhavnani #define PLAT_MAX_CORES_PER_CLUSTER U(2) 1550dae22eSDeepika Bhavnani #define PLAT_CLUSTER_COUNT U(12) 16007a7a33SSumit Garg #define PLATFORM_CORE_COUNT (PLAT_CLUSTER_COUNT * \ 17007a7a33SSumit Garg PLAT_MAX_CORES_PER_CLUSTER) 18007a7a33SSumit Garg 19b67d2029SMasahisa Kojima /* Macros to read the SQ power domain state */ 20b67d2029SMasahisa Kojima #define SQ_PWR_LVL0 MPIDR_AFFLVL0 21b67d2029SMasahisa Kojima #define SQ_PWR_LVL1 MPIDR_AFFLVL1 22b67d2029SMasahisa Kojima #define SQ_PWR_LVL2 MPIDR_AFFLVL2 23b67d2029SMasahisa Kojima 24b67d2029SMasahisa Kojima #define SQ_CORE_PWR_STATE(state) (state)->pwr_domain_state[SQ_PWR_LVL0] 25b67d2029SMasahisa Kojima #define SQ_CLUSTER_PWR_STATE(state) (state)->pwr_domain_state[SQ_PWR_LVL1] 26b67d2029SMasahisa Kojima #define SQ_SYSTEM_PWR_STATE(state) ((PLAT_MAX_PWR_LVL > SQ_PWR_LVL1) ?\ 27b67d2029SMasahisa Kojima (state)->pwr_domain_state[SQ_PWR_LVL2] : 0) 28b67d2029SMasahisa Kojima 291083b2b3SAntonio Nino Diaz #define PLAT_MAX_PWR_LVL U(1) 301083b2b3SAntonio Nino Diaz #define PLAT_MAX_RET_STATE U(1) 311083b2b3SAntonio Nino Diaz #define PLAT_MAX_OFF_STATE U(2) 32753701ccSSumit Garg 33753701ccSSumit Garg #define SQ_LOCAL_STATE_RUN 0 34753701ccSSumit Garg #define SQ_LOCAL_STATE_RET 1 35753701ccSSumit Garg #define SQ_LOCAL_STATE_OFF 2 36753701ccSSumit Garg 37c35d59a3SSumit Garg #define CACHE_WRITEBACK_SHIFT 6 38c35d59a3SSumit Garg #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 39c35d59a3SSumit Garg 408cd37d7bSSumit Garg #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) 418cd37d7bSSumit Garg #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) 42434454a2SArd Biesheuvel #define MAX_XLAT_TABLES 8 43434454a2SArd Biesheuvel #define MAX_MMAP_REGIONS 8 448cd37d7bSSumit Garg 4519aaeea0SJassi Brar #if TRUSTED_BOARD_BOOT 4619aaeea0SJassi Brar #define PLATFORM_STACK_SIZE 0x1000 4719aaeea0SJassi Brar #else 48c35d59a3SSumit Garg #define PLATFORM_STACK_SIZE 0x400 4919aaeea0SJassi Brar #endif 50c35d59a3SSumit Garg 5148ab3904SJassi Brar #if !RESET_TO_BL31 5248ab3904SJassi Brar 5348ab3904SJassi Brar /* A mailbox page will be mapped from BL2 and BL31 */ 5448ab3904SJassi Brar #define BL2_MAILBOX_BASE 0x0403f000 5548ab3904SJassi Brar #define BL2_MAILBOX_SIZE 0x1000 5648ab3904SJassi Brar 57a1938252SJassi Brar #define PLAT_SQ_BOOTIDX_BASE 0x08510000 58a1938252SJassi Brar #define PLAT_SQ_MAX_BOOT_INDEX 2 59a1938252SJassi Brar 6048ab3904SJassi Brar #define MAX_IO_HANDLES 2 6148ab3904SJassi Brar #define MAX_IO_DEVICES 2 6248ab3904SJassi Brar #define MAX_IO_BLOCK_DEVICES U(1) 6348ab3904SJassi Brar 6448ab3904SJassi Brar #define BL2_BASE 0x04000000 6548ab3904SJassi Brar #define BL2_SIZE (256 * 1024) 6648ab3904SJassi Brar #define BL2_LIMIT (BL2_BASE + BL2_SIZE) 6748ab3904SJassi Brar 6848ab3904SJassi Brar /* If BL2 is enabled, the BL31 is loaded on secure DRAM */ 6948ab3904SJassi Brar #define BL31_BASE 0xfbe00000 7048ab3904SJassi Brar #define BL31_SIZE 0x00100000 7148ab3904SJassi Brar #else 7248ab3904SJassi Brar 73c35d59a3SSumit Garg #define BL31_BASE 0x04000000 74c35d59a3SSumit Garg #define BL31_SIZE 0x00080000 7548ab3904SJassi Brar #endif 7648ab3904SJassi Brar 77c35d59a3SSumit Garg #define BL31_LIMIT (BL31_BASE + BL31_SIZE) 78c35d59a3SSumit Garg 79e373b6a2SArd Biesheuvel #define BL32_BASE 0xfc000000 80434454a2SArd Biesheuvel #define BL32_SIZE 0x03c00000 81434454a2SArd Biesheuvel #define BL32_LIMIT (BL32_BASE + BL32_SIZE) 82e373b6a2SArd Biesheuvel 8348ab3904SJassi Brar /* Alternative BL33 */ 8448ab3904SJassi Brar #define PLAT_SQ_BL33_BASE 0xe0000000 85a12a66d0SJassi Brar #define PLAT_SQ_BL33_SIZE 0x00200000 8648ab3904SJassi Brar 87a1938252SJassi Brar /* FWU FIP IO base */ 8848ab3904SJassi Brar #define PLAT_SQ_FIP_IOBASE 0x08600000 8948ab3904SJassi Brar #define PLAT_SQ_FIP_MAXSIZE 0x00400000 9048ab3904SJassi Brar 910eb275c9SSumit Garg #define PLAT_SQ_CCN_BASE 0x32000000 920eb275c9SSumit Garg #define PLAT_SQ_CLUSTER_TO_CCN_ID_MAP \ 930eb275c9SSumit Garg 0, /* Cluster 0 */ \ 940eb275c9SSumit Garg 18, /* Cluster 1 */ \ 950eb275c9SSumit Garg 11, /* Cluster 2 */ \ 960eb275c9SSumit Garg 29, /* Cluster 3 */ \ 970eb275c9SSumit Garg 35, /* Cluster 4 */ \ 980eb275c9SSumit Garg 17, /* Cluster 5 */ \ 990eb275c9SSumit Garg 12, /* Cluster 6 */ \ 1000eb275c9SSumit Garg 30, /* Cluster 7 */ \ 1010eb275c9SSumit Garg 14, /* Cluster 8 */ \ 1020eb275c9SSumit Garg 32, /* Cluster 9 */ \ 1030eb275c9SSumit Garg 15, /* Cluster 10 */ \ 1040eb275c9SSumit Garg 33 /* Cluster 11 */ 1050eb275c9SSumit Garg 10667b40070SSumit Garg /* UART related constants */ 10767b40070SSumit Garg #define PLAT_SQ_BOOT_UART_BASE 0x2A400000 10867b40070SSumit Garg #define PLAT_SQ_BOOT_UART_CLK_IN_HZ 62500000 10967b40070SSumit Garg #define SQ_CONSOLE_BAUDRATE 115200 11067b40070SSumit Garg 1115931fdacSSumit Garg #define SQ_SYS_CNTCTL_BASE 0x2a430000 1125931fdacSSumit Garg 1135931fdacSSumit Garg #define SQ_SYS_TIMCTL_BASE 0x2a810000 1145931fdacSSumit Garg #define PLAT_SQ_NSTIMER_FRAME_ID 0 1154d4911d7SMasahisa Kojima #define SQ_SYS_CNT_BASE_NS 0x2a830000 1165931fdacSSumit Garg 117cfe19f85SArd Biesheuvel #define DRAMINFO_BASE 0x2E00FFC0 118cfe19f85SArd Biesheuvel 11905377100SSumit Garg #define PLAT_SQ_MHU_BASE 0x45000000 12005377100SSumit Garg 121b7ad0444SSumit Garg #define PLAT_SQ_SCP_COM_SHARED_MEM_BASE 0x45400000 122b7ad0444SSumit Garg #define SCPI_CMD_GET_DRAMINFO 0x1 123b7ad0444SSumit Garg 12485427debSSumit Garg #define SQ_BOOT_CFG_ADDR 0x45410000 12585427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_SHIFT 8 12685427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_BIT_WIDTH 6 12785427debSSumit Garg 128b529799fSSumit Garg #define PLAT_SQ_GICD_BASE 0x30000000 129b529799fSSumit Garg #define PLAT_SQ_GICR_BASE 0x30400000 130b529799fSSumit Garg 131753701ccSSumit Garg #define PLAT_SQ_GPIO_BASE 0x51000000 132753701ccSSumit Garg 133434454a2SArd Biesheuvel #define PLAT_SPM_BUF_BASE (BL32_LIMIT - 32 * PLAT_SPM_BUF_SIZE) 134434454a2SArd Biesheuvel #define PLAT_SPM_BUF_SIZE ULL(0x10000) 135434454a2SArd Biesheuvel #define PLAT_SPM_SPM_BUF_EL0_MMAP MAP_REGION2(PLAT_SPM_BUF_BASE, \ 136434454a2SArd Biesheuvel PLAT_SPM_BUF_BASE, \ 137434454a2SArd Biesheuvel PLAT_SPM_BUF_SIZE, \ 138434454a2SArd Biesheuvel MT_RO_DATA | MT_SECURE | \ 139434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 140434454a2SArd Biesheuvel 141434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_BASE BL32_LIMIT 142434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_SIZE ULL(0x200000) 143434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_MMAP MAP_REGION2(PLAT_SP_IMAGE_NS_BUF_BASE, \ 144434454a2SArd Biesheuvel PLAT_SP_IMAGE_NS_BUF_BASE, \ 145434454a2SArd Biesheuvel PLAT_SP_IMAGE_NS_BUF_SIZE, \ 146434454a2SArd Biesheuvel MT_RW_DATA | MT_NS | \ 147434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 148434454a2SArd Biesheuvel 149434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_PCPU_SIZE ULL(0x10000) 150434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_SIZE (32 * PLAT_SP_IMAGE_STACK_PCPU_SIZE) 151434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_BASE (PLAT_SQ_SP_HEAP_BASE + PLAT_SQ_SP_HEAP_SIZE) 152434454a2SArd Biesheuvel 153434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_SIZE ULL(0x200000) 154434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_MMAP MAP_REGION2(BL32_BASE, BL32_BASE, \ 155434454a2SArd Biesheuvel PLAT_SQ_SP_IMAGE_SIZE, \ 156434454a2SArd Biesheuvel MT_CODE | MT_SECURE | \ 157434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 158434454a2SArd Biesheuvel 159434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_BASE (BL32_BASE + PLAT_SQ_SP_IMAGE_SIZE) 160434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_SIZE ULL(0x800000) 161434454a2SArd Biesheuvel 162434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_RW_MMAP MAP_REGION2(PLAT_SQ_SP_HEAP_BASE, \ 163434454a2SArd Biesheuvel PLAT_SQ_SP_HEAP_BASE, \ 164434454a2SArd Biesheuvel (PLAT_SQ_SP_HEAP_SIZE + \ 165434454a2SArd Biesheuvel PLAT_SP_IMAGE_STACK_SIZE), \ 166434454a2SArd Biesheuvel MT_RW_DATA | MT_SECURE | \ 167434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 168434454a2SArd Biesheuvel 169434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_BASE (PLAT_SP_IMAGE_STACK_BASE + \ 170434454a2SArd Biesheuvel PLAT_SP_IMAGE_STACK_SIZE) 171434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_SIZE ULL(0x40000) 172434454a2SArd Biesheuvel 173434454a2SArd Biesheuvel #define PLAT_SP_PRI 0x20 174434454a2SArd Biesheuvel #define PLAT_PRI_BITS 2 175434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_0 ULL(0) 176434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_1 ULL(0) 177434454a2SArd Biesheuvel 178434454a2SArd Biesheuvel /* Total number of memory regions with distinct properties */ 179434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NUM_MEM_REGIONS 6 180434454a2SArd Biesheuvel 181434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MMAP_REGIONS 30 182434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MAX_XLAT_TABLES 20 183*da04341eSChris Kay #define PLAT_SP_IMAGE_XLAT_SECTION_NAME ".sp_xlat_table" 184*da04341eSChris Kay #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME ".sp_xlat_table" 185434454a2SArd Biesheuvel 186434454a2SArd Biesheuvel #define PLAT_SQ_UART1_BASE PLAT_SQ_BOOT_UART_BASE 187434454a2SArd Biesheuvel #define PLAT_SQ_UART1_SIZE ULL(0x1000) 188434454a2SArd Biesheuvel #define PLAT_SQ_UART1_MMAP MAP_REGION_FLAT(PLAT_SQ_UART1_BASE, \ 189434454a2SArd Biesheuvel PLAT_SQ_UART1_SIZE, \ 190434454a2SArd Biesheuvel MT_DEVICE | MT_RW | \ 191434454a2SArd Biesheuvel MT_NS | MT_PRIVILEGED) 192434454a2SArd Biesheuvel 193434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_BASE 0x50000000 194434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_SIZE ULL(0x8000000) 195434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_MMAP MAP_REGION_FLAT(PLAT_SQ_PERIPH_BASE, \ 196434454a2SArd Biesheuvel PLAT_SQ_PERIPH_SIZE, \ 197434454a2SArd Biesheuvel MT_DEVICE | MT_RW | \ 198434454a2SArd Biesheuvel MT_NS | MT_USER) 199434454a2SArd Biesheuvel 200434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_BASE 0x08000000 201434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_SIZE ULL(0x8000000) 202434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_MMAP MAP_REGION_FLAT(PLAT_SQ_FLASH_BASE, \ 203434454a2SArd Biesheuvel PLAT_SQ_FLASH_SIZE, \ 204434454a2SArd Biesheuvel MT_DEVICE | MT_RW | \ 205434454a2SArd Biesheuvel MT_NS | MT_USER) 206434454a2SArd Biesheuvel 2071083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */ 208