]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(sdei): add a function to return total number of events registered
authorJohn Powell <john.powell@arm.com>
Thu, 12 May 2022 17:49:55 +0000 (12:49 -0500)
committerManish V Badarkhe <Manish.Badarkhe@arm.com>
Wed, 5 Oct 2022 14:25:28 +0000 (15:25 +0100)
This patch adds a public API to return the total number of registered
events. The purpose of this is primarily for DRTM to ensure that no
SDEI event can interfere with a dynamic launch.

Signed-off-by: John Powell <john.powell@arm.com>
Change-Id: I1d1cba2da7d5566cc340620ee1ce7d7844740b86

include/services/sdei.h
services/std_svc/sdei/sdei_event.c

index 063ed6f28654d0b561238dd9dfab5202c4e1a049..c12a182f0178bc441327165ffcd40592f37cf327 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2022, Arm Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -137,4 +137,7 @@ void sdei_init(void);
 /* Public API to dispatch an event to Normal world */
 int sdei_dispatch_event(int ev_num);
 
+/* Public API to check how many SDEI events are registered. */
+int sdei_get_registered_event_count(void);
+
 #endif /* SDEI_H */
index 0b608e1b64a60749a8b20306e2381df1b47ab106..e0c7971ac4fd83c3bc14d4674c65141b559fdb7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2022, Arm Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -99,3 +99,24 @@ sdei_ev_map_t *find_event_map(int ev_num)
 
        return NULL;
 }
+
+/*
+ * Return the total number of currently registered SDEI events.
+ */
+int sdei_get_registered_event_count(void)
+{
+       const sdei_mapping_t *mapping;
+       sdei_ev_map_t *map;
+       unsigned int i;
+       unsigned int j;
+       int count = 0;
+
+       /* Add up reg counts for each mapping. */
+       for_each_mapping_type(i, mapping) {
+               iterate_mapping(mapping, j, map) {
+                       count += map->reg_count;
+               }
+       }
+
+       return count;
+}