aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 985df63aa59..fe26df7cf5c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -854,12 +854,6 @@ EXPORT_SYMBOL(pci_choose_state);
854 ((flags & PCI_EXP_FLAGS_VERS) > 1 || \ 854 ((flags & PCI_EXP_FLAGS_VERS) > 1 || \
855 (type == PCI_EXP_TYPE_ROOT_PORT || \ 855 (type == PCI_EXP_TYPE_ROOT_PORT || \
856 type == PCI_EXP_TYPE_RC_EC)) 856 type == PCI_EXP_TYPE_RC_EC))
857#define pcie_cap_has_devctl2(type, flags) \
858 ((flags & PCI_EXP_FLAGS_VERS) > 1)
859#define pcie_cap_has_lnkctl2(type, flags) \
860 ((flags & PCI_EXP_FLAGS_VERS) > 1)
861#define pcie_cap_has_sltctl2(type, flags) \
862 ((flags & PCI_EXP_FLAGS_VERS) > 1)
863 857
864static struct pci_cap_saved_state *pci_find_saved_cap( 858static struct pci_cap_saved_state *pci_find_saved_cap(
865 struct pci_dev *pci_dev, char cap) 859 struct pci_dev *pci_dev, char cap)
@@ -902,13 +896,14 @@ static int pci_save_pcie_state(struct pci_dev *dev)
902 pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); 896 pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]);
903 if (pcie_cap_has_rtctl(dev->pcie_type, flags)) 897 if (pcie_cap_has_rtctl(dev->pcie_type, flags))
904 pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); 898 pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]);
905 if (pcie_cap_has_devctl2(dev->pcie_type, flags))
906 pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]);
907 if (pcie_cap_has_lnkctl2(dev->pcie_type, flags))
908 pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]);
909 if (pcie_cap_has_sltctl2(dev->pcie_type, flags))
910 pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]);
911 899
900 pos = pci_pcie_cap2(dev);
901 if (!pos)
902 return 0;
903
904 pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]);
905 pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]);
906 pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]);
912 return 0; 907 return 0;
913} 908}
914 909
@@ -935,12 +930,14 @@ static void pci_restore_pcie_state(struct pci_dev *dev)
935 pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); 930 pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]);
936 if (pcie_cap_has_rtctl(dev->pcie_type, flags)) 931 if (pcie_cap_has_rtctl(dev->pcie_type, flags))
937 pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); 932 pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]);
938 if (pcie_cap_has_devctl2(dev->pcie_type, flags)) 933
939 pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); 934 pos = pci_pcie_cap2(dev);
940 if (pcie_cap_has_lnkctl2(dev->pcie_type, flags)) 935 if (!pos)
941 pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); 936 return;
942 if (pcie_cap_has_sltctl2(dev->pcie_type, flags)) 937
943 pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); 938 pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]);
939 pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]);
940 pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]);
944} 941}
945 942
946 943