blob: 38c5fe4f2143050778e794f15223eaa9140b9715 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02008#include "../juno_def.h"
9
10/*******************************************************************************
11 * Platform definitions used by common code
12 ******************************************************************************/
13
14#ifndef __PLATFORM_DEF_H__
15#define __PLATFORM_DEF_H__
16
17/*******************************************************************************
18 * Platform binary types for linking
19 ******************************************************************************/
20#ifndef AARCH32
21#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
22#define PLATFORM_LINKER_ARCH aarch64
23#else
24#define PLATFORM_LINKER_FORMAT "elf32-littlearm"
25#define PLATFORM_LINKER_ARCH arm
26#endif
27
28/*******************************************************************************
29 * Run-time address of the TFTF image.
30 * It has to match the location where the Trusted Firmware-A loads the BL33
31 * image.
32 ******************************************************************************/
33#define TFTF_BASE 0xE0000000
34
35#define JUNO_DRAM1_BASE 0x80000000
36#define JUNO_DRAM2_BASE 0x880000000
37#define DRAM_BASE JUNO_DRAM1_BASE
38#define DRAM_SIZE 0x80000000
39
40/* Base address of non-trusted watchdog (SP805) */
41#define SP805_WDOG_BASE 0x1C0F0000
42
43/* Memory mapped Generic timer interfaces */
44#define SYS_CNT_BASE1 0x2a830000
45
46/* V2M motherboard system registers & offsets */
47#define VE_SYSREGS_BASE 0x1c010000
48#define V2M_SYS_LED 0x8
49
50/*******************************************************************************
51 * Base address and size of external NVM flash
52 ******************************************************************************/
53#define FLASH_BASE 0x08000000
54
55/*
56 * The flash chip on Juno is a SCSP package of 2-die's and of a total size of
57 * 512Mb, we are using only the main blocks of size 128KB for storing results.
58 * The SMC controller performs data striping and splits the word into half to
59 * each flash die's which leads to a virtual block size of 256KB to software.
60 */
61#define NOR_FLASH_BLOCK_SIZE 0x40000
62#define NOR_FLASH_BLOCKS_COUNT 255
63#define FLASH_SIZE (NOR_FLASH_BLOCK_SIZE * NOR_FLASH_BLOCKS_COUNT)
64
65/*******************************************************************************
66 * Base address and size for the FIP that contains FWU images.
67 ******************************************************************************/
68#define PLAT_ARM_FWU_FIP_BASE (FLASH_BASE + 0x400000)
69#define PLAT_ARM_FWU_FIP_SIZE (0x100000)
70
71/*******************************************************************************
72 * Base address and size for non-trusted SRAM.
73 ******************************************************************************/
74#define NSRAM_BASE (0x2e000000)
75#define NSRAM_SIZE (0x00008000)
76
77/*******************************************************************************
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020078 * NS_BL1U specific defines.
79 * NS_BL1U RW data is relocated from NS-ROM to NS-RAM at runtime so we
80 * need 2 sets of addresses.
81 ******************************************************************************/
82#define NS_BL1U_RO_BASE (0x08000000 + 0x03EB8000)
83#define NS_BL1U_RO_LIMIT (NS_BL1U_RO_BASE + 0xC000)
84
85/*******************************************************************************
86 * Put NS_BL1U RW at the top of the Non-Trusted SRAM. NS_BL1U_RW_BASE is
87 * calculated using the current NS_BL1U RW debug size plus a little space
88 * for growth.
89 ******************************************************************************/
90#define NS_BL1U_RW_SIZE (0x7000)
91#define NS_BL1U_RW_BASE (NSRAM_BASE)
92#define NS_BL1U_RW_LIMIT (NS_BL1U_RW_BASE + NS_BL1U_RW_SIZE)
93
94/*******************************************************************************
95 * Base address and limit for NS_BL2U image.
96 ******************************************************************************/
97#define NS_BL2U_BASE DRAM_BASE
98#define NS_BL2U_LIMIT (NS_BL2U_BASE + 0x4D000)
99
100/*******************************************************************************
101 * Generic platform constants
102 ******************************************************************************/
103
104/* Size of cacheable stacks */
105#if IMAGE_NS_BL1U
106#define PLATFORM_STACK_SIZE 0x1000
107#elif IMAGE_NS_BL2U
108#define PLATFORM_STACK_SIZE 0x1000
109#elif IMAGE_TFTF
110#define PLATFORM_STACK_SIZE 0x1400
111#endif
112
113/* Size of coherent stacks for debug and release builds */
114#if DEBUG
115#define PCPU_DV_MEM_STACK_SIZE 0x600
116#else
117#define PCPU_DV_MEM_STACK_SIZE 0x500
118#endif
119
120#define PLATFORM_SYSTEM_COUNT 1
121#define PLATFORM_CLUSTER_COUNT 2
122#define PLATFORM_CLUSTER1_CORE_COUNT 4 /* Cortex-A53 Cluster */
123#define PLATFORM_CLUSTER0_CORE_COUNT 2 /* Cortex-A57 Cluster */
124#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
125 PLATFORM_CLUSTER0_CORE_COUNT)
126#define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \
127 PLATFORM_CLUSTER_COUNT + \
128 PLATFORM_CORE_COUNT)
129#define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
130#define PLAT_MAX_PWR_LEVEL PLATFORM_MAX_AFFLVL
131#define PLAT_MAX_PWR_STATES_PER_LVL 2
132
133/* Local state bit width for each level in the state-ID field of power state */
134#define PLAT_LOCAL_PSTATE_WIDTH 4
135
136#if IMAGE_NS_BL1U
137#define MAX_IO_DEVICES 2
138#define MAX_IO_HANDLES 2
139#else
140#define MAX_IO_DEVICES 1
141#define MAX_IO_HANDLES 1
142#endif
143
144#if USE_NVM
145/*
146 * The Flash memory is used to store TFTF data on Juno.
147 * However, it might contain other data that must not be overwritten.
148 * For example, when using the Trusted Firmware-A, the FIP image
149 * (containing the bootloader images) is also stored in Flash.
150 * Hence, consider the first 40MB of Flash as reserved for firmware usage.
151 * The TFTF can use the rest of the Flash memory.
152 */
153#define TFTF_NVM_OFFSET 0x2800000 /* 40MB */
154#define TFTF_NVM_SIZE (FLASH_SIZE - TFTF_NVM_OFFSET)
155#else
156/*
157 * If you want to run without support for non-volatile memory (due to e.g.
158 * unavailability of a flash driver), DRAM can be used instead as workaround.
159 * The TFTF binary itself is loaded at 0xE0000000 so we have plenty of free
160 * memory at the beginning of the DRAM. Let's use the first 128MB.
161 *
162 * Please note that this won't be suitable for all test scenarios and
163 * for this reason some tests will be disabled in this configuration.
164 */
165#define TFTF_NVM_OFFSET 0x0
166#define TFTF_NVM_SIZE 0x8000000 /* 128 MB */
167#endif
168
169/*******************************************************************************
170 * Platform specific page table and MMU setup constants
171 ******************************************************************************/
172#define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32)
173#define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32)
174#define MAX_XLAT_TABLES 5
175#define MAX_MMAP_REGIONS 16
176
177/*******************************************************************************
178 * Used to align variables on the biggest cache line size in the platform.
179 * This is known only to the platform as it might have a combination of
180 * integrated and external caches.
181 ******************************************************************************/
182#define CACHE_WRITEBACK_SHIFT 6
183#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
184
185/*******************************************************************************
186 * Non-Secure Software Generated Interupts IDs
187 ******************************************************************************/
188#define IRQ_NS_SGI_0 0
189#define IRQ_NS_SGI_1 1
190#define IRQ_NS_SGI_2 2
191#define IRQ_NS_SGI_3 3
192#define IRQ_NS_SGI_4 4
193#define IRQ_NS_SGI_5 5
194#define IRQ_NS_SGI_6 6
195#define IRQ_NS_SGI_7 7
196
197#define PLAT_MAX_SPI_OFFSET_ID 220
198
199/* The IRQ generated by Ethernet controller */
200#define IRQ_ETHERNET 192
201
202#define IRQ_CNTPSIRQ1 92
203/* Per-CPU Hypervisor Timer Interrupt ID */
204#define IRQ_PCPU_HP_TIMER 26
205/* Per-CPU Non-Secure Timer Interrupt ID */
206#define IRQ_PCPU_NS_TIMER 30
207
208/*
209 * Times(in ms) used by test code for completion of different events.
210 * Suspend entry time for debug build is high due to the time taken
211 * by the VERBOSE/INFO prints. The value considers the worst case scenario
212 * where all CPUs are going and coming out of suspend continuously.
213 */
214#if DEBUG
215#define PLAT_SUSPEND_ENTRY_TIME 0x100
216#define PLAT_SUSPEND_ENTRY_EXIT_TIME 0x200
217#else
218#define PLAT_SUSPEND_ENTRY_TIME 10
219#define PLAT_SUSPEND_ENTRY_EXIT_TIME 20
220#endif
221
222#endif /* __PLATFORM_DEF_H__ */