PCI/AER: Use PCI Express Capability accessors
Use PCI Express Capability access functions to simplify PCIe AER. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
@@ -122,19 +122,17 @@ static void set_downstream_devices_error_reporting(struct pci_dev *dev,
|
||||
static void aer_enable_rootport(struct aer_rpc *rpc)
|
||||
{
|
||||
struct pci_dev *pdev = rpc->rpd->port;
|
||||
int pos, aer_pos;
|
||||
int aer_pos;
|
||||
u16 reg16;
|
||||
u32 reg32;
|
||||
|
||||
pos = pci_pcie_cap(pdev);
|
||||
/* Clear PCIe Capability's Device Status */
|
||||
pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, ®16);
|
||||
pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16);
|
||||
pcie_capability_read_word(pdev, PCI_EXP_DEVSTA, ®16);
|
||||
pcie_capability_write_word(pdev, PCI_EXP_DEVSTA, reg16);
|
||||
|
||||
/* Disable system error generation in response to error messages */
|
||||
pci_read_config_word(pdev, pos + PCI_EXP_RTCTL, ®16);
|
||||
reg16 &= ~(SYSTEM_ERROR_INTR_ON_MESG_MASK);
|
||||
pci_write_config_word(pdev, pos + PCI_EXP_RTCTL, reg16);
|
||||
pcie_capability_clear_word(pdev, PCI_EXP_RTCTL,
|
||||
SYSTEM_ERROR_INTR_ON_MESG_MASK);
|
||||
|
||||
aer_pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
|
||||
/* Clear error status */
|
||||
@@ -396,9 +394,8 @@ static void aer_error_resume(struct pci_dev *dev)
|
||||
u16 reg16;
|
||||
|
||||
/* Clean up Root device status */
|
||||
pos = pci_pcie_cap(dev);
|
||||
pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, ®16);
|
||||
pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, reg16);
|
||||
pcie_capability_read_word(dev, PCI_EXP_DEVSTA, ®16);
|
||||
pcie_capability_write_word(dev, PCI_EXP_DEVSTA, reg16);
|
||||
|
||||
/* Clean AER Root Error Status */
|
||||
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
|
||||
|
Reference in New Issue
Block a user