EXTRA_DIST = misc/rasdaemon.service misc/ras-mc-ctl.service
sbin_PROGRAMS = rasdaemon
-rasdaemon_SOURCES = rasdaemon.c ras-events.c ras-mc-handler.c
+rasdaemon_SOURCES = rasdaemon.c ras-events.c ras-mc-handler.c \
+ bitfield.c
if WITH_SQLITE3
rasdaemon_SOURCES += ras-record.c
endif
endif
if WITH_MCE
rasdaemon_SOURCES += ras-mce-handler.c mce-intel.c mce-amd-k8.c \
- bitfield.c mce-intel-p4-p6.c mce-intel-nehalem.c \
+ mce-intel-p4-p6.c mce-intel-nehalem.c \
mce-intel-dunnington.c mce-intel-tulsa.c \
mce-intel-sb.c mce-intel-ivb.c
endif
#include "ras-mce-handler.h"
#include "bitfield.h"
-char *reserved_3bits[8];
-char *reserved_1bit[2];
-char *reserved_2bits[4];
+unsigned bitfield_msg(char *buf, size_t len, const char **bitarray,
+ unsigned array_len,
+ unsigned bit_offset, unsigned ignore_bits,
+ uint64_t status)
+{
+ int i, n;
+ char *p = buf;
+
+ len--;
+
+ for (i = 0; i < array_len; i++) {
+ if (status & ignore_bits)
+ continue;
+ if (status & (1 << (i + bit_offset))) {
+ if (p != buf) {
+ n = snprintf(p, len, ", ");
+ len -= n;
+ p += n;
+ }
+ if (!bitarray[i])
+ n = snprintf(p, len, "BIT%d", i + bit_offset);
+ else
+ n = snprintf(p, len, "%s", bitarray[i]);
+ len -= n;
+ p += n;
+ }
+ }
+
+ *p = 0;
+ return p - buf;
+}
static uint64_t bitmask(uint64_t i)
{
struct field *fields)
{
struct field *f;
- char buf[60];
for (f = fields; f->str; f++) {
uint64_t v = (status >> f->start_bit) & bitmask(f->stringlen - 1);
if (v == 0)
continue;
mce_snprintf(e->error_msg, "<%u:%llx>",
- f->start_bit, v);
+ f->start_bit, (long long)v);
}
}
}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdint.h>
+
/* Generic bitfield decoder */
struct field {
#define HEXNUMBER(start, end, name) { start, end, name, "%Lx", 0 }
#define HEXNUMBERFORCE(start, end, name) { start, end, name, "%Lx", 1 }
+struct mce_event;
+
void decode_bitfield(struct mce_event *e, uint64_t status,
struct field *fields);
void decode_numfield(struct mce_event *e, uint64_t status,
{
return ((value >> nr) == 1);
}
+
+/* Ancillary routines */
+
+unsigned bitfield_msg(char *buf, size_t len, const char **bitarray,
+ unsigned array_len,
+ unsigned bit_offset, unsigned ignore_bits,
+ uint64_t status);
#include "ras-aer-handler.h"
#include "ras-record.h"
#include "ras-logger.h"
+#include "bitfield.h"
static const char *aer_errors[32] = {
/* Correctable errors */
* End of mcelog's code
*/
-unsigned bitfield_msg(char *buf, size_t len, char **bitarray, unsigned array_len,
- unsigned bit_offset, unsigned ignore_bits,
- uint64_t status)
-{
- int i, n;
- char *p = buf;
-
- len--;
-
- for (i = 0; i < array_len; i++) {
- if (status & ignore_bits)
- continue;
- if (status & (1 << (i + bit_offset))) {
- if (p != buf) {
- n = snprintf(p, len, ", ");
- len -= n;
- p += n;
- }
- if (!bitarray[i])
- n = snprintf(p, len, "BIT%d", i + bit_offset);
- else
- n = snprintf(p, len, "%s", bitarray[i]);
- len -= n;
- p += n;
- }
- }
-
- *p = 0;
- return p - buf;
-}
-
static void report_mce_event(struct ras_events *ras,
struct pevent_record *record,
struct trace_seq *s, struct mce_event *e)
struct pevent_record *record,
struct event_format *event, void *context);
-/* Ancillary routines */
-
-unsigned bitfield_msg(char *buf, size_t len, char **bitarray, unsigned array_len,
- unsigned bit_offset, unsigned ignore_bits,
- uint64_t status);
-
/* Per-CPU-type decoders for Intel CPUs */
void p4_decode_model(struct mce_event *e);
void core2_decode_model(struct mce_event *e);