blob: 3c74a465c690072c4924b5a0ec27790b7ef5cdbc [file] [log] [blame]
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +01001/*
Balint Dobszayd0dbd5e2019-12-18 15:28:00 +01002 * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/* SDEI configuration for ARM platforms */
8
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <bl31/ehf.h>
Balint Dobszayd0dbd5e2019-12-18 15:28:00 +010010#include <common/debug.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000011#include <services/sdei.h>
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +010012
Balint Dobszayd0dbd5e2019-12-18 15:28:00 +010013#if SDEI_IN_FCONF
14#include <plat/arm/common/fconf_sdei_getter.h>
15#endif
16#include <plat/common/platform.h>
17#include <platform_def.h>
18
19
20#if SDEI_IN_FCONF
21/* Private event mappings */
22static sdei_ev_map_t arm_sdei_private[PLAT_SDEI_DP_EVENT_MAX_CNT + 1] = { 0 };
23
24/* Shared event mappings */
25static sdei_ev_map_t arm_sdei_shared[PLAT_SDEI_DS_EVENT_MAX_CNT] = { 0 };
26
27void plat_sdei_setup(void)
28{
29 uint32_t i;
30
31 arm_sdei_private[0] = (sdei_ev_map_t)SDEI_DEFINE_EVENT_0(ARM_SDEI_SGI);
32
33 for (i = 0; i < FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_cnt); i++) {
34 arm_sdei_private[i + 1] = (sdei_ev_map_t)SDEI_PRIVATE_EVENT(
35 FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_nums[i]),
36 FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_intrs[i]),
37 FCONF_GET_PROPERTY(sdei, dyn_config, private_ev_flags[i]));
38 }
39
40 for (i = 0; i < FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_cnt); i++) {
41 arm_sdei_shared[i] = (sdei_ev_map_t)SDEI_SHARED_EVENT( \
42 FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_nums[i]),
43 FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_intrs[i]),
44 FCONF_GET_PROPERTY(sdei, dyn_config, shared_ev_flags[i]));
45 }
46 INFO("FCONF: SDEI platform setup\n");
47}
48#else
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +010049/* Private event mappings */
Jeenu Viswambharan6e284462017-12-08 10:38:24 +000050static sdei_ev_map_t arm_sdei_private[] = {
51 PLAT_ARM_PRIVATE_SDEI_EVENTS
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +010052};
53
54/* Shared event mappings */
Jeenu Viswambharan6e284462017-12-08 10:38:24 +000055static sdei_ev_map_t arm_sdei_shared[] = {
56 PLAT_ARM_SHARED_SDEI_EVENTS
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +010057};
58
Balint Dobszayd0dbd5e2019-12-18 15:28:00 +010059void plat_sdei_setup(void)
60{
61 INFO("SDEI platform setup\n");
62}
63#endif /* SDEI_IN_FCONF */
64
Jeenu Viswambharana5acc0a2017-09-22 08:32:10 +010065/* Export ARM SDEI events */
Jeenu Viswambharan6e284462017-12-08 10:38:24 +000066REGISTER_SDEI_MAP(arm_sdei_private, arm_sdei_shared);