aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie/aer/aerdrv_core.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-03-13 17:44:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-03-13 17:44:51 -0400
commit97fb44eb6bc01f4ffed4300e475aa15e44877375 (patch)
tree481ed6efd0babe7185cae04f2fd295426b36411d /drivers/pci/pcie/aer/aerdrv_core.c
parente4707dd3e9d0cb57597b6568a5e51fea5d6fca41 (diff)
parent148854c65ea8046b045672fd49f4333aefaa3ab5 (diff)
Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into devel
Conflicts: arch/arm/mach-at91/gpio.c
Diffstat (limited to 'drivers/pci/pcie/aer/aerdrv_core.c')
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index aac7006949f..d0c97368586 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -108,6 +108,34 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
108} 108}
109#endif /* 0 */ 109#endif /* 0 */
110 110
111
112static void set_device_error_reporting(struct pci_dev *dev, void *data)
113{
114 bool enable = *((bool *)data);
115
116 if (dev->pcie_type != PCIE_RC_PORT &&
117 dev->pcie_type != PCIE_SW_UPSTREAM_PORT &&
118 dev->pcie_type != PCIE_SW_DOWNSTREAM_PORT)
119 return;
120
121 if (enable)
122 pci_enable_pcie_error_reporting(dev);
123 else
124 pci_disable_pcie_error_reporting(dev);
125}
126
127/**
128 * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports.
129 * @dev: pointer to root port's pci_dev data structure
130 * @enable: true = enable error reporting, false = disable error reporting.
131 */
132static void set_downstream_devices_error_reporting(struct pci_dev *dev,
133 bool enable)
134{
135 set_device_error_reporting(dev, &enable);
136 pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable);
137}
138
111static int find_device_iter(struct device *device, void *data) 139static int find_device_iter(struct device *device, void *data)
112{ 140{
113 struct pci_dev *dev; 141 struct pci_dev *dev;
@@ -525,15 +553,11 @@ void aer_enable_rootport(struct aer_rpc *rpc)
525 pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, &reg32); 553 pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, &reg32);
526 pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); 554 pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32);
527 555
528 /* Enable Root Port device reporting error itself */ 556 /*
529 pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, &reg16); 557 * Enable error reporting for the root port device and downstream port
530 reg16 = reg16 | 558 * devices.
531 PCI_EXP_DEVCTL_CERE | 559 */
532 PCI_EXP_DEVCTL_NFERE | 560 set_downstream_devices_error_reporting(pdev, true);
533 PCI_EXP_DEVCTL_FERE |
534 PCI_EXP_DEVCTL_URRE;
535 pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL,
536 reg16);
537 561
538 /* Enable Root Port's interrupt in response to error messages */ 562 /* Enable Root Port's interrupt in response to error messages */
539 pci_write_config_dword(pdev, 563 pci_write_config_dword(pdev,
@@ -553,6 +577,12 @@ static void disable_root_aer(struct aer_rpc *rpc)
553 u32 reg32; 577 u32 reg32;
554 int pos; 578 int pos;
555 579
580 /*
581 * Disable error reporting for the root port device and downstream port
582 * devices.
583 */
584 set_downstream_devices_error_reporting(pdev, false);
585
556 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); 586 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
557 /* Disable Root's interrupt in response to error messages */ 587 /* Disable Root's interrupt in response to error messages */
558 pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0); 588 pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0);