2 * Machine check exception header file.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * Copyright 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
22 #ifndef __ASM_PPC64_MCE_H__
23 #define __ASM_PPC64_MCE_H__
25 #include <linux/bitops.h>
34 MCE_SEV_ERROR_SYNC
= 2,
38 enum MCE_Disposition
{
39 MCE_DISPOSITION_RECOVERED
= 0,
40 MCE_DISPOSITION_NOT_RECOVERED
= 1,
44 MCE_INITIATOR_UNKNOWN
= 0,
45 MCE_INITIATOR_CPU
= 1,
49 MCE_ERROR_TYPE_UNKNOWN
= 0,
50 MCE_ERROR_TYPE_UE
= 1,
51 MCE_ERROR_TYPE_SLB
= 2,
52 MCE_ERROR_TYPE_ERAT
= 3,
53 MCE_ERROR_TYPE_TLB
= 4,
54 MCE_ERROR_TYPE_USER
= 5,
55 MCE_ERROR_TYPE_RA
= 6,
56 MCE_ERROR_TYPE_LINK
= 7,
59 enum MCE_UeErrorType
{
60 MCE_UE_ERROR_INDETERMINATE
= 0,
61 MCE_UE_ERROR_IFETCH
= 1,
62 MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH
= 2,
63 MCE_UE_ERROR_LOAD_STORE
= 3,
64 MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE
= 4,
67 enum MCE_SlbErrorType
{
68 MCE_SLB_ERROR_INDETERMINATE
= 0,
69 MCE_SLB_ERROR_PARITY
= 1,
70 MCE_SLB_ERROR_MULTIHIT
= 2,
73 enum MCE_EratErrorType
{
74 MCE_ERAT_ERROR_INDETERMINATE
= 0,
75 MCE_ERAT_ERROR_PARITY
= 1,
76 MCE_ERAT_ERROR_MULTIHIT
= 2,
79 enum MCE_TlbErrorType
{
80 MCE_TLB_ERROR_INDETERMINATE
= 0,
81 MCE_TLB_ERROR_PARITY
= 1,
82 MCE_TLB_ERROR_MULTIHIT
= 2,
85 enum MCE_UserErrorType
{
86 MCE_USER_ERROR_INDETERMINATE
= 0,
87 MCE_USER_ERROR_TLBIE
= 1,
90 enum MCE_RaErrorType
{
91 MCE_RA_ERROR_INDETERMINATE
= 0,
92 MCE_RA_ERROR_IFETCH
= 1,
93 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH
= 2,
94 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN
= 3,
95 MCE_RA_ERROR_LOAD
= 4,
96 MCE_RA_ERROR_STORE
= 5,
97 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE
= 6,
98 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN
= 7,
99 MCE_RA_ERROR_LOAD_STORE_FOREIGN
= 8,
102 enum MCE_LinkErrorType
{
103 MCE_LINK_ERROR_INDETERMINATE
= 0,
104 MCE_LINK_ERROR_IFETCH_TIMEOUT
= 1,
105 MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT
= 2,
106 MCE_LINK_ERROR_LOAD_TIMEOUT
= 3,
107 MCE_LINK_ERROR_STORE_TIMEOUT
= 4,
108 MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT
= 5,
111 struct machine_check_event
{
112 enum MCE_Version version
:8; /* 0x00 */
113 uint8_t in_use
; /* 0x01 */
114 enum MCE_Severity severity
:8; /* 0x02 */
115 enum MCE_Initiator initiator
:8; /* 0x03 */
116 enum MCE_ErrorType error_type
:8; /* 0x04 */
117 enum MCE_Disposition disposition
:8; /* 0x05 */
118 uint8_t reserved_1
[2]; /* 0x06 */
119 uint64_t gpr3
; /* 0x08 */
120 uint64_t srr0
; /* 0x10 */
121 uint64_t srr1
; /* 0x18 */
124 enum MCE_UeErrorType ue_error_type
:8;
125 uint8_t effective_address_provided
;
126 uint8_t physical_address_provided
;
127 uint8_t reserved_1
[5];
128 uint64_t effective_address
;
129 uint64_t physical_address
;
130 uint8_t reserved_2
[8];
134 enum MCE_SlbErrorType slb_error_type
:8;
135 uint8_t effective_address_provided
;
136 uint8_t reserved_1
[6];
137 uint64_t effective_address
;
138 uint8_t reserved_2
[16];
142 enum MCE_EratErrorType erat_error_type
:8;
143 uint8_t effective_address_provided
;
144 uint8_t reserved_1
[6];
145 uint64_t effective_address
;
146 uint8_t reserved_2
[16];
150 enum MCE_TlbErrorType tlb_error_type
:8;
151 uint8_t effective_address_provided
;
152 uint8_t reserved_1
[6];
153 uint64_t effective_address
;
154 uint8_t reserved_2
[16];
158 enum MCE_UserErrorType user_error_type
:8;
159 uint8_t effective_address_provided
;
160 uint8_t reserved_1
[6];
161 uint64_t effective_address
;
162 uint8_t reserved_2
[16];
166 enum MCE_RaErrorType ra_error_type
:8;
167 uint8_t effective_address_provided
;
168 uint8_t reserved_1
[6];
169 uint64_t effective_address
;
170 uint8_t reserved_2
[16];
174 enum MCE_LinkErrorType link_error_type
:8;
175 uint8_t effective_address_provided
;
176 uint8_t reserved_1
[6];
177 uint64_t effective_address
;
178 uint8_t reserved_2
[16];
183 struct mce_error_info
{
184 enum MCE_ErrorType error_type
:8;
186 enum MCE_UeErrorType ue_error_type
:8;
187 enum MCE_SlbErrorType slb_error_type
:8;
188 enum MCE_EratErrorType erat_error_type
:8;
189 enum MCE_TlbErrorType tlb_error_type
:8;
190 enum MCE_UserErrorType user_error_type
:8;
191 enum MCE_RaErrorType ra_error_type
:8;
192 enum MCE_LinkErrorType link_error_type
:8;
194 enum MCE_Severity severity
:8;
195 enum MCE_Initiator initiator
:8;
198 #define MAX_MC_EVT 100
200 /* Release flags for get_mce_event() */
201 #define MCE_EVENT_RELEASE true
202 #define MCE_EVENT_DONTRELEASE false
204 extern void save_mce_event(struct pt_regs
*regs
, long handled
,
205 struct mce_error_info
*mce_err
, uint64_t nip
,
207 extern int get_mce_event(struct machine_check_event
*mce
, bool release
);
208 extern void release_mce_event(void);
209 extern void machine_check_queue_event(void);
210 extern void machine_check_print_event_info(struct machine_check_event
*evt
,
212 extern uint64_t get_mce_fault_addr(struct machine_check_event
*evt
);
214 #endif /* __ASM_PPC64_MCE_H__ */