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