|
@@ -837,6 +837,19 @@ static void pci_release_dev(struct device *dev)
|
|
|
kfree(pci_dev);
|
|
|
}
|
|
|
|
|
|
+static void set_pcie_port_type(struct pci_dev *pdev)
|
|
|
+{
|
|
|
+ int pos;
|
|
|
+ u16 reg16;
|
|
|
+
|
|
|
+ pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
|
|
|
+ if (!pos)
|
|
|
+ return;
|
|
|
+ pdev->is_pcie = 1;
|
|
|
+ pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16);
|
|
|
+ pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* pci_cfg_space_size - get the configuration space size of the PCI device.
|
|
|
* @dev: PCI device
|
|
@@ -951,6 +964,7 @@ pci_scan_device(struct pci_bus *bus, int devfn)
|
|
|
dev->device = (l >> 16) & 0xffff;
|
|
|
dev->cfg_size = pci_cfg_space_size(dev);
|
|
|
dev->error_state = pci_channel_io_normal;
|
|
|
+ set_pcie_port_type(dev);
|
|
|
|
|
|
/* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer)
|
|
|
set this higher, assuming the system even supports it. */
|