-
Notifications
You must be signed in to change notification settings - Fork 81
/
mce-intel-sb.c
134 lines (114 loc) · 3.17 KB
/
mce-intel-sb.c
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
// SPDX-License-Identifier: GPL-2.0
/*
* The code below came from Andi Kleen/Intel/SUSE mcelog code,
* released under GNU Public General License, v.2
*/
#include <stdio.h>
#include <string.h>
#include "bitfield.h"
#include "ras-mce-handler.h"
/* See IA32 SDM Vol3B Table 16.4.1 */
static char *pcu_1[] = {
[0] = "No error",
[1] = "Non_IMem_Sel",
[2] = "I_Parity_Error",
[3] = "Bad_OpCode",
[4] = "I_Stack_Underflow",
[5] = "I_Stack_Overflow",
[6] = "D_Stack_Underflow",
[7] = "D_Stack_Overflow",
[8] = "Non-DMem_Sel",
[9] = "D_Parity_Error"
};
static char *pcu_2[] = {
[0x00] = "No Error",
[0x0D] = "MC_IMC_FORCE_SR_S3_TIMEOUT",
[0x0E] = "MC_MC_CPD_UNCPD_ST_TIMEOUT",
[0x0F] = "MC_PKGS_SAFE_WP_TIMEOUT",
[0x43] = "MC_PECI_MAILBOX_QUIESCE_TIMEOUT",
[0x5C] = "MC_MORE_THAN_ONE_LT_AGENT",
[0x60] = "MC_INVALID_PKGS_REQ_PCH",
[0x61] = "MC_INVALID_PKGS_REQ_QPI",
[0x62] = "MC_INVALID_PKGS_RES_QPI",
[0x63] = "MC_INVALID_PKGC_RES_PCH",
[0x64] = "MC_INVALID_PKG_STATE_CONFIG",
[0x70] = "MC_WATCHDG_TIMEOUT_PKGC_SLAVE",
[0x71] = "MC_WATCHDG_TIMEOUT_PKGC_MASTER",
[0x72] = "MC_WATCHDG_TIMEOUT_PKGS_MASTER",
[0x7A] = "MC_HA_FAILSTS_CHANGE_DETECTED",
[0x81] = "MC_RECOVERABLE_DIE_THERMAL_TOO_HOT",
};
static struct field pcu_mc4[] = {
FIELD(16, pcu_1),
FIELD(24, pcu_2),
{}
};
static char *memctrl_1[] = {
[0x001] = "Address parity error",
[0x002] = "HA Wrt buffer Data parity error",
[0x004] = "HA Wrt byte enable parity error",
[0x008] = "Corrected patrol scrub error",
[0x010] = "Uncorrected patrol scrub error",
[0x020] = "Corrected spare error",
[0x040] = "Uncorrected spare error",
};
static struct field memctrl_mc8[] = {
FIELD(16, memctrl_1),
{}
};
void snb_decode_model(struct ras_events *ras, struct mce_event *e)
{
struct mce_priv *mce = ras->mce_priv;
uint32_t mca = e->status & 0xffff;
unsigned int rank0 = -1, rank1 = -1, chan;
switch (e->bank) {
case 4:
decode_bitfield(e, e->status, pcu_mc4);
break;
case 6:
case 7:
/* MCACOD already decoded */
if (mce->cputype == CPU_SANDY_BRIDGE_EP)
mce_snprintf(e->bank_name, "QPI");
break;
case 8:
case 9:
case 10:
case 11:
// Wprintf("MemCtrl: ");
decode_bitfield(e, e->status, memctrl_mc8);
break;
}
/*
* Memory error specific code. Returns if the error is not a MC one
*/
/* Check if the error is at the memory controller */
if ((mca >> 7) != 1)
return;
/* Ignore unless this is an corrected extended error from an iMC bank */
if (e->bank < 8 || e->bank > 11 || (e->status & MCI_STATUS_UC) ||
!test_prefix(7, e->status & 0xefff))
return;
/*
* Parse the reported channel and ranks
*/
chan = EXTRACT(e->status, 0, 3);
if (chan == 0xf)
return;
mce_snprintf(e->mc_location, "memory_channel=%d", chan);
if (EXTRACT(e->misc, 62, 62))
rank0 = EXTRACT(e->misc, 46, 50);
if (EXTRACT(e->misc, 63, 63))
rank1 = EXTRACT(e->misc, 51, 55);
/*
* FIXME: The conversion from rank to dimm requires to parse the
* DMI tables and call failrank2dimm().
*/
if (rank0 >= 0 && rank1 >= 0)
mce_snprintf(e->mc_location, "ranks=%d and %d",
rank0, rank1);
else if (rank0 >= 0)
mce_snprintf(e->mc_location, "rank=%d", rank0);
else
mce_snprintf(e->mc_location, "rank=%d", rank1);
}