]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
plat/arm/fvp: Support performing SDEI platform setup in runtime
authorBalint Dobszay <balint.dobszay@arm.com>
Wed, 18 Dec 2019 14:28:00 +0000 (15:28 +0100)
committerMadhukar Pappireddy <madhukar.pappireddy@arm.com>
Fri, 15 May 2020 15:05:06 +0000 (10:05 -0500)
This patch introduces dynamic configuration for SDEI setup and is supported
when the new build flag SDEI_IN_FCONF is enabled. Instead of using C arrays
and processing the configuration at compile time, the config is moved to
dts files. It will be retrieved at runtime during SDEI init, using the fconf
layer.

Change-Id: If5c35a7517ba00a9f258d7f3e7c8c20cee169a31
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Co-authored-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
14 files changed:
Makefile
docs/getting_started/build-options.rst
fdts/fvp-base-gicv3-psci-common.dtsi
include/plat/arm/common/arm_def.h
include/plat/arm/common/fconf_sdei_getter.h [new file with mode: 0644]
include/plat/common/platform.h
include/services/sdei.h
include/services/sdei_flags.h [new file with mode: 0644]
make_helpers/defaults.mk
plat/arm/board/fvp/include/platform_def.h
plat/arm/common/aarch64/arm_sdei.c
plat/arm/common/arm_common.mk
plat/arm/common/fconf/fconf_sdei_getter.c [new file with mode: 0644]
services/std_svc/sdei/sdei_main.c

index 9972362691c8bff0130185f6a0984e5c90a19cfa..2f53cdf1b7936e3d92b077f62edc4eddea7961fd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -651,6 +651,12 @@ ifeq ($(DYN_DISABLE_AUTH), 1)
     endif
 endif
 
+# SDEI_IN_FCONF is only supported when SDEI_SUPPORT is enabled.
+ifeq ($(SDEI_SUPPORT)-$(SDEI_IN_FCONF),0-1)
+$(error "SDEI_IN_FCONF is an experimental feature and is only supported when \
+       SDEI_SUPPORT is enabled")
+endif
+
 # If pointer authentication is used in the firmware, make sure that all the
 # registers associated to it are also saved and restored.
 # Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
@@ -882,6 +888,7 @@ $(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
 $(eval $(call assert_boolean,USE_COHERENT_MEM))
 $(eval $(call assert_boolean,USE_DEBUGFS))
 $(eval $(call assert_boolean,ARM_IO_IN_DTB))
+$(eval $(call assert_boolean,SDEI_IN_FCONF))
 $(eval $(call assert_boolean,USE_ROMLIB))
 $(eval $(call assert_boolean,USE_TBBR_DEFS))
 $(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY))
@@ -961,6 +968,7 @@ $(eval $(call add_define,TRUSTED_BOARD_BOOT))
 $(eval $(call add_define,USE_COHERENT_MEM))
 $(eval $(call add_define,USE_DEBUGFS))
 $(eval $(call add_define,ARM_IO_IN_DTB))
+$(eval $(call add_define,SDEI_IN_FCONF))
 $(eval $(call add_define,USE_ROMLIB))
 $(eval $(call add_define,USE_TBBR_DEFS))
 $(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY))
index 6f3b605a86a6c31037f941434625f5ea5235f3db..c86307948df4349fe5f4552d3c1e3c793728cfd4 100644 (file)
@@ -645,6 +645,11 @@ Common build options
    configuration device tree, instead of static structure in the code base.
    This is currently an experimental feature.
 
+-  ``SDEI_IN_FCONF``: This flag determines whether to configure SDEI setup in
+   runtime using firmware configuration framework. The platform specific SDEI
+   shared and private events configuration is retrieved from device tree rather
+   than static C structures at compile time. This is currently an experimental
+   feature and is only supported if SDEI_SUPPORT build flag is enabled.
 
 -  ``USE_ROMLIB``: This flag determines whether library at ROM will be used.
    This feature creates a library of functions to be placed in ROM and thus
index fb73f60532265232a6c0414a29417aa006eb0eb6..4a7b6565814b5d313bb55949384a723a581932c7 100644 (file)
@@ -4,6 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <services/sdei_flags.h>
+
 /memreserve/ 0x80000000 0x00010000;
 
 / {
                max-pwr-lvl = <2>;
        };
 
+#if SDEI_IN_FCONF
+       firmware {
+               sdei {
+                       compatible = "arm,sdei-1.0";
+                       method = "smc";
+                       private_event_count = <3>;
+                       shared_event_count = <3>;
+                       /*
+                        * Each event descriptor has typically 3 fields:
+                        * 1. Event number
+                        * 2. Interrupt number the event is bound to or
+                        *    if event is dynamic, specified as SDEI_DYN_IRQ
+                        * 3. Bit map of event flags
+                        */
+                       private_events =        <1000 SDEI_DYN_IRQ SDEI_MAPF_DYNAMIC>,
+                                               <1001 SDEI_DYN_IRQ SDEI_MAPF_DYNAMIC>,
+                                               <1002 SDEI_DYN_IRQ SDEI_MAPF_DYNAMIC>;
+                       shared_events =         <2000 SDEI_DYN_IRQ SDEI_MAPF_DYNAMIC>,
+                                               <2001 SDEI_DYN_IRQ SDEI_MAPF_DYNAMIC>,
+                                               <2002 SDEI_DYN_IRQ SDEI_MAPF_DYNAMIC>;
+               };
+       };
+#endif /* SDEI_IN_FCONF */
+
        cpus {
                #address-cells = <2>;
                #size-cells = <0>;
index 7c852e19f24ab382af836e9302d2bd75a63bb0c7..89f7c61466c1324ecb61790218cba355044681ed 100644 (file)
 /* SGI used for SDEI signalling */
 #define ARM_SDEI_SGI                   ARM_IRQ_SEC_SGI_0
 
+#if SDEI_IN_FCONF
+/* ARM SDEI dynamic private event max count */
+#define ARM_SDEI_DP_EVENT_MAX_CNT      3
+
+/* ARM SDEI dynamic shared event max count */
+#define ARM_SDEI_DS_EVENT_MAX_CNT      3
+#else
 /* ARM SDEI dynamic private event numbers */
 #define ARM_SDEI_DP_EVENT_0            1000
 #define ARM_SDEI_DP_EVENT_1            1001
        SDEI_SHARED_EVENT(ARM_SDEI_DS_EVENT_0, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC), \
        SDEI_SHARED_EVENT(ARM_SDEI_DS_EVENT_1, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC), \
        SDEI_SHARED_EVENT(ARM_SDEI_DS_EVENT_2, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC)
+#endif /* SDEI_IN_FCONF */
 
 #endif /* ARM_DEF_H */
diff --git a/include/plat/arm/common/fconf_sdei_getter.h b/include/plat/arm/common/fconf_sdei_getter.h
new file mode 100644 (file)
index 0000000..e0a97a6
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef FCONF_SDEI_GETTER_H
+#define FCONF_SDEI_GETTER_H
+
+#include <lib/fconf/fconf.h>
+
+#include <platform_def.h>
+
+#define sdei__dyn_config_getter(id)    sdei_dyn_config.id
+
+struct sdei_dyn_config_t {
+       uint32_t private_ev_cnt;
+       int32_t private_ev_nums[PLAT_SDEI_DP_EVENT_MAX_CNT];
+       unsigned int private_ev_intrs[PLAT_SDEI_DP_EVENT_MAX_CNT];
+       unsigned int private_ev_flags[PLAT_SDEI_DP_EVENT_MAX_CNT];
+       uint32_t shared_ev_cnt;
+       int32_t shared_ev_nums[PLAT_SDEI_DS_EVENT_MAX_CNT];
+       unsigned int shared_ev_intrs[PLAT_SDEI_DS_EVENT_MAX_CNT];
+       unsigned int shared_ev_flags[PLAT_SDEI_DS_EVENT_MAX_CNT];
+};
+
+int fconf_populate_sdei_dyn_config(uintptr_t config);
+
+extern struct sdei_dyn_config_t sdei_dyn_config;
+
+#endif /* FCONF_SDEI_GETTER_H */
index b8ba14c572bac52e6f8cf561df28614c6702343c..720c259b8f6a419e8254419c13f468a9eefc3ba9 100644 (file)
@@ -132,6 +132,7 @@ struct meminfo *bl1_plat_sec_mem_layout(void);
 
 /* SDEI platform functions */
 #if SDEI_SUPPORT
+void plat_sdei_setup(void);
 int plat_sdei_validate_entry_point(uintptr_t ep, unsigned int client_mode);
 void plat_sdei_handle_masked_trigger(uint64_t mpidr, unsigned int intr);
 #endif
index ae8c7e42fdfb58e707fe8bf322aebb93609689be..063ed6f28654d0b561238dd9dfab5202c4e1a049 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -9,6 +9,7 @@
 
 #include <lib/spinlock.h>
 #include <lib/utils_def.h>
+#include <services/sdei_flags.h>
 
 /* Range 0xC4000020 - 0xC400003F reserved for SDE 64bit smc calls */
 #define SDEI_VERSION                           0xC4000020U
 #define SDEI_EV_HANDLED                0U
 #define SDEI_EV_FAILED         1U
 
-/* Internal: SDEI flag bit positions */
-#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   0U
-
-/* SDEI flags */
-
-/*
- * These flags determine whether or not an event can be associated with an
- * interrupt. Static events are permanently associated with an interrupt, and
- * can't be changed at runtime.  Association of dynamic events with interrupts
- * can be changed at run time using the SDEI_INTERRUPT_BIND and
- * SDEI_INTERRUPT_RELEASE calls.
- *
- * SDEI_MAPF_DYNAMIC only indicates run time configurability, where as
- * SDEI_MAPF_BOUND indicates interrupt association. For example:
- *
- *  - Calling SDEI_INTERRUPT_BIND on a dynamic event will have both
- *    SDEI_MAPF_DYNAMIC and SDEI_MAPF_BOUND set.
- *
- *  - Statically-bound events will always have SDEI_MAPF_BOUND set, and neither
- *    SDEI_INTERRUPT_BIND nor SDEI_INTERRUPT_RELEASE can be called on them.
- *
- * 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_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_)
-
 /* Indices of private and shared mappings */
 #define SDEI_MAP_IDX_PRIV_     0U
 #define SDEI_MAP_IDX_SHRD_     1U
diff --git a/include/services/sdei_flags.h b/include/services/sdei_flags.h
new file mode 100644 (file)
index 0000000..d1308f8
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SDEI_FLAGS_H
+#define SDEI_FLAGS_H
+
+#include <lib/utils_def.h>
+
+/* Internal: SDEI flag bit positions */
+#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   0U
+
+/* SDEI flags */
+
+/*
+ * These flags determine whether or not an event can be associated with an
+ * interrupt. Static events are permanently associated with an interrupt, and
+ * can't be changed at runtime.  Association of dynamic events with interrupts
+ * can be changed at run time using the SDEI_INTERRUPT_BIND and
+ * SDEI_INTERRUPT_RELEASE calls.
+ *
+ * SDEI_MAPF_DYNAMIC only indicates run time configurability, where as
+ * SDEI_MAPF_BOUND indicates interrupt association. For example:
+ *
+ *  - Calling SDEI_INTERRUPT_BIND on a dynamic event will have both
+ *    SDEI_MAPF_DYNAMIC and SDEI_MAPF_BOUND set.
+ *
+ *  - Statically-bound events will always have SDEI_MAPF_BOUND set, and neither
+ *    SDEI_INTERRUPT_BIND nor SDEI_INTERRUPT_RELEASE can be called on them.
+ *
+ * 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_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_)
+
+#endif /* SDEI_FLAGS_H */
index 608e963497a006c3b80e6d2cb539e185a9de5c0f..e5880d206113f8df0d4001f27c13d6367d96aa2e 100644 (file)
@@ -223,7 +223,10 @@ USE_COHERENT_MEM           := 1
 USE_DEBUGFS                    := 0
 
 # Build option to fconf based io
-ARM_IO_IN_DTB          := 0
+ARM_IO_IN_DTB                  := 0
+
+# Build option to support SDEI through fconf
+SDEI_IN_FCONF                  :=0
 
 # Build option to choose whether Trusted Firmware uses library at ROM
 USE_ROMLIB                     := 0
index 1ed30742961552549e8ecbdb1f7b33c45c625eb3..62ede9ab82b37bab692ffeb143d93629b6ca56af 100644 (file)
 
 #define PLAT_ARM_G0_IRQ_PROPS(grp)     ARM_G0_IRQ_PROPS(grp)
 
+#if SDEI_IN_FCONF
+#define PLAT_SDEI_DP_EVENT_MAX_CNT     ARM_SDEI_DP_EVENT_MAX_CNT
+#define PLAT_SDEI_DS_EVENT_MAX_CNT     ARM_SDEI_DS_EVENT_MAX_CNT
+#else
 #define PLAT_ARM_PRIVATE_SDEI_EVENTS   ARM_SDEI_PRIVATE_EVENTS
 #define PLAT_ARM_SHARED_SDEI_EVENTS    ARM_SDEI_SHARED_EVENTS
+#endif
 
 #define PLAT_ARM_SP_IMAGE_STACK_BASE   (PLAT_SP_IMAGE_NS_BUF_BASE +    \
                                         PLAT_SP_IMAGE_NS_BUF_SIZE)
index 493134b6a150a8dd9c7fe3e2caee8e8238337df4..3c74a465c690072c4924b5a0ec27790b7ef5cdbc 100644 (file)
@@ -1,16 +1,51 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 /* SDEI configuration for ARM platforms */
 
-#include <platform_def.h>
-
 #include <bl31/ehf.h>
+#include <common/debug.h>
 #include <services/sdei.h>
 
+#if SDEI_IN_FCONF
+#include <plat/arm/common/fconf_sdei_getter.h>
+#endif
+#include <plat/common/platform.h>
+#include <platform_def.h>
+
+
+#if SDEI_IN_FCONF
+/* Private event mappings */
+static sdei_ev_map_t arm_sdei_private[PLAT_SDEI_DP_EVENT_MAX_CNT + 1] = { 0 };
+
+/* Shared event mappings */
+static sdei_ev_map_t arm_sdei_shared[PLAT_SDEI_DS_EVENT_MAX_CNT] = { 0 };
+
+void plat_sdei_setup(void)
+{
+       uint32_t i;
+
+       arm_sdei_private[0] = (sdei_ev_map_t)SDEI_DEFINE_EVENT_0(ARM_SDEI_SGI);
+
+       for (i = 0; i < FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_cnt); i++) {
+               arm_sdei_private[i + 1] = (sdei_ev_map_t)SDEI_PRIVATE_EVENT(
+                       FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_nums[i]),
+                       FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_intrs[i]),
+                       FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_flags[i]));
+       }
+
+       for (i = 0; i < FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_cnt); i++) {
+               arm_sdei_shared[i] = (sdei_ev_map_t)SDEI_SHARED_EVENT( \
+                       FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_nums[i]),
+                       FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_intrs[i]),
+                       FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_flags[i]));
+       }
+       INFO("FCONF: SDEI platform setup\n");
+}
+#else
 /* Private event mappings */
 static sdei_ev_map_t arm_sdei_private[] = {
        PLAT_ARM_PRIVATE_SDEI_EVENTS
@@ -21,5 +56,11 @@ static sdei_ev_map_t arm_sdei_shared[] = {
        PLAT_ARM_SHARED_SDEI_EVENTS
 };
 
+void plat_sdei_setup(void)
+{
+       INFO("SDEI platform setup\n");
+}
+#endif /* SDEI_IN_FCONF */
+
 /* Export ARM SDEI events */
 REGISTER_SDEI_MAP(arm_sdei_private, arm_sdei_shared);
index 3b0c39d4b95eac8056fbff5631df99426c36ed96..387c131e1496e24f49de0b0082100fd1d976b697 100644 (file)
@@ -263,6 +263,9 @@ endif
 
 ifeq (${SDEI_SUPPORT},1)
 BL31_SOURCES           +=      plat/arm/common/aarch64/arm_sdei.c
+ifeq (${SDEI_IN_FCONF},1)
+BL31_SOURCES           +=      plat/arm/common/fconf/fconf_sdei_getter.c
+endif
 endif
 
 # RAS sources
diff --git a/plat/arm/common/fconf/fconf_sdei_getter.c b/plat/arm/common/fconf/fconf_sdei_getter.c
new file mode 100644 (file)
index 0000000..c26e316
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include <assert.h>
+
+#include <common/debug.h>
+#include <common/fdt_wrappers.h>
+#include <libfdt.h>
+#include <plat/arm/common/fconf_sdei_getter.h>
+
+#define PRIVATE_EVENT_NUM(i) private_events[3 * (i)]
+#define PRIVATE_EVENT_INTR(i) private_events[3 * (i) + 1]
+#define PRIVATE_EVENT_FLAGS(i) private_events[3 * (i) + 2]
+
+#define SHARED_EVENT_NUM(i) shared_events[3 * (i)]
+#define SHARED_EVENT_INTR(i) shared_events[3 * (i) + 1]
+#define SHARED_EVENT_FLAGS(i) shared_events[3 * (i) + 2]
+
+struct sdei_dyn_config_t sdei_dyn_config;
+
+int fconf_populate_sdei_dyn_config(uintptr_t config)
+{
+       uint32_t i;
+       int node, err;
+       uint32_t private_events[PLAT_SDEI_DP_EVENT_MAX_CNT * 3];
+       uint32_t shared_events[PLAT_SDEI_DS_EVENT_MAX_CNT * 3];
+
+       const void *dtb = (void *)config;
+
+       /* Check that the node offset points to compatible property */
+       node = fdt_node_offset_by_compatible(dtb, -1, "arm,sdei-1.0");
+       if (node < 0) {
+               ERROR("FCONF: Can't find 'arm,sdei-1.0' compatible node in dtb\n");
+               return node;
+       }
+
+       /* Read number of private mappings */
+       err = fdt_read_uint32(dtb, node, "private_event_count",
+                               &sdei_dyn_config.private_ev_cnt);
+       if (err < 0) {
+               ERROR("FCONF: Read cell failed for 'private_event_count': %u\n",
+                               sdei_dyn_config.private_ev_cnt);
+               return err;
+       }
+
+       /* Check if the value is in range */
+       if (sdei_dyn_config.private_ev_cnt > PLAT_SDEI_DP_EVENT_MAX_CNT) {
+               ERROR("FCONF: Invalid value for 'private_event_count': %u\n",
+                               sdei_dyn_config.private_ev_cnt);
+               return -1;
+       }
+
+       /* Read private mappings */
+       err = fdt_read_uint32_array(dtb, node, "private_events",
+                               sdei_dyn_config.private_ev_cnt * 3, private_events);
+       if (err < 0) {
+               ERROR("FCONF: Read cell failed for 'private_events': %d\n", err);
+               return err;
+       }
+
+       /* Move data to fconf struct */
+       for (i = 0; i < sdei_dyn_config.private_ev_cnt; i++) {
+               sdei_dyn_config.private_ev_nums[i]  = PRIVATE_EVENT_NUM(i);
+               sdei_dyn_config.private_ev_intrs[i] = PRIVATE_EVENT_INTR(i);
+               sdei_dyn_config.private_ev_flags[i] = PRIVATE_EVENT_FLAGS(i);
+       }
+
+       /* Read number of shared mappings */
+       err = fdt_read_uint32(dtb, node, "shared_event_count",
+                               &sdei_dyn_config.shared_ev_cnt);
+       if (err < 0) {
+               ERROR("FCONF: Read cell failed for 'shared_event_count'\n");
+               return err;
+       }
+
+       /* Check if the value is in range */
+       if (sdei_dyn_config.shared_ev_cnt > PLAT_SDEI_DS_EVENT_MAX_CNT) {
+               ERROR("FCONF: Invalid value for 'shared_event_count': %u\n",
+                               sdei_dyn_config.shared_ev_cnt);
+               return -1;
+       }
+
+       /* Read shared mappings */
+       err = fdt_read_uint32_array(dtb, node, "shared_events",
+                               sdei_dyn_config.shared_ev_cnt * 3, shared_events);
+       if (err < 0) {
+               ERROR("FCONF: Read cell failed for 'shared_events': %d\n", err);
+               return err;
+       }
+
+       /* Move data to fconf struct */
+       for (i = 0; i < sdei_dyn_config.shared_ev_cnt; i++) {
+               sdei_dyn_config.shared_ev_nums[i]  = SHARED_EVENT_NUM(i);
+               sdei_dyn_config.shared_ev_intrs[i] = SHARED_EVENT_INTR(i);
+               sdei_dyn_config.shared_ev_flags[i] = SHARED_EVENT_FLAGS(i);
+       }
+
+       return 0;
+}
+
+FCONF_REGISTER_POPULATOR(HW_CONFIG, sdei, fconf_populate_sdei_dyn_config);
index 04241776411695652182c62a63691cbfe6bf3af8..dba5e07ffac3e7d327e9de26379dde9cc0c5839e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -226,6 +226,7 @@ static void sdei_class_init(sdei_class_t class)
 /* SDEI dispatcher initialisation */
 void sdei_init(void)
 {
+       plat_sdei_setup();
        sdei_class_init(SDEI_CRITICAL);
        sdei_class_init(SDEI_NORMAL);
 
@@ -328,8 +329,11 @@ finish:
 }
 
 /* Register handler and argument for an SDEI event */
-static int64_t sdei_event_register(int ev_num, uint64_t ep, uint64_t arg,
-               uint64_t flags, uint64_t mpidr)
+static int64_t sdei_event_register(int ev_num,
+                               uint64_t ep,
+                               uint64_t arg,
+                               uint64_t flags,
+                               uint64_t mpidr)
 {
        int ret;
        unsigned int routing;