blob: 0e1cae6064703cda58f97cf7b2ab93c27b9d618d [file] [log] [blame]
Jiafei Pan46367ad2018-03-02 07:23:30 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __PLATFORM_DEF_H__
8#define __PLATFORM_DEF_H__
9
10#include <common_def.h>
11#include <tzc400.h>
12#include <utils.h>
13#include "ls_def.h"
14
15#define FIRMWARE_WELCOME_STR_LS1043 "Welcome to LS1043 BL1 Phase\n"
16#define FIRMWARE_WELCOME_STR_LS1043_BL2 "Welcome to LS1043 BL2 Phase\n"
17#define FIRMWARE_WELCOME_STR_LS1043_BL31 "Welcome to LS1043 BL31 Phase\n"
18#define FIRMWARE_WELCOME_STR_LS1043_BL32 "Welcome to LS1043 BL32 Phase, TSP\n"
19
20/* Required platform porting definitions */
21#define PLAT_PRIMARY_CPU 0x0
22#define PLAT_MAX_PWR_LVL LS_PWR_LVL1
23#define PLATFORM_CORE_COUNT 4
24#define COUNTER_FREQUENCY 25000000 /* 25MHz */
25
26/*
27 * Required LS standard platform porting definitions
28 */
29#define PLAT_LS_CLUSTER_COUNT 1
30#define PLAT_LS1043_CCI_CLUSTER0_SL_IFACE_IX 4
31#define LS1043_CLUSTER_COUNT 1
32#define LS1043_MAX_CPUS_PER_CLUSTER 4
33
34#define LS_DRAM1_BASE 0x80000000
35#define LS_DRAM2_BASE 0x880000000
36#define LS_DRAM2_SIZE 0x780000000 /* 30G */
37#define LS_DRAM1_SIZE 0x80000000 /* 2G */
38#define LS_NS_DRAM_BASE LS_DRAM1_BASE
39/* 64M Secure Memory, in fact there a 2M non-secure hole on top of it */
40#define LS_SECURE_DRAM_SIZE (64 * 1024 * 1024)
41#define LS_SECURE_DRAM_BASE (LS_NS_DRAM_BASE + LS_DRAM1_SIZE - \
42 LS_SECURE_DRAM_SIZE)
43#define LS_NS_DRAM_SIZE (LS_DRAM1_SIZE - LS_SECURE_DRAM_SIZE)
44
45/*
46 * By default, BL2 is in DDR memory.
47 * If LS_BL2_IN_OCRAM is defined, BL2 will in OCRAM
48 */
49/* #define LS_BL2_IN_OCRAM */
50
51#ifndef LS_BL2_IN_OCRAM
52/*
53 * on top of SECURE memory is 2M non-secure hole for OPTee,
54 * 1M secure memory below this hole will be used for BL2.
55 */
56#define LS_BL2_DDR_BASE (LS_SECURE_DRAM_BASE + \
57 LS_SECURE_DRAM_SIZE \
58 - 3 * 1024 * 1024)
59#endif
60
61#define PLAT_LS_CCSR_BASE 0x1000000
62#define PLAT_LS_CCSR_SIZE 0xF000000
63
64/* Flash base address, currently ROM is not used for TF-A images on LS platforms */
65#define PLAT_LS_TRUSTED_ROM_BASE 0x60100000
66#define PLAT_LS_TRUSTED_ROM_SIZE 0x20000000 /* Flash size */
67#define PLAT_LS_FLASH_SIZE 0x20000000
68#define PLAT_LS_FLASH_BASE 0x60000000
69
70#define LS_SRAM_BASE 0x10000000
71#define LS_SRAM_LIMIT 0x10020000 /* 128K */
72#define LS_SRAM_SHARED_SIZE 0x1000 /* 4K */
73#define LS_SRAM_SIZE (LS_SRAM_LIMIT - LS_SRAM_BASE)
74#define LS_BL_RAM_BASE (LS_SRAM_BASE + LS_SRAM_SHARED_SIZE)
75
76#define PLAT_LS_FIP_MAX_SIZE 0x4000000
77
78/* Memory Layout */
79
80#define BL1_RO_BASE PLAT_LS_TRUSTED_ROM_BASE
81#define BL1_RO_LIMIT (PLAT_LS_TRUSTED_ROM_BASE \
82 + PLAT_LS_TRUSTED_ROM_SIZE)
83#define PLAT_LS_FIP_BASE 0x60120000
84
85#ifdef LS_BL2_IN_OCRAM
86/* BL2 is in OCRAM */
87#define PLAT_LS_MAX_BL1_RW_SIZE (52 * 1024) /* 52K */
88#define PLAT_LS_MAX_BL31_SIZE (64 * 1024) /* 64K */
89#define PLAT_LS_MAX_BL2_SIZE (44 * 1024) /* 44K */
90/* Reserve memory in OCRAM for BL31 Text and ROData segment */
91#define BL31_TEXT_RODATA_SIZE (32 * 1024) /* 32K */
92#else /* LS_BL2_IN_OCRAM */
93/* BL2 in DDR */
94#define PLAT_LS_MAX_BL1_RW_SIZE (64 * 1024) /* 64K */
95#define PLAT_LS_MAX_BL31_SIZE (64 * 1024) /* 64K */
96#define PLAT_LS_MAX_BL2_SIZE (1 * 1024 * 1024) /* 1M */
97#endif /* LS_BL2_IN_OCRAM */
98/*
99 * Put BL31 at the start of OCRAM.
100 */
101#define BL31_BASE LS_SRAM_BASE
102#define BL31_LIMIT (LS_SRAM_BASE + PLAT_LS_MAX_BL31_SIZE)
103
104#ifdef LS_BL2_IN_OCRAM
105/*
106 * BL2 follow BL31 Text and ROData region.
107 */
108#define BL2_BASE (BL31_BASE + BL31_TEXT_RODATA_SIZE)
109#define BL2_LIMIT (BL2_BASE + PLAT_LS_MAX_BL2_SIZE)
110
111#else
112/*
113 * BL2 in DDR memory.
114 */
115#define BL2_BASE LS_BL2_DDR_BASE
116#define BL2_LIMIT (BL2_BASE + PLAT_LS_MAX_BL2_SIZE)
117
118#endif
119
120/*
121 * Put BL1 RW at the top of the Trusted SRAM.
122 */
123#ifdef LS_BL2_IN_OCRAM
124#define BL1_RW_BASE BL2_LIMIT
125#else
126#define BL1_RW_BASE BL31_LIMIT
127#endif
128#define BL1_RW_LIMIT LS_SRAM_LIMIT
129
130/* Put BL32 in secure memory */
131#define BL32_BASE LS_SECURE_DRAM_BASE
132#define BL32_LIMIT (LS_SECURE_DRAM_BASE + LS_SECURE_DRAM_SIZE)
133/* BL33 memory region */
134#define BL33_BASE 0x82000000
135#define BL33_LIMIT (LS_NS_DRAM_BASE + LS_NS_DRAM_SIZE)
136
137/*******************************************************************************
138 * BL32 specific defines.
139 ******************************************************************************/
140/*
141 * On ARM standard platforms, the TSP can execute from Trusted SRAM,
142 * Trusted DRAM (if available) or the DRAM region secured by the TrustZone
143 * controller.
144 */
145
146#define TSP_SEC_MEM_BASE BL32_BASE
147#define TSP_SEC_MEM_SIZE (BL32_LIMIT - BL32_BASE)
148
149/*
150 * ID of the secure physical generic timer interrupt used by the TSP.
151 */
152#define TSP_IRQ_SEC_PHY_TIMER 29
153
154
155/*
156 * GIC related constants
157 */
158#define PLAT_LS1043_CCI_BASE 0x01180000
159#define GICD_BASE 0x01401000
160#define GICC_BASE 0x01402000
161#define GICD_BASE_64K 0x01410000
162#define GICC_BASE_64K 0x01420000
163
164#define DCFG_CCSR_SVR 0x1ee00a4
165#define REV1_0 0x10
166#define REV1_1 0x11
167#define GIC_ADDR_BIT 31
168#define SCFG_GIC400_ALIGN 0x1570188
169
170/* UART related definition */
171
172#define PLAT_LS1043_DUART1_BASE 0x021c0000
173#define PLAT_LS1043_DUART2_BASE 0x021d0000
174#define PLAT_LS1043_DUART_SIZE 0x10000
175
176#define PLAT_LS1043_UART_BASE 0x21c0500
177#define PLAT_LS1043_UART2_BASE 0x21c0600
178#define PLAT_LS1043_UART_CLOCK 400000000
179#define PLAT_LS1043_UART_BAUDRATE 115200
180/* Define UART to be used by TF-A log */
181#define LS_TF_UART_BASE PLAT_LS1043_UART_BASE
182#define LS_TF_UART_CLOCK PLAT_LS1043_UART_CLOCK
183#define LS_TF_UART_BAUDRATE PLAT_LS1043_UART_BAUDRATE
184
185#define LS1043_SYS_CNTCTL_BASE 0x2B00000
186
187#define CONFIG_SYS_IMMR 0x01000000
188#define CONFIG_SYS_FSL_CSU_ADDR (CONFIG_SYS_IMMR + 0x00510000)
189
190/* Size of cacheable stacks */
191#if defined(IMAGE_BL1)
192#define PLATFORM_STACK_SIZE 0x440
193#define MAX_MMAP_REGIONS 6
194#define MAX_XLAT_TABLES 4
195#elif defined(IMAGE_BL2)
196#define PLATFORM_STACK_SIZE 0x400
197#define MAX_MMAP_REGIONS 8
198#define MAX_XLAT_TABLES 6
199#elif defined(IMAGE_BL31)
200#define PLATFORM_STACK_SIZE 0x400
201#define MAX_MMAP_REGIONS 8
202#define MAX_XLAT_TABLES 4
203#elif defined(IMAGE_BL32)
204#define PLATFORM_STACK_SIZE 0x440
205#define MAX_MMAP_REGIONS 8
206#define MAX_XLAT_TABLES 9
207#endif
208
209#define MAX_IO_DEVICES 3
210#define MAX_IO_HANDLES 4
211
212#endif /* __PLATFORM_DEF_H__ */