/**     errhand_defs.h
 **
 ** Author: Ted Schmitz
 ** Date of original creation december 8, 2008
 **
 **     The definitions in this file use to be part of "errhand.h" but were
 ** removed and placed in this file so the assembly language code could include
 ** the same definitions as the "C" code.  Assembly language source code does not 
 ** like including "C" structures, etc. in the source code.  
 **
 ** Only static definitions may be defined in this file.  All other structures, 
 ** enumerations, etc., should be defined in "errhand.h".  
 **
 ** This file contains many of the references used by the error handler and 
 ** the tests to communicate with the error handler.
 **
 ** This file can be included by itself, but it is also automatically included
 ** by "errhand.h".
 **
 **/

/**     The following symbols define the actions available when an error
 ** is detected.  These actions are also used to instruct the individual
 ** subtests what to do when a failure is detected as follows:
 **
 ** STOP_ON_ERROR = Exit the subtest and terminate the "Start" command.
 ** CONT_ON_ERROR = Log every failure encountered, but ignore failure and
 **                 continue testing.
 ** RESTART_ON_ERROR = Exit the current subtest and continue testing from the
 **		       first selected subtest if all execution loops have
 **                    not been completed.
 ** SKIP_ON_ERROR = Exit the current subtest and continue with the next
 **                 selected subtest.
 **/
#define STOP_ON_ERROR 0                 /* stop on error mode value */
#define CONT_ON_ERROR 1                 /* continue on error mode value */
#define RESTART_ON_ERROR 2              /* start testing over on 1st fail */
#define SKIP_ON_ERROR 3                 /* skip to next selected test on fail */
#define GTNF_ON_ERROR 4                 /* go to normal firmware on fail */

/**	The following symbols define all the possible severity levels that
 ** can be defined in the "severity" element of the "errhand_info"
 ** structure.
 **/
#define SLEVEL_WARN 0			/* anomaly detected but hw may still 
                                   func */
#define SLEVEL_FATAL 1			/* fatal hw malfunction detected */
#define SLEVEL_INFO 2			/* information only to be displayed */
/* end of severity level symbols */

/**
 **    The following symbols define how many bytes should be displayed from
 ** the expected and received data elements in the error handler information
 ** structure.
 **/
#define DISP_SIZE_1B 0                  /* character data (1 byte elements) */
#define DISP_SIZE_2B 1                  /* 2 byte elements */
#define DISP_SIZE_4B 2                  /* long data (4 byte elements) */
#define DISP_SIZE_8B 3                  /* double (two 4-byte elements) */
#define DISP_SIZE_12B 4                 /* tripple (three 4-byte elements) */
#define DISP_SIZE_16B 5                 /* quad (four 4-byte elements) */

/**   The following symbols define flag bits for each piece of error 
 ** information that can accompany a call to the error handler when a 
 ** test fails.  The flags are then used by various functions to determine
 ** what error information is available for storage, or display, etc.
 **
 **             error_stop        Severity   data_rec   disp_size   fru_list
 ** call_type        | sup_error_stop | data_exp | fail_adrs | void_ptr |
 **|EH_INFO_ONLY   |   |            | X |      |   |       |   |   X  |   |
 **|EH_WARNING     | X |     X      | X |  X   | X |   X   | X |      |   |
 **|EH_FAIL        | X |     X      | X |  X   | X |   X   | X |      | X |
 **|EH_FAIL_USR_MSG| X |     X      | X |      |   |       |   |   X  | X |
 **|EH_FAIL_EXP_REC| X |     X      | X |  X   | X |       | X |      | X |
 **|EH_ERR_CODE_FRU| X |     X      | X |      |   |       |   |      | X |
 **|EH_DATA_ADRS_MSG_FRU...
 **|            ...| X |     X      | X |  X   | X |   X   | X |   X  | X |
 **
 ** The bits are arranged as follows:
 ** BIT Description
 **  0  Error stop & Supplimantal error stop are available
 **  1  Address in error available
 **  2  Data expected, data received, & data size available
 **  3  FRU list available
 **  4  Void pointer to user message is available
 **  5  There is no test number associated with this failure
 **31-6 Reserved for future use
 **/
#define EI_ERROR_CODE_AVAIL   0x00000001
#define EI_ERR_ADRS_AVAIL     0x00000002
#define EI_EXP_REC_DATA_AVAIL 0x00000004
#define EI_FRU_LIST_AVAIL     0x00000008
#define EI_USR_MSG_AVAIL      0x00000010
#define EI_NO_ASSOC_TN_AVAIL  0x00000020

/**	The following symbols define all the possible values that can be used
 ** in the "call_type" element in the "errhand_info" structure defined in
 ** file "errhand.h".
 **/
/* Reporting information only.  No error detected at this time. */
#define EH_INFO_ONLY EI_USR_MSG_AVAIL

/* A malfunction has been detected but it is not fatal.  Hardware may be 
operational. */
#define EH_WARNING (EI_ERROR_CODE_AVAIL | EI_ERR_ADRS_AVAIL | \
                    EI_EXP_REC_DATA_AVAIL)

/* A malfunction has been detected.  Display  error information. */
#define EH_FAIL (EI_ERROR_CODE_AVAIL | EI_ERR_ADRS_AVAIL \
                 | EI_EXP_REC_DATA_AVAIL | EI_FRU_LIST_AVAIL)

/* A malfunction has been detected.  Display user supplied error message. */
#define EH_FAIL_USR_MSG (EI_ERROR_CODE_AVAIL |  EI_FRU_LIST_AVAIL | \
                         EI_USR_MSG_AVAIL)

/* A malfunction has been detected.  Display expected & received data, 
but no failing address. */
#define EH_FAIL_EXP_REC (EI_ERROR_CODE_AVAIL | EI_EXP_REC_DATA_AVAIL | \
                         EI_FRU_LIST_AVAIL)

/* Only an error code and a fru list are available.  No fail adrs or 
expected and received data is avail */
#define EH_ERR_CODE_FRU (EI_ERROR_CODE_AVAIL | EI_FRU_LIST_AVAIL)

/* all fields are available include user defined msg */
#define EH_DATA_ADRS_MSG_FRU (EI_ERROR_CODE_AVAIL | EI_ERR_ADRS_AVAIL |\
                              EI_EXP_REC_DATA_AVAIL | EI_FRU_LIST_AVAIL | \
                              EI_USR_MSG_AVAIL)

/* Error code, fail adrs, FRU list & usr msg avail */
#define EH_EC_ADRS_MSG_FRU (EI_ERROR_CODE_AVAIL | EI_ERR_ADRS_AVAIL |\
                            EI_FRU_LIST_AVAIL | EI_USR_MSG_AVAIL)

/* Error code, fail adrs, FRU list & usr msg avail */
#define EH_EC_ADRS_MSG_FRU_NTN (EI_ERROR_CODE_AVAIL | EI_ERR_ADRS_AVAIL |\
                                EI_FRU_LIST_AVAIL | EI_USR_MSG_AVAIL |  \
                                EI_NO_ASSOC_TN_AVAIL)

/* Error code, fail adrs, exp & received data &  FRU list avail */
#define EH_EC_ADRS_FRU_NTN (EI_ERROR_CODE_AVAIL | EI_ERR_ADRS_AVAIL |\
                            EI_EXP_REC_DATA_AVAIL | EI_FRU_LIST_AVAIL |\
                            EI_NO_ASSOC_TN_AVAIL)

/* end of "call_type" symbols */
