7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Common Development and Distribution License (the "License").
20c794b39650d115e17a15983b6b82e46238cf45gavinm * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * or http://www.opensolaris.org/os/licensing.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#ifndef _SYS_MCA_X86_H
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define _SYS_MCA_X86_H
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Constants for the Memory Check Architecture as implemented on generic x86
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CPUs.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
20c794b39650d115e17a15983b6b82e46238cf45gavinm#include <sys/types.h>
20c794b39650d115e17a15983b6b82e46238cf45gavinm#include <sys/isa_defs.h>
20c794b39650d115e17a15983b6b82e46238cf45gavinm
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#ifdef __cplusplus
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern "C" {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Architectural MSRs from the IA-32 Software Developer's Manual - IA32_MSR_*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define IA32_MSR_MCG_CAP 0x179
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define IA32_MSR_MCG_STATUS 0x17a
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define IA32_MSR_MCG_CTL 0x17b
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_CAP_CTL_P 0x00000100ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_CAP_EXT_P 0x00000200ULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCG_CAP_TES_P 0x00000800ULL
728f047ccdb8a96a1aecc448cb87706241a08c94Adrian Frost#define MCG_CAP_CTL2_P 0x00000400ULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCG_CAP_COUNT_MASK 0x000000ffULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCG_CAP_COUNT(cap) ((cap) & MCG_CAP_COUNT_MASK)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_CAP_EXT_CNT_MASK 0x00ff0000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_CAP_EXT_CNT_SHIFT 16
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCG_CAP_EXT_CNT(cap) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((cap) & MCG_CAP_EXT_CNT_MASK) >> MCG_CAP_EXT_CNT_SHIFT)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_STATUS_RIPV 0x01
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_STATUS_EIPV 0x02
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MCG_STATUS_MCIP 0x04
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * There are as many error detector "banks" as indicated by
20c794b39650d115e17a15983b6b82e46238cf45gavinm * IA32_MSR_MCG_CAP.COUNT. Each bank has a minimum of 3 associated
20c794b39650d115e17a15983b6b82e46238cf45gavinm * registers (MCi_CTL, MCi_STATUS, and MCi_ADDR) and some banks
20c794b39650d115e17a15983b6b82e46238cf45gavinm * may implement a fourth (MCi_MISC) which should only be read
20c794b39650d115e17a15983b6b82e46238cf45gavinm * when MCi_STATUS.MISCV indicates that it exists and has valid data.
20c794b39650d115e17a15983b6b82e46238cf45gavinm *
20c794b39650d115e17a15983b6b82e46238cf45gavinm * The first bank features at MSR offsets 0x400 to 0x403, the next at
20c794b39650d115e17a15983b6b82e46238cf45gavinm * 0x404 to 0x407, and so on. Current processors implement up to 6
20c794b39650d115e17a15983b6b82e46238cf45gavinm * banks (sixth one at 0x414 to 0x417).
20c794b39650d115e17a15983b6b82e46238cf45gavinm *
20c794b39650d115e17a15983b6b82e46238cf45gavinm * It is, sadly, not the case that the i'th set of 4 registers starting
20c794b39650d115e17a15983b6b82e46238cf45gavinm * at 0x400 corresponds to MCi_{CTL,STATUS,ADDR,MISC} - for some Intel
20c794b39650d115e17a15983b6b82e46238cf45gavinm * processors, for example, the order is 0/1/2/4/3. Nonetheless, we can
20c794b39650d115e17a15983b6b82e46238cf45gavinm * still iterate through the banks and read all telemetry - there'll just
20c794b39650d115e17a15983b6b82e46238cf45gavinm * be some potential confusion as to which processor unit a bank is
20c794b39650d115e17a15983b6b82e46238cf45gavinm * associated with. Error reports should seek to disambiguate.
20c794b39650d115e17a15983b6b82e46238cf45gavinm *
20c794b39650d115e17a15983b6b82e46238cf45gavinm * IA32_MSR_MC(i, which) calculates the MSR address for th i'th bank
20c794b39650d115e17a15983b6b82e46238cf45gavinm * of registers (not for MCi_*, as above) and one of CTL, STATUS, ADDR, MISC
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define _IA32_MSR_MC0_CTL 0x400ULL /* first/base reg */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define _IA32_MSR_OFFSET_CTL 0x0 /* offset within a bank */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define _IA32_MSR_OFFSET_STATUS 0x1 /* offset within a bank */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define _IA32_MSR_OFFSET_ADDR 0x2 /* offset within a bank */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define _IA32_MSR_OFFSET_MISC 0x3 /* offset within a bank */
20c794b39650d115e17a15983b6b82e46238cf45gavinm
728f047ccdb8a96a1aecc448cb87706241a08c94Adrian Frost#define _IA32_MSR_MC0_CTL2 0x280ULL /* first MCi_CTL2 reg */
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define IA32_MSR_MC(i, which) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (_IA32_MSR_MC0_CTL + (i) * 4 + _IA32_MSR_OFFSET_##which)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
728f047ccdb8a96a1aecc448cb87706241a08c94Adrian Frost#define IA32_MSR_MC_CTL2(i) (_IA32_MSR_MC0_CTL2 + (i))
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * IA32_MSR_MCG_CAP.MCG_EXT_P indicates that a processor implements
20c794b39650d115e17a15983b6b82e46238cf45gavinm * a set of extended machine-check registers starting at MSR 0x180;
20c794b39650d115e17a15983b6b82e46238cf45gavinm * when that is set, IA32_MSR_MCG_CAP.MCG_EXT_CNT indicates how
20c794b39650d115e17a15983b6b82e46238cf45gavinm * many of these extended registers (addresses 0x180, 0x181, ...)
20c794b39650d115e17a15983b6b82e46238cf45gavinm * are present. Which registers are present depends on whether support
20c794b39650d115e17a15983b6b82e46238cf45gavinm * for 64-bit architecture is present.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define _IA32_MCG_RAX 0x180ULL /* first/base extended reg */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define IA32_MSR_EXT(i) (_IA32_MCG_RAX + (i))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
20c794b39650d115e17a15983b6b82e46238cf45gavinm#ifdef _BIT_FIELDS_LTOH
20c794b39650d115e17a15983b6b82e46238cf45gavinmtypedef union mca_x86_mcistatus {
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint64_t _val64;
20c794b39650d115e17a15983b6b82e46238cf45gavinm struct {
20c794b39650d115e17a15983b6b82e46238cf45gavinm /*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Lower 32 bits of MCi_STATUS
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm struct {
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _errcode:16; /* <15:0> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _ms_errcode:16; /* <31:16> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm } _mcis_lo;
20c794b39650d115e17a15983b6b82e46238cf45gavinm /*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Upper 32 bits of MCi_STATUS
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm union {
20c794b39650d115e17a15983b6b82e46238cf45gavinm /*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * If IA32_MCG_CAP.MCG_TES_P is set then <54:53>
20c794b39650d115e17a15983b6b82e46238cf45gavinm * and <56:55> are architectural.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm struct {
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _otherinfo:21; /* <52:32> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _tbes:2; /* <54:53> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _reserved:2; /* <56:55> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _pcc:1; /* <57> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _addrv:1; /* <58> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _miscv:1; /* <59> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _en:1; /* <60> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _uc:1; /* <61> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _over:1; /* <62> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _val:1; /* <63> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm } _mcis_hi_tes_p;
20c794b39650d115e17a15983b6b82e46238cf45gavinm /*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * If IA32_MCG_CAP.MCG_TES_P is clear then <56:53>
20c794b39650d115e17a15983b6b82e46238cf45gavinm * are model-specific.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm struct {
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _otherinfo:25; /* <56:32> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _pcc:1; /* <57> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _addrv:1; /* <58> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _miscv:1; /* <59> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _en:1; /* <60> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _uc:1; /* <61> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _over:1; /* <62> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm uint32_t _val:1; /* <63> */
20c794b39650d115e17a15983b6b82e46238cf45gavinm } _mcis_hi_tes_np;
20c794b39650d115e17a15983b6b82e46238cf45gavinm } _mcis_hi;
20c794b39650d115e17a15983b6b82e46238cf45gavinm } _mcis_hilo;
20c794b39650d115e17a15983b6b82e46238cf45gavinm} mca_x86_mcistatus_t;
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_errcode _mcis_hilo._mcis_lo._errcode
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_mserrcode _mcis_hilo._mcis_lo._ms_errcode
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_pcc _mcis_hilo._mcis_hi._mcis_hi_tes_np._pcc
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_addrv _mcis_hilo._mcis_hi._mcis_hi_tes_np._addrv
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_miscv _mcis_hilo._mcis_hi._mcis_hi_tes_np._miscv
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_en _mcis_hilo._mcis_hi._mcis_hi_tes_np._en
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_uc _mcis_hilo._mcis_hi._mcis_hi_tes_np._uc
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_over _mcis_hilo._mcis_hi._mcis_hi_tes_np._over
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_val _mcis_hilo._mcis_hi._mcis_hi_tes_np._val
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * The consumer must check for TES_P before using these.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_tbes _mcis_hilo._mcis_hi._mcis_hi_tes_p._tbes
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_reserved \
20c794b39650d115e17a15983b6b82e46238cf45gavinm _mcis_hilo._mcis_hi._mcis_hi_tes_p._reserved
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_otherinfo_tes_p \
20c794b39650d115e17a15983b6b82e46238cf45gavinm _mcis_hilo._mcis_hi._mcis_hi_tes_p._otherinfo
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define mcistatus_otherinfo_tes_np \
20c794b39650d115e17a15983b6b82e46238cf45gavinm _mcis_hilo._mcis_hi._mcis_hi_tes_np._otherinfo
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#endif /* _BIT_FIELDS_LTOH */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_VAL 0x8000000000000000ULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MSR_MC_STATUS_OVER 0x4000000000000000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_UC 0x2000000000000000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_EN 0x1000000000000000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_MISCV 0x0800000000000000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_ADDRV 0x0400000000000000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_PCC 0x0200000000000000ULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MSR_MC_STATUS_RESERVED_MASK 0x0180000000000000ULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MSR_MC_STATUS_TBES_MASK 0x0060000000000000ULL
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MSR_MC_STATUS_TBES_SHIFT 53
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MSR_MC_STATUS_CEC_MASK 0x001fffc000000000ULL
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MSR_MC_STATUS_CEC_SHIFT 38
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_MSERR_MASK 0x00000000ffff0000ULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_MSERR_SHIFT 16
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define MSR_MC_STATUS_MCAERR_MASK 0x000000000000ffffULL
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
728f047ccdb8a96a1aecc448cb87706241a08c94Adrian Frost#define MSR_MC_CTL2_EN 0x0000000040000000ULL
728f047ccdb8a96a1aecc448cb87706241a08c94Adrian Frost#define MSR_MC_CTL2_THRESHOLD_MASK 0x0000000000007fffULL
728f047ccdb8a96a1aecc448cb87706241a08c94Adrian Frost#define MSR_MC_CTL2_THRESHOLD_OVERFLOW 0x0000000000004000ULL
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Macros to extract error code and model-specific error code.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE(stat) ((stat) & MSR_MC_STATUS_MCAERR_MASK)
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_MSERRCODE(stat) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((stat) & MSR_MC_STATUS_MSERR_MASK) >> MSR_MC_STATUS_MSERR_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Macro to extract threshold based error state (if MCG_CAP.TES_P)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_TBES_VALUE(stat) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((stat) & MSR_MC_STATUS_TBES_MASK) >> MSR_MC_STATUS_TBES_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Bit definitions for the architectural error code.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_TT_MASK 0x000c
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_TT_SHIFT 2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_TT_INSTR 0x0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_TT_DATA 0x1
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_TT_GEN 0x2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_TT(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_ERRCODE_TT_MASK) >> MCAX86_ERRCODE_TT_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL_MASK 0x0003
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL_SHIFT 0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL_L0 0x0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL_L1 0x1
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL_L2 0x2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL_LG 0x3
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_LL(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_ERRCODE_LL_MASK)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_MASK 0x00f0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_SHIFT 4
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_ERR 0x0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_RD 0x1
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_WR 0x2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_DRD 0x3
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_DWR 0x4
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_IRD 0x5
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_PREFETCH 0x6
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_EVICT 0x7
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR_SNOOP 0x8
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_RRRR(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_ERRCODE_RRRR_MASK) >> MCAX86_ERRCODE_RRRR_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP_MASK 0x0600
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP_SHIFT 9
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP_SRC 0x0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP_RES 0x1
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP_OBS 0x2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP_GEN 0x3
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_PP(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_ERRCODE_PP_MASK) >> MCAX86_ERRCODE_PP_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_II_MASK 0x000c
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_II_SHIFT 2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_II_MEM 0x0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_II_IO 0x2
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_II_GEN 0x3
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_II(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_ERRCODE_II_MASK) >> MCAX86_ERRCODE_II_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_T_MASK 0x0100
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_T_SHIFT 8
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_T_NONE 0x0
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_T_TIMEOUT 0x1
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_T(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_ERRCODE_T_MASK) >> MCAX86_ERRCODE_T_SHIFT)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM_MASK 0x0070
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM_SHIFT 4
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM_GEN 0x0
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM_RD 0x1
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM_WR 0x2
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM_ADRCMD 0x3
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_MMM(code) \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost (((code) & MCAX86_ERRCODE_MMM_MASK) >> MCAX86_ERRCODE_MMM_SHIFT)
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_MASK 0x000f
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_SHIFT 0
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH0 0x0
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH1 0x1
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH2 0x2
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH3 0x3
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH4 0x4
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH5 0x5
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH6 0x6
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH7 0x7
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH8 0x8
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH9 0x9
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH10 0xa
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH11 0xb
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH12 0xc
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH13 0xd
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_CH14 0xe
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC_GEN 0xf
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_CCCC(code) \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost (((code) & MCAX86_ERRCODE_CCCC_MASK) >> MCAX86_ERRCODE_CCCC_SHIFT)
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Simple error encoding. MASKON are bits that must be set for a match
20c794b39650d115e17a15983b6b82e46238cf45gavinm * at the same time bits indicated by MASKOFF are clear.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_UNCLASSIFIED_MASKON 0x0001
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_UNCLASSIFIED_MASKOFF 0xfffe
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_MC_CODE_PARITY_MASKON 0x0002
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_MC_CODE_PARITY_MASKOFF 0xfffd
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_EXTERNAL_MASKON 0x0003
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_EXTERNAL_MASKOFF 0xfffc
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_FRC_MASKON 0x0004
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_FRC_MASKOFF 0xfffb
20c794b39650d115e17a15983b6b82e46238cf45gavinm
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_SIMPLE_INTERNAL_PARITY_MASKON 0x0005
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_SIMPLE_INTERNAL_PARITY_MASKOFF 0xfffa
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_INTERNAL_TIMER_MASKON 0x0400
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_INTERNAL_TIMER_MASKOFF 0xfbff
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_INTERNAL_UNCLASS_MASK_MASKON 0x0400
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_INTERNAL_UNCLASS_MASK_MASKOFF 0xf800
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_SIMPLE_INTERNAL_UNCLASS_VALUE_MASK 0x03ff
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Macros to make an internal unclassified error code, and to test if
20c794b39650d115e17a15983b6b82e46238cf45gavinm * a given code is internal unclassified.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_MKERRCODE_INTERNAL_UNCLASS(val) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (MCAX86_SIMPLE_INTERNAL_UNCLASS_MASK_MASKON | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((val) & MCAX86_SIMPLE_INTERNAL_UNCLASS_VALUE_MASK))
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISSIMPLE_INTERNAL_UNCLASS(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_SIMPLE_INTERNAL_UNCLASS_MASK_MASKON) == \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_SIMPLE_INTERNAL_UNCLASS_MASK_MASKON && \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_SIMPLE_INTERNAL_UNCLASS_MASK_MASKOFF) == 0 && \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_SIMPLE_INTERNAL_UNCLASS_VALUE_MASK) != 0)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Is the given error code a simple error encoding?
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISSIMPLE(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) >= MCAX86_SIMPLE_UNCLASSIFIED_MASKON && \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost (code) <= MCAX86_SIMPLE_INTERNAL_PARITY_MASKON || \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (code) == MCAX86_SIMPLE_INTERNAL_TIMER_MASKON || \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_ERRCODE_ISSIMPLE_INTERNAL_UNCLASS(code))
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Compound error encoding. We always ignore the 'F' bit (which indicates
20c794b39650d115e17a15983b6b82e46238cf45gavinm * "correction report filtering") in classifying the error type.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_GENERIC_MEMHIER_MASKON 0x000c
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_GENERIC_MEMHIER_MASKOFF 0xeff0
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_TLB_MASKON 0x0010
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_TLB_MASKOFF 0xefe0
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_MEMHIER_MASKON 0x0100
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_MEMHIER_MASKOFF 0xee00
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_BUS_INTERCONNECT_MASKON 0x0800
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_COMPOUND_BUS_INTERCONNECT_MASKOFF 0xe000
20c794b39650d115e17a15983b6b82e46238cf45gavinm
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_COMPOUND_MEMORY_CONTROLLER_MASKON 0x0080
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_COMPOUND_MEMORY_CONTROLLER_MASKOFF 0xff00
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
20c794b39650d115e17a15983b6b82e46238cf45gavinm/*
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Macros to make compound error codes and to test for each type.
20c794b39650d115e17a15983b6b82e46238cf45gavinm */
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_MKERRCODE_GENERIC_MEMHIER(ll) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (MCAX86_COMPOUND_GENERIC_MEMHIER_MASKON | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((ll) & MCAX86_ERRCODE_LL_MASK))
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISGENERIC_MEMHIER(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_COMPOUND_GENERIC_MEMHIER_MASKON) == \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_COMPOUND_GENERIC_MEMHIER_MASKON && \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_COMPOUND_GENERIC_MEMHIER_MASKOFF) == 0)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_MKERRCODE_TLB(tt, ll) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (MCAX86_COMPOUND_TLB_MASKON | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((tt) << MCAX86_ERRCODE_TT_SHIFT & MCAX86_ERRCODE_TT_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((ll) & MCAX86_ERRCODE_LL_MASK))
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISTLB(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_COMPOUND_TLB_MASKON) == \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_COMPOUND_TLB_MASKON && \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_COMPOUND_TLB_MASKOFF) == 0)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_MKERRCODE_MEMHIER(rrrr, tt, ll) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (MCAX86_COMPOUND_MEMHIER_MASKON | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((rrrr) << MCAX86_ERRCODE_RRRR_SHIFT & MCAX86_ERRCODE_RRRR_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((tt) << MCAX86_ERRCODE_TT_SHIFT & MCAX86_ERRCODE_TT_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((ll) & MCAX86_ERRCODE_LL_MASK))
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISMEMHIER(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_COMPOUND_MEMHIER_MASKON) == \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_COMPOUND_MEMHIER_MASKON && \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_COMPOUND_MEMHIER_MASKOFF) == 0)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_MKERRCODE_BUS_INTERCONNECT(pp, t, rrrr, ii, ll) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (MCAX86_COMPOUND_BUS_INTERCONNECT_MASKON | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((pp) << MCAX86_ERRCODE_PP_SHIFT & MCAX86_ERRCODE_PP_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((t) << MCAX86_ERRCODE_T_SHIFT & MCAX86_ERRCODE_T_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((rrrr) << MCAX86_ERRCODE_RRRR_SHIFT & MCAX86_ERRCODE_RRRR_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((ii) << MCAX86_ERRCODE_II_SHIFT & MCAX86_ERRCODE_II_MASK) | \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((ll) & MCAX86_ERRCODE_LL_MASK))
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISBUS_INTERCONNECT(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (((code) & MCAX86_COMPOUND_BUS_INTERCONNECT_MASKON) == \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_COMPOUND_BUS_INTERCONNECT_MASKON && \
20c794b39650d115e17a15983b6b82e46238cf45gavinm ((code) & MCAX86_COMPOUND_BUS_INTERCONNECT_MASKOFF) == 0)
20c794b39650d115e17a15983b6b82e46238cf45gavinm
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_MKERRCODE_MEMORY_CONTROLLER (mmm, cccc) \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost (MCAX86_COMPOUNT_MEMORY_CONTROLLER_MASKON | \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost ((mmm) << MCAX86_ERRCODE_MMM_SHIFT & MCAX86_ERRCODE_MMM_MASK) | \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost ((cccc) << MCAX86_ERRCODE_CCCC_SHIFT & MCAX86_ERRCODE_CCCC_MASK))
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost#define MCAX86_ERRCODE_ISMEMORY_CONTROLLER(code) \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost (((code) & MCAX86_COMPOUND_MEMORY_CONTROLLER_MASKON) == \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost MCAX86_COMPOUND_MEMORY_CONTROLLER_MASKON && \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost ((code) & MCAX86_COMPOUND_MEMORY_CONTROLLER_MASKOFF) == 0)
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_ISCOMPOUND(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (MCAX86_ERRCODE_ISGENERIC_MEMHIER(code) || \
20c794b39650d115e17a15983b6b82e46238cf45gavinm MCAX86_ERRCODE_ISTLB(code) || \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost MCAX86_ERRCODE_ISMEMHIER(code) || \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost MCAX86_ERRCODE_ISBUS_INTERCONNECT(code) || \
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost MCAX86_ERRCODE_ISMEMORY_CONTROLLER(code))
20c794b39650d115e17a15983b6b82e46238cf45gavinm
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define MCAX86_ERRCODE_UNKNOWN(code) \
20c794b39650d115e17a15983b6b82e46238cf45gavinm (!MCAX86_ERRCODE_ISSIMPLE(code) && !MCAX86_ERRCODE_ISCOMPOUND(code))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#ifdef __cplusplus
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi}
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif /* _SYS_MCA_X86_H */