blob: c8c36d7900d64f836e62fcce0cff3fae97e5098a [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Dan Handleye83b0ca2014-01-14 18:17:09 +00002 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <string.h>
32#include <assert.h>
33#include <arch_helpers.h>
34#include <platform.h>
35#include <bl_common.h>
36/* Included only for error codes */
37#include <psci.h>
James Morrissey40a6f642014-02-10 14:24:36 +000038#include "debug.h"
Achin Gupta4f6ad662013-10-25 09:08:21 +010039
40unsigned char platform_normal_stacks[PLATFORM_STACK_SIZE][PLATFORM_CORE_COUNT]
41__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
42 section("tzfw_normal_stacks")));
43
44/*******************************************************************************
45 * This array holds the characteristics of the differences between the three
46 * FVP platforms (Base, A53_A57 & Foundation). It will be populated during cold
47 * boot at each boot stage by the primary before enabling the MMU (to allow cci
48 * configuration) & used thereafter. Each BL will have its own copy to allow
49 * independent operation.
50 ******************************************************************************/
51static unsigned long platform_config[CONFIG_LIMIT];
52
53/*******************************************************************************
54 * TODO: Check page table alignment to avoid space wastage
55 ******************************************************************************/
56
57/*******************************************************************************
58 * Level 1 translation tables need 4 entries for the 4GB address space accessib-
59 * le by the secure firmware. Input address space will be restricted using the
60 * T0SZ settings in the TCR.
61 ******************************************************************************/
62static unsigned long l1_xlation_table[ADDR_SPACE_SIZE >> 30]
63__attribute__ ((aligned((ADDR_SPACE_SIZE >> 30) << 3)));
64
65/*******************************************************************************
66 * Level 2 translation tables describe the first & second gb of the address
67 * space needed to address secure peripherals e.g. trusted ROM and RAM.
68 ******************************************************************************/
69static unsigned long l2_xlation_table[NUM_L2_PAGETABLES][NUM_2MB_IN_GB]
Jeenu Viswambharan74cbb832014-02-17 17:26:51 +000070__attribute__ ((aligned(NUM_2MB_IN_GB << 3), section("xlat_table")));
Achin Gupta4f6ad662013-10-25 09:08:21 +010071
72/*******************************************************************************
73 * Level 3 translation tables (2 sets) describe the trusted & non-trusted RAM
74 * regions at a granularity of 4K.
75 ******************************************************************************/
76static unsigned long l3_xlation_table[NUM_L3_PAGETABLES][NUM_4K_IN_2MB]
Jeenu Viswambharan74cbb832014-02-17 17:26:51 +000077__attribute__ ((aligned(NUM_4K_IN_2MB << 3), section("xlat_table")));
Achin Gupta4f6ad662013-10-25 09:08:21 +010078
79/*******************************************************************************
80 * Helper to create a level 1/2 table descriptor which points to a level 2/3
81 * table.
82 ******************************************************************************/
83static unsigned long create_table_desc(unsigned long *next_table_ptr)
84{
85 unsigned long desc = (unsigned long) next_table_ptr;
86
87 /* Clear the last 12 bits */
88 desc >>= FOUR_KB_SHIFT;
89 desc <<= FOUR_KB_SHIFT;
90
91 desc |= TABLE_DESC;
92
93 return desc;
94}
95
96/*******************************************************************************
97 * Helper to create a level 1/2/3 block descriptor which maps the va to addr
98 ******************************************************************************/
99static unsigned long create_block_desc(unsigned long desc,
100 unsigned long addr,
101 unsigned int level)
102{
103 switch (level) {
104 case LEVEL1:
105 desc |= (addr << FIRST_LEVEL_DESC_N) | BLOCK_DESC;
106 break;
107 case LEVEL2:
108 desc |= (addr << SECOND_LEVEL_DESC_N) | BLOCK_DESC;
109 break;
110 case LEVEL3:
111 desc |= (addr << THIRD_LEVEL_DESC_N) | TABLE_DESC;
112 break;
113 default:
114 assert(0);
115 }
116
117 return desc;
118}
119
120/*******************************************************************************
121 * Helper to create a level 1/2/3 block descriptor which maps the va to output_
122 * addr with Device nGnRE attributes.
123 ******************************************************************************/
124static unsigned long create_device_block(unsigned long output_addr,
125 unsigned int level,
126 unsigned int ns)
127{
128 unsigned long upper_attrs, lower_attrs, desc;
129
130 lower_attrs = LOWER_ATTRS(ACCESS_FLAG | OSH | AP_RW);
131 lower_attrs |= LOWER_ATTRS(ns | ATTR_DEVICE_INDEX);
132 upper_attrs = UPPER_ATTRS(XN);
133 desc = upper_attrs | lower_attrs;
134
135 return create_block_desc(desc, output_addr, level);
136}
137
138/*******************************************************************************
139 * Helper to create a level 1/2/3 block descriptor which maps the va to output_
140 * addr with inner-shareable normal wbwa read-only memory attributes.
141 ******************************************************************************/
142static unsigned long create_romem_block(unsigned long output_addr,
143 unsigned int level,
144 unsigned int ns)
145{
146 unsigned long upper_attrs, lower_attrs, desc;
147
148 lower_attrs = LOWER_ATTRS(ACCESS_FLAG | ISH | AP_RO);
149 lower_attrs |= LOWER_ATTRS(ns | ATTR_IWBWA_OWBWA_NTR_INDEX);
150 upper_attrs = UPPER_ATTRS(0ull);
151 desc = upper_attrs | lower_attrs;
152
153 return create_block_desc(desc, output_addr, level);
154}
155
156/*******************************************************************************
157 * Helper to create a level 1/2/3 block descriptor which maps the va to output_
158 * addr with inner-shareable normal wbwa read-write memory attributes.
159 ******************************************************************************/
160static unsigned long create_rwmem_block(unsigned long output_addr,
161 unsigned int level,
162 unsigned int ns)
163{
164 unsigned long upper_attrs, lower_attrs, desc;
165
166 lower_attrs = LOWER_ATTRS(ACCESS_FLAG | ISH | AP_RW);
167 lower_attrs |= LOWER_ATTRS(ns | ATTR_IWBWA_OWBWA_NTR_INDEX);
168 upper_attrs = UPPER_ATTRS(XN);
169 desc = upper_attrs | lower_attrs;
170
171 return create_block_desc(desc, output_addr, level);
172}
173
174/*******************************************************************************
175 * Create page tables as per the platform memory map. Certain aspects of page
176 * talble creating have been abstracted in the above routines. This can be impr-
177 * oved further.
178 * TODO: Move the page table setup helpers into the arch or lib directory
179 *******************************************************************************/
180static unsigned long fill_xlation_tables(meminfo *tzram_layout,
181 unsigned long ro_start,
182 unsigned long ro_limit,
183 unsigned long coh_start,
184 unsigned long coh_limit)
185{
186 unsigned long l2_desc, l3_desc;
187 unsigned long *xt_addr = 0, *pt_addr, off = 0;
188 unsigned long trom_start_index, trom_end_index;
189 unsigned long tzram_start_index, tzram_end_index;
190 unsigned long flash0_start_index, flash0_end_index;
191 unsigned long flash1_start_index, flash1_end_index;
192 unsigned long vram_start_index, vram_end_index;
193 unsigned long nsram_start_index, nsram_end_index;
194 unsigned long tdram_start_index, tdram_end_index;
195 unsigned long dram_start_index, dram_end_index;
196 unsigned long dev0_start_index, dev0_end_index;
197 unsigned long dev1_start_index, dev1_end_index;
198 unsigned int idx;
199
200
201 /*****************************************************************
202 * LEVEL1 PAGETABLE SETUP
203 *
204 * Find the start and end indices of the memory peripherals in the
205 * first level pagetables. These are the main areas we care about.
206 * Also bump the end index by one if its equal to the start to
207 * allow for regions which lie completely in a GB.
208 *****************************************************************/
209 trom_start_index = ONE_GB_INDEX(TZROM_BASE);
210 dev0_start_index = ONE_GB_INDEX(TZRNG_BASE);
211 dram_start_index = ONE_GB_INDEX(DRAM_BASE);
212 dram_end_index = ONE_GB_INDEX(DRAM_BASE + DRAM_SIZE);
213
214 if (dram_end_index == dram_start_index)
215 dram_end_index++;
216
217 /*
218 * Fill up the level1 translation table first
219 */
220 for (idx = 0; idx < (ADDR_SPACE_SIZE >> 30); idx++) {
221
222 /*
223 * Fill up the entry for the TZROM. This will cover
224 * everything in the first GB.
225 */
226 if (idx == trom_start_index) {
227 xt_addr = &l2_xlation_table[GB1_L2_PAGETABLE][0];
228 l1_xlation_table[idx] = create_table_desc(xt_addr);
229 continue;
230 }
231
232 /*
233 * Mark the second gb as device
234 */
235 if (idx == dev0_start_index) {
236 xt_addr = &l2_xlation_table[GB2_L2_PAGETABLE][0];
237 l1_xlation_table[idx] = create_table_desc(xt_addr);
238 continue;
239 }
240
241 /*
242 * Fill up the block entry for the DRAM with Normal
243 * inner-WBWA outer-WBWA non-transient attributes.
244 * This will cover 2-4GB. Note that the acesses are
245 * marked as non-secure.
246 */
247 if ((idx >= dram_start_index) && (idx < dram_end_index)) {
248 l1_xlation_table[idx] = create_rwmem_block(idx, LEVEL1,
249 NS);
250 continue;
251 }
252
253 assert(0);
254 }
255
256
257 /*****************************************************************
258 * LEVEL2 PAGETABLE SETUP
259 *
260 * Find the start and end indices of the memory & peripherals in the
261 * second level pagetables.
262 ******************************************************************/
263
264 /* Initializations for the 1st GB */
265 trom_start_index = TWO_MB_INDEX(TZROM_BASE);
266 trom_end_index = TWO_MB_INDEX(TZROM_BASE + TZROM_SIZE);
267 if (trom_end_index == trom_start_index)
268 trom_end_index++;
269
270 tdram_start_index = TWO_MB_INDEX(TZDRAM_BASE);
271 tdram_end_index = TWO_MB_INDEX(TZDRAM_BASE + TZDRAM_SIZE);
272 if (tdram_end_index == tdram_start_index)
273 tdram_end_index++;
274
275 flash0_start_index = TWO_MB_INDEX(FLASH0_BASE);
276 flash0_end_index = TWO_MB_INDEX(FLASH0_BASE + TZROM_SIZE);
277 if (flash0_end_index == flash0_start_index)
278 flash0_end_index++;
279
280 flash1_start_index = TWO_MB_INDEX(FLASH1_BASE);
281 flash1_end_index = TWO_MB_INDEX(FLASH1_BASE + FLASH1_SIZE);
282 if (flash1_end_index == flash1_start_index)
283 flash1_end_index++;
284
285 vram_start_index = TWO_MB_INDEX(VRAM_BASE);
286 vram_end_index = TWO_MB_INDEX(VRAM_BASE + VRAM_SIZE);
287 if (vram_end_index == vram_start_index)
288 vram_end_index++;
289
290 dev0_start_index = TWO_MB_INDEX(DEVICE0_BASE);
291 dev0_end_index = TWO_MB_INDEX(DEVICE0_BASE + DEVICE0_SIZE);
292 if (dev0_end_index == dev0_start_index)
293 dev0_end_index++;
294
295 dev1_start_index = TWO_MB_INDEX(DEVICE1_BASE);
296 dev1_end_index = TWO_MB_INDEX(DEVICE1_BASE + DEVICE1_SIZE);
297 if (dev1_end_index == dev1_start_index)
298 dev1_end_index++;
299
300 /* Since the size is < 2M this is a single index */
301 tzram_start_index = TWO_MB_INDEX(tzram_layout->total_base);
302 nsram_start_index = TWO_MB_INDEX(NSRAM_BASE);
303
304 /*
305 * Fill up the level2 translation table for the first GB next
306 */
307 for (idx = 0; idx < NUM_2MB_IN_GB; idx++) {
308
309 l2_desc = INVALID_DESC;
310 xt_addr = &l2_xlation_table[GB1_L2_PAGETABLE][idx];
311
312 /* Block entries for 64M of trusted Boot ROM */
313 if ((idx >= trom_start_index) && (idx < trom_end_index))
314 l2_desc = create_romem_block(idx, LEVEL2, 0);
315
316 /* Single L3 page table entry for 256K of TZRAM */
317 if (idx == tzram_start_index) {
318 pt_addr = &l3_xlation_table[TZRAM_PAGETABLE][0];
319 l2_desc = create_table_desc(pt_addr);
320 }
321
322 /* Block entries for 32M of trusted DRAM */
323 if ((idx >= tdram_start_index) && (idx <= tdram_end_index))
324 l2_desc = create_rwmem_block(idx, LEVEL2, 0);
325
326 /* Block entries for 64M of aliased trusted Boot ROM */
327 if ((idx >= flash0_start_index) && (idx < flash0_end_index))
328 l2_desc = create_romem_block(idx, LEVEL2, 0);
329
330 /* Block entries for 64M of flash1 */
331 if ((idx >= flash1_start_index) && (idx < flash1_end_index))
332 l2_desc = create_romem_block(idx, LEVEL2, 0);
333
334 /* Block entries for 32M of VRAM */
335 if ((idx >= vram_start_index) && (idx < vram_end_index))
336 l2_desc = create_rwmem_block(idx, LEVEL2, 0);
337
338 /* Block entries for all the devices in the first gb */
339 if ((idx >= dev0_start_index) && (idx < dev0_end_index))
340 l2_desc = create_device_block(idx, LEVEL2, 0);
341
342 /* Block entries for all the devices in the first gb */
343 if ((idx >= dev1_start_index) && (idx < dev1_end_index))
344 l2_desc = create_device_block(idx, LEVEL2, 0);
345
346 /* Single L3 page table entry for 64K of NSRAM */
347 if (idx == nsram_start_index) {
348 pt_addr = &l3_xlation_table[NSRAM_PAGETABLE][0];
349 l2_desc = create_table_desc(pt_addr);
350 }
351
352 *xt_addr = l2_desc;
353 }
354
355
356 /*
357 * Initializations for the 2nd GB. Mark everything as device
358 * for the time being as the memory map is not final. Each
359 * index will need to be offset'ed to allow absolute values
360 */
361 off = NUM_2MB_IN_GB;
362 for (idx = off; idx < (NUM_2MB_IN_GB + off); idx++) {
363 l2_desc = create_device_block(idx, LEVEL2, 0);
364 xt_addr = &l2_xlation_table[GB2_L2_PAGETABLE][idx - off];
365 *xt_addr = l2_desc;
366 }
367
368
369 /*****************************************************************
370 * LEVEL3 PAGETABLE SETUP
Achin Gupta4f6ad662013-10-25 09:08:21 +0100371 *****************************************************************/
372
373 /* Fill up the level3 pagetable for the trusted SRAM. */
374 tzram_start_index = FOUR_KB_INDEX(tzram_layout->total_base);
375 tzram_end_index = FOUR_KB_INDEX(tzram_layout->total_base +
376 tzram_layout->total_size);
377 if (tzram_end_index == tzram_start_index)
378 tzram_end_index++;
379
Sandrine Bailleux8d69a032013-11-27 09:38:52 +0000380 /* Reusing trom* to mark RO memory. */
Achin Gupta4f6ad662013-10-25 09:08:21 +0100381 trom_start_index = FOUR_KB_INDEX(ro_start);
382 trom_end_index = FOUR_KB_INDEX(ro_limit);
383 if (trom_end_index == trom_start_index)
384 trom_end_index++;
385
Sandrine Bailleux8d69a032013-11-27 09:38:52 +0000386 /* Reusing dev* to mark coherent device memory. */
Achin Gupta4f6ad662013-10-25 09:08:21 +0100387 dev0_start_index = FOUR_KB_INDEX(coh_start);
388 dev0_end_index = FOUR_KB_INDEX(coh_limit);
389 if (dev0_end_index == dev0_start_index)
390 dev0_end_index++;
391
392
393 /* Each index will need to be offset'ed to allow absolute values */
394 off = FOUR_KB_INDEX(TZRAM_BASE);
395 for (idx = off; idx < (NUM_4K_IN_2MB + off); idx++) {
396
397 l3_desc = INVALID_DESC;
398 xt_addr = &l3_xlation_table[TZRAM_PAGETABLE][idx - off];
399
400 if (idx >= tzram_start_index && idx < tzram_end_index)
401 l3_desc = create_rwmem_block(idx, LEVEL3, 0);
402
403 if (idx >= trom_start_index && idx < trom_end_index)
404 l3_desc = create_romem_block(idx, LEVEL3, 0);
405
406 if (idx >= dev0_start_index && idx < dev0_end_index)
407 l3_desc = create_device_block(idx, LEVEL3, 0);
408
409 *xt_addr = l3_desc;
410 }
411
412 /* Fill up the level3 pagetable for the non-trusted SRAM. */
413 nsram_start_index = FOUR_KB_INDEX(NSRAM_BASE);
414 nsram_end_index = FOUR_KB_INDEX(NSRAM_BASE + NSRAM_SIZE);
415 if (nsram_end_index == nsram_start_index)
416 nsram_end_index++;
417
418 /* Each index will need to be offset'ed to allow absolute values */
419 off = FOUR_KB_INDEX(NSRAM_BASE);
420 for (idx = off; idx < (NUM_4K_IN_2MB + off); idx++) {
421
422 l3_desc = INVALID_DESC;
423 xt_addr = &l3_xlation_table[NSRAM_PAGETABLE][idx - off];
424
425 if (idx >= nsram_start_index && idx < nsram_end_index)
426 l3_desc = create_rwmem_block(idx, LEVEL3, NS);
427
428 *xt_addr = l3_desc;
429 }
430
431 return (unsigned long) l1_xlation_table;
432}
433
434/*******************************************************************************
435 * Enable the MMU assuming that the pagetables have already been created
436 *******************************************************************************/
437void enable_mmu()
438{
439 unsigned long mair, tcr, ttbr, sctlr;
440 unsigned long current_el = read_current_el();
441
442 /* Set the attributes in the right indices of the MAIR */
443 mair = MAIR_ATTR_SET(ATTR_DEVICE, ATTR_DEVICE_INDEX);
444 mair |= MAIR_ATTR_SET(ATTR_IWBWA_OWBWA_NTR,
445 ATTR_IWBWA_OWBWA_NTR_INDEX);
446 write_mair(mair);
447
448 /*
449 * Set TCR bits as well. Inner & outer WBWA & shareable + T0SZ = 32
450 */
451 tcr = TCR_SH_INNER_SHAREABLE | TCR_RGN_OUTER_WBA |
452 TCR_RGN_INNER_WBA | TCR_T0SZ_4GB;
453 if (GET_EL(current_el) == MODE_EL3) {
454 tcr |= TCR_EL3_RES1;
Sandrine Bailleux295538b2013-11-15 14:46:44 +0000455 /* Invalidate EL3 TLBs */
Achin Gupta4f6ad662013-10-25 09:08:21 +0100456 tlbialle3();
457 } else {
458 /* Invalidate EL1 TLBs */
459 tlbivmalle1();
460 }
461
462 write_tcr(tcr);
463
464 /* Set TTBR bits as well */
465 assert(((unsigned long)l1_xlation_table & (sizeof(l1_xlation_table) - 1)) == 0);
466 ttbr = (unsigned long) l1_xlation_table;
467 write_ttbr0(ttbr);
468
469 sctlr = read_sctlr();
470 sctlr |= SCTLR_WXN_BIT | SCTLR_M_BIT | SCTLR_I_BIT;
471 sctlr |= SCTLR_A_BIT | SCTLR_C_BIT;
472 write_sctlr(sctlr);
473
474 return;
475}
476
477void disable_mmu(void)
478{
479 /* Zero out the MMU related registers */
480 write_mair(0);
481 write_tcr(0);
482 write_ttbr0(0);
483 write_sctlr(0);
484
Achin Gupta4f6ad662013-10-25 09:08:21 +0100485 /* Flush the caches */
486 dcsw_op_all(DCCISW);
487
488 return;
489}
490
491/*******************************************************************************
492 * Setup the pagetables as per the platform memory map & initialize the mmu
493 *******************************************************************************/
494void configure_mmu(meminfo *mem_layout,
495 unsigned long ro_start,
496 unsigned long ro_limit,
497 unsigned long coh_start,
498 unsigned long coh_limit)
499{
Sandrine Bailleux8d69a032013-11-27 09:38:52 +0000500 assert(IS_PAGE_ALIGNED(ro_start));
501 assert(IS_PAGE_ALIGNED(ro_limit));
502 assert(IS_PAGE_ALIGNED(coh_start));
503 assert(IS_PAGE_ALIGNED(coh_limit));
504
Achin Gupta4f6ad662013-10-25 09:08:21 +0100505 fill_xlation_tables(mem_layout,
506 ro_start,
507 ro_limit,
508 coh_start,
509 coh_limit);
510 enable_mmu();
511 return;
512}
513
514/* Simple routine which returns a configuration variable value */
515unsigned long platform_get_cfgvar(unsigned int var_id)
516{
517 assert(var_id < CONFIG_LIMIT);
518 return platform_config[var_id];
519}
520
521/*******************************************************************************
522 * A single boot loader stack is expected to work on both the Foundation FVP
523 * models and the two flavours of the Base FVP models (AEMv8 & Cortex). The
524 * SYS_ID register provides a mechanism for detecting the differences between
525 * these platforms. This information is stored in a per-BL array to allow the
526 * code to take the correct path.Per BL platform configuration.
527 ******************************************************************************/
528int platform_config_setup(void)
529{
530 unsigned int rev, hbi, bld, arch, sys_id, midr_pn;
531
532 sys_id = mmio_read_32(VE_SYSREGS_BASE + V2M_SYS_ID);
533 rev = (sys_id >> SYS_ID_REV_SHIFT) & SYS_ID_REV_MASK;
534 hbi = (sys_id >> SYS_ID_HBI_SHIFT) & SYS_ID_HBI_MASK;
535 bld = (sys_id >> SYS_ID_BLD_SHIFT) & SYS_ID_BLD_MASK;
536 arch = (sys_id >> SYS_ID_ARCH_SHIFT) & SYS_ID_ARCH_MASK;
537
James Morrissey40a6f642014-02-10 14:24:36 +0000538 if ((rev != REV_FVP) || (arch != ARCH_MODEL))
539 panic();
Achin Gupta4f6ad662013-10-25 09:08:21 +0100540
541 /*
542 * The build field in the SYS_ID tells which variant of the GIC
543 * memory is implemented by the model.
544 */
545 switch (bld) {
546 case BLD_GIC_VE_MMAP:
547 platform_config[CONFIG_GICD_ADDR] = VE_GICD_BASE;
548 platform_config[CONFIG_GICC_ADDR] = VE_GICC_BASE;
549 platform_config[CONFIG_GICH_ADDR] = VE_GICH_BASE;
550 platform_config[CONFIG_GICV_ADDR] = VE_GICV_BASE;
551 break;
552 case BLD_GIC_A53A57_MMAP:
553 platform_config[CONFIG_GICD_ADDR] = BASE_GICD_BASE;
554 platform_config[CONFIG_GICC_ADDR] = BASE_GICC_BASE;
555 platform_config[CONFIG_GICH_ADDR] = BASE_GICH_BASE;
556 platform_config[CONFIG_GICV_ADDR] = BASE_GICV_BASE;
557 break;
558 default:
559 assert(0);
560 }
561
562 /*
563 * The hbi field in the SYS_ID is 0x020 for the Base FVP & 0x010
564 * for the Foundation FVP.
565 */
566 switch (hbi) {
567 case HBI_FOUNDATION:
568 platform_config[CONFIG_MAX_AFF0] = 4;
569 platform_config[CONFIG_MAX_AFF1] = 1;
570 platform_config[CONFIG_CPU_SETUP] = 0;
571 platform_config[CONFIG_BASE_MMAP] = 0;
Harry Liebel30affd52013-10-30 17:41:48 +0000572 platform_config[CONFIG_HAS_CCI] = 0;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100573 break;
574 case HBI_FVP_BASE:
575 midr_pn = (read_midr() >> MIDR_PN_SHIFT) & MIDR_PN_MASK;
576 if ((midr_pn == MIDR_PN_A57) || (midr_pn == MIDR_PN_A53))
577 platform_config[CONFIG_CPU_SETUP] = 1;
578 else
579 platform_config[CONFIG_CPU_SETUP] = 0;
580
581 platform_config[CONFIG_MAX_AFF0] = 4;
582 platform_config[CONFIG_MAX_AFF1] = 2;
583 platform_config[CONFIG_BASE_MMAP] = 1;
Harry Liebel30affd52013-10-30 17:41:48 +0000584 platform_config[CONFIG_HAS_CCI] = 1;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100585 break;
586 default:
587 assert(0);
588 }
589
590 return 0;
591}
592
Ian Spray84687392014-01-02 16:57:12 +0000593unsigned long plat_get_ns_image_entrypoint(void)
594{
Achin Gupta4f6ad662013-10-25 09:08:21 +0100595 return NS_IMAGE_OFFSET;
596}