From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Len Brown <lenb@kernel.org>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
Jiang Liu <jiang.liu@huawei.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>,
x86@kernel.org
Subject: [PATCH 2/8] PCI, x86: Separate out pcibios_allocate_dev_resources()
Date: Sat, 3 Nov 2012 21:39:25 -0700 [thread overview]
Message-ID: <1352003971-22278-3-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1352003971-22278-1-git-send-email-yinghai@kernel.org>
Thus pcibios_allocate_resources() could more simple and clean.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: x86@kernel.org
---
arch/x86/pci/i386.c | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 9800362..5817cf2 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -232,9 +232,8 @@ struct pci_check_idx_range {
int end;
};
-static void __init pcibios_allocate_resources(int pass)
+static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
{
- struct pci_dev *dev = NULL;
int idx, disabled, i;
u16 command;
struct resource *r;
@@ -246,14 +245,13 @@ static void __init pcibios_allocate_resources(int pass)
#endif
};
- for_each_pci_dev(dev) {
- pci_read_config_word(dev, PCI_COMMAND, &command);
- for (i = 0; i < ARRAY_SIZE(idx_range); i++)
+ pci_read_config_word(dev, PCI_COMMAND, &command);
+ for (i = 0; i < ARRAY_SIZE(idx_range); i++)
for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) {
r = &dev->resource[idx];
- if (r->parent) /* Already allocated */
+ if (r->parent) /* Already allocated */
continue;
- if (!r->start) /* Address not assigned at all */
+ if (!r->start) /* Address not assigned at all */
continue;
if (r->flags & IORESOURCE_IO)
disabled = !(command & PCI_COMMAND_IO);
@@ -272,23 +270,29 @@ static void __init pcibios_allocate_resources(int pass)
}
}
}
- if (!pass) {
- r = &dev->resource[PCI_ROM_RESOURCE];
- if (r->flags & IORESOURCE_ROM_ENABLE) {
- /* Turn the ROM off, leave the resource region,
- * but keep it unregistered. */
- u32 reg;
- dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
- r->flags &= ~IORESOURCE_ROM_ENABLE;
- pci_read_config_dword(dev,
- dev->rom_base_reg, ®);
- pci_write_config_dword(dev, dev->rom_base_reg,
+ if (!pass) {
+ r = &dev->resource[PCI_ROM_RESOURCE];
+ if (r->flags & IORESOURCE_ROM_ENABLE) {
+ /* Turn the ROM off, leave the resource region,
+ * but keep it unregistered. */
+ u32 reg;
+ dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
+ r->flags &= ~IORESOURCE_ROM_ENABLE;
+ pci_read_config_dword(dev, dev->rom_base_reg, ®);
+ pci_write_config_dword(dev, dev->rom_base_reg,
reg & ~PCI_ROM_ADDRESS_ENABLE);
- }
}
}
}
+static void __init pcibios_allocate_resources(int pass)
+{
+ struct pci_dev *dev = NULL;
+
+ for_each_pci_dev(dev)
+ pcibios_allocate_dev_resources(dev, pass);
+}
+
static int __init pcibios_assign_resources(void)
{
struct pci_dev *dev = NULL;
--
1.7.7
next prev parent reply other threads:[~2012-11-04 4:41 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-18 6:12 [PATCH v3 0/6] acpi,pci: hostbridge hotplug support Taku Izumi
2012-09-18 6:19 ` [PATCH v3 1/8] ACPI, PCI: Use normal list for struct acpi_pci_driver Taku Izumi
2012-09-18 6:20 ` [PATCH v3 2/8] ACPI, PCI: Notify acpi_pci_drivers when hot-plugging PCI root bridges Taku Izumi
2012-09-18 6:21 ` [PATCH v3 3/8] ACPI, PCI: add acpi_pci_drivers protection Taku Izumi
2012-09-18 6:22 ` [PATCH v3 4/8] ACPI, PCI: change acpi_pci_drivers' add/remove interface Taku Izumi
2012-09-19 22:46 ` Bjorn Helgaas
2012-09-20 10:15 ` Taku Izumi
2012-09-21 7:03 ` [PATCH] change signature of walk_root_bridge() function Taku Izumi
2012-09-21 13:24 ` Bjorn Helgaas
2012-09-18 6:23 ` [PATCH v3 5/8] ACPI, PCI: change acpi_pci_find_root implementation Taku Izumi
2012-09-19 22:03 ` Bjorn Helgaas
2012-09-21 7:14 ` Taku Izumi
2012-09-21 17:57 ` Bjorn Helgaas
2012-09-18 6:24 ` [PATCH v3 6/8] ACPI, PCI: add acpi_pci_roots protection Taku Izumi
2012-09-20 19:32 ` Bjorn Helgaas
2012-09-18 6:25 ` [PATCH v3 7/8] ACPI, PCI: add hostbridge removal function Taku Izumi
2012-09-21 20:09 ` Bjorn Helgaas
2012-09-27 16:48 ` Bjorn Helgaas
2012-09-27 17:23 ` Yinghai Lu
2012-09-27 17:59 ` Yinghai Lu
2012-09-27 18:44 ` Bjorn Helgaas
2012-09-27 20:17 ` Yinghai Lu
2012-09-28 16:07 ` Bjorn Helgaas
2012-09-28 16:19 ` Yinghai Lu
2012-09-28 19:44 ` Bjorn Helgaas
2012-09-28 0:15 ` Taku Izumi
2012-09-28 0:23 ` Bjorn Helgaas
2012-09-28 14:16 ` Bjorn Helgaas
2012-09-28 9:46 ` Taku Izumi
2012-10-30 4:02 ` Bjorn Helgaas
2012-10-30 17:42 ` Yinghai Lu
2012-10-30 17:42 ` [PATCH 1/8] PCI: Separate out pci_assign_unassigned_bus_resources() Yinghai Lu
2012-10-30 17:42 ` [PATCH 2/8] PCI: Move pci_rescan_bus() back to probe.c Yinghai Lu
2012-10-30 17:42 ` [PATCH 3/8] PCI: Move out pci_enable_bridges out of assign_unsigned_bus_res Yinghai Lu
2012-11-02 10:02 ` Taku Izumi
2012-11-02 14:56 ` Yinghai Lu
2012-10-30 17:42 ` [PATCH 4/8] PCI, ACPI: assign unassigned resource for hot add root bus Yinghai Lu
2012-10-30 17:42 ` [PATCH 5/8] PCI: Add pci_stop/remove_root_bus() Yinghai Lu
2012-10-30 17:42 ` [PATCH 6/8] PCI, ACPI: Make acpi_pci_root_remove stop/remove pci root bus Yinghai Lu
2012-10-30 17:42 ` [PATCH 7/8] PCI, ACPI: delete root bus prt during hot remove path Yinghai Lu
2012-10-30 17:42 ` [PATCH 8/8] PCI, ACPI: remove acpi_root_driver in reserse order Yinghai Lu
2012-11-02 0:17 ` Rafael J. Wysocki
2012-11-05 22:27 ` Re: Bjorn Helgaas
2012-11-05 22:49 ` Re: Yinghai Lu
2012-11-06 5:03 ` Taku Izumi
2012-10-31 8:26 ` [PATCH v3,RESEND 7/8] ACPI, PCI: add hostbridge removal function Taku Izumi
2012-10-31 8:27 ` [PATCH v3,RESEND 8/8] ACPI, PCI: add resoruce-assign code for devices under hot-added hostbridge Taku Izumi
2012-11-04 4:39 ` [PATCH 0/8] PCI, ACPI, x86: Reserve fw allocated resource for hot-add root bus Yinghai Lu
2012-11-04 4:39 ` [PATCH 1/8] PCI, x86: Separate out pcibios_allocate_bridge_resources() Yinghai Lu
2012-11-04 4:39 ` Yinghai Lu [this message]
2012-11-04 4:39 ` [PATCH 3/8] PCI, x86: Let pcibios_allocate_bus_resources() take bus instead Yinghai Lu
2012-11-04 4:39 ` [PATCH 4/8] PCI, x86: Separate out rom resource claim Yinghai Lu
2012-11-04 4:39 ` [PATCH 5/8] PCI, x86: Add pcibios_fw_addr_done Yinghai Lu
2012-11-04 4:39 ` [PATCH 6/8] PCI, x86: Remove __init for hw/fw allocated functions Yinghai Lu
2012-11-04 4:39 ` [PATCH 7/8] PCI, x86: Claim FW allocated resources in hot add path Yinghai Lu
2012-11-04 4:39 ` [PATCH 8/8] PCI, ACPI: reserve fw allocated resource for hot added root bus Yinghai Lu
2012-12-07 7:15 ` [PATCH 0/8] PCI, ACPI, x86: Reserve fw allocated resource for hot-add " Yinghai Lu
2013-01-07 23:49 ` Bjorn Helgaas
2013-01-08 17:57 ` Bjorn Helgaas
2013-01-08 18:27 ` Yinghai Lu
2013-01-09 17:35 ` Bjorn Helgaas
2013-01-09 17:53 ` Yinghai Lu
2013-01-09 18:39 ` Bjorn Helgaas
2013-01-09 19:01 ` Yinghai Lu
2013-01-09 20:10 ` Rafael J. Wysocki
2013-01-10 0:34 ` Bjorn Helgaas
2013-01-10 13:07 ` Rafael J. Wysocki
2013-01-10 14:49 ` Bjorn Helgaas
2013-01-09 20:59 ` Benjamin Herrenschmidt
2013-07-02 21:31 ` Bjorn Helgaas
2013-07-02 22:55 ` Yinghai Lu
2012-09-18 6:26 ` [PATCH v3 8/8] ACPI, PCI: add resoruce-assign code for devices under hot-added hostbridge Taku Izumi
2012-09-20 5:41 ` Yinghai Lu
2012-09-23 22:48 ` Yinghai Lu
2012-09-28 9:48 ` Taku Izumi
2012-09-18 18:41 ` [PATCH v3 0/6] acpi,pci: hostbridge hotplug support Yinghai Lu
2012-09-18 18:57 ` Yinghai Lu
2012-09-19 4:53 ` Taku Izumi
2012-09-20 6:19 ` Yinghai Lu
2012-09-19 0:50 ` Jiang Liu
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=1352003971-22278-3-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=bhelgaas@google.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=jiang.liu@huawei.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rjw@sisk.pl \
--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).