2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
8 #ifndef _ASM_IA64_SN_IOERROR_HANDLING_H
9 #define _ASM_IA64_SN_IOERROR_HANDLING_H
11 #include <linux/types.h>
12 #include <asm/sn/sgi.h>
17 * Basic types required for io error handling interfaces.
21 * Return code from the io error handling interfaces.
24 enum error_return_code_e {
26 ERROR_RETURN_CODE_SUCCESS,
29 ERROR_RETURN_CODE_GENERAL_FAILURE,
31 /* Nth error noticed while handling the first error */
32 ERROR_RETURN_CODE_NESTED_CALL,
34 /* State of the vertex is invalid */
35 ERROR_RETURN_CODE_INVALID_STATE,
38 ERROR_RETURN_CODE_INVALID_ACTION,
40 /* Valid action but not cannot set it */
41 ERROR_RETURN_CODE_CANNOT_SET_ACTION,
43 /* Valid action but not possible for the current state */
44 ERROR_RETURN_CODE_CANNOT_PERFORM_ACTION,
46 /* Valid state but cannot change the state of the vertex to it */
47 ERROR_RETURN_CODE_CANNOT_SET_STATE,
50 ERROR_RETURN_CODE_DUPLICATE,
52 /* Reached the root of the system critical graph */
53 ERROR_RETURN_CODE_SYS_CRITICAL_GRAPH_BEGIN,
55 /* Reached the leaf of the system critical graph */
56 ERROR_RETURN_CODE_SYS_CRITICAL_GRAPH_ADD,
58 /* Cannot shutdown the device in hw/sw */
59 ERROR_RETURN_CODE_SHUTDOWN_FAILED,
61 /* Cannot restart the device in hw/sw */
62 ERROR_RETURN_CODE_RESET_FAILED,
64 /* Cannot failover the io subsystem */
65 ERROR_RETURN_CODE_FAILOVER_FAILED,
67 /* No Jump Buffer exists */
68 ERROR_RETURN_CODE_NO_JUMP_BUFFER
71 typedef uint64_t error_return_code_t;
74 * State of the vertex during error handling.
83 /* Trying to decipher the error bits */
86 /* Trying to carryout the action decided upon after
87 * looking at the error bits
91 /* Donot allow any other operations to this vertex from
92 * other parts of the kernel. This is also used to indicate
93 * that the device has been software shutdown.
97 /* This is a transitory state when no new requests are accepted
98 * on behalf of the device. This is usually used when trying to
99 * quiesce all the outstanding operations and preparing the
100 * device for a failover / shutdown etc.
102 ERROR_STATE_SHUTDOWN_IN_PROGRESS,
104 /* This is the state when there is absolutely no activity going
107 ERROR_STATE_SHUTDOWN_COMPLETE,
109 /* This is the state when the device has issued a retry. */
112 /* This is the normal state. This can also be used to indicate
113 * that the device has been software-enabled after software-
114 * shutting down previously.
120 typedef uint64_t error_state_t;
123 * Generic error classes. This is used to classify errors after looking
124 * at the error bits and helpful in deciding on the action.
127 /* Unclassified error */
130 /* LLP transmit error */
131 ERROR_CLASS_LLP_XMIT,
133 /* LLP receive error */
134 ERROR_CLASS_LLP_RECV,
145 /* System coherency error */
146 ERROR_CLASS_SYS_COHERENCY,
148 /* Bad data error (ecc / parity etc) */
149 ERROR_CLASS_BAD_DATA,
151 /* Illegal request packet */
152 ERROR_CLASS_BAD_REQ_PKT,
154 /* Illegal response packet */
155 ERROR_CLASS_BAD_RESP_PKT
158 typedef uint64_t error_class_t;
162 * Error context which the error action can use.
164 typedef void *error_context_t;
165 #define ERROR_CONTEXT_IGNORE ((error_context_t)-1ll)
171 typedef error_return_code_t (*error_action_f)( error_context_t);
172 #define ERROR_ACTION_IGNORE ((error_action_f)-1ll)
174 /* Typical set of error actions */
175 typedef struct error_action_set_s {
176 error_action_f eas_panic;
177 error_action_f eas_shutdown;
178 error_action_f eas_abort;
179 error_action_f eas_retry;
180 error_action_f eas_failover;
181 error_action_f eas_log_n_ignore;
182 error_action_f eas_reset;
183 } error_action_set_t;
186 /* Set of priorites for in case mutliple error actions/states
187 * are trying to be prescribed for a device.
188 * NOTE : The ordering below encapsulates the priorities. Highest value
189 * corresponds to highest priority.
191 enum error_priority_e {
192 ERROR_PRIORITY_IGNORE,
194 ERROR_PRIORITY_NORMAL,
196 ERROR_PRIORITY_FAILOVER,
197 ERROR_PRIORITY_RETRY,
198 ERROR_PRIORITY_ABORT,
199 ERROR_PRIORITY_SHUTDOWN,
200 ERROR_PRIORITY_RESTART,
204 typedef uint64_t error_priority_t;
206 /* Error action interfaces */
208 extern error_return_code_t error_action_set(vertex_hdl_t,
212 extern error_return_code_t error_action_perform(vertex_hdl_t);
215 #define INFO_LBL_ERROR_SKIP_ENV "error_skip_env"
217 #define v_error_skip_env_get(v, l) \
218 hwgraph_info_get_LBL(v, INFO_LBL_ERROR_SKIP_ENV, (arbitrary_info_t *)&l)
220 #define v_error_skip_env_set(v, l, r) \
222 hwgraph_info_replace_LBL(v, INFO_LBL_ERROR_SKIP_ENV, (arbitrary_info_t)l,0) :\
223 hwgraph_info_add_LBL(v, INFO_LBL_ERROR_SKIP_ENV, (arbitrary_info_t)l))
225 #define v_error_skip_env_clear(v) \
226 hwgraph_info_remove_LBL(v, INFO_LBL_ERROR_SKIP_ENV, 0)
228 typedef uint64_t counter_t;
230 extern counter_t error_retry_count_get(vertex_hdl_t);
231 extern error_return_code_t error_retry_count_set(vertex_hdl_t,counter_t);
232 extern counter_t error_retry_count_increment(vertex_hdl_t);
233 extern counter_t error_retry_count_decrement(vertex_hdl_t);
235 /* Except for the PIO Read error typically the other errors are handled in
236 * the context of an asynchronous error interrupt.
238 #define IS_ERROR_INTR_CONTEXT(_ec) ((_ec & IOECODE_DMA) || \
239 (_ec == IOECODE_PIO_WRITE))
241 #endif /* __KERNEL__ */
242 #endif /* _ASM_IA64_SN_IOERROR_HANDLING_H */