From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Cc: ink@jurassic.park.msu.ru
Subject: [PATCH] PCI: pci_assign_unassigned_resources() on x86
Date: Fri, 1 Jul 2005 13:48:31 -0700 [thread overview]
Message-ID: <11202509112600@kroah.com> (raw)
In-Reply-To: <11202509114020@kroah.com>
[PATCH] PCI: pci_assign_unassigned_resources() on x86
- Add sanity check for io[port,mem]_resource in setup-bus.c. These
resources look like "free" as they have no parents, but obviously
we must not touch them.
- In i386.c:pci_allocate_bus_resources(), if a bridge resource cannot be
allocated for some reason, then clear its flags. This prevents any child
allocations in this range, so the setup-bus code will work with a clean
resource sub-tree.
- i386.c:pcibios_enable_resources() doesn't enable bridges, as it checks
only resources 0-5, which looks like a clear bug to me. I suspect it
might break hotplug as well in some cases.
From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
commit 299de0343c7d18448a69c635378342e9214b14af
tree 0a456358b5f919328e234868139c983813f4cb80
parent 90b54929b626c80056262d9d99b3f48522e404d0
author Ivan Kokshaysky <ink@jurassic.park.msu.ru> Wed, 15 Jun 2005 18:59:27 +0400
committer Greg Kroah-Hartman <gregkh@suse.de> Fri, 01 Jul 2005 13:35:50 -0700
arch/i386/pci/common.c | 1 +
arch/i386/pci/i386.c | 11 ++++++++---
drivers/pci/setup-bus.c | 2 ++
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -165,6 +165,7 @@ static int __init pcibios_init(void)
if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
pcibios_sort();
#endif
+ pci_assign_unassigned_resources();
return 0;
}
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
--- a/arch/i386/pci/i386.c
+++ b/arch/i386/pci/i386.c
@@ -106,11 +106,16 @@ static void __init pcibios_allocate_bus_
if ((dev = bus->self)) {
for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
r = &dev->resource[idx];
- if (!r->start)
+ if (!r->flags)
continue;
pr = pci_find_parent_resource(dev, r);
- if (!pr || request_resource(pr, r) < 0)
+ if (!r->start || !pr || request_resource(pr, r) < 0) {
printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev));
+ /* Something is wrong with the region.
+ Invalidate the resource to prevent child
+ resource allocations in this range. */
+ r->flags = 0;
+ }
}
}
pcibios_allocate_bus_resources(&bus->children);
@@ -227,7 +232,7 @@ int pcibios_enable_resources(struct pci_
pci_read_config_word(dev, PCI_COMMAND, &cmd);
old_cmd = cmd;
- for(idx=0; idx<6; idx++) {
+ for(idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
/* Only set up the requested stuff */
if (!(mask & (1<<idx)))
continue;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -273,6 +273,8 @@ find_free_bus_resource(struct pci_bus *b
for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
r = bus->resource[i];
+ if (r == &ioport_resource || r == &iomem_resource)
+ continue;
if (r && (r->flags & type_mask) == type && !r->parent)
return r;
}
next prev parent reply other threads:[~2005-07-01 20:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-01 20:47 [GIT PATCH] PCI patches for 2.6.13-rc1 Greg KH
2005-07-01 20:48 ` [PATCH] PCI: Fix up PCI routing in parent bridge Greg KH
2005-07-01 20:48 ` [PATCH] PCI: Increase the number of PCI bus resources Greg KH
2005-07-01 20:48 ` Greg KH [this message]
2005-07-01 20:48 ` [PATCH] PCI: clean up dynamic pci id logic Greg KH
2005-07-01 20:48 ` [PATCH] PCI: handle subtractive decode pci-pci bridge better Greg KH
2005-07-01 20:48 ` [PATCH] PCI: acpi tg3 ethernet not coming back properly after S3 suspendon DellM70 Greg KH
2005-07-01 20:48 ` [PATCH] PCI: Add PCI quirk for SMBus on the Asus P4B-LX Greg KH
2005-07-01 20:48 ` [PATCH] PCI: Remove newline from pci MODALIAS variable Greg KH
2005-07-01 20:48 ` [PATCH] gregkh-pci-pci-assign-unassigned-resources fix Greg KH
2005-07-01 20:48 ` [PATCH] pci: cleanup argument comments for pci_{save,restore}_state Greg KH
[not found] ` <20050701204741.GA1137-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2005-07-12 22:12 ` [GIT PATCH] ACPI patches for 2.6.13-rc2 Len Brown
2005-07-12 22:12 ` Len Brown
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=11202509112600@kroah.com \
--to=gregkh@suse.de \
--cc=greg@kroah.com \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.