File: mce-intel-p4-p6.c

package info (click to toggle)
rasdaemon 0.6.0-1.2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,168 kB
  • sloc: ansic: 12,084; sh: 4,150; perl: 986; makefile: 81
file content (151 lines) | stat: -rw-r--r-- 4,381 bytes parent folder | download | duplicates (2)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
 * The code below came from Andi Kleen/Intel/SuSe mcelog code,
 * released under GNU Public General License, v.2
 *
 * 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
*/

#include <string.h>
#include <stdio.h>

#include "ras-mce-handler.h"
#include "bitfield.h"

/* Decode P4 and P6 family (p6old and Core2) model specific errors */

/* [19..24] */
static char *bus_queue_req_type[] = {
	[0] = "BQ_DCU_READ_TYPE",
	[2] = "BQ_IFU_DEMAND_TYPE",
	[3] = "BQ_IFU_DEMAND_NC_TYPE",
	[4] = "BQ_DCU_RFO_TYPE",
	[5] = "BQ_DCU_RFO_LOCK_TYPE",
	[6] = "BQ_DCU_ITOM_TYPE",
	[8] = "BQ_DCU_WB_TYPE",
	[10] = "BC_DCU_WCEVICT_TYPE",
	[11] = "BQ_DCU_WCLINE_TYPE",
	[12] = "BQ_DCU_BTM_TYPE",
	[13] = "BQ_DCU_INTACK_TYPE",
	[14] = "BQ_DCU_INVALL2_TYPE",
	[15] = "BQ_DCU_FLUSHL2_TYPE",
	[16] = "BQ_DCU_PART_RD_TYPE",
	[18] = "BQ_DCU_PART_WR_TYPE",
	[20] = "BQ_DCU_SPEC_CYC_TYPE",
	[24] = "BQ_DCU_IO_RD_TYPE",
	[25] = "BQ_DCU_IO_WR_TYPE",
	[28] = "BQ_DCU_LOCK_RD_TYPE",
	[30] = "BQ_DCU_SPLOCK_RD_TYPE",
	[29] = "BQ_DCU_LOCK_WR_TYPE",
};

/* [25..27] */
static char *bus_queue_error_type[] = {
	[0] = "BQ_ERR_HARD_TYPE",
	[1] = "BQ_ERR_DOUBLE_TYPE",
	[2] = "BQ_ERR_AERR2_TYPE",
	[4] = "BQ_ERR_SINGLE_TYPE",
	[5] = "BQ_ERR_AERR1_TYPE",
};

static struct field p6_shared_status[] = {
	FIELD(16, NULL),
	FIELD(19, bus_queue_req_type),
	FIELD(25, bus_queue_error_type),
	FIELD(25, bus_queue_error_type),
	SBITFIELD(30, "internal BINIT"),
	SBITFIELD(36, "received parity error on response transaction"),
	SBITFIELD(38, "timeout BINIT (ROB timeout)."
		  " No micro-instruction retired for some time"),
	FIELD(39, NULL),
	SBITFIELD(42, "bus transaction received hard error response"),
	SBITFIELD(43, "failure that caused IERR"),
	/* The following are reserved for Core in the SDM. Let's keep them here anyways*/
	SBITFIELD(44, "two failing bus transactions with address parity error (AERR)"),
	SBITFIELD(45, "uncorrectable ECC error"),
	SBITFIELD(46, "correctable ECC error"),
	/* [47..54]: ECC syndrome */
	FIELD(55, NULL),
	{},
};

static struct field p6old_status[] = {
	SBITFIELD(28, "FRC error"),
	SBITFIELD(29, "BERR on this CPU"),
	FIELD(31, NULL),
	FIELD(32, NULL),
	SBITFIELD(35, "BINIT received from external bus"),
	SBITFIELD(37, "Received hard error reponse on split transaction (Bus BINIT)"),
	{}
};

static struct field core2_status[] = {
	SBITFIELD(28, "MCE driven"),
	SBITFIELD(29, "MCE is observed"),
	SBITFIELD(31, "BINIT observed"),
	FIELD(32, NULL),
	SBITFIELD(34, "PIC or FSB data parity error"),
	FIELD(35, NULL),
	SBITFIELD(37, "FSB address parity error detected"),
	{}
};

static struct numfield p6old_status_numbers[] = {
	HEXNUMBER(47, 54, "ECC syndrome"),
	{}
};

static struct {
	int value;
	char *str;
} p4_model []= {
	{16, "FSB address parity"},
	{17, "Response hard fail"},
	{18, "Response parity"},
	{19, "PIC and FSB data parity"},
	{20, "Invalid PIC request(Signature=0xF04H)"},
	{21, "Pad state machine"},
	{22, "Pad strobe glitch"},
	{23, "Pad address glitch"}
};

void p4_decode_model(struct mce_event *e)
{
	uint32_t model = e->status & 0xffff0000L;
	unsigned i;

	for (i = 0; i < ARRAY_SIZE(p4_model); i++) {
		if (model & (1 << p4_model[i].value))
			mce_snprintf(e->error_msg, "%s", p4_model[i].str);
	}
}

void core2_decode_model(struct mce_event *e)
{
	uint64_t status = e->status;

	decode_bitfield(e, status, p6_shared_status);
	decode_bitfield(e, status, core2_status);
	/* Normally reserved, but let's parse anyways: */
	decode_numfield(e, status, p6old_status_numbers);
}

void p6old_decode_model(struct mce_event *e)
{
	uint64_t status = e->status;

	decode_bitfield(e, status, p6_shared_status);
	decode_bitfield(e, status, p6old_status);
	decode_numfield(e, status, p6old_status_numbers);
}