Commit 5d52aea8 authored by Varun Wadekar's avatar Varun Wadekar
Browse files

Tegra: handler to check support for System Suspend



Tegra210 SoCs need the sc7entry-fw to enter System Suspend mode,
but there might be certain boards that do not have this firmware
blob. To stop the NS world from issuing System suspend entry
commands on such devices, we ned to disable System Suspend from
the PSCI "features".

This patch removes the System suspend handler from the Tegra PSCI
ops, so that the framework will disable support for "System Suspend"
from the PSCI "features".

Original change by: kalyani chidambaram <kalyanic@nvidia.com>

Change-Id: Ie029f82f55990a8b3a6debb73e95e0e218bfd1f5
Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent 21368290
...@@ -259,7 +259,7 @@ int32_t tegra_validate_ns_entrypoint(uintptr_t entrypoint) ...@@ -259,7 +259,7 @@ int32_t tegra_validate_ns_entrypoint(uintptr_t entrypoint)
/******************************************************************************* /*******************************************************************************
* Export the platform handlers to enable psci to invoke them * Export the platform handlers to enable psci to invoke them
******************************************************************************/ ******************************************************************************/
static const plat_psci_ops_t tegra_plat_psci_ops = { static plat_psci_ops_t tegra_plat_psci_ops = {
.cpu_standby = tegra_cpu_standby, .cpu_standby = tegra_cpu_standby,
.pwr_domain_on = tegra_pwr_domain_on, .pwr_domain_on = tegra_pwr_domain_on,
.pwr_domain_off = tegra_pwr_domain_off, .pwr_domain_off = tegra_pwr_domain_off,
...@@ -295,6 +295,14 @@ int plat_setup_psci_ops(uintptr_t sec_entrypoint, ...@@ -295,6 +295,14 @@ int plat_setup_psci_ops(uintptr_t sec_entrypoint,
*/ */
(void)tegra_soc_pwr_domain_on_finish(&target_state); (void)tegra_soc_pwr_domain_on_finish(&target_state);
/*
* Disable System Suspend if the platform does not
* support it
*/
if (!plat_supports_system_suspend()) {
tegra_plat_psci_ops.get_sys_suspend_power_state = NULL;
}
/* /*
* Initialize PSCI ops struct * Initialize PSCI ops struct
*/ */
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define TEGRA_PRIVATE_H #define TEGRA_PRIVATE_H
#include <platform_def.h> #include <platform_def.h>
#include <stdbool.h>
#include <arch.h> #include <arch.h>
#include <arch_helpers.h> #include <arch_helpers.h>
...@@ -78,6 +79,7 @@ plat_params_from_bl2_t *plat_get_bl31_plat_params(void); ...@@ -78,6 +79,7 @@ plat_params_from_bl2_t *plat_get_bl31_plat_params(void);
void plat_early_platform_setup(void); void plat_early_platform_setup(void);
void plat_late_platform_setup(void); void plat_late_platform_setup(void);
void plat_relocate_bl32_image(const image_info_t *bl32_img_info); void plat_relocate_bl32_image(const image_info_t *bl32_img_info);
bool plat_supports_system_suspend(void);
/* Declarations for plat_secondary.c */ /* Declarations for plat_secondary.c */
void plat_secondary_setup(void); void plat_secondary_setup(void);
......
...@@ -154,3 +154,11 @@ void plat_late_platform_setup(void) ...@@ -154,3 +154,11 @@ void plat_late_platform_setup(void)
{ {
; /* do nothing */ ; /* do nothing */
} }
/*******************************************************************************
* Handler to indicate support for System Suspend
******************************************************************************/
bool plat_supports_system_suspend(void)
{
return true;
}
...@@ -291,13 +291,16 @@ int32_t plat_core_pos_by_mpidr(u_register_t mpidr) ...@@ -291,13 +291,16 @@ int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
return ret; return ret;
} }
/*******************************************************************************
* Handler to relocate BL32 image to TZDRAM
******************************************************************************/
void plat_relocate_bl32_image(const image_info_t *bl32_img_info) void plat_relocate_bl32_image(const image_info_t *bl32_img_info)
{ {
const plat_params_from_bl2_t *plat_bl31_params = plat_get_bl31_plat_params(); const plat_params_from_bl2_t *plat_bl31_params = plat_get_bl31_plat_params();
const entry_point_info_t *bl32_ep_info = bl31_plat_get_next_image_ep_info(SECURE); const entry_point_info_t *bl32_ep_info = bl31_plat_get_next_image_ep_info(SECURE);
uint64_t tzdram_start, tzdram_end, bl32_start, bl32_end; uint64_t tzdram_start, tzdram_end, bl32_start, bl32_end;
if ((bl32_img_info != NULL) && (bl32_ep_info != NULL)) { if ((bl32_img_info != NULL) && (bl32_ep_info != NULL)) {
/* Relocate BL32 if it resides outside of the TZDRAM */ /* Relocate BL32 if it resides outside of the TZDRAM */
tzdram_start = plat_bl31_params->tzdram_base; tzdram_start = plat_bl31_params->tzdram_base;
...@@ -326,3 +329,11 @@ void plat_relocate_bl32_image(const image_info_t *bl32_img_info) ...@@ -326,3 +329,11 @@ void plat_relocate_bl32_image(const image_info_t *bl32_img_info)
} }
} }
} }
/*******************************************************************************
* Handler to indicate support for System Suspend
******************************************************************************/
bool plat_supports_system_suspend(void)
{
return true;
}
...@@ -304,6 +304,9 @@ plat_params_from_bl2_t *plat_get_bl31_plat_params(void) ...@@ -304,6 +304,9 @@ plat_params_from_bl2_t *plat_get_bl31_plat_params(void)
return (plat_params_from_bl2_t *)(uintptr_t)val; return (plat_params_from_bl2_t *)(uintptr_t)val;
} }
/*******************************************************************************
* Handler for late platform setup
******************************************************************************/
void plat_late_platform_setup(void) void plat_late_platform_setup(void)
{ {
#if ENABLE_STRICT_CHECKING_MODE #if ENABLE_STRICT_CHECKING_MODE
...@@ -314,3 +317,11 @@ void plat_late_platform_setup(void) ...@@ -314,3 +317,11 @@ void plat_late_platform_setup(void)
mce_enable_strict_checking(); mce_enable_strict_checking();
#endif #endif
} }
/*******************************************************************************
* Handler to indicate support for System Suspend
******************************************************************************/
bool plat_supports_system_suspend(void)
{
return true;
}
...@@ -262,3 +262,21 @@ void plat_gic_setup(void) ...@@ -262,3 +262,21 @@ void plat_gic_setup(void)
*/ */
tegra_fc_enable_fiq_to_ccplex_routing(); tegra_fc_enable_fiq_to_ccplex_routing();
} }
/*******************************************************************************
* Handler to indicate support for System Suspend
******************************************************************************/
bool plat_supports_system_suspend(void)
{
const plat_params_from_bl2_t *plat_params = bl31_get_plat_params();
/*
* sc7entry-fw is only supported by Tegra210 SoCs.
*/
if (!tegra_chipid_is_t210_b01() && (plat_params->sc7entry_fw_base != 0U)) {
return true;
} else if (tegra_chipid_is_t210_b01()) {
return true;
} else {
return false;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment