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 signal indicates more than one signal
26  *                              - the \ref 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(void *p_pt, const struct irq_load_info_t *p_ildi);
46 
47 /*
48  * Prepare execution context for deprivileged FLIH functions
49  * Parameters:
50  *      p_owner_sp - IRQ owner partition_t pointer
51  *      flih_func  - The FLIH Function
52  */
53 uint32_t tfm_flih_prepare_depriv_flih(struct partition_t *p_owner_sp,
54                                       uintptr_t flih_func);
55 
56 /*
57  * Go back to ISR from FLIH functions
58  * Parameters:
59  *      result - The return value of the FLIH Function, indicating to the SPM
60  *               how to complete the FLIH processing, for example setting signal
61  *               to the Secure Partition.
62  *      p_ctx_flih_ret - The contents on the Main Stack when this function is
63  *                       called. It is used to restore context.
64  */
65 uint32_t tfm_flih_return_to_isr(psa_flih_result_t result,
66                                 struct context_flih_ret_t *p_ctx_flih_ret);
67