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
|
/** @file
*
* Copyright (c) 2014, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
* which accompanies this distribution. The full text of the license may be found at
* http://opensource.org/licenses/bsd-license.php
*
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
#include <arch_helpers.h>
#include <arm_gic.h>
#include <console.h>
#include <debug.h>
#include <io_storage.h>
#include <irq.h>
#include <nvm.h>
#include <platform.h>
#include <psci.h>
#include <stdio.h>
#include <string.h>
#include <tftf.h>
#include "juno_def.h"
#include "juno_private.h"
static struct {
unsigned cluster_id;
unsigned cpu_id;
} juno_cores[] = {
/* A53 Cluster: 4 cores*/
{ 1, 0 },
{ 1, 1 },
{ 1, 2 },
{ 1, 3 },
/* A57 Cluster: 2 cores */
{ 0, 0 },
{ 0, 1 },
};
/*
* Table of regions to map using the MMU.
*/
static const mmap_region_t tftf_mmap[] = {
{ DEVICE0_BASE, DEVICE0_BASE, DEVICE0_SIZE,
MT_DEVICE | MT_RW | MT_NS },
{ DEVICE1_BASE, DEVICE1_BASE, DEVICE1_SIZE,
MT_DEVICE | MT_RW | MT_NS },
#if USE_NVM
{ FLASH_BASE, FLASH_BASE, FLASH_SIZE, MT_DEVICE | MT_RW | MT_NS },
#endif
{ DRAM_BASE, DRAM_BASE, TFTF_BASE - DRAM_BASE,
MT_MEMORY | MT_RW | MT_NS },
{ TFTF_BASE, TFTF_BASE, L2_BLOCK_SIZE,
MT_MEMORY | MT_RO | MT_NS }, /* Program text */
{ TFTF_BASE + L2_BLOCK_SIZE, TFTF_BASE + L2_BLOCK_SIZE,
(DRAM_BASE + DRAM_SIZE) - (TFTF_BASE + L2_BLOCK_SIZE),
MT_MEMORY | MT_RW | MT_NS },
{0}
};
const mmap_region_t *tftf_platform_get_mmap(void)
{
return tftf_mmap;
}
unsigned int tftf_platform_core_pos_to_mpid(unsigned int core_pos)
{
unsigned int mpid = make_mpid(juno_cores[core_pos].cluster_id,
juno_cores[core_pos].cpu_id);
return mpid;
}
bool tftf_platform_is_core_pos_present(unsigned int core_pos)
{
unsigned int mpidr;
mpidr = tftf_platform_core_pos_to_mpid(core_pos);
return plat_get_aff_state(MPIDR_AFFLVL0, mpidr) == PSCI_AFF_PRESENT;
}
void tftf_platform_setup(void)
{
#if USE_NVM
int ret;
ret = juno_io_setup();
if (ret != IO_SUCCESS)
WARN("IO setup failed : 0x%x\n", ret);
#endif
/* Juno does not support GIC Redistributor a GICv3 feature */
arm_gic_init(GICC_BASE, GICD_BASE, 0);
tftf_register_gic_id();
arm_gic_setup();
juno_setup_topology();
}
void tftf_early_platform_setup(void)
{
console_init(PL011_UART2_BASE, PL011_UART2_CLK_IN_HZ, PL011_BAUDRATE);
}
void tftf_plat_arch_setup(void)
{
tftf_plat_configure_mmu();
}
|