20 #ifndef _POWERPC_EEH_H
21 #define _POWERPC_EEH_H
25 #include <linux/list.h>
26 #include <linux/string.h>
48 #define EEH_PE_INVALID (1 << 0)
49 #define EEH_PE_PHB (1 << 1)
50 #define EEH_PE_DEVICE (1 << 2)
51 #define EEH_PE_BUS (1 << 3)
53 #define EEH_PE_ISOLATED (1 << 0)
54 #define EEH_PE_RECOVERING (1 << 1)
71 #define eeh_pe_for_each_dev(pe, edev) \
72 list_for_each_entry(edev, &pe->edevs, list)
81 #define EEH_DEV_IRQ_DISABLED (1<<0)
96 static inline struct device_node *eeh_dev_to_of_node(
struct eeh_dev *edev)
101 static inline struct pci_dev *eeh_dev_to_pci_dev(
struct eeh_dev *edev)
113 #define EEH_OPT_DISABLE 0
114 #define EEH_OPT_ENABLE 1
115 #define EEH_OPT_THAW_MMIO 2
116 #define EEH_OPT_THAW_DMA 3
117 #define EEH_STATE_UNAVAILABLE (1 << 0)
118 #define EEH_STATE_NOT_SUPPORT (1 << 1)
119 #define EEH_STATE_RESET_ACTIVE (1 << 2)
120 #define EEH_STATE_MMIO_ACTIVE (1 << 3)
121 #define EEH_STATE_DMA_ACTIVE (1 << 4)
122 #define EEH_STATE_MMIO_ENABLED (1 << 5)
123 #define EEH_STATE_DMA_ENABLED (1 << 6)
124 #define EEH_RESET_DEACTIVATE 0
125 #define EEH_RESET_HOT 1
126 #define EEH_RESET_FUNDAMENTAL 3
127 #define EEH_LOG_TEMP 1
128 #define EEH_LOG_PERM 2
135 int (*set_option)(
struct eeh_pe *pe,
int option);
136 int (*get_pe_addr)(
struct eeh_pe *pe);
137 int (*get_state)(
struct eeh_pe *pe,
int *
state);
138 int (*reset)(
struct eeh_pe *pe,
int option);
140 int (*get_log)(
struct eeh_pe *pe,
int severity,
char *drv_log,
unsigned long len);
141 int (*configure_bridge)(
struct eeh_pe *pe);
148 extern struct mutex eeh_mutex;
151 #define EEH_PROBE_MODE_DEV (1<<0)
152 #define EEH_PROBE_MODE_DEVTREE (1<<1)
154 static inline void eeh_probe_mode_set(
int flag)
159 static inline int eeh_probe_mode_devtree(
void)
164 static inline int eeh_probe_mode_dev(
void)
169 static inline void eeh_lock(
void)
174 static inline void eeh_unlock(
void)
183 #define EEH_MAX_ALLOWED_FREEZES 5
185 typedef void *(*eeh_traverse_func)(
void *
data,
void *
flag);
190 eeh_traverse_func
fn,
void *
flag);
212 #define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_subsystem_enabled)
219 #define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))
235 #define eeh_dev_check_failure(x) (0)
245 static inline void eeh_lock(
void) { }
246 static inline void eeh_unlock(
void) { }
248 #define EEH_POSSIBLE_ERROR(val, type) (0)
249 #define EEH_IO_ERROR_VALUE(size) (-1UL)
256 static inline u8 eeh_readb(
const volatile void __iomem *
addr)
259 if (EEH_POSSIBLE_ERROR(val,
u8))
264 static inline u16 eeh_readw(
const volatile void __iomem *addr)
267 if (EEH_POSSIBLE_ERROR(val,
u16))
272 static inline u32 eeh_readl(
const volatile void __iomem *addr)
275 if (EEH_POSSIBLE_ERROR(val,
u32))
280 static inline u64 eeh_readq(
const volatile void __iomem *addr)
282 u64 val = in_le64(addr);
283 if (EEH_POSSIBLE_ERROR(val,
u64))
288 static inline u16 eeh_readw_be(
const volatile void __iomem *addr)
291 if (EEH_POSSIBLE_ERROR(val,
u16))
296 static inline u32 eeh_readl_be(
const volatile void __iomem *addr)
299 if (EEH_POSSIBLE_ERROR(val,
u32))
304 static inline u64 eeh_readq_be(
const volatile void __iomem *addr)
306 u64 val = in_be64(addr);
307 if (EEH_POSSIBLE_ERROR(val,
u64))
312 static inline void eeh_memcpy_fromio(
void *
dest,
const
321 if (n >= 4 && EEH_POSSIBLE_ERROR(*((
u32 *)(dest + n - 4)),
u32))
326 static inline void eeh_readsb(
const volatile void __iomem *addr,
void *
buf,
329 _insb(addr, buf, ns);
330 if (EEH_POSSIBLE_ERROR((*(((
u8*)buf)+ns-1)),
u8))
334 static inline void eeh_readsw(
const volatile void __iomem *addr,
void * buf,
337 _insw(addr, buf, ns);
338 if (EEH_POSSIBLE_ERROR((*(((
u16*)buf)+ns-1)),
u16))
342 static inline void eeh_readsl(
const volatile void __iomem *addr,
void * buf,
345 _insl(addr, buf, nl);
346 if (EEH_POSSIBLE_ERROR((*(((
u32*)buf)+nl-1)),
u32))