aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 15:14:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 15:14:47 -0500
commit193c0d682525987db59ac3a24531a77e4947aa95 (patch)
tree7b58346171c4d07e2c2ee6c3c469c325495149a4 /drivers/pci/probe.c
parent8b0cab14951fbf8126795ab301835a8f8126a988 (diff)
parent1cb73f8c479e66541fefd3f7fa547b1fa56cdc54 (diff)
Merge tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI update from Bjorn Helgaas: "Host bridge hotplug: - Untangle _PRT from struct pci_bus (Bjorn Helgaas) - Request _OSC control before scanning root bus (Taku Izumi) - Assign resources when adding host bridge (Yinghai Lu) - Remove root bus when removing host bridge (Yinghai Lu) - Remove _PRT during hot remove (Yinghai Lu) SRIOV - Add sysfs knobs to control numVFs (Don Dutile) Power management - Notify devices when power resource turned on (Huang Ying) Bug fixes - Work around broken _SEG on HP xw9300 (Bjorn Helgaas) - Keep runtime PM enabled for unbound PCI devices (Huang Ying) - Fix Optimus dual-GPU runtime D3 suspend issue (Dave Airlie) - Fix xen frontend shutdown issue (David Vrabel) - Work around PLX PCI 9050 BAR alignment erratum (Ian Abbott) Miscellaneous - Add GPL license for drivers/pci/ioapic (Andrew Cooks) - Add standard PCI-X, PCIe ASPM register #defines (Bjorn Helgaas) - NumaChip remote PCI support (Daniel Blueman) - Fix PCIe Link Capabilities Supported Link Speed definition (Jingoo Han) - Convert dev_printk() to dev_info(), etc (Joe Perches) - Add support for non PCI BAR ROM data (Matthew Garrett) - Add x86 support for host bridge translation offset (Mike Yoknis) - Report success only when every driver supports AER (Vijay Pandarathil)" Fix up trivial conflicts. * tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (48 commits) PCI: Use phys_addr_t for physical ROM address x86/PCI: Add NumaChip remote PCI support ath9k: Use standard #defines for PCIe Capability ASPM fields iwlwifi: Use standard #defines for PCIe Capability ASPM fields iwlwifi: collapse wrapper for pcie_capability_read_word() iwlegacy: Use standard #defines for PCIe Capability ASPM fields iwlegacy: collapse wrapper for pcie_capability_read_word() cxgb3: Use standard #defines for PCIe Capability ASPM fields PCI: Add standard PCIe Capability Link ASPM field names PCI/portdrv: Use PCI Express Capability accessors PCI: Use standard PCIe Capability Link register field names x86: Use PCI setup data PCI: Add support for non-BAR ROMs PCI: Add pcibios_add_device EFI: Stash ROMs if they're not in the PCI BAR PCI: Add and use standard PCI-X Capability register names PCI/PM: Keep runtime PM enabled for unbound PCI devices xen-pcifront: Handle backend CLOSED without CLOSING PCI: SRIOV control and status via sysfs (documentation) PCI/AER: Report success only when every device has AER-aware driver ...
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 3683f6094e3f..6186f03d84f3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -521,7 +521,7 @@ static unsigned char pcie_link_speed[] = {
521 521
522void pcie_update_link_speed(struct pci_bus *bus, u16 linksta) 522void pcie_update_link_speed(struct pci_bus *bus, u16 linksta)
523{ 523{
524 bus->cur_bus_speed = pcie_link_speed[linksta & 0xf]; 524 bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS];
525} 525}
526EXPORT_SYMBOL_GPL(pcie_update_link_speed); 526EXPORT_SYMBOL_GPL(pcie_update_link_speed);
527 527
@@ -579,14 +579,16 @@ static void pci_set_bus_speed(struct pci_bus *bus)
579 if (pos) { 579 if (pos) {
580 u16 status; 580 u16 status;
581 enum pci_bus_speed max; 581 enum pci_bus_speed max;
582 pci_read_config_word(bridge, pos + 2, &status);
583 582
584 if (status & 0x8000) { 583 pci_read_config_word(bridge, pos + PCI_X_BRIDGE_SSTATUS,
584 &status);
585
586 if (status & PCI_X_SSTATUS_533MHZ) {
585 max = PCI_SPEED_133MHz_PCIX_533; 587 max = PCI_SPEED_133MHz_PCIX_533;
586 } else if (status & 0x4000) { 588 } else if (status & PCI_X_SSTATUS_266MHZ) {
587 max = PCI_SPEED_133MHz_PCIX_266; 589 max = PCI_SPEED_133MHz_PCIX_266;
588 } else if (status & 0x0002) { 590 } else if (status & PCI_X_SSTATUS_133MHZ) {
589 if (((status >> 12) & 0x3) == 2) { 591 if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) {
590 max = PCI_SPEED_133MHz_PCIX_ECC; 592 max = PCI_SPEED_133MHz_PCIX_ECC;
591 } else { 593 } else {
592 max = PCI_SPEED_133MHz_PCIX; 594 max = PCI_SPEED_133MHz_PCIX;
@@ -596,7 +598,8 @@ static void pci_set_bus_speed(struct pci_bus *bus)
596 } 598 }
597 599
598 bus->max_bus_speed = max; 600 bus->max_bus_speed = max;
599 bus->cur_bus_speed = pcix_bus_speed[(status >> 6) & 0xf]; 601 bus->cur_bus_speed = pcix_bus_speed[
602 (status & PCI_X_SSTATUS_FREQ) >> 6];
600 603
601 return; 604 return;
602 } 605 }
@@ -607,7 +610,7 @@ static void pci_set_bus_speed(struct pci_bus *bus)
607 u16 linksta; 610 u16 linksta;
608 611
609 pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap); 612 pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap);
610 bus->max_bus_speed = pcie_link_speed[linkcap & 0xf]; 613 bus->max_bus_speed = pcie_link_speed[linkcap & PCI_EXP_LNKCAP_SLS];
611 614
612 pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta); 615 pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta);
613 pcie_update_link_speed(bus, linksta); 616 pcie_update_link_speed(bus, linksta);
@@ -975,6 +978,7 @@ int pci_setup_device(struct pci_dev *dev)
975 dev->sysdata = dev->bus->sysdata; 978 dev->sysdata = dev->bus->sysdata;
976 dev->dev.parent = dev->bus->bridge; 979 dev->dev.parent = dev->bus->bridge;
977 dev->dev.bus = &pci_bus_type; 980 dev->dev.bus = &pci_bus_type;
981 dev->dev.type = &pci_dev_type;
978 dev->hdr_type = hdr_type & 0x7f; 982 dev->hdr_type = hdr_type & 0x7f;
979 dev->multifunction = !!(hdr_type & 0x80); 983 dev->multifunction = !!(hdr_type & 0x80);
980 dev->error_state = pci_channel_io_normal; 984 dev->error_state = pci_channel_io_normal;
@@ -1889,6 +1893,28 @@ unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge)
1889 return max; 1893 return max;
1890} 1894}
1891 1895
1896/**
1897 * pci_rescan_bus - scan a PCI bus for devices.
1898 * @bus: PCI bus to scan
1899 *
1900 * Scan a PCI bus and child buses for new devices, adds them,
1901 * and enables them.
1902 *
1903 * Returns the max number of subordinate bus discovered.
1904 */
1905unsigned int __ref pci_rescan_bus(struct pci_bus *bus)
1906{
1907 unsigned int max;
1908
1909 max = pci_scan_child_bus(bus);
1910 pci_assign_unassigned_bus_resources(bus);
1911 pci_enable_bridges(bus);
1912 pci_bus_add_devices(bus);
1913
1914 return max;
1915}
1916EXPORT_SYMBOL_GPL(pci_rescan_bus);
1917
1892EXPORT_SYMBOL(pci_add_new_bus); 1918EXPORT_SYMBOL(pci_add_new_bus);
1893EXPORT_SYMBOL(pci_scan_slot); 1919EXPORT_SYMBOL(pci_scan_slot);
1894EXPORT_SYMBOL(pci_scan_bridge); 1920EXPORT_SYMBOL(pci_scan_bridge);