blob: bec21a0dcfed2b74c976a3f948176b88685b6b82 [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
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00008#ifndef PLAT_MARVELL_H
9#define PLAT_MARVELL_H
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030010
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030011#include <stdint.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000012
Claus Pedersen785e66c2022-09-12 22:42:58 +000013#include <common/bl_common.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000014#include <lib/cassert.h>
15#include <lib/el3_runtime/cpu_data.h>
16#include <lib/utils.h>
Remi Pommarel7459e742019-07-14 20:34:28 +020017#include <lib/xlat_tables/xlat_tables_v2.h>
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030018
19/*
20 * Extern declarations common to Marvell standard platforms
21 */
22extern const mmap_region_t plat_marvell_mmap[];
23
24#define MARVELL_CASSERT_MMAP \
25 CASSERT((ARRAY_SIZE(plat_marvell_mmap) + MARVELL_BL_REGIONS) \
26 <= MAX_MMAP_REGIONS, \
27 assert_max_mmap_regions)
28
Antonio Nino Diaz79662212018-09-24 17:15:46 +010029struct marvell_bl31_params {
30 param_header_t h;
31 image_info_t *bl31_image_info;
32 entry_point_info_t *bl32_ep_info;
33 image_info_t *bl32_image_info;
34 entry_point_info_t *bl33_ep_info;
35 image_info_t *bl33_image_info;
36};
37
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030038/*
39 * Utility functions common to Marvell standard platforms
40 */
41void marvell_setup_page_tables(uintptr_t total_base,
42 size_t total_size,
43 uintptr_t code_start,
44 uintptr_t code_limit,
45 uintptr_t rodata_start,
46 uintptr_t rodata_limit
47#if USE_COHERENT_MEM
48 , uintptr_t coh_start,
49 uintptr_t coh_limit
50#endif
51);
52
Konstantin Porotchkind8e39572018-11-14 17:15:08 +020053/* Console utility functions */
54void marvell_console_boot_init(void);
55void marvell_console_boot_end(void);
56void marvell_console_runtime_init(void);
57void marvell_console_runtime_end(void);
58
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030059/* IO storage utility functions */
60void marvell_io_setup(void);
61
62/* Systimer utility function */
63void marvell_configure_sys_timer(void);
64
65/* Topology utility function */
66int marvell_check_mpidr(u_register_t mpidr);
67
68/* BLE utility functions */
69int ble_plat_setup(int *skip);
70void plat_marvell_dram_update_topology(void);
71void ble_plat_pcie_ep_setup(void);
72struct pci_hw_cfg *plat_get_pcie_hw_data(void);
73
74/* BL1 utility functions */
75void marvell_bl1_early_platform_setup(void);
76void marvell_bl1_platform_setup(void);
77void marvell_bl1_plat_arch_setup(void);
78
79/* BL2 utility functions */
80void marvell_bl2_early_platform_setup(meminfo_t *mem_layout);
81void marvell_bl2_platform_setup(void);
82void marvell_bl2_plat_arch_setup(void);
83uint32_t marvell_get_spsr_for_bl32_entry(void);
84uint32_t marvell_get_spsr_for_bl33_entry(void);
85
86/* BL31 utility functions */
Antonio Nino Diaz79662212018-09-24 17:15:46 +010087void marvell_bl31_early_platform_setup(void *from_bl2,
Konstantin Porotchkinacb1dc12018-08-19 10:07:35 +030088 uintptr_t soc_fw_config,
89 uintptr_t hw_config,
90 void *plat_params_from_bl2);
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030091void marvell_bl31_platform_setup(void);
92void marvell_bl31_plat_runtime_setup(void);
93void marvell_bl31_plat_arch_setup(void);
94
95/* Power management config to power off the SoC */
96void *plat_marvell_get_pm_cfg(void);
97
98/* Check if MSS AP CM3 firmware contains PM support */
99_Bool is_pm_fw_running(void);
100
101/* Bootrom image recovery utility functions */
102void *plat_marvell_get_skip_image_data(void);
103
104/* FIP TOC validity check */
105int marvell_io_is_toc_valid(void);
106
107/*
108 * PSCI functionality
109 */
110void marvell_psci_arch_init(int ap_idx);
111void plat_marvell_system_reset(void);
112
113/*
Marcin Wojtas0c60c2f2018-03-21 09:59:59 +0100114 * Miscellaneous platform SMC routines
115 */
116#ifdef MVEBU_PMU_IRQ_WA
117void mvebu_pmu_interrupt_enable(void);
118void mvebu_pmu_interrupt_disable(void);
119#endif
120
121/*
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300122 * Optional functions required in Marvell standard platforms
123 */
124void plat_marvell_io_setup(void);
125int plat_marvell_get_alt_image_source(
126 unsigned int image_id,
127 uintptr_t *dev_handle,
128 uintptr_t *image_spec);
129unsigned int plat_marvell_calc_core_pos(u_register_t mpidr);
130
131const mmap_region_t *plat_marvell_get_mmap(void);
132void marvell_ble_prepare_exit(void);
133void marvell_exit_bootrom(uintptr_t base);
134
135int plat_marvell_early_cpu_powerdown(void);
Grzegorz Jaszczyk62c24862018-10-04 09:44:56 +0200136int bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info);
137
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000138#endif /* PLAT_MARVELL_H */