feat(sdei): add a function to return total number of events registered

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
This commit is contained in:
John Powell 2022-05-12 12:49:55 -05:00 committed by Manish V Badarkhe
parent ff1e42e20a
commit e6381f9cf8
2 changed files with 26 additions and 2 deletions

View 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 */

View 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;
}