aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-04-17 15:10:18 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-04-17 15:10:18 +0100
commitb3323cd6bddf38ba9e944b16573d429073d60723 (patch)
treef5672127319d6d625c3af6a92b1476f3459a8b0b /include
parent0f17a683246e20869395223215bb5e2f4fb1d81e (diff)
downloadplatform_external_arm-trusted-firmware-b3323cd6bddf38ba9e944b16573d429073d60723.tar.gz
platform_external_arm-trusted-firmware-b3323cd6bddf38ba9e944b16573d429073d60723.tar.bz2
platform_external_arm-trusted-firmware-b3323cd6bddf38ba9e944b16573d429073d60723.zip
Fix some MISRA defects in SPM code
Change-Id: I989c1f4aef8e3cb20d5d19e6347575e6449bb60b Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/common/runtime_svc.h12
-rw-r--r--include/lib/aarch64/arch.h8
-rw-r--r--include/lib/smccc.h4
-rw-r--r--include/lib/xlat_tables/xlat_tables_v2.h4
4 files changed, 14 insertions, 14 deletions
diff --git a/include/common/runtime_svc.h b/include/common/runtime_svc.h
index 5d9fa3908..706c2118d 100644
--- a/include/common/runtime_svc.h
+++ b/include/common/runtime_svc.h
@@ -102,15 +102,15 @@ CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc_t, handle), \
* oen is used to access an entry in the 'rt_svc_descs_indices' array. The entry
* contains the index of the service descriptor in the 'rt_svc_descs' array.
*/
-#define get_unique_oen(oen, call_type) ((oen & FUNCID_OEN_MASK) | \
- ((call_type & FUNCID_TYPE_MASK) \
- << FUNCID_OEN_WIDTH))
+#define get_unique_oen(oen, call_type) \
+ (((uint32_t)(oen) & FUNCID_OEN_MASK) | \
+ (((uint32_t)(call_type) & FUNCID_TYPE_MASK) << FUNCID_OEN_WIDTH))
/*
* This macro generates the unique owning entity number from the SMC Function
- * ID. This unique oen is used to access an entry in the
- * 'rt_svc_descs_indices' array to invoke the corresponding runtime service
- * handler during SMC handling.
+ * ID. This unique oen is used to access an entry in the 'rt_svc_descs_indices'
+ * array to invoke the corresponding runtime service handler during SMC
+ * handling.
*/
#define get_unique_oen_from_smc_fid(fid) \
get_unique_oen(((fid) >> FUNCID_OEN_SHIFT), \
diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h
index 91aa484f2..ff3881e60 100644
--- a/include/lib/aarch64/arch.h
+++ b/include/lib/aarch64/arch.h
@@ -442,10 +442,10 @@
#define GET_M32(mode) (((mode) >> MODE32_SHIFT) & MODE32_MASK)
#define SPSR_64(el, sp, daif) \
- (MODE_RW_64 << MODE_RW_SHIFT | \
- ((el) & MODE_EL_MASK) << MODE_EL_SHIFT | \
- ((sp) & MODE_SP_MASK) << MODE_SP_SHIFT | \
- ((daif) & SPSR_DAIF_MASK) << SPSR_DAIF_SHIFT)
+ ((MODE_RW_64 << MODE_RW_SHIFT) | \
+ (((el) & MODE_EL_MASK) << MODE_EL_SHIFT) | \
+ (((sp) & MODE_SP_MASK) << MODE_SP_SHIFT) | \
+ (((daif) & SPSR_DAIF_MASK) << SPSR_DAIF_SHIFT))
#define SPSR_MODE32(mode, isa, endian, aif) \
((MODE_RW_32 << MODE_RW_SHIFT) | \
diff --git a/include/lib/smccc.h b/include/lib/smccc.h
index d68342032..b1d4dea86 100644
--- a/include/lib/smccc.h
+++ b/include/lib/smccc.h
@@ -76,8 +76,8 @@
#define SMC_FROM_SECURE (U(0) << 0)
#define SMC_FROM_NON_SECURE (U(1) << 0)
-#define is_caller_non_secure(_f) (!!(_f & SMC_FROM_NON_SECURE))
-#define is_caller_secure(_f) (!(is_caller_non_secure(_f)))
+#define is_caller_non_secure(_f) (((_f) & SMC_FROM_NON_SECURE) != U(0))
+#define is_caller_secure(_f) (!is_caller_non_secure(_f))
/* The macro below is used to identify a Standard Service SMC call */
#define is_std_svc_call(_fid) ((((_fid) >> FUNCID_OEN_SHIFT) & \
diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h
index ba3e3603d..b2379454d 100644
--- a/include/lib/xlat_tables/xlat_tables_v2.h
+++ b/include/lib/xlat_tables/xlat_tables_v2.h
@@ -299,7 +299,7 @@ int mmap_remove_dynamic_region_ctx(xlat_ctx_t *ctx,
* executing.
*/
int change_mem_attributes(xlat_ctx_t *ctx, uintptr_t base_va, size_t size,
- mmap_attr_t attr);
+ uint32_t attr);
/*
* Query the memory attributes of a memory page in a set of translation tables.
@@ -317,7 +317,7 @@ int change_mem_attributes(xlat_ctx_t *ctx, uintptr_t base_va, size_t size,
* Output parameter where to store the attributes of the targeted memory page.
*/
int get_mem_attributes(const xlat_ctx_t *ctx, uintptr_t base_va,
- mmap_attr_t *attributes);
+ uint32_t *attributes);
#endif /*__ASSEMBLY__*/
#endif /* __XLAT_TABLES_V2_H__ */