14ced5956SRohit Mathew /* 24ced5956SRohit Mathew * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved. 34ced5956SRohit Mathew * 44ced5956SRohit Mathew * SPDX-License-Identifier: BSD-3-Clause 54ced5956SRohit Mathew */ 64ced5956SRohit Mathew 74ced5956SRohit Mathew #ifndef NRD_RAS_H 84ced5956SRohit Mathew #define NRD_RAS_H 94ced5956SRohit Mathew 104ced5956SRohit Mathew #include <lib/extensions/ras.h> 114ced5956SRohit Mathew #include <plat/common/platform.h> 124ced5956SRohit Mathew 134ced5956SRohit Mathew /* 144ced5956SRohit Mathew * Interrupt type supported. 15*75414f71SRohit Mathew * - NRD_RAS_INTR_TYPE_SPI: Denotes a SPI interrupt 16*75414f71SRohit Mathew * - NRD_RAS_INTR_TYPE_PPI: Denotes a PPI interrupt 174ced5956SRohit Mathew */ 18*75414f71SRohit Mathew #define NRD_RAS_INTR_TYPE_SPI 0 19*75414f71SRohit Mathew #define NRD_RAS_INTR_TYPE_PPI 1 204ced5956SRohit Mathew 214ced5956SRohit Mathew /* RAS error info data structure. */ 2240ea4208SRohit Mathew struct nrd_ras_ev_map { 234ced5956SRohit Mathew int sdei_ev_num; /* SDEI Event number */ 244ced5956SRohit Mathew int intr; /* Physical intr number */ 254ced5956SRohit Mathew int intr_type; /* Interrupt Type (SPI or PPI)*/ 264ced5956SRohit Mathew }; 274ced5956SRohit Mathew 284ced5956SRohit Mathew /* RAS config data structure. Must be defined by each platform. */ 2940ea4208SRohit Mathew struct plat_nrd_ras_config { 3040ea4208SRohit Mathew struct nrd_ras_ev_map *ev_map; 314ced5956SRohit Mathew int ev_map_size; 324ced5956SRohit Mathew }; 334ced5956SRohit Mathew 344ced5956SRohit Mathew /* 354ced5956SRohit Mathew * Find event map for a given interrupt number. On success, returns pointer 364ced5956SRohit Mathew * to the event map. On error, returns NULL. 374ced5956SRohit Mathew */ 3840ea4208SRohit Mathew struct nrd_ras_ev_map *nrd_find_ras_event_map_by_intr(uint32_t intr_num); 394ced5956SRohit Mathew 404ced5956SRohit Mathew /* 414ced5956SRohit Mathew * Initialization function for the framework. 424ced5956SRohit Mathew * 434ced5956SRohit Mathew * Registers RAS config provided by the platform and then configures and 444ced5956SRohit Mathew * enables interrupt for each registered error. On success, return 0. 454ced5956SRohit Mathew */ 4640ea4208SRohit Mathew int nrd_ras_platform_setup(struct plat_nrd_ras_config *config); 474ced5956SRohit Mathew 484ced5956SRohit Mathew /* Base element RAM RAS interrupt handler function. */ 4940ea4208SRohit Mathew int nrd_ras_sram_intr_handler(const struct err_record_info *err_rec, 504ced5956SRohit Mathew int probe_data, 514ced5956SRohit Mathew const struct err_handler_data *const data); 524ced5956SRohit Mathew 534ced5956SRohit Mathew /* CPU RAS interrupt handler */ 5440ea4208SRohit Mathew int nrd_ras_cpu_intr_handler(const struct err_record_info *err_rec, 554ced5956SRohit Mathew int probe_data, 564ced5956SRohit Mathew const struct err_handler_data *const data); 574ced5956SRohit Mathew 584ced5956SRohit Mathew #endif /* NRD_RAS_H */ 59