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