1 /*
2  * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include "tfm_hal_device_header.h"
9 #include "target_cfg.h"
10 #include "Driver_MPC.h"
11 #include "utilities.h"
12 /* "exception_info.h" must be the last include because of the IAR pragma */
13 #include "exception_info.h"
14 
15 /* Import MPC driver */
16 extern ARM_DRIVER_MPC Driver_CODE_SRAM_MPC;
17 
C_MPC_Handler(void)18 void C_MPC_Handler(void)
19 {
20     /* Clear MPC interrupt flag and pending MPC IRQ */
21     Driver_CODE_SRAM_MPC.ClearInterrupt();
22     NVIC_ClearPendingIRQ(S_MPC_COMBINED_IRQn);
23 
24     /* Print fault message and block execution */
25     ERROR_MSG("Platform Exception: MPC fault!!!");
26 
27     tfm_core_panic();
28 }
29 
MPC_Handler(void)30 __attribute__((naked)) void MPC_Handler(void)
31 {
32     EXCEPTION_INFO();
33 
34     __ASM volatile(
35         "BL        C_MPC_Handler           \n"
36         "B         .                       \n"
37     );
38 }
39 
C_PPC_Handler(void)40 void C_PPC_Handler(void)
41 {
42     /*
43      * Due to an issue on the FVP, the PPC fault doesn't trigger a
44      * PPC IRQ which is handled by the PPC_handler.
45      * In the FVP execution, this code is not execute.
46      */
47 
48     /* Clear PPC interrupt flag and pending PPC IRQ */
49     ppc_clear_irq();
50     NVIC_ClearPendingIRQ(S_PPC_COMBINED_IRQn);
51 
52     /* Print fault message*/
53     ERROR_MSG("Platform Exception: PPC fault!!!");
54 
55     tfm_core_panic();
56 }
57 
PPC_Handler(void)58 __attribute__((naked)) void PPC_Handler(void)
59 {
60     EXCEPTION_INFO();
61 
62     __ASM volatile(
63         "BL        C_PPC_Handler           \n"
64         "B         .                       \n"
65     );
66 }
67