1 /*
2  * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef SDEI_FLAGS_H
8 #define SDEI_FLAGS_H
9 
10 #include <lib/utils_def.h>
11 
12 /* Internal: SDEI flag bit positions */
13 #define SDEI_MAPF_DYNAMIC_SHIFT_	1U
14 #define SDEI_MAPF_BOUND_SHIFT_		2U
15 #define SDEI_MAPF_SIGNALABLE_SHIFT_	3U
16 #define SDEI_MAPF_PRIVATE_SHIFT_	4U
17 #define SDEI_MAPF_CRITICAL_SHIFT_	5U
18 #define SDEI_MAPF_EXPLICIT_SHIFT_	6U
19 
20 /* SDEI event 0 */
21 #define SDEI_EVENT_0	0
22 
23 /* Placeholder interrupt for dynamic mapping */
24 #define SDEI_DYN_IRQ	0U
25 
26 /* SDEI flags */
27 
28 /*
29  * These flags determine whether or not an event can be associated with an
30  * interrupt. Static events are permanently associated with an interrupt, and
31  * can't be changed at runtime.  Association of dynamic events with interrupts
32  * can be changed at run time using the SDEI_INTERRUPT_BIND and
33  * SDEI_INTERRUPT_RELEASE calls.
34  *
35  * SDEI_MAPF_DYNAMIC only indicates run time configurability, where as
36  * SDEI_MAPF_BOUND indicates interrupt association. For example:
37  *
38  *  - Calling SDEI_INTERRUPT_BIND on a dynamic event will have both
39  *    SDEI_MAPF_DYNAMIC and SDEI_MAPF_BOUND set.
40  *
41  *  - Statically-bound events will always have SDEI_MAPF_BOUND set, and neither
42  *    SDEI_INTERRUPT_BIND nor SDEI_INTERRUPT_RELEASE can be called on them.
43  *
44  * See also the is_map_bound() macro.
45  */
46 #define SDEI_MAPF_DYNAMIC	BIT(SDEI_MAPF_DYNAMIC_SHIFT_)
47 #define SDEI_MAPF_BOUND		BIT(SDEI_MAPF_BOUND_SHIFT_)
48 #define SDEI_MAPF_EXPLICIT	BIT(SDEI_MAPF_EXPLICIT_SHIFT_)
49 
50 #define SDEI_MAPF_SIGNALABLE	BIT(SDEI_MAPF_SIGNALABLE_SHIFT_)
51 #define SDEI_MAPF_PRIVATE	BIT(SDEI_MAPF_PRIVATE_SHIFT_)
52 
53 #define SDEI_MAPF_NORMAL	0
54 #define SDEI_MAPF_CRITICAL	BIT(SDEI_MAPF_CRITICAL_SHIFT_)
55 
56 #endif /* SDEI_FLAGS_H */
57