summaryrefslogtreecommitdiff
path: root/plat/arm/board/armstrong/include/platform_def.h
blob: e89f00aa59ff7ff512539c1dda85daca7d44bd22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*
 * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * Neither the name of ARM nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include "../armstrong_def.h"
#include <arch.h>

/*******************************************************************************
 * Platform definitions used by common code
 ******************************************************************************/

#ifndef __PLATFORM_DEF_H__
#define __PLATFORM_DEF_H__

/*******************************************************************************
 * Platform binary types for linking
 ******************************************************************************/
#define PLATFORM_LINKER_FORMAT          "elf64-littleaarch64"
#define PLATFORM_LINKER_ARCH            aarch64

/*******************************************************************************
 * Run-time address of the TFTF image.
 * It has to match the location where the trusted firmware loads the BL3-3
 * image.
 ******************************************************************************/
#define TFTF_BASE			0xE0000000

#define DRAM_BASE			0x80000000
#define DRAM_SIZE			0x80000000

/* Memory mapped Generic timer interfaces  */
#define SYS_CNT_BASE1		0x2a830000

/* Base address of non-trusted watchdog (SP805) */
#define SP805_WDOG_BASE		0x1C0F0000

/* Size of a block as mapped by a second-level translation table */
#define L2_BLOCK_SIZE		0x200000

/* V2M motherboard system registers & offsets */
#define VE_SYSREGS_BASE		0x1c010000
#define V2M_SYS_LED		0x8

/*
 * Size of memory region configured as secure DRAM by the trusted firmware
 * through the TrustZone Controller.
 * TODO: Get rid of this constant once tsp_crash_reporting_test1() function has
 * been fixed. On Armstrong, TZC-400 is not configured to reserve any DRAM as Secure
 * at the moment.
 */
#define DRAM_TZ_SIZE	0x00000000ull

/*******************************************************************************
 * Generic platform constants
 ******************************************************************************/

/* Size of cacheable stacks */
#define PLATFORM_STACK_SIZE    0xb80

/* Size of coherent stacks for debug and release builds */
#if DEBUG
#define PCPU_DV_MEM_STACK_SIZE 0x400
#else
#define PCPU_DV_MEM_STACK_SIZE 0x300
#endif

#define PLATFORM_CLUSTER_COUNT		2
/*
 * The topology differs for collins which is 2x4 while for
 * armstrong and buzz it is 4x4
 */
#ifdef PLAT_collins
#define PLATFORM_CLUSTER0_CORE_COUNT	2 /* A72 Cluster */
#define PLATFORM_CLUSTER1_CORE_COUNT	4 /* A53 Cluster */
#else
#define PLATFORM_CLUSTER0_CORE_COUNT	4 /* A72 Cluster */
#define PLATFORM_CLUSTER1_CORE_COUNT	4 /* A53 Cluster */
#endif
#define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER0_CORE_COUNT + \
					PLATFORM_CLUSTER1_CORE_COUNT)
#define PLATFORM_NUM_AFFS		(PLATFORM_CLUSTER_COUNT + \
					 PLATFORM_CORE_COUNT)
#define PLATFORM_MAX_AFFLVL		MPIDR_AFFLVL1

/* TODO : Migrate complete TFTF from affinity level to power levels */
#define PLAT_MAX_PWR_LEVEL		PLATFORM_MAX_AFFLVL
#define PLAT_MAX_PWR_STATES_PER_LVL	2

#define MAX_IO_DEVICES			1
#define MAX_IO_HANDLES			1

/* Local state bit width for each level in the state-ID field of power state */
#define PLAT_LOCAL_PSTATE_WIDTH		4

/*
 * The flash memory in Armstrong resembles as a SCSP package of 2-die's and
 * of a total size of 512Mb, we are using only the main blocks of size
 * 128KB for storing results. Also the FVP performs data striping and
 * splits the word into half to each flash die's which leads to a
 * virtual block size of 256KB to software.
 */
#define NOR_FLASH_BLOCK_SIZE		0x40000 /* 256KB */
#define NOR_FLASH_BLOCKS_COUNT		255

#if USE_NVM
/*
 * The Flash memory is used to store TFTF data on Armstrong.
 * However, it might contain other data that must not be overwritten.
 * For example, when using the ARM Trusted Firmware, the FIP image
 * (containing the bootloader images) is also stored in Flash.
 * Hence, consider the first 40MB of Flash as reserved for firmware usage.
 * The TFTF can use the rest of the Flash memory.
 */
#define TFTF_NVM_OFFSET		0x2800000	/* 40MB */
#define TFTF_NVM_SIZE		(FLASH_SIZE - TFTF_NVM_OFFSET)
#else
/*
 * If you want to run without support for non-volatile memory (due to e.g.
 * unavailability of a flash driver), DRAM can be used instead as workaround.
 * The TFTF binary itself is loaded at 0xE0000000 so we have plenty of free
 * memory at the beginning of the DRAM. Let's use the first 128MB.
 *
 * Please note that this won't be suitable for all test scenarios and
 * for this reason some tests will be disabled in this configuration.
 */
#define TFTF_NVM_OFFSET		0x0
#define TFTF_NVM_SIZE		0x8000000	/* 128 MB */
#endif

/*******************************************************************************
 * Platform specific page table and MMU setup constants
 ******************************************************************************/
#define ADDR_SPACE_SIZE			(1ull << 32)
#define MAX_XLAT_TABLES			4
#define MAX_MMAP_REGIONS		16

/*******************************************************************************
 * Used to align variables on the biggest cache line size in the platform.
 * This is known only to the platform as it might have a combination of
 * integrated and external caches.
 ******************************************************************************/
#define CACHE_WRITEBACK_SHIFT   6
#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)

/*******************************************************************************
 * Non-Secure Software Generated Interupts IDs
 ******************************************************************************/
#define IRQ_NS_SGI_0		0
#define IRQ_NS_SGI_1		1
#define IRQ_NS_SGI_2		2
#define IRQ_NS_SGI_3		3
#define IRQ_NS_SGI_4		4
#define IRQ_NS_SGI_5		5
#define IRQ_NS_SGI_6		6
#define IRQ_NS_SGI_7		7

/*
 * On Armstrong, consider that the last SPI is the USB EHCI Controller interrupt.
 */
#define PLAT_MAX_SPI_OFFSET_ID	85

#define IRQ_CNTPSIRQ1		92
/* Per-CPU Hypervisor Timer Interrupt ID */
#define IRQ_PCPU_HP_TIMER		26
/* Per-CPU Non-Secure Timer Interrupt ID */
#define IRQ_PCPU_NS_TIMER		30

/* Times(in ms) used by test code for completion of different events */
#define PLAT_SUSPEND_ENTRY_TIME		15
#define PLAT_SUSPEND_ENTRY_EXIT_TIME	30

#endif /* __PLATFORM_DEF_H__ */