blob: 19be6cb068f89d71c0bd721d8520901809d7e381 [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 "../fvp_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 0x88000000
34
35/* Base address of non-trusted watchdog (SP805) */
36#define SP805_WDOG_BASE 0x1C0F0000
37
38/*******************************************************************************
39 * Base address and size of external NVM flash
40 ******************************************************************************/
41#define FLASH_BASE 0x08000000
42
43/*
44 * The flash memory in FVP resembles as a SCSP package of 2-die's and
45 * of a total size of 512Mb, we are using only the main blocks of size
46 * 128KB for storing results. Also the FVP performs data striping and
47 * splits the word into half to each flash die's which leads to a
48 * virtual block size of 256KB to software.
49 */
50#define NOR_FLASH_BLOCK_SIZE 0x40000 /* 256KB */
51#define NOR_FLASH_BLOCKS_COUNT 255
52#define FLASH_SIZE (NOR_FLASH_BLOCK_SIZE * NOR_FLASH_BLOCKS_COUNT)
53
54/*******************************************************************************
55 * Base address and size for the FIP that contains FWU images.
56 ******************************************************************************/
57#define PLAT_ARM_FWU_FIP_BASE (FLASH_BASE + 0x400000)
58#define PLAT_ARM_FWU_FIP_SIZE (0x100000)
59
60/*******************************************************************************
61 * Base address and size for non-trusted SRAM.
62 ******************************************************************************/
63#define NSRAM_BASE (0x2e000000)
64#define NSRAM_SIZE (0x00010000)
65
66/*******************************************************************************
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020067 * NS_BL1U specific defines.
68 * NS_BL1U RW data is relocated from NS-ROM to NS-RAM at runtime so we
69 * need 2 sets of addresses.
70 ******************************************************************************/
71#define NS_BL1U_RO_BASE (0x08000000 + 0x03EB8000)
72#define NS_BL1U_RO_LIMIT (NS_BL1U_RO_BASE + 0xC000)
73
74/*******************************************************************************
75 * Put NS_BL1U RW at the top of the Non-Trusted SRAM. NS_BL1U_RW_BASE is
76 * calculated using the current NS_BL1U RW debug size plus a little space
77 * for growth.
78 ******************************************************************************/
79#define NS_BL1U_RW_SIZE (0x7000)
80#define NS_BL1U_RW_BASE (NSRAM_BASE)
81#define NS_BL1U_RW_LIMIT (NS_BL1U_RW_BASE + NS_BL1U_RW_SIZE)
82
83/*******************************************************************************
84 * Platform memory map related constants
85 ******************************************************************************/
86#define FVP_DRAM1_BASE 0x80000000
87#define FVP_DRAM2_BASE 0x880000000
88#define DRAM_BASE FVP_DRAM1_BASE
89#define DRAM_SIZE 0x80000000
90
91/*******************************************************************************
92 * Base address and limit for NS_BL2U image.
93 ******************************************************************************/
94#define NS_BL2U_BASE DRAM_BASE
95#define NS_BL2U_LIMIT (NS_BL2U_BASE + 0x4D000)
96
97/******************************************************************************
98 * Memory mapped Generic timer interfaces
99 ******************************************************************************/
100/* REFCLK CNTControl, Generic Timer. Secure Access only. */
101#define SYS_CNT_CONTROL_BASE 0x2a430000
102/* REFCLK CNTRead, Generic Timer. */
103#define SYS_CNT_READ_BASE 0x2a800000
104/* AP_REFCLK CNTBase1, Generic Timer. */
105#define SYS_CNT_BASE1 0x2a830000
106
107/* V2M motherboard system registers & offsets */
108#define VE_SYSREGS_BASE 0x1c010000
109#define V2M_SYS_LED 0x8
110
111/*******************************************************************************
112 * Generic platform constants
113 ******************************************************************************/
114
115/* Size of cacheable stacks */
116#if IMAGE_NS_BL1U || IMAGE_NS_BL2U
117#define PLATFORM_STACK_SIZE 0x1000
118#else
119#define PLATFORM_STACK_SIZE 0x1400
120#endif
121
122/* Size of coherent stacks for debug and release builds */
123#if DEBUG
124#define PCPU_DV_MEM_STACK_SIZE 0x600
125#else
126#define PCPU_DV_MEM_STACK_SIZE 0x500
127#endif
128
129#define PLATFORM_CORE_COUNT (FVP_CLUSTER_COUNT * \
130 FVP_MAX_CPUS_PER_CLUSTER)
131#define PLATFORM_NUM_AFFS (1 + FVP_CLUSTER_COUNT + \
132 PLATFORM_CORE_COUNT)
133#define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
134
135/* TODO : Migrate complete TFTF from affinity level to power levels */
136#define PLAT_MAX_PWR_LEVEL PLATFORM_MAX_AFFLVL
137#define PLAT_MAX_PWR_STATES_PER_LVL 2
138
139#if IMAGE_NS_BL1U
140#define MAX_IO_DEVICES 2
141#define MAX_IO_HANDLES 2
142#else
143#define MAX_IO_DEVICES 1
144#define MAX_IO_HANDLES 1
145#endif
146
147/* Local state bit width for each level in the state-ID field of power state */
148#define PLAT_LOCAL_PSTATE_WIDTH 4
149
150#if USE_NVM
151/*
152 * The Flash memory is used to store the TFTF data on FVP.
153 * However, it might contain other data that must not be overwritten.
154 * For example, when using the Trusted Firmware-A, the FIP image
155 * (containing the bootloader images) is also stored in Flash.
156 * Hence, consider the first 40MB of Flash as reserved for firmware usage.
157 * The TFTF can use the rest of the Flash memory.
158 */
159#define TFTF_NVM_OFFSET 0x2800000 /* 40 MB */
160#define TFTF_NVM_SIZE (FLASH_SIZE - TFTF_NVM_OFFSET)
161#else
162/*
163 * If you want to run without support for non-volatile memory (due to
164 * e.g. unavailability of a flash driver), DRAM can be used instead as
165 * a workaround. The TFTF binary itself is loaded at 0x88000000 so the
166 * first 128MB can be used
167 * Please note that this won't be suitable for all test scenarios and
168 * for this reason some tests will be disabled in this configuration.
169 */
170#define TFTF_NVM_OFFSET 0x0
171#define TFTF_NVM_SIZE (TFTF_BASE - DRAM_BASE - TFTF_NVM_OFFSET)
172#endif
173
174/*******************************************************************************
175 * Platform specific page table and MMU setup constants
176 ******************************************************************************/
177#define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32)
178#define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32)
179#if IMAGE_TFTF
180#define MAX_XLAT_TABLES 6
181#define MAX_MMAP_REGIONS 16
182#else
183#define MAX_XLAT_TABLES 5
184#define MAX_MMAP_REGIONS 16
185#endif
186
187/*******************************************************************************
188 * Used to align variables on the biggest cache line size in the platform.
189 * This is known only to the platform as it might have a combination of
190 * integrated and external caches.
191 ******************************************************************************/
192#define CACHE_WRITEBACK_SHIFT 6
193#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
194
195/*******************************************************************************
196 * Non-Secure Software Generated Interupts IDs
197 ******************************************************************************/
198#define IRQ_NS_SGI_0 0
199#define IRQ_NS_SGI_1 1
200#define IRQ_NS_SGI_2 2
201#define IRQ_NS_SGI_3 3
202#define IRQ_NS_SGI_4 4
203#define IRQ_NS_SGI_5 5
204#define IRQ_NS_SGI_6 6
205#define IRQ_NS_SGI_7 7
206
207/*
208 * On FVP, consider that the last SPI is the Trusted Random Number Generator
209 * interrupt.
210 */
211#define PLAT_MAX_SPI_OFFSET_ID 107
212
213/* AP_REFCLK, Generic Timer, CNTPSIRQ1. */
214#define IRQ_CNTPSIRQ1 58
215/* Per-CPU Hypervisor Timer Interrupt ID */
216#define IRQ_PCPU_HP_TIMER 26
217/* Per-CPU Non-Secure Timer Interrupt ID */
218#define IRQ_PCPU_NS_TIMER 30
219
220
221/* Times(in ms) used by test code for completion of different events */
222#define PLAT_SUSPEND_ENTRY_TIME 15
223#define PLAT_SUSPEND_ENTRY_EXIT_TIME 30
224
Antonio Nino Diazf2218e72019-03-19 10:59:11 +0000225/*******************************************************************************
226 * Location of the memory buffer shared between Normal World (i.e. TFTF) and the
227 * Secure Partition (e.g. Cactus-MM) to pass data associated to secure service
228 * requests. This is only needed for SPM based on MM.
229 * Note: This address has to match the one used in TF (see ARM_SP_IMAGE_NS_BUF_*
230 * macros).
231 ******************************************************************************/
232#define ARM_SECURE_SERVICE_BUFFER_BASE 0xff600000ull
233#define ARM_SECURE_SERVICE_BUFFER_SIZE 0x10000ull
234
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200235#endif /* __PLATFORM_DEF_H__ */