blob: 0267e08c4984c4f5fd5995d393b1421ad4ee5397 [file] [log] [blame]
Varun Wadekar08438e22015-05-19 16:48:04 +05301/*
Anthony Zhou50e91632017-03-13 15:34:08 +08002 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
Varun Wadekar08438e22015-05-19 16:48:04 +05303 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekar08438e22015-05-19 16:48:04 +05305 */
6
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +00007#ifndef TEGRA_PRIVATE_H
8#define TEGRA_PRIVATE_H
Varun Wadekar08438e22015-05-19 16:48:04 +05309
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000010#include <platform_def.h>
11
Varun Wadekar71cb26e2015-08-07 10:03:00 +053012#include <arch.h>
Varun Wadekar80c50ee2018-10-19 11:42:28 -070013#include <arch_helpers.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000014#include <lib/psci/psci.h>
15#include <lib/xlat_tables/xlat_tables_v2.h>
16
Varun Wadekar80c50ee2018-10-19 11:42:28 -070017#include <tegra_gic.h>
Varun Wadekar08438e22015-05-19 16:48:04 +053018
Varun Wadekar9a964512015-06-10 14:04:32 +053019/*******************************************************************************
20 * Tegra DRAM memory base address
21 ******************************************************************************/
Varun Wadekar70cb6922017-04-24 14:17:12 -070022#define TEGRA_DRAM_BASE ULL(0x80000000)
23#define TEGRA_DRAM_END ULL(0x27FFFFFFF)
Varun Wadekar9a964512015-06-10 14:04:32 +053024
Varun Wadekard3360302015-12-28 14:55:41 -080025/*******************************************************************************
26 * Struct for parameters received from BL2
27 ******************************************************************************/
Varun Wadekar08438e22015-05-19 16:48:04 +053028typedef struct plat_params_from_bl2 {
Varun Wadekare0d41582015-10-06 12:49:31 +053029 /* TZ memory size */
Varun Wadekar08438e22015-05-19 16:48:04 +053030 uint64_t tzdram_size;
Varun Wadekare0d41582015-10-06 12:49:31 +053031 /* TZ memory base */
32 uint64_t tzdram_base;
Varun Wadekare1084212015-10-29 10:37:28 +053033 /* UART port ID */
34 int uart_id;
Harvey Hsiehb4957912016-11-23 19:13:08 +080035 /* L2 ECC parity protection disable flag */
36 int l2_ecc_parity_prot_dis;
Varun Wadekar08438e22015-05-19 16:48:04 +053037} plat_params_from_bl2_t;
38
Varun Wadekar78e2bd102015-12-28 16:36:42 -080039/*******************************************************************************
Harvey Hsiehb4957912016-11-23 19:13:08 +080040 * Helper function to access l2ctlr_el1 register on Cortex-A57 CPUs
41 ******************************************************************************/
42DEFINE_RENAME_SYSREG_RW_FUNCS(l2ctlr_el1, CORTEX_A57_L2CTLR_EL1)
43
44/*******************************************************************************
Antonio Nino Diazfdcc1122018-09-24 17:16:05 +010045 * Struct describing parameters passed to bl31
46 ******************************************************************************/
47struct tegra_bl31_params {
48 param_header_t h;
49 image_info_t *bl31_image_info;
50 entry_point_info_t *bl32_ep_info;
51 image_info_t *bl32_image_info;
52 entry_point_info_t *bl33_ep_info;
53 image_info_t *bl33_image_info;
54};
55
Varun Wadekar93eafbc2015-07-23 10:07:54 +053056/* Declarations for plat_psci_handlers.c */
Anthony Zhou214e84642017-03-03 16:23:08 +080057int32_t tegra_soc_validate_power_state(uint32_t power_state,
Varun Wadekar71cb26e2015-08-07 10:03:00 +053058 psci_power_state_t *req_state);
Varun Wadekar93eafbc2015-07-23 10:07:54 +053059
Varun Wadekar08438e22015-05-19 16:48:04 +053060/* Declarations for plat_setup.c */
61const mmap_region_t *plat_get_mmio_map(void);
Varun Wadekare1084212015-10-29 10:37:28 +053062uint32_t plat_get_console_from_id(int id);
Varun Wadekard3360302015-12-28 14:55:41 -080063void plat_gic_setup(void);
Antonio Nino Diazfdcc1122018-09-24 17:16:05 +010064struct tegra_bl31_params *plat_get_bl31_params(void);
Varun Wadekar8ab06d22016-05-23 11:41:07 -070065plat_params_from_bl2_t *plat_get_bl31_plat_params(void);
Varun Wadekar08438e22015-05-19 16:48:04 +053066
67/* Declarations for plat_secondary.c */
68void plat_secondary_setup(void);
Anthony Zhou592035d2017-03-21 15:50:09 +080069int32_t plat_lock_cpu_vectors(void);
Varun Wadekar08438e22015-05-19 16:48:04 +053070
Varun Wadekar78e2bd102015-12-28 16:36:42 -080071/* Declarations for tegra_fiq_glue.c */
72void tegra_fiq_handler_setup(void);
73int tegra_fiq_get_intr_context(void);
74void tegra_fiq_set_ns_entrypoint(uint64_t entrypoint);
75
Varun Wadekar08438e22015-05-19 16:48:04 +053076/* Declarations for tegra_security.c */
77void tegra_security_setup(void);
78void tegra_security_setup_videomem(uintptr_t base, uint64_t size);
79
80/* Declarations for tegra_pm.c */
Vignesh Radhakrishnana9e02602017-03-03 10:58:05 -080081extern uint8_t tegra_fake_system_suspend;
82
Varun Wadekar08438e22015-05-19 16:48:04 +053083void tegra_pm_system_suspend_entry(void);
84void tegra_pm_system_suspend_exit(void);
85int tegra_system_suspended(void);
86
87/* Declarations for tegraXXX_pm.c */
88int tegra_prepare_cpu_suspend(unsigned int id, unsigned int afflvl);
89int tegra_prepare_cpu_on_finish(unsigned long mpidr);
90
91/* Declarations for tegra_bl31_setup.c */
92plat_params_from_bl2_t *bl31_get_plat_params(void);
Varun Wadekar9a964512015-06-10 14:04:32 +053093int bl31_check_ns_address(uint64_t base, uint64_t size_in_bytes);
Varun Wadekar5ea0b022016-03-28 15:56:47 -070094void plat_early_platform_setup(void);
Varun Wadekar08438e22015-05-19 16:48:04 +053095
Varun Wadekarc8961322015-07-16 15:47:03 +053096/* Declarations for tegra_delay_timer.c */
97void tegra_delay_timer_init(void);
98
Varun Wadekar68c7de62016-03-18 13:07:33 -070099void tegra_secure_entrypoint(void);
100void tegra186_cpu_reset_handler(void);
101
Anthony Zhou1d491122017-03-01 12:47:37 +0800102/* Declarations for tegra_sip_calls.c */
103uintptr_t tegra_sip_handler(uint32_t smc_fid,
104 u_register_t x1,
105 u_register_t x2,
106 u_register_t x3,
107 u_register_t x4,
108 void *cookie,
109 void *handle,
110 u_register_t flags);
111int plat_sip_handler(uint32_t smc_fid,
112 uint64_t x1,
113 uint64_t x2,
114 uint64_t x3,
115 uint64_t x4,
116 const void *cookie,
117 void *handle,
118 uint64_t flags);
119
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +0000120#endif /* TEGRA_PRIVATE_H */