Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 1 | /* |
Omkar Anand Kulkarni | aa8abf0 | 2023-05-31 11:29:17 +0530 | [diff] [blame] | 2 | * Copyright (c) 2018-2023, ARM Limited and Contributors. All rights reserved. |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef SGI_RAS_H |
| 8 | #define SGI_RAS_H |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 9 | |
Omkar Anand Kulkarni | aa8abf0 | 2023-05-31 11:29:17 +0530 | [diff] [blame] | 10 | #include <lib/extensions/ras.h> |
| 11 | #include <plat/common/platform.h> |
| 12 | |
| 13 | /* |
| 14 | * Interrupt type supported. |
| 15 | * - SGI_RAS_INTR_TYPE_SPI: Denotes a SPI interrupt |
| 16 | * - SGI_RAS_INTR_TYPE_PPI: Denotes a PPI interrupt |
| 17 | */ |
| 18 | #define SGI_RAS_INTR_TYPE_SPI 0 |
| 19 | #define SGI_RAS_INTR_TYPE_PPI 1 |
| 20 | |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 21 | /* |
Omkar Anand Kulkarni | aa8abf0 | 2023-05-31 11:29:17 +0530 | [diff] [blame] | 22 | * MM Communicate information structure. Required to generate MM Communicate |
| 23 | * payload to be shared with Standalone MM. |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 24 | */ |
Omkar Anand Kulkarni | aa8abf0 | 2023-05-31 11:29:17 +0530 | [diff] [blame] | 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. */ |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 32 | struct sgi_ras_ev_map { |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 33 | int sdei_ev_num; /* SDEI Event number */ |
| 34 | int intr; /* Physical intr number */ |
Omkar Anand Kulkarni | aa8abf0 | 2023-05-31 11:29:17 +0530 | [diff] [blame] | 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_sgi_ras_config { |
| 40 | struct sgi_ras_ev_map *ev_map; |
| 41 | int ev_map_size; |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 42 | }; |
| 43 | |
Omkar Anand Kulkarni | aa8abf0 | 2023-05-31 11:29:17 +0530 | [diff] [blame] | 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 sgi_ras_ev_map *sgi_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 sgi_ras_platform_setup(struct plat_sgi_ras_config *config); |
Sughosh Ganu | 18f513d | 2018-05-16 17:22:35 +0530 | [diff] [blame] | 57 | |
Omkar Anand Kulkarni | 43525c4 | 2023-05-31 12:14:10 +0530 | [diff] [blame] | 58 | /* Base element RAM RAS interrupt handler function. */ |
| 59 | int sgi_ras_sram_intr_handler(const struct err_record_info *err_rec, |
| 60 | int probe_data, |
| 61 | const struct err_handler_data *const data); |
| 62 | |
Omkar Anand Kulkarni | 1ab5c60 | 2023-06-27 16:32:47 +0530 | [diff] [blame] | 63 | /* CPU RAS interrupt handler */ |
| 64 | int sgi_ras_cpu_intr_handler(const struct err_record_info *err_rec, |
| 65 | int probe_data, |
| 66 | const struct err_handler_data *const data); |
| 67 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 68 | #endif /* SGI_RAS_H */ |