1 /*
2  * Copyright (c) 2021, Arm Limited. All rights reserved.
3  * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon
4  * company) or an affiliate of Cypress Semiconductor Corporation. All rights
5  * reserved.
6  *
7  * SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 #include "spm.h"
12 
13 #include "load/interrupt_defs.h"
14 #include "load/partition_defs.h"
15 #include "psa/service.h"
16 
17 /**
18  * \brief Return the IRQ load info context pointer associated with a signal
19  *
20  * \param[in]      p_ldinf      The load info of the partition in which we look
21  *                              for the signal.
22  * \param[in]      signal       The signal to query for.
23  *
24  * \retval NULL    if one of more the following are true:
25  *                 - the \ref psa_signal_t signal indicates more than one signal
26  *                 - the \ref psa_signal_t signal does not belong to the
27  *                   partition.
28  * \retval Any other value      The load info pointer associated with the signal
29  */
30 const struct irq_load_info_t *get_irq_info_for_signal(
31                                     const struct partition_load_info_t *p_ldinf,
32                                     psa_signal_t signal);
33 
34 /**
35  * \brief Entry of Secure interrupt handler. Platforms can call this function to
36  *        handle individual interrupts.
37  *
38  * \param[in] p_pt         The owner Partition of the interrupt to handle
39  * \param[in] p_ildi       The irq_load_info_t struct of the interrupt to handle
40  *
41  * Note:
42  *  The input parameters are maintained by platforms and they must be init-ed
43  *  in the interrupt init functions.
44  */
45 void spm_handle_interrupt(struct partition_t *p_pt,
46                           const struct irq_load_info_t *p_ildi);
47 
48 /*
49  * Prepare execution context for deprivileged FLIH functions
50  * Parameters:
51  *      p_owner_sp - IRQ owner partition_t pointer
52  *      flih_func  - The FLIH Function
53  */
54 uint32_t tfm_flih_prepare_depriv_flih(struct partition_t *p_owner_sp,
55                                       uintptr_t flih_func);
56 
57 /*
58  * Go back to ISR from FLIH functions
59  * Parameters:
60  *      result - The return value of the FLIH Function, indicating to the SPM
61  *               how to complete the FLIH processing, for example setting signal
62  *               to the Secure Partition.
63  *      p_ctx_flih_ret - The contents on the Main Stack when this function is
64  *                       called. It is used to restore context.
65  */
66 uint32_t tfm_flih_return_to_isr(psa_flih_result_t result,
67                                 struct context_flih_ret_t *p_ctx_flih_ret);
68