diff options
Diffstat (limited to 'arch/powerpc/include/asm/eeh.h')
-rw-r--r-- | arch/powerpc/include/asm/eeh.h | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index fab7743c2640..9983c3d26bca 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/atomic.h> | ||
28 | 29 | ||
29 | struct pci_dev; | 30 | struct pci_dev; |
30 | struct pci_bus; | 31 | struct pci_bus; |
@@ -33,10 +34,11 @@ struct device_node; | |||
33 | #ifdef CONFIG_EEH | 34 | #ifdef CONFIG_EEH |
34 | 35 | ||
35 | /* EEH subsystem flags */ | 36 | /* EEH subsystem flags */ |
36 | #define EEH_ENABLED 0x1 /* EEH enabled */ | 37 | #define EEH_ENABLED 0x01 /* EEH enabled */ |
37 | #define EEH_FORCE_DISABLED 0x2 /* EEH disabled */ | 38 | #define EEH_FORCE_DISABLED 0x02 /* EEH disabled */ |
38 | #define EEH_PROBE_MODE_DEV 0x4 /* From PCI device */ | 39 | #define EEH_PROBE_MODE_DEV 0x04 /* From PCI device */ |
39 | #define EEH_PROBE_MODE_DEVTREE 0x8 /* From device tree */ | 40 | #define EEH_PROBE_MODE_DEVTREE 0x08 /* From device tree */ |
41 | #define EEH_ENABLE_IO_FOR_LOG 0x10 /* Enable IO for log */ | ||
40 | 42 | ||
41 | /* | 43 | /* |
42 | * Delay for PE reset, all in ms | 44 | * Delay for PE reset, all in ms |
@@ -84,7 +86,9 @@ struct eeh_pe { | |||
84 | int freeze_count; /* Times of froze up */ | 86 | int freeze_count; /* Times of froze up */ |
85 | struct timeval tstamp; /* Time on first-time freeze */ | 87 | struct timeval tstamp; /* Time on first-time freeze */ |
86 | int false_positives; /* Times of reported #ff's */ | 88 | int false_positives; /* Times of reported #ff's */ |
89 | atomic_t pass_dev_cnt; /* Count of passed through devs */ | ||
87 | struct eeh_pe *parent; /* Parent PE */ | 90 | struct eeh_pe *parent; /* Parent PE */ |
91 | void *data; /* PE auxillary data */ | ||
88 | struct list_head child_list; /* Link PE to the child list */ | 92 | struct list_head child_list; /* Link PE to the child list */ |
89 | struct list_head edevs; /* Link list of EEH devices */ | 93 | struct list_head edevs; /* Link list of EEH devices */ |
90 | struct list_head child; /* Child PEs */ | 94 | struct list_head child; /* Child PEs */ |
@@ -93,6 +97,11 @@ struct eeh_pe { | |||
93 | #define eeh_pe_for_each_dev(pe, edev, tmp) \ | 97 | #define eeh_pe_for_each_dev(pe, edev, tmp) \ |
94 | list_for_each_entry_safe(edev, tmp, &pe->edevs, list) | 98 | list_for_each_entry_safe(edev, tmp, &pe->edevs, list) |
95 | 99 | ||
100 | static inline bool eeh_pe_passed(struct eeh_pe *pe) | ||
101 | { | ||
102 | return pe ? !!atomic_read(&pe->pass_dev_cnt) : false; | ||
103 | } | ||
104 | |||
96 | /* | 105 | /* |
97 | * The struct is used to trace EEH state for the associated | 106 | * The struct is used to trace EEH state for the associated |
98 | * PCI device node or PCI device. In future, it might | 107 | * PCI device node or PCI device. In future, it might |
@@ -165,6 +174,11 @@ enum { | |||
165 | #define EEH_STATE_DMA_ACTIVE (1 << 4) /* Active DMA */ | 174 | #define EEH_STATE_DMA_ACTIVE (1 << 4) /* Active DMA */ |
166 | #define EEH_STATE_MMIO_ENABLED (1 << 5) /* MMIO enabled */ | 175 | #define EEH_STATE_MMIO_ENABLED (1 << 5) /* MMIO enabled */ |
167 | #define EEH_STATE_DMA_ENABLED (1 << 6) /* DMA enabled */ | 176 | #define EEH_STATE_DMA_ENABLED (1 << 6) /* DMA enabled */ |
177 | #define EEH_PE_STATE_NORMAL 0 /* Normal state */ | ||
178 | #define EEH_PE_STATE_RESET 1 /* PE reset asserted */ | ||
179 | #define EEH_PE_STATE_STOPPED_IO_DMA 2 /* Frozen PE */ | ||
180 | #define EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA, Enabled IO */ | ||
181 | #define EEH_PE_STATE_UNAVAIL 5 /* Unavailable */ | ||
168 | #define EEH_RESET_DEACTIVATE 0 /* Deactivate the PE reset */ | 182 | #define EEH_RESET_DEACTIVATE 0 /* Deactivate the PE reset */ |
169 | #define EEH_RESET_HOT 1 /* Hot reset */ | 183 | #define EEH_RESET_HOT 1 /* Hot reset */ |
170 | #define EEH_RESET_FUNDAMENTAL 3 /* Fundamental reset */ | 184 | #define EEH_RESET_FUNDAMENTAL 3 /* Fundamental reset */ |
@@ -194,36 +208,28 @@ extern int eeh_subsystem_flags; | |||
194 | extern struct eeh_ops *eeh_ops; | 208 | extern struct eeh_ops *eeh_ops; |
195 | extern raw_spinlock_t confirm_error_lock; | 209 | extern raw_spinlock_t confirm_error_lock; |
196 | 210 | ||
197 | static inline bool eeh_enabled(void) | 211 | static inline void eeh_add_flag(int flag) |
198 | { | 212 | { |
199 | if ((eeh_subsystem_flags & EEH_FORCE_DISABLED) || | 213 | eeh_subsystem_flags |= flag; |
200 | !(eeh_subsystem_flags & EEH_ENABLED)) | ||
201 | return false; | ||
202 | |||
203 | return true; | ||
204 | } | 214 | } |
205 | 215 | ||
206 | static inline void eeh_set_enable(bool mode) | 216 | static inline void eeh_clear_flag(int flag) |
207 | { | 217 | { |
208 | if (mode) | 218 | eeh_subsystem_flags &= ~flag; |
209 | eeh_subsystem_flags |= EEH_ENABLED; | ||
210 | else | ||
211 | eeh_subsystem_flags &= ~EEH_ENABLED; | ||
212 | } | 219 | } |
213 | 220 | ||
214 | static inline void eeh_probe_mode_set(int flag) | 221 | static inline bool eeh_has_flag(int flag) |
215 | { | 222 | { |
216 | eeh_subsystem_flags |= flag; | 223 | return !!(eeh_subsystem_flags & flag); |
217 | } | 224 | } |
218 | 225 | ||
219 | static inline int eeh_probe_mode_devtree(void) | 226 | static inline bool eeh_enabled(void) |
220 | { | 227 | { |
221 | return (eeh_subsystem_flags & EEH_PROBE_MODE_DEVTREE); | 228 | if (eeh_has_flag(EEH_FORCE_DISABLED) || |
222 | } | 229 | !eeh_has_flag(EEH_ENABLED)) |
230 | return false; | ||
223 | 231 | ||
224 | static inline int eeh_probe_mode_dev(void) | 232 | return true; |
225 | { | ||
226 | return (eeh_subsystem_flags & EEH_PROBE_MODE_DEV); | ||
227 | } | 233 | } |
228 | 234 | ||
229 | static inline void eeh_serialize_lock(unsigned long *flags) | 235 | static inline void eeh_serialize_lock(unsigned long *flags) |
@@ -243,6 +249,7 @@ static inline void eeh_serialize_unlock(unsigned long flags) | |||
243 | #define EEH_MAX_ALLOWED_FREEZES 5 | 249 | #define EEH_MAX_ALLOWED_FREEZES 5 |
244 | 250 | ||
245 | typedef void *(*eeh_traverse_func)(void *data, void *flag); | 251 | typedef void *(*eeh_traverse_func)(void *data, void *flag); |
252 | void eeh_set_pe_aux_size(int size); | ||
246 | int eeh_phb_pe_create(struct pci_controller *phb); | 253 | int eeh_phb_pe_create(struct pci_controller *phb); |
247 | struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb); | 254 | struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb); |
248 | struct eeh_pe *eeh_pe_get(struct eeh_dev *edev); | 255 | struct eeh_pe *eeh_pe_get(struct eeh_dev *edev); |
@@ -272,6 +279,13 @@ void eeh_add_device_late(struct pci_dev *); | |||
272 | void eeh_add_device_tree_late(struct pci_bus *); | 279 | void eeh_add_device_tree_late(struct pci_bus *); |
273 | void eeh_add_sysfs_files(struct pci_bus *); | 280 | void eeh_add_sysfs_files(struct pci_bus *); |
274 | void eeh_remove_device(struct pci_dev *); | 281 | void eeh_remove_device(struct pci_dev *); |
282 | int eeh_dev_open(struct pci_dev *pdev); | ||
283 | void eeh_dev_release(struct pci_dev *pdev); | ||
284 | struct eeh_pe *eeh_iommu_group_to_pe(struct iommu_group *group); | ||
285 | int eeh_pe_set_option(struct eeh_pe *pe, int option); | ||
286 | int eeh_pe_get_state(struct eeh_pe *pe); | ||
287 | int eeh_pe_reset(struct eeh_pe *pe, int option); | ||
288 | int eeh_pe_configure(struct eeh_pe *pe); | ||
275 | 289 | ||
276 | /** | 290 | /** |
277 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. | 291 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. |
@@ -295,8 +309,6 @@ static inline bool eeh_enabled(void) | |||
295 | return false; | 309 | return false; |
296 | } | 310 | } |
297 | 311 | ||
298 | static inline void eeh_set_enable(bool mode) { } | ||
299 | |||
300 | static inline int eeh_init(void) | 312 | static inline int eeh_init(void) |
301 | { | 313 | { |
302 | return 0; | 314 | return 0; |