aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2010-03-16 17:52:58 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-03-24 16:21:35 -0400
commit99ddd552fef7e6e3b7dc76ba8fee9ea5869d1e14 (patch)
treeefdfc780d0993ab3e62888000bd3ff5f38508602 /drivers/pci
parent966f3a7570447c5025d67a618d408e68a3ae3167 (diff)
PCI: break out primary/secondary/subordinate for readability
No functional change; just add names for the primary/secondary/subordinate bus numbers read from config space rather than repeatedly masking/shifting. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/probe.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2a943090a3b7..7feacf521e14 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -673,16 +673,20 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
673 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); 673 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
674 u32 buses, i, j = 0; 674 u32 buses, i, j = 0;
675 u16 bctl; 675 u16 bctl;
676 u8 primary, secondary, subordinate;
676 int broken = 0; 677 int broken = 0;
677 678
678 pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); 679 pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
680 primary = buses & 0xFF;
681 secondary = (buses >> 8) & 0xFF;
682 subordinate = (buses >> 16) & 0xFF;
679 683
680 dev_dbg(&dev->dev, "scanning behind bridge, config %06x, pass %d\n", 684 dev_dbg(&dev->dev, "scanning [bus %02x-%02x] behind bridge, pass %d\n",
681 buses & 0xffffff, pass); 685 secondary, subordinate, pass);
682 686
683 /* Check if setup is sensible at all */ 687 /* Check if setup is sensible at all */
684 if (!pass && 688 if (!pass &&
685 ((buses & 0xff) != bus->number || ((buses >> 8) & 0xff) <= bus->number)) { 689 (primary != bus->number || secondary <= bus->number)) {
686 dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n"); 690 dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n");
687 broken = 1; 691 broken = 1;
688 } 692 }
@@ -693,15 +697,15 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
693 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, 697 pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
694 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); 698 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
695 699
696 if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus && !broken) { 700 if ((secondary || subordinate) && !pcibios_assign_all_busses() &&
697 unsigned int cmax, busnr; 701 !is_cardbus && !broken) {
702 unsigned int cmax;
698 /* 703 /*
699 * Bus already configured by firmware, process it in the first 704 * Bus already configured by firmware, process it in the first
700 * pass and just note the configuration. 705 * pass and just note the configuration.
701 */ 706 */
702 if (pass) 707 if (pass)
703 goto out; 708 goto out;
704 busnr = (buses >> 8) & 0xFF;
705 709
706 /* 710 /*
707 * If we already got to this bus through a different bridge, 711 * If we already got to this bus through a different bridge,
@@ -710,13 +714,13 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
710 * However, we continue to descend down the hierarchy and 714 * However, we continue to descend down the hierarchy and
711 * scan remaining child buses. 715 * scan remaining child buses.
712 */ 716 */
713 child = pci_find_bus(pci_domain_nr(bus), busnr); 717 child = pci_find_bus(pci_domain_nr(bus), secondary);
714 if (!child) { 718 if (!child) {
715 child = pci_add_new_bus(bus, dev, busnr); 719 child = pci_add_new_bus(bus, dev, secondary);
716 if (!child) 720 if (!child)
717 goto out; 721 goto out;
718 child->primary = buses & 0xFF; 722 child->primary = primary;
719 child->subordinate = (buses >> 16) & 0xFF; 723 child->subordinate = subordinate;
720 child->bridge_ctl = bctl; 724 child->bridge_ctl = bctl;
721 } 725 }
722 726