ppc64-diag
rtas_errd.h
Go to the documentation of this file.
1 
22 #ifndef _RTAS_ERRD_H
23 #define _RTAS_ERRD_H
24 
25 #include <signal.h>
26 #include <librtasevent.h>
27 #include <servicelog-1/servicelog.h>
28 #include "fru_prev6.h"
29 #include "config.h"
30 
31 extern char *platform_log;
32 extern char *messages_log;
33 extern char *proc_error_log1;
34 extern char *proc_error_log2;
35 extern char *rtas_errd_log;
36 extern char *rtas_errd_log0;
37 extern char *test_file;
38 
39 #ifdef DEBUG
40 extern char *scenario_file;
41 extern int testing_finished;
42 extern int no_drmgr;
47 #define RTAS_ERRD_ARGS "c:de:f:hl:m:p:Rs:"
48 #else
49 
53 #define RTAS_ERRD_ARGS "dh"
54 #endif
55 
56 extern int platform_log_fd;
57 extern int debug;
58 extern char *scanlog;
59 
60 extern struct servicelog *slog;
61 
62 #define RTAS_ERROR_LOG_MAX 4096
63 #define ADDL_TEXT_MAX 256
64 
65 #ifndef MAX
66 #define MAX(x,y) ((x) > (y) ? (x) : (y))
67 #endif
68 
69 #define TRUE 1
70 #define FALSE 0
71 
72 /* Structure containing error log entries for a device. */
73 struct errdata {
74  unsigned sequence; /* sequence # of entry */
75  unsigned time_stamp; /* entry timestamp */
76  unsigned err_id; /* error id code */
77 };
78 
79 struct diag_vpd {
80  char *ds; /* displayable message */
81  char *yl; /* location code */
82  char *fn; /* fru part number */
83  char *sn; /* fru serial number */
84  char *se; /* enclosure serial number */
85  char *tm; /* enclosure model number */
86 };
87 
97 struct event {
98  int seq_num;
100  int length;
101  struct rtas_event_hdr *rtas_hdr;
103  unsigned int flags;
104  char *loc_codes;
106  struct errdata errdata;
109  struct sl_event *sl_entry;
110 };
111 
112 /* flags for struct event */
113 #define RE_SCANLOG_AVAIL 0x00000001
114 #define RE_SERVICEABLE 0x00000002
115 #define RE_PLATDUMP_AVAIL 0x00000004
116 #define RE_PREDICTIVE 0x00000008
117 
118 #define RE_HMC_TAGGED 0x40000000
119 #define RE_ALREADY_REPORTED 0x20000000
120 #define RE_RECOVERED_ERROR 0x10000000
121 
122 extern char *epow_status_file;
123 
124 /* files.c */
125 #define dbg(_f, _a...) _dbg("%s(): "_f, __FUNCTION__, ##_a)
126 void log_msg(struct event *, char *, ...);
127 void cfg_log(char *, ...);
128 int init_files(void);
129 void close_files(void);
130 void _dbg(const char *, ...);
131 int print_rtas_event(struct event *);
132 int platform_log_write(char *, ...);
133 void update_epow_status_file(int);
134 int read_proc_error_log(char *, int);
135 
136 /* dump.c */
137 void check_scanlog_dump(void);
138 void check_platform_dump(struct event *);
139 
140 /* eeh.c */
141 void check_eeh(struct event *);
142 
143 /* guard.c */
144 void handle_resource_dealloc(struct event *);
145 
146 /* rtas_errd.c */
147 int handle_rtas_event(struct event *);
148 
149 /* update.c */
150 void update_rtas_msgs(void);
151 
152 /* ela.c */
153 int process_pre_v6(struct event *);
154 int get_error_fmt(struct event *);
155 
156 /* v6ela.c */
157 int process_v6(struct event *);
158 
159 /* diag_support.c */
160 char *get_dt_status(char *);
161 char *diag_get_fru_pn(struct event *, char *);
162 void free_diag_vpd(struct event *);
163 
164 /* menugoal.c */
165 int menugoal(struct event *, char *);
166 
167 /* epow.c */
168 void epow_timer_handler(int, siginfo_t, void *);
169 int check_epow(struct event *);
170 
171 /* servicelog.c */
172 time_t get_event_date(struct event *event);
173 int servicelog_sev(int rtas_sev);
174 void add_callout(struct event *event, char pri, int type, char *proc,
175  char *loc, char *pn, char *sn, char *ccin);
176 void log_event(struct event *);
177 
178 /* signal.c */
179 void sighup_handler(int, siginfo_t, void *);
180 void restore_sigchld_default(void);
181 void setup_sigchld_handler(void);
182 
183 /* prrn.c */
184 void handle_prrn_event(struct event *);
185 
186 /* hotplug.c */
187 void handle_hotplug_event(struct event *);
188 
189 #endif /* _RTAS_ERRD_H */
void free_diag_vpd(struct event *)
Definition: diag_support.c:39
void log_event(struct event *)
log the event in the servicelog DB
Definition: servicelog.c:216
char * rtas_errd_log0
Saved ("rolled over") messages log for rtas_errd daemon.
Definition: files.c:73
int process_v6(struct event *)
Definition: v6ela.c:526
int platform_log_fd
Definition: files.c:38
int debug
Debug level to run at for rtas_errd daemon.
Definition: rtas_errd.c:41
void check_scanlog_dump(void)
Check for new scanlog dumps.
Definition: dump.c:163
#define RTAS_ERROR_LOG_MAX
Definition: rtas_errd.h:62
Header for ppc64-diag config file.
struct to track and handle RTAS events in rtas_errd.
Definition: rtas_errd.h:97
void handle_hotplug_event(struct event *)
Definition: hotplug.c:34
int process_pre_v6(struct event *)
Handle older (pre-v6) style events.
Definition: ela.c:541
time_t get_event_date(struct event *event)
Retrieve the timestamp from an event.
Definition: servicelog.c:48
int servicelog_sev(int rtas_sev)
convert RTAS severity to servicelog severity
Definition: servicelog.c:102
void close_files(void)
Close all the files used by rtas_errd.
Definition: files.c:320
struct servicelog * slog
servicelog struct for libservicelog use
Definition: rtas_errd.c:62
char * proc_error_log2
Alternate file to read RTAS events from.
Definition: files.c:53
unsigned sequence
Definition: rtas_errd.h:74
void handle_resource_dealloc(struct event *)
Parse RTAS event for CPU guard information.
Definition: guard.c:548
char * tm
Definition: rtas_errd.h:85
void cfg_log(char *,...)
dummy interface for calls to diag_cfg
Definition: files.c:688
struct rtas_event * rtas_event
Definition: rtas_errd.h:108
#define ADDL_TEXT_MAX
Definition: rtas_errd.h:63
char * scanlog
buffer to hold scanlog dump path
Definition: files.c:94
int get_error_fmt(struct event *)
Extract the error log format indicator from the chrp error log.
Definition: ela.c:1196
char * platform_log
Definition: files.c:37
void check_eeh(struct event *)
Check a RTAS event for EEH event notification.
Definition: eeh.c:61
char * ds
Definition: rtas_errd.h:80
unsigned time_stamp
Definition: rtas_errd.h:75
char * diag_get_fru_pn(struct event *, char *)
Definition: diag_support.c:484
char * proc_error_log1
File to read RTAS events from.
Definition: files.c:52
Definition: rtas_errd.h:73
char * get_dt_status(char *)
Definition: diag_support.c:243
unsigned int flags
Definition: rtas_errd.h:103
char addl_text[ADDL_TEXT_MAX]
Definition: rtas_errd.h:105
int check_epow(struct event *)
Check an RTAS event for EPOW data.
Definition: epow.c:396
Definition: rtas_errd.h:79
int init_files(void)
Initialize files used by rtas_errd.
Definition: files.c:264
void setup_sigchld_handler(void)
setup child signal handler
Definition: signal.c:99
char * fn
Definition: rtas_errd.h:82
int length
Definition: rtas_errd.h:100
int platform_log_write(char *,...)
Write messages to the platform log.
Definition: files.c:860
int menugoal(struct event *, char *)
void log_msg(struct event *, char *,...)
Log messages to rtas_errd_log.
Definition: files.c:706
unsigned err_id
Definition: rtas_errd.h:76
struct sl_event * sl_entry
Definition: rtas_errd.h:109
void update_epow_status_file(int)
Update the epow status file.
Definition: files.c:887
int read_proc_error_log(char *, int)
Read data from proc_error_log.
Definition: files.c:351
void epow_timer_handler(int, siginfo_t, void *)
Routine to handle SIGALRM timer interrupts.
Definition: epow.c:63
void check_platform_dump(struct event *)
Check RTAS event for a platform dump.
Definition: dump.c:274
struct rtas_event_hdr * rtas_hdr
Definition: rtas_errd.h:101
char * test_file
char * messages_log
Definition: update.c:68
void restore_sigchld_default(void)
restore child signal handler
Definition: signal.c:73
char * epow_status_file
Definition: files.c:83
int print_rtas_event(struct event *)
Print an RTAS event to the platform log.
Definition: files.c:758
void update_rtas_msgs(void)
Update RTAS messages in the platform log.
Definition: update.c:207
int handle_rtas_event(struct event *)
Main routine for processing RTAS events.
Definition: rtas_errd.c:126
void sighup_handler(int, siginfo_t, void *)
signal handler for SIGHUP
Definition: signal.c:41
char * se
Definition: rtas_errd.h:84
char * loc_codes
Definition: rtas_errd.h:104
void add_callout(struct event *event, char pri, int type, char *proc, char *loc, char *pn, char *sn, char *ccin)
Add a new FRU callout to the list for this event.
Definition: servicelog.c:138
char * rtas_errd_log
Message log for the rtas_errd daemon.
Definition: files.c:72
void _dbg(const char *,...)
Write debug messages to stdout.
Definition: files.c:726
char event_buf[RTAS_ERROR_LOG_MAX]
Definition: rtas_errd.h:99
void handle_prrn_event(struct event *)
Definition: prrn.c:621
int seq_num
Definition: rtas_errd.h:98
char * yl
Definition: rtas_errd.h:81
char * sn
Definition: rtas_errd.h:83