fix(plat/xilinx/versal): resolve misra R10.3
MISRA Violation: MISRA-C:2012 R.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
Signed-off-by: Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>
Change-Id: I9c6dd8dba40db8067b46947ceff295732648612a
diff --git a/plat/xilinx/versal/bl31_versal_setup.c b/plat/xilinx/versal/bl31_versal_setup.c
index 698d036..4d7caf1 100644
--- a/plat/xilinx/versal/bl31_versal_setup.c
+++ b/plat/xilinx/versal/bl31_versal_setup.c
@@ -67,16 +67,16 @@
if (VERSAL_CONSOLE_IS(pl011)) {
static console_t versal_runtime_console;
/* Initialize the console to provide early debug support */
- int rc = console_pl011_register(VERSAL_UART_BASE,
- VERSAL_UART_CLOCK,
- VERSAL_UART_BAUDRATE,
+ int rc = console_pl011_register((unsigned long)VERSAL_UART_BASE,
+ (unsigned int)VERSAL_UART_CLOCK,
+ (unsigned int)VERSAL_UART_BAUDRATE,
&versal_runtime_console);
if (rc == 0) {
panic();
}
- console_set_scope(&versal_runtime_console, CONSOLE_FLAG_BOOT |
- CONSOLE_FLAG_RUNTIME);
+ console_set_scope(&versal_runtime_console, (unsigned int)(CONSOLE_FLAG_BOOT |
+ CONSOLE_FLAG_RUNTIME));
} else if (VERSAL_CONSOLE_IS(dcc)) {
/* Initialize the dcc console for debug */
int rc = console_dcc_register();
@@ -166,7 +166,7 @@
void bl31_plat_runtime_setup(void)
{
uint64_t flags = 0;
- uint64_t rc;
+ int32_t rc;
set_interrupt_rm_flag(flags, NON_SECURE);
rc = register_interrupt_type_handler(INTR_TYPE_EL3,
diff --git a/plat/xilinx/versal/include/versal_def.h b/plat/xilinx/versal/include/versal_def.h
index 3319ac2..9372954 100644
--- a/plat/xilinx/versal/include/versal_def.h
+++ b/plat/xilinx/versal/include/versal_def.h
@@ -52,7 +52,7 @@
/*******************************************************************************
* IRQ constants
******************************************************************************/
-#define VERSAL_IRQ_SEC_PHY_TIMER 29
+#define VERSAL_IRQ_SEC_PHY_TIMER U(29)
/*******************************************************************************
* CCI-400 related constants
@@ -128,17 +128,17 @@
/* IPI registers and bitfields */
#define IPI0_REG_BASE U(0xFF330000)
-#define IPI0_TRIG_BIT (1 << 2)
-#define PMC_IPI_TRIG_BIT (1 << 1)
+#define IPI0_TRIG_BIT (1U << 2U)
+#define PMC_IPI_TRIG_BIT (1U << 1U)
#define IPI1_REG_BASE U(0xFF340000)
-#define IPI1_TRIG_BIT (1 << 3)
+#define IPI1_TRIG_BIT (1U << 3U)
#define IPI2_REG_BASE U(0xFF350000)
-#define IPI2_TRIG_BIT (1 << 4)
+#define IPI2_TRIG_BIT (1U << 4U)
#define IPI3_REG_BASE U(0xFF360000)
-#define IPI3_TRIG_BIT (1 << 5)
+#define IPI3_TRIG_BIT (1U << 5U)
#define IPI4_REG_BASE U(0xFF370000)
-#define IPI4_TRIG_BIT (1 << 5)
+#define IPI4_TRIG_BIT (1U << 5U)
#define IPI5_REG_BASE U(0xFF380000)
-#define IPI5_TRIG_BIT (1 << 6)
+#define IPI5_TRIG_BIT (1U << 6U)
#endif /* VERSAL_DEF_H */
diff --git a/plat/xilinx/versal/plat_psci.c b/plat/xilinx/versal/plat_psci.c
index e7bf8f8..1f3b2bf 100644
--- a/plat/xilinx/versal/plat_psci.c
+++ b/plat/xilinx/versal/plat_psci.c
@@ -193,7 +193,7 @@
{
VERBOSE("%s: power_state: 0x%x\n", __func__, power_state);
- int pstate = psci_get_pstate_type(power_state);
+ unsigned int pstate = psci_get_pstate_type(power_state);
assert(req_state);
diff --git a/plat/xilinx/versal/plat_versal.c b/plat/xilinx/versal/plat_versal.c
index 107eae6..15b89bf 100644
--- a/plat/xilinx/versal/plat_versal.c
+++ b/plat/xilinx/versal/plat_versal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2021, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -17,5 +17,5 @@
return -1;
}
- return versal_calc_core_pos(mpidr);
+ return (int)versal_calc_core_pos(mpidr);
}
diff --git a/plat/xilinx/versal/sip_svc_setup.c b/plat/xilinx/versal/sip_svc_setup.c
index 2649e18..479a34c 100644
--- a/plat/xilinx/versal/sip_svc_setup.c
+++ b/plat/xilinx/versal/sip_svc_setup.c
@@ -19,8 +19,8 @@
#define VERSAL_SIP_SVC_VERSION U(0x8200ff03)
/* SiP Service Calls version numbers */
-#define SIP_SVC_VERSION_MAJOR 0
-#define SIP_SVC_VERSION_MINOR 1
+#define SIP_SVC_VERSION_MAJOR U(0)
+#define SIP_SVC_VERSION_MINOR U(1)
/* These macros are used to identify PM calls from the SMC function ID */
#define PM_FID_MASK 0xf000u
@@ -31,8 +31,8 @@
/* SiP Service UUID */
DEFINE_SVC_UUID2(versal_sip_uuid,
- 0x2ab9e4ec, 0x93b9, 0x11e7, 0xa0, 0x19,
- 0xdf, 0xe0, 0xdb, 0xad, 0x0a, 0xe0);
+ 0x2ab9e4ecU, 0x93b9U, 0x11e7U, 0xa0U, 0x19U,
+ 0xdfU, 0xe0U, 0xdbU, 0xadU, 0x0aU, 0xe0U);
/**
* sip_svc_setup() - Setup SiP Service