diff options
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 9f8a6b79a8ec..3cdba8b3f816 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -606,10 +606,10 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
606 | u32 linkcap; | 606 | u32 linkcap; |
607 | u16 linksta; | 607 | u16 linksta; |
608 | 608 | ||
609 | pci_read_config_dword(bridge, pos + PCI_EXP_LNKCAP, &linkcap); | 609 | pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap); |
610 | bus->max_bus_speed = pcie_link_speed[linkcap & 0xf]; | 610 | bus->max_bus_speed = pcie_link_speed[linkcap & 0xf]; |
611 | 611 | ||
612 | pci_read_config_word(bridge, pos + PCI_EXP_LNKSTA, &linksta); | 612 | pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta); |
613 | pcie_update_link_speed(bus, linksta); | 613 | pcie_update_link_speed(bus, linksta); |
614 | } | 614 | } |
615 | } | 615 | } |
@@ -932,24 +932,16 @@ void set_pcie_port_type(struct pci_dev *pdev) | |||
932 | pdev->is_pcie = 1; | 932 | pdev->is_pcie = 1; |
933 | pdev->pcie_cap = pos; | 933 | pdev->pcie_cap = pos; |
934 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); | 934 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); |
935 | pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4; | 935 | pdev->pcie_flags_reg = reg16; |
936 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16); | 936 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16); |
937 | pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD; | 937 | pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD; |
938 | } | 938 | } |
939 | 939 | ||
940 | void set_pcie_hotplug_bridge(struct pci_dev *pdev) | 940 | void set_pcie_hotplug_bridge(struct pci_dev *pdev) |
941 | { | 941 | { |
942 | int pos; | ||
943 | u16 reg16; | ||
944 | u32 reg32; | 942 | u32 reg32; |
945 | 943 | ||
946 | pos = pci_pcie_cap(pdev); | 944 | pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, ®32); |
947 | if (!pos) | ||
948 | return; | ||
949 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); | ||
950 | if (!(reg16 & PCI_EXP_FLAGS_SLOT)) | ||
951 | return; | ||
952 | pci_read_config_dword(pdev, pos + PCI_EXP_SLTCAP, ®32); | ||
953 | if (reg32 & PCI_EXP_SLTCAP_HPC) | 945 | if (reg32 & PCI_EXP_SLTCAP_HPC) |
954 | pdev->is_hotplug_bridge = 1; | 946 | pdev->is_hotplug_bridge = 1; |
955 | } | 947 | } |
@@ -1163,8 +1155,7 @@ int pci_cfg_space_size(struct pci_dev *dev) | |||
1163 | if (class == PCI_CLASS_BRIDGE_HOST) | 1155 | if (class == PCI_CLASS_BRIDGE_HOST) |
1164 | return pci_cfg_space_size_ext(dev); | 1156 | return pci_cfg_space_size_ext(dev); |
1165 | 1157 | ||
1166 | pos = pci_pcie_cap(dev); | 1158 | if (!pci_is_pcie(dev)) { |
1167 | if (!pos) { | ||
1168 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 1159 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
1169 | if (!pos) | 1160 | if (!pos) |
1170 | goto fail; | 1161 | goto fail; |
@@ -1386,9 +1377,9 @@ static int only_one_child(struct pci_bus *bus) | |||
1386 | 1377 | ||
1387 | if (!parent || !pci_is_pcie(parent)) | 1378 | if (!parent || !pci_is_pcie(parent)) |
1388 | return 0; | 1379 | return 0; |
1389 | if (parent->pcie_type == PCI_EXP_TYPE_ROOT_PORT) | 1380 | if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT) |
1390 | return 1; | 1381 | return 1; |
1391 | if (parent->pcie_type == PCI_EXP_TYPE_DOWNSTREAM && | 1382 | if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM && |
1392 | !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS)) | 1383 | !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS)) |
1393 | return 1; | 1384 | return 1; |
1394 | return 0; | 1385 | return 0; |
@@ -1465,7 +1456,7 @@ static int pcie_find_smpss(struct pci_dev *dev, void *data) | |||
1465 | */ | 1456 | */ |
1466 | if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || | 1457 | if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || |
1467 | (dev->bus->self && | 1458 | (dev->bus->self && |
1468 | dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT))) | 1459 | pci_pcie_type(dev->bus->self) != PCI_EXP_TYPE_ROOT_PORT))) |
1469 | *smpss = 0; | 1460 | *smpss = 0; |
1470 | 1461 | ||
1471 | if (*smpss > dev->pcie_mpss) | 1462 | if (*smpss > dev->pcie_mpss) |
@@ -1481,7 +1472,8 @@ static void pcie_write_mps(struct pci_dev *dev, int mps) | |||
1481 | if (pcie_bus_config == PCIE_BUS_PERFORMANCE) { | 1472 | if (pcie_bus_config == PCIE_BUS_PERFORMANCE) { |
1482 | mps = 128 << dev->pcie_mpss; | 1473 | mps = 128 << dev->pcie_mpss; |
1483 | 1474 | ||
1484 | if (dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && dev->bus->self) | 1475 | if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT && |
1476 | dev->bus->self) | ||
1485 | /* For "Performance", the assumption is made that | 1477 | /* For "Performance", the assumption is made that |
1486 | * downstream communication will never be larger than | 1478 | * downstream communication will never be larger than |
1487 | * the MRRS. So, the MPS only needs to be configured | 1479 | * the MRRS. So, the MPS only needs to be configured |