Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 8 | #ifndef PLAT_MARVELL_H |
| 9 | #define PLAT_MARVELL_H |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 10 | |
| 11 | #include <cassert.h> |
| 12 | #include <cpu_data.h> |
| 13 | #include <stdint.h> |
| 14 | #include <utils.h> |
| 15 | #include <xlat_tables.h> |
| 16 | |
| 17 | /* |
| 18 | * Extern declarations common to Marvell standard platforms |
| 19 | */ |
| 20 | extern const mmap_region_t plat_marvell_mmap[]; |
| 21 | |
| 22 | #define MARVELL_CASSERT_MMAP \ |
| 23 | CASSERT((ARRAY_SIZE(plat_marvell_mmap) + MARVELL_BL_REGIONS) \ |
| 24 | <= MAX_MMAP_REGIONS, \ |
| 25 | assert_max_mmap_regions) |
| 26 | |
Antonio Nino Diaz | 7966221 | 2018-09-24 17:15:46 +0100 | [diff] [blame] | 27 | struct marvell_bl31_params { |
| 28 | param_header_t h; |
| 29 | image_info_t *bl31_image_info; |
| 30 | entry_point_info_t *bl32_ep_info; |
| 31 | image_info_t *bl32_image_info; |
| 32 | entry_point_info_t *bl33_ep_info; |
| 33 | image_info_t *bl33_image_info; |
| 34 | }; |
| 35 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 36 | /* |
| 37 | * Utility functions common to Marvell standard platforms |
| 38 | */ |
| 39 | void marvell_setup_page_tables(uintptr_t total_base, |
| 40 | size_t total_size, |
| 41 | uintptr_t code_start, |
| 42 | uintptr_t code_limit, |
| 43 | uintptr_t rodata_start, |
| 44 | uintptr_t rodata_limit |
| 45 | #if USE_COHERENT_MEM |
| 46 | , uintptr_t coh_start, |
| 47 | uintptr_t coh_limit |
| 48 | #endif |
| 49 | ); |
| 50 | |
Konstantin Porotchkin | d8e3957 | 2018-11-14 17:15:08 +0200 | [diff] [blame] | 51 | /* Console utility functions */ |
| 52 | void marvell_console_boot_init(void); |
| 53 | void marvell_console_boot_end(void); |
| 54 | void marvell_console_runtime_init(void); |
| 55 | void marvell_console_runtime_end(void); |
| 56 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 57 | /* IO storage utility functions */ |
| 58 | void marvell_io_setup(void); |
| 59 | |
| 60 | /* Systimer utility function */ |
| 61 | void marvell_configure_sys_timer(void); |
| 62 | |
| 63 | /* Topology utility function */ |
| 64 | int marvell_check_mpidr(u_register_t mpidr); |
| 65 | |
| 66 | /* BLE utility functions */ |
| 67 | int ble_plat_setup(int *skip); |
| 68 | void plat_marvell_dram_update_topology(void); |
| 69 | void ble_plat_pcie_ep_setup(void); |
| 70 | struct pci_hw_cfg *plat_get_pcie_hw_data(void); |
| 71 | |
| 72 | /* BL1 utility functions */ |
| 73 | void marvell_bl1_early_platform_setup(void); |
| 74 | void marvell_bl1_platform_setup(void); |
| 75 | void marvell_bl1_plat_arch_setup(void); |
| 76 | |
| 77 | /* BL2 utility functions */ |
| 78 | void marvell_bl2_early_platform_setup(meminfo_t *mem_layout); |
| 79 | void marvell_bl2_platform_setup(void); |
| 80 | void marvell_bl2_plat_arch_setup(void); |
| 81 | uint32_t marvell_get_spsr_for_bl32_entry(void); |
| 82 | uint32_t marvell_get_spsr_for_bl33_entry(void); |
| 83 | |
| 84 | /* BL31 utility functions */ |
Antonio Nino Diaz | 7966221 | 2018-09-24 17:15:46 +0100 | [diff] [blame] | 85 | void marvell_bl31_early_platform_setup(void *from_bl2, |
Konstantin Porotchkin | acb1dc1 | 2018-08-19 10:07:35 +0300 | [diff] [blame] | 86 | uintptr_t soc_fw_config, |
| 87 | uintptr_t hw_config, |
| 88 | void *plat_params_from_bl2); |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 89 | void marvell_bl31_platform_setup(void); |
| 90 | void marvell_bl31_plat_runtime_setup(void); |
| 91 | void marvell_bl31_plat_arch_setup(void); |
| 92 | |
| 93 | /* Power management config to power off the SoC */ |
| 94 | void *plat_marvell_get_pm_cfg(void); |
| 95 | |
| 96 | /* Check if MSS AP CM3 firmware contains PM support */ |
| 97 | _Bool is_pm_fw_running(void); |
| 98 | |
| 99 | /* Bootrom image recovery utility functions */ |
| 100 | void *plat_marvell_get_skip_image_data(void); |
| 101 | |
| 102 | /* FIP TOC validity check */ |
| 103 | int marvell_io_is_toc_valid(void); |
| 104 | |
| 105 | /* |
| 106 | * PSCI functionality |
| 107 | */ |
| 108 | void marvell_psci_arch_init(int ap_idx); |
| 109 | void plat_marvell_system_reset(void); |
| 110 | |
| 111 | /* |
Marcin Wojtas | 0c60c2f | 2018-03-21 09:59:59 +0100 | [diff] [blame] | 112 | * Miscellaneous platform SMC routines |
| 113 | */ |
| 114 | #ifdef MVEBU_PMU_IRQ_WA |
| 115 | void mvebu_pmu_interrupt_enable(void); |
| 116 | void mvebu_pmu_interrupt_disable(void); |
| 117 | #endif |
| 118 | |
| 119 | /* |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 120 | * Optional functions required in Marvell standard platforms |
| 121 | */ |
| 122 | void plat_marvell_io_setup(void); |
| 123 | int plat_marvell_get_alt_image_source( |
| 124 | unsigned int image_id, |
| 125 | uintptr_t *dev_handle, |
| 126 | uintptr_t *image_spec); |
| 127 | unsigned int plat_marvell_calc_core_pos(u_register_t mpidr); |
| 128 | |
| 129 | const mmap_region_t *plat_marvell_get_mmap(void); |
| 130 | void marvell_ble_prepare_exit(void); |
| 131 | void marvell_exit_bootrom(uintptr_t base); |
| 132 | |
| 133 | int plat_marvell_early_cpu_powerdown(void); |
Grzegorz Jaszczyk | 62c2486 | 2018-10-04 09:44:56 +0200 | [diff] [blame] | 134 | int bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info); |
| 135 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 136 | #endif /* PLAT_MARVELL_H */ |