Commit 195e363f authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

Fix MISRA defects in PMF



No functional changes.

Change-Id: I64abd72026082218a40b1a4b8f7dc26ff2478ba6
Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent 43534997
...@@ -9,17 +9,18 @@ ...@@ -9,17 +9,18 @@
#include <cassert.h> #include <cassert.h>
#include <pmf_helpers.h> #include <pmf_helpers.h>
#include <utils_def.h>
/* /*
* Constants used for/by PMF services. * Constants used for/by PMF services.
*/ */
#define PMF_ARM_TIF_IMPL_ID 0x41 #define PMF_ARM_TIF_IMPL_ID U(0x41)
#define PMF_TID_SHIFT 0 #define PMF_TID_SHIFT 0
#define PMF_TID_MASK (0xFF << PMF_TID_SHIFT) #define PMF_TID_MASK (U(0xFF) << PMF_TID_SHIFT)
#define PMF_SVC_ID_SHIFT 10 #define PMF_SVC_ID_SHIFT 10
#define PMF_SVC_ID_MASK (0x3F << PMF_SVC_ID_SHIFT) #define PMF_SVC_ID_MASK (U(0x3F) << PMF_SVC_ID_SHIFT)
#define PMF_IMPL_ID_SHIFT 24 #define PMF_IMPL_ID_SHIFT 24
#define PMF_IMPL_ID_MASK (0xFFU << PMF_IMPL_ID_SHIFT) #define PMF_IMPL_ID_MASK (U(0xFF) << PMF_IMPL_ID_SHIFT)
/* /*
* Flags passed to PMF_REGISTER_SERVICE * Flags passed to PMF_REGISTER_SERVICE
...@@ -37,16 +38,16 @@ ...@@ -37,16 +38,16 @@
/* /*
* Defines for PMF SMC function ids. * Defines for PMF SMC function ids.
*/ */
#define PMF_SMC_GET_TIMESTAMP_32 0x82000010u #define PMF_SMC_GET_TIMESTAMP_32 U(0x82000010)
#define PMF_SMC_GET_TIMESTAMP_64 0xC2000010u #define PMF_SMC_GET_TIMESTAMP_64 U(0xC2000010)
#define PMF_NUM_SMC_CALLS 2 #define PMF_NUM_SMC_CALLS 2
/* /*
* The macros below are used to identify * The macros below are used to identify
* PMF calls from the SMC function ID. * PMF calls from the SMC function ID.
*/ */
#define PMF_FID_MASK 0xffe0u #define PMF_FID_MASK U(0xffe0)
#define PMF_FID_VALUE 0u #define PMF_FID_VALUE U(0)
#define is_pmf_fid(_fid) (((_fid) & PMF_FID_MASK) == PMF_FID_VALUE) #define is_pmf_fid(_fid) (((_fid) & PMF_FID_MASK) == PMF_FID_VALUE)
/* Following are the supported PMF service IDs */ /* Following are the supported PMF service IDs */
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <assert.h> #include <assert.h>
#include <bl_common.h> #include <bl_common.h>
#include <platform.h> #include <platform.h>
#include <pmf.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
IMPORT_SYM(uintptr_t, __PMF_SVC_DESCS_START__, PMF_SVC_DESCS_START); IMPORT_SYM(uintptr_t, __PMF_SVC_DESCS_START__, PMF_SVC_DESCS_START);
IMPORT_SYM(uintptr_t, __PMF_SVC_DESCS_END__, PMF_SVC_DESCS_END); IMPORT_SYM(uintptr_t, __PMF_SVC_DESCS_END__, PMF_SVC_DESCS_END);
IMPORT_SYM(uintptr_t, __PMF_PERCPU_TIMESTAMP_END__, PMF_PERCPU_TIMESTAMP_END); IMPORT_SYM(uintptr_t, __PMF_PERCPU_TIMESTAMP_END__, PMF_PERCPU_TIMESTAMP_END);
IMPORT_SYM(intptr_t, __PMF_TIMESTAMP_START__, PMF_TIMESTAMP_ARRAY_START); IMPORT_SYM(uintptr_t, __PMF_TIMESTAMP_START__, PMF_TIMESTAMP_ARRAY_START);
#define PMF_PERCPU_TIMESTAMP_SIZE (PMF_PERCPU_TIMESTAMP_END - PMF_TIMESTAMP_ARRAY_START) #define PMF_PERCPU_TIMESTAMP_SIZE (PMF_PERCPU_TIMESTAMP_END - PMF_TIMESTAMP_ARRAY_START)
...@@ -67,15 +67,15 @@ int pmf_setup(void) ...@@ -67,15 +67,15 @@ int pmf_setup(void)
pmf_svc_descs = (pmf_svc_desc_t *) PMF_SVC_DESCS_START; pmf_svc_descs = (pmf_svc_desc_t *) PMF_SVC_DESCS_START;
for (ii = 0; ii < pmf_svc_descs_num; ii++) { for (ii = 0; ii < pmf_svc_descs_num; ii++) {
assert(pmf_svc_descs[ii].get_ts); assert(pmf_svc_descs[ii].get_ts != NULL);
/* /*
* Call the initialization routine for this * Call the initialization routine for this
* PMF service, if it is defined. * PMF service, if it is defined.
*/ */
if (pmf_svc_descs[ii].init) { if (pmf_svc_descs[ii].init != NULL) {
rc = pmf_svc_descs[ii].init(); rc = pmf_svc_descs[ii].init();
if (rc) { if (rc != 0) {
WARN("Could not initialize PMF" WARN("Could not initialize PMF"
"service %s - skipping \n", "service %s - skipping \n",
pmf_svc_descs[ii].name); pmf_svc_descs[ii].name);
...@@ -125,7 +125,7 @@ static pmf_svc_desc_t *get_service(unsigned int tid) ...@@ -125,7 +125,7 @@ static pmf_svc_desc_t *get_service(unsigned int tid)
if (pmf_num_services == 0) if (pmf_num_services == 0)
return NULL; return NULL;
assert(pmf_svc_descs); assert(pmf_svc_descs != NULL);
do { do {
mid = (low + high) / 2; mid = (low + high) / 2;
...@@ -158,7 +158,7 @@ int pmf_get_timestamp_smc(unsigned int tid, ...@@ -158,7 +158,7 @@ int pmf_get_timestamp_smc(unsigned int tid,
unsigned long long *ts_value) unsigned long long *ts_value)
{ {
pmf_svc_desc_t *svc_desc; pmf_svc_desc_t *svc_desc;
assert(ts_value); assert(ts_value != NULL);
/* Search for registered service. */ /* Search for registered service. */
svc_desc = get_service(tid); svc_desc = get_service(tid);
...@@ -247,7 +247,7 @@ unsigned long long __pmf_get_timestamp(uintptr_t base_addr, ...@@ -247,7 +247,7 @@ unsigned long long __pmf_get_timestamp(uintptr_t base_addr,
unsigned long long *ts_addr = (unsigned long long *)calc_ts_addr(base_addr, unsigned long long *ts_addr = (unsigned long long *)calc_ts_addr(base_addr,
tid, cpuid); tid, cpuid);
if (flags & PMF_CACHE_MAINT) if ((flags & PMF_CACHE_MAINT) != 0U)
inv_dcache_range((uintptr_t)ts_addr, sizeof(unsigned long long)); inv_dcache_range((uintptr_t)ts_addr, sizeof(unsigned long long));
return *ts_addr; return *ts_addr;
......
...@@ -37,7 +37,8 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid, ...@@ -37,7 +37,8 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
* x0 --> error code. * x0 --> error code.
* x1 - x2 --> time-stamp value. * x1 - x2 --> time-stamp value.
*/ */
rc = pmf_get_timestamp_smc(x1, x2, x3, &ts_value); rc = pmf_get_timestamp_smc((unsigned int)x1, x2,
(unsigned int)x3, &ts_value);
SMC_RET3(handle, rc, (uint32_t)ts_value, SMC_RET3(handle, rc, (uint32_t)ts_value,
(uint32_t)(ts_value >> 32)); (uint32_t)(ts_value >> 32));
} }
...@@ -49,7 +50,8 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid, ...@@ -49,7 +50,8 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
* x0 --> error code. * x0 --> error code.
* x1 --> time-stamp value. * x1 --> time-stamp value.
*/ */
rc = pmf_get_timestamp_smc(x1, x2, x3, &ts_value); rc = pmf_get_timestamp_smc((unsigned int)x1, x2,
(unsigned int)x3, &ts_value);
SMC_RET2(handle, rc, ts_value); SMC_RET2(handle, rc, ts_value);
} }
} }
......
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