From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: Deng-Cheng Zhu <dczhu@mips.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 03/12] MIPS: PCI: supply root bus resources to pci_create_bus()
Date: Mon, 10 Oct 2011 21:18:41 -0600 [thread overview]
Message-ID: <20111011031840.5149.12861.stgit@bhelgaas.mtv.corp.google.com> (raw)
In-Reply-To: <20111011030726.5149.23793.stgit@bhelgaas.mtv.corp.google.com>
Use the new interface of pci_create_bus() so that system controller's
resources are added to the root bus upon bus creation, thereby avoiding
conflicts with PCI quirks before pcibios_fixup_bus() gets the chance to
fixup the root bus resources in pci_scan_child_bus().
Based on original patch by Deng-Cheng Zhu.
Reference: https://lkml.org/lkml/2011/8/26/89
CC: Deng-Cheng Zhu <dczhu@mips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/mips/pci/pci.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 33bba7b..4c7866d 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -80,6 +80,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
{
static int next_busno;
static int need_domain_info;
+ struct list_head resources;
struct pci_bus *bus;
if (!hose->iommu)
@@ -88,7 +89,17 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
if (hose->get_busno && pci_probe_only)
next_busno = (*hose->get_busno)();
- bus = pci_scan_bus(next_busno, hose->pci_ops, hose);
+ INIT_LIST_HEAD(&resources);
+ pci_add_resource(&resources, ctrl->mem_resource);
+ pci_add_resource(&resources, ctrl->io_resource);
+ bus = pci_create_bus(NULL, next_busno, hose->pci_ops, hose, &resources);
+ if (bus) {
+ bus->subordinate = pci_scan_child_bus(bus);
+ pci_bus_add_devices(bus);
+ } else {
+ pci_free_resource_list(&resources);
+ }
+
hose->bus = bus;
need_domain_info = need_domain_info || hose->index;
@@ -265,15 +276,11 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
{
/* Propagate hose info into the subordinate devices. */
- struct pci_controller *hose = bus->sysdata;
struct list_head *ln;
struct pci_dev *dev = bus->self;
- if (!dev) {
- bus->resource[0] = hose->io_resource;
- bus->resource[1] = hose->mem_resource;
- } else if (pci_probe_only &&
- (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
+ if (pci_probe_only && dev &&
+ (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
pci_read_bridge_bases(bus);
pcibios_fixup_device_resources(dev, bus);
}
next prev parent reply other threads:[~2011-10-11 3:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-11 3:18 [RFC PATCH 00/12] Create PCI root buses with correct resources Bjorn Helgaas
2011-10-11 3:18 ` [PATCH 01/12] PCI: add helpers for building PCI bus resource lists Bjorn Helgaas
2011-10-11 3:18 ` [PATCH 02/12] PCI: pass available resources into pci_create_bus() Bjorn Helgaas
2011-10-11 3:18 ` Bjorn Helgaas [this message]
2011-10-11 3:18 ` [PATCH 04/12] x86/PCI: supply root bus resources to pci_create_bus() Bjorn Helgaas
2011-10-11 3:18 ` [PATCH 05/12] powerpc/pci: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-11 3:18 ` [PATCH 06/12] powerpc/pci: split PHB part out of pcibios_map_io_space() Bjorn Helgaas
2011-10-11 3:19 ` [PATCH 07/12] powerpc/pci: supply root bus resources to pci_create_bus() Bjorn Helgaas
2011-10-11 3:19 ` [PATCH 08/12] microblaze/pci: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-11 3:19 ` [PATCH 09/12] microblaze/pci: supply root bus resources to pci_create_bus() Bjorn Helgaas
2011-10-11 3:19 ` [PATCH 10/12] sparc/pci: " Bjorn Helgaas
2011-10-11 3:33 ` David Miller
2011-10-11 3:19 ` [PATCH 11/12] sparc/pci: use pci_create_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-11 3:19 ` [PATCH 12/12] sparc/pci: supply root bus resources to pci_create_bus() Bjorn Helgaas
2011-10-11 3:33 ` David Miller
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=20111011031840.5149.12861.stgit@bhelgaas.mtv.corp.google.com \
--to=bhelgaas@google.com \
--cc=dczhu@mips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.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
all inboxes | Powered by JetHome®