17d116dccSCC Ma /* 27d116dccSCC Ma * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved. 37d116dccSCC Ma * 47d116dccSCC Ma * Redistribution and use in source and binary forms, with or without 57d116dccSCC Ma * modification, are permitted provided that the following conditions are met: 67d116dccSCC Ma * 77d116dccSCC Ma * Redistributions of source code must retain the above copyright notice, this 87d116dccSCC Ma * list of conditions and the following disclaimer. 97d116dccSCC Ma * 107d116dccSCC Ma * Redistributions in binary form must reproduce the above copyright notice, 117d116dccSCC Ma * this list of conditions and the following disclaimer in the documentation 127d116dccSCC Ma * and/or other materials provided with the distribution. 137d116dccSCC Ma * 147d116dccSCC Ma * Neither the name of ARM nor the names of its contributors may be used 157d116dccSCC Ma * to endorse or promote products derived from this software without specific 167d116dccSCC Ma * prior written permission. 177d116dccSCC Ma * 187d116dccSCC Ma * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 197d116dccSCC Ma * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 207d116dccSCC Ma * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 217d116dccSCC Ma * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 227d116dccSCC Ma * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 237d116dccSCC Ma * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 247d116dccSCC Ma * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 257d116dccSCC Ma * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 267d116dccSCC Ma * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 277d116dccSCC Ma * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 287d116dccSCC Ma * POSSIBILITY OF SUCH DAMAGE. 297d116dccSCC Ma */ 307d116dccSCC Ma 317d116dccSCC Ma #ifndef __PLATFORM_DEF_H__ 327d116dccSCC Ma #define __PLATFORM_DEF_H__ 337d116dccSCC Ma 348bc20038SKoan-Sin Tan #include "mt8173_def.h" 358bc20038SKoan-Sin Tan 367d116dccSCC Ma 377d116dccSCC Ma /******************************************************************************* 387d116dccSCC Ma * Platform binary types for linking 397d116dccSCC Ma ******************************************************************************/ 407d116dccSCC Ma #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" 417d116dccSCC Ma #define PLATFORM_LINKER_ARCH aarch64 427d116dccSCC Ma 437d116dccSCC Ma /******************************************************************************* 447d116dccSCC Ma * Generic platform constants 457d116dccSCC Ma ******************************************************************************/ 467d116dccSCC Ma 477d116dccSCC Ma /* Size of cacheable stacks */ 483d8256b2SMasahiro Yamada #if defined(IMAGE_BL1) 497d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x440 503d8256b2SMasahiro Yamada #elif defined(IMAGE_BL2) 517d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x400 523d8256b2SMasahiro Yamada #elif defined(IMAGE_BL31) 537d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x800 543d8256b2SMasahiro Yamada #elif defined(IMAGE_BL32) 557d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x440 567d116dccSCC Ma #endif 577d116dccSCC Ma 587d116dccSCC Ma #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" 597d116dccSCC Ma 607d116dccSCC Ma #define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2 613fc26aa0SKoan-Sin Tan #if !ENABLE_PLAT_COMPAT 623fc26aa0SKoan-Sin Tan #define PLAT_MAX_PWR_LVL 2 633fc26aa0SKoan-Sin Tan #define PLAT_MAX_RET_STATE 1 643fc26aa0SKoan-Sin Tan #define PLAT_MAX_OFF_STATE 2 653fc26aa0SKoan-Sin Tan #endif 667d116dccSCC Ma #define PLATFORM_SYSTEM_COUNT 1 677d116dccSCC Ma #define PLATFORM_CLUSTER_COUNT 2 687d116dccSCC Ma #define PLATFORM_CLUSTER0_CORE_COUNT 4 697d116dccSCC Ma #define PLATFORM_CLUSTER1_CORE_COUNT 2 707d116dccSCC Ma #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \ 717d116dccSCC Ma PLATFORM_CLUSTER0_CORE_COUNT) 727d116dccSCC Ma #define PLATFORM_MAX_CPUS_PER_CLUSTER 4 737d116dccSCC Ma #define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \ 747d116dccSCC Ma PLATFORM_CLUSTER_COUNT + \ 757d116dccSCC Ma PLATFORM_CORE_COUNT) 767d116dccSCC Ma 777d116dccSCC Ma /******************************************************************************* 787d116dccSCC Ma * Platform memory map related constants 797d116dccSCC Ma ******************************************************************************/ 80e2a65959SJimmy Huang /* 81e2a65959SJimmy Huang * MT8173 SRAM memory layout 82e2a65959SJimmy Huang * 0x100000 +-------------------+ 83e2a65959SJimmy Huang * | shared mem (4KB) | 84e2a65959SJimmy Huang * 0x101000 +-------------------+ 85e2a65959SJimmy Huang * | | 86e2a65959SJimmy Huang * | BL3-1 (124KB) | 87e2a65959SJimmy Huang * | | 88e2a65959SJimmy Huang * 0x120000 +-------------------+ 89e2a65959SJimmy Huang * | reserved (64KB) | 90e2a65959SJimmy Huang * 0x130000 +-------------------+ 91e2a65959SJimmy Huang */ 92e2a65959SJimmy Huang /* TF txet, ro, rw, xlat table, coherent memory ... etc. 93e2a65959SJimmy Huang * Size: release: 128KB, debug: 128KB 94e2a65959SJimmy Huang */ 957d116dccSCC Ma #define TZRAM_BASE (0x100000) 967d116dccSCC Ma #if DEBUG 977d116dccSCC Ma #define TZRAM_SIZE (0x20000) 987d116dccSCC Ma #else 997d116dccSCC Ma #define TZRAM_SIZE (0x20000) 1007d116dccSCC Ma #endif 1017d116dccSCC Ma 102e2a65959SJimmy Huang /* Reserved: 64KB */ 1037d116dccSCC Ma #define TZRAM2_BASE (TZRAM_BASE + TZRAM_SIZE) 1047d116dccSCC Ma #define TZRAM2_SIZE (0x10000) 1057d116dccSCC Ma 1067d116dccSCC Ma /******************************************************************************* 1077d116dccSCC Ma * BL31 specific defines. 1087d116dccSCC Ma ******************************************************************************/ 1097d116dccSCC Ma /* 1107d116dccSCC Ma * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if 1117d116dccSCC Ma * present). BL31_BASE is calculated using the current BL3-1 debug size plus a 1127d116dccSCC Ma * little space for growth. 1137d116dccSCC Ma */ 1147d116dccSCC Ma #define BL31_BASE (TZRAM_BASE + 0x1000) 1157d116dccSCC Ma #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE) 1167d116dccSCC Ma #define TZRAM2_LIMIT (TZRAM2_BASE + TZRAM2_SIZE) 1177d116dccSCC Ma 1187d116dccSCC Ma /******************************************************************************* 1197d116dccSCC Ma * Platform specific page table and MMU setup constants 1207d116dccSCC Ma ******************************************************************************/ 121*201d535fSKoan-Sin Tan #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32) 122*201d535fSKoan-Sin Tan #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32) 1237d116dccSCC Ma #define MAX_XLAT_TABLES 4 1247d116dccSCC Ma #define MAX_MMAP_REGIONS 16 1257d116dccSCC Ma 1267d116dccSCC Ma /******************************************************************************* 1277d116dccSCC Ma * Declarations and constants to access the mailboxes safely. Each mailbox is 1287d116dccSCC Ma * aligned on the biggest cache line size in the platform. This is known only 1297d116dccSCC Ma * to the platform as it might have a combination of integrated and external 1307d116dccSCC Ma * caches. Such alignment ensures that two maiboxes do not sit on the same cache 1317d116dccSCC Ma * line at any cache level. They could belong to different cpus/clusters & 1327d116dccSCC Ma * get written while being protected by different locks causing corruption of 1337d116dccSCC Ma * a valid mailbox address. 1347d116dccSCC Ma ******************************************************************************/ 1357d116dccSCC Ma #define CACHE_WRITEBACK_SHIFT 6 1367d116dccSCC Ma #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 1377d116dccSCC Ma 1388bc20038SKoan-Sin Tan 1398bc20038SKoan-Sin Tan #define PLAT_ARM_GICD_BASE BASE_GICD_BASE 1408bc20038SKoan-Sin Tan #define PLAT_ARM_GICC_BASE BASE_GICC_BASE 1418bc20038SKoan-Sin Tan 1428bc20038SKoan-Sin Tan #define PLAT_ARM_G1S_IRQS MT_IRQ_SEC_SGI_0, \ 1438bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_1, \ 1448bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_2, \ 1458bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_3, \ 1468bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_4, \ 1478bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_5, \ 1488bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_6, \ 1498bc20038SKoan-Sin Tan MT_IRQ_SEC_SGI_7 1508bc20038SKoan-Sin Tan 1518bc20038SKoan-Sin Tan #define PLAT_ARM_G0_IRQS 1528bc20038SKoan-Sin Tan 1537d116dccSCC Ma #endif /* __PLATFORM_DEF_H__ */ 154