1 /* $Id: ioerror.h,v 1.1.1.1 2005/04/11 02:50:52 jack Exp $
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
7 * Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
9 #ifndef _ASM_IA64_SN_IOERROR_H
10 #define _ASM_IA64_SN_IOERROR_H
14 #include <linux/types.h>
15 #include <asm/sn/types.h>
18 * Macros defining the various Errors to be handled as part of
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.
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.
39 #define IOECODE_UNSPEC 0
40 #define IOECODE_READ 1
41 #define IOECODE_WRITE 2
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)
50 /* support older names, but try to move everything
51 * to using new names that identify which package
52 * controls their values ...
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
60 * List of error numbers returned by error handling sub-system.
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 */
70 #define IOERROR_WIDGETLEVEL 0x6 /* Some failure at widget level */
71 #define IOERROR_XTALKLEVEL 0x7
73 #define IOERROR_HWGRAPH_LOOKUP 0x8 /* hwgraph lookup failed for path */
74 #define IOERROR_UNHANDLED 0x9 /* handler rejected error */
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.
83 * IO errors at the bus/device driver level
86 #define IOERROR_DEV_NOTFOUND 0x10 /* Device matching bus addr not found */
87 #define IOERROR_DEV_SHUTDOWN 0x11 /* Device has been shutdown */
91 * Indicates the direction of transfer that caused the error.
93 #define IOERROR_ADDR_PIO 1 /* Error Address generated due to PIO */
94 #define IOERROR_ADDR_DMA 2 /* Error address generated due to DMA */
99 * This structure would expand to hold the information retrieved from
100 * all IO related error registers.
102 * This structure is defined to hold all system specific
103 * information related to a single error.
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
110 * - This provides a way to dump all error related information in any layer
111 * of erorr handling (debugging aid).
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.
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.
123 typedef struct io_error_s {
124 /* Bit fields indicating which sturcture fields are valid */
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;
145 short ie_errortype; /* error type: extra info about error */
146 short ie_widgetnum; /* Widget number that's in error */
147 short ie_widgetdev; /* Device within widget in error */
148 cpuid_t ie_srccpu; /* CPU on srcnode generating error */
149 cnodeid_t ie_srcnode; /* Node which caused the error */
150 cnodeid_t ie_errnode; /* Node where error was noticed */
151 iopaddr_t ie_sysioaddr; /* Sys specific IO address */
152 iopaddr_t ie_xtalkaddr; /* Xtalk (48bit) addr of Error */
153 iopaddr_t ie_busspace; /* Bus specific address space */
154 iopaddr_t ie_busaddr; /* Bus specific address */
155 caddr_t ie_vaddr; /* Virtual address of error */
156 paddr_t ie_memaddr; /* Physical memory address */
157 caddr_t ie_epc; /* pc when error reported */
158 caddr_t ie_ef; /* eframe when error reported */
162 #define IOERROR_INIT(e) do { (e)->ie_v.iev_a = 0; } while (0)
163 #define IOERROR_SETVALUE(e,f,v) do { (e)->ie_ ## f = (v); (e)->ie_v.iev_b.ievb_ ## f = 1; } while (0)
164 #define IOERROR_FIELDVALID(e,f) (((e)->ie_v.iev_b.ievb_ ## f) != 0)
165 #define IOERROR_GETVALUE(e,f) (ASSERT(IOERROR_FIELDVALID(e,f)),((e)->ie_ ## f))
167 /* hub code likes to call the SysAD address "hubaddr" ... */
168 #define ie_hubaddr ie_sysioaddr
169 #define ievb_hubaddr ievb_sysioaddr
173 * Error handling Modes.
176 MODE_DEVPROBE, /* Probing mode. Errors not fatal */
177 MODE_DEVERROR, /* Error while system is running */
178 MODE_DEVUSERERROR, /* Device Error created due to user mode access */
179 MODE_DEVREENABLE /* Reenable pass */
183 typedef int error_handler_f(void *, int, ioerror_mode_t, ioerror_t *);
184 typedef void *error_handler_arg_t;
186 extern void ioerror_dump(char *, int, int, ioerror_t *);
189 #define IOERROR_DUMP(x, y, z, t) ioerror_dump((x), (y), (z), (t))
190 #define IOERR_PRINTF(x) (x)
192 #define IOERROR_DUMP(x, y, z, t)
193 #define IOERR_PRINTF(x)
194 #endif /* ERROR_DEBUG */
196 #endif /* _ASM_IA64_SN_IOERROR_H */