1c35d59a3SSumit Garg /* 2f8931606SAditya Angadi * Copyright (c) 2018-2020, 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 45c35d59a3SSumit Garg #define PLATFORM_STACK_SIZE 0x400 46c35d59a3SSumit Garg 47c35d59a3SSumit Garg #define BL31_BASE 0x04000000 48c35d59a3SSumit Garg #define BL31_SIZE 0x00080000 49c35d59a3SSumit Garg #define BL31_LIMIT (BL31_BASE + BL31_SIZE) 50c35d59a3SSumit Garg 51e373b6a2SArd Biesheuvel #define BL32_BASE 0xfc000000 52434454a2SArd Biesheuvel #define BL32_SIZE 0x03c00000 53434454a2SArd Biesheuvel #define BL32_LIMIT (BL32_BASE + BL32_SIZE) 54e373b6a2SArd Biesheuvel 550eb275c9SSumit Garg #define PLAT_SQ_CCN_BASE 0x32000000 560eb275c9SSumit Garg #define PLAT_SQ_CLUSTER_TO_CCN_ID_MAP \ 570eb275c9SSumit Garg 0, /* Cluster 0 */ \ 580eb275c9SSumit Garg 18, /* Cluster 1 */ \ 590eb275c9SSumit Garg 11, /* Cluster 2 */ \ 600eb275c9SSumit Garg 29, /* Cluster 3 */ \ 610eb275c9SSumit Garg 35, /* Cluster 4 */ \ 620eb275c9SSumit Garg 17, /* Cluster 5 */ \ 630eb275c9SSumit Garg 12, /* Cluster 6 */ \ 640eb275c9SSumit Garg 30, /* Cluster 7 */ \ 650eb275c9SSumit Garg 14, /* Cluster 8 */ \ 660eb275c9SSumit Garg 32, /* Cluster 9 */ \ 670eb275c9SSumit Garg 15, /* Cluster 10 */ \ 680eb275c9SSumit Garg 33 /* Cluster 11 */ 690eb275c9SSumit Garg 7067b40070SSumit Garg /* UART related constants */ 7167b40070SSumit Garg #define PLAT_SQ_BOOT_UART_BASE 0x2A400000 7267b40070SSumit Garg #define PLAT_SQ_BOOT_UART_CLK_IN_HZ 62500000 7367b40070SSumit Garg #define SQ_CONSOLE_BAUDRATE 115200 7467b40070SSumit Garg 755931fdacSSumit Garg #define SQ_SYS_CNTCTL_BASE 0x2a430000 765931fdacSSumit Garg 775931fdacSSumit Garg #define SQ_SYS_TIMCTL_BASE 0x2a810000 785931fdacSSumit Garg #define PLAT_SQ_NSTIMER_FRAME_ID 0 79*4d4911d7SMasahisa Kojima #define SQ_SYS_CNT_BASE_NS 0x2a830000 805931fdacSSumit Garg 81cfe19f85SArd Biesheuvel #define DRAMINFO_BASE 0x2E00FFC0 82cfe19f85SArd Biesheuvel 8305377100SSumit Garg #define PLAT_SQ_MHU_BASE 0x45000000 8405377100SSumit Garg 85b7ad0444SSumit Garg #define PLAT_SQ_SCP_COM_SHARED_MEM_BASE 0x45400000 86b7ad0444SSumit Garg #define SCPI_CMD_GET_DRAMINFO 0x1 87b7ad0444SSumit Garg 8885427debSSumit Garg #define SQ_BOOT_CFG_ADDR 0x45410000 8985427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_SHIFT 8 9085427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_BIT_WIDTH 6 9185427debSSumit Garg 92b529799fSSumit Garg #define PLAT_SQ_GICD_BASE 0x30000000 93b529799fSSumit Garg #define PLAT_SQ_GICR_BASE 0x30400000 94b529799fSSumit Garg 95753701ccSSumit Garg #define PLAT_SQ_GPIO_BASE 0x51000000 96753701ccSSumit Garg 97434454a2SArd Biesheuvel #define PLAT_SPM_BUF_BASE (BL32_LIMIT - 32 * PLAT_SPM_BUF_SIZE) 98434454a2SArd Biesheuvel #define PLAT_SPM_BUF_SIZE ULL(0x10000) 99434454a2SArd Biesheuvel #define PLAT_SPM_SPM_BUF_EL0_MMAP MAP_REGION2(PLAT_SPM_BUF_BASE, \ 100434454a2SArd Biesheuvel PLAT_SPM_BUF_BASE, \ 101434454a2SArd Biesheuvel PLAT_SPM_BUF_SIZE, \ 102434454a2SArd Biesheuvel MT_RO_DATA | MT_SECURE | \ 103434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 104434454a2SArd Biesheuvel 105434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_BASE BL32_LIMIT 106434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_SIZE ULL(0x200000) 107434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_MMAP MAP_REGION2(PLAT_SP_IMAGE_NS_BUF_BASE, \ 108434454a2SArd Biesheuvel PLAT_SP_IMAGE_NS_BUF_BASE, \ 109434454a2SArd Biesheuvel PLAT_SP_IMAGE_NS_BUF_SIZE, \ 110434454a2SArd Biesheuvel MT_RW_DATA | MT_NS | \ 111434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 112434454a2SArd Biesheuvel 113434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_PCPU_SIZE ULL(0x10000) 114434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_SIZE (32 * PLAT_SP_IMAGE_STACK_PCPU_SIZE) 115434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_BASE (PLAT_SQ_SP_HEAP_BASE + PLAT_SQ_SP_HEAP_SIZE) 116434454a2SArd Biesheuvel 117434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_SIZE ULL(0x200000) 118434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_MMAP MAP_REGION2(BL32_BASE, BL32_BASE, \ 119434454a2SArd Biesheuvel PLAT_SQ_SP_IMAGE_SIZE, \ 120434454a2SArd Biesheuvel MT_CODE | MT_SECURE | \ 121434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 122434454a2SArd Biesheuvel 123434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_BASE (BL32_BASE + PLAT_SQ_SP_IMAGE_SIZE) 124434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_SIZE ULL(0x800000) 125434454a2SArd Biesheuvel 126434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_RW_MMAP MAP_REGION2(PLAT_SQ_SP_HEAP_BASE, \ 127434454a2SArd Biesheuvel PLAT_SQ_SP_HEAP_BASE, \ 128434454a2SArd Biesheuvel (PLAT_SQ_SP_HEAP_SIZE + \ 129434454a2SArd Biesheuvel PLAT_SP_IMAGE_STACK_SIZE), \ 130434454a2SArd Biesheuvel MT_RW_DATA | MT_SECURE | \ 131434454a2SArd Biesheuvel MT_USER, PAGE_SIZE) 132434454a2SArd Biesheuvel 133434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_BASE (PLAT_SP_IMAGE_STACK_BASE + \ 134434454a2SArd Biesheuvel PLAT_SP_IMAGE_STACK_SIZE) 135434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_SIZE ULL(0x40000) 136434454a2SArd Biesheuvel 137434454a2SArd Biesheuvel #define PLAT_SP_PRI 0x20 138434454a2SArd Biesheuvel #define PLAT_PRI_BITS 2 139434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_0 ULL(0) 140434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_1 ULL(0) 141434454a2SArd Biesheuvel 142434454a2SArd Biesheuvel /* Total number of memory regions with distinct properties */ 143434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NUM_MEM_REGIONS 6 144434454a2SArd Biesheuvel 145434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MMAP_REGIONS 30 146434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MAX_XLAT_TABLES 20 147434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_XLAT_SECTION_NAME "sp_xlat_table" 1480922e481SMasahisa Kojima #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME "sp_xlat_table" 149434454a2SArd Biesheuvel 150434454a2SArd Biesheuvel #define PLAT_SQ_UART1_BASE PLAT_SQ_BOOT_UART_BASE 151434454a2SArd Biesheuvel #define PLAT_SQ_UART1_SIZE ULL(0x1000) 152434454a2SArd Biesheuvel #define PLAT_SQ_UART1_MMAP MAP_REGION_FLAT(PLAT_SQ_UART1_BASE, \ 153434454a2SArd Biesheuvel PLAT_SQ_UART1_SIZE, \ 154434454a2SArd Biesheuvel MT_DEVICE | MT_RW | \ 155434454a2SArd Biesheuvel MT_NS | MT_PRIVILEGED) 156434454a2SArd Biesheuvel 157434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_BASE 0x50000000 158434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_SIZE ULL(0x8000000) 159434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_MMAP MAP_REGION_FLAT(PLAT_SQ_PERIPH_BASE, \ 160434454a2SArd Biesheuvel PLAT_SQ_PERIPH_SIZE, \ 161434454a2SArd Biesheuvel MT_DEVICE | MT_RW | \ 162434454a2SArd Biesheuvel MT_NS | MT_USER) 163434454a2SArd Biesheuvel 164434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_BASE 0x08000000 165434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_SIZE ULL(0x8000000) 166434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_MMAP MAP_REGION_FLAT(PLAT_SQ_FLASH_BASE, \ 167434454a2SArd Biesheuvel PLAT_SQ_FLASH_SIZE, \ 168434454a2SArd Biesheuvel MT_DEVICE | MT_RW | \ 169434454a2SArd Biesheuvel MT_NS | MT_USER) 170434454a2SArd Biesheuvel 1711083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */ 172