linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Tony Luck <tony.luck@intel.com>,
	David Miller <davem@davemloft.net>, x86 <x86@kernel.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>,
	Kyle McMartin <kyle@mcmartin.ca>, Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org
Subject: [PATCH 18/21] parisc/PCI: register busn_res for root buses
Date: Mon,  7 May 2012 13:30:03 -0700	[thread overview]
Message-ID: <1336422606-4244-19-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1336422606-4244-1-git-send-email-yinghai@kernel.org>

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

  parent reply	other threads:[~2012-05-07 20:30 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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 02/21] PCI: replace secondary/subordinate with busn_res 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
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-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   ` 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   ` Yinghai Lu
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 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 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 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   ` 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:29   ` 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   ` Yinghai Lu
2012-05-07 20:30 ` [PATCH 16/21] sparc/PCI: " 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
2012-05-07 20:30 ` Yinghai Lu [this message]
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   ` 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-18 23:32       ` Bjorn Helgaas
2012-05-19  4:38       ` Yinghai Lu
2012-05-19  4:38         ` Yinghai Lu
2012-05-21 20:06         ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336422606-4244-19-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyle@mcmartin.ca \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).