xref: /titanic_52/usr/src/uts/sun4u/sys/plat_ecc_unum.h (revision d00f0155af9a9a671eb08a0dc30f5ea0a379c36c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_PLAT_ECC_NUM_H
287c478bd9Sstevel@tonic-gate #define	_SYS_PLAT_ECC_NUM_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/int_types.h>
377c478bd9Sstevel@tonic-gate #include <sys/cheetahregs.h>
387c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h>
397c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
407c478bd9Sstevel@tonic-gate #include <sys/ddipropdefs.h>
417c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
427c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
437c478bd9Sstevel@tonic-gate #include <sys/platform_module.h>
447c478bd9Sstevel@tonic-gate #include <sys/errno.h>
457c478bd9Sstevel@tonic-gate #include <sys/conf.h>
467c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
477c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * This file contains the common definitions used by the platform
517c478bd9Sstevel@tonic-gate  * unum ecc logging.
527c478bd9Sstevel@tonic-gate  */
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate typedef enum {
557c478bd9Sstevel@tonic-gate 	PLAT_ECC_ERROR_MESSAGE,
567c478bd9Sstevel@tonic-gate 	PLAT_ECC_INDICTMENT_MESSAGE,
577c478bd9Sstevel@tonic-gate 	PLAT_ECC_ERROR2_MESSAGE,
587c478bd9Sstevel@tonic-gate 	PLAT_ECC_INDICTMENT2_MESSAGE,
59*d00f0155Sayznaga 	PLAT_ECC_CAPABILITY_MESSAGE,
60*d00f0155Sayznaga 	PLAT_ECC_DIMM_SID_MESSAGE
617c478bd9Sstevel@tonic-gate } plat_ecc_message_type_t;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /* Platform-specific function for sending mailbox message */
647c478bd9Sstevel@tonic-gate extern int plat_send_ecc_mailbox_msg(plat_ecc_message_type_t, void *);
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /* For figuring out unique CPU id */
677c478bd9Sstevel@tonic-gate extern int plat_make_fru_cpuid(int, int, int);
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* For figuring out board number for given CPU id */
707c478bd9Sstevel@tonic-gate extern int plat_make_fru_boardnum(int);
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /* For initializing the taskqs */
737c478bd9Sstevel@tonic-gate extern void plat_ecc_init(void);
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /* For setting the capability value */
767c478bd9Sstevel@tonic-gate extern void plat_ecc_capability_sc_set(uint32_t cap);
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /* For sending a capability message to the SC */
797c478bd9Sstevel@tonic-gate extern int plat_ecc_capability_send(void);
807c478bd9Sstevel@tonic-gate 
81*d00f0155Sayznaga /* For determining the maximum cpumem boards possible */
82*d00f0155Sayznaga extern int plat_max_cpumem_boards(void);
83*d00f0155Sayznaga 
84*d00f0155Sayznaga /* For parsing the values from a memory unum */
85*d00f0155Sayznaga extern int parse_unum_memory(char *, int *, int *, int *, int *, int *);
86*d00f0155Sayznaga 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * The following variables enable and disable the fruid message logging on SC.
897c478bd9Sstevel@tonic-gate  * ecc_log_fruid_enable can be set in /etc/system or via mdb.  A value
907c478bd9Sstevel@tonic-gate  * of 1 is default, and indicates the messages are sent.  A value of 0
917c478bd9Sstevel@tonic-gate  * indicates that the messages are not sent.
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate extern int ecc_log_fruid_enable;
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #define	ECC_FRUID_ENABLE_DEFAULT	1
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #define	PLAT_ECC_JNUMBER_LENGTH	60
987c478bd9Sstevel@tonic-gate typedef struct plat_ecc_error_data {
997c478bd9Sstevel@tonic-gate 	uint8_t		version;	/* Starting with 1 */
1007c478bd9Sstevel@tonic-gate 	uint8_t		error_code;	/* Error Code */
1017c478bd9Sstevel@tonic-gate 	uint16_t	proc_num;	/* Processor Number of */
1027c478bd9Sstevel@tonic-gate 					/* CPU in error */
1037c478bd9Sstevel@tonic-gate 	uint8_t		bank_no;	/* 0 or 1 */
1047c478bd9Sstevel@tonic-gate 	uint8_t		ecache_dimm_no;	/* 0 to 3 */
1057c478bd9Sstevel@tonic-gate 	uint8_t		error_type;	/* single, two, three, quad */
1067c478bd9Sstevel@tonic-gate 					/* or multiple bit error status */
1077c478bd9Sstevel@tonic-gate 	uint8_t		databit_type;	/* Identify the databit type: */
1087c478bd9Sstevel@tonic-gate 					/* MTAG, ECC, MTAGECC or Data */
1097c478bd9Sstevel@tonic-gate 	uint8_t		databit_no;	/* Failed Databit number */
1107c478bd9Sstevel@tonic-gate 	uint8_t		node_no;	/* Wildcat node number */
1117c478bd9Sstevel@tonic-gate 	uint16_t	detecting_proc;	/* Processor detecting the ECC error */
1127c478bd9Sstevel@tonic-gate 	char		Jnumber[60];	/* Jnumber of the Dimm or Ecache */
1137c478bd9Sstevel@tonic-gate } plat_ecc_error_data_t;
1147c478bd9Sstevel@tonic-gate 
115a046a04eSmb91622 #define	PLAT_ECC_VERSION	3
1167c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_UNK	0x0	/* Unknown */
1177c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_CE	0x1	/* Correctable ECC error */
1187c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_UE	0x2	/* Uncorrectable ECC error */
1197c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_EDC	0x3	/* Correctable ECC error from E$ */
1207c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_EDU	0x4	/* Uncorrectable ECC error from E$ */
1217c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_WDC	0x5	/* Correctable E$ write-back ECC */
1227c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_WDU	0x6	/* Uncorrectable E$ write-back ECC */
1237c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_CPC	0x7	/* Copy-out correctable ECC error */
1247c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_CPU	0x8	/* Copy-out uncorrectable ECC error */
1257c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_UCC	0x9	/* SW handled correctable ECC */
1267c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_UCU	0xa	/* SW handled uncorrectable ECC */
1277c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_EMC	0xb	/* Correctable MTAG ECC error */
1287c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_CODE_EMU	0xc	/* Uncorrectable MTAG ECC error */
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_TYPE_UNK	0x0	/* Unknown */
1317c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_TYPE_SINGLE	0x1	/* Single bit error */
1327c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_TYPE_M2	0x2	/* Double bit error */
1337c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_TYPE_M3	0x3	/* Triple bit error */
1347c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_TYPE_M4	0x4	/* Quad bit error */
1357c478bd9Sstevel@tonic-gate #define	PLAT_ERROR_TYPE_M	0x5	/* Multiple bit error */
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate #define	PLAT_BIT_TYPE_MULTI	0x0	/* Error is 2 or more bits */
1387c478bd9Sstevel@tonic-gate #define	PLAT_BIT_TYPE_MTAG_D	0x1	/* MTAG data error */
1397c478bd9Sstevel@tonic-gate #define	PLAT_BIT_TYPE_MTAG_E	0x2	/* MTAG ECC error */
1407c478bd9Sstevel@tonic-gate #define	PLAT_BIT_TYPE_ECC	0x3	/* ECC error */
1417c478bd9Sstevel@tonic-gate #define	PLAT_BIT_TYPE_DATA	0x4	/* Data error */
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * Based on "UltraSPARC-III Programmer's Reference Manual", these values are
145a046a04eSmb91622  * obtained when you use the syndrome bits from the AFSR to index into the
146a046a04eSmb91622  * ECC syndrome table.  See us3_common.c for more details on the definitions
1477c478bd9Sstevel@tonic-gate  * of C0, C1, C2, ... C8, MT0, MT1, ... M3, M4 ... etc.
1487c478bd9Sstevel@tonic-gate  */
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #define	ECC_SYND_DATA_BEGIN	0
151a046a04eSmb91622 #define	ECC_SYND_DATA_LENGTH	128	/* data bits 0-127 */
1527c478bd9Sstevel@tonic-gate #define	ECC_SYND_ECC_BEGIN	(ECC_SYND_DATA_BEGIN + ECC_SYND_DATA_LENGTH)
1537c478bd9Sstevel@tonic-gate #define	ECC_SYND_ECC_LENGTH	9	/* ECC bits C0 - C* */
1547c478bd9Sstevel@tonic-gate #define	ECC_SYND_MTAG_BEGIN	(ECC_SYND_ECC_BEGIN + ECC_SYND_ECC_LENGTH)
1557c478bd9Sstevel@tonic-gate #define	ECC_SYND_MTAG_LENGTH	3	/* MTAG DATA bits MT0, MT1, MT3 */
1567c478bd9Sstevel@tonic-gate #define	ECC_SYND_MECC_BEGIN	(ECC_SYND_MTAG_BEGIN + ECC_SYND_MTAG_LENGTH)
1577c478bd9Sstevel@tonic-gate #define	ECC_SYND_MECC_LENGTH	4	/* MTAG ECC bits MTC0 - MTC3 */
1587c478bd9Sstevel@tonic-gate #define	ECC_SYND_M2	144
1597c478bd9Sstevel@tonic-gate #define	ECC_SYND_M3	145
1607c478bd9Sstevel@tonic-gate #define	ECC_SYND_M4	146
1617c478bd9Sstevel@tonic-gate #define	ECC_SYND_M	147
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate enum plat_ecc_type {PLAT_ECC_UNKNOWN, PLAT_ECC_MEMORY, PLAT_ECC_ECACHE };
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate typedef struct plat_ecc_msg_hdr {
1667c478bd9Sstevel@tonic-gate 	uint8_t		emh_major_ver;
1677c478bd9Sstevel@tonic-gate 	uint8_t		emh_minor_ver;
1687c478bd9Sstevel@tonic-gate 	uint16_t	emh_msg_type;
1697c478bd9Sstevel@tonic-gate 	uint16_t	emh_msg_length;
1707c478bd9Sstevel@tonic-gate 	uint16_t	emh_future0;	/* pad */
1717c478bd9Sstevel@tonic-gate } plat_ecc_msg_hdr_t;
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate extern uint16_t ecc_error2_mailbox_flags;
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L2_XXC		0x0001
1767c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L2_XXU		0x0002
1777c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L3_XXC		0x0004
1787c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L3_XXU		0x0008
1797c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_MEM_ERRS		0x0010
1807c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_BUS_ERRS		0x0020
1817c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L2_TAG_ERRS	0x0040
1827c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L3_TAG_ERRS	0x0080
1837c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_L1_PARITY		0x0100
1847c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_TLB_PARITY		0x0200
1857c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_IV_ERRS		0x0400
1867c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_MTAG_XXC		0x0800
1877c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_IV_MTAG_XXC	0x1000
1887c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_PCACHE		0x2000
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate /* default value for ecc_error2_mailbox_flags */
1917c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_SEND_DEFAULT		0x3fff
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate typedef struct plat_ecc_error2_data {
1947c478bd9Sstevel@tonic-gate 	plat_ecc_msg_hdr_t	ee2d_header;	/* Header info */
1957c478bd9Sstevel@tonic-gate 	uint8_t		ee2d_type;		/* PLAT_ECC_ERROR2_* */
1967c478bd9Sstevel@tonic-gate 	uint8_t		ee2d_afar_status;	/* AFLT_STAT_* (see async.h) */
1977c478bd9Sstevel@tonic-gate 	uint8_t		ee2d_synd_status;	/* AFLT_STAT_* (see async.h) */
1987c478bd9Sstevel@tonic-gate 	uint8_t		ee2d_bank_number;	/* 0 or 1 */
1997c478bd9Sstevel@tonic-gate 	uint16_t	ee2d_detecting_proc;	/* Proc that detected error */
2007c478bd9Sstevel@tonic-gate 	uint16_t	ee2d_jnumber;		/* J# of the part in error */
2017c478bd9Sstevel@tonic-gate 	uint16_t	ee2d_owning_proc;	/* Proc that controls memory */
2027c478bd9Sstevel@tonic-gate 	uint16_t	ee2d_future1;		/* pad */
2037c478bd9Sstevel@tonic-gate 	uint32_t	ee2d_cpu_impl;		/* Proc type */
2047c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_afsr;		/* AFSR */
2057c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_sdw_afsr;		/* Shadow AFSR */
2067c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_afsr_ext;		/* Extended AFSR */
2077c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_sdw_afsr_ext;	/* Shadow extended AFSR */
2087c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_afar;		/* AFAR */
2097c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_sdw_afar;		/* Shadow AFAR */
2107c478bd9Sstevel@tonic-gate 	uint64_t	ee2d_timestamp;		/* Time stamp */
2117c478bd9Sstevel@tonic-gate } plat_ecc_error2_data_t;
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate #define	ee2d_major_version	ee2d_header.emh_major_ver
2147c478bd9Sstevel@tonic-gate #define	ee2d_minor_version	ee2d_header.emh_minor_ver
2157c478bd9Sstevel@tonic-gate #define	ee2d_msg_type		ee2d_header.emh_msg_type
2167c478bd9Sstevel@tonic-gate #define	ee2d_msg_length		ee2d_header.emh_msg_length
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_VERSION_MAJOR		1
2197c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_VERSION_MINOR		1
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /* Values for ee2d_type */
2227c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_NONE			0x00
2237c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L2_CE			0x01
2247c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L2_UE			0x02
2257c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L3_CE			0x03
2267c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L3_UE			0x04
2277c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_CE			0x05
2287c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_UE			0x06
2297c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_DUE			0x07
2307c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_TO			0x08
2317c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_BERR			0x09
2327c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_DTO			0x0a
2337c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_DBERR			0x0b
2347c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L2_TSCE			0x0c
2357c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L2_THCE			0x0d
2367c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L3_TSCE			0x0e /* Unused */
2377c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L3_THCE			0x0f
2387c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_DPE			0x10
2397c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_IPE			0x11
2407c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_ITLB			0x12
2417c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_DTLB			0x13
2427c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_IVU			0x14
2437c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_IVC			0x15
2447c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_EMC			0x16
2457c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_IMC			0x17
2467c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_L3_MECC			0x18
2477c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_PCACHE			0x19
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate #define	PLAT_ECC_ERROR2_NUMVALS			0x1a
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate typedef struct plat_ecc_ch_async_flt {
2527c478bd9Sstevel@tonic-gate 	int		ecaf_synd_status; /* AFLT_STAT_* (see async.h) */
2537c478bd9Sstevel@tonic-gate 	int		ecaf_afar_status; /* AFLT_STAT_* (see async.h) */
2547c478bd9Sstevel@tonic-gate 	uint64_t	ecaf_sdw_afar;
2557c478bd9Sstevel@tonic-gate 	uint64_t	ecaf_sdw_afsr;
2567c478bd9Sstevel@tonic-gate 	uint64_t	ecaf_afsr_ext;
2577c478bd9Sstevel@tonic-gate 	uint64_t	ecaf_sdw_afsr_ext;
2587c478bd9Sstevel@tonic-gate } plat_ecc_ch_async_flt_t;
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate /*
2617c478bd9Sstevel@tonic-gate  * The following structures/#defines are used to notify the SC
2627c478bd9Sstevel@tonic-gate  * of DIMMs that fail the leaky bucket algorithm, E$ that experience
2637c478bd9Sstevel@tonic-gate  * multiple correctable errors and fail the serd algorithm, and
2647c478bd9Sstevel@tonic-gate  * E$ that experience any non-fatal uncorrectable error.
2657c478bd9Sstevel@tonic-gate  */
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate extern uint8_t ecc_indictment_mailbox_disable;
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /* The message is OK */
2707c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICTMENT_OK		0x00
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate /* Send the message, but don't trust it */
2737c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICTMENT_SUSPECT	0x01
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate /* Don't send message */
2767c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICTMENT_NO_SEND	0x02
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate extern uint8_t ecc_indictment_mailbox_flags;
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate /* DIMM indictments for CEs */
2817c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_DIMM_INDICT		0x01
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate /* E$ indictments for UCC, WDC, CPC, EDC */
2847c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_ECACHE_XXC_INDICT		0x02
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate /* E$ indictments for UCU, WDU, CPU, EDU */
2877c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_ECACHE_XXU_INDICT		0x04
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate /* Default value for ecc_indictment_mailbox_flags */
2907c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_DEFAULT_INDICT	(PLAT_ECC_SEND_ECACHE_XXC_INDICT |\
2917c478bd9Sstevel@tonic-gate 					PLAT_ECC_SEND_ECACHE_XXU_INDICT)
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate /*
2947c478bd9Sstevel@tonic-gate  * WARNING: The plat_ecc_indictment_data_t struct size can be no bigger than
2957c478bd9Sstevel@tonic-gate  * 128 bytes.  The union will fill out the structure to the correct size -
2967c478bd9Sstevel@tonic-gate  * the string space used in solaris_version will fill out the rest of the
2977c478bd9Sstevel@tonic-gate  * structure.
2987c478bd9Sstevel@tonic-gate  *
2997c478bd9Sstevel@tonic-gate  * Any changes made to this structure in the future should ensure that the
3007c478bd9Sstevel@tonic-gate  * structure does not go over 128 bytes.
3017c478bd9Sstevel@tonic-gate  */
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT_SIZE	128
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate typedef struct {
3067c478bd9Sstevel@tonic-gate 	uint8_t 	version;		/* Starting with 1 */
3077c478bd9Sstevel@tonic-gate 	uint8_t 	indictment_type;	/* see below for values */
3087c478bd9Sstevel@tonic-gate 	uint8_t 	indictment_uncertain;
3097c478bd9Sstevel@tonic-gate 				/* Value of ecc_indictment_mailbox_disable */
3107c478bd9Sstevel@tonic-gate 	uint8_t 	board_num;		/* board number of dimm/E$ */
3117c478bd9Sstevel@tonic-gate 	uint16_t	detecting_proc;		/* Processor Number of CPU */
3127c478bd9Sstevel@tonic-gate 						/* reporting error */
3137c478bd9Sstevel@tonic-gate 	uint16_t	syndrome;		/* syndrome of last error */
3147c478bd9Sstevel@tonic-gate 	uint16_t	jnumber;		/* Jnumber of dimm/E$ */
3157c478bd9Sstevel@tonic-gate 	uint16_t	future[7];		/* For future use */
3167c478bd9Sstevel@tonic-gate 	uint64_t	afsr;			/* AFSR of last error */
3177c478bd9Sstevel@tonic-gate 	uint64_t	afar;			/* AFAR of last error */
3187c478bd9Sstevel@tonic-gate 	char    	solaris_version[1];
3197c478bd9Sstevel@tonic-gate 						/* Solaris version string */
3207c478bd9Sstevel@tonic-gate } plat_ecc_indict_msg_contents_t;
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate typedef union {
3237c478bd9Sstevel@tonic-gate 	plat_ecc_indict_msg_contents_t	msg_contents;
3247c478bd9Sstevel@tonic-gate 	uint8_t				filler[PLAT_ECC_INDICT_SIZE];
3257c478bd9Sstevel@tonic-gate } plat_ecc_indictment_data_t;
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate #define	PLAT_ECC_VERSION_LENGTH		(PLAT_ECC_INDICT_SIZE - \
3287c478bd9Sstevel@tonic-gate 		offsetof(plat_ecc_indict_msg_contents_t, solaris_version))
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICTMENT_VERSION	1
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate /*
3337c478bd9Sstevel@tonic-gate  * Values for indictment_type.  For Panther, E$ refers to
3347c478bd9Sstevel@tonic-gate  * the L3$.  For previous procs, E$ refers to the L2$.
3357c478bd9Sstevel@tonic-gate  */
3367c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT_NONE			0x00
3377c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT_DIMM			0x01
3387c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT_ECACHE_CORRECTABLES	0x02
3397c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT_ECACHE_UNCORRECTABLE	0x03
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate /*
3437c478bd9Sstevel@tonic-gate  * These values are used to set the state of msg_status
3447c478bd9Sstevel@tonic-gate  *
3457c478bd9Sstevel@tonic-gate  * 0 - No message in transit
3467c478bd9Sstevel@tonic-gate  * 1 - taskq thread dispatched, dispatching thread waiting for signal
3477c478bd9Sstevel@tonic-gate  * 2 - dispatched thread completed sending message
3487c478bd9Sstevel@tonic-gate  * 3 - dispatching thread received interrupt, not waiting for signal
3497c478bd9Sstevel@tonic-gate  */
3507c478bd9Sstevel@tonic-gate #define	PLAT_ECC_NO_MSG_ACTIVE		0
3517c478bd9Sstevel@tonic-gate #define	PLAT_ECC_TASK_DISPATCHED	1
3527c478bd9Sstevel@tonic-gate #define	PLAT_ECC_MSG_SENT		2
3537c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INTERRUPT_RECEIVED	3
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate /*
3567c478bd9Sstevel@tonic-gate  * Min and max sizes of plat_ecc_taskq
3577c478bd9Sstevel@tonic-gate  */
3587c478bd9Sstevel@tonic-gate #define	PLAT_ECC_TASKQ_MIN	2
3597c478bd9Sstevel@tonic-gate #define	PLAT_ECC_TASKQ_MAX	8
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate extern uint16_t ecc_indictment2_mailbox_flags;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L2_XXU		0x0001
3657c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L2_XXC_SERD	0x0002
3667c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L2_TAG_SERD	0x0004
3677c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L3_XXU		0x0008
3687c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L3_XXC_SERD	0x0010
3697c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L3_TAG_SERD	0x0020
3707c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_L1_SERD		0x0040
3717c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_TLB_SERD		0x0080
3727c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_FPU		0x0100
3737c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_PCACHE_SERD	0x0200
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate #define	PLAT_ECC_SEND_INDICT2_DEFAULT		0x03ff
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate typedef struct plat_ecc_indictment2_data {
3787c478bd9Sstevel@tonic-gate 	plat_ecc_msg_hdr_t	ei2d_header;	/* Header info */
3797c478bd9Sstevel@tonic-gate 	uint8_t		ei2d_type;		/* PLAT_ECC_INDICT2_* */
3807c478bd9Sstevel@tonic-gate 	uint8_t		ei2d_uncertain;		/* See indictment_uncertain */
3817c478bd9Sstevel@tonic-gate 	uint8_t		ei2d_board_num;		/* Board number of dimm */
3827c478bd9Sstevel@tonic-gate 	uint8_t		ei2d_future1;		/* pad */
3837c478bd9Sstevel@tonic-gate 	uint16_t	ei2d_arraigned_proc;	/* Proc number */
3847c478bd9Sstevel@tonic-gate 	uint16_t	ei2d_jnumber;		/* Jnumber */
3857c478bd9Sstevel@tonic-gate 	uint32_t	ei2d_cpu_impl;		/* Proc type */
3867c478bd9Sstevel@tonic-gate 	uint32_t	ei2d_future2;		/* pad */
3877c478bd9Sstevel@tonic-gate 	uint64_t	ei2d_timestamp;		/* Time stamp */
3887c478bd9Sstevel@tonic-gate } plat_ecc_indictment2_data_t;
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate #define	ei2d_major_version	ei2d_header.emh_major_ver
3917c478bd9Sstevel@tonic-gate #define	ei2d_minor_version	ei2d_header.emh_minor_ver
3927c478bd9Sstevel@tonic-gate #define	ei2d_msg_type		ei2d_header.emh_msg_type
3937c478bd9Sstevel@tonic-gate #define	ei2d_msg_length		ei2d_header.emh_msg_length
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_MAJOR_VERSION	1
3967c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_MINOR_VERSION	1
3977c478bd9Sstevel@tonic-gate 
3987c478bd9Sstevel@tonic-gate /*
3997c478bd9Sstevel@tonic-gate  * Values for ei2d_type
4007c478bd9Sstevel@tonic-gate  */
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_NONE			0x00
4037c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_L2_UE			0x01
4047c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_L2_SERD		0x02
4057c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_L2_TAG_SERD		0x03
4067c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_L3_UE			0x04
4077c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_L3_SERD		0x05
4087c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_L3_TAG_SERD		0x06
4097c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_DCACHE_SERD		0x07
4107c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_ICACHE_SERD		0x08
4117c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_ITLB_SERD		0x09
4127c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_DTLB_SERD		0x0a
4137c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_FPU			0x0b
4147c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_PCACHE_SERD		0x0c
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate #define	PLAT_ECC_INDICT2_NUMVALS		0x0d
4177c478bd9Sstevel@tonic-gate 
4187c478bd9Sstevel@tonic-gate /*
4197c478bd9Sstevel@tonic-gate  * The following structure maps the indictment reason to its
4207c478bd9Sstevel@tonic-gate  * corresponding type.
4217c478bd9Sstevel@tonic-gate  */
4227c478bd9Sstevel@tonic-gate typedef struct plat_ecc_bl_map {
4237c478bd9Sstevel@tonic-gate 	char	*ebm_reason;	/* Indictment reason */
4247c478bd9Sstevel@tonic-gate 	int	ebm_type;	/* Indictment type */
4257c478bd9Sstevel@tonic-gate } plat_ecc_bl_map_t;
4267c478bd9Sstevel@tonic-gate 
4277c478bd9Sstevel@tonic-gate /*
4287c478bd9Sstevel@tonic-gate  * This message is used to exchange the capability of the SC and Domain
4297c478bd9Sstevel@tonic-gate  * so that both entities can adjust their behavior as appropriate.
4307c478bd9Sstevel@tonic-gate  * Also the Solaris version is sent from the Domain along with the
4317c478bd9Sstevel@tonic-gate  * capability bitmap.
4327c478bd9Sstevel@tonic-gate  */
4337c478bd9Sstevel@tonic-gate typedef struct plat_capability_data {
4347c478bd9Sstevel@tonic-gate 	plat_ecc_msg_hdr_t	capd_header;	/* Header info */
4357c478bd9Sstevel@tonic-gate 	uint32_t	capd_capability;	/* Capability bitmap */
4367c478bd9Sstevel@tonic-gate 	uint32_t	capd_future1;		/* pad */
4377c478bd9Sstevel@tonic-gate 	uint64_t	capd_future2;		/* pad */
4387c478bd9Sstevel@tonic-gate 	char		capd_solaris_version[1];
4397c478bd9Sstevel@tonic-gate 						/* Solaris version string ptr */
4407c478bd9Sstevel@tonic-gate } plat_capability_data_t;
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate #define	capd_major_version	capd_header.emh_major_ver
4437c478bd9Sstevel@tonic-gate #define	capd_minor_version	capd_header.emh_minor_ver
4447c478bd9Sstevel@tonic-gate #define	capd_msg_type		capd_header.emh_msg_type
4457c478bd9Sstevel@tonic-gate #define	capd_msg_length		capd_header.emh_msg_length
4467c478bd9Sstevel@tonic-gate 
4477c478bd9Sstevel@tonic-gate #define	PLAT_ECC_CAP_VERSION_MAJOR	1
4487c478bd9Sstevel@tonic-gate #define	PLAT_ECC_CAP_VERSION_MINOR	1
4497c478bd9Sstevel@tonic-gate 
450*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_ERROR		0x001
451*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_INDICT		0x002
452*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_ERROR2		0x004
453*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_INDICT2		0x008
454*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_FMA			0x010
455*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_EREPORTS		0x020	/* unused */
456*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_DIMM_SID		0x040
457*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_DP_ERROR		0x080
458*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_DP_FAULT		0x100
4597c478bd9Sstevel@tonic-gate 
460*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_DOMAIN_DEFAULT	0x1df
461*d00f0155Sayznaga #define	PLAT_ECC_CAPABILITY_SC_DEFAULT		0x003
4627c478bd9Sstevel@tonic-gate 
4637c478bd9Sstevel@tonic-gate extern uint32_t plat_ecc_capability_map_domain;
4647c478bd9Sstevel@tonic-gate extern uint32_t plat_ecc_capability_map_sc;
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate /*
4677c478bd9Sstevel@tonic-gate  * The following structure is a wrapper around the all messages. The
4687c478bd9Sstevel@tonic-gate  * extra members are used for communicating between two threads.
4697c478bd9Sstevel@tonic-gate  */
4707c478bd9Sstevel@tonic-gate typedef struct plat_ecc_message {
4717c478bd9Sstevel@tonic-gate 	plat_ecc_message_type_t		ecc_msg_type;
4727c478bd9Sstevel@tonic-gate 	uint32_t			ecc_msg_status;
4737c478bd9Sstevel@tonic-gate 	uint32_t			ecc_msg_ret;
4747c478bd9Sstevel@tonic-gate 	uint32_t			ecc_msg_len;
4757c478bd9Sstevel@tonic-gate 	void *				ecc_msg_data;
4767c478bd9Sstevel@tonic-gate } plat_ecc_message_t;
4777c478bd9Sstevel@tonic-gate 
4787c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4797c478bd9Sstevel@tonic-gate }
4807c478bd9Sstevel@tonic-gate #endif
4817c478bd9Sstevel@tonic-gate 
4827c478bd9Sstevel@tonic-gate #endif	/* _SYS_PLAT_ECC_NUM_H */
483