#ifndef _SYS_PLAT_ECC_NUM_H
#define _SYS_PLAT_ECC_NUM_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/int_types.h>
#include <sys/cheetahregs.h>
#include <sys/cpuvar.h>
#include <sys/dditypes.h>
#include <sys/ddipropdefs.h>
#include <sys/ddi_impldefs.h>
#include <sys/sunddi.h>
#include <sys/platform_module.h>
#include <sys/errno.h>
#include <sys/conf.h>
#include <sys/cmn_err.h>
#include <sys/sysmacros.h>
typedef enum {
PLAT_ECC_ERROR_MESSAGE,
PLAT_ECC_INDICTMENT_MESSAGE,
PLAT_ECC_ERROR2_MESSAGE,
PLAT_ECC_INDICTMENT2_MESSAGE,
PLAT_ECC_CAPABILITY_MESSAGE,
PLAT_ECC_DIMM_SID_MESSAGE
} plat_ecc_message_type_t;
extern int plat_send_ecc_mailbox_msg(plat_ecc_message_type_t, void *);
extern int plat_make_fru_cpuid(int, int, int);
extern int plat_make_fru_boardnum(int);
extern void plat_ecc_init(void);
extern void plat_ecc_capability_sc_set(uint32_t cap);
extern int plat_ecc_capability_send(void);
extern int plat_max_cpumem_boards(void);
extern int parse_unum_memory(char *, int *, int *, int *, int *, int *);
extern int ecc_log_fruid_enable;
#define ECC_FRUID_ENABLE_DEFAULT 1
#define PLAT_ECC_JNUMBER_LENGTH 60
typedef struct plat_ecc_error_data {
uint8_t version;
uint8_t error_code;
uint16_t proc_num;
uint8_t bank_no;
uint8_t ecache_dimm_no;
uint8_t error_type;
uint8_t databit_type;
uint8_t databit_no;
uint8_t node_no;
uint16_t detecting_proc;
char Jnumber[60];
} plat_ecc_error_data_t;
#define PLAT_ECC_VERSION 3
#define PLAT_ERROR_CODE_UNK 0x0
#define PLAT_ERROR_CODE_CE 0x1
#define PLAT_ERROR_CODE_UE 0x2
#define PLAT_ERROR_CODE_EDC 0x3
#define PLAT_ERROR_CODE_EDU 0x4
#define PLAT_ERROR_CODE_WDC 0x5
#define PLAT_ERROR_CODE_WDU 0x6
#define PLAT_ERROR_CODE_CPC 0x7
#define PLAT_ERROR_CODE_CPU 0x8
#define PLAT_ERROR_CODE_UCC 0x9
#define PLAT_ERROR_CODE_UCU 0xa
#define PLAT_ERROR_CODE_EMC 0xb
#define PLAT_ERROR_CODE_EMU 0xc
#define PLAT_ERROR_TYPE_UNK 0x0
#define PLAT_ERROR_TYPE_SINGLE 0x1
#define PLAT_ERROR_TYPE_M2 0x2
#define PLAT_ERROR_TYPE_M3 0x3
#define PLAT_ERROR_TYPE_M4 0x4
#define PLAT_ERROR_TYPE_M 0x5
#define PLAT_BIT_TYPE_MULTI 0x0
#define PLAT_BIT_TYPE_MTAG_D 0x1
#define PLAT_BIT_TYPE_MTAG_E 0x2
#define PLAT_BIT_TYPE_ECC 0x3
#define PLAT_BIT_TYPE_DATA 0x4
#define ECC_SYND_DATA_BEGIN 0
#define ECC_SYND_DATA_LENGTH 128
#define ECC_SYND_ECC_BEGIN (ECC_SYND_DATA_BEGIN + ECC_SYND_DATA_LENGTH)
#define ECC_SYND_ECC_LENGTH 9
#define ECC_SYND_MTAG_BEGIN (ECC_SYND_ECC_BEGIN + ECC_SYND_ECC_LENGTH)
#define ECC_SYND_MTAG_LENGTH 3
#define ECC_SYND_MECC_BEGIN (ECC_SYND_MTAG_BEGIN + ECC_SYND_MTAG_LENGTH)
#define ECC_SYND_MECC_LENGTH 4
#define ECC_SYND_M2 144
#define ECC_SYND_M3 145
#define ECC_SYND_M4 146
#define ECC_SYND_M 147
enum plat_ecc_type {PLAT_ECC_UNKNOWN, PLAT_ECC_MEMORY, PLAT_ECC_ECACHE };
typedef struct plat_ecc_msg_hdr {
uint8_t emh_major_ver;
uint8_t emh_minor_ver;
uint16_t emh_msg_type;
uint16_t emh_msg_length;
uint16_t emh_future0;
} plat_ecc_msg_hdr_t;
extern uint16_t ecc_error2_mailbox_flags;
#define PLAT_ECC_ERROR2_SEND_L2_XXC 0x0001
#define PLAT_ECC_ERROR2_SEND_L2_XXU 0x0002
#define PLAT_ECC_ERROR2_SEND_L3_XXC 0x0004
#define PLAT_ECC_ERROR2_SEND_L3_XXU 0x0008
#define PLAT_ECC_ERROR2_SEND_MEM_ERRS 0x0010
#define PLAT_ECC_ERROR2_SEND_BUS_ERRS 0x0020
#define PLAT_ECC_ERROR2_SEND_L2_TAG_ERRS 0x0040
#define PLAT_ECC_ERROR2_SEND_L3_TAG_ERRS 0x0080
#define PLAT_ECC_ERROR2_SEND_L1_PARITY 0x0100
#define PLAT_ECC_ERROR2_SEND_TLB_PARITY 0x0200
#define PLAT_ECC_ERROR2_SEND_IV_ERRS 0x0400
#define PLAT_ECC_ERROR2_SEND_MTAG_XXC 0x0800
#define PLAT_ECC_ERROR2_SEND_IV_MTAG_XXC 0x1000
#define PLAT_ECC_ERROR2_SEND_PCACHE 0x2000
#define PLAT_ECC_ERROR2_SEND_DEFAULT 0x3fff
typedef struct plat_ecc_error2_data {
plat_ecc_msg_hdr_t ee2d_header;
uint8_t ee2d_type;
uint8_t ee2d_afar_status;
uint8_t ee2d_synd_status;
uint8_t ee2d_bank_number;
uint16_t ee2d_detecting_proc;
uint16_t ee2d_jnumber;
uint16_t ee2d_owning_proc;
uint16_t ee2d_future1;
uint32_t ee2d_cpu_impl;
uint64_t ee2d_afsr;
uint64_t ee2d_sdw_afsr;
uint64_t ee2d_afsr_ext;
uint64_t ee2d_sdw_afsr_ext;
uint64_t ee2d_afar;
uint64_t ee2d_sdw_afar;
uint64_t ee2d_timestamp;
} plat_ecc_error2_data_t;
#define ee2d_major_version ee2d_header.emh_major_ver
#define ee2d_minor_version ee2d_header.emh_minor_ver
#define ee2d_msg_type ee2d_header.emh_msg_type
#define ee2d_msg_length ee2d_header.emh_msg_length
#define PLAT_ECC_ERROR2_VERSION_MAJOR 1
#define PLAT_ECC_ERROR2_VERSION_MINOR 1
#define PLAT_ECC_ERROR2_NONE 0x00
#define PLAT_ECC_ERROR2_L2_CE 0x01
#define PLAT_ECC_ERROR2_L2_UE 0x02
#define PLAT_ECC_ERROR2_L3_CE 0x03
#define PLAT_ECC_ERROR2_L3_UE 0x04
#define PLAT_ECC_ERROR2_CE 0x05
#define PLAT_ECC_ERROR2_UE 0x06
#define PLAT_ECC_ERROR2_DUE 0x07
#define PLAT_ECC_ERROR2_TO 0x08
#define PLAT_ECC_ERROR2_BERR 0x09
#define PLAT_ECC_ERROR2_DTO 0x0a
#define PLAT_ECC_ERROR2_DBERR 0x0b
#define PLAT_ECC_ERROR2_L2_TSCE 0x0c
#define PLAT_ECC_ERROR2_L2_THCE 0x0d
#define PLAT_ECC_ERROR2_L3_TSCE 0x0e
#define PLAT_ECC_ERROR2_L3_THCE 0x0f
#define PLAT_ECC_ERROR2_DPE 0x10
#define PLAT_ECC_ERROR2_IPE 0x11
#define PLAT_ECC_ERROR2_ITLB 0x12
#define PLAT_ECC_ERROR2_DTLB 0x13
#define PLAT_ECC_ERROR2_IVU 0x14
#define PLAT_ECC_ERROR2_IVC 0x15
#define PLAT_ECC_ERROR2_EMC 0x16
#define PLAT_ECC_ERROR2_IMC 0x17
#define PLAT_ECC_ERROR2_L3_MECC 0x18
#define PLAT_ECC_ERROR2_PCACHE 0x19
#define PLAT_ECC_ERROR2_NUMVALS 0x1a
typedef struct plat_ecc_ch_async_flt {
int ecaf_synd_status;
int ecaf_afar_status;
uint64_t ecaf_sdw_afar;
uint64_t ecaf_sdw_afsr;
uint64_t ecaf_afsr_ext;
uint64_t ecaf_sdw_afsr_ext;
} plat_ecc_ch_async_flt_t;
extern uint8_t ecc_indictment_mailbox_disable;
#define PLAT_ECC_INDICTMENT_OK 0x00
#define PLAT_ECC_INDICTMENT_SUSPECT 0x01
#define PLAT_ECC_INDICTMENT_NO_SEND 0x02
extern uint8_t ecc_indictment_mailbox_flags;
#define PLAT_ECC_SEND_DIMM_INDICT 0x01
#define PLAT_ECC_SEND_ECACHE_XXC_INDICT 0x02
#define PLAT_ECC_SEND_ECACHE_XXU_INDICT 0x04
#define PLAT_ECC_SEND_DEFAULT_INDICT (PLAT_ECC_SEND_ECACHE_XXC_INDICT |\
PLAT_ECC_SEND_ECACHE_XXU_INDICT)
#define PLAT_ECC_INDICT_SIZE 128
typedef struct {
uint8_t version;
uint8_t indictment_type;
uint8_t indictment_uncertain;
uint8_t board_num;
uint16_t detecting_proc;
uint16_t syndrome;
uint16_t jnumber;
uint16_t future[7];
uint64_t afsr;
uint64_t afar;
char solaris_version[1];
} plat_ecc_indict_msg_contents_t;
typedef union {
plat_ecc_indict_msg_contents_t msg_contents;
uint8_t filler[PLAT_ECC_INDICT_SIZE];
} plat_ecc_indictment_data_t;
#define PLAT_ECC_VERSION_LENGTH (PLAT_ECC_INDICT_SIZE - \
offsetof(plat_ecc_indict_msg_contents_t, solaris_version))
#define PLAT_ECC_INDICTMENT_VERSION 1
#define PLAT_ECC_INDICT_NONE 0x00
#define PLAT_ECC_INDICT_DIMM 0x01
#define PLAT_ECC_INDICT_ECACHE_CORRECTABLES 0x02
#define PLAT_ECC_INDICT_ECACHE_UNCORRECTABLE 0x03
#define PLAT_ECC_NO_MSG_ACTIVE 0
#define PLAT_ECC_TASK_DISPATCHED 1
#define PLAT_ECC_MSG_SENT 2
#define PLAT_ECC_INTERRUPT_RECEIVED 3
#define PLAT_ECC_TASKQ_MIN 2
#define PLAT_ECC_TASKQ_MAX 8
extern uint16_t ecc_indictment2_mailbox_flags;
#define PLAT_ECC_SEND_INDICT2_L2_XXU 0x0001
#define PLAT_ECC_SEND_INDICT2_L2_XXC_SERD 0x0002
#define PLAT_ECC_SEND_INDICT2_L2_TAG_SERD 0x0004
#define PLAT_ECC_SEND_INDICT2_L3_XXU 0x0008
#define PLAT_ECC_SEND_INDICT2_L3_XXC_SERD 0x0010
#define PLAT_ECC_SEND_INDICT2_L3_TAG_SERD 0x0020
#define PLAT_ECC_SEND_INDICT2_L1_SERD 0x0040
#define PLAT_ECC_SEND_INDICT2_TLB_SERD 0x0080
#define PLAT_ECC_SEND_INDICT2_FPU 0x0100
#define PLAT_ECC_SEND_INDICT2_PCACHE_SERD 0x0200
#define PLAT_ECC_SEND_INDICT2_DEFAULT 0x03ff
typedef struct plat_ecc_indictment2_data {
plat_ecc_msg_hdr_t ei2d_header;
uint8_t ei2d_type;
uint8_t ei2d_uncertain;
uint8_t ei2d_board_num;
uint8_t ei2d_future1;
uint16_t ei2d_arraigned_proc;
uint16_t ei2d_jnumber;
uint32_t ei2d_cpu_impl;
uint32_t ei2d_future2;
uint64_t ei2d_timestamp;
} plat_ecc_indictment2_data_t;
#define ei2d_major_version ei2d_header.emh_major_ver
#define ei2d_minor_version ei2d_header.emh_minor_ver
#define ei2d_msg_type ei2d_header.emh_msg_type
#define ei2d_msg_length ei2d_header.emh_msg_length
#define PLAT_ECC_INDICT2_MAJOR_VERSION 1
#define PLAT_ECC_INDICT2_MINOR_VERSION 1
#define PLAT_ECC_INDICT2_NONE 0x00
#define PLAT_ECC_INDICT2_L2_UE 0x01
#define PLAT_ECC_INDICT2_L2_SERD 0x02
#define PLAT_ECC_INDICT2_L2_TAG_SERD 0x03
#define PLAT_ECC_INDICT2_L3_UE 0x04
#define PLAT_ECC_INDICT2_L3_SERD 0x05
#define PLAT_ECC_INDICT2_L3_TAG_SERD 0x06
#define PLAT_ECC_INDICT2_DCACHE_SERD 0x07
#define PLAT_ECC_INDICT2_ICACHE_SERD 0x08
#define PLAT_ECC_INDICT2_ITLB_SERD 0x09
#define PLAT_ECC_INDICT2_DTLB_SERD 0x0a
#define PLAT_ECC_INDICT2_FPU 0x0b
#define PLAT_ECC_INDICT2_PCACHE_SERD 0x0c
#define PLAT_ECC_INDICT2_NUMVALS 0x0d
typedef struct plat_ecc_bl_map {
char *ebm_reason;
int ebm_type;
} plat_ecc_bl_map_t;
typedef struct plat_capability_data {
plat_ecc_msg_hdr_t capd_header;
uint32_t capd_capability;
uint32_t capd_future1;
uint64_t capd_future2;
char capd_solaris_version[1];
} plat_capability_data_t;
#define capd_major_version capd_header.emh_major_ver
#define capd_minor_version capd_header.emh_minor_ver
#define capd_msg_type capd_header.emh_msg_type
#define capd_msg_length capd_header.emh_msg_length
#define PLAT_ECC_CAP_VERSION_MAJOR 1
#define PLAT_ECC_CAP_VERSION_MINOR 1
#define PLAT_ECC_CAPABILITY_ERROR 0x001
#define PLAT_ECC_CAPABILITY_INDICT 0x002
#define PLAT_ECC_CAPABILITY_ERROR2 0x004
#define PLAT_ECC_CAPABILITY_INDICT2 0x008
#define PLAT_ECC_CAPABILITY_FMA 0x010
#define PLAT_ECC_CAPABILITY_EREPORTS 0x020
#define PLAT_ECC_CAPABILITY_DIMM_SID 0x040
#define PLAT_ECC_CAPABILITY_DP_ERROR 0x080
#define PLAT_ECC_CAPABILITY_DP_FAULT 0x100
#define PLAT_ECC_CAPABILITY_DOMAIN_DEFAULT 0x1df
#define PLAT_ECC_CAPABILITY_SC_DEFAULT 0x003
extern uint32_t plat_ecc_capability_map_domain;
extern uint32_t plat_ecc_capability_map_sc;
typedef struct plat_ecc_message {
plat_ecc_message_type_t ecc_msg_type;
uint32_t ecc_msg_status;
uint32_t ecc_msg_ret;
uint32_t ecc_msg_len;
void * ecc_msg_data;
} plat_ecc_message_t;
#ifdef __cplusplus
}
#endif
#endif