1 |
1275 |
phoenix |
/* $Id: ioerror.h,v 1.1.1.1 2004-04-15 02:42:31 phoenix Exp $
|
2 |
|
|
*
|
3 |
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
4 |
|
|
* License. See the file "COPYING" in the main directory of this archive
|
5 |
|
|
* for more details.
|
6 |
|
|
*
|
7 |
|
|
* Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
|
8 |
|
|
*/
|
9 |
|
|
#ifndef _ASM_IA64_SN_IOERROR_H
|
10 |
|
|
#define _ASM_IA64_SN_IOERROR_H
|
11 |
|
|
|
12 |
|
|
#ifndef __ASSEMBLY__
|
13 |
|
|
|
14 |
|
|
#include <linux/types.h>
|
15 |
|
|
#include <asm/sn/types.h>
|
16 |
|
|
|
17 |
|
|
/*
|
18 |
|
|
* Macros defining the various Errors to be handled as part of
|
19 |
|
|
* IO Error handling.
|
20 |
|
|
*/
|
21 |
|
|
|
22 |
|
|
/*
|
23 |
|
|
* List of errors to be handled by each subsystem.
|
24 |
|
|
* "error_code" field will take one of these values.
|
25 |
|
|
* The error code is built up of single bits expressing
|
26 |
|
|
* our confidence that the error was that type; note
|
27 |
|
|
* that it is possible to have a PIO or DMA error where
|
28 |
|
|
* we don't know whether it was a READ or a WRITE, or
|
29 |
|
|
* even a READ or WRITE error that we're not sure whether
|
30 |
|
|
* to call a PIO or DMA.
|
31 |
|
|
*
|
32 |
|
|
* It is also possible to set both PIO and DMA, and possible
|
33 |
|
|
* to set both READ and WRITE; the first may be nonsensical
|
34 |
|
|
* but the second *could* be used to designate an access
|
35 |
|
|
* that is known to be a read-modify-write cycle. It is
|
36 |
|
|
* quite possible that nobody will ever use PIO|DMA or
|
37 |
|
|
* READ|WRITE ... but being flexible is good.
|
38 |
|
|
*/
|
39 |
|
|
#define IOECODE_UNSPEC 0
|
40 |
|
|
#define IOECODE_READ 1
|
41 |
|
|
#define IOECODE_WRITE 2
|
42 |
|
|
#define IOECODE_PIO 4
|
43 |
|
|
#define IOECODE_DMA 8
|
44 |
|
|
|
45 |
|
|
#define IOECODE_PIO_READ (IOECODE_PIO|IOECODE_READ)
|
46 |
|
|
#define IOECODE_PIO_WRITE (IOECODE_PIO|IOECODE_WRITE)
|
47 |
|
|
#define IOECODE_DMA_READ (IOECODE_DMA|IOECODE_READ)
|
48 |
|
|
#define IOECODE_DMA_WRITE (IOECODE_DMA|IOECODE_WRITE)
|
49 |
|
|
|
50 |
|
|
/* support older names, but try to move everything
|
51 |
|
|
* to using new names that identify which package
|
52 |
|
|
* controls their values ...
|
53 |
|
|
*/
|
54 |
|
|
#define PIO_READ_ERROR IOECODE_PIO_READ
|
55 |
|
|
#define PIO_WRITE_ERROR IOECODE_PIO_WRITE
|
56 |
|
|
#define DMA_READ_ERROR IOECODE_DMA_READ
|
57 |
|
|
#define DMA_WRITE_ERROR IOECODE_DMA_WRITE
|
58 |
|
|
|
59 |
|
|
/*
|
60 |
|
|
* List of error numbers returned by error handling sub-system.
|
61 |
|
|
*/
|
62 |
|
|
|
63 |
|
|
#define IOERROR_HANDLED 0 /* Error Properly handled. */
|
64 |
|
|
#define IOERROR_NODEV 0x1 /* No such device attached */
|
65 |
|
|
#define IOERROR_BADHANDLE 0x2 /* Received bad handle */
|
66 |
|
|
#define IOERROR_BADWIDGETNUM 0x3 /* Bad widget number */
|
67 |
|
|
#define IOERROR_BADERRORCODE 0x4 /* Bad error code passed in */
|
68 |
|
|
#define IOERROR_INVALIDADDR 0x5 /* Invalid address specified */
|
69 |
|
|
|
70 |
|
|
#define IOERROR_WIDGETLEVEL 0x6 /* Some failure at widget level */
|
71 |
|
|
#define IOERROR_XTALKLEVEL 0x7
|
72 |
|
|
|
73 |
|
|
#define IOERROR_HWGRAPH_LOOKUP 0x8 /* hwgraph lookup failed for path */
|
74 |
|
|
#define IOERROR_UNHANDLED 0x9 /* handler rejected error */
|
75 |
|
|
|
76 |
|
|
#define IOERROR_PANIC 0xA /* subsidiary handler has already
|
77 |
|
|
* started decode: continue error
|
78 |
|
|
* data dump, and panic from top
|
79 |
|
|
* caller in error chain.
|
80 |
|
|
*/
|
81 |
|
|
|
82 |
|
|
/*
|
83 |
|
|
* IO errors at the bus/device driver level
|
84 |
|
|
*/
|
85 |
|
|
|
86 |
|
|
#define IOERROR_DEV_NOTFOUND 0x10 /* Device matching bus addr not found */
|
87 |
|
|
#define IOERROR_DEV_SHUTDOWN 0x11 /* Device has been shutdown */
|
88 |
|
|
|
89 |
|
|
/*
|
90 |
|
|
* Type of address.
|
91 |
|
|
* Indicates the direction of transfer that caused the error.
|
92 |
|
|
*/
|
93 |
|
|
#define IOERROR_ADDR_PIO 1 /* Error Address generated due to PIO */
|
94 |
|
|
#define IOERROR_ADDR_DMA 2 /* Error address generated due to DMA */
|
95 |
|
|
|
96 |
|
|
/*
|
97 |
|
|
* IO error structure.
|
98 |
|
|
*
|
99 |
|
|
* This structure would expand to hold the information retrieved from
|
100 |
|
|
* all IO related error registers.
|
101 |
|
|
*
|
102 |
|
|
* This structure is defined to hold all system specific
|
103 |
|
|
* information related to a single error.
|
104 |
|
|
*
|
105 |
|
|
* This serves a couple of purpose.
|
106 |
|
|
* - Error handling often involves translating one form of address to other
|
107 |
|
|
* form. So, instead of having different data structures at each level,
|
108 |
|
|
* we have a single structure, and the appropriate fields get filled in
|
109 |
|
|
* at each layer.
|
110 |
|
|
* - This provides a way to dump all error related information in any layer
|
111 |
|
|
* of erorr handling (debugging aid).
|
112 |
|
|
*
|
113 |
|
|
* A second possibility is to allow each layer to define its own error
|
114 |
|
|
* data structure, and fill in the proper fields. This has the advantage
|
115 |
|
|
* of isolating the layers.
|
116 |
|
|
* A big concern is the potential stack usage (and overflow), if each layer
|
117 |
|
|
* defines these structures on stack (assuming we don't want to do kmalloc.
|
118 |
|
|
*
|
119 |
|
|
* Any layer wishing to pass extra information to a layer next to it in
|
120 |
|
|
* error handling hierarchy, can do so as a separate parameter.
|
121 |
|
|
*/
|
122 |
|
|
|
123 |
|
|
typedef struct io_error_s {
|
124 |
|
|
/* Bit fields indicating which structure fields are valid */
|
125 |
|
|
union {
|
126 |
|
|
struct {
|
127 |
|
|
unsigned ievb_errortype:1;
|
128 |
|
|
unsigned ievb_widgetnum:1;
|
129 |
|
|
unsigned ievb_widgetdev:1;
|
130 |
|
|
unsigned ievb_srccpu:1;
|
131 |
|
|
unsigned ievb_srcnode:1;
|
132 |
|
|
unsigned ievb_errnode:1;
|
133 |
|
|
unsigned ievb_sysioaddr:1;
|
134 |
|
|
unsigned ievb_xtalkaddr:1;
|
135 |
|
|
unsigned ievb_busspace:1;
|
136 |
|
|
unsigned ievb_busaddr:1;
|
137 |
|
|
unsigned ievb_vaddr:1;
|
138 |
|
|
unsigned ievb_memaddr:1;
|
139 |
|
|
unsigned ievb_epc:1;
|
140 |
|
|
unsigned ievb_ef:1;
|
141 |
|
|
unsigned ievb_tnum:1;
|
142 |
|
|
} iev_b;
|
143 |
|
|
unsigned iev_a;
|
144 |
|
|
} ie_v;
|
145 |
|
|
|
146 |
|
|
short ie_errortype; /* error type: extra info about error */
|
147 |
|
|
short ie_widgetnum; /* Widget number that's in error */
|
148 |
|
|
short ie_widgetdev; /* Device within widget in error */
|
149 |
|
|
cpuid_t ie_srccpu; /* CPU on srcnode generating error */
|
150 |
|
|
cnodeid_t ie_srcnode; /* Node which caused the error */
|
151 |
|
|
cnodeid_t ie_errnode; /* Node where error was noticed */
|
152 |
|
|
iopaddr_t ie_sysioaddr; /* Sys specific IO address */
|
153 |
|
|
iopaddr_t ie_xtalkaddr; /* Xtalk (48bit) addr of Error */
|
154 |
|
|
iopaddr_t ie_busspace; /* Bus specific address space */
|
155 |
|
|
iopaddr_t ie_busaddr; /* Bus specific address */
|
156 |
|
|
caddr_t ie_vaddr; /* Virtual address of error */
|
157 |
|
|
paddr_t ie_memaddr; /* Physical memory address */
|
158 |
|
|
caddr_t ie_epc; /* pc when error reported */
|
159 |
|
|
caddr_t ie_ef; /* eframe when error reported */
|
160 |
|
|
short ie_tnum; /* Xtalk TNUM field */
|
161 |
|
|
} ioerror_t;
|
162 |
|
|
|
163 |
|
|
#define IOERROR_INIT(e) do { (e)->ie_v.iev_a = 0; } while (0)
|
164 |
|
|
#define IOERROR_SETVALUE(e,f,v) do { (e)->ie_ ## f = (v); (e)->ie_v.iev_b.ievb_ ## f = 1; } while (0)
|
165 |
|
|
#define IOERROR_FIELDVALID(e,f) ((unsigned long long)((e)->ie_v.iev_b.ievb_ ## f) != (unsigned long long) 0)
|
166 |
|
|
#define IOERROR_NOGETVALUE(e,f) (ASSERT(IOERROR_FIELDVALID(e,f)), ((e)->ie_ ## f))
|
167 |
|
|
#define IOERROR_GETVALUE(p,e,f) ASSERT(IOERROR_FIELDVALID(e,f)); p=((e)->ie_ ## f)
|
168 |
|
|
|
169 |
|
|
/* hub code likes to call the SysAD address "hubaddr" ... */
|
170 |
|
|
#define ie_hubaddr ie_sysioaddr
|
171 |
|
|
#define ievb_hubaddr ievb_sysioaddr
|
172 |
|
|
#endif
|
173 |
|
|
|
174 |
|
|
/*
|
175 |
|
|
* Error handling Modes.
|
176 |
|
|
*/
|
177 |
|
|
typedef enum {
|
178 |
|
|
MODE_DEVPROBE, /* Probing mode. Errors not fatal */
|
179 |
|
|
MODE_DEVERROR, /* Error while system is running */
|
180 |
|
|
MODE_DEVUSERERROR, /* Device Error created due to user mode access */
|
181 |
|
|
MODE_DEVREENABLE /* Reenable pass */
|
182 |
|
|
} ioerror_mode_t;
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
typedef int error_handler_f(void *, int, ioerror_mode_t, ioerror_t *);
|
186 |
|
|
typedef void *error_handler_arg_t;
|
187 |
|
|
|
188 |
|
|
extern void snia_ioerror_dump(char *, int, int, ioerror_t *);
|
189 |
|
|
|
190 |
|
|
#ifdef ERROR_DEBUG
|
191 |
|
|
#define IOERROR_DUMP(x, y, z, t) snia_ioerror_dump((x), (y), (z), (t))
|
192 |
|
|
#define IOERR_PRINTF(x) (x)
|
193 |
|
|
#else
|
194 |
|
|
#define IOERROR_DUMP(x, y, z, t)
|
195 |
|
|
#define IOERR_PRINTF(x)
|
196 |
|
|
#endif /* ERROR_DEBUG */
|
197 |
|
|
|
198 |
|
|
#endif /* _ASM_IA64_SN_IOERROR_H */
|