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 /* 22 * MM Communicate information structure. Required to generate MM Communicate 23 * payload to be shared with Standalone MM. 24 */ 25 typedef struct mm_communicate_header { 26 struct efi_guid header_guid; 27 size_t message_len; 28 uint8_t data[1]; 29 } mm_communicate_header_t; 30 31 /* RAS error info data structure. */ 32 struct nrd_ras_ev_map { 33 int sdei_ev_num; /* SDEI Event number */ 34 int intr; /* Physical intr number */ 35 int intr_type; /* Interrupt Type (SPI or PPI)*/ 36 }; 37 38 /* RAS config data structure. Must be defined by each platform. */ 39 struct plat_nrd_ras_config { 40 struct nrd_ras_ev_map *ev_map; 41 int ev_map_size; 42 }; 43 44 /* 45 * Find event map for a given interrupt number. On success, returns pointer 46 * to the event map. On error, returns NULL. 47 */ 48 struct nrd_ras_ev_map *nrd_find_ras_event_map_by_intr(uint32_t intr_num); 49 50 /* 51 * Initialization function for the framework. 52 * 53 * Registers RAS config provided by the platform and then configures and 54 * enables interrupt for each registered error. On success, return 0. 55 */ 56 int nrd_ras_platform_setup(struct plat_nrd_ras_config *config); 57 58 /* Base element RAM RAS interrupt handler function. */ 59 int nrd_ras_sram_intr_handler(const struct err_record_info *err_rec, 60 int probe_data, 61 const struct err_handler_data *const data); 62 63 /* CPU RAS interrupt handler */ 64 int nrd_ras_cpu_intr_handler(const struct err_record_info *err_rec, 65 int probe_data, 66 const struct err_handler_data *const data); 67 68 #endif /* NRD_RAS_H */ 69