mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
fix(zynqmp): typecast operands to match data type
This corrects the MISRA violation C2012-10.3: The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category. The condition is explicitly checked against 0U, appending 'U' and typecasting for unsigned comparison. Change-Id: I141fbc554265173df0ca90c2ddc7f28137c6b0f1 Signed-off-by: Nithin G <nithing@amd.com> Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
This commit is contained in:
parent
3dc93e5139
commit
6ae9562473
10 changed files with 306 additions and 305 deletions
|
@ -333,7 +333,7 @@ int32_t plat_get_soc_version(void)
|
|||
|
||||
int32_t plat_get_soc_revision(void)
|
||||
{
|
||||
return mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_IDCODE_OFFSET);
|
||||
return (int32_t)mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_IDCODE_OFFSET);
|
||||
}
|
||||
|
||||
static uint32_t zynqmp_get_ps_ver(void)
|
||||
|
|
|
@ -59,7 +59,7 @@ static inline void bl31_set_default_config(void)
|
|||
bl32_image_ep_info.pc = BL32_BASE;
|
||||
bl32_image_ep_info.spsr = arm_get_spsr_for_bl32_entry();
|
||||
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
|
||||
bl33_image_ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
|
||||
bl33_image_ep_info.spsr = (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,
|
||||
DISABLE_ALL_EXCEPTIONS);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,5 +18,5 @@ int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
|
|||
return -1;
|
||||
}
|
||||
|
||||
return zynqmp_calc_core_pos(mpidr);
|
||||
return (int32_t)zynqmp_calc_core_pos(mpidr);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -703,7 +703,7 @@ enum pm_ret_status tfa_ioctl_bitmask(uint32_t *bit_mask)
|
|||
IOCTL_AFI,
|
||||
};
|
||||
uint8_t i, ioctl_id;
|
||||
int32_t ret;
|
||||
enum pm_ret_status ret;
|
||||
|
||||
for (i = 0U; i < ARRAY_SIZE(supported_ids); i++) {
|
||||
ioctl_id = supported_ids[i];
|
||||
|
|
|
@ -2058,7 +2058,7 @@ enum pm_ret_status pm_api_pinctrl_get_function_groups(uint32_t fid,
|
|||
if ((grps + index + i) >= end_of_grp_offset) {
|
||||
break;
|
||||
}
|
||||
groups[i] = (grps + index + i);
|
||||
groups[i] = (uint16_t)(grps + index + i);
|
||||
}
|
||||
|
||||
return PM_RET_SUCCESS;
|
||||
|
|
|
@ -46,22 +46,22 @@ static uint32_t suspend_mode = PM_SUSPEND_MODE_STD;
|
|||
/* Order in pm_procs_all array must match cpu ids */
|
||||
static const struct pm_proc pm_procs_all[] = {
|
||||
{
|
||||
.node_id = NODE_APU_0,
|
||||
.node_id = (uint32_t)NODE_APU_0,
|
||||
.pwrdn_mask = APU_0_PWRCTL_CPUPWRDWNREQ_MASK,
|
||||
.ipi = &apu_ipi,
|
||||
},
|
||||
{
|
||||
.node_id = NODE_APU_1,
|
||||
.node_id = (uint32_t)NODE_APU_1,
|
||||
.pwrdn_mask = APU_1_PWRCTL_CPUPWRDWNREQ_MASK,
|
||||
.ipi = &apu_ipi,
|
||||
},
|
||||
{
|
||||
.node_id = NODE_APU_2,
|
||||
.node_id = (uint32_t)NODE_APU_2,
|
||||
.pwrdn_mask = APU_2_PWRCTL_CPUPWRDWNREQ_MASK,
|
||||
.ipi = &apu_ipi,
|
||||
},
|
||||
{
|
||||
.node_id = NODE_APU_3,
|
||||
.node_id = (uint32_t)NODE_APU_3,
|
||||
.pwrdn_mask = APU_3_PWRCTL_CPUPWRDWNREQ_MASK,
|
||||
.ipi = &apu_ipi,
|
||||
},
|
||||
|
@ -206,9 +206,10 @@ static void pm_client_set_wakeup_sources(void)
|
|||
|
||||
while (reg != 0U) {
|
||||
enum pm_node_id node;
|
||||
uint32_t idx, ret, irq, lowest_set = reg & (-reg);
|
||||
uint32_t idx, irq, lowest_set = reg & (-reg);
|
||||
enum pm_ret_status ret;
|
||||
|
||||
idx = __builtin_ctz(lowest_set);
|
||||
idx = (uint32_t)__builtin_ctz(lowest_set);
|
||||
irq = base_irq + idx;
|
||||
|
||||
if (irq > IRQ_MAX) {
|
||||
|
|
|
@ -51,164 +51,164 @@ typedef struct __attribute__((packed)) {
|
|||
/* Dependent APIs for TF-A to check their version from firmware */
|
||||
static const eemi_api_dependency api_dep_table[] = {
|
||||
{
|
||||
.id = PM_SELF_SUSPEND,
|
||||
.api_id = PM_SELF_SUSPEND,
|
||||
.id = (uint8_t)PM_SELF_SUSPEND,
|
||||
.api_id = (uint8_t)PM_SELF_SUSPEND,
|
||||
},
|
||||
{
|
||||
.id = PM_REQ_WAKEUP,
|
||||
.api_id = PM_REQ_WAKEUP,
|
||||
.id = (uint8_t)PM_REQ_WAKEUP,
|
||||
.api_id = (uint8_t)PM_REQ_WAKEUP,
|
||||
},
|
||||
{
|
||||
.id = PM_ABORT_SUSPEND,
|
||||
.api_id = PM_ABORT_SUSPEND,
|
||||
.id = (uint8_t)PM_ABORT_SUSPEND,
|
||||
.api_id = (uint8_t)PM_ABORT_SUSPEND,
|
||||
},
|
||||
{
|
||||
.id = PM_SET_WAKEUP_SOURCE,
|
||||
.api_id = PM_SET_WAKEUP_SOURCE,
|
||||
.id = (uint8_t)PM_SET_WAKEUP_SOURCE,
|
||||
.api_id = (uint8_t)PM_SET_WAKEUP_SOURCE,
|
||||
},
|
||||
{
|
||||
.id = PM_SYSTEM_SHUTDOWN,
|
||||
.api_id = PM_SYSTEM_SHUTDOWN,
|
||||
.id = (uint8_t)PM_SYSTEM_SHUTDOWN,
|
||||
.api_id = (uint8_t)PM_SYSTEM_SHUTDOWN,
|
||||
},
|
||||
{
|
||||
.id = PM_GET_API_VERSION,
|
||||
.api_id = PM_GET_API_VERSION,
|
||||
.id = (uint8_t)PM_GET_API_VERSION,
|
||||
.api_id = (uint8_t)PM_GET_API_VERSION,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_ENABLE,
|
||||
.api_id = PM_PLL_SET_MODE,
|
||||
.id = (uint8_t)PM_CLOCK_ENABLE,
|
||||
.api_id = (uint8_t)PM_PLL_SET_MODE,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_ENABLE,
|
||||
.api_id = PM_CLOCK_ENABLE,
|
||||
.id = (uint8_t)PM_CLOCK_ENABLE,
|
||||
.api_id = (uint8_t)PM_CLOCK_ENABLE,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_DISABLE,
|
||||
.api_id = PM_PLL_SET_MODE,
|
||||
.id = (uint8_t)PM_CLOCK_DISABLE,
|
||||
.api_id = (uint8_t)PM_PLL_SET_MODE,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_DISABLE,
|
||||
.api_id = PM_CLOCK_DISABLE,
|
||||
.id = (uint8_t)PM_CLOCK_DISABLE,
|
||||
.api_id = (uint8_t)PM_CLOCK_DISABLE,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_GETSTATE,
|
||||
.api_id = PM_PLL_GET_MODE,
|
||||
.id = (uint8_t)PM_CLOCK_GETSTATE,
|
||||
.api_id = (uint8_t)PM_PLL_GET_MODE,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_GETSTATE,
|
||||
.api_id = PM_CLOCK_GETSTATE,
|
||||
.id = (uint8_t)PM_CLOCK_GETSTATE,
|
||||
.api_id = (uint8_t)PM_CLOCK_GETSTATE,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_SETDIVIDER,
|
||||
.api_id = PM_PLL_SET_PARAMETER,
|
||||
.id = (uint8_t)PM_CLOCK_SETDIVIDER,
|
||||
.api_id = (uint8_t)PM_PLL_SET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_SETDIVIDER,
|
||||
.api_id = PM_CLOCK_SETDIVIDER,
|
||||
.id = (uint8_t)PM_CLOCK_SETDIVIDER,
|
||||
.api_id = (uint8_t)PM_CLOCK_SETDIVIDER,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_GETDIVIDER,
|
||||
.api_id = PM_PLL_GET_PARAMETER,
|
||||
.id = (uint8_t)PM_CLOCK_GETDIVIDER,
|
||||
.api_id = (uint8_t)PM_PLL_GET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_GETDIVIDER,
|
||||
.api_id = PM_CLOCK_GETDIVIDER,
|
||||
.id = (uint8_t)PM_CLOCK_GETDIVIDER,
|
||||
.api_id = (uint8_t)PM_CLOCK_GETDIVIDER,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_SETPARENT,
|
||||
.api_id = PM_PLL_SET_PARAMETER,
|
||||
.id = (uint8_t)PM_CLOCK_SETPARENT,
|
||||
.api_id = (uint8_t)PM_PLL_SET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_SETPARENT,
|
||||
.api_id = PM_CLOCK_SETPARENT,
|
||||
.id = (uint8_t)PM_CLOCK_SETPARENT,
|
||||
.api_id = (uint8_t)PM_CLOCK_SETPARENT,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_GETPARENT,
|
||||
.api_id = PM_PLL_GET_PARAMETER,
|
||||
.id = (uint8_t)PM_CLOCK_GETPARENT,
|
||||
.api_id = (uint8_t)PM_PLL_GET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = PM_CLOCK_GETPARENT,
|
||||
.api_id = PM_CLOCK_GETPARENT,
|
||||
.id = (uint8_t)PM_CLOCK_GETPARENT,
|
||||
.api_id = (uint8_t)PM_CLOCK_GETPARENT,
|
||||
},
|
||||
{
|
||||
.id = PM_PLL_SET_PARAMETER,
|
||||
.api_id = PM_PLL_SET_PARAMETER,
|
||||
.id = (uint8_t)PM_PLL_SET_PARAMETER,
|
||||
.api_id = (uint8_t)PM_PLL_SET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = PM_PLL_GET_PARAMETER,
|
||||
.api_id = PM_PLL_GET_PARAMETER,
|
||||
.id = (uint8_t)PM_PLL_GET_PARAMETER,
|
||||
.api_id = (uint8_t)PM_PLL_GET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = PM_PLL_SET_MODE,
|
||||
.api_id = PM_PLL_SET_MODE,
|
||||
.id = (uint8_t)PM_PLL_SET_MODE,
|
||||
.api_id = (uint8_t)PM_PLL_SET_MODE,
|
||||
},
|
||||
{
|
||||
.id = PM_PLL_GET_MODE,
|
||||
.api_id = PM_PLL_GET_MODE,
|
||||
.id = (uint8_t)PM_PLL_GET_MODE,
|
||||
.api_id = (uint8_t)PM_PLL_GET_MODE,
|
||||
},
|
||||
{
|
||||
.id = PM_REGISTER_ACCESS,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)PM_REGISTER_ACCESS,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = PM_REGISTER_ACCESS,
|
||||
.api_id = PM_MMIO_READ,
|
||||
.id = (uint8_t)PM_REGISTER_ACCESS,
|
||||
.api_id = (uint8_t)PM_MMIO_READ,
|
||||
},
|
||||
{
|
||||
.id = PM_FEATURE_CHECK,
|
||||
.api_id = PM_FEATURE_CHECK,
|
||||
.id = (uint8_t)PM_FEATURE_CHECK,
|
||||
.api_id = (uint8_t)PM_FEATURE_CHECK,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_SET_TAPDELAY_BYPASS,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_SET_TAPDELAY_BYPASS,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_SD_DLL_RESET,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_SD_DLL_RESET,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_SET_SD_TAPDELAY,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_SET_SD_TAPDELAY,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_SET_SD_TAPDELAY,
|
||||
.api_id = PM_MMIO_READ,
|
||||
.id = (uint8_t)IOCTL_SET_SD_TAPDELAY,
|
||||
.api_id = (uint8_t)PM_MMIO_READ,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_SET_PLL_FRAC_DATA,
|
||||
.api_id = PM_PLL_SET_PARAMETER,
|
||||
.id = (uint8_t)IOCTL_SET_PLL_FRAC_DATA,
|
||||
.api_id = (uint8_t)PM_PLL_SET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_GET_PLL_FRAC_DATA,
|
||||
.api_id = PM_PLL_GET_PARAMETER,
|
||||
.id = (uint8_t)IOCTL_GET_PLL_FRAC_DATA,
|
||||
.api_id = (uint8_t)PM_PLL_GET_PARAMETER,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_WRITE_GGS,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_WRITE_GGS,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_READ_GGS,
|
||||
.api_id = PM_MMIO_READ,
|
||||
.id = (uint8_t)IOCTL_READ_GGS,
|
||||
.api_id = (uint8_t)PM_MMIO_READ,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_WRITE_PGGS,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_WRITE_PGGS,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_READ_PGGS,
|
||||
.api_id = PM_MMIO_READ,
|
||||
.id = (uint8_t)IOCTL_READ_PGGS,
|
||||
.api_id = (uint8_t)PM_MMIO_READ,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_ULPI_RESET,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_ULPI_RESET,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_SET_BOOT_HEALTH_STATUS,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_SET_BOOT_HEALTH_STATUS,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
{
|
||||
.id = IOCTL_AFI,
|
||||
.api_id = PM_MMIO_WRITE,
|
||||
.id = (uint8_t)IOCTL_AFI,
|
||||
.api_id = (uint8_t)PM_MMIO_WRITE,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -770,7 +770,7 @@ enum pm_ret_status check_api_dependency(uint8_t id)
|
|||
{
|
||||
uint8_t i;
|
||||
uint32_t version_type;
|
||||
int ret;
|
||||
enum pm_ret_status ret;
|
||||
|
||||
for (i = 0U; i < ARRAY_SIZE(api_dep_table); i++) {
|
||||
if (api_dep_table[i].id == id) {
|
||||
|
@ -1521,47 +1521,47 @@ void pm_query_data(enum pm_query_ids qid, uint32_t arg1, uint32_t arg2,
|
|||
pm_clock_get_name(arg1, (char *)data);
|
||||
break;
|
||||
case PM_QID_CLOCK_GET_TOPOLOGY:
|
||||
data[0] = pm_clock_get_topology(arg1, arg2, &data[1]);
|
||||
data[0] = (uint32_t)pm_clock_get_topology(arg1, arg2, &data[1]);
|
||||
break;
|
||||
case PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS:
|
||||
data[0] = pm_clock_get_fixedfactor_params(arg1, &data[1],
|
||||
data[0] = (uint32_t)pm_clock_get_fixedfactor_params(arg1, &data[1],
|
||||
&data[2]);
|
||||
break;
|
||||
case PM_QID_CLOCK_GET_PARENTS:
|
||||
data[0] = pm_clock_get_parents(arg1, arg2, &data[1]);
|
||||
data[0] = (uint32_t)pm_clock_get_parents(arg1, arg2, &data[1]);
|
||||
break;
|
||||
case PM_QID_CLOCK_GET_ATTRIBUTES:
|
||||
data[0] = pm_clock_get_attributes(arg1, &data[1]);
|
||||
data[0] = (uint32_t)pm_clock_get_attributes(arg1, &data[1]);
|
||||
break;
|
||||
case PM_QID_PINCTRL_GET_NUM_PINS:
|
||||
data[0] = pm_pinctrl_get_num_pins(&data[1]);
|
||||
data[0] = (uint32_t)pm_pinctrl_get_num_pins(&data[1]);
|
||||
break;
|
||||
case PM_QID_PINCTRL_GET_NUM_FUNCTIONS:
|
||||
data[0] = pm_pinctrl_get_num_functions(&data[1]);
|
||||
data[0] = (uint32_t)pm_pinctrl_get_num_functions(&data[1]);
|
||||
break;
|
||||
case PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS:
|
||||
data[0] = pm_pinctrl_get_num_function_groups(arg1, &data[1]);
|
||||
data[0] = (uint32_t)pm_pinctrl_get_num_function_groups(arg1, &data[1]);
|
||||
break;
|
||||
case PM_QID_PINCTRL_GET_FUNCTION_NAME:
|
||||
pm_pinctrl_get_function_name(arg1, (char *)data);
|
||||
break;
|
||||
case PM_QID_PINCTRL_GET_FUNCTION_GROUPS:
|
||||
data[0] = pm_pinctrl_get_function_groups(arg1, arg2,
|
||||
data[0] = (uint32_t)pm_pinctrl_get_function_groups(arg1, arg2,
|
||||
(uint16_t *)&data[1]);
|
||||
break;
|
||||
case PM_QID_PINCTRL_GET_PIN_GROUPS:
|
||||
data[0] = pm_pinctrl_get_pin_groups(arg1, arg2,
|
||||
data[0] = (uint32_t)pm_pinctrl_get_pin_groups(arg1, arg2,
|
||||
(uint16_t *)&data[1]);
|
||||
break;
|
||||
case PM_QID_CLOCK_GET_NUM_CLOCKS:
|
||||
data[0] = pm_clock_get_num_clocks(&data[1]);
|
||||
data[0] = (uint32_t)pm_clock_get_num_clocks(&data[1]);
|
||||
break;
|
||||
|
||||
case PM_QID_CLOCK_GET_MAX_DIVISOR:
|
||||
data[0] = pm_clock_get_max_divisor(arg1, arg2, &data[1]);
|
||||
data[0] = (uint32_t)pm_clock_get_max_divisor(arg1, (uint8_t)arg2, &data[1]);
|
||||
break;
|
||||
default:
|
||||
data[0] = PM_RET_ERROR_ARGS;
|
||||
data[0] = (uint32_t)PM_RET_ERROR_ARGS;
|
||||
WARN("Unimplemented query service call: 0x%x\n", qid);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -187,9 +187,9 @@ enum pm_shutdown_type {
|
|||
*
|
||||
*/
|
||||
enum pm_shutdown_subtype {
|
||||
PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM,
|
||||
PMF_SHUTDOWN_SUBTYPE_PS_ONLY,
|
||||
PMF_SHUTDOWN_SUBTYPE_SYSTEM,
|
||||
PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM = (0U),
|
||||
PMF_SHUTDOWN_SUBTYPE_PS_ONLY = (1U),
|
||||
PMF_SHUTDOWN_SUBTYPE_SYSTEM = (2U),
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -560,7 +560,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
|
|||
uint32_t bit_mask[2] = {0};
|
||||
|
||||
ret = pm_feature_check(pm_arg[0], &version_type, bit_mask,
|
||||
ARRAY_SIZE(bit_mask));
|
||||
(uint8_t)ARRAY_SIZE(bit_mask));
|
||||
SMC_RET2(handle, ((uint64_t)ret | ((uint64_t)version_type << 32U)),
|
||||
((uint64_t)bit_mask[0] | ((uint64_t)bit_mask[1] << 32U)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue