xref: /rk3399_ARM-atf/plat/mediatek/mt8173/include/platform_def.h (revision 3d8256b2a1ef1195aed86bef7378e83d0a61a91b)
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 
347d116dccSCC Ma 
357d116dccSCC Ma /*******************************************************************************
367d116dccSCC Ma  * Platform binary types for linking
377d116dccSCC Ma  ******************************************************************************/
387d116dccSCC Ma #define PLATFORM_LINKER_FORMAT		"elf64-littleaarch64"
397d116dccSCC Ma #define PLATFORM_LINKER_ARCH		aarch64
407d116dccSCC Ma 
417d116dccSCC Ma /*******************************************************************************
427d116dccSCC Ma  * Generic platform constants
437d116dccSCC Ma  ******************************************************************************/
447d116dccSCC Ma 
457d116dccSCC Ma /* Size of cacheable stacks */
46*3d8256b2SMasahiro Yamada #if defined(IMAGE_BL1)
477d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x440
48*3d8256b2SMasahiro Yamada #elif defined(IMAGE_BL2)
497d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x400
50*3d8256b2SMasahiro Yamada #elif defined(IMAGE_BL31)
517d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x800
52*3d8256b2SMasahiro Yamada #elif defined(IMAGE_BL32)
537d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x440
547d116dccSCC Ma #endif
557d116dccSCC Ma 
567d116dccSCC Ma #define FIRMWARE_WELCOME_STR		"Booting Trusted Firmware\n"
577d116dccSCC Ma 
587d116dccSCC Ma #define PLATFORM_MAX_AFFLVL		MPIDR_AFFLVL2
597d116dccSCC Ma #define PLATFORM_SYSTEM_COUNT		1
607d116dccSCC Ma #define PLATFORM_CLUSTER_COUNT		2
617d116dccSCC Ma #define PLATFORM_CLUSTER0_CORE_COUNT	4
627d116dccSCC Ma #define PLATFORM_CLUSTER1_CORE_COUNT	2
637d116dccSCC Ma #define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER1_CORE_COUNT +	\
647d116dccSCC Ma 					 PLATFORM_CLUSTER0_CORE_COUNT)
657d116dccSCC Ma #define PLATFORM_MAX_CPUS_PER_CLUSTER	4
667d116dccSCC Ma #define PLATFORM_NUM_AFFS		(PLATFORM_SYSTEM_COUNT +	\
677d116dccSCC Ma 					 PLATFORM_CLUSTER_COUNT +	\
687d116dccSCC Ma 					 PLATFORM_CORE_COUNT)
697d116dccSCC Ma 
707d116dccSCC Ma /*******************************************************************************
717d116dccSCC Ma  * Platform memory map related constants
727d116dccSCC Ma  ******************************************************************************/
73e2a65959SJimmy Huang /*
74e2a65959SJimmy Huang  * MT8173 SRAM memory layout
75e2a65959SJimmy Huang  * 0x100000 +-------------------+
76e2a65959SJimmy Huang  *          | shared mem (4KB)  |
77e2a65959SJimmy Huang  * 0x101000 +-------------------+
78e2a65959SJimmy Huang  *          |                   |
79e2a65959SJimmy Huang  *          |   BL3-1 (124KB)   |
80e2a65959SJimmy Huang  *          |                   |
81e2a65959SJimmy Huang  * 0x120000 +-------------------+
82e2a65959SJimmy Huang  *          |  reserved (64KB)  |
83e2a65959SJimmy Huang  * 0x130000 +-------------------+
84e2a65959SJimmy Huang  */
85e2a65959SJimmy Huang /* TF txet, ro, rw, xlat table, coherent memory ... etc.
86e2a65959SJimmy Huang  * Size: release: 128KB, debug: 128KB
87e2a65959SJimmy Huang  */
887d116dccSCC Ma #define TZRAM_BASE		(0x100000)
897d116dccSCC Ma #if DEBUG
907d116dccSCC Ma #define TZRAM_SIZE		(0x20000)
917d116dccSCC Ma #else
927d116dccSCC Ma #define TZRAM_SIZE		(0x20000)
937d116dccSCC Ma #endif
947d116dccSCC Ma 
95e2a65959SJimmy Huang /* Reserved: 64KB */
967d116dccSCC Ma #define TZRAM2_BASE		(TZRAM_BASE + TZRAM_SIZE)
977d116dccSCC Ma #define TZRAM2_SIZE		(0x10000)
987d116dccSCC Ma 
997d116dccSCC Ma /*******************************************************************************
1007d116dccSCC Ma  * BL31 specific defines.
1017d116dccSCC Ma  ******************************************************************************/
1027d116dccSCC Ma /*
1037d116dccSCC Ma  * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
1047d116dccSCC Ma  * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
1057d116dccSCC Ma  * little space for growth.
1067d116dccSCC Ma  */
1077d116dccSCC Ma #define BL31_BASE		(TZRAM_BASE + 0x1000)
1087d116dccSCC Ma #define BL31_LIMIT		(TZRAM_BASE + TZRAM_SIZE)
1097d116dccSCC Ma #define TZRAM2_LIMIT		(TZRAM2_BASE + TZRAM2_SIZE)
1107d116dccSCC Ma 
1117d116dccSCC Ma /*******************************************************************************
1127d116dccSCC Ma  * Platform specific page table and MMU setup constants
1137d116dccSCC Ma  ******************************************************************************/
1147d116dccSCC Ma #define ADDR_SPACE_SIZE		(1ull << 32)
1157d116dccSCC Ma #define MAX_XLAT_TABLES		4
1167d116dccSCC Ma #define MAX_MMAP_REGIONS	16
1177d116dccSCC Ma 
1187d116dccSCC Ma /*******************************************************************************
1197d116dccSCC Ma  * Declarations and constants to access the mailboxes safely. Each mailbox is
1207d116dccSCC Ma  * aligned on the biggest cache line size in the platform. This is known only
1217d116dccSCC Ma  * to the platform as it might have a combination of integrated and external
1227d116dccSCC Ma  * caches. Such alignment ensures that two maiboxes do not sit on the same cache
1237d116dccSCC Ma  * line at any cache level. They could belong to different cpus/clusters &
1247d116dccSCC Ma  * get written while being protected by different locks causing corruption of
1257d116dccSCC Ma  * a valid mailbox address.
1267d116dccSCC Ma  ******************************************************************************/
1277d116dccSCC Ma #define CACHE_WRITEBACK_SHIFT	6
1287d116dccSCC Ma #define CACHE_WRITEBACK_GRANULE	(1 << CACHE_WRITEBACK_SHIFT)
1297d116dccSCC Ma 
1307d116dccSCC Ma #endif /* __PLATFORM_DEF_H__ */
131