[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1332135996-13860-20-git-send-email-yinghai@kernel.org>
Date: Sun, 18 Mar 2012 22:46:08 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Jesse Barnes <jbarnes@...tuousgeek.org>, x86 <x86@...nel.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH -v3 19/47] PCI: Claim hw/fw allocated resources in hot add path.
During testing remove/rescan root bus 00, found
[ 338.142574] bus: 'pci': really_probe: probing driver ata_piix with device 0000:00:01.1
[ 338.146788] ata_piix 0000:00:01.1: device not available (can't reserve [io 0x01f0-0x01f7])
[ 338.150565] ata_piix: probe of 0000:00:01.1 failed with error -22
because that fixed resource is not claimed from
arch/x86/pci/i386.c::pcibios_allocate_resources()
that is init path.
Try to claim those resources, so on the remove/rescan will still use old
resources.
It is some kind honoring HW/FW setting in the registers during hot add.
esp root-bus hot add is through acpi, BIOS have chance to set some register
for us.
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
arch/x86/pci/i386.c | 20 ++++++++++++++++----
drivers/pci/bus.c | 2 ++
include/linux/pci.h | 1 +
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index cecb842..e1ff375 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -193,13 +193,15 @@ EXPORT_SYMBOL(pcibios_align_resource);
* as well.
*/
-static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
+static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
{
int idx;
struct resource *r;
for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
r = &dev->resource[idx];
+ if (r->parent) /* Already allocated */
+ continue;
if (!r->flags)
continue;
if (!r->start || pci_claim_resource(dev, idx) < 0) {
@@ -215,7 +217,7 @@ static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
}
}
-static void __init pcibios_allocate_bus_resources(struct pci_bus *bus)
+static void pcibios_allocate_bus_resources(struct pci_bus *bus)
{
struct pci_bus *child;
@@ -231,7 +233,7 @@ struct pci_check_idx_range {
int end;
};
-static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
+static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
{
int idx, disabled, i;
u16 command;
@@ -284,7 +286,7 @@ static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
}
}
-static void __init pcibios_allocate_resources(struct pci_bus *bus, int pass)
+static void pcibios_allocate_resources(struct pci_bus *bus, int pass)
{
struct pci_dev *dev;
struct pci_bus *child;
@@ -326,6 +328,16 @@ static int __init pcibios_assign_resources(void)
return 0;
}
+void pcibios_resource_survey_bus(struct pci_bus *bus)
+{
+ dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n");
+
+ pcibios_allocate_bus_resources(bus);
+
+ pcibios_allocate_resources(bus, 0);
+ pcibios_allocate_resources(bus, 1);
+}
+
void __init pcibios_resource_survey(void)
{
struct pci_bus *bus;
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 1eb7944..672ffc8 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -94,6 +94,8 @@ void pci_bus_remove_resources(struct pci_bus *bus)
pci_free_resource_list(&bus->resources);
}
+void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
+
/**
* pci_bus_alloc_resource - allocate a resource from a parent bus
* @bus: PCI bus
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 860091f..b434401 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -643,6 +643,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
/* Some device drivers need know if pci is initiated */
extern int no_pci_devices(void);
+void pcibios_resource_survey_bus(struct pci_bus *bus);
void pcibios_fixup_bus(struct pci_bus *);
int __must_check pcibios_enable_device(struct pci_dev *, int mask);
char *pcibios_setup(char *str);
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists