Subject: [PATCH] PCI: Remove secondary/subordinate in pci_bus We already have busn_res in pci_bus, so remove the duplicated secondary/subordinate. Signed-off-by: Yinghai Lu --- arch/alpha/kernel/pci.c | 2 arch/arm/kernel/bios32.c | 2 arch/ia64/pci/pci.c | 2 arch/microblaze/pci/pci-common.c | 3 - arch/mips/pci/pci.c | 2 arch/powerpc/kernel/pci-common.c | 9 +-- arch/powerpc/kernel/pci_64.c | 2 arch/powerpc/kernel/pci_of_scan.c | 2 arch/powerpc/platforms/powernv/pci-ioda.c | 8 +- arch/powerpc/platforms/pseries/pci_dlpar.c | 2 arch/sh/drivers/pci/pci.c | 2 arch/sparc/kernel/pci.c | 4 - arch/tile/kernel/pci.c | 9 ++- arch/x86/pci/acpi.c | 2 arch/xtensa/kernel/pci.c | 2 drivers/iommu/intel-iommu.c | 2 drivers/net/ethernet/broadcom/tg3.c | 4 - drivers/parisc/dino.c | 13 ++-- drivers/parisc/iosapic.c | 2 drivers/parisc/lba_pci.c | 23 ++++---- drivers/pci/hotplug-pci.c | 2 drivers/pci/hotplug/acpiphp_glue.c | 8 +- drivers/pci/hotplug/shpchp_sysfs.c | 6 +- drivers/pci/iov.c | 4 - drivers/pci/pci.c | 2 drivers/pci/probe.c | 83 +++++++++++++---------------- drivers/pci/setup-bus.c | 22 +++---- drivers/pcmcia/cardbus.c | 2 drivers/pcmcia/yenta_socket.c | 4 - include/linux/pci.h | 2 30 files changed, 112 insertions(+), 120 deletions(-) Index: linux-2.6/arch/alpha/kernel/pci.c =================================================================== --- linux-2.6.orig/arch/alpha/kernel/pci.c +++ linux-2.6/arch/alpha/kernel/pci.c @@ -359,7 +359,7 @@ common_init_pci(void) hose, &resources); hose->bus = bus; hose->need_domain_info = need_domain_info; - next_busno = bus->subordinate + 1; + next_busno = bus->busn_res.end + 1; /* Don't allow 8-bit bus number overflow inside the hose - reserve some space for bridges. */ if (next_busno > 224) { Index: linux-2.6/arch/arm/kernel/bios32.c =================================================================== --- linux-2.6.orig/arch/arm/kernel/bios32.c +++ linux-2.6/arch/arm/kernel/bios32.c @@ -445,7 +445,7 @@ static void __init pcibios_init_hw(struc if (!sys->bus) panic("PCI: unable to scan bus!"); - busnr = sys->bus->subordinate + 1; + busnr = sys->bus->busn_res.end + 1; list_add(&sys->node, &hw->buses); } else { Index: linux-2.6/arch/ia64/pci/pci.c =================================================================== --- linux-2.6.orig/arch/ia64/pci/pci.c +++ linux-2.6/arch/ia64/pci/pci.c @@ -386,7 +386,7 @@ pci_acpi_scan_root(struct acpi_pci_root return NULL; } - pbus->subordinate = pci_scan_child_bus(pbus); + pci_scan_child_bus(pbus); return pbus; out3: Index: linux-2.6/arch/microblaze/pci/pci-common.c =================================================================== --- linux-2.6.orig/arch/microblaze/pci/pci-common.c +++ linux-2.6/arch/microblaze/pci/pci-common.c @@ -1505,10 +1505,9 @@ static void __devinit pcibios_scan_phb(s pci_free_resource_list(&resources); return; } - bus->secondary = hose->first_busno; hose->bus = bus; - hose->last_busno = bus->subordinate; + hose->last_busno = bus->busn_res.end; } static int __init pcibios_init(void) Index: linux-2.6/arch/mips/pci/pci.c =================================================================== --- linux-2.6.orig/arch/mips/pci/pci.c +++ linux-2.6/arch/mips/pci/pci.c @@ -101,7 +101,7 @@ static void __devinit pcibios_scanbus(st need_domain_info = need_domain_info || hose->index; hose->need_domain_info = need_domain_info; if (bus) { - next_busno = bus->subordinate + 1; + next_busno = bus->busn_res.end + 1; /* Don't allow 8-bit bus number overflow inside the hose - reserve some space for bridges. */ if (next_busno > 224) { Index: linux-2.6/arch/powerpc/kernel/pci-common.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/pci-common.c +++ linux-2.6/arch/powerpc/kernel/pci-common.c @@ -1651,7 +1651,6 @@ void __devinit pcibios_scan_phb(struct p pci_free_resource_list(&resources); return; } - bus->secondary = hose->first_busno; hose->bus = bus; /* Get probe mode and perform scan */ @@ -1659,15 +1658,13 @@ void __devinit pcibios_scan_phb(struct p if (node && ppc_md.pci_probe_mode) mode = ppc_md.pci_probe_mode(bus); pr_debug(" probe mode: %d\n", mode); - if (mode == PCI_PROBE_DEVTREE) { - bus->subordinate = hose->last_busno; + if (mode == PCI_PROBE_DEVTREE) of_scan_bus(node, bus); - } if (mode == PCI_PROBE_NORMAL) { pci_bus_update_busn_res_end(bus, 255); - hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); - pci_bus_update_busn_res_end(bus, bus->subordinate); + hose->last_busno = pci_scan_child_bus(bus); + pci_bus_update_busn_res_end(bus, hose->last_busno); } /* Platform gets a chance to do some global fixups before Index: linux-2.6/arch/powerpc/kernel/pci_64.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/pci_64.c +++ linux-2.6/arch/powerpc/kernel/pci_64.c @@ -236,7 +236,7 @@ long sys_pciconfig_iobase(long which, un for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { bus = pci_bus_b(ln); - if (in_bus >= bus->number && in_bus <= bus->subordinate) + if (in_bus >= bus->number && in_bus <= bus->busn_res.end) break; bus = NULL; } Index: linux-2.6/arch/powerpc/kernel/pci_of_scan.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/pci_of_scan.c +++ linux-2.6/arch/powerpc/kernel/pci_of_scan.c @@ -240,7 +240,7 @@ void __devinit of_scan_pci_bridge(struct } bus->primary = dev->bus->number; - bus->subordinate = busrange[1]; + pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); bus->bridge_ctl = 0; /* parse ranges property */ Index: linux-2.6/arch/powerpc/platforms/powernv/pci-ioda.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/powernv/pci-ioda.c +++ linux-2.6/arch/powerpc/platforms/powernv/pci-ioda.c @@ -589,7 +589,7 @@ static int __devinit pnv_ioda_configure_ dcomp = OPAL_IGNORE_RID_DEVICE_NUMBER; fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER; parent = pe->pbus->self; - count = pe->pbus->subordinate - pe->pbus->secondary + 1; + count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1; switch(count) { case 1: bcomp = OpalPciBusAll; break; case 2: bcomp = OpalPciBus7Bits; break; @@ -816,11 +816,11 @@ static void __devinit pnv_ioda_setup_bus pe->pdev = NULL; pe->tce32_seg = -1; pe->mve_number = -1; - pe->rid = bus->secondary << 8; + pe->rid = bus->busn_res.start << 8; pe->dma_weight = 0; - pe_info(pe, "Secondary busses %d..%d associated with PE\n", - bus->secondary, bus->subordinate); + pe_info(pe, "Secondary busses %pR associated with PE\n", + &bus->busn_res); if (pnv_ioda_configure_pe(phb, pe)) { /* XXX What do we do here ? */ Index: linux-2.6/arch/powerpc/platforms/pseries/pci_dlpar.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/pseries/pci_dlpar.c +++ linux-2.6/arch/powerpc/platforms/pseries/pci_dlpar.c @@ -121,7 +121,7 @@ void pcibios_add_pci_devices(struct pci_ if (!num) return; pcibios_setup_bus_devices(bus); - max = bus->secondary; + max = bus->busn_res.start; for (pass=0; pass < 2; pass++) list_for_each_entry(dev, &bus->devices, bus_list) { if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || Index: linux-2.6/arch/sh/drivers/pci/pci.c =================================================================== --- linux-2.6.orig/arch/sh/drivers/pci/pci.c +++ linux-2.6/arch/sh/drivers/pci/pci.c @@ -59,7 +59,7 @@ static void __devinit pcibios_scanbus(st need_domain_info = need_domain_info || hose->index; hose->need_domain_info = need_domain_info; if (bus) { - next_busno = bus->subordinate + 1; + next_busno = bus->busn_res.end + 1; /* Don't allow 8-bit bus number overflow inside the hose - reserve some space for bridges. */ if (next_busno > 224) { Index: linux-2.6/arch/sparc/kernel/pci.c =================================================================== --- linux-2.6.orig/arch/sparc/kernel/pci.c +++ linux-2.6/arch/sparc/kernel/pci.c @@ -535,7 +535,7 @@ static void __devinit of_scan_pci_bridge } bus->primary = dev->bus->number; - bus->subordinate = busrange[1]; + pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); bus->bridge_ctl = 0; /* parse ranges property, or cook one up by hand for Simba */ @@ -697,8 +697,6 @@ struct pci_bus * __devinit pci_scan_one_ pci_free_resource_list(&resources); return NULL; } - bus->secondary = pbm->pci_first_busno; - bus->subordinate = pbm->pci_last_busno; pci_of_scan_bus(pbm, node, bus); pci_bus_add_devices(bus); Index: linux-2.6/arch/tile/kernel/pci.c =================================================================== --- linux-2.6.orig/arch/tile/kernel/pci.c +++ linux-2.6/arch/tile/kernel/pci.c @@ -310,6 +310,7 @@ int __init pcibios_init(void) if (pci_scan_flags[i] == 0 && controllers[i].ops != NULL) { struct pci_controller *controller = &controllers[i]; struct pci_bus *bus; + LIST_HEAD(resources); if (tile_init_irqs(i, controller)) { pr_err("PCI: Could not initialize IRQs\n"); @@ -327,9 +328,11 @@ int __init pcibios_init(void) * This is inlined in linux/pci.h and calls into * pci_scan_bus_parented() in probe.c. */ - bus = pci_scan_bus(0, controller->ops, controller); + pci_add_resource(&resources, &ioport_resource); + pci_add_resource(&resources, &iomem_resource); + bus = pci_scan_root_bus(NULL, 0, controller->ops, controller, &resources); controller->root_bus = bus; - controller->last_busno = bus->subordinate; + controller->last_busno = bus->busn_res.end; } } @@ -366,7 +369,7 @@ int __init pcibios_init(void) */ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && (PCI_SLOT(dev->devfn) == 0)) { - next_bus = dev->subordinate; + next_bus = dev->busn_res.end; controllers[i].mem_resources[0] = *next_bus->resource[0]; controllers[i].mem_resources[1] = Index: linux-2.6/arch/x86/pci/acpi.c =================================================================== --- linux-2.6.orig/arch/x86/pci/acpi.c +++ linux-2.6/arch/x86/pci/acpi.c @@ -451,7 +451,7 @@ struct pci_bus * __devinit pci_acpi_scan bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd, &resources); if (bus) { - bus->subordinate = pci_scan_child_bus(bus); + pci_scan_child_bus(bus); pci_set_host_bridge_release( to_pci_host_bridge(bus->bridge), release_pci_root_info, info); Index: linux-2.6/arch/xtensa/kernel/pci.c =================================================================== --- linux-2.6.orig/arch/xtensa/kernel/pci.c +++ linux-2.6/arch/xtensa/kernel/pci.c @@ -187,7 +187,7 @@ static int __init pcibios_init(void) bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno, pci_ctrl->ops, pci_ctrl, &resources); pci_ctrl->bus = bus; - pci_ctrl->last_busno = bus->subordinate; + pci_ctrl->last_busno = bus->busn_res.end; if (next_busno <= pci_ctrl->last_busno) next_busno = pci_ctrl->last_busno+1; } Index: linux-2.6/drivers/iommu/intel-iommu.c =================================================================== --- linux-2.6.orig/drivers/iommu/intel-iommu.c +++ linux-2.6/drivers/iommu/intel-iommu.c @@ -660,7 +660,7 @@ static struct intel_iommu *device_to_iom if (drhd->devices[i] && drhd->devices[i]->subordinate && drhd->devices[i]->subordinate->number <= bus && - drhd->devices[i]->subordinate->subordinate >= bus) + drhd->devices[i]->subordinate->busn_res.end >= bus) return drhd->iommu; } Index: linux-2.6/drivers/net/ethernet/broadcom/tg3.c =================================================================== --- linux-2.6.orig/drivers/net/ethernet/broadcom/tg3.c +++ linux-2.6/drivers/net/ethernet/broadcom/tg3.c @@ -14196,7 +14196,7 @@ static int __devinit tg3_get_invariants( if (bridge->subordinate && (bridge->subordinate->number <= tp->pdev->bus->number) && - (bridge->subordinate->subordinate >= + (bridge->subordinate->busn_res.end >= tp->pdev->bus->number)) { tg3_flag_set(tp, 5701_DMA_BUG); pci_dev_put(bridge); @@ -14224,7 +14224,7 @@ static int __devinit tg3_get_invariants( if (bridge && bridge->subordinate && (bridge->subordinate->number <= tp->pdev->bus->number) && - (bridge->subordinate->subordinate >= + (bridge->subordinate->busn_res.end >= tp->pdev->bus->number)) { tg3_flag_set(tp, 40BIT_DMA_BUG); pci_dev_put(bridge); Index: linux-2.6/drivers/parisc/dino.c =================================================================== --- linux-2.6.orig/drivers/parisc/dino.c +++ linux-2.6/drivers/parisc/dino.c @@ -174,7 +174,7 @@ static int dino_cfg_read(struct pci_bus int size, u32 *val) { struct dino_device *d = DINO_DEV(parisc_walk_tree(bus->bridge)); - u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; + u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; u32 v = DINO_CFG_TOK(local_bus, devfn, where & ~3); void __iomem *base_addr = d->hba.base_addr; unsigned long flags; @@ -209,7 +209,7 @@ static int dino_cfg_write(struct pci_bus int size, u32 val) { struct dino_device *d = DINO_DEV(parisc_walk_tree(bus->bridge)); - u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; + u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; u32 v = DINO_CFG_TOK(local_bus, devfn, where & ~3); void __iomem *base_addr = d->hba.base_addr; unsigned long flags; @@ -554,7 +554,7 @@ dino_fixup_bus(struct pci_bus *bus) struct dino_device *dino_dev = DINO_DEV(parisc_walk_tree(bus->bridge)); DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", - __func__, bus, bus->secondary, + __func__, bus, bus->busn_res.start, bus->bridge->platform_data); /* Firmware doesn't set up card-mode dino, so we have to */ @@ -898,6 +898,7 @@ static int __init dino_probe(struct pari LIST_HEAD(resources); struct pci_bus *bus; unsigned long hpa = dev->hpa.start; + int max; name = "Dino"; if (is_card_dino(&dev->id)) { @@ -1002,13 +1003,13 @@ static int __init dino_probe(struct pari return 0; } - pci_bus_update_busn_res_end(bus, bus->subordinate); - bus->subordinate = pci_scan_child_bus(bus); + max = pci_scan_child_bus(bus); + pci_bus_update_busn_res_end(bus, max); /* This code *depends* on scanning being single threaded * if it isn't, this global bus number count will fail */ - dino_current_bus = bus->subordinate + 1; + dino_current_bus = max + 1; pci_bus_assign_resources(bus); pci_bus_add_devices(bus); return 0; Index: linux-2.6/drivers/parisc/iosapic.c =================================================================== --- linux-2.6.orig/drivers/parisc/iosapic.c +++ linux-2.6/drivers/parisc/iosapic.c @@ -532,7 +532,7 @@ iosapic_xlate_pin(struct iosapic_info *i intr_slot = PCI_SLOT(pcidev->devfn); } DBG_IRT("iosapic_xlate_pin: bus %d slot %d pin %d\n", - pcidev->bus->secondary, intr_slot, intr_pin); + pcidev->bus->busn_res.start, intr_slot, intr_pin); return irt_find_irqline(isi, intr_slot, intr_pin); } Index: linux-2.6/drivers/parisc/lba_pci.c =================================================================== --- linux-2.6.orig/drivers/parisc/lba_pci.c +++ linux-2.6/drivers/parisc/lba_pci.c @@ -189,8 +189,8 @@ lba_dump_res(struct resource *r, int d) static int lba_device_present(u8 bus, u8 dfn, struct lba_device *d) { - u8 first_bus = d->hba.hba_bus->secondary; - u8 last_sub_bus = d->hba.hba_bus->subordinate; + u8 first_bus = d->hba.hba_bus->busn_res.start; + u8 last_sub_bus = d->hba.hba_bus->busn_res.end; if ((bus < first_bus) || (bus > last_sub_bus) || @@ -364,7 +364,7 @@ lba_rd_cfg(struct lba_device *d, u32 tok static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data) { struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); - u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; + u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; u32 tok = LBA_CFG_TOK(local_bus, devfn); void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; @@ -380,7 +380,7 @@ static int elroy_cfg_read(struct pci_bus return 0; } - if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { + if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->busn_res.start, devfn, d)) { DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __func__, tok, pos); /* either don't want to look or know device isn't present. */ *data = ~0U; @@ -431,7 +431,7 @@ lba_wr_cfg(struct lba_device *d, u32 tok static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data) { struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); - u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; + u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; u32 tok = LBA_CFG_TOK(local_bus,devfn); if ((pos > 255) || (devfn > 255)) @@ -444,7 +444,7 @@ static int elroy_cfg_write(struct pci_bu return 0; } - if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { + if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->busn_res.start, devfn, d))) { DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __func__, tok, pos,data); return 1; /* New Workaround */ } @@ -481,7 +481,7 @@ static struct pci_ops elroy_cfg_ops = { static int mercury_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data) { struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); - u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; + u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; u32 tok = LBA_CFG_TOK(local_bus, devfn); void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; @@ -514,7 +514,7 @@ static int mercury_cfg_write(struct pci_ { struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; - u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; + u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; u32 tok = LBA_CFG_TOK(local_bus,devfn); if ((pos > 255) || (devfn > 255)) @@ -636,7 +636,7 @@ lba_fixup_bus(struct pci_bus *bus) struct lba_device *ldev = LBA_DEV(parisc_walk_tree(bus->bridge)); DBG("lba_fixup_bus(0x%p) bus %d platform_data 0x%p\n", - bus, bus->secondary, bus->bridge->platform_data); + bus, (int)bus->busn_res.start, bus->bridge->platform_data); /* ** Properly Setup MMIO resources for this bus. @@ -1366,6 +1366,7 @@ lba_driver_probe(struct parisc_device *d void *tmp_obj; char *version; void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096); + int max; /* Read HW Rev First */ func_class = READ_REG32(addr + LBA_FCLASS); @@ -1514,7 +1515,7 @@ lba_driver_probe(struct parisc_device *d return 0; } - lba_bus->subordinate = pci_scan_child_bus(lba_bus); + max = pci_scan_child_bus(lba_bus); /* This is in lieu of calling pci_assign_unassigned_resources() */ if (is_pdc_pat()) { @@ -1544,7 +1545,7 @@ lba_driver_probe(struct parisc_device *d lba_dev->flags |= LBA_FLAG_SKIP_PROBE; } - lba_next_bus = lba_bus->subordinate + 1; + lba_next_bus = max + 1; pci_bus_add_devices(lba_bus); /* Whew! Finally done! Tell services we got this one covered. */ Index: linux-2.6/drivers/pci/hotplug-pci.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug-pci.c +++ linux-2.6/drivers/pci/hotplug-pci.c @@ -7,7 +7,7 @@ int __ref pci_hp_add_bridge(struct pci_dev *dev) { struct pci_bus *parent = dev->bus; - int pass, busnr = parent->secondary; + int pass, busnr = parent->busn_res.start; for (pass = 0; pass < 2; pass++) busnr = pci_scan_bridge(parent, dev, busnr, pass); Index: linux-2.6/drivers/pci/hotplug/acpiphp_glue.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/acpiphp_glue.c +++ linux-2.6/drivers/pci/hotplug/acpiphp_glue.c @@ -100,11 +100,11 @@ static int post_dock_fixups(struct notif PCI_PRIMARY_BUS, &buses); - if (((buses >> 8) & 0xff) != bus->secondary) { + if (((buses >> 8) & 0xff) != bus->busn_res.start) { buses = (buses & 0xff000000) | ((unsigned int)(bus->primary) << 0) - | ((unsigned int)(bus->secondary) << 8) - | ((unsigned int)(bus->subordinate) << 16); + | ((unsigned int)(bus->busn_res.start) << 8) + | ((unsigned int)(bus->busn_res.end) << 16); pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); } return NOTIFY_OK; @@ -628,7 +628,7 @@ static unsigned char acpiphp_max_busnr(s * bus->subordinate value because it could have * padding in it. */ - max = bus->secondary; + max = bus->busn_res.start; list_for_each(tmp, &bus->children) { n = pci_bus_max_busnr(pci_bus_b(tmp)); Index: linux-2.6/drivers/pci/hotplug/shpchp_sysfs.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/shpchp_sysfs.c +++ linux-2.6/drivers/pci/hotplug/shpchp_sysfs.c @@ -73,13 +73,13 @@ static ssize_t show_ctrl (struct device } } out += sprintf(out, "Free resources: bus numbers\n"); - for (busnr = bus->secondary; busnr <= bus->subordinate; busnr++) { + for (busnr = bus->busn_res.start; busnr <= bus->busn_res.end; busnr++) { if (!pci_find_bus(pci_domain_nr(bus), busnr)) break; } - if (busnr < bus->subordinate) + if (busnr < bus->busn_res.end) out += sprintf(out, "start = %8.8x, length = %8.8x\n", - busnr, (bus->subordinate - busnr)); + busnr, (int)(bus->busn_res.end - busnr)); return out - buf; } Index: linux-2.6/drivers/pci/iov.c =================================================================== --- linux-2.6.orig/drivers/pci/iov.c +++ linux-2.6/drivers/pci/iov.c @@ -47,7 +47,7 @@ static struct pci_bus *virtfn_add_bus(st if (!child) return NULL; - child->subordinate = busnr; + pci_bus_insert_busn_res(child, busnr, busnr); child->dev.parent = bus->bridge; rc = pci_bus_add_child(child); if (rc) { @@ -327,7 +327,7 @@ static int sriov_enable(struct pci_dev * iov->offset = offset; iov->stride = stride; - if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->subordinate) { + if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) { dev_err(&dev->dev, "SR-IOV: bus number out of range\n"); return -ENOMEM; } Index: linux-2.6/drivers/pci/pci.c =================================================================== --- linux-2.6.orig/drivers/pci/pci.c +++ linux-2.6/drivers/pci/pci.c @@ -109,7 +109,7 @@ unsigned char pci_bus_max_busnr(struct p struct list_head *tmp; unsigned char max, n; - max = bus->subordinate; + max = bus->busn_res.end; list_for_each(tmp, &bus->children) { n = pci_bus_max_busnr(pci_bus_b(tmp)); if(n > max) Index: linux-2.6/drivers/pci/probe.c =================================================================== --- linux-2.6.orig/drivers/pci/probe.c +++ linux-2.6/drivers/pci/probe.c @@ -388,8 +388,7 @@ void __devinit pci_read_bridge_bases(str if (pci_is_root_bus(child)) /* It's a host bus, nothing to read */ return; - dev_info(&dev->dev, "PCI bridge to [bus %02x-%02x]%s\n", - child->secondary, child->subordinate, + dev_info(&dev->dev, "PCI bridge to %pR%s\n", &child->busn_res, dev->transparent ? " (subtractive decode)" : ""); pci_bus_remove_resources(child); @@ -606,9 +605,8 @@ static struct pci_bus *pci_alloc_child_b * Set up the primary, secondary and subordinate * bus numbers. */ - child->number = child->secondary = busnr; - child->primary = parent->secondary; - child->subordinate = 0xff; + child->number = busnr; + child->primary = parent->busn_res.start; if (!bridge) return child; @@ -668,9 +666,8 @@ static void __devinit pci_bus_update_top res = &parent->busn_res; if (res == parent_res) break; - parent->subordinate += size; pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, - parent->subordinate); + parent->busn_res.end); dev_printk(KERN_DEBUG, &parent->dev, "busn_res: %s %02lx to %pR\n", (size > 0) ? "extended" : "shrunk", @@ -832,12 +829,12 @@ int __devinit pci_scan_bridge(struct pci * to see if the new setting good. */ if (primary != child->primary || - secondary != child->secondary || - subordinate != child->subordinate) { + secondary != child->busn_res.start || + subordinate != child->busn_res.end) { dev_info(&dev->dev, "someone changed bus register from pri:%02x, sec:%02x, sub:%02x to pri:%02x, sec:%02x, sub:%02x\n", - child->primary, child->secondary, - child->subordinate, + child->primary, (int)child->busn_res.start, + (int)child->busn_res.end, primary, secondary, subordinate); if (!list_empty(&dev->subordinate->devices)) { u32 old_buses; @@ -852,8 +849,8 @@ int __devinit pci_scan_bridge(struct pci */ old_buses = (buses & 0xff000000) | ((unsigned int)(child->primary) << 0) - | ((unsigned int)(child->secondary) << 8) - | ((unsigned int)(child->subordinate) << 16); + | ((unsigned int)(child->busn_res.start) << 8) + | ((unsigned int)(child->busn_res.end) << 16); pci_write_config_dword(dev, PCI_PRIMARY_BUS, old_buses); pci_stop_and_remove_behind_bridge(dev); @@ -901,7 +898,6 @@ int __devinit pci_scan_bridge(struct pci if (!child) goto out; child->primary = primary; - child->subordinate = subordinate; child->bridge_ctl = bctl; pci_bus_insert_busn_res(child, secondary, subordinate); @@ -910,8 +906,8 @@ int __devinit pci_scan_bridge(struct pci cmax = __pci_scan_child_bus(child, pass); if (cmax > max) max = cmax; - if (child->subordinate > max) - max = child->subordinate; + if (child->busn_res.end > max) + max = child->busn_res.end; } else { /* * We need to assign a number to this bus which we always @@ -965,15 +961,14 @@ int __devinit pci_scan_bridge(struct pci if (!child) goto out; - child->subordinate = busn_res.end; pci_bus_replace_busn_res(child, &busn_res); buses = (buses & 0xff000000) | ((unsigned int)(child->primary) << 0) - | ((unsigned int)(child->secondary) << 8) - | ((unsigned int)(child->subordinate) << 16); + | ((unsigned int)(child->busn_res.start) << 8) + | ((unsigned int)(child->busn_res.end) << 16); - max = child->subordinate; + max = child->busn_res.end; /* * yenta.c forces a secondary latency timer of 176. @@ -996,13 +991,12 @@ int __devinit pci_scan_bridge(struct pci /* * Set the subordinate bus number to its real value. */ - if (dev->is_hotplug_bridge && child->subordinate > max && - (max - child->secondary) < HOTPLUG_BRIDGE_RESERVE_BUSNR) - max = min_t(int, child->secondary + + if (dev->is_hotplug_bridge && child->busn_res.end > max && + (max - child->busn_res.start) < HOTPLUG_BRIDGE_RESERVE_BUSNR) + max = min_t(int, child->busn_res.start + HOTPLUG_BRIDGE_RESERVE_BUSNR, - child->subordinate); - shrink_size = child->subordinate - max; - child->subordinate = max; + child->busn_res.end); + shrink_size = (int)child->busn_res.end - max; pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); pci_bus_update_busn_res_end(child, max); @@ -1023,19 +1017,19 @@ int __devinit pci_scan_bridge(struct pci /* Has only triggered on CardBus, fixup is in yenta_socket */ while (bus->parent) { - if ((child->subordinate > bus->subordinate) || - (child->number > bus->subordinate) || + if ((child->busn_res.end > bus->busn_res.end) || + (child->number > bus->busn_res.end) || (child->number < bus->number) || - (child->subordinate < bus->number)) { - dev_info(&child->dev, "[bus %02x-%02x] %s " - "hidden behind%s bridge %s [bus %02x-%02x]\n", - child->number, child->subordinate, - (bus->number > child->subordinate && - bus->subordinate < child->number) ? + (child->busn_res.end < bus->number)) { + dev_info(&child->dev, "%pR %s " + "hidden behind%s bridge %s %pR\n", + &child->busn_res, + (bus->number > child->busn_res.end && + bus->busn_res.end < child->number) ? "wholly" : "partially", bus->self->transparent ? " transparent" : "", dev_name(&bus->dev), - bus->number, bus->subordinate); + &bus->busn_res); } bus = bus->parent; } @@ -1736,7 +1730,7 @@ EXPORT_SYMBOL_GPL(pcie_bus_configure_set static unsigned int __devinit __pci_scan_child_bus(struct pci_bus *bus, int pass) { - unsigned int devfn, max = bus->secondary; + unsigned int devfn, max = bus->busn_res.start; struct pci_dev *dev; dev_dbg(&bus->dev, "scanning bus pass %d\n", pass); @@ -1845,7 +1839,7 @@ struct pci_bus *pci_create_root_bus(stru /* Create legacy_io and legacy_mem files for this bus */ pci_create_legacy_files(b); - b->number = b->secondary = bus; + b->number = bus; if (parent) dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev)); @@ -1857,9 +1851,11 @@ struct pci_bus *pci_create_root_bus(stru list_move_tail(&window->list, &bridge->windows); res = window->res; offset = window->offset; - if (res->flags & IORESOURCE_BUS) + if (res->flags & IORESOURCE_BUS) { + if (bus != res->start) + res->start = bus; pci_bus_insert_busn_res(b, res->start, res->end); - else + } else pci_bus_add_resource(b, res, 0); if (offset) { if (resource_type(res) == IORESOURCE_IO) @@ -1947,6 +1943,7 @@ struct pci_bus * __devinit pci_scan_root struct pci_host_bridge_window *window, *n; struct resource *res; bool found; + int max; list_for_each_entry_safe(window, n, resources, list) { res = window->res; @@ -1967,10 +1964,10 @@ struct pci_bus * __devinit pci_scan_root pci_bus_insert_busn_res(b, bus, 255); } - b->subordinate = pci_scan_child_bus(b); + max = pci_scan_child_bus(b); if (!found) - pci_bus_update_busn_res_end(b, b->subordinate); + pci_bus_update_busn_res_end(b, max); pci_bus_add_devices(b); return b; @@ -1989,7 +1986,7 @@ struct pci_bus * __devinit pci_scan_bus_ pci_add_resource(&resources, &busn_resource); b = pci_create_root_bus(parent, bus, ops, sysdata, &resources); if (b) - b->subordinate = pci_scan_child_bus(b); + pci_scan_child_bus(b); else pci_free_resource_list(&resources); return b; @@ -2007,7 +2004,7 @@ struct pci_bus * __devinit pci_scan_bus( pci_add_resource(&resources, &busn_resource); b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources); if (b) { - b->subordinate = pci_scan_child_bus(b); + pci_scan_child_bus(b); pci_bus_add_devices(b); } else { pci_free_resource_list(&resources); Index: linux-2.6/drivers/pci/setup-bus.c =================================================================== --- linux-2.6.orig/drivers/pci/setup-bus.c +++ linux-2.6/drivers/pci/setup-bus.c @@ -404,8 +404,7 @@ void pci_setup_cardbus(struct pci_bus *b struct resource *res; struct pci_bus_region region; - dev_info(&bridge->dev, "CardBus bridge to [bus %02x-%02x]\n", - bus->secondary, bus->subordinate); + dev_info(&bridge->dev, "CardBus bridge to %pR\n", &bus->busn_res); res = bus->resource[0]; pcibios_resource_to_bus(bridge, ®ion, res); @@ -553,8 +552,7 @@ static void __pci_setup_bridge(struct pc { struct pci_dev *bridge = bus->self; - dev_info(&bridge->dev, "PCI bridge to [bus %02x-%02x]\n", - bus->secondary, bus->subordinate); + dev_info(&bridge->dev, "PCI bridge to %pR\n", &bus->busn_res); if (type & IORESOURCE_IO) pci_setup_bridge_io(bus); @@ -745,8 +743,8 @@ static void pbus_size_io(struct pci_bus if (!size0 && !size1) { if (b_res->start || b_res->end) dev_info(&bus->self->dev, "disabling bridge window " - "%pR to [bus %02x-%02x] (unused)\n", b_res, - bus->secondary, bus->subordinate); + "%pR to %pR (unused)\n", b_res, + &bus->busn_res); b_res->flags = 0; return; } @@ -757,8 +755,8 @@ static void pbus_size_io(struct pci_bus if (size1 > size0 && realloc_head) { add_to_list(realloc_head, bus->self, b_res, size1-size0, 4096); dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " - "%pR to [bus %02x-%02x] add_size %lx\n", b_res, - bus->secondary, bus->subordinate, size1-size0); + "%pR to %pR add_size %lx\n", b_res, + &bus->busn_res, size1-size0); } } @@ -863,8 +861,8 @@ static int pbus_size_mem(struct pci_bus if (!size0 && !size1) { if (b_res->start || b_res->end) dev_info(&bus->self->dev, "disabling bridge window " - "%pR to [bus %02x-%02x] (unused)\n", b_res, - bus->secondary, bus->subordinate); + "%pR to %pR (unused)\n", b_res, + &bus->busn_res); b_res->flags = 0; return 1; } @@ -874,8 +872,8 @@ static int pbus_size_mem(struct pci_bus if (size1 > size0 && realloc_head) { add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " - "%pR to [bus %02x-%02x] add_size %llx\n", b_res, - bus->secondary, bus->subordinate, (unsigned long long)size1-size0); + "%pR to %pR add_size %llx\n", b_res, + &bus->busn_res, (unsigned long long)size1-size0); } return 1; } Index: linux-2.6/drivers/pcmcia/cardbus.c =================================================================== --- linux-2.6.orig/drivers/pcmcia/cardbus.c +++ linux-2.6/drivers/pcmcia/cardbus.c @@ -73,7 +73,7 @@ int __ref cb_alloc(struct pcmcia_socket s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); pci_fixup_cardbus(bus); - max = bus->secondary; + max = bus->busn_res.start; for (pass = 0; pass < 2; pass++) list_for_each_entry(dev, &bus->devices, bus_list) if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || Index: linux-2.6/drivers/pcmcia/yenta_socket.c =================================================================== --- linux-2.6.orig/drivers/pcmcia/yenta_socket.c +++ linux-2.6/drivers/pcmcia/yenta_socket.c @@ -1048,8 +1048,8 @@ static void yenta_config_init(struct yen config_writeb(socket, PCI_LATENCY_TIMER, 168); config_writel(socket, PCI_PRIMARY_BUS, (176 << 24) | /* sec. latency timer */ - (dev->subordinate->subordinate << 16) | /* subordinate bus */ - (dev->subordinate->secondary << 8) | /* secondary bus */ + ((unsigned int)dev->subordinate->busn_res.end << 16) | /* subordinate bus */ + ((unsigned int)dev->subordinate->busn_res.start << 8) | /* secondary bus */ dev->subordinate->primary); /* primary bus */ /* Index: linux-2.6/include/linux/pci.h =================================================================== --- linux-2.6.orig/include/linux/pci.h +++ linux-2.6/include/linux/pci.h @@ -429,8 +429,6 @@ struct pci_bus { unsigned char number; /* bus number */ unsigned char primary; /* number of primary bridge */ - unsigned char secondary; /* number of secondary bridge */ - unsigned char subordinate; /* max number of subordinate buses */ unsigned char max_bus_speed; /* enum pci_bus_speed */ unsigned char cur_bus_speed; /* enum pci_bus_speed */