From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 03/29] PCI: add pci_scan_root_bus(), deprecate pci_scan_bus() and pci_scan_bus_parented()
Date: Thu, 13 Oct 2011 22:27:22 -0600 [thread overview]
Message-ID: <20111014042722.23504.2041.stgit@bhelgaas.mtv.corp.google.com> (raw)
In-Reply-To: <20111014042142.23504.70417.stgit@bhelgaas.mtv.corp.google.com>
"Early" and "header" quirks use incorrect bus resources because they see
the default resources assigned by pci_create_bus(), before the architecture
fixes them up (typically in pcibios_fixup_bus()). Regions reserved by
these quirks end up with the wrong parents.
Here's the standard path for scanning a PCI root bus:
pci_scan_bus or pci_scan_bus_parented
pci_create_bus <-- A create with default resources
pci_scan_child_bus
pci_scan_slot
pci_scan_single_device
pci_scan_device
pci_setup_device
pci_fixup_device(early) <-- B
pci_device_add
pci_fixup_device(header) <-- C
pcibios_fixup_bus <-- D fill in correct resources
Early and header quirks at B and C use the default (incorrect) root bus
resources rather than those filled in at D.
This patch adds a new pci_scan_root_bus() function that sets the bus
resources correctly from a supplied list of resources. It also marks
pci_scan_bus() and pci_scan_bus_parented() as deprecated.
Callers of pci_scan_bus() should switch to pci_scan_root_bus(). Callers of
pci_scan_bus_parented() should use pci_create_root_bus() followed by
pci_scan_child_bus(). In both cases, root bus resource fixups, e.g.,
in pcibios_fixup_bus(), should be removed.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/probe.c | 39 +++++++++++++++++++++++++++++++++++++--
include/linux/pci.h | 19 ++++++++-----------
2 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 20d2d40..9cb7158 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1624,18 +1624,53 @@ struct pci_bus *pci_create_bus(struct device *parent,
return pci_create_root_bus(parent, bus, ops, sysdata, NULL);
}
+/*
+ * Deprecated; use pci_create_root_bus() with non-NULL resources and
+ * pci_scan_child_bus() instead
+ */
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
int bus, struct pci_ops *ops, void *sysdata)
{
struct pci_bus *b;
b = pci_create_root_bus(parent, bus, ops, sysdata, NULL);
- if (b)
- b->subordinate = pci_scan_child_bus(b);
+ if (!b)
+ return NULL;
+
+ b->subordinate = pci_scan_child_bus(b);
return b;
}
EXPORT_SYMBOL(pci_scan_bus_parented);
+/* Deprecated; use pci_scan_root_bus() with non-NULL resources instead */
+struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
+ void *sysdata)
+{
+ struct pci_bus *b;
+
+ b = pci_create_root_bus(NULL, bus, ops, sysdata, NULL);
+ if (!b)
+ return NULL;
+
+ b->subordinate = pci_scan_child_bus(b);
+ pci_bus_add_devices(b);
+ return b;
+}
+
+struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus_num,
+ struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+ struct pci_bus *bus;
+
+ bus = pci_create_root_bus(parent, bus_num, ops, sysdata, resources);
+ if (!bus)
+ return NULL;
+
+ bus->subordinate = pci_scan_child_bus(bus);
+ pci_bus_add_devices(bus);
+ return bus;
+}
+
#ifdef CONFIG_HOTPLUG
/**
* pci_rescan_bus - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6bdf854..03c6089 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -655,20 +655,17 @@ void pci_fixup_cardbus(struct pci_bus *);
void pcibios_scan_specific_bus(int busn);
extern struct pci_bus *pci_find_bus(int domain, int busnr);
void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
- struct pci_ops *ops, void *sysdata);
-static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
- void *sysdata)
-{
- struct pci_bus *root_bus;
- root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
- if (root_bus)
- pci_bus_add_devices(root_bus);
- return root_bus;
-}
+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_bus *pci_create_root_bus(struct device *parent, int bus,
struct pci_ops *ops, void *sysdata,
struct list_head *resources);
+struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
+ struct pci_ops *ops, void *sysdata)
+ __deprecated;
+struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
+ void *sysdata) __deprecated;
struct pci_bus *pci_create_bus(struct device *parent, int bus,
struct pci_ops *ops, void *sysdata) __deprecated;
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
next prev parent reply other threads:[~2011-10-14 4:34 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 4:27 [PATCH v2 00/29] Create PCI root buses with correct resources Bjorn Helgaas
2011-10-14 4:27 ` [PATCH v2 01/29] PCI: add helpers for building PCI bus resource lists Bjorn Helgaas
2011-10-14 4:27 ` [PATCH v2 02/29] PCI: add pci_create_root_bus(), deprecate pci_create_bus() Bjorn Helgaas
2011-10-14 4:27 ` Bjorn Helgaas [this message]
2011-10-14 4:27 ` [PATCH v2 04/29] MIPS: PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14 4:27 ` [PATCH v2 05/29] x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14 4:27 ` [PATCH v2 06/29] x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus() Bjorn Helgaas
2011-10-14 5:30 ` Yinghai Lu
2011-10-14 20:32 ` Bjorn Helgaas
2011-10-14 20:39 ` Yinghai Lu
2011-10-14 20:54 ` Bjorn Helgaas
2011-10-14 21:15 ` Yinghai Lu
2011-10-14 4:27 ` [PATCH v2 07/29] powerpc/PCI: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-14 4:27 ` [PATCH v2 08/29] powerpc/PCI: split PHB part out of pcibios_map_io_space() Bjorn Helgaas
2011-10-14 4:27 ` [PATCH v2 09/29] powerpc/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14 7:34 ` Benjamin Herrenschmidt
2011-10-14 4:27 ` [PATCH v2 10/29] microblaze/PCI: fix pci_bus_for_each_resource() usage Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 11/29] microblaze/PCI: make pcibios_setup_phb_resources() static Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 12/29] microblaze/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 13/29] microblaze/PCI: use pci_scan_root_bus() Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 14/29] sparc/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14 4:46 ` David Miller
2011-10-14 4:49 ` David Miller
2011-10-14 4:28 ` [PATCH v2 15/29] sparc32, leon/PCI: convert to pci_scan_root_bus() " Bjorn Helgaas
2011-10-14 4:43 ` David Miller
2011-10-14 4:28 ` [PATCH v2 16/29] ia64/PCI: use pci_create_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 17/29] ia64/PCI: convert to pci_create_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 18/29] parisc/PCI: use pci_create_root_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 19/29] parisc/PCI: supply root bus resources to pci_create_root_bus() Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 20/29] parisc/PCI: deal with LMMIO/PAT overlaps before creating PCI root bus Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 21/29] parisc/PCI: use pci_create_root_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14 4:28 ` [PATCH v2 22/29] parisc/PCI: supply root bus resources to pci_create_root_bus() Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 23/29] xen/PCI: use pci_create_root_bus() instead of pci_scan_bus_parented() Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 24/29] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 25/29] arm/PCI: " Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 26/29] frv/PCI: " Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 27/29] mn10300/PCI: " Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 28/29] sh/PCI: " Bjorn Helgaas
2011-10-14 4:29 ` [PATCH v2 29/29] xtensa/PCI: " Bjorn Helgaas
2011-10-14 15:14 ` [PATCH v2 00/29] Create PCI root buses with correct resources James Bottomley
2011-10-14 15:33 ` Bjorn Helgaas
2011-10-14 15:45 ` James Bottomley
2011-10-14 17:21 ` Bjorn Helgaas
2011-12-20 15:55 ` Bjorn Helgaas
2011-12-22 18:59 ` David Miller
2011-12-22 19:15 ` David Miller
2011-12-22 19:56 ` David Miller
2011-12-22 22:02 ` 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=20111014042722.23504.2041.stgit@bhelgaas.mtv.corp.google.com \
--to=bhelgaas@google.com \
--cc=linux-arch@vger.kernel.org \
--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®