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 6c143b4497ca..d8f513bdf95c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -603,10 +603,10 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
603 | u32 linkcap; | 603 | u32 linkcap; |
604 | u16 linksta; | 604 | u16 linksta; |
605 | 605 | ||
606 | pci_read_config_dword(bridge, pos + PCI_EXP_LNKCAP, &linkcap); | 606 | pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap); |
607 | bus->max_bus_speed = pcie_link_speed[linkcap & 0xf]; | 607 | bus->max_bus_speed = pcie_link_speed[linkcap & 0xf]; |
608 | 608 | ||
609 | pci_read_config_word(bridge, pos + PCI_EXP_LNKSTA, &linksta); | 609 | pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta); |
610 | pcie_update_link_speed(bus, linksta); | 610 | pcie_update_link_speed(bus, linksta); |
611 | } | 611 | } |
612 | } | 612 | } |
@@ -929,24 +929,16 @@ void set_pcie_port_type(struct pci_dev *pdev) | |||
929 | pdev->is_pcie = 1; | 929 | pdev->is_pcie = 1; |
930 | pdev->pcie_cap = pos; | 930 | pdev->pcie_cap = pos; |
931 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); | 931 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); |
932 | pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4; | 932 | pdev->pcie_flags_reg = reg16; |
933 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16); | 933 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16); |
934 | pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD; | 934 | pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD; |
935 | } | 935 | } |
936 | 936 | ||
937 | void set_pcie_hotplug_bridge(struct pci_dev *pdev) | 937 | void set_pcie_hotplug_bridge(struct pci_dev *pdev) |
938 | { | 938 | { |
939 | int pos; | ||
940 | u16 reg16; | ||
941 | u32 reg32; | 939 | u32 reg32; |
942 | 940 | ||
943 | pos = pci_pcie_cap(pdev); | 941 | pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, ®32); |
944 | if (!pos) | ||
945 | return; | ||
946 | pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); | ||
947 | if (!(reg16 & PCI_EXP_FLAGS_SLOT)) | ||
948 | return; | ||
949 | pci_read_config_dword(pdev, pos + PCI_EXP_SLTCAP, ®32); | ||
950 | if (reg32 & PCI_EXP_SLTCAP_HPC) | 942 | if (reg32 & PCI_EXP_SLTCAP_HPC) |
951 | pdev->is_hotplug_bridge = 1; | 943 | pdev->is_hotplug_bridge = 1; |
952 | } | 944 | } |
@@ -1160,8 +1152,7 @@ int pci_cfg_space_size(struct pci_dev *dev) | |||
1160 | if (class == PCI_CLASS_BRIDGE_HOST) | 1152 | if (class == PCI_CLASS_BRIDGE_HOST) |
1161 | return pci_cfg_space_size_ext(dev); | 1153 | return pci_cfg_space_size_ext(dev); |
1162 | 1154 | ||
1163 | pos = pci_pcie_cap(dev); | 1155 | if (!pci_is_pcie(dev)) { |
1164 | if (!pos) { | ||
1165 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 1156 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
1166 | if (!pos) | 1157 | if (!pos) |
1167 | goto fail; | 1158 | goto fail; |
@@ -1383,9 +1374,9 @@ static int only_one_child(struct pci_bus *bus) | |||
1383 | 1374 | ||
1384 | if (!parent || !pci_is_pcie(parent)) | 1375 | if (!parent || !pci_is_pcie(parent)) |
1385 | return 0; | 1376 | return 0; |
1386 | if (parent->pcie_type == PCI_EXP_TYPE_ROOT_PORT) | 1377 | if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT) |
1387 | return 1; | 1378 | return 1; |
1388 | if (parent->pcie_type == PCI_EXP_TYPE_DOWNSTREAM && | 1379 | if (pci_pcie_type(parent) == PCI_EXP_TYPE_DOWNSTREAM && |
1389 | !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS)) | 1380 | !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS)) |
1390 | return 1; | 1381 | return 1; |
1391 | return 0; | 1382 | return 0; |
@@ -1462,7 +1453,7 @@ static int pcie_find_smpss(struct pci_dev *dev, void *data) | |||
1462 | */ | 1453 | */ |
1463 | if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || | 1454 | if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || |
1464 | (dev->bus->self && | 1455 | (dev->bus->self && |
1465 | dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT))) | 1456 | pci_pcie_type(dev->bus->self) != PCI_EXP_TYPE_ROOT_PORT))) |
1466 | *smpss = 0; | 1457 | *smpss = 0; |
1467 | 1458 | ||
1468 | if (*smpss > dev->pcie_mpss) | 1459 | if (*smpss > dev->pcie_mpss) |
@@ -1478,7 +1469,8 @@ static void pcie_write_mps(struct pci_dev *dev, int mps) | |||
1478 | if (pcie_bus_config == PCIE_BUS_PERFORMANCE) { | 1469 | if (pcie_bus_config == PCIE_BUS_PERFORMANCE) { |
1479 | mps = 128 << dev->pcie_mpss; | 1470 | mps = 128 << dev->pcie_mpss; |
1480 | 1471 | ||
1481 | if (dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && dev->bus->self) | 1472 | if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT && |
1473 | dev->bus->self) | ||
1482 | /* For "Performance", the assumption is made that | 1474 | /* For "Performance", the assumption is made that |
1483 | * downstream communication will never be larger than | 1475 | * downstream communication will never be larger than |
1484 | * the MRRS. So, the MPS only needs to be configured | 1476 | * the MRRS. So, the MPS only needs to be configured |