xref: /rk3399_ARM-atf/plat/arm/board/neoverse_rd/common/include/nrd_ras.h (revision d153bcf427be7656277aec7997305acae0292a28)
1 /*
2  * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef NRD_RAS_H
8 #define NRD_RAS_H
9 
10 #include <lib/extensions/ras.h>
11 #include <plat/common/platform.h>
12 
13 /*
14  * Interrupt type supported.
15  * - NRD_RAS_INTR_TYPE_SPI: Denotes a SPI interrupt
16  * - NRD_RAS_INTR_TYPE_PPI: Denotes a PPI interrupt
17  */
18 #define NRD_RAS_INTR_TYPE_SPI 0
19 #define NRD_RAS_INTR_TYPE_PPI 1
20 
21 /* RAS error info data structure. */
22 struct nrd_ras_ev_map {
23 	int sdei_ev_num;	/* SDEI Event number */
24 	int intr;		/* Physical intr number */
25 	int intr_type;          /* Interrupt Type (SPI or PPI)*/
26 };
27 
28 /* RAS config data structure. Must be defined by each platform. */
29 struct plat_nrd_ras_config {
30 	struct nrd_ras_ev_map *ev_map;
31 	int ev_map_size;
32 };
33 
34 /*
35  * Find event map for a given interrupt number. On success, returns pointer
36  * to the event map. On error, returns NULL.
37  */
38 struct nrd_ras_ev_map *nrd_find_ras_event_map_by_intr(uint32_t intr_num);
39 
40 /*
41  * Initialization function for the framework.
42  *
43  * Registers RAS config provided by the platform and then configures and
44  * enables interrupt for each registered error. On success, return 0.
45  */
46 int nrd_ras_platform_setup(struct plat_nrd_ras_config *config);
47 
48 /* Base element RAM RAS interrupt handler function. */
49 int nrd_ras_sram_intr_handler(const struct err_record_info *err_rec,
50 				int probe_data,
51 				const struct err_handler_data *const data);
52 
53 /* CPU RAS interrupt handler */
54 int nrd_ras_cpu_intr_handler(const struct err_record_info *err_rec,
55 				int probe_data,
56 				const struct err_handler_data *const data);
57 
58 #endif /* NRD_RAS_H */
59