linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate
@ 2012-05-07 20:29 Yinghai Lu
  2012-05-07 20:29 ` [PATCH 01/21] PCI: add busn_res into struct pci_bus Yinghai Lu
                   ` (21 more replies)
  0 siblings, 22 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

struct pci_bus will take busn_res instead. and those busn_res will be in
domain busn_res tree.

This could be base of busn_res allocation patchset.

The patches need to apply to pci-next and
	for-pci-hotplug cleanup

could be found at:
        git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-busn_res

Bjorn Helgaas (1):
  PCI: print conflicting entry in busn_res inserting

Yinghai Lu (20):
  PCI: add busn_res into struct pci_bus.
  PCI: replace secondary/subordinate with busn_res
  PCI: Remove secondary/subordinate in struct ci_bus
  PCI: Add busn_res for pci domain.
  resource: adjust_resource handle resource without parent
  PCI: Add busn_res operation functions
  PCI: release busn_res when removing bus
  PCI: Insert busn_res in pci_create_root_bus()
  PCI: checking busn_res in pci_scan_root_bus()
  PCI: Add default busn_resource
  PCI: Add default busn_res for pci_scan_bus()
  x86/PCI: add busn_res into resources list for ACPI path
  x86/PCI: put busn resource in pci_root_info for native host bridge
    drivers
  ia64/PCI: register busn_res for root buses
  sparc/PCI: register busn_res for root buses
  powerpc/PCI: register busn_res for root buses
  parisc/PCI: register busn_res for root buses
  tile/PCI: Use pci_scan_root_bus instead pci_scan_bus
  PCI: Register busn_res for iov bus
  PCI: insert busn_res for child bus

 arch/alpha/kernel/pci.c                    |    2 +-
 arch/arm/kernel/bios32.c                   |    2 +-
 arch/ia64/pci/pci.c                        |    4 +-
 arch/microblaze/pci/pci-common.c           |    4 +-
 arch/mips/pci/pci.c                        |    2 +-
 arch/powerpc/include/asm/pci-bridge.h      |    1 +
 arch/powerpc/kernel/pci-common.c           |   17 ++-
 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                    |    8 +-
 arch/sparc/kernel/pci_impl.h               |    1 +
 arch/tile/kernel/pci.c                     |    9 +-
 arch/x86/pci/acpi.c                        |    9 +-
 arch/x86/pci/amd_bus.c                     |    7 +-
 arch/x86/pci/bus_numa.c                    |   22 +++-
 arch/x86/pci/bus_numa.h                    |    3 +-
 arch/xtensa/kernel/pci.c                   |    2 +-
 drivers/iommu/intel-iommu.c                |    2 +-
 drivers/net/ethernet/broadcom/tg3.c        |    4 +-
 drivers/parisc/dino.c                      |   16 ++-
 drivers/parisc/iosapic.c                   |    2 +-
 drivers/parisc/lba_pci.c                   |   26 ++--
 drivers/pci/hotplug-pci.c                  |    4 +-
 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                        |  191 +++++++++++++++++++++++-----
 drivers/pci/remove.c                       |    1 +
 drivers/pci/setup-bus.c                    |   24 ++--
 drivers/pcmcia/cardbus.c                   |    2 +-
 drivers/pcmcia/yenta_socket.c              |   26 ++--
 include/linux/pci.h                        |    8 +-
 kernel/resource.c                          |   13 +-
 37 files changed, 313 insertions(+), 135 deletions(-)

-- 
1.7.7


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 01/21] PCI: add busn_res into struct pci_bus.
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 02/21] PCI: replace secondary/subordinate with busn_res Yinghai Lu
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Will use it to track bus number resource tree.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 include/linux/pci.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 17b7b5b..2b91da0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,6 +419,7 @@ struct pci_bus {
 	struct list_head slots;		/* list of slots on this bus */
 	struct resource *resource[PCI_BRIDGE_RESOURCE_NUM];
 	struct list_head resources;	/* address space routed to this bus */
+	struct resource busn_res;	/* track registered bus num range */
 
 	struct pci_ops	*ops;		/* configuration access functions */
 	void		*sysdata;	/* hook for sys-specific extension */
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 02/21] PCI: replace secondary/subordinate with busn_res
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
  2012-05-07 20:29 ` [PATCH 01/21] PCI: add busn_res into struct pci_bus Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 03/21] PCI: Remove secondary/subordinate in struct ci_bus Yinghai Lu
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

We already have busn_res in pci_bus, use that instead, So later
could have them in resource tree.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/alpha/kernel/pci.c                    |    2 +-
 arch/arm/kernel/bios32.c                   |    2 +-
 arch/ia64/pci/pci.c                        |    2 +-
 arch/microblaze/pci/pci-common.c           |    4 +-
 arch/mips/pci/pci.c                        |    2 +-
 arch/powerpc/kernel/pci-common.c           |    6 +-
 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                    |    6 +-
 arch/tile/kernel/pci.c                     |    4 +-
 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                      |   10 ++--
 drivers/parisc/iosapic.c                   |    2 +-
 drivers/parisc/lba_pci.c                   |   22 +++++-----
 drivers/pci/hotplug-pci.c                  |    4 +-
 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                        |   58 ++++++++++++++--------------
 drivers/pci/setup-bus.c                    |   24 ++++++------
 drivers/pcmcia/cardbus.c                   |    2 +-
 drivers/pcmcia/yenta_socket.c              |   26 ++++++------
 29 files changed, 111 insertions(+), 111 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 1a62963..53229a4 100644
--- a/arch/alpha/kernel/pci.c
+++ b/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) {
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index ede5f77..ea59205 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -445,7 +445,7 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
 			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 {
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 524df42..3ca9bed 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -384,7 +384,7 @@ pci_acpi_scan_root(struct acpi_pci_root *root)
 		return NULL;
 	}
 
-	pbus->subordinate = pci_scan_child_bus(pbus);
+	pbus->busn_res.end = pci_scan_child_bus(pbus);
 	return pbus;
 
 out3:
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index d10403d..0855008 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1505,10 +1505,10 @@ static void __devinit pcibios_scan_phb(struct pci_controller *hose)
 		pci_free_resource_list(&resources);
 		return;
 	}
-	bus->secondary = hose->first_busno;
+	bus->busn_res.start = hose->first_busno;
 	hose->bus = bus;
 
-	hose->last_busno = bus->subordinate;
+	hose->last_busno = bus->busn_res.end;
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 0514866..9ff3f85 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -101,7 +101,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
 	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) {
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 8e78e93..3532b53 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1646,7 +1646,7 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 		pci_free_resource_list(&resources);
 		return;
 	}
-	bus->secondary = hose->first_busno;
+	bus->busn_res.start = hose->first_busno;
 	hose->bus = bus;
 
 	/* Get probe mode and perform scan */
@@ -1655,12 +1655,12 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 		mode = ppc_md.pci_probe_mode(bus);
 	pr_debug("    probe mode: %d\n", mode);
 	if (mode == PCI_PROBE_DEVTREE) {
-		bus->subordinate = hose->last_busno;
+		bus->busn_res.end = hose->last_busno;
 		of_scan_bus(node, bus);
 	}
 
 	if (mode == PCI_PROBE_NORMAL)
-		hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
+		hose->last_busno = bus->busn_res.end = pci_scan_child_bus(bus);
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 94a54f6..4ff190f 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -236,7 +236,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
 
 	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;
 	}
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 89dde17..a36281a 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -240,7 +240,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
 	}
 
 	bus->primary = dev->bus->number;
-	bus->subordinate = busrange[1];
+	bus->busn_res.end = busrange[1];
 	bus->bridge_ctl = 0;
 
 	/* parse ranges property */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index fbdd74d..9cda6a1 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -589,7 +589,7 @@ static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb,
 		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(struct pci_dev *dev,
 	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 ? */
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 8b7bafa..3ccebc8 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -121,7 +121,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
 		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 ||
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 9d10a3c..43068dc 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -59,7 +59,7 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose)
 	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) {
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index fdaf218..c85bfd7 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -535,7 +535,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
 	}
 
 	bus->primary = dev->bus->number;
-	bus->subordinate = busrange[1];
+	bus->busn_res.end = busrange[1];
 	bus->bridge_ctl = 0;
 
 	/* parse ranges property, or cook one up by hand for Simba */
@@ -693,8 +693,8 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
-	bus->secondary = pbm->pci_first_busno;
-	bus->subordinate = pbm->pci_last_busno;
+	bus->busn_res.start = pbm->pci_first_busno;
+	bus->busn_res.end = pbm->pci_last_busno;
 
 	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index a1bb59e..7aa2743 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -329,7 +329,7 @@ int __devinit pcibios_init(void)
 			 */
 			bus = pci_scan_bus(0, controller->ops, controller);
 			controller->root_bus = bus;
-			controller->last_busno = bus->subordinate;
+			controller->last_busno = bus->busn_res.end;
 		}
 	}
 
@@ -366,7 +366,7 @@ int __devinit 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] =
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index fc09c27..350fe63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -440,7 +440,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
 		bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd,
 					  &resources);
 		if (bus) {
-			bus->subordinate = pci_scan_child_bus(bus);
+			bus->busn_res.end = pci_scan_child_bus(bus);
 			pci_set_host_bridge_release(
 				to_pci_host_bridge(bus->bridge),
 				release_pci_root_info, info);
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index eb30e35..9c57c1e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/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;
 	}
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f93d5ac..b40aebd 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -660,7 +660,7 @@ static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn)
 			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;
 		}
 
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 062ac33..36b35b2 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -14127,7 +14127,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 			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);
@@ -14155,7 +14155,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 			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);
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index 432d4bb..70517b0 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -174,7 +174,7 @@ static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where,
 		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 *bus, unsigned int devfn, int where,
 	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 */
@@ -998,12 +998,12 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	bus->subordinate = pci_scan_child_bus(bus);
+	bus->busn_res.end = pci_scan_child_bus(bus);
 
 	/* 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 = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 1f9e9fe..83380c8 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -532,7 +532,7 @@ iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev)
 		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);
 }
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 052fa23..cd8f9ce 100644
--- a/drivers/parisc/lba_pci.c
+++ b/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, u8 reg, u32 size)
 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 *bus, unsigned int devfn, int pos, int
 		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, u8 reg, u32 data, u32 size)
 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_bus *bus, unsigned int devfn, int pos, int
 		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_bus *bus, unsigned int devfn, int pos, i
 {
 	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.
@@ -1511,7 +1511,7 @@ lba_driver_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	lba_bus->subordinate = pci_scan_child_bus(lba_bus);
+	lba_bus->busn_res.end = pci_scan_child_bus(lba_bus);
 
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
@@ -1541,7 +1541,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = lba_bus->subordinate + 1;
+	lba_next_bus = lba_res->busn_res.end + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
diff --git a/drivers/pci/hotplug-pci.c b/drivers/pci/hotplug-pci.c
index 01eae34..6258dc2 100644
--- a/drivers/pci/hotplug-pci.c
+++ b/drivers/pci/hotplug-pci.c
@@ -7,8 +7,8 @@
 int __ref pci_hp_add_bridge(struct pci_dev *dev)
 {
 	struct pci_bus *parent = dev->bus;
-	int pass, busnr, start = parent->secondary;
-	int end = parent->subordinate;
+	int pass, busnr, start = parent->busn_res.start;
+	int end = parent->busn_res.end;
 
 	for (busnr = start; busnr <= end; busnr++) {
 		if (!pci_find_bus(pci_domain_nr(parent), busnr))
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 806c44f..62d0ae4 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -100,11 +100,11 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val,
 			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;
@@ -692,7 +692,7 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
 	 * 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));
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c
index efa30da..eeb23ce 100644
--- a/drivers/pci/hotplug/shpchp_sysfs.c
+++ b/drivers/pci/hotplug/shpchp_sysfs.c
@@ -73,13 +73,13 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha
 		}
 	}
 	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;
 }
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 6554e1a..e873060 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -47,7 +47,7 @@ static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr)
 	if (!child)
 		return NULL;
 
-	child->subordinate = busnr;
+	child->busn_res.end = 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 *dev, int nr_virtfn)
 	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;
 	}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8f16900..1ef809b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -110,7 +110,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus* bus)
 	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)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 658ac97..651b096 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -381,8 +381,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
 	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);
@@ -599,9 +599,9 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	 * Set up the primary, secondary and subordinate
 	 * bus numbers.
 	 */
-	child->number = child->secondary = busnr;
-	child->primary = parent->secondary;
-	child->subordinate = 0xff;
+	child->number = child->busn_res.start = busnr;
+	child->primary = parent->busn_res.start;
+	child->busn_res.end = 0xff;
 
 	if (!bridge)
 		return child;
@@ -643,8 +643,8 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
 	if (!pcibios_assign_all_busses())
 		return;
 
-	while (parent->parent && parent->subordinate < max) {
-		parent->subordinate = max;
+	while (parent->parent && parent->busn_res.end < max) {
+		parent->busn_res.end = max;
 		pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, max);
 		parent = parent->parent;
 	}
@@ -718,15 +718,15 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 			if (!child)
 				goto out;
 			child->primary = primary;
-			child->subordinate = subordinate;
+			child->busn_res.end = subordinate;
 			child->bridge_ctl = bctl;
 		}
 
 		cmax = pci_scan_child_bus(child);
 		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
@@ -759,8 +759,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 		}
 		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);
 
 		/*
 		 * yenta.c forces a secondary latency timer of 176.
@@ -805,8 +805,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 					break;
 				while (parent->parent) {
 					if ((!pcibios_assign_all_busses()) &&
-					    (parent->subordinate > max) &&
-					    (parent->subordinate <= max+i)) {
+					    (parent->busn_res.end > max) &&
+					    (parent->busn_res.end <= max+i)) {
 						j = 1;
 					}
 					parent = parent->parent;
@@ -827,7 +827,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 		/*
 		 * Set the subordinate bus number to its real value.
 		 */
-		child->subordinate = max;
+		child->busn_res.end = max;
 		pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
 	}
 
@@ -837,19 +837,19 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 
 	/* 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;
 	}
@@ -1548,7 +1548,7 @@ EXPORT_SYMBOL_GPL(pcie_bus_configure_settings);
 
 unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
 {
-	unsigned int devfn, pass, max = bus->secondary;
+	unsigned int devfn, pass, max = bus->busn_res.start;
 	struct pci_dev *dev;
 
 	dev_dbg(&bus->dev, "scanning bus\n");
@@ -1642,7 +1642,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	/* Create legacy_io and legacy_mem files for this bus */
 	pci_create_legacy_files(b);
 
-	b->number = b->secondary = bus;
+	b->number = b->busn_res.start = bus;
 
 	if (parent)
 		dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev));
@@ -1693,7 +1693,7 @@ struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
 	if (!b)
 		return NULL;
 
-	b->subordinate = pci_scan_child_bus(b);
+	b->busn_res.end = pci_scan_child_bus(b);
 	pci_bus_add_devices(b);
 	return b;
 }
@@ -1710,7 +1710,7 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
 	pci_add_resource(&resources, &iomem_resource);
 	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
 	if (b)
-		b->subordinate = pci_scan_child_bus(b);
+		b->busn_res.end = pci_scan_child_bus(b);
 	else
 		pci_free_resource_list(&resources);
 	return b;
@@ -1727,7 +1727,7 @@ struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &iomem_resource);
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
-		b->subordinate = pci_scan_child_bus(b);
+		b->busn_res.end = pci_scan_child_bus(b);
 		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 8fa2d4b..192172c 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -404,8 +404,8 @@ void pci_setup_cardbus(struct pci_bus *bus)
 	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, &region, res);
@@ -553,8 +553,8 @@ static void __pci_setup_bridge(struct pci_bus *bus, unsigned long type)
 {
 	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 +745,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
 	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 +757,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
 	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 +863,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 	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 +874,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 	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;
 }
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index 6e75153..24caeaf 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -73,7 +73,7 @@ int __ref cb_alloc(struct pcmcia_socket *s)
 	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 ||
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index d07f9ac..667678d 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1048,8 +1048,8 @@ static void yenta_config_init(struct yenta_socket *socket)
 	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 */
 
 	/*
@@ -1086,14 +1086,14 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
 	struct pci_bus *bridge_to_fix = cardbus_bridge->parent;
 
 	/* Check bus numbers are already set up correctly: */
-	if (bridge_to_fix->subordinate >= cardbus_bridge->subordinate)
+	if (bridge_to_fix->busn_res.end >= cardbus_bridge->busn_res.end)
 		return; /* The subordinate number is ok, nothing to do */
 
 	if (!bridge_to_fix->parent)
 		return; /* Root bridges are ok */
 
 	/* stay within the limits of the bus range of the parent: */
-	upper_limit = bridge_to_fix->parent->subordinate;
+	upper_limit = bridge_to_fix->parent->busn_res.end;
 
 	/* check the bus ranges of all silbling bridges to prevent overlap */
 	list_for_each(tmp, &bridge_to_fix->parent->children) {
@@ -1104,36 +1104,36 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
 		 * current upper limit, set the new upper limit to
 		 * the bus number below the silbling's range:
 		 */
-		if (silbling->secondary > bridge_to_fix->subordinate
-		    && silbling->secondary <= upper_limit)
-			upper_limit = silbling->secondary - 1;
+		if (silbling->busn_res.start > bridge_to_fix->busn_res.end
+		    && silbling->busn_res.start <= upper_limit)
+			upper_limit = silbling->busn_res.start - 1;
 	}
 
 	/* Show that the wanted subordinate number is not possible: */
-	if (cardbus_bridge->subordinate > upper_limit)
+	if (cardbus_bridge->busn_res.end > upper_limit)
 		dev_printk(KERN_WARNING, &cardbus_bridge->dev,
 			   "Upper limit for fixing this "
 			   "bridge's parent bridge: #%02x\n", upper_limit);
 
 	/* If we have room to increase the bridge's subordinate number, */
-	if (bridge_to_fix->subordinate < upper_limit) {
+	if (bridge_to_fix->busn_res.end < upper_limit) {
 
 		/* use the highest number of the hidden bus, within limits */
 		unsigned char subordinate_to_assign =
-			min(cardbus_bridge->subordinate, upper_limit);
+			min_t(int, cardbus_bridge->busn_res.end, upper_limit);
 
 		dev_printk(KERN_INFO, &bridge_to_fix->dev,
 			   "Raising subordinate bus# of parent "
 			   "bus (#%02x) from #%02x to #%02x\n",
 			   bridge_to_fix->number,
-			   bridge_to_fix->subordinate, subordinate_to_assign);
+			   (int)bridge_to_fix->busn_res.end, subordinate_to_assign);
 
 		/* Save the new subordinate in the bus struct of the bridge */
-		bridge_to_fix->subordinate = subordinate_to_assign;
+		bridge_to_fix->busn_res.end = subordinate_to_assign;
 
 		/* and update the PCI config space with the new subordinate */
 		pci_write_config_byte(bridge_to_fix->self,
-			PCI_SUBORDINATE_BUS, bridge_to_fix->subordinate);
+			PCI_SUBORDINATE_BUS, bridge_to_fix->busn_res.end);
 	}
 }
 
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 03/21] PCI: Remove secondary/subordinate in struct ci_bus
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
  2012-05-07 20:29 ` [PATCH 01/21] PCI: add busn_res into struct pci_bus Yinghai Lu
  2012-05-07 20:29 ` [PATCH 02/21] PCI: replace secondary/subordinate with busn_res Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 04/21] PCI: Add busn_res for pci domain Yinghai Lu
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

It is not used anymore, so remove the duplicated secondary/subordinate.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 include/linux/pci.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2b91da0..d588ef4 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -427,8 +427,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 */
 
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 04/21] PCI: Add busn_res for pci domain.
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (2 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 03/21] PCI: Remove secondary/subordinate in struct ci_bus Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 05/21] resource: adjust_resource handle resource without parent Yinghai Lu
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

pci root bus busn_res will be registered under that.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 651b096..674a477 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -20,6 +20,36 @@
 LIST_HEAD(pci_root_buses);
 EXPORT_SYMBOL(pci_root_buses);
 
+static LIST_HEAD(pci_domain_busn_res_list);
+
+struct pci_domain_busn_res {
+	struct list_head list;
+	struct resource res;
+	int domain_nr;
+};
+
+static struct resource *get_pci_domain_busn_res(int domain_nr)
+{
+	struct pci_domain_busn_res *r;
+
+	list_for_each_entry(r, &pci_domain_busn_res_list, list)
+		if (r->domain_nr == domain_nr)
+			return &r->res;
+
+	r = kzalloc(sizeof(*r), GFP_KERNEL);
+	if (!r)
+		return NULL;
+
+	r->domain_nr = domain_nr;
+	r->res.start = 0;
+	r->res.end = 0xff;
+	r->res.flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED;
+
+	list_add_tail(&r->list, &pci_domain_busn_res_list);
+
+	return &r->res;
+}
+
 static int find_anything(struct device *dev, void *data)
 {
 	return 1;
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 05/21] resource: adjust_resource handle resource without parent
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (3 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 04/21] PCI: Add busn_res for pci domain Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-18 17:12   ` Bjorn Helgaas
  2012-05-07 20:29 ` [PATCH 06/21] PCI: Add busn_res operation functions Yinghai Lu
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

for no parent no siling case.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 kernel/resource.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 7e8ea66..51ade23 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -722,14 +722,12 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
 
 	write_lock(&resource_lock);
 
+	if (!parent)
+		goto skip;
+
 	if ((start < parent->start) || (end > parent->end))
 		goto out;
 
-	for (tmp = res->child; tmp; tmp = tmp->sibling) {
-		if ((tmp->start < start) || (tmp->end > end))
-			goto out;
-	}
-
 	if (res->sibling && (res->sibling->start <= end))
 		goto out;
 
@@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
 			goto out;
 	}
 
+skip:
+	for (tmp = res->child; tmp; tmp = tmp->sibling)
+		if ((tmp->start < start) || (tmp->end > end))
+			goto out;
+
 	res->start = start;
 	res->end = end;
 	result = 0;
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 06/21] PCI: Add busn_res operation functions
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (4 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 05/21] resource: adjust_resource handle resource without parent Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 07/21] PCI: print conflicting entry in busn_res inserting Yinghai Lu
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Will use them insert/update busn res in pci_bus struct.

-v2: use update_resource() requested by Bjorn.
-v3: use domain_busn_res as root bus busn_res parent.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    3 ++
 2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 674a477..bfbf064 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1714,6 +1714,69 @@ err_out:
 	return NULL;
 }
 
+int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
+{
+	struct resource *res = &b->busn_res;
+	struct resource *parent_res;
+	int ret;
+
+	res->start = bus;
+	res->end = bus_max;
+	res->flags = IORESOURCE_BUS;
+
+	if (!pci_is_root_bus(b))
+		parent_res = &b->parent->busn_res;
+	else {
+		parent_res = get_pci_domain_busn_res(pci_domain_nr(b));
+		res->flags |= IORESOURCE_PCI_FIXED;
+	}
+
+	ret = insert_resource(parent_res, res);
+
+	dev_printk(KERN_DEBUG, &b->dev,
+			"busn_res: %pR %s inserted under %s %pR\n",
+			res, ret ? "can not be" : "is",
+			pci_is_root_bus(b) ? "domain":"", parent_res);
+
+	return ret;
+}
+
+int pci_bus_update_busn_res_end(struct pci_bus *b, int bus_max)
+{
+	struct resource *res = &b->busn_res;
+	struct resource old_res = *res;
+	resource_size_t size;
+	int ret;
+
+	if (res->start > bus_max)
+		return -EINVAL;
+
+	size = bus_max - res->start + 1;
+	ret = adjust_resource(res, res->start, size);
+	dev_printk(KERN_DEBUG, &b->dev,
+			"busn_res: %pR end %s updated to %02x\n",
+			&old_res, ret ? "can not be" : "is", bus_max);
+
+	if (!ret && !res->parent)
+		pci_bus_insert_busn_res(b, res->start, res->end);
+
+	return ret;
+}
+
+void pci_bus_release_busn_res(struct pci_bus *b)
+{
+	struct resource *res = &b->busn_res;
+	int ret;
+
+	if (!res->flags || !res->parent)
+		return;
+
+	ret = release_resource(res);
+	dev_printk(KERN_DEBUG, &b->dev,
+			"busn_res: %pR %s released\n",
+			res, ret ? "can not be" : "is");
+}
+
 struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d588ef4..b5f2cc7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -667,6 +667,9 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
+int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
+void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 07/21] PCI: print conflicting entry in busn_res inserting
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (5 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 06/21] PCI: Add busn_res operation functions Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 08/21] PCI: release busn_res when removing bus Yinghai Lu
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

From: Bjorn Helgaas <bhelgaas@google.com>

Print conflicting entry if insertion fails.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bfbf064..7662ab7 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1717,8 +1717,7 @@ err_out:
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
-	struct resource *parent_res;
-	int ret;
+	struct resource *parent_res, *conflict;
 
 	res->start = bus;
 	res->end = bus_max;
@@ -1731,14 +1730,20 @@ int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 		res->flags |= IORESOURCE_PCI_FIXED;
 	}
 
-	ret = insert_resource(parent_res, res);
+	conflict = insert_resource_conflict(parent_res, res);
 
-	dev_printk(KERN_DEBUG, &b->dev,
-			"busn_res: %pR %s inserted under %s %pR\n",
-			res, ret ? "can not be" : "is",
-			pci_is_root_bus(b) ? "domain":"", parent_res);
+	if (conflict)
+		dev_printk(KERN_DEBUG, &b->dev,
+			   "busn_res: can not insert %pR under %s%pR (conflicts with %s %pR)\n",
+			    res, pci_is_root_bus(b) ? "domain " : "",
+			    parent_res, conflict->name, conflict);
+	else
+		dev_printk(KERN_DEBUG, &b->dev,
+			   "busn_res: %pR is inserted under %s%pR\n",
+			   res, pci_is_root_bus(b) ? "domain " : "",
+			   parent_res);
 
-	return ret;
+	return conflict == NULL;
 }
 
 int pci_bus_update_busn_res_end(struct pci_bus *b, int bus_max)
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 08/21] PCI: release busn_res when removing bus
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (6 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 07/21] PCI: print conflicting entry in busn_res inserting Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 09/21] PCI: Insert busn_res in pci_create_root_bus() Yinghai Lu
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/remove.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index fd77e2b..04a4861 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -68,6 +68,7 @@ void pci_remove_bus(struct pci_bus *pci_bus)
 
 	down_write(&pci_bus_sem);
 	list_del(&pci_bus->node);
+	pci_bus_release_busn_res(pci_bus);
 	up_write(&pci_bus_sem);
 	if (!pci_bus->is_added)
 		return;
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 09/21] PCI: Insert busn_res in pci_create_root_bus()
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (7 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 08/21] PCI: release busn_res when removing bus Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 10/21] PCI: checking busn_res in pci_scan_root_bus() Yinghai Lu
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

That busn_res is from resources list

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7662ab7..59011ce 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1684,7 +1684,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 		list_move_tail(&window->list, &bridge->windows);
 		res = window->res;
 		offset = window->offset;
-		pci_bus_add_resource(b, res, 0);
+		if (res->flags & IORESOURCE_BUS)
+			pci_bus_insert_busn_res(b, bus, res->end);
+		else
+			pci_bus_add_resource(b, res, 0);
 		if (offset) {
 			if (resource_type(res) == IORESOURCE_IO)
 				fmt = " (bus address [%#06llx-%#06llx])";
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 10/21] PCI: checking busn_res in pci_scan_root_bus()
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (8 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 09/21] PCI: Insert busn_res in pci_create_root_bus() Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 11/21] PCI: Add default busn_resource Yinghai Lu
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Some callers do not supply the bus number aperture, usually because they do
not know the end.  In this case, we assume the aperture extends from the
root bus number to bus 255, scan the bus, and shrink the bus number
resource so it ends at the largest bus number we found.

This is obviously not correct because the actual end of the aperture may
well be larger than the largest bus number we found.  But I guess it's all
we have for now.

Also print out one info about that, so we could find out which path
does not have busn_res in resources list.

-v4: set found initial value to false.

[bhelgaas: changelog, list _safe iterator unnecessary, use %pR format for bus]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 59011ce..6258f6f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1788,13 +1788,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
+	struct pci_host_bridge_window *window;
+	bool found = false;
 	struct pci_bus *b;
+	int max;
+
+	list_for_each_entry(window, resources, list)
+		if (window->res->flags & IORESOURCE_BUS) {
+			found = true;
+			break;
+		}
 
 	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
-	b->busn_res.end = pci_scan_child_bus(b);
+	if (!found) {
+		dev_info(&b->dev,
+		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
+			bus);
+		pci_bus_insert_busn_res(b, bus, 255);
+	}
+
+	max = pci_scan_child_bus(b);
+
+	if (!found)
+		pci_bus_update_busn_res_end(b, max);
+
 	pci_bus_add_devices(b);
 	return b;
 }
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 11/21] PCI: Add default busn_resource
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (9 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 10/21] PCI: checking busn_res in pci_scan_root_bus() Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 12/21] PCI: Add default busn_res for pci_scan_bus() Yinghai Lu
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

We need to put into the resources list for legacy system.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |    7 +++++++
 include/linux/pci.h |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 6258f6f..68e75cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -16,6 +16,13 @@
 #define CARDBUS_LATENCY_TIMER	176	/* secondary latency timer */
 #define CARDBUS_RESERVE_BUSNR	3
 
+struct resource busn_resource = {
+	.name	= "PCI busn",
+	.start	= 0,
+	.end	= 255,
+	.flags	= IORESOURCE_BUS,
+};
+
 /* Ugh.  Need to stop exporting this to modules. */
 LIST_HEAD(pci_root_buses);
 EXPORT_SYMBOL(pci_root_buses);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b5f2cc7..84ce6da 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -368,6 +368,8 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
 	return (pdev->error_state != pci_channel_io_normal);
 }
 
+extern struct resource busn_resource;
+
 struct pci_host_bridge_window {
 	struct list_head list;
 	struct resource *res;		/* host bridge aperture (CPU address) */
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 12/21] PCI: Add default busn_res for pci_scan_bus()
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (10 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 11/21] PCI: Add default busn_resource Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 13/21] x86/PCI: add busn_res into resources list for ACPI path Yinghai Lu
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 68e75cb..9f68b9d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1836,9 +1836,10 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
+	pci_add_resource(&resources, &busn_resource);
 	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
 	if (b)
-		b->busn_res.end = pci_scan_child_bus(b);
+		pci_scan_child_bus(b);
 	else
 		pci_free_resource_list(&resources);
 	return b;
@@ -1853,9 +1854,10 @@ struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
+	pci_add_resource(&resources, &busn_resource);
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
-		b->busn_res.end = pci_scan_child_bus(b);
+		pci_scan_child_bus(b);
 		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 13/21] x86/PCI: add busn_res into resources list for ACPI path
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (11 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 12/21] PCI: Add default busn_res for pci_scan_bus() Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:29 ` [PATCH 14/21] x86/PCI: put busn resource in pci_root_info for native host bridge drivers Yinghai Lu
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Add the host bridge bus number aperture from _CRS to the resource list.
Like the MMIO and I/O port apertures, this will be used when assigning
resources to hot-added devices or in the case of conflicts.

Always insert that even pci_use_crs is not used.

[bhelgaas: rewrite changelog]
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/pci/acpi.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 350fe63..2bb885a 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -12,7 +12,6 @@ struct pci_root_info {
 	char name[16];
 	unsigned int res_num;
 	struct resource *res;
-	int busnum;
 	struct pci_sysdata sd;
 };
 
@@ -347,7 +346,9 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 {
 	size_t size;
 
+	sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum);
 	info->bridge = device;
+
 	info->res_num = 0;
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource,
 				info);
@@ -360,8 +361,6 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	if (!info->res)
 		return;
 
-	sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum);
-
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
 				info);
 }
@@ -426,6 +425,8 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
 	} else {
 		probe_pci_root_info(info, device, busnum, domain);
 
+		/* insert busn res at first */
+		pci_add_resource(&resources,  &root->secondary);
 		/*
 		 * _CRS with no apertures is normal, so only fall back to
 		 * defaults or native bridge info if we're ignoring _CRS.
@@ -440,7 +441,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
 		bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd,
 					  &resources);
 		if (bus) {
-			bus->busn_res.end = 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);
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 14/21] x86/PCI: put busn resource in pci_root_info for native host bridge drivers
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (12 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 13/21] x86/PCI: add busn_res into resources list for ACPI path Yinghai Lu
@ 2012-05-07 20:29 ` Yinghai Lu
  2012-05-07 20:30 ` [PATCH 15/21] ia64/PCI: register busn_res for root buses Yinghai Lu
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:29 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Add the host bridge bus number aperture to the resource list.
Like the MMIO and I/O port apertures, this will be used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: tidy printk, changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/pci/amd_bus.c  |    7 +++----
 arch/x86/pci/bus_numa.c |   22 +++++++++++++++++++---
 arch/x86/pci/bus_numa.h |    3 +--
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 5aed49b..e9e6ed5 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -121,7 +121,6 @@ static int __init early_fill_mp_bus_info(void)
 		link = (reg >> 8) & 0x03;
 
 		info = alloc_pci_root_info(min_bus, max_bus, node, link);
-		sprintf(info->name, "PCI Bus #%02x", min_bus);
 	}
 
 	/* get the default node and link for left over res */
@@ -300,9 +299,9 @@ static int __init early_fill_mp_bus_info(void)
 		int busnum;
 		struct pci_root_res *root_res;
 
-		busnum = info->bus_min;
-		printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n",
-		       info->bus_min, info->bus_max, info->node, info->link);
+		busnum = info->busn.start;
+		printk(KERN_DEBUG "bus: %pR on node %x link %x\n",
+		       &info->busn, info->node, info->link);
 		list_for_each_entry(root_res, &info->resources, list)
 			printk(KERN_DEBUG "bus: %02x %pR\n",
 				       busnum, &root_res->res);
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index 306579f..d37e2fe 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -14,7 +14,7 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
 		return NULL;
 
 	list_for_each_entry(info, &pci_root_infos, list)
-		if (info->bus_min == bus)
+		if (info->busn.start == bus)
 			return info;
 
 	return NULL;
@@ -24,6 +24,8 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources)
 {
 	struct pci_root_info *info = x86_find_pci_root_info(bus);
 	struct pci_root_res *root_res;
+	struct pci_host_bridge_window *window;
+	bool found = false;
 
 	if (!info)
 		goto default_resources;
@@ -31,6 +33,16 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources)
 	printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n",
 	       bus);
 
+	/* already added by acpi ? */
+	list_for_each_entry(window, resources, list)
+		if (window->res->flags & IORESOURCE_BUS) {
+			found = true;
+			break;
+		}
+
+	if (!found)
+		pci_add_resource(resources, &info->busn);
+
 	list_for_each_entry(root_res, &info->resources, list) {
 		struct resource *res;
 		struct resource *root;
@@ -66,9 +78,13 @@ struct pci_root_info __init *alloc_pci_root_info(int bus_min, int bus_max,
 	if (!info)
 		return info;
 
+	sprintf(info->name, "PCI Bus #%02x", bus_min);
+
 	INIT_LIST_HEAD(&info->resources);
-	info->bus_min = bus_min;
-	info->bus_max = bus_max;
+	info->busn.name  = info->name;
+	info->busn.start = bus_min;
+	info->busn.end   = bus_max;
+	info->busn.flags = IORESOURCE_BUS;
 	info->node = node;
 	info->link = link;
 
diff --git a/arch/x86/pci/bus_numa.h b/arch/x86/pci/bus_numa.h
index 226a466..ff8f65b 100644
--- a/arch/x86/pci/bus_numa.h
+++ b/arch/x86/pci/bus_numa.h
@@ -13,8 +13,7 @@ struct pci_root_info {
 	struct list_head list;
 	char name[12];
 	struct list_head resources;
-	int bus_min;
-	int bus_max;
+	struct resource busn;
 	int node;
 	int link;
 };
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 15/21] ia64/PCI: register busn_res for root buses
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (13 preceding siblings ...)
  2012-05-07 20:29 ` [PATCH 14/21] x86/PCI: put busn resource in pci_root_info for native host bridge drivers Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-07 20:30 ` [PATCH 16/21] sparc/PCI: " Yinghai Lu
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu, Fenghua Yu, linux-ia64

Add the host bridge bus number aperture from _CRS to the resource list.
Like the MMIO and I/O port apertures, this is used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: write changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
---
 arch/ia64/pci/pci.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 3ca9bed..d173a88 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -351,6 +351,8 @@ pci_acpi_scan_root(struct acpi_pci_root *root)
 #endif
 
 	INIT_LIST_HEAD(&info.resources);
+	/* insert busn resource at first */
+	pci_add_resource(&info.resources, &root->secondary);
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
 			&windows);
 	if (windows) {
@@ -384,7 +386,7 @@ pci_acpi_scan_root(struct acpi_pci_root *root)
 		return NULL;
 	}
 
-	pbus->busn_res.end = pci_scan_child_bus(pbus);
+	pci_scan_child_bus(pbus);
 	return pbus;
 
 out3:
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 16/21] sparc/PCI: register busn_res for root buses
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (14 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 15/21] ia64/PCI: register busn_res for root buses Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-07 20:43   ` David Miller
  2012-05-07 20:30 ` [PATCH 17/21] powerpc/PCI: " Yinghai Lu
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu, sparclinux

Add the host bridge bus number aperture to the resource list.
Like the MMIO and I/O port apertures, this is used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: write changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
---
 arch/sparc/kernel/pci.c      |    8 +++++---
 arch/sparc/kernel/pci_impl.h |    1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index c85bfd7..74e4bf3 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -535,7 +535,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
 	}
 
 	bus->primary = dev->bus->number;
-	bus->busn_res.end = 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 */
@@ -685,6 +685,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				pbm->io_space.start);
 	pci_add_resource_offset(&resources, &pbm->mem_space,
 				pbm->mem_space.start);
+	pbm->busn.start = pbm->pci_first_busno;
+	pbm->busn.end	= pbm->pci_last_busn;
+	pbm->busn.flags	= IORESOURCE_BUS;
+	pci_add_resource(&resources, &pbm->busn);
 	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
 				  pbm, &resources);
 	if (!bus) {
@@ -693,8 +697,6 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
-	bus->busn_res.start = pbm->pci_first_busno;
-	bus->busn_res.end = pbm->pci_last_busno;
 
 	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 6beb60d..918a203 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -97,6 +97,7 @@ struct pci_pbm_info {
 	/* PBM I/O and Memory space resources. */
 	struct resource			io_space;
 	struct resource			mem_space;
+	struct resource			busn;
 
 	/* Base of PCI Config space, can be per-PBM or shared. */
 	unsigned long			config_space;
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 17/21] powerpc/PCI: register busn_res for root buses
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (15 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 16/21] sparc/PCI: " Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-07 20:30 ` [PATCH 18/21] parisc/PCI: " Yinghai Lu
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu, Paul Mackerras, linuxppc-dev

Add the host bridge bus number aperture to the resource list.
Like the MMIO and I/O port apertures, this is used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: write changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/include/asm/pci-bridge.h |    1 +
 arch/powerpc/kernel/pci-common.c      |   17 +++++++++++------
 arch/powerpc/kernel/pci_of_scan.c     |    2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index ac39e6a..8cccbee 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -30,6 +30,7 @@ struct pci_controller {
 	int first_busno;
 	int last_busno;
 	int self_busno;
+	struct resource busn;
 
 	void __iomem *io_base_virt;
 #ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 3532b53..7320f36 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1637,6 +1637,11 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 	/* Wire up PHB bus resources */
 	pcibios_setup_phb_resources(hose, &resources);
 
+	hose->busn.start = hose->first_busno;
+	hose->busn.end	 = hose->last_busno;
+	hose->busn.flags = IORESOURCE_BUS;
+	pci_add_resource(&resources, &hose->busn);
+
 	/* Create an empty bus for the toplevel */
 	bus = pci_create_root_bus(hose->parent, hose->first_busno,
 				  hose->ops, hose, &resources);
@@ -1646,7 +1651,6 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 		pci_free_resource_list(&resources);
 		return;
 	}
-	bus->busn_res.start = hose->first_busno;
 	hose->bus = bus;
 
 	/* Get probe mode and perform scan */
@@ -1654,13 +1658,14 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 	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->busn_res.end = hose->last_busno;
+	if (mode == PCI_PROBE_DEVTREE)
 		of_scan_bus(node, bus);
-	}
 
-	if (mode == PCI_PROBE_NORMAL)
-		hose->last_busno = bus->busn_res.end = pci_scan_child_bus(bus);
+	if (mode == PCI_PROBE_NORMAL) {
+		pci_bus_update_busn_res_end(bus, 255);
+		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
 	 * we proceed to resource allocation
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index a36281a..ae5ea5e 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -240,7 +240,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
 	}
 
 	bus->primary = dev->bus->number;
-	bus->busn_res.end = busrange[1];
+	pci_bus_insert_busn_res(bus, busrange[0], busrange[1]);
 	bus->bridge_ctl = 0;
 
 	/* parse ranges property */
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 18/21] parisc/PCI: register busn_res for root buses
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (16 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 17/21] powerpc/PCI: " Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-07 20:30 ` [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus Yinghai Lu
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu, Kyle McMartin, Helge Deller, linux-parisc

Add the host bridge bus number aperture to the resource list.
Like the MMIO and I/O port apertures, this is used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: set flags directly, at LBA bus_num init, write changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
CC: Kyle McMartin <kyle@mcmartin.ca>
CC: Helge Deller <deller@gmx.de>
CC: linux-parisc@vger.kernel.org
---
 drivers/parisc/dino.c    |   10 ++++++++--
 drivers/parisc/lba_pci.c |    8 ++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index 70517b0..ffddc4f 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -898,6 +898,7 @@ static int __init dino_probe(struct parisc_device *dev)
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
 	unsigned long hpa = dev->hpa.start;
+	int max;
 
 	name = "Dino";
 	if (is_card_dino(&dev->id)) {
@@ -983,6 +984,10 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
+	dino_dev->hba.bus_num.start = dino_current_bus;
+	dino_dev->hba.bus_num.end = 255;
+	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
+	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
@@ -998,12 +1003,13 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	bus->busn_res.end = 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->busn_res.end + 1;
+	dino_current_bus = max + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index cd8f9ce..4f9cf24 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -989,6 +989,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
 		case PAT_PBNUM:
 			lba_dev->hba.bus_num.start = p->start;
 			lba_dev->hba.bus_num.end   = p->end;
+			lba_dev->hba.bus_num.flags = IORESOURCE_BUS;
 			break;
 
 		case PAT_LMMIO:
@@ -1366,6 +1367,7 @@ lba_driver_probe(struct parisc_device *dev)
 	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);
@@ -1502,6 +1504,8 @@ lba_driver_probe(struct parisc_device *dev)
 	if (lba_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &lba_dev->hba.gmmio_space);
 
+	pci_add_resource(&resources, &lba_dev->hba.bus_num);
+
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
 		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
@@ -1511,7 +1515,7 @@ lba_driver_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	lba_bus->busn_res.end = 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()) {
@@ -1541,7 +1545,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = lba_res->busn_res.end + 1;
+	lba_next_bus = max + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (17 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 18/21] parisc/PCI: " Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-09 19:32   ` Chris Metcalf
  2012-05-07 20:30 ` [PATCH 20/21] PCI: Register busn_res for iov bus Yinghai Lu
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu, Chris Metcalf

It will update busn_res accordingly, so we get that for last_busno.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Chris Metcalf <cmetcalf@tilera.com>
---
 arch/tile/kernel/pci.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 7aa2743..4a951b87 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -310,6 +310,7 @@ int __devinit 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,7 +328,9 @@ int __devinit 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->busn_res.end;
 		}
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 20/21] PCI: Register busn_res for iov bus
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (18 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-07 20:30 ` [PATCH 21/21] PCI: insert busn_res for child bus Yinghai Lu
  2012-05-17 22:19 ` [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Bjorn Helgaas
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Insert that to tree.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/iov.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index e873060..74bbaf8 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -47,7 +47,7 @@ static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr)
 	if (!child)
 		return NULL;
 
-	child->busn_res.end = busnr;
+	pci_bus_insert_busn_res(child, busnr, busnr);
 	child->dev.parent = bus->bridge;
 	rc = pci_bus_add_child(child);
 	if (rc) {
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH 21/21] PCI: insert busn_res for child bus
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (19 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 20/21] PCI: Register busn_res for iov bus Yinghai Lu
@ 2012-05-07 20:30 ` Yinghai Lu
  2012-05-17 22:19 ` [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Bjorn Helgaas
  21 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-07 20:30 UTC (permalink / raw)
  To: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller, x86
  Cc: Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch,
	Yinghai Lu

Now we can insert busn_res now, after all root bus's get inserted.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/probe.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 9f68b9d..0840409 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -755,7 +755,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 			if (!child)
 				goto out;
 			child->primary = primary;
-			child->busn_res.end = subordinate;
+			pci_bus_insert_busn_res(child, secondary, subordinate);
 			child->bridge_ctl = bctl;
 		}
 
@@ -793,6 +793,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 			child = pci_add_new_bus(bus, dev, ++max);
 			if (!child)
 				goto out;
+			pci_bus_insert_busn_res(child, max, 0xff);
 		}
 		buses = (buses & 0xff000000)
 		      | ((unsigned int)(child->primary)     <<  0)
@@ -864,7 +865,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 		/*
 		 * Set the subordinate bus number to its real value.
 		 */
-		child->busn_res.end = max;
+		pci_bus_update_busn_res_end(child, max);
 		pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
 	}
 
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH 16/21] sparc/PCI: register busn_res for root buses
  2012-05-07 20:30 ` [PATCH 16/21] sparc/PCI: " Yinghai Lu
@ 2012-05-07 20:43   ` David Miller
  0 siblings, 0 replies; 33+ messages in thread
From: David Miller @ 2012-05-07 20:43 UTC (permalink / raw)
  To: yinghai
  Cc: bhelgaas, benh, tony.luck, x86, linux, akpm, torvalds, gregkh,
	linux-pci, linux-kernel, linux-arch, sparclinux

From: Yinghai Lu <yinghai@kernel.org>
Date: Mon,  7 May 2012 13:30:01 -0700

> Add the host bridge bus number aperture to the resource list.
> Like the MMIO and I/O port apertures, this is used when assigning
> resources to hot-added devices or in the case of conflicts.
> 
> [bhelgaas: write changelog]
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus
  2012-05-07 20:30 ` [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus Yinghai Lu
@ 2012-05-09 19:32   ` Chris Metcalf
  2012-05-09 19:45     ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: Chris Metcalf @ 2012-05-09 19:32 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller,
	x86, Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On 5/7/2012 4:30 PM, Yinghai Lu wrote:
> It will update busn_res accordingly, so we get that for last_busno.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
> ---
>  arch/tile/kernel/pci.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
> index 7aa2743..4a951b87 100644
> --- a/arch/tile/kernel/pci.c
> +++ b/arch/tile/kernel/pci.c
> @@ -310,6 +310,7 @@ int __devinit 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,7 +328,9 @@ int __devinit 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->busn_res.end;
>  		}

We don't want ioport_resource on tilepro, since we don't support accessing
I/O port space.

With that one line removed:

Acked-by: Chris Metcalf <cmetcalf@tilera.com>

Or, I can queue this change to take through the tile tree when the merge
window opens.  Which would you prefer?

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus
  2012-05-09 19:32   ` Chris Metcalf
@ 2012-05-09 19:45     ` Yinghai Lu
  0 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2012-05-09 19:45 UTC (permalink / raw)
  To: Chris Metcalf
  Cc: Bjorn Helgaas, Benjamin Herrenschmidt, Tony Luck, David Miller,
	x86, Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Wed, May 9, 2012 at 12:32 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:
> On 5/7/2012 4:30 PM, Yinghai Lu wrote:
>> It will update busn_res accordingly, so we get that for last_busno.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> Cc: Chris Metcalf <cmetcalf@tilera.com>
>> ---
>>  arch/tile/kernel/pci.c |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
>> index 7aa2743..4a951b87 100644
>> --- a/arch/tile/kernel/pci.c
>> +++ b/arch/tile/kernel/pci.c
>> @@ -310,6 +310,7 @@ int __devinit 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,7 +328,9 @@ int __devinit 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->busn_res.end;
>>               }
>
> We don't want ioport_resource on tilepro, since we don't support accessing
> I/O port space.
>
> With that one line removed:
>
> Acked-by: Chris Metcalf <cmetcalf@tilera.com>

Thanks.

>
> Or, I can queue this change to take through the tile tree when the merge
> window opens.  Which would you prefer?

have to go through pci-next tree. because other change like

 controller->last_busno = bus->busn_res.end;

is in pci-next.

Yinghai

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate
  2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
                   ` (20 preceding siblings ...)
  2012-05-07 20:30 ` [PATCH 21/21] PCI: insert busn_res for child bus Yinghai Lu
@ 2012-05-17 22:19 ` Bjorn Helgaas
  2012-05-18  2:13   ` Yinghai Lu
  21 siblings, 1 reply; 33+ messages in thread
From: Bjorn Helgaas @ 2012-05-17 22:19 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Mon, May 7, 2012 at 2:29 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> struct pci_bus will take busn_res instead. and those busn_res will be in
> domain busn_res tree.
>
> This could be base of busn_res allocation patchset.
>
> The patches need to apply to pci-next and
>        for-pci-hotplug cleanup

Sigh.  You previously said we should do this order:

        for-pci-hostbridge-cleanup
        for-pci-busn-alloc
        for-pci-res-alloc
        for-pci-root-bus-hotplug
        for-pci-for-each-res-addon

I merged for-pci-hostbridge-cleanup already.  I was about to start
merging for-pci-busn-alloc.

But now you added for-pci-hotplug-cleanup and made for-pci-busn-alloc
depend on it.  I have some comments on for-pci-hotplug-cleanup, so I'm
not ready to merge it quite yet.  Can you please just go back to the
original order and put the new hotplug cleanup stuff at the *end*?

> could be found at:
>        git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-busn_res
>
> Bjorn Helgaas (1):
>  PCI: print conflicting entry in busn_res inserting
>
> Yinghai Lu (20):
>  PCI: add busn_res into struct pci_bus.
>  PCI: replace secondary/subordinate with busn_res
>  PCI: Remove secondary/subordinate in struct ci_bus
>  PCI: Add busn_res for pci domain.
>  resource: adjust_resource handle resource without parent
>  PCI: Add busn_res operation functions
>  PCI: release busn_res when removing bus
>  PCI: Insert busn_res in pci_create_root_bus()
>  PCI: checking busn_res in pci_scan_root_bus()
>  PCI: Add default busn_resource
>  PCI: Add default busn_res for pci_scan_bus()
>  x86/PCI: add busn_res into resources list for ACPI path
>  x86/PCI: put busn resource in pci_root_info for native host bridge
>    drivers
>  ia64/PCI: register busn_res for root buses
>  sparc/PCI: register busn_res for root buses
>  powerpc/PCI: register busn_res for root buses
>  parisc/PCI: register busn_res for root buses
>  tile/PCI: Use pci_scan_root_bus instead pci_scan_bus
>  PCI: Register busn_res for iov bus
>  PCI: insert busn_res for child bus
>
>  arch/alpha/kernel/pci.c                    |    2 +-
>  arch/arm/kernel/bios32.c                   |    2 +-
>  arch/ia64/pci/pci.c                        |    4 +-
>  arch/microblaze/pci/pci-common.c           |    4 +-
>  arch/mips/pci/pci.c                        |    2 +-
>  arch/powerpc/include/asm/pci-bridge.h      |    1 +
>  arch/powerpc/kernel/pci-common.c           |   17 ++-
>  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                    |    8 +-
>  arch/sparc/kernel/pci_impl.h               |    1 +
>  arch/tile/kernel/pci.c                     |    9 +-
>  arch/x86/pci/acpi.c                        |    9 +-
>  arch/x86/pci/amd_bus.c                     |    7 +-
>  arch/x86/pci/bus_numa.c                    |   22 +++-
>  arch/x86/pci/bus_numa.h                    |    3 +-
>  arch/xtensa/kernel/pci.c                   |    2 +-
>  drivers/iommu/intel-iommu.c                |    2 +-
>  drivers/net/ethernet/broadcom/tg3.c        |    4 +-
>  drivers/parisc/dino.c                      |   16 ++-
>  drivers/parisc/iosapic.c                   |    2 +-
>  drivers/parisc/lba_pci.c                   |   26 ++--
>  drivers/pci/hotplug-pci.c                  |    4 +-
>  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                        |  191 +++++++++++++++++++++++-----
>  drivers/pci/remove.c                       |    1 +
>  drivers/pci/setup-bus.c                    |   24 ++--
>  drivers/pcmcia/cardbus.c                   |    2 +-
>  drivers/pcmcia/yenta_socket.c              |   26 ++--
>  include/linux/pci.h                        |    8 +-
>  kernel/resource.c                          |   13 +-
>  37 files changed, 313 insertions(+), 135 deletions(-)
>
> --
> 1.7.7
>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate
  2012-05-17 22:19 ` [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Bjorn Helgaas
@ 2012-05-18  2:13   ` Yinghai Lu
  2012-05-18 23:32     ` Bjorn Helgaas
  0 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2012-05-18  2:13 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Thu, May 17, 2012 at 3:19 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> Sigh.  You previously said we should do this order:
>
>        for-pci-hostbridge-cleanup
>        for-pci-busn-alloc
>        for-pci-res-alloc
>        for-pci-root-bus-hotplug
>        for-pci-for-each-res-addon
>
> I merged for-pci-hostbridge-cleanup already.  I was about to start
> merging for-pci-busn-alloc.
>
> But now you added for-pci-hotplug-cleanup and made for-pci-busn-alloc
> depend on it.  I have some comments on for-pci-hotplug-cleanup, so I'm
> not ready to merge it quite yet.  Can you please just go back to the
> original order and put the new hotplug cleanup stuff at the *end*?

ok, update for-pci-busn_res branch, now it is based on your next branch.

git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
for-pci-busn_res

later will push out

       for-pci-hotplug
       for-pci-busn-alloc
       for-pci-root-bus-hotplug
       for-pci-for-each-res-addon
       for-pci-res-alloc

Yinghai

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 05/21] resource: adjust_resource handle resource without parent
  2012-05-07 20:29 ` [PATCH 05/21] resource: adjust_resource handle resource without parent Yinghai Lu
@ 2012-05-18 17:12   ` Bjorn Helgaas
  2012-05-18 17:54     ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: Bjorn Helgaas @ 2012-05-18 17:12 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Mon, May 7, 2012 at 2:29 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> for no parent no siling case.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
>  kernel/resource.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 7e8ea66..51ade23 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -722,14 +722,12 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
>
>        write_lock(&resource_lock);
>
> +       if (!parent)
> +               goto skip;
> +
>        if ((start < parent->start) || (end > parent->end))
>                goto out;
>
> -       for (tmp = res->child; tmp; tmp = tmp->sibling) {
> -               if ((tmp->start < start) || (tmp->end > end))
> -                       goto out;
> -       }
> -
>        if (res->sibling && (res->sibling->start <= end))
>                goto out;
>
> @@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
>                        goto out;
>        }
>
> +skip:
> +       for (tmp = res->child; tmp; tmp = tmp->sibling)
> +               if ((tmp->start < start) || (tmp->end > end))
> +                       goto out;
> +
>        res->start = start;
>        res->end = end;
>        result = 0;

Where does this case occur?  When do you need to adjust a resource
that has no parent?

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 05/21] resource: adjust_resource handle resource without parent
  2012-05-18 17:12   ` Bjorn Helgaas
@ 2012-05-18 17:54     ` Yinghai Lu
  2012-05-18 18:06       ` Bjorn Helgaas
  0 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2012-05-18 17:54 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Fri, May 18, 2012 at 10:12 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Mon, May 7, 2012 at 2:29 PM, Yinghai Lu <yinghai@kernel.org> wrote:

> Where does this case occur?  When do you need to adjust a resource
> that has no parent?

for unassigned pci bridge from BIOS, before scan busn_res.end is 0xff,
so you can not insert them, because the bridge could in the middle.
Have to update the busn_res.end and insert after the bridge is scanned

Yinghai

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 05/21] resource: adjust_resource handle resource without parent
  2012-05-18 17:54     ` Yinghai Lu
@ 2012-05-18 18:06       ` Bjorn Helgaas
  0 siblings, 0 replies; 33+ messages in thread
From: Bjorn Helgaas @ 2012-05-18 18:06 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Fri, May 18, 2012 at 11:54 AM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Fri, May 18, 2012 at 10:12 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> On Mon, May 7, 2012 at 2:29 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>
>> Where does this case occur?  When do you need to adjust a resource
>> that has no parent?
>
> for unassigned pci bridge from BIOS, before scan busn_res.end is 0xff,
> so you can not insert them, because the bridge could in the middle.
> Have to update the busn_res.end and insert after the bridge is scanned

Does the resource have children in this case?  If it has no parent,
it's not in the resource tree at all, is it?  Is there any reason to
use adjust_resource() rather than just updating res->start and
res->end directly?

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate
  2012-05-18  2:13   ` Yinghai Lu
@ 2012-05-18 23:32     ` Bjorn Helgaas
  2012-05-19  4:38       ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: Bjorn Helgaas @ 2012-05-18 23:32 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Thu, May 17, 2012 at 8:13 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Thu, May 17, 2012 at 3:19 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> Sigh.  You previously said we should do this order:
>>
>>        for-pci-hostbridge-cleanup
>>        for-pci-busn-alloc
>>        for-pci-res-alloc
>>        for-pci-root-bus-hotplug
>>        for-pci-for-each-res-addon
>>
>> I merged for-pci-hostbridge-cleanup already.  I was about to start
>> merging for-pci-busn-alloc.
>>
>> But now you added for-pci-hotplug-cleanup and made for-pci-busn-alloc
>> depend on it.  I have some comments on for-pci-hotplug-cleanup, so I'm
>> not ready to merge it quite yet.  Can you please just go back to the
>> original order and put the new hotplug cleanup stuff at the *end*?
>
> ok, update for-pci-busn_res branch, now it is based on your next branch.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
> for-pci-busn_res

OK.  You just incorporated the hotplug-cleanup stuff into that branch,
which isn't what I had in mind.  But in the interest of making forward
progress, I merged as much as I could.  The result is at:

  git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next-3.5

After Linus pulls my current "next" branch during the merge window,
I'll put the "next-3.5" stuff into the "next" branch.

Note that I stopped at your probe_resource() patch -- I already told
you I won't merge that in its current form because I think the
interface you propose is too complicated.

Let me know what series you'd like me to work on next, and send the
current patches to the list.

Bjorn

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate
  2012-05-18 23:32     ` Bjorn Helgaas
@ 2012-05-19  4:38       ` Yinghai Lu
  2012-05-21 20:06         ` Bjorn Helgaas
  0 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2012-05-19  4:38 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Fri, May 18, 2012 at 4:32 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Thu, May 17, 2012 at 8:13 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, May 17, 2012 at 3:19 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>>> Sigh.  You previously said we should do this order:
>>>
>>>        for-pci-hostbridge-cleanup
>>>        for-pci-busn-alloc
>>>        for-pci-res-alloc
>>>        for-pci-root-bus-hotplug
>>>        for-pci-for-each-res-addon
>>>
>>> I merged for-pci-hostbridge-cleanup already.  I was about to start
>>> merging for-pci-busn-alloc.
>>>
>>> But now you added for-pci-hotplug-cleanup and made for-pci-busn-alloc
>>> depend on it.  I have some comments on for-pci-hotplug-cleanup, so I'm
>>> not ready to merge it quite yet.  Can you please just go back to the
>>> original order and put the new hotplug cleanup stuff at the *end*?
>>
>> ok, update for-pci-busn_res branch, now it is based on your next branch.
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
>> for-pci-busn_res
>
> OK.  You just incorporated the hotplug-cleanup stuff into that branch,
> which isn't what I had in mind.  But in the interest of making forward
> progress, I merged as much as I could.  The result is at:
>
>  git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next-3.5
>
> After Linus pulls my current "next" branch during the merge window,
> I'll put the "next-3.5" stuff into the "next" branch.

Great! Thanks a lot.

looks one of commit author is messed up.

http://git.kernel.org/?p=linux/kernel/git/helgaas/pci.git;a=commitdiff;h=b20238f05059818de8edd76cb5523b6bf8e26527

author	Bjorn Helgaas <bhelgaas@google.com>	
	Fri, 18 May 2012 17:35:50 +0000 (11:35 -0600)
committer	Bjorn Helgaas <bhelgaas@google.com>	
	Fri, 18 May 2012 20:00:35 +0000 (14:00 -0600)
Will use them insert/update busn res in pci_bus struct.

[bhelgaas: print conflicting entry if insertion fails]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

but if changing it would take you too much time, just leave it as is.

>
> Note that I stopped at your probe_resource() patch -- I already told
> you I won't merge that in its current form because I think the
> interface you propose is too complicated.

ok, let me check if i could simplify it more.

>
> Let me know what series you'd like me to work on next, and send the
> current patches to the list.

Maybe for-pci-res-alloc could be moved forwarded, then
for-pci-busn-alloc
for-pci-root-bus-hotplug
for-pci-for-each-res-addon

Yinghai

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate
  2012-05-19  4:38       ` Yinghai Lu
@ 2012-05-21 20:06         ` Bjorn Helgaas
  0 siblings, 0 replies; 33+ messages in thread
From: Bjorn Helgaas @ 2012-05-21 20:06 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Benjamin Herrenschmidt, Tony Luck, David Miller, x86,
	Dominik Brodowski, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman, linux-pci, linux-kernel, linux-arch

On Fri, May 18, 2012 at 10:38 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Fri, May 18, 2012 at 4:32 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:

> looks one of commit author is messed up.
>
> http://git.kernel.org/?p=linux/kernel/git/helgaas/pci.git;a=commitdiff;h=b20238f05059818de8edd76cb5523b6bf8e26527
>
> author  Bjorn Helgaas <bhelgaas@google.com>
>        Fri, 18 May 2012 17:35:50 +0000 (11:35 -0600)
> committer       Bjorn Helgaas <bhelgaas@google.com>
>        Fri, 18 May 2012 20:00:35 +0000 (14:00 -0600)
> Will use them insert/update busn res in pci_bus struct.
>
> [bhelgaas: print conflicting entry if insertion fails]
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>
> but if changing it would take you too much time, just leave it as is.

Oops, sorry, I squashed two patches into one (no point in two patches
that (1) add A and (2) clean up A), and I must have screwed up the
author then.  I fixed it in my tree.

I also changed the branch name to "for-3.6" to make it more obvious
that the changes there are targeted for the 3.6 merge window, not for
3.5.  After Linus pulls my current "next" branch into 3.5-rcX, I'll
move the for-3.6 stuff to the "next" branch as usual.

>> Let me know what series you'd like me to work on next, and send the
>> current patches to the list.
>
> Maybe for-pci-res-alloc could be moved forwarded, then
> for-pci-busn-alloc
> for-pci-root-bus-hotplug
> for-pci-for-each-res-addon

OK, just send your current patches to the list so everybody has a
chance to see them.

Bjorn

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2012-05-21 20:06 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07 20:29 [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Yinghai Lu
2012-05-07 20:29 ` [PATCH 01/21] PCI: add busn_res into struct pci_bus Yinghai Lu
2012-05-07 20:29 ` [PATCH 02/21] PCI: replace secondary/subordinate with busn_res Yinghai Lu
2012-05-07 20:29 ` [PATCH 03/21] PCI: Remove secondary/subordinate in struct ci_bus Yinghai Lu
2012-05-07 20:29 ` [PATCH 04/21] PCI: Add busn_res for pci domain Yinghai Lu
2012-05-07 20:29 ` [PATCH 05/21] resource: adjust_resource handle resource without parent Yinghai Lu
2012-05-18 17:12   ` Bjorn Helgaas
2012-05-18 17:54     ` Yinghai Lu
2012-05-18 18:06       ` Bjorn Helgaas
2012-05-07 20:29 ` [PATCH 06/21] PCI: Add busn_res operation functions Yinghai Lu
2012-05-07 20:29 ` [PATCH 07/21] PCI: print conflicting entry in busn_res inserting Yinghai Lu
2012-05-07 20:29 ` [PATCH 08/21] PCI: release busn_res when removing bus Yinghai Lu
2012-05-07 20:29 ` [PATCH 09/21] PCI: Insert busn_res in pci_create_root_bus() Yinghai Lu
2012-05-07 20:29 ` [PATCH 10/21] PCI: checking busn_res in pci_scan_root_bus() Yinghai Lu
2012-05-07 20:29 ` [PATCH 11/21] PCI: Add default busn_resource Yinghai Lu
2012-05-07 20:29 ` [PATCH 12/21] PCI: Add default busn_res for pci_scan_bus() Yinghai Lu
2012-05-07 20:29 ` [PATCH 13/21] x86/PCI: add busn_res into resources list for ACPI path Yinghai Lu
2012-05-07 20:29 ` [PATCH 14/21] x86/PCI: put busn resource in pci_root_info for native host bridge drivers Yinghai Lu
2012-05-07 20:30 ` [PATCH 15/21] ia64/PCI: register busn_res for root buses Yinghai Lu
2012-05-07 20:30 ` [PATCH 16/21] sparc/PCI: " Yinghai Lu
2012-05-07 20:43   ` David Miller
2012-05-07 20:30 ` [PATCH 17/21] powerpc/PCI: " Yinghai Lu
2012-05-07 20:30 ` [PATCH 18/21] parisc/PCI: " Yinghai Lu
2012-05-07 20:30 ` [PATCH 19/21] tile/PCI: Use pci_scan_root_bus instead pci_scan_bus Yinghai Lu
2012-05-09 19:32   ` Chris Metcalf
2012-05-09 19:45     ` Yinghai Lu
2012-05-07 20:30 ` [PATCH 20/21] PCI: Register busn_res for iov bus Yinghai Lu
2012-05-07 20:30 ` [PATCH 21/21] PCI: insert busn_res for child bus Yinghai Lu
2012-05-17 22:19 ` [PATCH 00/21] PCI: use busn_res to replace bus secondary/subordinate Bjorn Helgaas
2012-05-18  2:13   ` Yinghai Lu
2012-05-18 23:32     ` Bjorn Helgaas
2012-05-19  4:38       ` Yinghai Lu
2012-05-21 20:06         ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).