Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 1 | /* |
Ambroise Vincent | 09a22e7 | 2019-05-29 14:04:16 +0100 | [diff] [blame] | 2 | * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. |
Varun Wadekar | b5b15b2 | 2018-05-17 10:10:25 -0700 | [diff] [blame] | 3 | * Copyright (c) 2020, NVIDIA Corporation. All rights reserved. |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 4 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 5 | * SPDX-License-Identifier: BSD-3-Clause |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 6 | */ |
| 7 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 8 | #ifndef TEGRA_PRIVATE_H |
| 9 | #define TEGRA_PRIVATE_H |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 10 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | #include <platform_def.h> |
Varun Wadekar | 8d7a02b | 2018-06-26 16:07:50 -0700 | [diff] [blame] | 12 | #include <stdbool.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 14 | #include <arch.h> |
Varun Wadekar | 9f4a7d3 | 2018-10-19 11:42:28 -0700 | [diff] [blame] | 15 | #include <arch_helpers.h> |
Ambroise Vincent | 09a22e7 | 2019-05-29 14:04:16 +0100 | [diff] [blame] | 16 | #include <drivers/ti/uart/uart_16550.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 17 | #include <lib/psci/psci.h> |
| 18 | #include <lib/xlat_tables/xlat_tables_v2.h> |
| 19 | |
Varun Wadekar | 9f4a7d3 | 2018-10-19 11:42:28 -0700 | [diff] [blame] | 20 | #include <tegra_gic.h> |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 21 | |
Varun Wadekar | 7a269e2 | 2015-06-10 14:04:32 +0530 | [diff] [blame] | 22 | /******************************************************************************* |
Steven Kao | d417cea | 2017-06-14 14:02:23 +0800 | [diff] [blame] | 23 | * Implementation defined ACTLR_EL1 bit definitions |
| 24 | ******************************************************************************/ |
| 25 | #define ACTLR_EL1_PMSTATE_MASK (ULL(0xF) << 0) |
| 26 | |
| 27 | /******************************************************************************* |
| 28 | * Implementation defined ACTLR_EL2 bit definitions |
| 29 | ******************************************************************************/ |
| 30 | #define ACTLR_EL2_PMSTATE_MASK (ULL(0xF) << 0) |
| 31 | |
| 32 | /******************************************************************************* |
Varun Wadekar | b7b4575 | 2015-12-28 14:55:41 -0800 | [diff] [blame] | 33 | * Struct for parameters received from BL2 |
| 34 | ******************************************************************************/ |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 35 | typedef struct plat_params_from_bl2 { |
Varun Wadekar | 6bb6246 | 2015-10-06 12:49:31 +0530 | [diff] [blame] | 36 | /* TZ memory size */ |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 37 | uint64_t tzdram_size; |
Varun Wadekar | 6bb6246 | 2015-10-06 12:49:31 +0530 | [diff] [blame] | 38 | /* TZ memory base */ |
| 39 | uint64_t tzdram_base; |
Varun Wadekar | d2014c6 | 2015-10-29 10:37:28 +0530 | [diff] [blame] | 40 | /* UART port ID */ |
Varun Wadekar | fda095f | 2019-01-02 10:48:18 -0800 | [diff] [blame] | 41 | int32_t uart_id; |
Harvey Hsieh | fbdfce1 | 2016-11-23 19:13:08 +0800 | [diff] [blame] | 42 | /* L2 ECC parity protection disable flag */ |
Varun Wadekar | fda095f | 2019-01-02 10:48:18 -0800 | [diff] [blame] | 43 | int32_t l2_ecc_parity_prot_dis; |
Varun Wadekar | 4967c3d | 2017-07-21 13:34:16 -0700 | [diff] [blame] | 44 | /* SHMEM base address for storing the boot logs */ |
| 45 | uint64_t boot_profiler_shmem_base; |
Varun Wadekar | f07d6de | 2018-02-27 14:33:57 -0800 | [diff] [blame] | 46 | /* System Suspend Entry Firmware size */ |
| 47 | uint64_t sc7entry_fw_size; |
| 48 | /* System Suspend Entry Firmware base address */ |
| 49 | uint64_t sc7entry_fw_base; |
Kalyani Chidambaram | fcd1e88 | 2018-09-12 14:59:08 -0700 | [diff] [blame] | 50 | /* Enable dual execution */ |
| 51 | uint8_t enable_ccplex_lock_step; |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 52 | } plat_params_from_bl2_t; |
| 53 | |
Varun Wadekar | dc79930 | 2015-12-28 16:36:42 -0800 | [diff] [blame] | 54 | /******************************************************************************* |
Harvey Hsieh | fbdfce1 | 2016-11-23 19:13:08 +0800 | [diff] [blame] | 55 | * Helper function to access l2ctlr_el1 register on Cortex-A57 CPUs |
| 56 | ******************************************************************************/ |
| 57 | DEFINE_RENAME_SYSREG_RW_FUNCS(l2ctlr_el1, CORTEX_A57_L2CTLR_EL1) |
| 58 | |
| 59 | /******************************************************************************* |
Antonio Nino Diaz | 6bf7c6b | 2018-09-24 17:16:05 +0100 | [diff] [blame] | 60 | * Struct describing parameters passed to bl31 |
| 61 | ******************************************************************************/ |
| 62 | struct tegra_bl31_params { |
| 63 | param_header_t h; |
| 64 | image_info_t *bl31_image_info; |
| 65 | entry_point_info_t *bl32_ep_info; |
| 66 | image_info_t *bl32_image_info; |
| 67 | entry_point_info_t *bl33_ep_info; |
| 68 | image_info_t *bl33_image_info; |
| 69 | }; |
| 70 | |
Varun Wadekar | d4a698f | 2019-08-26 10:20:53 -0700 | [diff] [blame] | 71 | /******************************************************************************* |
| 72 | * To suppress Coverity MISRA C-2012 Rule 2.2 violations |
| 73 | *******************************************************************************/ |
| 74 | #define UNUSED_FUNC_NOP() asm("nop") |
| 75 | |
Varun Wadekar | 254441d | 2015-07-23 10:07:54 +0530 | [diff] [blame] | 76 | /* Declarations for plat_psci_handlers.c */ |
Anthony Zhou | 5d1bb05 | 2017-03-03 16:23:08 +0800 | [diff] [blame] | 77 | int32_t tegra_soc_validate_power_state(uint32_t power_state, |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 78 | psci_power_state_t *req_state); |
Varun Wadekar | 254441d | 2015-07-23 10:07:54 +0530 | [diff] [blame] | 79 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 80 | /* Declarations for plat_setup.c */ |
| 81 | const mmap_region_t *plat_get_mmio_map(void); |
Varun Wadekar | 9d15f7e | 2019-08-21 14:01:31 -0700 | [diff] [blame] | 82 | void plat_enable_console(int32_t id); |
Varun Wadekar | b7b4575 | 2015-12-28 14:55:41 -0800 | [diff] [blame] | 83 | void plat_gic_setup(void); |
Antonio Nino Diaz | 6bf7c6b | 2018-09-24 17:16:05 +0100 | [diff] [blame] | 84 | struct tegra_bl31_params *plat_get_bl31_params(void); |
Varun Wadekar | d22d4ad | 2016-05-23 11:41:07 -0700 | [diff] [blame] | 85 | plat_params_from_bl2_t *plat_get_bl31_plat_params(void); |
Dilan Lee | 1f66f3d | 2017-10-27 09:51:09 +0800 | [diff] [blame] | 86 | void plat_early_platform_setup(void); |
| 87 | void plat_late_platform_setup(void); |
Varun Wadekar | 0ed6270 | 2018-06-20 14:30:59 -0700 | [diff] [blame] | 88 | void plat_relocate_bl32_image(const image_info_t *bl32_img_info); |
Varun Wadekar | 8d7a02b | 2018-06-26 16:07:50 -0700 | [diff] [blame] | 89 | bool plat_supports_system_suspend(void); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 90 | |
| 91 | /* Declarations for plat_secondary.c */ |
| 92 | void plat_secondary_setup(void); |
Anthony Zhou | faad346 | 2017-03-21 15:50:09 +0800 | [diff] [blame] | 93 | int32_t plat_lock_cpu_vectors(void); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 94 | |
Varun Wadekar | dc79930 | 2015-12-28 16:36:42 -0800 | [diff] [blame] | 95 | /* Declarations for tegra_fiq_glue.c */ |
| 96 | void tegra_fiq_handler_setup(void); |
David Pu | 70f6597 | 2019-03-18 15:14:49 -0700 | [diff] [blame] | 97 | int32_t tegra_fiq_get_intr_context(void); |
Varun Wadekar | dc79930 | 2015-12-28 16:36:42 -0800 | [diff] [blame] | 98 | void tegra_fiq_set_ns_entrypoint(uint64_t entrypoint); |
| 99 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 100 | /* Declarations for tegra_security.c */ |
| 101 | void tegra_security_setup(void); |
| 102 | void tegra_security_setup_videomem(uintptr_t base, uint64_t size); |
| 103 | |
| 104 | /* Declarations for tegra_pm.c */ |
| 105 | void tegra_pm_system_suspend_entry(void); |
| 106 | void tegra_pm_system_suspend_exit(void); |
Anthony Zhou | 85a8fa0 | 2017-03-22 14:42:42 +0800 | [diff] [blame] | 107 | int32_t tegra_system_suspended(void); |
Varun Wadekar | b3421ce | 2017-12-27 18:10:12 -0800 | [diff] [blame] | 108 | int32_t tegra_soc_cpu_standby(plat_local_state_t cpu_state); |
Anthony Zhou | 85a8fa0 | 2017-03-22 14:42:42 +0800 | [diff] [blame] | 109 | int32_t tegra_soc_pwr_domain_suspend(const psci_power_state_t *target_state); |
| 110 | int32_t tegra_soc_pwr_domain_on(u_register_t mpidr); |
| 111 | int32_t tegra_soc_pwr_domain_off(const psci_power_state_t *target_state); |
| 112 | int32_t tegra_soc_pwr_domain_on_finish(const psci_power_state_t *target_state); |
| 113 | int32_t tegra_soc_pwr_domain_power_down_wfi(const psci_power_state_t *target_state); |
Varun Wadekar | b5b15b2 | 2018-05-17 10:10:25 -0700 | [diff] [blame] | 114 | int32_t tegra_soc_pwr_domain_suspend_pwrdown_early(const psci_power_state_t *target_state); |
Anthony Zhou | 85a8fa0 | 2017-03-22 14:42:42 +0800 | [diff] [blame] | 115 | int32_t tegra_soc_prepare_system_reset(void); |
| 116 | __dead2 void tegra_soc_prepare_system_off(void); |
| 117 | plat_local_state_t tegra_soc_get_target_pwr_state(uint32_t lvl, |
| 118 | const plat_local_state_t *states, |
| 119 | uint32_t ncpu); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 120 | |
| 121 | /* Declarations for tegraXXX_pm.c */ |
| 122 | int tegra_prepare_cpu_suspend(unsigned int id, unsigned int afflvl); |
| 123 | int tegra_prepare_cpu_on_finish(unsigned long mpidr); |
| 124 | |
| 125 | /* Declarations for tegra_bl31_setup.c */ |
| 126 | plat_params_from_bl2_t *bl31_get_plat_params(void); |
Varun Wadekar | fda095f | 2019-01-02 10:48:18 -0800 | [diff] [blame] | 127 | int32_t bl31_check_ns_address(uint64_t base, uint64_t size_in_bytes); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 128 | |
Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 129 | /* Declarations for tegra_delay_timer.c */ |
| 130 | void tegra_delay_timer_init(void); |
| 131 | |
Varun Wadekar | 93bed2a | 2016-03-18 13:07:33 -0700 | [diff] [blame] | 132 | void tegra_secure_entrypoint(void); |
Varun Wadekar | 93bed2a | 2016-03-18 13:07:33 -0700 | [diff] [blame] | 133 | |
Anthony Zhou | e5bd345 | 2017-03-01 12:47:37 +0800 | [diff] [blame] | 134 | /* Declarations for tegra_sip_calls.c */ |
| 135 | uintptr_t tegra_sip_handler(uint32_t smc_fid, |
| 136 | u_register_t x1, |
| 137 | u_register_t x2, |
| 138 | u_register_t x3, |
| 139 | u_register_t x4, |
| 140 | void *cookie, |
| 141 | void *handle, |
| 142 | u_register_t flags); |
| 143 | int plat_sip_handler(uint32_t smc_fid, |
| 144 | uint64_t x1, |
| 145 | uint64_t x2, |
| 146 | uint64_t x3, |
| 147 | uint64_t x4, |
| 148 | const void *cookie, |
| 149 | void *handle, |
| 150 | uint64_t flags); |
| 151 | |
David Pu | 70f6597 | 2019-03-18 15:14:49 -0700 | [diff] [blame] | 152 | #if RAS_EXTENSION |
| 153 | void tegra194_ras_enable(void); |
David Pu | c3f8815 | 2019-06-07 15:30:17 -0700 | [diff] [blame] | 154 | void tegra194_ras_corrected_err_clear(uint64_t *cookie); |
David Pu | 70f6597 | 2019-03-18 15:14:49 -0700 | [diff] [blame] | 155 | #endif |
| 156 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 157 | #endif /* TEGRA_PRIVATE_H */ |