aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c62
1 files changed, 43 insertions, 19 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ec909afa90b6..6186f03d84f3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -305,7 +305,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
305 } 305 }
306} 306}
307 307
308static void __devinit pci_read_bridge_io(struct pci_bus *child) 308static void pci_read_bridge_io(struct pci_bus *child)
309{ 309{
310 struct pci_dev *dev = child->self; 310 struct pci_dev *dev = child->self;
311 u8 io_base_lo, io_limit_lo; 311 u8 io_base_lo, io_limit_lo;
@@ -345,7 +345,7 @@ static void __devinit pci_read_bridge_io(struct pci_bus *child)
345 } 345 }
346} 346}
347 347
348static void __devinit pci_read_bridge_mmio(struct pci_bus *child) 348static void pci_read_bridge_mmio(struct pci_bus *child)
349{ 349{
350 struct pci_dev *dev = child->self; 350 struct pci_dev *dev = child->self;
351 u16 mem_base_lo, mem_limit_lo; 351 u16 mem_base_lo, mem_limit_lo;
@@ -367,7 +367,7 @@ static void __devinit pci_read_bridge_mmio(struct pci_bus *child)
367 } 367 }
368} 368}
369 369
370static void __devinit pci_read_bridge_mmio_pref(struct pci_bus *child) 370static void pci_read_bridge_mmio_pref(struct pci_bus *child)
371{ 371{
372 struct pci_dev *dev = child->self; 372 struct pci_dev *dev = child->self;
373 u16 mem_base_lo, mem_limit_lo; 373 u16 mem_base_lo, mem_limit_lo;
@@ -417,7 +417,7 @@ static void __devinit pci_read_bridge_mmio_pref(struct pci_bus *child)
417 } 417 }
418} 418}
419 419
420void __devinit pci_read_bridge_bases(struct pci_bus *child) 420void pci_read_bridge_bases(struct pci_bus *child)
421{ 421{
422 struct pci_dev *dev = child->self; 422 struct pci_dev *dev = child->self;
423 struct resource *res; 423 struct resource *res;
@@ -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);
@@ -705,7 +708,7 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
705 * them, we proceed to assigning numbers to the remaining buses in 708 * them, we proceed to assigning numbers to the remaining buses in
706 * order to avoid overlaps between old and new bus numbers. 709 * order to avoid overlaps between old and new bus numbers.
707 */ 710 */
708int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) 711int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
709{ 712{
710 struct pci_bus *child; 713 struct pci_bus *child;
711 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); 714 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
@@ -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;
@@ -1586,7 +1590,7 @@ void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss)
1586} 1590}
1587EXPORT_SYMBOL_GPL(pcie_bus_configure_settings); 1591EXPORT_SYMBOL_GPL(pcie_bus_configure_settings);
1588 1592
1589unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) 1593unsigned int pci_scan_child_bus(struct pci_bus *bus)
1590{ 1594{
1591 unsigned int devfn, pass, max = bus->busn_res.start; 1595 unsigned int devfn, pass, max = bus->busn_res.start;
1592 struct pci_dev *dev; 1596 struct pci_dev *dev;
@@ -1790,7 +1794,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
1790 res, ret ? "can not be" : "is"); 1794 res, ret ? "can not be" : "is");
1791} 1795}
1792 1796
1793struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, 1797struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
1794 struct pci_ops *ops, void *sysdata, struct list_head *resources) 1798 struct pci_ops *ops, void *sysdata, struct list_head *resources)
1795{ 1799{
1796 struct pci_host_bridge_window *window; 1800 struct pci_host_bridge_window *window;
@@ -1826,7 +1830,7 @@ struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
1826EXPORT_SYMBOL(pci_scan_root_bus); 1830EXPORT_SYMBOL(pci_scan_root_bus);
1827 1831
1828/* Deprecated; use pci_scan_root_bus() instead */ 1832/* Deprecated; use pci_scan_root_bus() instead */
1829struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, 1833struct pci_bus *pci_scan_bus_parented(struct device *parent,
1830 int bus, struct pci_ops *ops, void *sysdata) 1834 int bus, struct pci_ops *ops, void *sysdata)
1831{ 1835{
1832 LIST_HEAD(resources); 1836 LIST_HEAD(resources);
@@ -1844,7 +1848,7 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
1844} 1848}
1845EXPORT_SYMBOL(pci_scan_bus_parented); 1849EXPORT_SYMBOL(pci_scan_bus_parented);
1846 1850
1847struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 1851struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
1848 void *sysdata) 1852 void *sysdata)
1849{ 1853{
1850 LIST_HEAD(resources); 1854 LIST_HEAD(resources);
@@ -1864,7 +1868,6 @@ struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
1864} 1868}
1865EXPORT_SYMBOL(pci_scan_bus); 1869EXPORT_SYMBOL(pci_scan_bus);
1866 1870
1867#ifdef CONFIG_HOTPLUG
1868/** 1871/**
1869 * pci_rescan_bus_bridge_resize - scan a PCI bus for devices. 1872 * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
1870 * @bridge: PCI bridge for the bus to scan 1873 * @bridge: PCI bridge for the bus to scan
@@ -1890,11 +1893,32 @@ unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge)
1890 return max; 1893 return max;
1891} 1894}
1892 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
1893EXPORT_SYMBOL(pci_add_new_bus); 1918EXPORT_SYMBOL(pci_add_new_bus);
1894EXPORT_SYMBOL(pci_scan_slot); 1919EXPORT_SYMBOL(pci_scan_slot);
1895EXPORT_SYMBOL(pci_scan_bridge); 1920EXPORT_SYMBOL(pci_scan_bridge);
1896EXPORT_SYMBOL_GPL(pci_scan_child_bus); 1921EXPORT_SYMBOL_GPL(pci_scan_child_bus);
1897#endif
1898 1922
1899static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b) 1923static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b)
1900{ 1924{