blob: 4afaae1d9ad528f3c7cd28f7a6adaebbe4304cc8 [file] [log] [blame]
Nariman Poushin0ece80f2018-02-26 06:52:04 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Chandni Cherukuria3f66132018-08-10 11:17:58 +05307#ifndef SGI_BASE_PLATFORM_DEF_H
8#define SGI_BASE_PLATFORM_DEF_H
Nariman Poushin0ece80f2018-02-26 06:52:04 +00009
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <lib/utils_def.h>
11#include <lib/xlat_tables/xlat_tables_defs.h>
12#include <plat/common/common_def.h>
13
Nariman Poushin0ece80f2018-02-26 06:52:04 +000014#include <arm_def.h>
Sughosh Ganu79b91d42018-05-16 15:13:25 +053015#include <arm_spm_def.h>
Nariman Poushin0ece80f2018-02-26 06:52:04 +000016#include <board_css_def.h>
Nariman Poushin0ece80f2018-02-26 06:52:04 +000017#include <css_def.h>
18#include <soc_css_def.h>
Antonio Nino Diaz48bfb542018-10-11 13:02:34 +010019#include <v2m_def.h>
Nariman Poushin0ece80f2018-02-26 06:52:04 +000020
Nariman Poushin0ece80f2018-02-26 06:52:04 +000021#define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053022 CSS_SGI_MAX_CPUS_PER_CLUSTER * \
23 CSS_SGI_MAX_PE_PER_CPU)
Nariman Poushin0ece80f2018-02-26 06:52:04 +000024
Antonio Nino Diaz48bfb542018-10-11 13:02:34 +010025#define PLAT_ARM_TRUSTED_SRAM_SIZE 0x00040000 /* 256 KB */
26
Antonio Nino Diaz92029262018-09-28 16:39:26 +010027/*
28 * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
29 * plat_arm_mmap array defined for each BL stage.
30 */
31#if defined(IMAGE_BL31)
32# if ENABLE_SPM
33# define PLAT_ARM_MMAP_ENTRIES 9
34# define MAX_XLAT_TABLES 7
35# define PLAT_SP_IMAGE_MMAP_REGIONS 7
36# define PLAT_SP_IMAGE_MAX_XLAT_TABLES 10
37# else
38# define PLAT_ARM_MMAP_ENTRIES 8
39# define MAX_XLAT_TABLES 5
40# endif
41#elif defined(IMAGE_BL32)
42# define PLAT_ARM_MMAP_ENTRIES 8
Nariman Poushin0ece80f2018-02-26 06:52:04 +000043# define MAX_XLAT_TABLES 5
Antonio Nino Diaz92029262018-09-28 16:39:26 +010044#elif !USE_ROMLIB
45# define PLAT_ARM_MMAP_ENTRIES 11
46# define MAX_XLAT_TABLES 5
47#else
48# define PLAT_ARM_MMAP_ENTRIES 12
49# define MAX_XLAT_TABLES 6
Nariman Poushin0ece80f2018-02-26 06:52:04 +000050#endif
51
Antonio Nino Diaz92029262018-09-28 16:39:26 +010052/*
53 * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
54 * plus a little space for growth.
55 */
56#define PLAT_ARM_MAX_BL1_RW_SIZE 0xB000
57
58/*
59 * PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page
60 */
61
62#if USE_ROMLIB
63#define PLAT_ARM_MAX_ROMLIB_RW_SIZE 0x1000
64#define PLAT_ARM_MAX_ROMLIB_RO_SIZE 0xe000
Nariman Poushin0ece80f2018-02-26 06:52:04 +000065#else
Antonio Nino Diaz92029262018-09-28 16:39:26 +010066#define PLAT_ARM_MAX_ROMLIB_RW_SIZE 0
67#define PLAT_ARM_MAX_ROMLIB_RO_SIZE 0
Nariman Poushin0ece80f2018-02-26 06:52:04 +000068#endif
69
Antonio Nino Diaz92029262018-09-28 16:39:26 +010070/*
71 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
72 * little space for growth.
73 */
Nariman Poushin0ece80f2018-02-26 06:52:04 +000074#if TRUSTED_BOARD_BOOT
75# define PLAT_ARM_MAX_BL2_SIZE 0x1D000
76#else
Antonio Nino Diaz92029262018-09-28 16:39:26 +010077# define PLAT_ARM_MAX_BL2_SIZE 0x11000
Nariman Poushin0ece80f2018-02-26 06:52:04 +000078#endif
79
Antonio Nino Diaz92029262018-09-28 16:39:26 +010080/*
81 * Since BL31 NOBITS overlays BL2 and BL1-RW, PLAT_ARM_MAX_BL31_SIZE is
82 * calculated using the current BL31 PROGBITS debug size plus the sizes of
83 * BL2 and BL1-RW
84 */
85#define PLAT_ARM_MAX_BL31_SIZE 0x3B000
Nariman Poushin0ece80f2018-02-26 06:52:04 +000086
Antonio Nino Diaz48bfb542018-10-11 13:02:34 +010087/*
88 * Size of cacheable stacks
89 */
90#if defined(IMAGE_BL1)
91# if TRUSTED_BOARD_BOOT
92# define PLATFORM_STACK_SIZE 0x1000
93# else
94# define PLATFORM_STACK_SIZE 0x440
95# endif
96#elif defined(IMAGE_BL2)
97# if TRUSTED_BOARD_BOOT
98# define PLATFORM_STACK_SIZE 0x1000
99# else
100# define PLATFORM_STACK_SIZE 0x400
101# endif
102#elif defined(IMAGE_BL2U)
103# define PLATFORM_STACK_SIZE 0x400
104#elif defined(IMAGE_BL31)
105# if ENABLE_SPM
106# define PLATFORM_STACK_SIZE 0x500
107# else
108# define PLATFORM_STACK_SIZE 0x400
109# endif
110#elif defined(IMAGE_BL32)
111# define PLATFORM_STACK_SIZE 0x440
112#endif
113
114
Nariman Poushin0ece80f2018-02-26 06:52:04 +0000115#define PLAT_ARM_NSTIMER_FRAME_ID 0
116
Nariman Poushin0ece80f2018-02-26 06:52:04 +0000117#define PLAT_ARM_TRUSTED_ROM_BASE 0x0
118#define PLAT_ARM_TRUSTED_ROM_SIZE 0x00080000 /* 512KB */
119
Chris Kay42fbdfc2018-05-10 14:27:45 +0100120#define PLAT_ARM_NSRAM_BASE 0x06000000
121#define PLAT_ARM_NSRAM_SIZE 0x00080000 /* 512KB */
122
Nariman Poushin0ece80f2018-02-26 06:52:04 +0000123#define PLAT_ARM_G1S_IRQ_PROPS(grp) CSS_G1S_IRQ_PROPS(grp)
124#define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)
125
126#define CSS_SGI_DEVICE_BASE (0x20000000)
127#define CSS_SGI_DEVICE_SIZE (0x20000000)
128#define CSS_SGI_MAP_DEVICE MAP_REGION_FLAT( \
129 CSS_SGI_DEVICE_BASE, \
130 CSS_SGI_DEVICE_SIZE, \
131 MT_DEVICE | MT_RW | MT_SECURE)
132
Nariman Poushin0ece80f2018-02-26 06:52:04 +0000133/* GIC related constants */
134#define PLAT_ARM_GICD_BASE 0x30000000
135#define PLAT_ARM_GICC_BASE 0x2C000000
136#define PLAT_ARM_GICR_BASE 0x300C0000
137
Sughosh Ganue1579e02018-05-16 17:19:56 +0530138/* Map the secure region for access from S-EL0 */
139#define PLAT_ARM_SECURE_MAP_DEVICE MAP_REGION_FLAT( \
140 SOC_CSS_DEVICE_BASE, \
141 SOC_CSS_DEVICE_SIZE, \
142 MT_DEVICE | MT_RW | MT_SECURE | MT_USER)
143
Sughosh Ganud284b572018-11-14 10:42:46 +0530144#define PLAT_SP_PRI PLAT_RAS_PRI
145
Sughosh Ganu5f212942018-05-16 15:35:25 +0530146#if RAS_EXTENSION
147/* Allocate 128KB for CPER buffers */
Sughosh Ganu70661cf2018-05-16 17:26:40 +0530148#define PLAT_SP_BUF_BASE ULL(0x20000)
149
Ard Biesheuvel8b034fc2018-12-29 19:43:21 +0100150#define PLAT_ARM_SP_IMAGE_STACK_BASE (PLAT_SP_IMAGE_NS_BUF_BASE + \
151 PLAT_SP_IMAGE_NS_BUF_SIZE + \
Sughosh Ganu70661cf2018-05-16 17:26:40 +0530152 PLAT_SP_BUF_BASE)
153
154/* Platform specific SMC FID's used for RAS */
155#define SP_DMC_ERROR_INJECT_EVENT_AARCH64 0xC4000042
156#define SP_DMC_ERROR_INJECT_EVENT_AARCH32 0x84000042
157
158#define SP_DMC_ERROR_OVERFLOW_EVENT_AARCH64 0xC4000043
159#define SP_DMC_ERROR_OVERFLOW_EVENT_AARCH32 0x84000043
160
161#define SP_DMC_ERROR_ECC_EVENT_AARCH64 0xC4000044
162#define SP_DMC_ERROR_ECC_EVENT_AARCH32 0x84000044
163
164/* ARM SDEI dynamic shared event numbers */
165#define SGI_SDEI_DS_EVENT_0 804
166#define SGI_SDEI_DS_EVENT_1 805
167
168#define PLAT_ARM_PRIVATE_SDEI_EVENTS \
169 SDEI_DEFINE_EVENT_0(ARM_SDEI_SGI), \
170 SDEI_EXPLICIT_EVENT(SGI_SDEI_DS_EVENT_0, SDEI_MAPF_CRITICAL), \
171 SDEI_EXPLICIT_EVENT(SGI_SDEI_DS_EVENT_1, SDEI_MAPF_CRITICAL),
172#define PLAT_ARM_SHARED_SDEI_EVENTS
173
Ard Biesheuvel8b034fc2018-12-29 19:43:21 +0100174#define ARM_SP_CPER_BUF_BASE (PLAT_SP_IMAGE_NS_BUF_BASE + \
175 PLAT_SP_IMAGE_NS_BUF_SIZE)
Sughosh Ganu70661cf2018-05-16 17:26:40 +0530176#define ARM_SP_CPER_BUF_SIZE ULL(0x20000)
177#define ARM_SP_CPER_BUF_MMAP MAP_REGION2( \
178 ARM_SP_CPER_BUF_BASE, \
179 ARM_SP_CPER_BUF_BASE, \
180 ARM_SP_CPER_BUF_SIZE, \
181 MT_RW_DATA | MT_NS | MT_USER, \
182 PAGE_SIZE)
Sughosh Ganu5f212942018-05-16 15:35:25 +0530183
Sughosh Ganu5f212942018-05-16 15:35:25 +0530184#else
Ard Biesheuvel8b034fc2018-12-29 19:43:21 +0100185#define PLAT_ARM_SP_IMAGE_STACK_BASE (PLAT_SP_IMAGE_NS_BUF_BASE + \
186 PLAT_SP_IMAGE_NS_BUF_SIZE)
Sughosh Ganu5f212942018-05-16 15:35:25 +0530187#endif /* RAS_EXTENSION */
188
Nariman Poushin0ece80f2018-02-26 06:52:04 +0000189/* Platform ID address */
190#define SSC_VERSION (SSC_REG_BASE + SSC_VERSION_OFFSET)
191#ifndef __ASSEMBLY__
192/* SSC_VERSION related accessors */
193/* Returns the part number of the platform */
194#define GET_SGI_PART_NUM \
195 GET_SSC_VERSION_PART_NUM(mmio_read_32(SSC_VERSION))
196/* Returns the configuration number of the platform */
197#define GET_SGI_CONFIG_NUM \
198 GET_SSC_VERSION_CONFIG(mmio_read_32(SSC_VERSION))
199#endif /* __ASSEMBLY__ */
200
Roberto Vargasbcca6c62018-06-11 16:15:35 +0100201/*******************************************************************************
202 * Memprotect definitions
203 ******************************************************************************/
204/* PSCI memory protect definitions:
205 * This variable is stored in a non-secure flash because some ARM reference
206 * platforms do not have secure NVRAM. Real systems that provided MEM_PROTECT
207 * support must use a secure NVRAM to store the PSCI MEM_PROTECT definitions.
208 */
209#define PLAT_ARM_MEM_PROT_ADDR (V2M_FLASH0_BASE + \
210 V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE)
211
212
Chandni Cherukuria3f66132018-08-10 11:17:58 +0530213#endif /* SGI_BASE_PLATFORM_DEF_H */