ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ia64 / sn / ioerror_handling.h
1 /*
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
4  * for more details.
5  *
6  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
7  */
8 #ifndef _ASM_IA64_SN_IOERROR_HANDLING_H
9 #define _ASM_IA64_SN_IOERROR_HANDLING_H
10
11 #include <linux/types.h>
12 #include <asm/sn/sgi.h>
13
14 #ifdef __KERNEL__
15
16 /*
17  * Basic types required for io error handling interfaces.
18  */
19
20 /*
21  * Return code from the io error handling interfaces.
22  */
23
24 enum error_return_code_e {
25         /* Success */
26         ERROR_RETURN_CODE_SUCCESS,
27
28         /* Unknown failure */
29         ERROR_RETURN_CODE_GENERAL_FAILURE,
30
31         /* Nth error noticed while handling the first error */
32         ERROR_RETURN_CODE_NESTED_CALL,
33
34         /* State of the vertex is invalid */
35         ERROR_RETURN_CODE_INVALID_STATE,
36
37         /* Invalid action */
38         ERROR_RETURN_CODE_INVALID_ACTION,
39
40         /* Valid action but not cannot set it */
41         ERROR_RETURN_CODE_CANNOT_SET_ACTION,
42
43         /* Valid action but not possible for the current state */
44         ERROR_RETURN_CODE_CANNOT_PERFORM_ACTION,
45
46         /* Valid state but cannot change the state of the vertex to it */
47         ERROR_RETURN_CODE_CANNOT_SET_STATE,
48
49         /* ??? */
50         ERROR_RETURN_CODE_DUPLICATE,
51
52         /* Reached the root of the system critical graph */
53         ERROR_RETURN_CODE_SYS_CRITICAL_GRAPH_BEGIN,
54
55         /* Reached the leaf of the system critical graph */
56         ERROR_RETURN_CODE_SYS_CRITICAL_GRAPH_ADD,
57
58         /* Cannot shutdown the device in hw/sw */
59         ERROR_RETURN_CODE_SHUTDOWN_FAILED,
60
61         /* Cannot restart the device in hw/sw */
62         ERROR_RETURN_CODE_RESET_FAILED,
63
64         /* Cannot failover the io subsystem */
65         ERROR_RETURN_CODE_FAILOVER_FAILED,
66
67         /* No Jump Buffer exists */
68         ERROR_RETURN_CODE_NO_JUMP_BUFFER
69 };
70
71 typedef uint64_t  error_return_code_t;
72
73 /*
74  * State of the vertex during error handling.
75  */
76 enum error_state_e {
77         /* Ignore state */
78         ERROR_STATE_IGNORE,
79
80         /* Invalid state */
81         ERROR_STATE_NONE,
82
83         /* Trying to decipher the error bits */
84         ERROR_STATE_LOOKUP,
85
86         /* Trying to carryout the action decided upon after
87          * looking at the error bits 
88          */
89         ERROR_STATE_ACTION,
90
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.
94          */
95         ERROR_STATE_SHUTDOWN,
96
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.
101          */
102         ERROR_STATE_SHUTDOWN_IN_PROGRESS,
103
104         /* This is the state when there is absolutely no activity going
105          * on wrt device.
106          */
107         ERROR_STATE_SHUTDOWN_COMPLETE,
108         
109         /* This is the state when the device has issued a retry. */
110         ERROR_STATE_RETRY,
111
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.
115          */
116         ERROR_STATE_NORMAL
117         
118 };
119
120 typedef uint64_t  error_state_t;
121
122 /*
123  * Generic error classes. This is used to classify errors after looking
124  * at the error bits and helpful in deciding on the action.
125  */
126 enum error_class_e {
127         /* Unclassified error */
128         ERROR_CLASS_UNKNOWN,
129
130         /* LLP transmit error */
131         ERROR_CLASS_LLP_XMIT,
132
133         /* LLP receive error */
134         ERROR_CLASS_LLP_RECV,
135
136         /* Credit error */
137         ERROR_CLASS_CREDIT,
138
139         /* Timeout error */
140         ERROR_CLASS_TIMEOUT,
141
142         /* Access error */
143         ERROR_CLASS_ACCESS,
144
145         /* System coherency error */
146         ERROR_CLASS_SYS_COHERENCY,
147
148         /* Bad data error (ecc / parity etc) */
149         ERROR_CLASS_BAD_DATA,
150
151         /* Illegal request packet */
152         ERROR_CLASS_BAD_REQ_PKT,
153         
154         /* Illegal response packet */
155         ERROR_CLASS_BAD_RESP_PKT
156 };
157
158 #endif /* __KERNEL__ */
159 #endif /* _ASM_IA64_SN_IOERROR_HANDLING_H */