123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #include <assert.h>
- #include <lib/utils.h>
- #include "sdei_private.h"
- #define MAP_OFF(_map, _mapping) ((_map) - (_mapping)->map)
- sdei_entry_t *get_event_entry(sdei_ev_map_t *map)
- {
- const sdei_mapping_t *mapping;
- sdei_entry_t *cpu_priv_base;
- unsigned int base_idx;
- long int idx;
- if (is_event_private(map)) {
-
- mapping = SDEI_PRIVATE_MAPPING();
- idx = MAP_OFF(map, mapping);
-
- base_idx = plat_my_core_pos() * ((unsigned int) mapping->num_maps);
- cpu_priv_base = &sdei_private_event_table[base_idx];
-
- return &cpu_priv_base[idx];
- } else {
- mapping = SDEI_SHARED_MAPPING();
- idx = MAP_OFF(map, mapping);
- return &sdei_shared_event_table[idx];
- }
- }
- sdei_ev_map_t *find_event_map_by_intr(unsigned int intr_num, bool shared)
- {
- const sdei_mapping_t *mapping;
- sdei_ev_map_t *map;
- unsigned int i;
-
- mapping = shared ? SDEI_SHARED_MAPPING() : SDEI_PRIVATE_MAPPING();
- iterate_mapping(mapping, i, map) {
- if (map->intr == intr_num)
- return map;
- }
- return NULL;
- }
- sdei_ev_map_t *find_event_map(int ev_num)
- {
- const sdei_mapping_t *mapping;
- sdei_ev_map_t *map;
- unsigned int i, j;
-
- for_each_mapping_type(i, mapping) {
- iterate_mapping(mapping, j, map) {
- if (map->ev_num == ev_num)
- return map;
- }
- }
- return NULL;
- }
- 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;
-
- for_each_mapping_type(i, mapping) {
- iterate_mapping(mapping, j, map) {
- count += map->reg_count;
- }
- }
- return count;
- }
|