mc-opl.h revision 0b240fcdeb4772e65fed050aee3e3dc63308ae72
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MC_OPL_H
#define _SYS_MC_OPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DEBUG
extern int oplmc_debug;
#else
#endif
#define MC_PATROL_INTERVAL_SEC 10
#define MC_POLL_EXIT 0x01
/*
*/
#define BANKNUM_PER_SB 8
typedef struct {
} cs_status_t;
typedef struct scf_log {
int sl_bank;
} scf_log_t;
/*
* Current max serial number size is 12, but keep enough room
* to accomodate any future changes.
*
* Current max part number size is 18 + 18(Sun's partnumber + FJ's partnumber),
* but keep enough room to accomodate any future changes.
*/
#define MCOPL_MAX_DIMMNAME 3
#define MCOPL_MAX_SERIAL 20
#define MCOPL_MAX_PARTNUM 44
typedef struct mc_dimm_info {
struct mc_dimm_info *md_next;
typedef struct mc_retry_info {
struct mc_retry_info *ri_next;
#define RETRY_STATE_PENDING 0
#define RETRY_STATE_ACTIVE 1
#define RETRY_STATE_REWRITE 2
int ri_state;
typedef struct mc_opl_state {
struct mc_opl_state *next;
#define MC_POLL_RUNNING 0x1
#define MC_MEMORYLESS 0x8
struct mc_bank {
#define BANK_INSTALLED 0x80000000
#define BANK_REWRITE_MODE 0x10000000
#define BANK_PTRL_RUNNING 0x00000001
#define MC_RETRY_COUNT 2
int mcb_rewrite_count;
int mc_scf_total[BANKNUM_PER_SB];
int mc_scf_retry[BANKNUM_PER_SB];
int mc_last_error;
/* number of times memory scanned */
int mc_tick_left;
} mc_opl_t;
typedef struct mc_addr {
int ma_bd; /* board number */
int ma_phys_bd; /* phyiscal board number */
int ma_bank; /* bank number */
} mc_addr_t;
typedef struct mc_rsaddr_info { /* patrol restart address/info */
struct mc_addr mi_restartaddr;
int mi_valid;
int mi_injectrestart;
typedef struct mc_flt_stat {
#define FLT_TYPE_INTERMITTENT_CE 0x0001
#define FLT_TYPE_PERMANENT_CE 0x0002
#define FLT_TYPE_UE 0x0003
#define FLT_TYPE_SUE 0x0004
#define FLT_TYPE_MUE 0x0005
#define FLT_TYPE_CMPE 0x0006
typedef struct mc_aflt {
char *mflt_erpt_class; /* ereport class name */
int mflt_is_ptrl; /* detected by PTRL or MI */
int mflt_nflts; /* 1 or 2 */
int mflt_pr; /* page retire flags */
} mc_aflt_t;
typedef struct mc_flt_page {
/* use PA[37:6] */
/*
* This is for changing MI_ERR_ADDR accuracy.
* Last two bits of PTRL_ERR_ADDR are always 0.
*/
#define ROUNDDOWN(a, n) (((a) & ~((n) - 1)))
#define MC_BOUND_BYTE 4
/*
* MAC_BANKm_PTRL_STAT_Register
*/
#define MAC_STAT_PTRL_CE 0x00000020
#define MAC_STAT_PTRL_UE 0x00000010
#define MAC_STAT_PTRL_CMPE 0x00000008
#define MAC_STAT_MI_CE 0x00000004
#define MAC_STAT_MI_UE 0x00000002
#define MAC_STAT_MI_CMPE 0x00000001
/*
* MAC_BANKm_PTRL_CTRL_Register
*/
#define MAC_CNTL_PTRL_START 0x80000000
#define MAC_CNTL_USE_RESTART_ADD 0x40000000
#define MAC_CNTL_PTRL_STOP 0x20000000
#define MAC_CNTL_PTRL_INTERVAL 0x1c000000
#define MAC_CNTL_PTRL_RESET 0x02000000
#define MAC_CNTL_PTRL_STATUS 0x01000000
#define MAC_CNTL_REW_REQ 0x00800000
#define MAC_CNTL_REW_RESET 0x00400000
#define MAC_CNTL_CS0_DEG_MODE 0x00200000
#define MAC_CNTL_PTRL_CE 0x00008000
#define MAC_CNTL_PTRL_UE 0x00004000
#define MAC_CNTL_PTRL_CMPE 0x00002000
#define MAC_CNTL_MI_CE 0x00001000
#define MAC_CNTL_MI_UE 0x00000800
#define MAC_CNTL_MI_CMPE 0x00000400
#define MAC_CNTL_REW_CE 0x00000200
#define MAC_CNTL_REW_UE 0x00000100
#define MAC_CNTL_REW_END 0x00000080
#define MAC_CNTL_PTRL_ADD_MAX 0x00000040
#define MAC_CNTL_REW_CMPE 0x00000020
#define MAC_CNTL_PTRL_ERR_SHIFT 13
#define MAC_CNTL_MI_ERR_SHIFT 10
#define MAC_CNTL_ALL_ERRS (MAC_CNTL_PTRL_ERRS|\
#define MAC_ERRLOG_SYND_SHIFT 16
#define MAC_ERRLOG_SYND_MASK 0xffff
#define MAC_ERRLOG_DIMMSLOT_SHIFT 13
#define MAC_ERRLOG_DIMMSLOT_MASK 0x7
#define MAC_ERRLOG_DRAM_PLACE_SHIFT 8
#define MAC_ERRLOG_DRAM_PLACE_MASK 0x1f
#define MAC_SET_ERRLOG_INFO(flt_stat) \
& MAC_CNTL_PTRL_START)) \
#define MAC_CLEAR_MAX(mcp, i) \
/*
*/
#define MAC_ERR_ADD_INVALID 0x80000000
#define MAC_ERR_LOG_INVALID 0x00000080
/*
* MAC_BANKm_STATIC_ERR_ADD_Register
*/
#define MAC_STATIC_ERR_VLD 0x80000000
/*
* MAC_BANKm_MIRR_Register
*/
#define MAC_MIRR_MIRROR_MODE 0x80000000
#define MAC_MIRR_BANK_EXCLUSIVE 0x40000000
#define OPL_BOARD_MAX 16
#define OPL_BANK_MAX 8
/*
* MAC_BANKm_EG_ADD_Register
*/
#define MAC_EG_ADD_MASK 0x7ffffffc
/*
* To set the EG_CNTL register, bit[26-25] and
* bit[21-20] must be cleared. Then the other
* control bit should be set. Then the bit[26-25]
* and bit[21-20] should be set while other bits
* should be the same as before.
*/
#define MAC_EG_CNTL_MASK 0x06300000
#define MAC_EG_ADD_FIX 0x80000000
#define MAC_EG_FORCE_DERR00 0x40000000
#define MAC_EG_FORCE_DERR16 0x20000000
#define MAC_EG_FORCE_DERR64 0x10000000
#define MAC_EG_FORCE_DERR80 0x08000000
#define MAC_EG_DERR_ALWAYS 0x02000000
#define MAC_EG_DERR_ONCE 0x04000000
#define MAC_EG_DERR_NOP 0x06000000
#define MAC_EG_FORCE_READ00 0x00800000
#define MAC_EG_FORCE_READ16 0x00400000
#define MAC_EG_RDERR_ALWAYS 0x00100000
#define MAC_EG_RDERR_ONCE 0x00200000
#define MAC_EG_RDERR_NOP 0x00300000
#define MAC_EG_SETUP_MASK 0xf9cfffff
/* For MAC-PA translation */
#define MC_ADDRESS_BITS 40
#define PA_BITS_FOR_MAC 39
#define INDEX_OF_BANK_SUPPLEMENT_BIT 39
#define MP_NONE 128
#define MP_BANK_0 129
#define MP_BANK_1 130
#define MP_BANK_2 131
#define CS_SHIFT 29
#define MC_TT_ENTRIES 64
#define MC_TT_CS 2
/* export interface for error injection */
#define MC_INJECT_NOP 0x0
#define MC_INJECT_INTERMITTENT_CE 0x1
#define MC_INJECT_PERMANENT_CE 0x2
#define MC_INJECT_UE 0x3
#define MC_INJECT_INTERMITTENT_MCE 0x11
#define MC_INJECT_PERMANENT_MCE 0x12
#define MC_INJECT_SUE 0x13
#define MC_INJECT_MUE 0x14
#define MC_INJECT_CMPE 0x15
#define MC_INJECT_MIRROR_MODE 0x10
#define MC_INJECT_MIRROR(x) (x & MC_INJECT_MIRROR_MODE)
#define MC_INJECT_FLAG_PREFETCH 0x1
#define MC_INJECT_FLAG_RESTART 0x2
#define MC_INJECT_FLAG_POLL 0x4
#define MC_INJECT_FLAG_RESET 0x8
#define MC_INJECT_FLAG_OTHER 0x10
#define MC_INJECT_FLAG_LD 0x20
#define MC_INJECT_FLAG_ST 0x40
#define MC_INJECT_FLAG_PATH 0x80
#ifdef DEBUG
#define MCI_NOP 0x0
#define MCI_CE 0x1
#define MCI_PERM_CE 0x2
#define MCI_UE 0x3
#define MCI_SHOW_ALL 0x4
#define MCI_SHOW_NONE 0x5
#define MCI_CMP 0x6
#define MCI_ALLOC 0x7
#define MCI_M_CE 0x8
#define MCI_M_PCE 0x9
#define MCI_M_UE 0xA
#define MCI_SUSPEND 0xB
#define MCI_RESUME 0xC
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MC_OPL_H */