blob: 1cb5f4dad9090905d5359ae072f25f2aafd57826 [file] [log] [blame]
Olivier Deprez6967c242021-04-09 09:24:08 +02001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <spm_helpers.h>
8
9/*******************************************************************************
10 * Hypervisor Calls Wrappers
11 ******************************************************************************/
12
13uint32_t spm_interrupt_get(void)
14{
15 hvc_args args = {
16 .fid = SPM_INTERRUPT_GET
17 };
18
19 hvc_ret_values ret = tftf_hvc(&args);
20
21 return ret.ret0;
22}
23
Manish Pandey58971b62020-09-21 21:10:38 +010024/**
25 * Hypervisor call to enable/disable SP delivery of a virtual interrupt of
26 * int_id value through the IRQ or FIQ vector (pin).
27 * Returns 0 on success, or -1 if passing an invalid interrupt id.
28 */
29int64_t spm_interrupt_enable(uint32_t int_id, bool enable, enum interrupt_pin pin)
30{
31 hvc_args args = {
32 .fid = SPM_INTERRUPT_ENABLE,
33 .arg1 = int_id,
34 .arg2 = enable,
35 .arg3 = pin
36 };
37
38 hvc_ret_values ret = tftf_hvc(&args);
39
40 return (int64_t)ret.ret0;
41}
Madhukar Pappireddy46d06d72021-08-05 15:21:46 -050042
43/**
44 * Hypervisor call to drop the priority and de-activate a secure interrupt.
45 * Returns 0 on success, or -1 if passing an invalid interrupt id.
46 */
47int64_t spm_interrupt_deactivate(uint32_t vint_id)
48{
49 hvc_args args = {
50 .fid = SPM_INTERRUPT_DEACTIVATE,
51 .arg1 = vint_id, /* pint_id */
52 .arg2 = vint_id
53 };
54
55 hvc_ret_values ret = tftf_hvc(&args);
56
57 return (int64_t)ret.ret0;
58}