hermon_fm.h revision 9e39c5ba00a55fa05777cc94b148296af305e135
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_IB_ADAPTERS_HERMON_FM_H
#define _SYS_IB_ADAPTERS_HERMON_FM_H
/*
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* HCA FMA compile note.
*
* FMA_TEST is used for HCA function tests, and
* the macro can be on by changing Makefile.
*
* in case of DEBUG
* FMA_TEST is on
*
* in case of non-DEBUG (DEBUG is off)
* FMA_TEST is off
*/
/*
* HCA FM common data structure
*/
/*
* HCA FM Structure
* This structure is used to catch HCA HW errors.
*/
struct i_hca_fm {
};
/*
* HCA FM acc handle structure
* This structure is holding ddi_acc_handle_t and other members
* to deal with HCA PIO FM.
*/
struct i_hca_acc_handle {
};
/*
* HCA FM function test structure
* This structure can be used to test the basic fm function test for HCA.
* The test code is included if the FMA_TEST macro is defined.
*/
struct i_hca_fm_test {
int num; /* serial numner */
int type; /* PIO or Hermon specific errors */
#define HCA_TEST_PIO 0x1
#define HCA_TEST_IBA 0x2
int trigger; /* how to trigger a HW error */
#define HCA_TEST_TRANSIENT 0x0001
#define HCA_TEST_PERSISTENT 0x0002
#define HCA_TEST_ATTACH 0x0010
#define HCA_TEST_START 0x0100
#define HCA_TEST_END 0x0200
int errcnt; /* how many transient error occurs */
int line_num; /* line number in the source code */
char *file_name; /* source filename */
char *hash_key; /* hash table for test items */
void *private; /* private data */
};
/*
* Hermon FM data structure
*/
typedef struct i_hca_fm hermon_hca_fm_t;
typedef struct i_hca_acc_handle hermon_acc_handle_t;
typedef struct i_hca_fm_test hermon_test_t;
/*
* The following defines are to supplement device error reporting.
* At each place where the planned FMA error matrix specifies that
* an ereport will be generated, for now there is a HERMON_FMANOTE()
* call generating an appropriate message string.
*/
/* CQE Syndrome errors - see hermon_cq.c */
#define HERMON_FMA_LOCLEN "CQE local length error"
#define HERMON_FMA_LOCQPOP "CQE local qp operation error"
#define HERMON_FMA_LOCPROT "CQE local protection error"
#define HERMON_FMA_WQFLUSH "CQE wqe flushed in error"
#define HERMON_FMA_MWBIND "CQE memory window bind error"
#define HERMON_FMA_RESP "CQE bad response"
#define HERMON_FMA_LOCACC "CQE local access error"
#define HERMON_FMA_REMREQ "CQE remote invalid request error"
#define HERMON_FMA_REMACC "CQE remote access error"
#define HERMON_FMA_REMOP "CQE remote operation error"
#define HERMON_FMA_XPORTCNT "CQE transport retry counter exceeded"
#define HERMON_FMA_RNRCNT "CQE RNR retry counter exceeded"
#define HERMON_FMA_REMABRT "CQE remote aborted error"
#define HERMON_FMA_UNKN "CQE unknown/reserved error returned"
/* event errors - see hermon_event.c */
#define HERMON_FMA_OVERRUN "EQE cq overrun or protection error"
#define HERMON_FMA_LOCCAT "EQE local work queue catastrophic error"
#define HERMON_FMA_QPCAT "EQE local queue pair catastrophic error"
#define HERMON_FMA_PATHMIG "EQE path migration failed"
#define HERMON_FMA_LOCINV "EQE invalid request - local work queue"
#define HERMON_FMA_LOCACEQ "EQE local access violation"
#define HERMON_FMA_SRQCAT "EQE shared received queue catastrophic"
#define HERMON_FMA_INTERNAL "EQE hca internal error"
/* HCR device failure returns - see hermon_cmd.c */
#define HERMON_FMA_HCRINT "HCR internal error processing command"
#define HERMON_FMA_NVMEM "HCR NVRAM checksum/CRC failure"
#define HERMON_FMA_TOTOG "HCR Timeout waiting for command toggle"
#define HERMON_FMA_GOBIT "HCR Timeout waiting for command go bit"
#define HERMON_FMA_RSRC "HCR Command insufficient resources"
#define HERMON_FMA_CMDINV "HCR Command invalid status returned"
/* HCA initialization errors - see hermon.c */
#define HERMON_FMA_FWVER "HCA firmware not at minimum version"
#define HERMON_FMA_PCIID "HCA PCIe devid not supported"
#define HERMON_FMA_MAINT "HCA device set to memory controller mode"
#define HERMON_FMA_BADNVMEM "HCR bad NVMEM error"
/*
* HCA FM constants
*/
/* HCA FM state */
/* HCA FM state flags */
/* HCA ererport type */
/* HCA ereport detail */
/* Ignore HCA HW error check */
#define HCA_SKIP_HW_CHK (-1)
/* HCA FM pio retry operation state */
#define HCA_PIO_OK (0) /* No HW errors */
#define HCA_PIO_RETRY_CNT (3)
/*
* Hermon FM macros
*/
#ifdef FMA_TEST
#else
#define TEST_DECLARE(tst)
#endif /* FMA_TEST */
/*
* hermon_pio_init() is a macro initializing variables.
*/
TEST_DECLARE(tst) \
int status = HCA_PIO_OK; \
int cnt = HCA_PIO_RETRY_CNT
/*
* hermon_pio_start() is one of a pair of macros checking HW errors
* at PIO requests, which should be called before the requests are issued.
*/
if (st->hs_fm_async_fatal) { \
goto label; \
} else { \
cnt = HCA_PIO_RETRY_CNT; \
HCA_PIO_PERSISTENT) { \
goto label; \
} \
} \
} else { \
status = HCA_SKIP_HW_CHK; \
} \
do {
/*
* hermon_pio_end() is the other of a pair of macros checking HW errors
* at PIO requests, which should be called after the requests end.
* If a HW error is detected and can be isolated well, these macros
* retry the operation to determine if the error is persistent or not.
*/
if (status != HCA_SKIP_HW_CHK) { \
if (st->hs_fm_async_fatal) { \
goto label; \
} \
HCA_PIO_PERSISTENT) { \
goto label; \
} else if (status == HCA_PIO_TRANSIENT) { \
} \
} \
} while (status == HCA_PIO_TRANSIENT)
extern void hermon_fm_init(hermon_state_t *);
extern void hermon_fm_fini(hermon_state_t *);
extern int hermon_fm_ereport_init(hermon_state_t *);
extern void hermon_fm_ereport_fini(hermon_state_t *);
extern int hermon_get_state(hermon_state_t *);
extern void hermon_fm_ereport(hermon_state_t *, int, int);
hermon_test_t *);
hermon_test_t *);
extern void hermon_clr_state_nolock(hermon_state_t *, int);
extern void hermon_inter_err_chk(void *);
#ifdef FMA_TEST
extern void hermon_test_deregister(void);
extern int hermon_test_num;
#endif /* FMA_TEST */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_ADAPTERS_HERMON_FM_H */