aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/eeh.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-03-26 11:18:44 -0400
committerIngo Molnar <mingo@kernel.org>2012-03-26 11:19:03 -0400
commit7fd52392c56361a40f0c630a82b36b95ca31eac6 (patch)
tree14091de24c6b28ea4cae9826f98aeedb7be091f5 /arch/powerpc/include/asm/eeh.h
parentb01c3a0010aabadf745f3e7fdb9cab682e0a28a2 (diff)
parente22057c8599373e5caef0bc42bdb95d2a361ab0d (diff)
Merge branch 'linus' into perf/urgent
Merge reason: we need to fix a non-trivial merge conflict. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc/include/asm/eeh.h')
-rw-r--r--arch/powerpc/include/asm/eeh.h134
1 files changed, 106 insertions, 28 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 66ea9b8b95c5..d60f99814ffb 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * eeh.h
3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation. 2 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation.
3 * Copyright 2001-2012 IBM Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -31,44 +31,105 @@ struct device_node;
31 31
32#ifdef CONFIG_EEH 32#ifdef CONFIG_EEH
33 33
34extern int eeh_subsystem_enabled; 34/*
35 * The struct is used to trace EEH state for the associated
36 * PCI device node or PCI device. In future, it might
37 * represent PE as well so that the EEH device to form
38 * another tree except the currently existing tree of PCI
39 * buses and PCI devices
40 */
41#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */
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
47struct eeh_dev {
48 int mode; /* EEH mode */
49 int class_code; /* Class code of the device */
50 int config_addr; /* Config address */
51 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 */
56 struct pci_controller *phb; /* Associated PHB */
57 struct device_node *dn; /* Associated device node */
58 struct pci_dev *pdev; /* Associated PCI device */
59};
60
61static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
62{
63 return edev->dn;
64}
65
66static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
67{
68 return edev->pdev;
69}
35 70
36/* Values for eeh_mode bits in device_node */ 71/*
37#define EEH_MODE_SUPPORTED (1<<0) 72 * The struct is used to trace the registered EEH operation
38#define EEH_MODE_NOCHECK (1<<1) 73 * callback functions. Actually, those operation callback
39#define EEH_MODE_ISOLATED (1<<2) 74 * functions are heavily platform dependent. That means the
40#define EEH_MODE_RECOVERING (1<<3) 75 * platform should register its own EEH operation callback
41#define EEH_MODE_IRQ_DISABLED (1<<4) 76 * functions before any EEH further operations.
77 */
78#define EEH_OPT_DISABLE 0 /* EEH disable */
79#define EEH_OPT_ENABLE 1 /* EEH enable */
80#define EEH_OPT_THAW_MMIO 2 /* MMIO enable */
81#define EEH_OPT_THAW_DMA 3 /* DMA enable */
82#define EEH_STATE_UNAVAILABLE (1 << 0) /* State unavailable */
83#define EEH_STATE_NOT_SUPPORT (1 << 1) /* EEH not supported */
84#define EEH_STATE_RESET_ACTIVE (1 << 2) /* Active reset */
85#define EEH_STATE_MMIO_ACTIVE (1 << 3) /* Active MMIO */
86#define EEH_STATE_DMA_ACTIVE (1 << 4) /* Active DMA */
87#define EEH_STATE_MMIO_ENABLED (1 << 5) /* MMIO enabled */
88#define EEH_STATE_DMA_ENABLED (1 << 6) /* DMA enabled */
89#define EEH_RESET_DEACTIVATE 0 /* Deactivate the PE reset */
90#define EEH_RESET_HOT 1 /* Hot reset */
91#define EEH_RESET_FUNDAMENTAL 3 /* Fundamental reset */
92#define EEH_LOG_TEMP 1 /* EEH temporary error log */
93#define EEH_LOG_PERM 2 /* EEH permanent error log */
94
95struct eeh_ops {
96 char *name;
97 int (*init)(void);
98 int (*set_option)(struct device_node *dn, int option);
99 int (*get_pe_addr)(struct device_node *dn);
100 int (*get_state)(struct device_node *dn, int *state);
101 int (*reset)(struct device_node *dn, int option);
102 int (*wait_state)(struct device_node *dn, int max_wait);
103 int (*get_log)(struct device_node *dn, int severity, char *drv_log, unsigned long len);
104 int (*configure_bridge)(struct device_node *dn);
105 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);
107};
108
109extern struct eeh_ops *eeh_ops;
110extern int eeh_subsystem_enabled;
42 111
43/* Max number of EEH freezes allowed before we consider the device 112/*
44 * to be permanently disabled. */ 113 * Max number of EEH freezes allowed before we consider the device
114 * to be permanently disabled.
115 */
45#define EEH_MAX_ALLOWED_FREEZES 5 116#define EEH_MAX_ALLOWED_FREEZES 5
46 117
118void * __devinit eeh_dev_init(struct device_node *dn, void *data);
119void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
120void __init eeh_dev_phb_init(void);
47void __init eeh_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);
126int __exit eeh_ops_unregister(const char *name);
48unsigned long eeh_check_failure(const volatile void __iomem *token, 127unsigned long eeh_check_failure(const volatile void __iomem *token,
49 unsigned long val); 128 unsigned long val);
50int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); 129int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev);
51void __init pci_addr_cache_build(void); 130void __init pci_addr_cache_build(void);
52
53/**
54 * eeh_add_device_early
55 * eeh_add_device_late
56 *
57 * Perform eeh initialization for devices added after boot.
58 * Call eeh_add_device_early before doing any i/o to the
59 * device (including config space i/o). Call eeh_add_device_late
60 * to finish the eeh setup for this device.
61 */
62void eeh_add_device_tree_early(struct device_node *); 131void eeh_add_device_tree_early(struct device_node *);
63void eeh_add_device_tree_late(struct pci_bus *); 132void eeh_add_device_tree_late(struct pci_bus *);
64
65/**
66 * eeh_remove_device_recursive - undo EEH for device & children.
67 * @dev: pci device to be removed
68 *
69 * As above, this removes the device; it also removes child
70 * pci devices as well.
71 */
72void eeh_remove_bus_device(struct pci_dev *); 133void eeh_remove_bus_device(struct pci_dev *);
73 134
74/** 135/**
@@ -87,8 +148,25 @@ void eeh_remove_bus_device(struct pci_dev *);
87#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8)) 148#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))
88 149
89#else /* !CONFIG_EEH */ 150#else /* !CONFIG_EEH */
151
152static inline void *eeh_dev_init(struct device_node *dn, void *data)
153{
154 return NULL;
155}
156
157static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { }
158
159static inline void eeh_dev_phb_init(void) { }
160
90static inline void eeh_init(void) { } 161static inline void eeh_init(void) { }
91 162
163#ifdef CONFIG_PPC_PSERIES
164static inline int eeh_pseries_init(void)
165{
166 return 0;
167}
168#endif /* CONFIG_PPC_PSERIES */
169
92static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 170static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
93{ 171{
94 return val; 172 return val;