blob: 7de36cf0c8a40a620b8f89a2f1e22a41fe46daff [file] [log] [blame]
Manish Pandeyd27b37d2021-03-02 14:41:58 +00001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <debug.h>
8
9#include <ffa_helpers.h>
10#include <sp_helpers.h>
Manish Pandey58971b62020-09-21 21:10:38 +010011#include <spm_helpers.h>
Manish Pandeyd27b37d2021-03-02 14:41:58 +000012
Manish Pandeyf7aafef2021-03-03 11:31:47 +000013#include "cactus_test_cmds.h"
14#include "spm_common.h"
15
16extern ffa_vm_id_t g_ffa_id;
17
18static void managed_exit_handler(void)
19{
20 /*
21 * Real SP will save its context here.
22 * Send interrupt ID for acknowledgement
23 */
24 cactus_response(g_ffa_id, HYP_ID, MANAGED_EXIT_INTERRUPT_ID);
25}
26
Manish Pandeyd27b37d2021-03-02 14:41:58 +000027int cactus_irq_handler(void)
28{
29 uint32_t irq_num;
30
31 irq_num = spm_interrupt_get();
32
33 ERROR("%s: Interrupt ID %u not handled!\n", __func__, irq_num);
34
35 return 0;
36}
37
38int cactus_fiq_handler(void)
39{
40 uint32_t fiq_num;
41
42 fiq_num = spm_interrupt_get();
43
Manish Pandeyf7aafef2021-03-03 11:31:47 +000044 if (fiq_num == MANAGED_EXIT_INTERRUPT_ID) {
45 managed_exit_handler();
46 } else {
47 ERROR("%s: Interrupt ID %u not handled!\n", __func__, fiq_num);
48 }
Manish Pandeyd27b37d2021-03-02 14:41:58 +000049
50 return 0;
51}