11841c533SNishanth Menon /* 21841c533SNishanth Menon * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. 31841c533SNishanth Menon * 41841c533SNishanth Menon * SPDX-License-Identifier: BSD-3-Clause 51841c533SNishanth Menon */ 61841c533SNishanth Menon 71841c533SNishanth Menon #ifndef __PLATFORM_DEF_H__ 81841c533SNishanth Menon #define __PLATFORM_DEF_H__ 91841c533SNishanth Menon 101841c533SNishanth Menon #include <arch.h> 111841c533SNishanth Menon #include <board_def.h> 121841c533SNishanth Menon #include <common_def.h> 131841c533SNishanth Menon 141841c533SNishanth Menon /******************************************************************************* 151841c533SNishanth Menon * Generic platform constants 161841c533SNishanth Menon ******************************************************************************/ 171841c533SNishanth Menon 181841c533SNishanth Menon /* Size of cacheable stack */ 191841c533SNishanth Menon #if IMAGE_BL31 201841c533SNishanth Menon #define PLATFORM_STACK_SIZE 0x800 211841c533SNishanth Menon #else 221841c533SNishanth Menon #define PLATFORM_STACK_SIZE 0x1000 231841c533SNishanth Menon #endif 241841c533SNishanth Menon 2589574715SBenjamin Fair #define PLATFORM_SYSTEM_COUNT 1 2689574715SBenjamin Fair #define PLATFORM_CORE_COUNT (K3_CLUSTER0_CORE_COUNT + \ 2789574715SBenjamin Fair K3_CLUSTER1_CORE_COUNT + \ 2889574715SBenjamin Fair K3_CLUSTER2_CORE_COUNT + \ 2989574715SBenjamin Fair K3_CLUSTER3_CORE_COUNT) 3089574715SBenjamin Fair 3189574715SBenjamin Fair #define PLATFORM_CLUSTER_COUNT ((K3_CLUSTER0_MSMC_PORT != UNUSED) + \ 3289574715SBenjamin Fair (K3_CLUSTER1_MSMC_PORT != UNUSED) + \ 3389574715SBenjamin Fair (K3_CLUSTER2_MSMC_PORT != UNUSED) + \ 3489574715SBenjamin Fair (K3_CLUSTER3_MSMC_PORT != UNUSED)) 3589574715SBenjamin Fair 3689574715SBenjamin Fair #define UNUSED -1 3789574715SBenjamin Fair 3889574715SBenjamin Fair #if !defined(K3_CLUSTER1_CORE_COUNT) || !defined(K3_CLUSTER1_MSMC_PORT) 3989574715SBenjamin Fair #define K3_CLUSTER1_CORE_COUNT 0 4089574715SBenjamin Fair #define K3_CLUSTER1_MSMC_PORT UNUSED 4189574715SBenjamin Fair #endif 4289574715SBenjamin Fair 4389574715SBenjamin Fair #if !defined(K3_CLUSTER2_CORE_COUNT) || !defined(K3_CLUSTER2_MSMC_PORT) 4489574715SBenjamin Fair #define K3_CLUSTER2_CORE_COUNT 0 4589574715SBenjamin Fair #define K3_CLUSTER2_MSMC_PORT UNUSED 4689574715SBenjamin Fair #endif 4789574715SBenjamin Fair 4889574715SBenjamin Fair #if !defined(K3_CLUSTER3_CORE_COUNT) || !defined(K3_CLUSTER3_MSMC_PORT) 4989574715SBenjamin Fair #define K3_CLUSTER3_CORE_COUNT 0 5089574715SBenjamin Fair #define K3_CLUSTER3_MSMC_PORT UNUSED 5189574715SBenjamin Fair #endif 5289574715SBenjamin Fair 5389574715SBenjamin Fair #if K3_CLUSTER0_MSMC_PORT == UNUSED 5489574715SBenjamin Fair #error "ARM cluster 0 must be used" 5589574715SBenjamin Fair #endif 5689574715SBenjamin Fair 5789574715SBenjamin Fair #if ((K3_CLUSTER1_MSMC_PORT == UNUSED) && (K3_CLUSTER1_CORE_COUNT != 0)) || \ 5889574715SBenjamin Fair ((K3_CLUSTER2_MSMC_PORT == UNUSED) && (K3_CLUSTER2_CORE_COUNT != 0)) || \ 5989574715SBenjamin Fair ((K3_CLUSTER3_MSMC_PORT == UNUSED) && (K3_CLUSTER3_CORE_COUNT != 0)) 6089574715SBenjamin Fair #error "Unused ports must have 0 ARM cores" 6189574715SBenjamin Fair #endif 6289574715SBenjamin Fair 6389574715SBenjamin Fair #define PLATFORM_CLUSTER_OFFSET K3_CLUSTER0_MSMC_PORT 6489574715SBenjamin Fair 651841c533SNishanth Menon #define PLAT_NUM_PWR_DOMAINS (PLATFORM_CLUSTER_COUNT + \ 661841c533SNishanth Menon PLATFORM_CORE_COUNT) 671841c533SNishanth Menon #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1 681841c533SNishanth Menon 691841c533SNishanth Menon /******************************************************************************* 701841c533SNishanth Menon * Memory layout constants 711841c533SNishanth Menon ******************************************************************************/ 721841c533SNishanth Menon 731841c533SNishanth Menon /* 741841c533SNishanth Menon * ARM-TF lives in SRAM, partition it here 751841c533SNishanth Menon */ 761841c533SNishanth Menon 771841c533SNishanth Menon #define SHARED_RAM_BASE BL31_LIMIT 781841c533SNishanth Menon #define SHARED_RAM_SIZE 0x00001000 791841c533SNishanth Menon 801841c533SNishanth Menon /* 811841c533SNishanth Menon * BL3-1 specific defines. 821841c533SNishanth Menon * 831841c533SNishanth Menon * Put BL3-1 at the base of the Trusted SRAM, before SHARED_RAM. 841841c533SNishanth Menon */ 851841c533SNishanth Menon #define BL31_BASE SEC_SRAM_BASE 861841c533SNishanth Menon #define BL31_SIZE (SEC_SRAM_SIZE - SHARED_RAM_SIZE) 871841c533SNishanth Menon #define BL31_LIMIT (BL31_BASE + BL31_SIZE) 881841c533SNishanth Menon #define BL31_PROGBITS_LIMIT BL31_LIMIT 891841c533SNishanth Menon 901841c533SNishanth Menon /* 91*e67bfcf3SNishanth Menon * Defines the maximum number of translation tables that are allocated by the 92*e67bfcf3SNishanth Menon * translation table library code. To minimize the amount of runtime memory 93*e67bfcf3SNishanth Menon * used, choose the smallest value needed to map the required virtual addresses 94*e67bfcf3SNishanth Menon * for each BL stage. 95*e67bfcf3SNishanth Menon */ 96*e67bfcf3SNishanth Menon #define MAX_XLAT_TABLES 8 97*e67bfcf3SNishanth Menon 98*e67bfcf3SNishanth Menon /* 99*e67bfcf3SNishanth Menon * Defines the maximum number of regions that are allocated by the translation 100*e67bfcf3SNishanth Menon * table library code. A region consists of physical base address, virtual base 101*e67bfcf3SNishanth Menon * address, size and attributes (Device/Memory, RO/RW, Secure/Non-Secure), as 102*e67bfcf3SNishanth Menon * defined in the `mmap_region_t` structure. The platform defines the regions 103*e67bfcf3SNishanth Menon * that should be mapped. Then, the translation table library will create the 104*e67bfcf3SNishanth Menon * corresponding tables and descriptors at runtime. To minimize the amount of 105*e67bfcf3SNishanth Menon * runtime memory used, choose the smallest value needed to register the 106*e67bfcf3SNishanth Menon * required regions for each BL stage. 107*e67bfcf3SNishanth Menon */ 108*e67bfcf3SNishanth Menon #define MAX_MMAP_REGIONS 8 109*e67bfcf3SNishanth Menon 110*e67bfcf3SNishanth Menon /* 111*e67bfcf3SNishanth Menon * Defines the total size of the address space in bytes. For example, for a 32 112*e67bfcf3SNishanth Menon * bit address space, this value should be `(1ull << 32)`. 113*e67bfcf3SNishanth Menon */ 114*e67bfcf3SNishanth Menon #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32) 115*e67bfcf3SNishanth Menon #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32) 116*e67bfcf3SNishanth Menon 117*e67bfcf3SNishanth Menon /* 1181841c533SNishanth Menon * Some data must be aligned on the biggest cache line size in the platform. 1191841c533SNishanth Menon * This is known only to the platform as it might have a combination of 1201841c533SNishanth Menon * integrated and external caches. 1211841c533SNishanth Menon */ 1221841c533SNishanth Menon #define CACHE_WRITEBACK_SHIFT 6 1231841c533SNishanth Menon #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 1241841c533SNishanth Menon 1251841c533SNishanth Menon #endif /* __PLATFORM_DEF_H__ */ 126