forked from mchehab/rasdaemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ras-events.h
116 lines (96 loc) · 2.54 KB
/
ras-events.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* Copyright (C) 2013 Mauro Carvalho Chehab <mchehab+redhat@kernel.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __RAS_EVENTS_H
#define __RAS_EVENTS_H
#include "ras-record.h"
#include <pthread.h>
#include <time.h>
#define MAX_PATH 1024
#define STR(x) #x
struct mce_priv;
enum {
MC_EVENT,
MCE_EVENT,
AER_EVENT,
NON_STANDARD_EVENT,
ARM_EVENT,
EXTLOG_EVENT,
DEVLINK_EVENT,
DISKERROR_EVENT,
MF_EVENT,
CXL_POISON_EVENT,
CXL_AER_UE_EVENT,
CXL_AER_CE_EVENT,
CXL_OVERFLOW_EVENT,
CXL_GENERIC_EVENT,
CXL_GENERAL_MEDIA_EVENT,
CXL_DRAM_EVENT,
CXL_MEMORY_MODULE_EVENT,
NR_EVENTS
};
struct ras_events {
char debugfs[MAX_PATH + 1];
char tracing[MAX_PATH + 1];
struct tep_handle *pevent;
int page_size;
/* Booleans */
unsigned use_uptime: 1;
unsigned record_events: 1;
/* For timestamp */
time_t uptime_diff;
/* For ras-record */
void *db_priv;
int db_ref_count;
pthread_mutex_t db_lock;
/* For the mce handler */
struct mce_priv *mce_priv;
/* For ABRT socket*/
int socketfd;
struct tep_event_filter *filters[NR_EVENTS];
};
struct pthread_data {
pthread_t thread;
struct tep_handle *pevent;
struct ras_events *ras;
int cpu;
};
/* Should match the code at Kernel's include/linux/edac.c */
enum hw_event_mc_err_type {
HW_EVENT_ERR_CORRECTED,
HW_EVENT_ERR_UNCORRECTED,
HW_EVENT_ERR_FATAL,
HW_EVENT_ERR_INFO,
};
/* Should match the code at Kernel's /drivers/pci/pcie/aer/aerdrv_errprint.c */
enum hw_event_aer_err_type {
HW_EVENT_AER_UNCORRECTED_NON_FATAL,
HW_EVENT_AER_UNCORRECTED_FATAL,
HW_EVENT_AER_CORRECTED,
};
/* Should match the code at Kernel's include/acpi/ghes.h */
enum ghes_severity {
GHES_SEV_NO,
GHES_SEV_CORRECTED,
GHES_SEV_RECOVERABLE,
GHES_SEV_PANIC,
};
/* Function prototypes */
int toggle_ras_mc_event(int enable);
int ras_offline_mce_event(struct ras_mc_offline_event *event);
int handle_ras_events(int record_events);
#endif