blob: dfd60d0bfd2783ec8d93e53c9134c48d5b690bde [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 {
16 struct acpi_hest_generic *generic;
Chen, Gong88f074f2013-10-18 14:28:59 -070017 struct acpi_generic_status *estatus;
Mauro Carvalho Chehab40e06412013-02-15 05:41:22 -030018 u64 buffer_paddr;
19 unsigned long flags;
20 union {
21 struct list_head list;
22 struct timer_list timer;
23 unsigned int irq;
24 };
25};
26
27struct ghes_estatus_node {
28 struct llist_node llnode;
29 struct acpi_hest_generic *generic;
Mauro Carvalho Chehab21480542013-02-15 06:10:39 -030030 struct ghes *ghes;
Mauro Carvalho Chehab40e06412013-02-15 05:41:22 -030031};
32
33struct ghes_estatus_cache {
34 u32 estatus_len;
35 atomic_t count;
36 struct acpi_hest_generic *generic;
37 unsigned long long time_in;
38 struct rcu_head rcu;
39};
40
41enum {
42 GHES_SEV_NO = 0x0,
43 GHES_SEV_CORRECTED = 0x1,
44 GHES_SEV_RECOVERABLE = 0x2,
45 GHES_SEV_PANIC = 0x3,
46};
Mauro Carvalho Chehab21480542013-02-15 06:10:39 -030047
48/* From drivers/edac/ghes_edac.c */
49
50#ifdef CONFIG_EDAC_GHES
51void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
52 struct cper_sec_mem_err *mem_err);
53
54int ghes_edac_register(struct ghes *ghes, struct device *dev);
55
56void ghes_edac_unregister(struct ghes *ghes);
57
58#else
59static inline void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
60 struct cper_sec_mem_err *mem_err)
61{
62}
63
64static inline int ghes_edac_register(struct ghes *ghes, struct device *dev)
65{
66 return 0;
67}
68
69static inline void ghes_edac_unregister(struct ghes *ghes)
70{
71}
72#endif