blob: c96f00679df800fac4c986004076c640a394038a [file] [log] [blame]
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +03001/*
2 * Copyright (C) 2018 Marvell International Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 * https://spdx.org/licenses
6 */
7
8#include <bl1.h>
9#include <bl1/bl1_private.h>
10#include <bl_common.h>
11#include <console.h>
12#include <debug.h>
13#include <platform.h>
14#include <platform_def.h>
15#include <plat_marvell.h>
16#include <sp805.h>
17
18/* Weak definitions may be overridden in specific Marvell standard platform */
19#pragma weak bl1_early_platform_setup
20#pragma weak bl1_plat_arch_setup
21#pragma weak bl1_platform_setup
22#pragma weak bl1_plat_sec_mem_layout
23
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030024/* Data structure which holds the extents of the RAM for BL1*/
25static meminfo_t bl1_ram_layout;
26
27meminfo_t *bl1_plat_sec_mem_layout(void)
28{
29 return &bl1_ram_layout;
30}
31
32/*
33 * BL1 specific platform actions shared between Marvell standard platforms.
34 */
35void marvell_bl1_early_platform_setup(void)
36{
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030037 /* Initialize the console to provide early debug support */
Konstantin Porotchkind8e39572018-11-14 17:15:08 +020038 marvell_console_boot_init();
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030039
40 /* Allow BL1 to see the whole Trusted RAM */
41 bl1_ram_layout.total_base = MARVELL_BL_RAM_BASE;
42 bl1_ram_layout.total_size = MARVELL_BL_RAM_SIZE;
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030043}
44
45void bl1_early_platform_setup(void)
46{
47 marvell_bl1_early_platform_setup();
48}
49
50/*
51 * Perform the very early platform specific architecture setup shared between
52 * MARVELL standard platforms. This only does basic initialization. Later
53 * architectural setup (bl1_arch_setup()) does not do anything platform
54 * specific.
55 */
56void marvell_bl1_plat_arch_setup(void)
57{
58 marvell_setup_page_tables(bl1_ram_layout.total_base,
59 bl1_ram_layout.total_size,
60 BL1_RO_BASE,
61 BL1_RO_LIMIT,
62 BL1_RO_DATA_BASE,
63 BL1_RO_DATA_END
64#if USE_COHERENT_MEM
65 , BL_COHERENT_RAM_BASE,
66 BL_COHERENT_RAM_END
67#endif
68 );
69 enable_mmu_el3(0);
70}
71
72void bl1_plat_arch_setup(void)
73{
74 marvell_bl1_plat_arch_setup();
75}
76
77/*
78 * Perform the platform specific architecture setup shared between
79 * MARVELL standard platforms.
80 */
81void marvell_bl1_platform_setup(void)
82{
83 /* Initialise the IO layer and register platform IO devices */
84 plat_marvell_io_setup();
85}
86
87void bl1_platform_setup(void)
88{
89 marvell_bl1_platform_setup();
90}
91
92void bl1_plat_prepare_exit(entry_point_info_t *ep_info)
93{
94#ifdef EL3_PAYLOAD_BASE
95 /*
96 * Program the EL3 payload's entry point address into the CPUs mailbox
97 * in order to release secondary CPUs from their holding pen and make
98 * them jump there.
99 */
100 marvell_program_trusted_mailbox(ep_info->pc);
101 dsbsy();
102 sev();
103#endif
104}