aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/eeh.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/eeh.h')
-rw-r--r--arch/powerpc/include/asm/eeh.h62
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
29struct pci_dev; 30struct pci_dev;
30struct pci_bus; 31struct 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
100static 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;
194extern struct eeh_ops *eeh_ops; 208extern struct eeh_ops *eeh_ops;
195extern raw_spinlock_t confirm_error_lock; 209extern raw_spinlock_t confirm_error_lock;
196 210
197static inline bool eeh_enabled(void) 211static 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
206static inline void eeh_set_enable(bool mode) 216static 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
214static inline void eeh_probe_mode_set(int flag) 221static inline bool eeh_has_flag(int flag)
215{ 222{
216 eeh_subsystem_flags |= flag; 223 return !!(eeh_subsystem_flags & flag);
217} 224}
218 225
219static inline int eeh_probe_mode_devtree(void) 226static 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
224static inline int eeh_probe_mode_dev(void) 232 return true;
225{
226 return (eeh_subsystem_flags & EEH_PROBE_MODE_DEV);
227} 233}
228 234
229static inline void eeh_serialize_lock(unsigned long *flags) 235static 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
245typedef void *(*eeh_traverse_func)(void *data, void *flag); 251typedef void *(*eeh_traverse_func)(void *data, void *flag);
252void eeh_set_pe_aux_size(int size);
246int eeh_phb_pe_create(struct pci_controller *phb); 253int eeh_phb_pe_create(struct pci_controller *phb);
247struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb); 254struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);
248struct eeh_pe *eeh_pe_get(struct eeh_dev *edev); 255struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);
@@ -272,6 +279,13 @@ void eeh_add_device_late(struct pci_dev *);
272void eeh_add_device_tree_late(struct pci_bus *); 279void eeh_add_device_tree_late(struct pci_bus *);
273void eeh_add_sysfs_files(struct pci_bus *); 280void eeh_add_sysfs_files(struct pci_bus *);
274void eeh_remove_device(struct pci_dev *); 281void eeh_remove_device(struct pci_dev *);
282int eeh_dev_open(struct pci_dev *pdev);
283void eeh_dev_release(struct pci_dev *pdev);
284struct eeh_pe *eeh_iommu_group_to_pe(struct iommu_group *group);
285int eeh_pe_set_option(struct eeh_pe *pe, int option);
286int eeh_pe_get_state(struct eeh_pe *pe);
287int eeh_pe_reset(struct eeh_pe *pe, int option);
288int 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
298static inline void eeh_set_enable(bool mode) { }
299
300static inline int eeh_init(void) 312static inline int eeh_init(void)
301{ 313{
302 return 0; 314 return 0;