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_IFETCH_FOREIGN
= 2,
94 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH
= 3,
95 MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN
= 4,
96 MCE_RA_ERROR_LOAD
= 5,
97 MCE_RA_ERROR_STORE
= 6,
98 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE
= 7,
99 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN
= 8,
100 MCE_RA_ERROR_LOAD_STORE_FOREIGN
= 9,
103 enum MCE_LinkErrorType
{
104 MCE_LINK_ERROR_INDETERMINATE
= 0,
105 MCE_LINK_ERROR_IFETCH_TIMEOUT
= 1,
106 MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT
= 2,
107 MCE_LINK_ERROR_LOAD_TIMEOUT
= 3,
108 MCE_LINK_ERROR_STORE_TIMEOUT
= 4,
109 MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT
= 5,
112 struct machine_check_event
{
113 enum MCE_Version version
:8; /* 0x00 */
114 uint8_t in_use
; /* 0x01 */
115 enum MCE_Severity severity
:8; /* 0x02 */
116 enum MCE_Initiator initiator
:8; /* 0x03 */
117 enum MCE_ErrorType error_type
:8; /* 0x04 */
118 enum MCE_Disposition disposition
:8; /* 0x05 */
119 uint8_t reserved_1
[2]; /* 0x06 */
120 uint64_t gpr3
; /* 0x08 */
121 uint64_t srr0
; /* 0x10 */
122 uint64_t srr1
; /* 0x18 */
125 enum MCE_UeErrorType ue_error_type
:8;
126 uint8_t effective_address_provided
;
127 uint8_t physical_address_provided
;
128 uint8_t reserved_1
[5];
129 uint64_t effective_address
;
130 uint64_t physical_address
;
131 uint8_t reserved_2
[8];
135 enum MCE_SlbErrorType slb_error_type
:8;
136 uint8_t effective_address_provided
;
137 uint8_t reserved_1
[6];
138 uint64_t effective_address
;
139 uint8_t reserved_2
[16];
143 enum MCE_EratErrorType erat_error_type
:8;
144 uint8_t effective_address_provided
;
145 uint8_t reserved_1
[6];
146 uint64_t effective_address
;
147 uint8_t reserved_2
[16];
151 enum MCE_TlbErrorType tlb_error_type
:8;
152 uint8_t effective_address_provided
;
153 uint8_t reserved_1
[6];
154 uint64_t effective_address
;
155 uint8_t reserved_2
[16];
159 enum MCE_UserErrorType user_error_type
:8;
160 uint8_t effective_address_provided
;
161 uint8_t reserved_1
[6];
162 uint64_t effective_address
;
163 uint8_t reserved_2
[16];
167 enum MCE_RaErrorType ra_error_type
:8;
168 uint8_t effective_address_provided
;
169 uint8_t reserved_1
[6];
170 uint64_t effective_address
;
171 uint8_t reserved_2
[16];
175 enum MCE_LinkErrorType link_error_type
:8;
176 uint8_t effective_address_provided
;
177 uint8_t reserved_1
[6];
178 uint64_t effective_address
;
179 uint8_t reserved_2
[16];
184 struct mce_error_info
{
185 enum MCE_ErrorType error_type
:8;
187 enum MCE_UeErrorType ue_error_type
:8;
188 enum MCE_SlbErrorType slb_error_type
:8;
189 enum MCE_EratErrorType erat_error_type
:8;
190 enum MCE_TlbErrorType tlb_error_type
:8;
191 enum MCE_UserErrorType user_error_type
:8;
192 enum MCE_RaErrorType ra_error_type
:8;
193 enum MCE_LinkErrorType link_error_type
:8;
195 enum MCE_Severity severity
:8;
196 enum MCE_Initiator initiator
:8;
199 #define MAX_MC_EVT 100
201 /* Release flags for get_mce_event() */
202 #define MCE_EVENT_RELEASE true
203 #define MCE_EVENT_DONTRELEASE false
205 extern void save_mce_event(struct pt_regs
*regs
, long handled
,
206 struct mce_error_info
*mce_err
, uint64_t nip
,
207 uint64_t addr
, uint64_t phys_addr
);
208 extern int get_mce_event(struct machine_check_event
*mce
, bool release
);
209 extern void release_mce_event(void);
210 extern void machine_check_queue_event(void);
211 extern void machine_check_print_event_info(struct machine_check_event
*evt
,
213 #endif /* __ASM_PPC64_MCE_H__ */