aboutsummaryrefslogtreecommitdiff
path: root/spm/cactus/cactus_interrupt.c
blob: 7de36cf0c8a40a620b8f89a2f1e22a41fe46daff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <debug.h>

#include <ffa_helpers.h>
#include <sp_helpers.h>
#include <spm_helpers.h>

#include "cactus_test_cmds.h"
#include "spm_common.h"

extern ffa_vm_id_t g_ffa_id;

static void managed_exit_handler(void)
{
	/*
	 * Real SP will save its context here.
	 * Send interrupt ID for acknowledgement
	 */
	cactus_response(g_ffa_id, HYP_ID, MANAGED_EXIT_INTERRUPT_ID);
}

int cactus_irq_handler(void)
{
	uint32_t irq_num;

	irq_num = spm_interrupt_get();

	ERROR("%s: Interrupt ID %u not handled!\n", __func__, irq_num);

	return 0;
}

int cactus_fiq_handler(void)
{
	uint32_t fiq_num;

	fiq_num = spm_interrupt_get();

	if (fiq_num == MANAGED_EXIT_INTERRUPT_ID) {
		managed_exit_handler();
	} else {
		ERROR("%s: Interrupt ID %u not handled!\n", __func__, fiq_num);
	}

	return 0;
}