Commit 0f426f8f authored by Anthony Zhou's avatar Anthony Zhou Committed by Varun Wadekar
Browse files

Tegra186: mce: remove unused type conversions



This patch removes unused type conversions as all the relevant macros
now use U()/ULL(), making these explicit typecasts unnecessary.

Change-Id: I01fb534649db2aaf186406b1aef6897662b44fe3
Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
parent 53ea1585
...@@ -99,9 +99,9 @@ static int32_t ari_request_wait(uint32_t ari_base, uint32_t evt_mask, uint32_t r ...@@ -99,9 +99,9 @@ static int32_t ari_request_wait(uint32_t ari_base, uint32_t evt_mask, uint32_t r
ret = 0; ret = 0;
} else { } else {
/* For shutdown/reboot commands, we dont have to check for timeouts */ /* For shutdown/reboot commands, we dont have to check for timeouts */
if ((req == (uint32_t)TEGRA_ARI_MISC_CCPLEX) && if ((req == TEGRA_ARI_MISC_CCPLEX) &&
((lo == (uint32_t)TEGRA_ARI_MISC_CCPLEX_SHUTDOWN_POWER_OFF) || ((lo == TEGRA_ARI_MISC_CCPLEX_SHUTDOWN_POWER_OFF) ||
(lo == (uint32_t)TEGRA_ARI_MISC_CCPLEX_SHUTDOWN_REBOOT))) { (lo == TEGRA_ARI_MISC_CCPLEX_SHUTDOWN_REBOOT))) {
ret = 0; ret = 0;
} else { } else {
/* /*
...@@ -161,38 +161,38 @@ int32_t ari_update_cstate_info(uint32_t ari_base, uint32_t cluster, uint32_t ccp ...@@ -161,38 +161,38 @@ int32_t ari_update_cstate_info(uint32_t ari_base, uint32_t cluster, uint32_t ccp
uint32_t system, uint8_t sys_state_force, uint32_t wake_mask, uint32_t system, uint8_t sys_state_force, uint32_t wake_mask,
uint8_t update_wake_mask) uint8_t update_wake_mask)
{ {
uint32_t val = 0U; uint64_t val = 0U;
/* clean the previous response state */ /* clean the previous response state */
ari_clobber_response(ari_base); ari_clobber_response(ari_base);
/* update CLUSTER_CSTATE? */ /* update CLUSTER_CSTATE? */
if (cluster != 0U) { if (cluster != 0U) {
val |= (cluster & (uint32_t)CLUSTER_CSTATE_MASK) | val |= (cluster & CLUSTER_CSTATE_MASK) |
(uint32_t)CLUSTER_CSTATE_UPDATE_BIT; CLUSTER_CSTATE_UPDATE_BIT;
} }
/* update CCPLEX_CSTATE? */ /* update CCPLEX_CSTATE? */
if (ccplex != 0U) { if (ccplex != 0U) {
val |= ((ccplex & (uint32_t)CCPLEX_CSTATE_MASK) << (uint32_t)CCPLEX_CSTATE_SHIFT) | val |= ((ccplex & CCPLEX_CSTATE_MASK) << CCPLEX_CSTATE_SHIFT) |
(uint32_t)CCPLEX_CSTATE_UPDATE_BIT; CCPLEX_CSTATE_UPDATE_BIT;
} }
/* update SYSTEM_CSTATE? */ /* update SYSTEM_CSTATE? */
if (system != 0U) { if (system != 0U) {
val |= ((system & (uint32_t)SYSTEM_CSTATE_MASK) << (uint32_t)SYSTEM_CSTATE_SHIFT) | val |= ((system & SYSTEM_CSTATE_MASK) << SYSTEM_CSTATE_SHIFT) |
(((uint32_t)sys_state_force << SYSTEM_CSTATE_FORCE_UPDATE_SHIFT) | (((uint64_t)sys_state_force << SYSTEM_CSTATE_FORCE_UPDATE_SHIFT) |
(uint32_t)SYSTEM_CSTATE_UPDATE_BIT); SYSTEM_CSTATE_UPDATE_BIT);
} }
/* update wake mask value? */ /* update wake mask value? */
if (update_wake_mask != 0U) { if (update_wake_mask != 0U) {
val |= (uint32_t)CSTATE_WAKE_MASK_UPDATE_BIT; val |= CSTATE_WAKE_MASK_UPDATE_BIT;
} }
/* set the updated cstate info */ /* set the updated cstate info */
return ari_request_wait(ari_base, 0U, TEGRA_ARI_UPDATE_CSTATE_INFO, val, return ari_request_wait(ari_base, 0U, TEGRA_ARI_UPDATE_CSTATE_INFO,
wake_mask); (uint32_t)val, wake_mask);
} }
int32_t ari_update_crossover_time(uint32_t ari_base, uint32_t type, uint32_t time) int32_t ari_update_crossover_time(uint32_t ari_base, uint32_t type, uint32_t time)
...@@ -299,10 +299,8 @@ int32_t ari_is_sc7_allowed(uint32_t ari_base, uint32_t state, uint32_t wake_time ...@@ -299,10 +299,8 @@ int32_t ari_is_sc7_allowed(uint32_t ari_base, uint32_t state, uint32_t wake_time
int32_t ret, result; int32_t ret, result;
/* check for allowed power state */ /* check for allowed power state */
if ((state != TEGRA_ARI_CORE_C0) && if ((state != TEGRA_ARI_CORE_C0) && (state != TEGRA_ARI_CORE_C1) &&
(state != TEGRA_ARI_CORE_C1) && (state != TEGRA_ARI_CORE_C6) && (state != TEGRA_ARI_CORE_C7)) {
(state != TEGRA_ARI_CORE_C6) &&
(state != TEGRA_ARI_CORE_C7)) {
ERROR("%s: unknown cstate (%d)\n", __func__, state); ERROR("%s: unknown cstate (%d)\n", __func__, state);
result = EINVAL; result = EINVAL;
} else { } else {
...@@ -325,12 +323,10 @@ int32_t ari_is_sc7_allowed(uint32_t ari_base, uint32_t state, uint32_t wake_time ...@@ -325,12 +323,10 @@ int32_t ari_is_sc7_allowed(uint32_t ari_base, uint32_t state, uint32_t wake_time
int32_t ari_online_core(uint32_t ari_base, uint32_t core) int32_t ari_online_core(uint32_t ari_base, uint32_t core)
{ {
uint64_t cpu = read_mpidr() & (uint64_t)(MPIDR_CPU_MASK); uint64_t cpu = read_mpidr() & (MPIDR_CPU_MASK);
uint64_t cluster = (read_mpidr() & ((uint64_t)(MPIDR_AFFLVL_MASK) << uint64_t cluster = (read_mpidr() & (MPIDR_CLUSTER_MASK)) >>
(uint64_t)(MPIDR_AFFINITY_BITS))) >> (MPIDR_AFFINITY_BITS);
(uint64_t)(MPIDR_AFFINITY_BITS); uint64_t impl = (read_midr() >> MIDR_IMPL_SHIFT) & MIDR_IMPL_MASK;
uint64_t impl = (read_midr() >> (uint64_t)MIDR_IMPL_SHIFT) &
(uint64_t)MIDR_IMPL_MASK;
int32_t ret; int32_t ret;
/* construct the current CPU # */ /* construct the current CPU # */
...@@ -344,8 +340,7 @@ int32_t ari_online_core(uint32_t ari_base, uint32_t core) ...@@ -344,8 +340,7 @@ int32_t ari_online_core(uint32_t ari_base, uint32_t core)
/* /*
* The Denver cluster has 2 CPUs only - 0, 1. * The Denver cluster has 2 CPUs only - 0, 1.
*/ */
if ((impl == (uint32_t)DENVER_IMPL) && if ((impl == DENVER_IMPL) && ((core == 2U) || (core == 3U))) {
((core == 2U) || (core == 3U))) {
ERROR("%s: unknown core id (%d)\n", __func__, core); ERROR("%s: unknown core id (%d)\n", __func__, core);
ret = EINVAL; ret = EINVAL;
} else { } else {
...@@ -467,7 +462,7 @@ int32_t ari_update_ccplex_gsc(uint32_t ari_base, uint32_t gsc_idx) ...@@ -467,7 +462,7 @@ int32_t ari_update_ccplex_gsc(uint32_t ari_base, uint32_t gsc_idx)
{ {
int32_t ret = 0; int32_t ret = 0;
/* sanity check GSC ID */ /* sanity check GSC ID */
if (gsc_idx > (uint32_t)TEGRA_ARI_GSC_VPR_IDX) { if (gsc_idx > TEGRA_ARI_GSC_VPR_IDX) {
ret = EINVAL; ret = EINVAL;
} else { } else {
/* clean the previous response state */ /* clean the previous response state */
......
...@@ -111,8 +111,8 @@ static mce_config_t mce_cfg_table[MCE_ARI_APERTURES_MAX] = { ...@@ -111,8 +111,8 @@ static mce_config_t mce_cfg_table[MCE_ARI_APERTURES_MAX] = {
static uint32_t mce_get_curr_cpu_ari_base(void) static uint32_t mce_get_curr_cpu_ari_base(void)
{ {
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint64_t cpuid = mpidr & (uint64_t)MPIDR_CPU_MASK; uint64_t cpuid = mpidr & MPIDR_CPU_MASK;
uint64_t impl = (read_midr() >> (uint64_t)MIDR_IMPL_SHIFT) & (uint64_t)MIDR_IMPL_MASK; uint64_t impl = (read_midr() >> MIDR_IMPL_SHIFT) & MIDR_IMPL_MASK;
/* /*
* T186 has 2 CPU clusters, one with Denver CPUs and the other with * T186 has 2 CPU clusters, one with Denver CPUs and the other with
...@@ -131,9 +131,9 @@ static uint32_t mce_get_curr_cpu_ari_base(void) ...@@ -131,9 +131,9 @@ static uint32_t mce_get_curr_cpu_ari_base(void)
static arch_mce_ops_t *mce_get_curr_cpu_ops(void) static arch_mce_ops_t *mce_get_curr_cpu_ops(void)
{ {
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint64_t cpuid = mpidr & (uint64_t)MPIDR_CPU_MASK; uint64_t cpuid = mpidr & MPIDR_CPU_MASK;
uint64_t impl = (read_midr() >> (uint64_t)MIDR_IMPL_SHIFT) & uint64_t impl = (read_midr() >> MIDR_IMPL_SHIFT) &
(uint64_t)MIDR_IMPL_MASK; MIDR_IMPL_MASK;
/* /*
* T186 has 2 CPU clusters, one with Denver CPUs and the other with * T186 has 2 CPU clusters, one with Denver CPUs and the other with
...@@ -180,17 +180,17 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -180,17 +180,17 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
* get the parameters required for the update cstate info * get the parameters required for the update cstate info
* command * command
*/ */
arg3 = read_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X4)); arg3 = read_ctx_reg(gp_regs, CTX_GPREG_X4);
arg4 = read_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X5)); arg4 = read_ctx_reg(gp_regs, CTX_GPREG_X5);
arg5 = read_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X6)); arg5 = read_ctx_reg(gp_regs, CTX_GPREG_X6);
ret = ops->update_cstate_info(cpu_ari_base, (uint32_t)arg0, ret = ops->update_cstate_info(cpu_ari_base, (uint32_t)arg0,
(uint32_t)arg1, (uint32_t)arg2, (uint8_t)arg3, (uint32_t)arg1, (uint32_t)arg2, (uint8_t)arg3,
(uint32_t)arg4, (uint8_t)arg5); (uint32_t)arg4, (uint8_t)arg5);
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X4), (0)); write_ctx_reg(gp_regs, CTX_GPREG_X4, (0ULL));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X5), (0)); write_ctx_reg(gp_regs, CTX_GPREG_X5, (0ULL));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X6), (0)); write_ctx_reg(gp_regs, CTX_GPREG_X6, (0ULL));
break; break;
...@@ -203,8 +203,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -203,8 +203,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
ret64 = ops->read_cstate_stats(cpu_ari_base, arg0); ret64 = ops->read_cstate_stats(cpu_ari_base, arg0);
/* update context to return cstate stats value */ /* update context to return cstate stats value */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X1, (ret64));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X2), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X2, (ret64));
break; break;
...@@ -217,8 +217,7 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -217,8 +217,7 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
ret = ops->is_ccx_allowed(cpu_ari_base, arg0, arg1); ret = ops->is_ccx_allowed(cpu_ari_base, arg0, arg1);
/* update context to return CCx status value */ /* update context to return CCx status value */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), write_ctx_reg(gp_regs, CTX_GPREG_X1, (uint64_t)(ret));
(uint64_t)(ret));
break; break;
...@@ -226,10 +225,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -226,10 +225,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
ret = ops->is_sc7_allowed(cpu_ari_base, arg0, arg1); ret = ops->is_sc7_allowed(cpu_ari_base, arg0, arg1);
/* update context to return SC7 status value */ /* update context to return SC7 status value */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), write_ctx_reg(gp_regs, CTX_GPREG_X1, (uint64_t)(ret));
(uint64_t)(ret)); write_ctx_reg(gp_regs, CTX_GPREG_X3, (uint64_t)(ret));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X3),
(uint64_t)(ret));
break; break;
...@@ -248,10 +245,10 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -248,10 +245,10 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
arg0); arg0);
/* update context to return if echo'd data matched source */ /* update context to return if echo'd data matched source */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), write_ctx_reg(gp_regs, CTX_GPREG_X1, ((ret64 == arg0) ?
((ret64 == arg0) ? 1ULL : 0ULL)); 1ULL : 0ULL));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X2), write_ctx_reg(gp_regs, CTX_GPREG_X2, ((ret64 == arg0) ?
((ret64 == arg0) ? 1ULL : 0ULL)); 1ULL : 0ULL));
break; break;
...@@ -263,10 +260,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -263,10 +260,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
* version = minor(63:32) | major(31:0). Update context * version = minor(63:32) | major(31:0). Update context
* to return major and minor version number. * to return major and minor version number.
*/ */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), write_ctx_reg(gp_regs, CTX_GPREG_X1, (ret64));
(ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X2, (ret64 >> 32ULL));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X2),
(ret64 >> 32ULL));
break; break;
...@@ -275,7 +270,7 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -275,7 +270,7 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
TEGRA_ARI_MISC_FEATURE_LEAF_0, arg0); TEGRA_ARI_MISC_FEATURE_LEAF_0, arg0);
/* update context to return features value */ /* update context to return features value */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X1, (ret64));
break; break;
...@@ -298,9 +293,9 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -298,9 +293,9 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
ret64 = ops->read_write_mca(cpu_ari_base, arg0, &arg1); ret64 = ops->read_write_mca(cpu_ari_base, arg0, &arg1);
/* update context to return MCA data/error */ /* update context to return MCA data/error */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X1, (ret64));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X2), (arg1)); write_ctx_reg(gp_regs, CTX_GPREG_X2, (arg1));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X3), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X3, (ret64));
break; break;
...@@ -308,8 +303,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -308,8 +303,8 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
ret64 = ops->read_write_mca(cpu_ari_base, arg0, &arg1); ret64 = ops->read_write_mca(cpu_ari_base, arg0, &arg1);
/* update context to return MCA error */ /* update context to return MCA error */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X1, (ret64));
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X3), (ret64)); write_ctx_reg(gp_regs, CTX_GPREG_X3, (ret64));
break; break;
...@@ -336,7 +331,7 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1, ...@@ -336,7 +331,7 @@ int32_t mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
ret = ops->read_write_uncore_perfmon(cpu_ari_base, arg0, &arg1); ret = ops->read_write_uncore_perfmon(cpu_ari_base, arg0, &arg1);
/* update context to return data */ /* update context to return data */
write_ctx_reg((gp_regs), (uint32_t)(CTX_GPREG_X1), (arg1)); write_ctx_reg(gp_regs, CTX_GPREG_X1, (arg1));
break; break;
case MCE_CMD_MISC_CCPLEX: case MCE_CMD_MISC_CCPLEX:
......
...@@ -200,15 +200,14 @@ int32_t nvg_is_sc7_allowed(uint32_t ari_base, uint32_t state, uint32_t wake_time ...@@ -200,15 +200,14 @@ int32_t nvg_is_sc7_allowed(uint32_t ari_base, uint32_t state, uint32_t wake_time
int32_t nvg_online_core(uint32_t ari_base, uint32_t core) int32_t nvg_online_core(uint32_t ari_base, uint32_t core)
{ {
uint64_t cpu = read_mpidr() & (uint64_t)MPIDR_CPU_MASK; uint64_t cpu = read_mpidr() & MPIDR_CPU_MASK;
uint64_t impl = (read_midr() >> (uint64_t)MIDR_IMPL_SHIFT) & uint64_t impl = (read_midr() >> MIDR_IMPL_SHIFT) & MIDR_IMPL_MASK;
(uint64_t)MIDR_IMPL_MASK;
int32_t ret = 0; int32_t ret = 0;
(void)ari_base; (void)ari_base;
/* sanity check code id */ /* sanity check code id */
if ((core >= (uint32_t)MCE_CORE_ID_MAX) || (cpu == core)) { if ((core >= MCE_CORE_ID_MAX) || (cpu == core)) {
ERROR("%s: unsupported core id (%d)\n", __func__, core); ERROR("%s: unsupported core id (%d)\n", __func__, core);
ret = EINVAL; ret = EINVAL;
} else { } else {
......
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