blob: 82fdae5c32c31b1c75d9205fbe7a1b3111b3224d [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
24void spm_debug_log(char c)
25{
26 hvc_args args = {
27 .fid = SPM_DEBUG_LOG,
28 .arg1 = c
29 };
30
31 (void)tftf_hvc(&args);
32}
Manish Pandey58971b62020-09-21 21:10:38 +010033
34/**
35 * Hypervisor call to enable/disable SP delivery of a virtual interrupt of
36 * int_id value through the IRQ or FIQ vector (pin).
37 * Returns 0 on success, or -1 if passing an invalid interrupt id.
38 */
39int64_t spm_interrupt_enable(uint32_t int_id, bool enable, enum interrupt_pin pin)
40{
41 hvc_args args = {
42 .fid = SPM_INTERRUPT_ENABLE,
43 .arg1 = int_id,
44 .arg2 = enable,
45 .arg3 = pin
46 };
47
48 hvc_ret_values ret = tftf_hvc(&args);
49
50 return (int64_t)ret.ret0;
51}
Madhukar Pappireddy46d06d72021-08-05 15:21:46 -050052
53/**
54 * Hypervisor call to drop the priority and de-activate a secure interrupt.
55 * Returns 0 on success, or -1 if passing an invalid interrupt id.
56 */
57int64_t spm_interrupt_deactivate(uint32_t vint_id)
58{
59 hvc_args args = {
60 .fid = SPM_INTERRUPT_DEACTIVATE,
61 .arg1 = vint_id, /* pint_id */
62 .arg2 = vint_id
63 };
64
65 hvc_ret_values ret = tftf_hvc(&args);
66
67 return (int64_t)ret.ret0;
68}