xref: /rk3399_ARM-atf/plat/mediatek/mt8173/include/platform_def.h (revision d30ac1c36f79588e7384cc56c69f885147a4286f)
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*d30ac1c3SSoby Mathew #if IMAGE_BL1
477d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x440
487d116dccSCC Ma #elif IMAGE_BL2
497d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x400
507d116dccSCC Ma #elif IMAGE_BL31
517d116dccSCC Ma #define PLATFORM_STACK_SIZE 0x800
527d116dccSCC Ma #elif 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  ******************************************************************************/
737d116dccSCC Ma /* TF txet, ro, rw, internal SRAM, Size: release: 80KB, debug: 92KB */
747d116dccSCC Ma #define TZRAM_BASE		(0x100000)
757d116dccSCC Ma #if DEBUG
767d116dccSCC Ma #define TZRAM_SIZE		(0x20000)
777d116dccSCC Ma #else
787d116dccSCC Ma #define TZRAM_SIZE		(0x20000)
797d116dccSCC Ma #endif
807d116dccSCC Ma 
817d116dccSCC Ma /* xlat_table , coherence ram, 64KB */
827d116dccSCC Ma #define TZRAM2_BASE		(TZRAM_BASE + TZRAM_SIZE)
837d116dccSCC Ma #define TZRAM2_SIZE		(0x10000)
847d116dccSCC Ma 
857d116dccSCC Ma /*******************************************************************************
867d116dccSCC Ma  * BL31 specific defines.
877d116dccSCC Ma  ******************************************************************************/
887d116dccSCC Ma /*
897d116dccSCC Ma  * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
907d116dccSCC Ma  * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
917d116dccSCC Ma  * little space for growth.
927d116dccSCC Ma  */
937d116dccSCC Ma #define BL31_BASE		(TZRAM_BASE + 0x1000)
947d116dccSCC Ma #define BL31_LIMIT		(TZRAM_BASE + TZRAM_SIZE)
957d116dccSCC Ma #define TZRAM2_LIMIT		(TZRAM2_BASE + TZRAM2_SIZE)
967d116dccSCC Ma 
977d116dccSCC Ma /*******************************************************************************
987d116dccSCC Ma  * Platform specific page table and MMU setup constants
997d116dccSCC Ma  ******************************************************************************/
1007d116dccSCC Ma #define ADDR_SPACE_SIZE		(1ull << 32)
1017d116dccSCC Ma #define MAX_XLAT_TABLES		4
1027d116dccSCC Ma #define MAX_MMAP_REGIONS	16
1037d116dccSCC Ma 
1047d116dccSCC Ma /*******************************************************************************
1057d116dccSCC Ma  * Declarations and constants to access the mailboxes safely. Each mailbox is
1067d116dccSCC Ma  * aligned on the biggest cache line size in the platform. This is known only
1077d116dccSCC Ma  * to the platform as it might have a combination of integrated and external
1087d116dccSCC Ma  * caches. Such alignment ensures that two maiboxes do not sit on the same cache
1097d116dccSCC Ma  * line at any cache level. They could belong to different cpus/clusters &
1107d116dccSCC Ma  * get written while being protected by different locks causing corruption of
1117d116dccSCC Ma  * a valid mailbox address.
1127d116dccSCC Ma  ******************************************************************************/
1137d116dccSCC Ma #define CACHE_WRITEBACK_SHIFT	6
1147d116dccSCC Ma #define CACHE_WRITEBACK_GRANULE	(1 << CACHE_WRITEBACK_SHIFT)
1157d116dccSCC Ma 
1167d116dccSCC Ma #endif /* __PLATFORM_DEF_H__ */
117