aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-09-17 22:13:41 -0700
committerYinghai Lu <yinghai@kernel.org>2012-09-17 22:13:41 -0700
commitb25f70f8280915691522c3df093ad99594cff590 (patch)
tree38700fce877b0691f64be40a7b2f1c21d55970b8
parentdb7352fcd1b5cead9c2f71aa369fe7c132fb4e1d (diff)
downloadlinux-yinghai-b25f70f8280915691522c3df093ad99594cff590.tar.gz
PCI: Claim hw/fw allocated resources in hot add path.for-pci-root-bus-hotplug-part2
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. -v2: add rom resource claiming. -v3: separate __init removing to another patch, also put pci_probe checking with caller from rom resource allocating Signed-off-by: Yinghai Lu <yinghai@kernel.org>
-rw-r--r--arch/x86/pci/i386.c13
-rw-r--r--drivers/pci/bus.c2
-rw-r--r--include/linux/pci.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 1806e91637e04d..e0b7f306b383c7 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -352,6 +352,19 @@ 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);
+
+ if (!(pci_probe & PCI_ASSIGN_ROMS))
+ pcibios_allocate_rom_resources(bus);
+}
+
void __init pcibios_resource_survey(void)
{
struct pci_bus *bus;
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 6241fd05bd4108..a85247d05efd6f 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -158,6 +158,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
return ret;
}
+void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
+
/**
* pci_bus_add_device - add a single device
* @dev: device to add
diff --git a/include/linux/pci.h b/include/linux/pci.h
index be1de01de1c4ac..ec254034dd7370 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -676,6 +676,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);
/* Architecture specific versions may override this (weak) */