]> git.hungrycats.org Git - linux/commitdiff
[PATCH] PCI resource allocation re-ordering
authorLi Shaohua <shaohua.li@intel.com>
Sun, 10 Oct 2004 03:15:28 +0000 (20:15 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 10 Oct 2004 03:15:28 +0000 (20:15 -0700)
This re-orders the PCI and ACPI IO resource assignment as suggested by
Linus.

With this patch, now the sequence of reserving resources is:
 1. PCI claim BAR
 2. ACPI reserve motherboard resources
 3. PNP reserve motherboard resources
 4. PCI allocate resources for uninitialized PCI devices

This way the kernel allocates new PCI resources after it has full
knowledge of the resource state, and at the same time allows ACPI and
PnP to be run _after_ we've filled in our knowledge about pre-allocated
resources.

The way it is done is to make the last phase of the original PCI assign
resources code to be an 'fs_initcall', along with the ACPI and PnP
initializations.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/pci/i386.c
drivers/acpi/motherboard.c
drivers/pnp/system.c

index 59ba6f11201f0ba1869638a4fa313ed3263d0ef6..b171e22838d130c62470d23b12c3dd8cf536e757 100644 (file)
@@ -164,7 +164,7 @@ static void __init pcibios_allocate_resources(int pass)
        }
 }
 
-static void __init pcibios_assign_resources(void)
+static int __init pcibios_assign_resources(void)
 {
        struct pci_dev *dev = NULL;
        int idx;
@@ -204,6 +204,7 @@ static void __init pcibios_assign_resources(void)
                                pci_assign_resource(dev, PCI_ROM_RESOURCE);
                }
        }
+       return 0;
 }
 
 void __init pcibios_resource_survey(void)
@@ -212,9 +213,14 @@ void __init pcibios_resource_survey(void)
        pcibios_allocate_bus_resources(&pci_root_buses);
        pcibios_allocate_resources(0);
        pcibios_allocate_resources(1);
-       pcibios_assign_resources();
 }
 
+/**
+ * called in fs_initcall (one below subsys_initcall),
+ * give a chance for motherboard reserve resources
+ */
+fs_initcall(pcibios_assign_resources);
+
 int pcibios_enable_resources(struct pci_dev *dev, int mask)
 {
        u16 cmd, old_cmd;
index 5475a7737f70b4016a5b90ea9a8a6336c4a20909..ee9c5d13eb6bbe755f5870ec44cdfad0e7c413f3 100644 (file)
@@ -170,4 +170,8 @@ static int __init acpi_motherboard_init(void)
        return 0;
 }
 
-subsys_initcall(acpi_motherboard_init);
+/**
+ * Reserve motherboard resources after PCI claim BARs,
+ * but before PCI assign resources for uninitialized PCI devices
+ */
+fs_initcall(acpi_motherboard_init);
index da52c86dc23a97a626b0c248108515a92a3c78fc..d42015c382af5aa7fd106081403c490ad3673317 100644 (file)
@@ -104,4 +104,8 @@ static int __init pnp_system_init(void)
        return pnp_register_driver(&system_pnp_driver);
 }
 
-subsys_initcall(pnp_system_init);
+/**
+ * Reserve motherboard resources after PCI claim BARs,
+ * but before PCI assign resources for uninitialized PCI devices
+ */
+fs_initcall(pnp_system_init);