diff options
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5db6b6690b59..463a5a9d583d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -837,6 +837,19 @@ static void pci_release_dev(struct device *dev) | |||
837 | kfree(pci_dev); | 837 | kfree(pci_dev); |
838 | } | 838 | } |
839 | 839 | ||
840 | static void set_pcie_port_type(struct pci_dev *pdev) | ||
841 | { | ||
842 | int pos; | ||
843 | u16 reg16; | ||
844 | |||
845 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
846 | if (!pos) | ||
847 | return; | ||
848 | pdev->is_pcie = 1; | ||
849 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); | ||
850 | pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4; | ||
851 | } | ||
852 | |||
840 | /** | 853 | /** |
841 | * pci_cfg_space_size - get the configuration space size of the PCI device. | 854 | * pci_cfg_space_size - get the configuration space size of the PCI device. |
842 | * @dev: PCI device | 855 | * @dev: PCI device |
@@ -951,6 +964,7 @@ pci_scan_device(struct pci_bus *bus, int devfn) | |||
951 | dev->device = (l >> 16) & 0xffff; | 964 | dev->device = (l >> 16) & 0xffff; |
952 | dev->cfg_size = pci_cfg_space_size(dev); | 965 | dev->cfg_size = pci_cfg_space_size(dev); |
953 | dev->error_state = pci_channel_io_normal; | 966 | dev->error_state = pci_channel_io_normal; |
967 | set_pcie_port_type(dev); | ||
954 | 968 | ||
955 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) | 969 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) |
956 | set this higher, assuming the system even supports it. */ | 970 | set this higher, assuming the system even supports it. */ |