Commit a06a3014 authored by Li Shaohua's avatar Li Shaohua Committed by Linus Torvalds

[PATCH] PCI resource allocation re-ordering

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: default avatarLinus Torvalds <torvalds@osdl.org>
parent 548a0574
...@@ -164,7 +164,7 @@ static void __init pcibios_allocate_resources(int pass) ...@@ -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; struct pci_dev *dev = NULL;
int idx; int idx;
...@@ -204,6 +204,7 @@ static void __init pcibios_assign_resources(void) ...@@ -204,6 +204,7 @@ static void __init pcibios_assign_resources(void)
pci_assign_resource(dev, PCI_ROM_RESOURCE); pci_assign_resource(dev, PCI_ROM_RESOURCE);
} }
} }
return 0;
} }
void __init pcibios_resource_survey(void) void __init pcibios_resource_survey(void)
...@@ -212,9 +213,14 @@ 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_bus_resources(&pci_root_buses);
pcibios_allocate_resources(0); pcibios_allocate_resources(0);
pcibios_allocate_resources(1); 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) int pcibios_enable_resources(struct pci_dev *dev, int mask)
{ {
u16 cmd, old_cmd; u16 cmd, old_cmd;
......
...@@ -170,4 +170,8 @@ static int __init acpi_motherboard_init(void) ...@@ -170,4 +170,8 @@ static int __init acpi_motherboard_init(void)
return 0; 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);
...@@ -104,4 +104,8 @@ static int __init pnp_system_init(void) ...@@ -104,4 +104,8 @@ static int __init pnp_system_init(void)
return pnp_register_driver(&system_pnp_driver); 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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment