1 /*
2  * Copyright (c) 2003 Sun Microsystems, Inc.  All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistribution of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistribution in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * Neither the name of Sun Microsystems, Inc. or the names of
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * This software is provided "AS IS," without a warranty of any kind.
20  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
21  * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
22  * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
23  * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
24  * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
25  * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL
26  * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
27  * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
28  * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
29  * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
30  * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
31  */
32 
33 #ifndef IPMI_SEL_H
34 #define IPMI_SEL_H
35 
36 #include <inttypes.h>
37 #include <ipmitool/ipmi.h>
38 #include <ipmitool/ipmi_sdr.h>
39 
40 #define IPMI_CMD_GET_SEL_INFO		0x40
41 #define IPMI_CMD_GET_SEL_ALLOC_INFO	0x41
42 #define IPMI_CMD_RESERVE_SEL		0x42
43 #define IPMI_CMD_GET_SEL_ENTRY		0x43
44 #define IPMI_CMD_ADD_SEL_ENTRY		0x44
45 #define IPMI_CMD_PARTIAL_ADD_SEL_ENTRY	0x45
46 #define IPMI_CMD_DELETE_SEL_ENTRY	0x46
47 #define IPMI_CMD_CLEAR_SEL		0x47
48 #define IPMI_CMD_GET_SEL_TIME		0x48
49 #define IPMI_CMD_SET_SEL_TIME		0x49
50 #define IPMI_CMD_GET_AUX_LOG_STATUS	0x5A
51 #define IPMI_CMD_SET_AUX_LOG_STATUS	0x5B
52 
53 enum {
54 	IPMI_EVENT_CLASS_DISCRETE,
55 	IPMI_EVENT_CLASS_DIGITAL,
56 	IPMI_EVENT_CLASS_THRESHOLD,
57 	IPMI_EVENT_CLASS_OEM,
58 };
59 
60 #ifdef HAVE_PRAGMA_PACK
61 #pragma pack(1)
62 #endif
63 struct sel_get_rq {
64 	uint16_t	reserve_id;
65 	uint16_t	record_id;
66 	uint8_t	offset;
67 	uint8_t	length;
68 } ATTRIBUTE_PACKING;
69 #ifdef HAVE_PRAGMA_PACK
70 #pragma pack(0)
71 #endif
72 
73 struct standard_spec_sel_rec{
74 	uint32_t	timestamp;
75 	uint16_t	gen_id;
76 	uint8_t	evm_rev;
77 	uint8_t	sensor_type;
78 	uint8_t	sensor_num;
79 #if WORDS_BIGENDIAN
80 	uint8_t	event_dir  : 1;
81 	uint8_t	event_type : 7;
82 #else
83 	uint8_t	event_type : 7;
84 	uint8_t	event_dir  : 1;
85 #endif
86 #define DATA_BYTE2_SPECIFIED_MASK	0xc0    /* event_data[0] bit mask */
87 #define DATA_BYTE3_SPECIFIED_MASK	0x30    /* event_data[0] bit mask */
88 #define EVENT_OFFSET_MASK		0x0f    /* event_data[0] bit mask */
89 	uint8_t	event_data[3];
90 };
91 /* Dell Specific MACRO's */
92 #define	OEM_CODE_IN_BYTE2		0x80	  /* Dell specific OEM Byte in Byte 2 Mask */
93 #define	OEM_CODE_IN_BYTE3		0x20	  /* Dell specific OEM Byte in Byte 3 Mask */
94 /* MASK MACROS */
95 #define	MASK_LOWER_NIBBLE		0x0F
96 #define	MASK_HIGHER_NIBBLE		0xF0
97 /*Senosr type Macro's */
98 #define	SENSOR_TYPE_MEMORY		0x0C
99 #define	SENSOR_TYPE_CRIT_INTR		0x13
100 #define	SENSOR_TYPE_EVT_LOG		0x10
101 #define	SENSOR_TYPE_SYS_EVENT		0x12
102 #define	SENSOR_TYPE_PROCESSOR		0x07
103 #define	SENSOR_TYPE_OEM_SEC_EVENT	0xC1
104 #define SENSOR_TYPE_VER_CHANGE		0x2B
105 #define	SENSOR_TYPE_FRM_PROG		0x0F
106 #define	SENSOR_TYPE_WTDOG		0x23
107 #define	SENSOR_TYPE_OEM_NFATAL_ERROR	0xC2
108 #define	SENSOR_TYPE_OEM_FATAL_ERROR	0xC3
109 #define SENSOR_TYPE_TXT_CMD_ERROR	0x20
110 #define SENSOR_TYPE_SUPERMICRO_OEM 0xD0
111 /* End of Macro for DELL Specific */
112 #define SEL_OEM_TS_DATA_LEN		6
113 #define SEL_OEM_NOTS_DATA_LEN		13
114 struct oem_ts_spec_sel_rec{
115 	uint32_t timestamp;
116 	uint8_t manf_id[3];
117 	uint8_t	oem_defined[SEL_OEM_TS_DATA_LEN];
118 };
119 
120 struct oem_nots_spec_sel_rec{
121 	uint8_t oem_defined[SEL_OEM_NOTS_DATA_LEN];
122 };
123 
124 #ifdef HAVE_PRAGMA_PACK
125 #pragma pack(1)
126 #endif
127 struct sel_event_record {
128 	uint16_t	record_id;
129 	uint8_t	record_type;
130 	union{
131 		struct standard_spec_sel_rec standard_type;
132 		struct oem_ts_spec_sel_rec oem_ts_type;
133 		struct oem_nots_spec_sel_rec oem_nots_type;
134 	} sel_type;
135 } ATTRIBUTE_PACKING;
136 #ifdef HAVE_PRAGMA_PACK
137 #pragma pack(0)
138 #endif
139 
140 struct ipmi_event_sensor_types {
141 	uint8_t	code;
142 	uint8_t	offset;
143 #define ALL_OFFSETS_SPECIFIED  0xff
144 	uint8_t   data;
145 	const char	* desc;
146 };
147 
148 static const struct ipmi_event_sensor_types generic_event_types[] = {
149     /* Threshold Based States */
150     { 0x01, 0x00, 0xff, "Lower Non-critical going low " },
151     { 0x01, 0x01, 0xff, "Lower Non-critical going high" },
152     { 0x01, 0x02, 0xff, "Lower Critical going low " },
153     { 0x01, 0x03, 0xff, "Lower Critical going high" },
154     { 0x01, 0x04, 0xff, "Lower Non-recoverable going low " },
155     { 0x01, 0x05, 0xff, "Lower Non-recoverable going high" },
156     { 0x01, 0x06, 0xff, "Upper Non-critical going low " },
157     { 0x01, 0x07, 0xff, "Upper Non-critical going high" },
158     { 0x01, 0x08, 0xff, "Upper Critical going low " },
159     { 0x01, 0x09, 0xff, "Upper Critical going high" },
160     { 0x01, 0x0a, 0xff, "Upper Non-recoverable going low " },
161     { 0x01, 0x0b, 0xff, "Upper Non-recoverable going high" },
162     /* DMI-based "usage state" States */
163     { 0x02, 0x00, 0xff, "Transition to Idle" },
164     { 0x02, 0x01, 0xff, "Transition to Active" },
165     { 0x02, 0x02, 0xff, "Transition to Busy" },
166     /* Digital-Discrete Event States */
167     { 0x03, 0x00, 0xff, "State Deasserted" },
168     { 0x03, 0x01, 0xff, "State Asserted" },
169     { 0x04, 0x00, 0xff, "Predictive Failure Deasserted" },
170     { 0x04, 0x01, 0xff, "Predictive Failure Asserted" },
171     { 0x05, 0x00, 0xff, "Limit Not Exceeded" },
172     { 0x05, 0x01, 0xff, "Limit Exceeded" },
173     { 0x06, 0x00, 0xff, "Performance Met" },
174     { 0x06, 0x01, 0xff, "Performance Lags" },
175     /* Severity Event States */
176     { 0x07, 0x00, 0xff, "Transition to OK" },
177     { 0x07, 0x01, 0xff, "Transition to Non-critical from OK" },
178     { 0x07, 0x02, 0xff, "Transition to Critical from less severe" },
179     { 0x07, 0x03, 0xff, "Transition to Non-recoverable from less severe" },
180     { 0x07, 0x04, 0xff, "Transition to Non-critical from more severe" },
181     { 0x07, 0x05, 0xff, "Transition to Critical from Non-recoverable" },
182     { 0x07, 0x06, 0xff, "Transition to Non-recoverable" },
183     { 0x07, 0x07, 0xff, "Monitor" },
184     { 0x07, 0x08, 0xff, "Informational" },
185     /* Availability Status States */
186     { 0x08, 0x00, 0xff, "Device Absent" },
187     { 0x08, 0x01, 0xff, "Device Present" },
188     { 0x09, 0x00, 0xff, "Device Disabled" },
189     { 0x09, 0x01, 0xff, "Device Enabled" },
190     { 0x0a, 0x00, 0xff, "Transition to Running" },
191     { 0x0a, 0x01, 0xff, "Transition to In Test" },
192     { 0x0a, 0x02, 0xff, "Transition to Power Off" },
193     { 0x0a, 0x03, 0xff, "Transition to On Line" },
194     { 0x0a, 0x04, 0xff, "Transition to Off Line" },
195     { 0x0a, 0x05, 0xff, "Transition to Off Duty" },
196     { 0x0a, 0x06, 0xff, "Transition to Degraded" },
197     { 0x0a, 0x07, 0xff, "Transition to Power Save" },
198     { 0x0a, 0x08, 0xff, "Install Error" },
199     /* Redundancy States */
200     { 0x0b, 0x00, 0xff, "Fully Redundant" },
201     { 0x0b, 0x01, 0xff, "Redundancy Lost" },
202     { 0x0b, 0x02, 0xff, "Redundancy Degraded" },
203     { 0x0b, 0x03, 0xff, "Non-Redundant: Sufficient from Redundant" },
204     { 0x0b, 0x04, 0xff, "Non-Redundant: Sufficient from Insufficient" },
205     { 0x0b, 0x05, 0xff, "Non-Redundant: Insufficient Resources" },
206     { 0x0b, 0x06, 0xff, "Redundancy Degraded from Fully Redundant" },
207     { 0x0b, 0x07, 0xff, "Redundancy Degraded from Non-Redundant" },
208     /* ACPI Device Power States */
209     { 0x0c, 0x00, 0xff, "D0 Power State" },
210     { 0x0c, 0x01, 0xff, "D1 Power State" },
211     { 0x0c, 0x02, 0xff, "D2 Power State" },
212     { 0x0c, 0x03, 0xff, "D3 Power State" },
213     /* END */
214     { 0x00, 0x00, 0xff, NULL },
215 };
216 
217 static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
218     /* Physical Security */
219     { 0x05, 0x00, 0xff, "General Chassis intrusion" },
220     { 0x05, 0x01, 0xff, "Drive Bay intrusion" },
221     { 0x05, 0x02, 0xff, "I/O Card area intrusion" },
222     { 0x05, 0x03, 0xff, "Processor area intrusion" },
223     { 0x05, 0x04, 0xff, "System unplugged from LAN" },
224     { 0x05, 0x05, 0xff, "Unauthorized dock" },
225     { 0x05, 0x06, 0xff, "FAN area intrusion" },
226     /* Platform Security */
227     { 0x06, 0x00, 0xff, "Front Panel Lockout violation attempted" },
228     { 0x06, 0x01, 0xff, "Pre-boot password violation - user password" },
229     { 0x06, 0x02, 0xff, "Pre-boot password violation - setup password" },
230     { 0x06, 0x03, 0xff, "Pre-boot password violation - network boot password" },
231     { 0x06, 0x04, 0xff, "Other pre-boot password violation" },
232     { 0x06, 0x05, 0xff, "Out-of-band access password violation" },
233     /* Processor */
234     { 0x07, 0x00, 0xff, "IERR" },
235     { 0x07, 0x01, 0xff, "Thermal Trip" },
236     { 0x07, 0x02, 0xff, "FRB1/BIST failure" },
237     { 0x07, 0x03, 0xff, "FRB2/Hang in POST failure" },
238     { 0x07, 0x04, 0xff, "FRB3/Processor startup/init failure" },
239     { 0x07, 0x05, 0xff, "Configuration Error" },
240     { 0x07, 0x06, 0xff, "SM BIOS Uncorrectable CPU-complex Error" },
241     { 0x07, 0x07, 0xff, "Presence detected" },
242     { 0x07, 0x08, 0xff, "Disabled" },
243     { 0x07, 0x09, 0xff, "Terminator presence detected" },
244     { 0x07, 0x0a, 0xff, "Throttled" },
245     { 0x07, 0x0b, 0xff, "Uncorrectable machine check exception" },
246     { 0x07, 0x0c, 0xff, "Correctable machine check error" },
247     /* Power Supply */
248     { 0x08, 0x00, 0xff, "Presence detected" },
249     { 0x08, 0x01, 0xff, "Failure detected" },
250     { 0x08, 0x02, 0xff, "Predictive failure" },
251     { 0x08, 0x03, 0xff, "Power Supply AC lost" },
252     { 0x08, 0x04, 0xff, "AC lost or out-of-range" },
253     { 0x08, 0x05, 0xff, "AC out-of-range, but present" },
254     { 0x08, 0x06, 0x00, "Config Error: Vendor Mismatch" },
255     { 0x08, 0x06, 0x01, "Config Error: Revision Mismatch" },
256     { 0x08, 0x06, 0x02, "Config Error: Processor Missing" },
257     { 0x08, 0x06, 0x03, "Config Error: Power Supply Rating Mismatch" },
258     { 0x08, 0x06, 0x04, "Config Error: Voltage Rating Mismatch" },
259     { 0x08, 0x06, 0xff, "Config Error" },
260     { 0x08, 0x06, 0xff, "Power Supply Inactive" },
261     /* Power Unit */
262     { 0x09, 0x00, 0xff, "Power off/down" },
263     { 0x09, 0x01, 0xff, "Power cycle" },
264     { 0x09, 0x02, 0xff, "240VA power down" },
265     { 0x09, 0x03, 0xff, "Interlock power down" },
266     { 0x09, 0x04, 0xff, "AC lost" },
267     { 0x09, 0x05, 0xff, "Soft-power control failure" },
268     { 0x09, 0x06, 0xff, "Failure detected" },
269     { 0x09, 0x07, 0xff, "Predictive failure" },
270     /* Memory */
271     { 0x0c, 0x00, 0xff, "Correctable ECC" },
272     { 0x0c, 0x01, 0xff, "Uncorrectable ECC" },
273     { 0x0c, 0x02, 0xff, "Parity" },
274     { 0x0c, 0x03, 0xff, "Memory Scrub Failed" },
275     { 0x0c, 0x04, 0xff, "Memory Device Disabled" },
276     { 0x0c, 0x05, 0xff, "Correctable ECC logging limit reached" },
277     { 0x0c, 0x06, 0xff, "Presence Detected" },
278     { 0x0c, 0x07, 0xff, "Configuration Error" },
279     { 0x0c, 0x08, 0xff, "Spare" },
280     { 0x0c, 0x09, 0xff, "Throttled" },
281     { 0x0c, 0x0a, 0xff, "Critical Overtemperature" },
282     /* Drive Slot */
283     { 0x0d, 0x00, 0xff, "Drive Present" },
284     { 0x0d, 0x01, 0xff, "Drive Fault" },
285     { 0x0d, 0x02, 0xff, "Predictive Failure" },
286     { 0x0d, 0x03, 0xff, "Hot Spare" },
287     { 0x0d, 0x04, 0xff, "Parity Check In Progress" },
288     { 0x0d, 0x05, 0xff, "In Critical Array" },
289     { 0x0d, 0x06, 0xff, "In Failed Array" },
290     { 0x0d, 0x07, 0xff, "Rebuild In Progress" },
291     { 0x0d, 0x08, 0xff, "Rebuild Aborted" },
292     /* System Firmware Error */
293     { 0x0f, 0x00, 0x00, "Unspecified" },
294     { 0x0f, 0x00, 0x01, "No system memory installed" },
295     { 0x0f, 0x00, 0x02, "No usable system memory" },
296     { 0x0f, 0x00, 0x03, "Unrecoverable IDE device failure" },
297     { 0x0f, 0x00, 0x04, "Unrecoverable system-board failure" },
298     { 0x0f, 0x00, 0x05, "Unrecoverable diskette failure" },
299     { 0x0f, 0x00, 0x06, "Unrecoverable hard-disk controller failure" },
300     { 0x0f, 0x00, 0x07, "Unrecoverable PS/2 or USB keyboard failure" },
301     { 0x0f, 0x00, 0x08, "Removable boot media not found" },
302     { 0x0f, 0x00, 0x09, "Unrecoverable video controller failure" },
303     { 0x0f, 0x00, 0x0a, "No video device selected" },
304     { 0x0f, 0x00, 0x0b, "BIOS corruption detected" },
305     { 0x0f, 0x00, 0x0c, "CPU voltage mismatch" },
306     { 0x0f, 0x00, 0x0d, "CPU speed mismatch failure" },
307     { 0x0f, 0x00, 0xff, "Unknown Error" },
308     /* System Firmware Hang */
309     { 0x0f, 0x01, 0x00, "Unspecified" },
310     { 0x0f, 0x01, 0x01, "Memory initialization" },
311     { 0x0f, 0x01, 0x02, "Hard-disk initialization" },
312     { 0x0f, 0x01, 0x03, "Secondary CPU Initialization" },
313     { 0x0f, 0x01, 0x04, "User authentication" },
314     { 0x0f, 0x01, 0x05, "User-initiated system setup" },
315     { 0x0f, 0x01, 0x06, "USB resource configuration" },
316     { 0x0f, 0x01, 0x07, "PCI resource configuration" },
317     { 0x0f, 0x01, 0x08, "Option ROM initialization" },
318     { 0x0f, 0x01, 0x09, "Video initialization" },
319     { 0x0f, 0x01, 0x0a, "Cache initialization" },
320     { 0x0f, 0x01, 0x0b, "SMBus initialization" },
321     { 0x0f, 0x01, 0x0c, "Keyboard controller initialization" },
322     { 0x0f, 0x01, 0x0d, "Management controller initialization" },
323     { 0x0f, 0x01, 0x0e, "Docking station attachment" },
324     { 0x0f, 0x01, 0x0f, "Enabling docking station" },
325     { 0x0f, 0x01, 0x10, "Docking station ejection" },
326     { 0x0f, 0x01, 0x11, "Disabling docking station" },
327     { 0x0f, 0x01, 0x12, "Calling operating system wake-up vector" },
328     { 0x0f, 0x01, 0x13, "System boot initiated" },
329     { 0x0f, 0x01, 0x14, "Motherboard initialization" },
330     { 0x0f, 0x01, 0x15, "reserved" },
331     { 0x0f, 0x01, 0x16, "Floppy initialization" },
332     { 0x0f, 0x01, 0x17, "Keyboard test" },
333     { 0x0f, 0x01, 0x18, "Pointing device test" },
334     { 0x0f, 0x01, 0x19, "Primary CPU initialization" },
335     { 0x0f, 0x01, 0xff, "Unknown Hang" },
336     /* System Firmware Progress */
337     { 0x0f, 0x02, 0x00, "Unspecified" },
338     { 0x0f, 0x02, 0x01, "Memory initialization" },
339     { 0x0f, 0x02, 0x02, "Hard-disk initialization" },
340     { 0x0f, 0x02, 0x03, "Secondary CPU Initialization" },
341     { 0x0f, 0x02, 0x04, "User authentication" },
342     { 0x0f, 0x02, 0x05, "User-initiated system setup" },
343     { 0x0f, 0x02, 0x06, "USB resource configuration" },
344     { 0x0f, 0x02, 0x07, "PCI resource configuration" },
345     { 0x0f, 0x02, 0x08, "Option ROM initialization" },
346     { 0x0f, 0x02, 0x09, "Video initialization" },
347     { 0x0f, 0x02, 0x0a, "Cache initialization" },
348     { 0x0f, 0x02, 0x0b, "SMBus initialization" },
349     { 0x0f, 0x02, 0x0c, "Keyboard controller initialization" },
350     { 0x0f, 0x02, 0x0d, "Management controller initialization" },
351     { 0x0f, 0x02, 0x0e, "Docking station attachment" },
352     { 0x0f, 0x02, 0x0f, "Enabling docking station" },
353     { 0x0f, 0x02, 0x10, "Docking station ejection" },
354     { 0x0f, 0x02, 0x11, "Disabling docking station" },
355     { 0x0f, 0x02, 0x12, "Calling operating system wake-up vector" },
356     { 0x0f, 0x02, 0x13, "System boot initiated" },
357     { 0x0f, 0x02, 0x14, "Motherboard initialization" },
358     { 0x0f, 0x02, 0x15, "reserved" },
359     { 0x0f, 0x02, 0x16, "Floppy initialization" },
360     { 0x0f, 0x02, 0x17, "Keyboard test" },
361     { 0x0f, 0x02, 0x18, "Pointing device test" },
362     { 0x0f, 0x02, 0x19, "Primary CPU initialization" },
363     { 0x0f, 0x02, 0xff, "Unknown Progress" },
364     /* Event Logging Disabled */
365     { 0x10, 0x00, 0xff, "Correctable memory error logging disabled" },
366     { 0x10, 0x01, 0xff, "Event logging disabled" },
367     { 0x10, 0x02, 0xff, "Log area reset/cleared" },
368     { 0x10, 0x03, 0xff, "All event logging disabled" },
369     { 0x10, 0x04, 0xff, "Log full" },
370     { 0x10, 0x05, 0xff, "Log almost full" },
371     /* Watchdog 1 */
372     { 0x11, 0x00, 0xff, "BIOS Reset" },
373     { 0x11, 0x01, 0xff, "OS Reset" },
374     { 0x11, 0x02, 0xff, "OS Shut Down" },
375     { 0x11, 0x03, 0xff, "OS Power Down" },
376     { 0x11, 0x04, 0xff, "OS Power Cycle" },
377     { 0x11, 0x05, 0xff, "OS NMI/Diag Interrupt" },
378     { 0x11, 0x06, 0xff, "OS Expired" },
379     { 0x11, 0x07, 0xff, "OS pre-timeout Interrupt" },
380     /* System Event */
381     { 0x12, 0x00, 0xff, "System Reconfigured" },
382     { 0x12, 0x01, 0xff, "OEM System boot event" },
383     { 0x12, 0x02, 0xff, "Undetermined system hardware failure" },
384     { 0x12, 0x03, 0xff, "Entry added to auxiliary log" },
385     { 0x12, 0x04, 0xff, "PEF Action" },
386     { 0x12, 0x05, 0xff, "Timestamp Clock Sync" },
387     /* Critical Interrupt */
388     { 0x13, 0x00, 0xff, "NMI/Diag Interrupt" },
389     { 0x13, 0x01, 0xff, "Bus Timeout" },
390     { 0x13, 0x02, 0xff, "I/O Channel check NMI" },
391     { 0x13, 0x03, 0xff, "Software NMI" },
392     { 0x13, 0x04, 0xff, "PCI PERR" },
393     { 0x13, 0x05, 0xff, "PCI SERR" },
394     { 0x13, 0x06, 0xff, "EISA failsafe timeout" },
395     { 0x13, 0x07, 0xff, "Bus Correctable error" },
396     { 0x13, 0x08, 0xff, "Bus Uncorrectable error" },
397     { 0x13, 0x09, 0xff, "Fatal NMI" },
398     { 0x13, 0x0a, 0xff, "Bus Fatal Error" },
399     { 0x13, 0x0b, 0xff, "Bus Degraded" },
400     /* Button */
401     { 0x14, 0x00, 0xff, "Power Button pressed" },
402     { 0x14, 0x01, 0xff, "Sleep Button pressed" },
403     { 0x14, 0x02, 0xff, "Reset Button pressed" },
404     { 0x14, 0x03, 0xff, "FRU Latch" },
405     { 0x14, 0x04, 0xff, "FRU Service" },
406     /* Chip Set */
407     { 0x19, 0x00, 0xff, "Soft Power Control Failure" },
408     { 0x19, 0x01, 0xff, "Thermal Trip" },
409     /* Cable/Interconnect */
410     { 0x1b, 0x00, 0xff, "Connected" },
411     { 0x1b, 0x01, 0xff, "Config Error" },
412     /* System Boot Initiated */
413     { 0x1d, 0x00, 0xff, "Initiated by power up" },
414     { 0x1d, 0x01, 0xff, "Initiated by hard reset" },
415     { 0x1d, 0x02, 0xff, "Initiated by warm reset" },
416     { 0x1d, 0x03, 0xff, "User requested PXE boot" },
417     { 0x1d, 0x04, 0xff, "Automatic boot to diagnostic" },
418     { 0x1d, 0x05, 0xff, "OS initiated hard reset" },
419     { 0x1d, 0x06, 0xff, "OS initiated warm reset" },
420     { 0x1d, 0x07, 0xff, "System Restart" },
421     /* Boot Error */
422     { 0x1e, 0x00, 0xff, "No bootable media" },
423     { 0x1e, 0x01, 0xff, "Non-bootable disk in drive" },
424     { 0x1e, 0x02, 0xff, "PXE server not found" },
425     { 0x1e, 0x03, 0xff, "Invalid boot sector" },
426     { 0x1e, 0x04, 0xff, "Timeout waiting for selection" },
427     /* OS Boot */
428     { 0x1f, 0x00, 0xff, "A: boot completed" },
429     { 0x1f, 0x01, 0xff, "C: boot completed" },
430     { 0x1f, 0x02, 0xff, "PXE boot completed" },
431     { 0x1f, 0x03, 0xff, "Diagnostic boot completed" },
432     { 0x1f, 0x04, 0xff, "CD-ROM boot completed" },
433     { 0x1f, 0x05, 0xff, "ROM boot completed" },
434     { 0x1f, 0x06, 0xff, "boot completed - device not specified" },
435     { 0x1f, 0x07, 0xff, "Installation started" },
436     { 0x1f, 0x08, 0xff, "Installation completed" },
437     { 0x1f, 0x09, 0xff, "Installation aborted" },
438     { 0x1f, 0x0a, 0xff, "Installation failed" },
439     /* OS Stop/Shutdown */
440     { 0x20, 0x00, 0xff, "Error during system startup" },
441     { 0x20, 0x01, 0xff, "Run-time critical stop" },
442     { 0x20, 0x02, 0xff, "OS graceful stop" },
443     { 0x20, 0x03, 0xff, "OS graceful shutdown" },
444     { 0x20, 0x04, 0xff, "PEF initiated soft shutdown" },
445     { 0x20, 0x05, 0xff, "Agent not responding" },
446     /* Slot/Connector */
447     { 0x21, 0x00, 0xff, "Fault Status" },
448     { 0x21, 0x01, 0xff, "Identify Status" },
449     { 0x21, 0x02, 0xff, "Device Installed" },
450     { 0x21, 0x03, 0xff, "Ready for Device Installation" },
451     { 0x21, 0x04, 0xff, "Ready for Device Removal" },
452     { 0x21, 0x05, 0xff, "Slot Power is Off" },
453     { 0x21, 0x06, 0xff, "Device Removal Request" },
454     { 0x21, 0x07, 0xff, "Interlock" },
455     { 0x21, 0x08, 0xff, "Slot is Disabled" },
456     { 0x21, 0x09, 0xff, "Spare Device" },
457     /* System ACPI Power State */
458     { 0x22, 0x00, 0xff, "S0/G0: working" },
459     { 0x22, 0x01, 0xff, "S1: sleeping with system hw & processor context maintained" },
460     { 0x22, 0x02, 0xff, "S2: sleeping, processor context lost" },
461     { 0x22, 0x03, 0xff, "S3: sleeping, processor & hw context lost, memory retained" },
462     { 0x22, 0x04, 0xff, "S4: non-volatile sleep/suspend-to-disk" },
463     { 0x22, 0x05, 0xff, "S5/G2: soft-off" },
464     { 0x22, 0x06, 0xff, "S4/S5: soft-off" },
465     { 0x22, 0x07, 0xff, "G3: mechanical off" },
466     { 0x22, 0x08, 0xff, "Sleeping in S1/S2/S3 state" },
467     { 0x22, 0x09, 0xff, "G1: sleeping" },
468     { 0x22, 0x0a, 0xff, "S5: entered by override" },
469     { 0x22, 0x0b, 0xff, "Legacy ON state" },
470     { 0x22, 0x0c, 0xff, "Legacy OFF state" },
471     { 0x22, 0x0e, 0xff, "Unknown" },
472     /* Watchdog 2 */
473     { 0x23, 0x00, 0xff, "Timer expired" },
474     { 0x23, 0x01, 0xff, "Hard reset" },
475     { 0x23, 0x02, 0xff, "Power down" },
476     { 0x23, 0x03, 0xff, "Power cycle" },
477     { 0x23, 0x04, 0xff, "reserved" },
478     { 0x23, 0x05, 0xff, "reserved" },
479     { 0x23, 0x06, 0xff, "reserved" },
480     { 0x23, 0x07, 0xff, "reserved" },
481     { 0x23, 0x08, 0xff, "Timer interrupt" },
482     /* Platform Alert */
483     { 0x24, 0x00, 0xff, "Platform generated page" },
484     { 0x24, 0x01, 0xff, "Platform generated LAN alert" },
485     { 0x24, 0x02, 0xff, "Platform Event Trap generated" },
486     { 0x24, 0x03, 0xff, "Platform generated SNMP trap, OEM format" },
487     /* Entity Presence */
488     { 0x25, 0x00, 0xff, "Present" },
489     { 0x25, 0x01, 0xff, "Absent" },
490     { 0x25, 0x02, 0xff, "Disabled" },
491     /* LAN */
492     { 0x27, 0x00, 0xff, "Heartbeat Lost" },
493     { 0x27, 0x01, 0xff, "Heartbeat" },
494     /* Management Subsystem Health */
495     { 0x28, 0x00, 0xff, "Sensor access degraded or unavailable" },
496     { 0x28, 0x01, 0xff, "Controller access degraded or unavailable" },
497     { 0x28, 0x02, 0xff, "Management controller off-line" },
498     { 0x28, 0x03, 0xff, "Management controller unavailable" },
499     { 0x28, 0x04, 0xff, "Sensor failure" },
500     { 0x28, 0x05, 0xff, "FRU failure" },
501     /* Battery */
502     { 0x29, 0x00, 0xff, "Low" },
503     { 0x29, 0x01, 0xff, "Failed" },
504     { 0x29, 0x02, 0xff, "Presence Detected" },
505     /* Version Change */
506     { 0x2b, 0x00, 0xff, "Hardware change detected" },
507     { 0x2b, 0x01, 0x00, "Firmware or software change detected" },
508     { 0x2b, 0x01, 0x01, "Firmware or software change detected, Mngmt Ctrl Dev Id" },
509     { 0x2b, 0x01, 0x02, "Firmware or software change detected, Mngmt Ctrl Firm Rev" },
510     { 0x2b, 0x01, 0x03, "Firmware or software change detected, Mngmt Ctrl Dev Rev" },
511     { 0x2b, 0x01, 0x04, "Firmware or software change detected, Mngmt Ctrl Manuf Id" },
512     { 0x2b, 0x01, 0x05, "Firmware or software change detected, Mngmt Ctrl IPMI Vers" },
513     { 0x2b, 0x01, 0x06, "Firmware or software change detected, Mngmt Ctrl Aux Firm Id" },
514     { 0x2b, 0x01, 0x07, "Firmware or software change detected, Mngmt Ctrl Firm Boot Block" },
515     { 0x2b, 0x01, 0x08, "Firmware or software change detected, Mngmt Ctrl Other" },
516     { 0x2b, 0x01, 0x09, "Firmware or software change detected, BIOS/EFI change" },
517     { 0x2b, 0x01, 0x0A, "Firmware or software change detected, SMBIOS change" },
518     { 0x2b, 0x01, 0x0B, "Firmware or software change detected, O/S change" },
519     { 0x2b, 0x01, 0x0C, "Firmware or software change detected, O/S loader change" },
520     { 0x2b, 0x01, 0x0D, "Firmware or software change detected, Service Diag change" },
521     { 0x2b, 0x01, 0x0E, "Firmware or software change detected, Mngmt SW agent change" },
522     { 0x2b, 0x01, 0x0F, "Firmware or software change detected, Mngmt SW App change" },
523     { 0x2b, 0x01, 0x10, "Firmware or software change detected, Mngmt SW Middle" },
524     { 0x2b, 0x01, 0x11, "Firmware or software change detected, Prog HW Change (FPGA)" },
525     { 0x2b, 0x01, 0x12, "Firmware or software change detected, board/FRU module change" },
526     { 0x2b, 0x01, 0x13, "Firmware or software change detected, board/FRU component change" },
527     { 0x2b, 0x01, 0x14, "Firmware or software change detected, board/FRU replace equ ver" },
528     { 0x2b, 0x01, 0x15, "Firmware or software change detected, board/FRU replace new ver" },
529     { 0x2b, 0x01, 0x16, "Firmware or software change detected, board/FRU replace old ver" },
530     { 0x2b, 0x01, 0x17, "Firmware or software change detected, board/FRU HW conf change" },
531     { 0x2b, 0x02, 0xff, "Hardware incompatibility detected" },
532     { 0x2b, 0x03, 0xff, "Firmware or software incompatibility detected" },
533     { 0x2b, 0x04, 0xff, "Invalid or unsupported hardware version" },
534     { 0x2b, 0x05, 0xff, "Invalid or unsupported firmware or software version" },
535     { 0x2b, 0x06, 0xff, "Hardware change success" },
536     { 0x2b, 0x07, 0x00, "Firmware or software change success" },
537     { 0x2b, 0x07, 0x01, "Firmware or software change success, Mngmt Ctrl Dev Id" },
538     { 0x2b, 0x07, 0x02, "Firmware or software change success, Mngmt Ctrl Firm Rev" },
539     { 0x2b, 0x07, 0x03, "Firmware or software change success, Mngmt Ctrl Dev Rev" },
540     { 0x2b, 0x07, 0x04, "Firmware or software change success, Mngmt Ctrl Manuf Id" },
541     { 0x2b, 0x07, 0x05, "Firmware or software change success, Mngmt Ctrl IPMI Vers" },
542     { 0x2b, 0x07, 0x06, "Firmware or software change success, Mngmt Ctrl Aux Firm Id" },
543     { 0x2b, 0x07, 0x07, "Firmware or software change success, Mngmt Ctrl Firm Boot Block" },
544     { 0x2b, 0x07, 0x08, "Firmware or software change success, Mngmt Ctrl Other" },
545     { 0x2b, 0x07, 0x09, "Firmware or software change success, BIOS/EFI change" },
546     { 0x2b, 0x07, 0x0A, "Firmware or software change success, SMBIOS change" },
547     { 0x2b, 0x07, 0x0B, "Firmware or software change success, O/S change" },
548     { 0x2b, 0x07, 0x0C, "Firmware or software change success, O/S loader change" },
549     { 0x2b, 0x07, 0x0D, "Firmware or software change success, Service Diag change" },
550     { 0x2b, 0x07, 0x0E, "Firmware or software change success, Mngmt SW agent change" },
551     { 0x2b, 0x07, 0x0F, "Firmware or software change success, Mngmt SW App change" },
552     { 0x2b, 0x07, 0x10, "Firmware or software change success, Mngmt SW Middle" },
553     { 0x2b, 0x07, 0x11, "Firmware or software change success, Prog HW Change (FPGA)" },
554     { 0x2b, 0x07, 0x12, "Firmware or software change success, board/FRU module change" },
555     { 0x2b, 0x07, 0x13, "Firmware or software change success, board/FRU component change" },
556     { 0x2b, 0x07, 0x14, "Firmware or software change success, board/FRU replace equ ver" },
557     { 0x2b, 0x07, 0x15, "Firmware or software change success, board/FRU replace new ver" },
558     { 0x2b, 0x07, 0x16, "Firmware or software change success, board/FRU replace old ver" },
559     { 0x2b, 0x07, 0x17, "Firmware or software change success, board/FRU HW conf change" },
560     /* FRU State */
561     { 0x2c, 0x00, 0xff, "Not Installed" },
562     { 0x2c, 0x01, 0xff, "Inactive" },
563     { 0x2c, 0x02, 0xff, "Activation Requested" },
564     { 0x2c, 0x03, 0xff, "Activation in Progress" },
565     { 0x2c, 0x04, 0xff, "Active" },
566     { 0x2c, 0x05, 0xff, "Deactivation Requested" },
567     { 0x2c, 0x06, 0xff, "Deactivation in Progress" },
568     { 0x2c, 0x07, 0xff, "Communication lost" },
569     /* PICMG FRU Hot Swap */
570     { 0xF0, 0x00, 0xFF, "Transition to M0" },
571     { 0xF0, 0x01, 0xFF, "Transition to M1" },
572     { 0xF0, 0x02, 0xFF, "Transition to M2" },
573     { 0xF0, 0x03, 0xFF, "Transition to M3" },
574     { 0xF0, 0x04, 0xFF, "Transition to M4" },
575     { 0xF0, 0x05, 0xFF, "Transition to M5" },
576     { 0xF0, 0x06, 0xFF, "Transition to M6" },
577     { 0xF0, 0x07, 0xFF, "Transition to M7" },
578     /* PICMG IPMB Physical Link */
579     { 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" },
580     { 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
581     { 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
582     { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" },
583     /* PICNG Moduke Hot Swap */
584     { 0xF2, 0x00, 0xff, "Module Handle Closed" },
585     { 0xF2, 0x01, 0xff, "Module Handle Opened" },
586     { 0xF2, 0x02, 0xff, "Quiesced" },
587     { 0x00, 0x00, 0xff, NULL },
588 };
589 
590 static const struct ipmi_event_sensor_types vita_sensor_event_types[] = {
591     /* VITA FRU State */
592     { 0xF0, 0x00, 0xFF, "Transition to M0" },
593     { 0xF0, 0x01, 0xFF, "Transition to M1" },
594     { 0xF0, 0x04, 0xFF, "Transition to M4" },
595     { 0xF0, 0x05, 0xFF, "Transition to M5" },
596     { 0xF0, 0x06, 0xFF, "Transition to M6" },
597     { 0xF0, 0x07, 0xFF, "Transition to M7" },
598     /* VITA System IPMB Link */
599     { 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" },
600     { 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" },
601     { 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" },
602     { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMP-B enabled" },
603     /* VITA FRU Temperature */
604     { 0xF3, 0x00, 0xff, "At or below Lower Non-critical" },
605     { 0xF3, 0x01, 0xff, "At or below Lower Critical" },
606     { 0xF3, 0x02, 0xff, "At or below Lower Non-recoverable" },
607     { 0xF3, 0x03, 0xff, "At or above Upper Non-critical" },
608     { 0xF3, 0x04, 0xff, "At or above Upper Critical" },
609     { 0xF3, 0x05, 0xff, "At or above Upper Non-recoverable" },
610     { 0x00, 0x00, 0xff, NULL }
611 };
612 
613 static const struct ipmi_event_sensor_types oem_kontron_event_types[] = {
614     /* Board Reset(cPCI) */
615     { 0xC1, 0x00, 0xff, "Push Button" },
616     { 0xC1, 0x01, 0xff, "Bridge Reset" },
617     { 0xC1, 0x02, 0xff, "Backplane" },
618     { 0xC1, 0x03, 0xff, "Hotswap Fault" },
619     { 0xC1, 0x04, 0xff, "Hotswap Healty" },
620     { 0xC1, 0x05, 0xff, "Unknown" },
621     { 0xC1, 0x06, 0xff, "ITP" },
622     { 0xC1, 0x07, 0xff, "Hardware Watchdog" },
623     { 0xC1, 0x08, 0xff, "Software Reset" },
624     /* IPMB-L Link State, based on PICMG IPMB-0 Link state sensor */
625     { 0xC3, 0x02, 0xff, "IPMB L Disabled" },
626     { 0xC3, 0x03, 0xff, "IPMB L Enabled" },
627     /* Board Reset */
628     { 0xC4, 0x00, 0xff, "Push Button" },
629     { 0xC4, 0x01, 0xff, "Hardware Power Failure" },
630     { 0xC4, 0x02, 0xff, "Unknown" },
631     { 0xC4, 0x03, 0xff, "Hardware Watchdog" },
632     { 0xC4, 0x04, 0xff, "Soft Reset" },
633     { 0xC4, 0x05, 0xff, "Warm Reset" },
634     { 0xC4, 0x06, 0xff, "Cold Reset" },
635     { 0xC4, 0x07, 0xff, "IPMI Command" },
636     { 0xC4, 0x08, 0xff, "Setup Reset (Save CMOS)" },
637     { 0xC4, 0x09, 0xff, "Power Up Reset" },
638     /* POST Value */
639     { 0xC6, 0x0E, 0xff, "Post Error (see data2)" },
640     /* FWUM Status */
641     { 0xC7, 0x00, 0xff, "First Boot After Upgrade" },
642     { 0xC7, 0x01, 0xff, "First Boot After Rollback(error)" },
643     { 0xC7, 0x02, 0xff, "First Boot After Errors (watchdog)" },
644     { 0xC7, 0x03, 0xff, "First Boot After Manual Rollback" },
645     { 0xC7, 0x08, 0xff, "Firmware Watchdog Bite, reset occurred" },
646     /* Switch Mngt Software Status */
647     { 0xC8, 0x00, 0xff, "Not Loaded" },
648     { 0xC8, 0x01, 0xff, "Initializing" },
649     { 0xC8, 0x02, 0xff, "Ready" },
650     { 0xC8, 0x03, 0xff, "Failure (see data2)" },
651     /* Diagnostic Status */
652     { 0xC9, 0x00, 0xff, "Started" },
653     { 0xC9, 0x01, 0xff, "Pass" },
654     { 0xC9, 0x02, 0xff, "Fail" },
655     { 0xCA, 0x00, 0xff, "In progress"},
656     { 0xCA, 0x01, 0xff, "Success"},
657     { 0xCA, 0x02, 0xff, "Failure"},
658     /* FRU Over Current */
659     { 0xCB, 0x00, 0xff, "Asserted"},
660     { 0xCB, 0x01, 0xff, "Deasserted"},
661     /* FRU Sensor Error */
662     { 0xCC, 0x00, 0xff, "Asserted"},
663     { 0xCC, 0x01, 0xff, "Deasserted"},
664     /* FRU Power Denied */
665     { 0xCD, 0x00, 0xff, "Asserted"},
666     { 0xCD, 0x01, 0xff, "Deasserted"},
667     /* Reset */
668     { 0xCF, 0x00, 0xff, "Asserted"},
669     { 0xCF, 0x01, 0xff, "Deasserted"},
670     /* END */
671     { 0x00, 0x00, 0xff, NULL },
672 };
673 
674 int ipmi_sel_main(struct ipmi_intf *, int, char **);
675 void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt);
676 void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt);
677 void ipmi_sel_print_extended_entry(struct ipmi_intf * intf, struct sel_event_record * evt);
678 void ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt);
679 void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc);
680 const char * ipmi_get_sensor_type(struct ipmi_intf *intf, uint8_t code);
681 uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel_event_record * evt);
682 char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
683 IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf);
684 char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
685 int ipmi_sel_oem_init(const char * filename);
686 const struct ipmi_event_sensor_types *
687 ipmi_get_first_event_sensor_type(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t event_type);
688 const struct ipmi_event_sensor_types *
689 ipmi_get_next_event_sensor_type(const struct ipmi_event_sensor_types *evt);
690 
691 #endif /* IPMI_SEL_H */
692