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.h136
1 files changed, 98 insertions, 38 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index d60f99814ffb..58c5ee61e700 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -32,27 +32,61 @@ struct device_node;
32#ifdef CONFIG_EEH 32#ifdef CONFIG_EEH
33 33
34/* 34/*
35 * The struct is used to trace PE related EEH functionality.
36 * In theory, there will have one instance of the struct to
37 * be created against particular PE. In nature, PEs corelate
38 * to each other. the struct has to reflect that hierarchy in
39 * order to easily pick up those affected PEs when one particular
40 * PE has EEH errors.
41 *
42 * Also, one particular PE might be composed of PCI device, PCI
43 * bus and its subordinate components. The struct also need ship
44 * the information. Further more, one particular PE is only meaingful
45 * in the corresponding PHB. Therefore, the root PEs should be created
46 * against existing PHBs in on-to-one fashion.
47 */
48#define EEH_PE_PHB 1 /* PHB PE */
49#define EEH_PE_DEVICE 2 /* Device PE */
50#define EEH_PE_BUS 3 /* Bus PE */
51
52#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */
53#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */
54
55struct eeh_pe {
56 int type; /* PE type: PHB/Bus/Device */
57 int state; /* PE EEH dependent mode */
58 int config_addr; /* Traditional PCI address */
59 int addr; /* PE configuration address */
60 struct pci_controller *phb; /* Associated PHB */
61 int check_count; /* Times of ignored error */
62 int freeze_count; /* Times of froze up */
63 int false_positives; /* Times of reported #ff's */
64 struct eeh_pe *parent; /* Parent PE */
65 struct list_head child_list; /* Link PE to the child list */
66 struct list_head edevs; /* Link list of EEH devices */
67 struct list_head child; /* Child PEs */
68};
69
70#define eeh_pe_for_each_dev(pe, edev) \
71 list_for_each_entry(edev, &pe->edevs, list)
72
73/*
35 * The struct is used to trace EEH state for the associated 74 * The struct is used to trace EEH state for the associated
36 * PCI device node or PCI device. In future, it might 75 * PCI device node or PCI device. In future, it might
37 * represent PE as well so that the EEH device to form 76 * represent PE as well so that the EEH device to form
38 * another tree except the currently existing tree of PCI 77 * another tree except the currently existing tree of PCI
39 * buses and PCI devices 78 * buses and PCI devices
40 */ 79 */
41#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */ 80#define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */
42#define EEH_MODE_NOCHECK (1<<1) /* EEH check should be skipped */
43#define EEH_MODE_ISOLATED (1<<2) /* The device has been isolated */
44#define EEH_MODE_RECOVERING (1<<3) /* Recovering the device */
45#define EEH_MODE_IRQ_DISABLED (1<<4) /* Interrupt disabled */
46 81
47struct eeh_dev { 82struct eeh_dev {
48 int mode; /* EEH mode */ 83 int mode; /* EEH mode */
49 int class_code; /* Class code of the device */ 84 int class_code; /* Class code of the device */
50 int config_addr; /* Config address */ 85 int config_addr; /* Config address */
51 int pe_config_addr; /* PE config address */ 86 int pe_config_addr; /* PE config address */
52 int check_count; /* Times of ignored error */
53 int freeze_count; /* Times of froze up */
54 int false_positives; /* Times of reported #ff's */
55 u32 config_space[16]; /* Saved PCI config space */ 87 u32 config_space[16]; /* Saved PCI config space */
88 struct eeh_pe *pe; /* Associated PE */
89 struct list_head list; /* Form link list in the PE */
56 struct pci_controller *phb; /* Associated PHB */ 90 struct pci_controller *phb; /* Associated PHB */
57 struct device_node *dn; /* Associated device node */ 91 struct device_node *dn; /* Associated device node */
58 struct pci_dev *pdev; /* Associated PCI device */ 92 struct pci_dev *pdev; /* Associated PCI device */
@@ -95,19 +129,51 @@ static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
95struct eeh_ops { 129struct eeh_ops {
96 char *name; 130 char *name;
97 int (*init)(void); 131 int (*init)(void);
98 int (*set_option)(struct device_node *dn, int option); 132 void* (*of_probe)(struct device_node *dn, void *flag);
99 int (*get_pe_addr)(struct device_node *dn); 133 void* (*dev_probe)(struct pci_dev *dev, void *flag);
100 int (*get_state)(struct device_node *dn, int *state); 134 int (*set_option)(struct eeh_pe *pe, int option);
101 int (*reset)(struct device_node *dn, int option); 135 int (*get_pe_addr)(struct eeh_pe *pe);
102 int (*wait_state)(struct device_node *dn, int max_wait); 136 int (*get_state)(struct eeh_pe *pe, int *state);
103 int (*get_log)(struct device_node *dn, int severity, char *drv_log, unsigned long len); 137 int (*reset)(struct eeh_pe *pe, int option);
104 int (*configure_bridge)(struct device_node *dn); 138 int (*wait_state)(struct eeh_pe *pe, int max_wait);
139 int (*get_log)(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len);
140 int (*configure_bridge)(struct eeh_pe *pe);
105 int (*read_config)(struct device_node *dn, int where, int size, u32 *val); 141 int (*read_config)(struct device_node *dn, int where, int size, u32 *val);
106 int (*write_config)(struct device_node *dn, int where, int size, u32 val); 142 int (*write_config)(struct device_node *dn, int where, int size, u32 val);
107}; 143};
108 144
109extern struct eeh_ops *eeh_ops; 145extern struct eeh_ops *eeh_ops;
110extern int eeh_subsystem_enabled; 146extern int eeh_subsystem_enabled;
147extern struct mutex eeh_mutex;
148extern int eeh_probe_mode;
149
150#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */
151#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */
152
153static inline void eeh_probe_mode_set(int flag)
154{
155 eeh_probe_mode = flag;
156}
157
158static inline int eeh_probe_mode_devtree(void)
159{
160 return (eeh_probe_mode == EEH_PROBE_MODE_DEVTREE);
161}
162
163static inline int eeh_probe_mode_dev(void)
164{
165 return (eeh_probe_mode == EEH_PROBE_MODE_DEV);
166}
167
168static inline void eeh_lock(void)
169{
170 mutex_lock(&eeh_mutex);
171}
172
173static inline void eeh_unlock(void)
174{
175 mutex_unlock(&eeh_mutex);
176}
111 177
112/* 178/*
113 * Max number of EEH freezes allowed before we consider the device 179 * Max number of EEH freezes allowed before we consider the device
@@ -115,19 +181,23 @@ extern int eeh_subsystem_enabled;
115 */ 181 */
116#define EEH_MAX_ALLOWED_FREEZES 5 182#define EEH_MAX_ALLOWED_FREEZES 5
117 183
184typedef void *(*eeh_traverse_func)(void *data, void *flag);
185int __devinit eeh_phb_pe_create(struct pci_controller *phb);
186int eeh_add_to_parent_pe(struct eeh_dev *edev);
187int eeh_rmv_from_parent_pe(struct eeh_dev *edev);
188void *eeh_pe_dev_traverse(struct eeh_pe *root,
189 eeh_traverse_func fn, void *flag);
190void eeh_pe_restore_bars(struct eeh_pe *pe);
191struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
192
118void * __devinit eeh_dev_init(struct device_node *dn, void *data); 193void * __devinit eeh_dev_init(struct device_node *dn, void *data);
119void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb); 194void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
120void __init eeh_dev_phb_init(void);
121void __init eeh_init(void);
122#ifdef CONFIG_PPC_PSERIES
123int __init eeh_pseries_init(void);
124#endif
125int __init eeh_ops_register(struct eeh_ops *ops); 195int __init eeh_ops_register(struct eeh_ops *ops);
126int __exit eeh_ops_unregister(const char *name); 196int __exit eeh_ops_unregister(const char *name);
127unsigned long eeh_check_failure(const volatile void __iomem *token, 197unsigned long eeh_check_failure(const volatile void __iomem *token,
128 unsigned long val); 198 unsigned long val);
129int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); 199int eeh_dev_check_failure(struct eeh_dev *edev);
130void __init pci_addr_cache_build(void); 200void __init eeh_addr_cache_build(void);
131void eeh_add_device_tree_early(struct device_node *); 201void eeh_add_device_tree_early(struct device_node *);
132void eeh_add_device_tree_late(struct pci_bus *); 202void eeh_add_device_tree_late(struct pci_bus *);
133void eeh_remove_bus_device(struct pci_dev *); 203void eeh_remove_bus_device(struct pci_dev *);
@@ -156,34 +226,24 @@ static inline void *eeh_dev_init(struct device_node *dn, void *data)
156 226
157static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { } 227static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { }
158 228
159static inline void eeh_dev_phb_init(void) { }
160
161static inline void eeh_init(void) { }
162
163#ifdef CONFIG_PPC_PSERIES
164static inline int eeh_pseries_init(void)
165{
166 return 0;
167}
168#endif /* CONFIG_PPC_PSERIES */
169
170static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 229static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
171{ 230{
172 return val; 231 return val;
173} 232}
174 233
175static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 234#define eeh_dev_check_failure(x) (0)
176{
177 return 0;
178}
179 235
180static inline void pci_addr_cache_build(void) { } 236static inline void eeh_addr_cache_build(void) { }
181 237
182static inline void eeh_add_device_tree_early(struct device_node *dn) { } 238static inline void eeh_add_device_tree_early(struct device_node *dn) { }
183 239
184static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } 240static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
185 241
186static inline void eeh_remove_bus_device(struct pci_dev *dev) { } 242static inline void eeh_remove_bus_device(struct pci_dev *dev) { }
243
244static inline void eeh_lock(void) { }
245static inline void eeh_unlock(void) { }
246
187#define EEH_POSSIBLE_ERROR(val, type) (0) 247#define EEH_POSSIBLE_ERROR(val, type) (0)
188#define EEH_IO_ERROR_VALUE(size) (-1UL) 248#define EEH_IO_ERROR_VALUE(size) (-1UL)
189#endif /* CONFIG_EEH */ 249#endif /* CONFIG_EEH */