summaryrefslogtreecommitdiff
path: root/include/services
diff options
context:
space:
mode:
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>2018-08-02 10:14:12 +0100
committerJeenu Viswambharan <jeenu.viswambharan@arm.com>2018-08-20 09:05:39 +0100
commitba6e5ca67160f3847b0e68a0f7bc16d12989f2b4 (patch)
treeef1e6e173aea5ea84f57cdd3f2a1269420c43cd0 /include/services
parent4e45fbd626e199d94116658b2a92e2ab6c0f1f07 (diff)
SDEI: MISRA fixes
These changes address most of the required MISRA rules. In the process, some from generic code is also fixed. No functional changes. Change-Id: I6235a355e006f0b1c7c1c4d811b3964a64d0434f Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Diffstat (limited to 'include/services')
-rw-r--r--include/services/sdei.h113
1 files changed, 54 insertions, 59 deletions
diff --git a/include/services/sdei.h b/include/services/sdei.h
index 79d1d065..4d0fd3fd 100644
--- a/include/services/sdei.h
+++ b/include/services/sdei.h
@@ -4,61 +4,56 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef __SDEI_H__
-#define __SDEI_H__
+#ifndef SDEI_H
+#define SDEI_H
#include <spinlock.h>
#include <utils_def.h>
/* Range 0xC4000020 - 0xC400003F reserved for SDE 64bit smc calls */
-#define SDEI_VERSION 0xC4000020
-#define SDEI_EVENT_REGISTER 0xC4000021
-#define SDEI_EVENT_ENABLE 0xC4000022
-#define SDEI_EVENT_DISABLE 0xC4000023
-#define SDEI_EVENT_CONTEXT 0xC4000024
-#define SDEI_EVENT_COMPLETE 0xC4000025
-#define SDEI_EVENT_COMPLETE_AND_RESUME 0xC4000026
-
-#define SDEI_EVENT_UNREGISTER 0xC4000027
-#define SDEI_EVENT_STATUS 0xC4000028
-#define SDEI_EVENT_GET_INFO 0xC4000029
-#define SDEI_EVENT_ROUTING_SET 0xC400002A
-#define SDEI_PE_MASK 0xC400002B
-#define SDEI_PE_UNMASK 0xC400002C
-
-#define SDEI_INTERRUPT_BIND 0xC400002D
-#define SDEI_INTERRUPT_RELEASE 0xC400002E
-#define SDEI_EVENT_SIGNAL 0xC400002F
-#define SDEI_FEATURES 0xC4000030
-#define SDEI_PRIVATE_RESET 0xC4000031
-#define SDEI_SHARED_RESET 0xC4000032
+#define SDEI_VERSION 0xC4000020U
+#define SDEI_EVENT_REGISTER 0xC4000021U
+#define SDEI_EVENT_ENABLE 0xC4000022U
+#define SDEI_EVENT_DISABLE 0xC4000023U
+#define SDEI_EVENT_CONTEXT 0xC4000024U
+#define SDEI_EVENT_COMPLETE 0xC4000025U
+#define SDEI_EVENT_COMPLETE_AND_RESUME 0xC4000026U
+
+#define SDEI_EVENT_UNREGISTER 0xC4000027U
+#define SDEI_EVENT_STATUS 0xC4000028U
+#define SDEI_EVENT_GET_INFO 0xC4000029U
+#define SDEI_EVENT_ROUTING_SET 0xC400002AU
+#define SDEI_PE_MASK 0xC400002BU
+#define SDEI_PE_UNMASK 0xC400002CU
+
+#define SDEI_INTERRUPT_BIND 0xC400002DU
+#define SDEI_INTERRUPT_RELEASE 0xC400002EU
+#define SDEI_EVENT_SIGNAL 0xC400002FU
+#define SDEI_FEATURES 0xC4000030U
+#define SDEI_PRIVATE_RESET 0xC4000031U
+#define SDEI_SHARED_RESET 0xC4000032U
/* SDEI_EVENT_REGISTER flags */
-#define SDEI_REGF_RM_ANY 0
-#define SDEI_REGF_RM_PE 1
+#define SDEI_REGF_RM_ANY 0ULL
+#define SDEI_REGF_RM_PE 1ULL
/* SDEI_EVENT_COMPLETE status flags */
-#define SDEI_EV_HANDLED 0
-#define SDEI_EV_FAILED 1
-
-/* SDE event status values in bit position */
-#define SDEI_STATF_REGISTERED 0
-#define SDEI_STATF_ENABLED 1
-#define SDEI_STATF_RUNNING 2
+#define SDEI_EV_HANDLED 0U
+#define SDEI_EV_FAILED 1U
/* Internal: SDEI flag bit positions */
-#define _SDEI_MAPF_DYNAMIC_SHIFT 1
-#define _SDEI_MAPF_BOUND_SHIFT 2
-#define _SDEI_MAPF_SIGNALABLE_SHIFT 3
-#define _SDEI_MAPF_PRIVATE_SHIFT 4
-#define _SDEI_MAPF_CRITICAL_SHIFT 5
-#define _SDEI_MAPF_EXPLICIT_SHIFT 6
+#define SDEI_MAPF_DYNAMIC_SHIFT_ 1U
+#define SDEI_MAPF_BOUND_SHIFT_ 2U
+#define SDEI_MAPF_SIGNALABLE_SHIFT_ 3U
+#define SDEI_MAPF_PRIVATE_SHIFT_ 4U
+#define SDEI_MAPF_CRITICAL_SHIFT_ 5U
+#define SDEI_MAPF_EXPLICIT_SHIFT_ 6U
/* SDEI event 0 */
#define SDEI_EVENT_0 0
/* Placeholder interrupt for dynamic mapping */
-#define SDEI_DYN_IRQ 0
+#define SDEI_DYN_IRQ 0U
/* SDEI flags */
@@ -80,20 +75,20 @@
*
* See also the is_map_bound() macro.
*/
-#define SDEI_MAPF_DYNAMIC BIT(_SDEI_MAPF_DYNAMIC_SHIFT)
-#define SDEI_MAPF_BOUND BIT(_SDEI_MAPF_BOUND_SHIFT)
-#define SDEI_MAPF_EXPLICIT BIT(_SDEI_MAPF_EXPLICIT_SHIFT)
+#define SDEI_MAPF_DYNAMIC BIT(SDEI_MAPF_DYNAMIC_SHIFT_)
+#define SDEI_MAPF_BOUND BIT(SDEI_MAPF_BOUND_SHIFT_)
+#define SDEI_MAPF_EXPLICIT BIT(SDEI_MAPF_EXPLICIT_SHIFT_)
-#define SDEI_MAPF_SIGNALABLE BIT(_SDEI_MAPF_SIGNALABLE_SHIFT)
-#define SDEI_MAPF_PRIVATE BIT(_SDEI_MAPF_PRIVATE_SHIFT)
+#define SDEI_MAPF_SIGNALABLE BIT(SDEI_MAPF_SIGNALABLE_SHIFT_)
+#define SDEI_MAPF_PRIVATE BIT(SDEI_MAPF_PRIVATE_SHIFT_)
#define SDEI_MAPF_NORMAL 0
-#define SDEI_MAPF_CRITICAL BIT(_SDEI_MAPF_CRITICAL_SHIFT)
+#define SDEI_MAPF_CRITICAL BIT(SDEI_MAPF_CRITICAL_SHIFT_)
/* Indices of private and shared mappings */
-#define _SDEI_MAP_IDX_PRIV 0
-#define _SDEI_MAP_IDX_SHRD 1
-#define _SDEI_MAP_IDX_MAX 2
+#define SDEI_MAP_IDX_PRIV_ 0U
+#define SDEI_MAP_IDX_SHRD_ 1U
+#define SDEI_MAP_IDX_MAX_ 2U
/* The macros below are used to identify SDEI calls from the SMC function ID */
#define SDEI_FID_MASK U(0xffe0)
@@ -104,22 +99,22 @@
#define SDEI_EVENT_MAP(_event, _intr, _flags) \
{ \
- .ev_num = _event, \
- .intr = _intr, \
- .map_flags = _flags \
+ .ev_num = (_event), \
+ .intr = (_intr), \
+ .map_flags = (_flags) \
}
#define SDEI_SHARED_EVENT(_event, _intr, _flags) \
SDEI_EVENT_MAP(_event, _intr, _flags)
#define SDEI_PRIVATE_EVENT(_event, _intr, _flags) \
- SDEI_EVENT_MAP(_event, _intr, _flags | SDEI_MAPF_PRIVATE)
+ SDEI_EVENT_MAP(_event, _intr, (_flags) | SDEI_MAPF_PRIVATE)
#define SDEI_DEFINE_EVENT_0(_intr) \
- SDEI_PRIVATE_EVENT(SDEI_EVENT_0, _intr, SDEI_MAPF_SIGNALABLE)
+ SDEI_PRIVATE_EVENT(SDEI_EVENT_0, (_intr), SDEI_MAPF_SIGNALABLE)
#define SDEI_EXPLICIT_EVENT(_event, _pri) \
- SDEI_EVENT_MAP(_event, 0, _pri | SDEI_MAPF_EXPLICIT | SDEI_MAPF_PRIVATE)
+ SDEI_EVENT_MAP((_event), 0, (_pri) | SDEI_MAPF_EXPLICIT | SDEI_MAPF_PRIVATE)
/*
* Declare shared and private entries for each core. Also declare a global
@@ -133,12 +128,12 @@
[PLATFORM_CORE_COUNT * ARRAY_SIZE(_private)]; \
sdei_entry_t sdei_shared_event_table[ARRAY_SIZE(_shared)]; \
const sdei_mapping_t sdei_global_mappings[] = { \
- [_SDEI_MAP_IDX_PRIV] = { \
- .map = _private, \
+ [SDEI_MAP_IDX_PRIV_] = { \
+ .map = (_private), \
.num_maps = ARRAY_SIZE(_private) \
}, \
- [_SDEI_MAP_IDX_SHRD] = { \
- .map = _shared, \
+ [SDEI_MAP_IDX_SHRD_] = { \
+ .map = (_shared), \
.num_maps = ARRAY_SIZE(_shared) \
}, \
}
@@ -185,4 +180,4 @@ void sdei_init(void);
/* Public API to dispatch an event to Normal world */
int sdei_dispatch_event(int ev_num);
-#endif /* __SDEI_H__ */
+#endif /* SDEI_H */