xref: /linux/arch/powerpc/include/asm/mce.h (revision 7b9f71f974a12740e79e918cfd58c2fce0b5b580)
1e22a2274SMahesh Salgaonkar /*
2e22a2274SMahesh Salgaonkar  * Machine check exception header file.
3e22a2274SMahesh Salgaonkar  *
4e22a2274SMahesh Salgaonkar  * This program is free software; you can redistribute it and/or modify
5e22a2274SMahesh Salgaonkar  * it under the terms of the GNU General Public License as published by
6e22a2274SMahesh Salgaonkar  * the Free Software Foundation; either version 2 of the License, or
7e22a2274SMahesh Salgaonkar  * (at your option) any later version.
8e22a2274SMahesh Salgaonkar  *
9e22a2274SMahesh Salgaonkar  * This program is distributed in the hope that it will be useful,
10e22a2274SMahesh Salgaonkar  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11e22a2274SMahesh Salgaonkar  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12e22a2274SMahesh Salgaonkar  * GNU General Public License for more details.
13e22a2274SMahesh Salgaonkar  *
14e22a2274SMahesh Salgaonkar  * You should have received a copy of the GNU General Public License
15e22a2274SMahesh Salgaonkar  * along with this program; if not, write to the Free Software
16e22a2274SMahesh Salgaonkar  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17e22a2274SMahesh Salgaonkar  *
18e22a2274SMahesh Salgaonkar  * Copyright 2013 IBM Corporation
19e22a2274SMahesh Salgaonkar  * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20e22a2274SMahesh Salgaonkar  */
21e22a2274SMahesh Salgaonkar 
22e22a2274SMahesh Salgaonkar #ifndef __ASM_PPC64_MCE_H__
23e22a2274SMahesh Salgaonkar #define __ASM_PPC64_MCE_H__
24e22a2274SMahesh Salgaonkar 
25e22a2274SMahesh Salgaonkar #include <linux/bitops.h>
26e22a2274SMahesh Salgaonkar 
27e22a2274SMahesh Salgaonkar /*
28e22a2274SMahesh Salgaonkar  * Machine Check bits on power7 and power8
29e22a2274SMahesh Salgaonkar  */
30e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_LOADSTORE(srr1)	((srr1) & PPC_BIT(42)) /* P8 too */
31e22a2274SMahesh Salgaonkar 
32e22a2274SMahesh Salgaonkar /* SRR1 bits for machine check (On Power7 and Power8) */
33e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH(srr1)	((srr1) & PPC_BITMASK(43, 45)) /* P8 too */
34e22a2274SMahesh Salgaonkar 
35e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_UE		(0x1 << PPC_BITLSHIFT(45)) /* P8 too */
36e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_SLB_PARITY	(0x2 << PPC_BITLSHIFT(45)) /* P8 too */
37e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_SLB_MULTIHIT	(0x3 << PPC_BITLSHIFT(45)) /* P8 too */
38e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_SLB_BOTH	(0x4 << PPC_BITLSHIFT(45))
39e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_TLB_MULTIHIT	(0x5 << PPC_BITLSHIFT(45)) /* P8 too */
40e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_UE_TLB_RELOAD	(0x6 << PPC_BITLSHIFT(45)) /* P8 too */
41e22a2274SMahesh Salgaonkar #define P7_SRR1_MC_IFETCH_UE_IFU_INTERNAL	(0x7 << PPC_BITLSHIFT(45))
42e22a2274SMahesh Salgaonkar 
43e22a2274SMahesh Salgaonkar /* SRR1 bits for machine check (On Power8) */
44e22a2274SMahesh Salgaonkar #define P8_SRR1_MC_IFETCH_ERAT_MULTIHIT	(0x4 << PPC_BITLSHIFT(45))
45e22a2274SMahesh Salgaonkar 
46e22a2274SMahesh Salgaonkar /* DSISR bits for machine check (On Power7 and Power8) */
47e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_UE			(PPC_BIT(48))	/* P8 too */
48e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_UE_TABLEWALK	(PPC_BIT(49))	/* P8 too */
49e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_ERAT_MULTIHIT	(PPC_BIT(52))	/* P8 too */
50e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_TLB_MULTIHIT_MFTLB	(PPC_BIT(53))	/* P8 too */
51e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_SLB_PARITY_MFSLB	(PPC_BIT(55))	/* P8 too */
52e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_SLB_MULTIHIT	(PPC_BIT(56))	/* P8 too */
53e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_SLB_MULTIHIT_PARITY	(PPC_BIT(57))	/* P8 too */
54e22a2274SMahesh Salgaonkar 
55e22a2274SMahesh Salgaonkar /*
56e22a2274SMahesh Salgaonkar  * DSISR bits for machine check (Power8) in addition to above.
57e22a2274SMahesh Salgaonkar  * Secondary DERAT Multihit
58e22a2274SMahesh Salgaonkar  */
59e22a2274SMahesh Salgaonkar #define P8_DSISR_MC_ERAT_MULTIHIT_SEC	(PPC_BIT(54))
60e22a2274SMahesh Salgaonkar 
61e22a2274SMahesh Salgaonkar /* SLB error bits */
62e22a2274SMahesh Salgaonkar #define P7_DSISR_MC_SLB_ERRORS		(P7_DSISR_MC_ERAT_MULTIHIT | \
63e22a2274SMahesh Salgaonkar 					 P7_DSISR_MC_SLB_PARITY_MFSLB | \
64e22a2274SMahesh Salgaonkar 					 P7_DSISR_MC_SLB_MULTIHIT | \
65e22a2274SMahesh Salgaonkar 					 P7_DSISR_MC_SLB_MULTIHIT_PARITY)
66e22a2274SMahesh Salgaonkar 
67ae744f34SMahesh Salgaonkar #define P8_DSISR_MC_SLB_ERRORS		(P7_DSISR_MC_SLB_ERRORS | \
68ae744f34SMahesh Salgaonkar 					 P8_DSISR_MC_ERAT_MULTIHIT_SEC)
69*7b9f71f9SNicholas Piggin 
70*7b9f71f9SNicholas Piggin /*
71*7b9f71f9SNicholas Piggin  * Machine Check bits on power9
72*7b9f71f9SNicholas Piggin  */
73*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_LOADSTORE(srr1)	(((srr1) >> PPC_BITLSHIFT(42)) & 1)
74*7b9f71f9SNicholas Piggin 
75*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH(srr1)	(	\
76*7b9f71f9SNicholas Piggin 	PPC_BITEXTRACT(srr1, 45, 0) |	\
77*7b9f71f9SNicholas Piggin 	PPC_BITEXTRACT(srr1, 44, 1) |	\
78*7b9f71f9SNicholas Piggin 	PPC_BITEXTRACT(srr1, 43, 2) |	\
79*7b9f71f9SNicholas Piggin 	PPC_BITEXTRACT(srr1, 36, 3) )
80*7b9f71f9SNicholas Piggin 
81*7b9f71f9SNicholas Piggin /* 0 is reserved */
82*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_UE				1
83*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_SLB_PARITY			2
84*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_SLB_MULTIHIT			3
85*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_ERAT_MULTIHIT			4
86*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_TLB_MULTIHIT			5
87*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_UE_TLB_RELOAD			6
88*7b9f71f9SNicholas Piggin /* 7 is reserved */
89*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_LINK_TIMEOUT			8
90*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_LINK_TABLEWALK_TIMEOUT	9
91*7b9f71f9SNicholas Piggin /* 10 ? */
92*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_RA			11
93*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_RA_TABLEWALK		12
94*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_RA_ASYNC_STORE		13
95*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_LINK_ASYNC_STORE_TIMEOUT	14
96*7b9f71f9SNicholas Piggin #define P9_SRR1_MC_IFETCH_RA_TABLEWALK_FOREIGN	15
97*7b9f71f9SNicholas Piggin 
98*7b9f71f9SNicholas Piggin /* DSISR bits for machine check (On Power9) */
99*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_UE					(PPC_BIT(48))
100*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_UE_TABLEWALK			(PPC_BIT(49))
101*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_LINK_LOAD_TIMEOUT			(PPC_BIT(50))
102*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_LINK_TABLEWALK_TIMEOUT		(PPC_BIT(51))
103*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_ERAT_MULTIHIT			(PPC_BIT(52))
104*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_TLB_MULTIHIT_MFTLB			(PPC_BIT(53))
105*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_USER_TLBIE				(PPC_BIT(54))
106*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_SLB_PARITY_MFSLB			(PPC_BIT(55))
107*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_SLB_MULTIHIT_MFSLB			(PPC_BIT(56))
108*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_RA_LOAD				(PPC_BIT(57))
109*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_RA_TABLEWALK			(PPC_BIT(58))
110*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_RA_TABLEWALK_FOREIGN		(PPC_BIT(59))
111*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_RA_FOREIGN				(PPC_BIT(60))
112*7b9f71f9SNicholas Piggin 
113*7b9f71f9SNicholas Piggin /* SLB error bits */
114*7b9f71f9SNicholas Piggin #define P9_DSISR_MC_SLB_ERRORS		(P9_DSISR_MC_ERAT_MULTIHIT | \
115*7b9f71f9SNicholas Piggin 					 P9_DSISR_MC_SLB_PARITY_MFSLB | \
116*7b9f71f9SNicholas Piggin 					 P9_DSISR_MC_SLB_MULTIHIT_MFSLB)
117*7b9f71f9SNicholas Piggin 
11836df96f8SMahesh Salgaonkar enum MCE_Version {
11936df96f8SMahesh Salgaonkar 	MCE_V1 = 1,
12036df96f8SMahesh Salgaonkar };
12136df96f8SMahesh Salgaonkar 
12236df96f8SMahesh Salgaonkar enum MCE_Severity {
12336df96f8SMahesh Salgaonkar 	MCE_SEV_NO_ERROR = 0,
12436df96f8SMahesh Salgaonkar 	MCE_SEV_WARNING = 1,
12536df96f8SMahesh Salgaonkar 	MCE_SEV_ERROR_SYNC = 2,
12636df96f8SMahesh Salgaonkar 	MCE_SEV_FATAL = 3,
12736df96f8SMahesh Salgaonkar };
12836df96f8SMahesh Salgaonkar 
12936df96f8SMahesh Salgaonkar enum MCE_Disposition {
13036df96f8SMahesh Salgaonkar 	MCE_DISPOSITION_RECOVERED = 0,
13136df96f8SMahesh Salgaonkar 	MCE_DISPOSITION_NOT_RECOVERED = 1,
13236df96f8SMahesh Salgaonkar };
13336df96f8SMahesh Salgaonkar 
13436df96f8SMahesh Salgaonkar enum MCE_Initiator {
13536df96f8SMahesh Salgaonkar 	MCE_INITIATOR_UNKNOWN = 0,
13636df96f8SMahesh Salgaonkar 	MCE_INITIATOR_CPU = 1,
13736df96f8SMahesh Salgaonkar };
13836df96f8SMahesh Salgaonkar 
13936df96f8SMahesh Salgaonkar enum MCE_ErrorType {
14036df96f8SMahesh Salgaonkar 	MCE_ERROR_TYPE_UNKNOWN = 0,
14136df96f8SMahesh Salgaonkar 	MCE_ERROR_TYPE_UE = 1,
14236df96f8SMahesh Salgaonkar 	MCE_ERROR_TYPE_SLB = 2,
14336df96f8SMahesh Salgaonkar 	MCE_ERROR_TYPE_ERAT = 3,
14436df96f8SMahesh Salgaonkar 	MCE_ERROR_TYPE_TLB = 4,
145*7b9f71f9SNicholas Piggin 	MCE_ERROR_TYPE_USER = 5,
146*7b9f71f9SNicholas Piggin 	MCE_ERROR_TYPE_RA = 6,
147*7b9f71f9SNicholas Piggin 	MCE_ERROR_TYPE_LINK = 7,
14836df96f8SMahesh Salgaonkar };
14936df96f8SMahesh Salgaonkar 
15036df96f8SMahesh Salgaonkar enum MCE_UeErrorType {
15136df96f8SMahesh Salgaonkar 	MCE_UE_ERROR_INDETERMINATE = 0,
15236df96f8SMahesh Salgaonkar 	MCE_UE_ERROR_IFETCH = 1,
15336df96f8SMahesh Salgaonkar 	MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
15436df96f8SMahesh Salgaonkar 	MCE_UE_ERROR_LOAD_STORE = 3,
15536df96f8SMahesh Salgaonkar 	MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
15636df96f8SMahesh Salgaonkar };
15736df96f8SMahesh Salgaonkar 
15836df96f8SMahesh Salgaonkar enum MCE_SlbErrorType {
15936df96f8SMahesh Salgaonkar 	MCE_SLB_ERROR_INDETERMINATE = 0,
16036df96f8SMahesh Salgaonkar 	MCE_SLB_ERROR_PARITY = 1,
16136df96f8SMahesh Salgaonkar 	MCE_SLB_ERROR_MULTIHIT = 2,
16236df96f8SMahesh Salgaonkar };
16336df96f8SMahesh Salgaonkar 
16436df96f8SMahesh Salgaonkar enum MCE_EratErrorType {
16536df96f8SMahesh Salgaonkar 	MCE_ERAT_ERROR_INDETERMINATE = 0,
16636df96f8SMahesh Salgaonkar 	MCE_ERAT_ERROR_PARITY = 1,
16736df96f8SMahesh Salgaonkar 	MCE_ERAT_ERROR_MULTIHIT = 2,
16836df96f8SMahesh Salgaonkar };
16936df96f8SMahesh Salgaonkar 
17036df96f8SMahesh Salgaonkar enum MCE_TlbErrorType {
17136df96f8SMahesh Salgaonkar 	MCE_TLB_ERROR_INDETERMINATE = 0,
17236df96f8SMahesh Salgaonkar 	MCE_TLB_ERROR_PARITY = 1,
17336df96f8SMahesh Salgaonkar 	MCE_TLB_ERROR_MULTIHIT = 2,
17436df96f8SMahesh Salgaonkar };
17536df96f8SMahesh Salgaonkar 
176*7b9f71f9SNicholas Piggin enum MCE_UserErrorType {
177*7b9f71f9SNicholas Piggin 	MCE_USER_ERROR_INDETERMINATE = 0,
178*7b9f71f9SNicholas Piggin 	MCE_USER_ERROR_TLBIE = 1,
179*7b9f71f9SNicholas Piggin };
180*7b9f71f9SNicholas Piggin 
181*7b9f71f9SNicholas Piggin enum MCE_RaErrorType {
182*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_INDETERMINATE = 0,
183*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_IFETCH = 1,
184*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
185*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 3,
186*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_LOAD = 4,
187*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_STORE = 5,
188*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 6,
189*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 7,
190*7b9f71f9SNicholas Piggin 	MCE_RA_ERROR_LOAD_STORE_FOREIGN = 8,
191*7b9f71f9SNicholas Piggin };
192*7b9f71f9SNicholas Piggin 
193*7b9f71f9SNicholas Piggin enum MCE_LinkErrorType {
194*7b9f71f9SNicholas Piggin 	MCE_LINK_ERROR_INDETERMINATE = 0,
195*7b9f71f9SNicholas Piggin 	MCE_LINK_ERROR_IFETCH_TIMEOUT = 1,
196*7b9f71f9SNicholas Piggin 	MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2,
197*7b9f71f9SNicholas Piggin 	MCE_LINK_ERROR_LOAD_TIMEOUT = 3,
198*7b9f71f9SNicholas Piggin 	MCE_LINK_ERROR_STORE_TIMEOUT = 4,
199*7b9f71f9SNicholas Piggin 	MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5,
200*7b9f71f9SNicholas Piggin };
201*7b9f71f9SNicholas Piggin 
20236df96f8SMahesh Salgaonkar struct machine_check_event {
20336df96f8SMahesh Salgaonkar 	enum MCE_Version	version:8;	/* 0x00 */
20436df96f8SMahesh Salgaonkar 	uint8_t			in_use;		/* 0x01 */
20536df96f8SMahesh Salgaonkar 	enum MCE_Severity	severity:8;	/* 0x02 */
20636df96f8SMahesh Salgaonkar 	enum MCE_Initiator	initiator:8;	/* 0x03 */
20736df96f8SMahesh Salgaonkar 	enum MCE_ErrorType	error_type:8;	/* 0x04 */
20836df96f8SMahesh Salgaonkar 	enum MCE_Disposition	disposition:8;	/* 0x05 */
20936df96f8SMahesh Salgaonkar 	uint8_t			reserved_1[2];	/* 0x06 */
21036df96f8SMahesh Salgaonkar 	uint64_t		gpr3;		/* 0x08 */
21136df96f8SMahesh Salgaonkar 	uint64_t		srr0;		/* 0x10 */
21236df96f8SMahesh Salgaonkar 	uint64_t		srr1;		/* 0x18 */
21336df96f8SMahesh Salgaonkar 	union {					/* 0x20 */
21436df96f8SMahesh Salgaonkar 		struct {
21536df96f8SMahesh Salgaonkar 			enum MCE_UeErrorType ue_error_type:8;
21636df96f8SMahesh Salgaonkar 			uint8_t		effective_address_provided;
21736df96f8SMahesh Salgaonkar 			uint8_t		physical_address_provided;
21836df96f8SMahesh Salgaonkar 			uint8_t		reserved_1[5];
21936df96f8SMahesh Salgaonkar 			uint64_t	effective_address;
22036df96f8SMahesh Salgaonkar 			uint64_t	physical_address;
22136df96f8SMahesh Salgaonkar 			uint8_t		reserved_2[8];
22236df96f8SMahesh Salgaonkar 		} ue_error;
22336df96f8SMahesh Salgaonkar 
22436df96f8SMahesh Salgaonkar 		struct {
22536df96f8SMahesh Salgaonkar 			enum MCE_SlbErrorType slb_error_type:8;
22636df96f8SMahesh Salgaonkar 			uint8_t		effective_address_provided;
22736df96f8SMahesh Salgaonkar 			uint8_t		reserved_1[6];
22836df96f8SMahesh Salgaonkar 			uint64_t	effective_address;
22936df96f8SMahesh Salgaonkar 			uint8_t		reserved_2[16];
23036df96f8SMahesh Salgaonkar 		} slb_error;
23136df96f8SMahesh Salgaonkar 
23236df96f8SMahesh Salgaonkar 		struct {
23336df96f8SMahesh Salgaonkar 			enum MCE_EratErrorType erat_error_type:8;
23436df96f8SMahesh Salgaonkar 			uint8_t		effective_address_provided;
23536df96f8SMahesh Salgaonkar 			uint8_t		reserved_1[6];
23636df96f8SMahesh Salgaonkar 			uint64_t	effective_address;
23736df96f8SMahesh Salgaonkar 			uint8_t		reserved_2[16];
23836df96f8SMahesh Salgaonkar 		} erat_error;
23936df96f8SMahesh Salgaonkar 
24036df96f8SMahesh Salgaonkar 		struct {
24136df96f8SMahesh Salgaonkar 			enum MCE_TlbErrorType tlb_error_type:8;
24236df96f8SMahesh Salgaonkar 			uint8_t		effective_address_provided;
24336df96f8SMahesh Salgaonkar 			uint8_t		reserved_1[6];
24436df96f8SMahesh Salgaonkar 			uint64_t	effective_address;
24536df96f8SMahesh Salgaonkar 			uint8_t		reserved_2[16];
24636df96f8SMahesh Salgaonkar 		} tlb_error;
247*7b9f71f9SNicholas Piggin 
248*7b9f71f9SNicholas Piggin 		struct {
249*7b9f71f9SNicholas Piggin 			enum MCE_UserErrorType user_error_type:8;
250*7b9f71f9SNicholas Piggin 			uint8_t		effective_address_provided;
251*7b9f71f9SNicholas Piggin 			uint8_t		reserved_1[6];
252*7b9f71f9SNicholas Piggin 			uint64_t	effective_address;
253*7b9f71f9SNicholas Piggin 			uint8_t		reserved_2[16];
254*7b9f71f9SNicholas Piggin 		} user_error;
255*7b9f71f9SNicholas Piggin 
256*7b9f71f9SNicholas Piggin 		struct {
257*7b9f71f9SNicholas Piggin 			enum MCE_RaErrorType ra_error_type:8;
258*7b9f71f9SNicholas Piggin 			uint8_t		effective_address_provided;
259*7b9f71f9SNicholas Piggin 			uint8_t		reserved_1[6];
260*7b9f71f9SNicholas Piggin 			uint64_t	effective_address;
261*7b9f71f9SNicholas Piggin 			uint8_t		reserved_2[16];
262*7b9f71f9SNicholas Piggin 		} ra_error;
263*7b9f71f9SNicholas Piggin 
264*7b9f71f9SNicholas Piggin 		struct {
265*7b9f71f9SNicholas Piggin 			enum MCE_LinkErrorType link_error_type:8;
266*7b9f71f9SNicholas Piggin 			uint8_t		effective_address_provided;
267*7b9f71f9SNicholas Piggin 			uint8_t		reserved_1[6];
268*7b9f71f9SNicholas Piggin 			uint64_t	effective_address;
269*7b9f71f9SNicholas Piggin 			uint8_t		reserved_2[16];
270*7b9f71f9SNicholas Piggin 		} link_error;
27136df96f8SMahesh Salgaonkar 	} u;
27236df96f8SMahesh Salgaonkar };
27336df96f8SMahesh Salgaonkar 
27436df96f8SMahesh Salgaonkar struct mce_error_info {
27536df96f8SMahesh Salgaonkar 	enum MCE_ErrorType error_type:8;
27636df96f8SMahesh Salgaonkar 	union {
27736df96f8SMahesh Salgaonkar 		enum MCE_UeErrorType ue_error_type:8;
27836df96f8SMahesh Salgaonkar 		enum MCE_SlbErrorType slb_error_type:8;
27936df96f8SMahesh Salgaonkar 		enum MCE_EratErrorType erat_error_type:8;
28036df96f8SMahesh Salgaonkar 		enum MCE_TlbErrorType tlb_error_type:8;
281*7b9f71f9SNicholas Piggin 		enum MCE_UserErrorType user_error_type:8;
282*7b9f71f9SNicholas Piggin 		enum MCE_RaErrorType ra_error_type:8;
283*7b9f71f9SNicholas Piggin 		enum MCE_LinkErrorType link_error_type:8;
28436df96f8SMahesh Salgaonkar 	} u;
285c1bbf387SNicholas Piggin 	enum MCE_Severity	severity:8;
286c1bbf387SNicholas Piggin 	enum MCE_Initiator	initiator:8;
28736df96f8SMahesh Salgaonkar };
28836df96f8SMahesh Salgaonkar 
28936df96f8SMahesh Salgaonkar #define MAX_MC_EVT	100
29036df96f8SMahesh Salgaonkar 
29136df96f8SMahesh Salgaonkar /* Release flags for get_mce_event() */
29236df96f8SMahesh Salgaonkar #define MCE_EVENT_RELEASE	true
29336df96f8SMahesh Salgaonkar #define MCE_EVENT_DONTRELEASE	false
29436df96f8SMahesh Salgaonkar 
29536df96f8SMahesh Salgaonkar extern void save_mce_event(struct pt_regs *regs, long handled,
29655672ecfSMahesh Salgaonkar 			   struct mce_error_info *mce_err, uint64_t nip,
29755672ecfSMahesh Salgaonkar 			   uint64_t addr);
29836df96f8SMahesh Salgaonkar extern int get_mce_event(struct machine_check_event *mce, bool release);
29936df96f8SMahesh Salgaonkar extern void release_mce_event(void);
300b5ff4211SMahesh Salgaonkar extern void machine_check_queue_event(void);
301b5ff4211SMahesh Salgaonkar extern void machine_check_print_event_info(struct machine_check_event *evt);
302b63a0ffeSMahesh Salgaonkar extern uint64_t get_mce_fault_addr(struct machine_check_event *evt);
303ae744f34SMahesh Salgaonkar 
304e22a2274SMahesh Salgaonkar #endif /* __ASM_PPC64_MCE_H__ */
305