diff options
author | linas <linas@austin.ibm.com> | 2005-11-16 18:10:41 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-09 15:13:21 -0500 |
commit | 392a1ce761bc3b3a5d642ee341c1ff082cbb71f0 (patch) | |
tree | 3b8028ae26e668d330e7f2d0559036fcc9ea2a34 /include | |
parent | 19272684b8e2fff39941e4c044d26ad349dd1a69 (diff) |
[PATCH] PCI Error Recovery: header file patch
Various PCI bus errors can be signaled by newer PCI controllers.
Recovering from those errors requires an infrastructure to notify
affected device drivers of the error, and a way of walking through a
reset sequence. This patch adds a set of callbacks to be used by error
recovery routines to notify device drivers of the various stages of
recovery.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pci.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index d0e003926744..0a44072383ec 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -78,6 +78,23 @@ typedef int __bitwise pci_power_t; | |||
78 | #define PCI_UNKNOWN ((pci_power_t __force) 5) | 78 | #define PCI_UNKNOWN ((pci_power_t __force) 5) |
79 | #define PCI_POWER_ERROR ((pci_power_t __force) -1) | 79 | #define PCI_POWER_ERROR ((pci_power_t __force) -1) |
80 | 80 | ||
81 | /** The pci_channel state describes connectivity between the CPU and | ||
82 | * the pci device. If some PCI bus between here and the pci device | ||
83 | * has crashed or locked up, this info is reflected here. | ||
84 | */ | ||
85 | typedef unsigned int __bitwise pci_channel_state_t; | ||
86 | |||
87 | enum pci_channel_state { | ||
88 | /* I/O channel is in normal state */ | ||
89 | pci_channel_io_normal = (__force pci_channel_state_t) 1, | ||
90 | |||
91 | /* I/O to channel is blocked */ | ||
92 | pci_channel_io_frozen = (__force pci_channel_state_t) 2, | ||
93 | |||
94 | /* PCI card is dead */ | ||
95 | pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, | ||
96 | }; | ||
97 | |||
81 | /* | 98 | /* |
82 | * The pci_dev structure is used to describe PCI devices. | 99 | * The pci_dev structure is used to describe PCI devices. |
83 | */ | 100 | */ |
@@ -111,6 +128,7 @@ struct pci_dev { | |||
111 | this is D0-D3, D0 being fully functional, | 128 | this is D0-D3, D0 being fully functional, |
112 | and D3 being off. */ | 129 | and D3 being off. */ |
113 | 130 | ||
131 | pci_channel_state_t error_state; /* current connectivity state */ | ||
114 | struct device dev; /* Generic device interface */ | 132 | struct device dev; /* Generic device interface */ |
115 | 133 | ||
116 | /* device is compatible with these IDs */ | 134 | /* device is compatible with these IDs */ |
@@ -233,6 +251,54 @@ struct pci_dynids { | |||
233 | unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ | 251 | unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ |
234 | }; | 252 | }; |
235 | 253 | ||
254 | /* ---------------------------------------------------------------- */ | ||
255 | /** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides | ||
256 | * a set fof callbacks in struct pci_error_handlers, then that device driver | ||
257 | * will be notified of PCI bus errors, and will be driven to recovery | ||
258 | * when an error occurs. | ||
259 | */ | ||
260 | |||
261 | typedef unsigned int __bitwise pci_ers_result_t; | ||
262 | |||
263 | enum pci_ers_result { | ||
264 | /* no result/none/not supported in device driver */ | ||
265 | PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1, | ||
266 | |||
267 | /* Device driver can recover without slot reset */ | ||
268 | PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2, | ||
269 | |||
270 | /* Device driver wants slot to be reset. */ | ||
271 | PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3, | ||
272 | |||
273 | /* Device has completely failed, is unrecoverable */ | ||
274 | PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4, | ||
275 | |||
276 | /* Device driver is fully recovered and operational */ | ||
277 | PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5, | ||
278 | }; | ||
279 | |||
280 | /* PCI bus error event callbacks */ | ||
281 | struct pci_error_handlers | ||
282 | { | ||
283 | /* PCI bus error detected on this device */ | ||
284 | pci_ers_result_t (*error_detected)(struct pci_dev *dev, | ||
285 | enum pci_channel_state error); | ||
286 | |||
287 | /* MMIO has been re-enabled, but not DMA */ | ||
288 | pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); | ||
289 | |||
290 | /* PCI Express link has been reset */ | ||
291 | pci_ers_result_t (*link_reset)(struct pci_dev *dev); | ||
292 | |||
293 | /* PCI slot has been reset */ | ||
294 | pci_ers_result_t (*slot_reset)(struct pci_dev *dev); | ||
295 | |||
296 | /* Device driver may resume normal operations */ | ||
297 | void (*resume)(struct pci_dev *dev); | ||
298 | }; | ||
299 | |||
300 | /* ---------------------------------------------------------------- */ | ||
301 | |||
236 | struct module; | 302 | struct module; |
237 | struct pci_driver { | 303 | struct pci_driver { |
238 | struct list_head node; | 304 | struct list_head node; |
@@ -245,6 +311,7 @@ struct pci_driver { | |||
245 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ | 311 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ |
246 | void (*shutdown) (struct pci_dev *dev); | 312 | void (*shutdown) (struct pci_dev *dev); |
247 | 313 | ||
314 | struct pci_error_handlers *err_handler; | ||
248 | struct device_driver driver; | 315 | struct device_driver driver; |
249 | struct pci_dynids dynids; | 316 | struct pci_dynids dynids; |
250 | }; | 317 | }; |