blob: 68f088a92398eb8303945732ca3a141796e02520 [file] [log] [blame]
Mauro Carvalho Chehab40e06412013-02-15 05:41:22 -03001#include <acpi/apei.h>
2#include <acpi/hed.h>
3
4/*
5 * One struct ghes is created for each generic hardware error source.
6 * It provides the context for APEI hardware error timer/IRQ/SCI/NMI
7 * handler.
8 *
9 * estatus: memory buffer for error status block, allocated during
10 * HEST parsing.
11 */
12#define GHES_TO_CLEAR 0x0001
13#define GHES_EXITING 0x0002
14
15struct ghes {
Tyler Baicar42aa5602017-06-21 12:17:04 -060016 union {
17 struct acpi_hest_generic *generic;
18 struct acpi_hest_generic_v2 *generic_v2;
19 };
Lv Zheng0a00fd52014-06-03 16:32:53 +080020 struct acpi_hest_generic_status *estatus;
Mauro Carvalho Chehab40e06412013-02-15 05:41:22 -030021 u64 buffer_paddr;
22 unsigned long flags;
23 union {
24 struct list_head list;
25 struct timer_list timer;
26 unsigned int irq;
27 };
28};
29
30struct ghes_estatus_node {
31 struct llist_node llnode;
32 struct acpi_hest_generic *generic;
Mauro Carvalho Chehab21480542013-02-15 06:10:39 -030033 struct ghes *ghes;
Mauro Carvalho Chehab40e06412013-02-15 05:41:22 -030034};
35
36struct ghes_estatus_cache {
37 u32 estatus_len;
38 atomic_t count;
39 struct acpi_hest_generic *generic;
40 unsigned long long time_in;
41 struct rcu_head rcu;
42};
43
44enum {
45 GHES_SEV_NO = 0x0,
46 GHES_SEV_CORRECTED = 0x1,
47 GHES_SEV_RECOVERABLE = 0x2,
48 GHES_SEV_PANIC = 0x3,
49};
Mauro Carvalho Chehab21480542013-02-15 06:10:39 -030050
51/* From drivers/edac/ghes_edac.c */
52
53#ifdef CONFIG_EDAC_GHES
54void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
55 struct cper_sec_mem_err *mem_err);
56
57int ghes_edac_register(struct ghes *ghes, struct device *dev);
58
59void ghes_edac_unregister(struct ghes *ghes);
60
61#else
62static inline void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
63 struct cper_sec_mem_err *mem_err)
64{
65}
66
67static inline int ghes_edac_register(struct ghes *ghes, struct device *dev)
68{
69 return 0;
70}
71
72static inline void ghes_edac_unregister(struct ghes *ghes)
73{
74}
75#endif