summaryrefslogtreecommitdiffstats
path: root/plat/arm/css/sgi/include/sgi_ras.h
blob: d311807e300e30f5ba425e2345bf11bf4753c13d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * Copyright (c) 2018-2023, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef SGI_RAS_H
#define SGI_RAS_H

#include <lib/extensions/ras.h>
#include <plat/common/platform.h>

/*
 * Interrupt type supported.
 * - SGI_RAS_INTR_TYPE_SPI: Denotes a SPI interrupt
 * - SGI_RAS_INTR_TYPE_PPI: Denotes a PPI interrupt
 */
#define SGI_RAS_INTR_TYPE_SPI 0
#define SGI_RAS_INTR_TYPE_PPI 1

/*
 * MM Communicate information structure. Required to generate MM Communicate
 * payload to be shared with Standalone MM.
 */
typedef struct mm_communicate_header {
	struct efi_guid	header_guid;
	size_t		message_len;
	uint8_t		data[1];
} mm_communicate_header_t;

/* RAS error info data structure. */
struct sgi_ras_ev_map {
	int sdei_ev_num;	/* SDEI Event number */
	int intr;		/* Physical intr number */
	int intr_type;          /* Interrupt Type (SPI or PPI)*/
};

/* RAS config data structure. Must be defined by each platform. */
struct plat_sgi_ras_config {
	struct sgi_ras_ev_map *ev_map;
	int ev_map_size;
};

/*
 * Find event map for a given interrupt number. On success, returns pointer
 * to the event map. On error, returns NULL.
 */
struct sgi_ras_ev_map *sgi_find_ras_event_map_by_intr(uint32_t intr_num);

/*
 * Initialization function for the framework.
 *
 * Registers RAS config provided by the platform and then configures and
 * enables interrupt for each registered error. On success, return 0.
 */
int sgi_ras_platform_setup(struct plat_sgi_ras_config *config);

/* Base element RAM RAS interrupt handler function. */
int sgi_ras_sram_intr_handler(const struct err_record_info *err_rec,
				int probe_data,
				const struct err_handler_data *const data);

/* CPU RAS interrupt handler */
int sgi_ras_cpu_intr_handler(const struct err_record_info *err_rec,
				int probe_data,
				const struct err_handler_data *const data);

#endif /* SGI_RAS_H */