aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/i386.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/pci/i386.c')
-rw-r--r--arch/x86/pci/i386.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index a85bef20a3b9..52e62e57fedd 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -35,6 +35,7 @@
35#include <asm/pat.h> 35#include <asm/pat.h>
36#include <asm/e820.h> 36#include <asm/e820.h>
37#include <asm/pci_x86.h> 37#include <asm/pci_x86.h>
38#include <asm/io_apic.h>
38 39
39 40
40static int 41static int
@@ -116,7 +117,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
116 struct pci_bus *bus; 117 struct pci_bus *bus;
117 struct pci_dev *dev; 118 struct pci_dev *dev;
118 int idx; 119 int idx;
119 struct resource *r, *pr; 120 struct resource *r;
120 121
121 /* Depth-First Search on bus tree */ 122 /* Depth-First Search on bus tree */
122 list_for_each_entry(bus, bus_list, node) { 123 list_for_each_entry(bus, bus_list, node) {
@@ -126,9 +127,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
126 r = &dev->resource[idx]; 127 r = &dev->resource[idx];
127 if (!r->flags) 128 if (!r->flags)
128 continue; 129 continue;
129 pr = pci_find_parent_resource(dev, r); 130 if (!r->start ||
130 if (!r->start || !pr || 131 pci_claim_resource(dev, idx) < 0) {
131 request_resource(pr, r) < 0) {
132 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 132 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
133 /* 133 /*
134 * Something is wrong with the region. 134 * Something is wrong with the region.
@@ -149,7 +149,7 @@ static void __init pcibios_allocate_resources(int pass)
149 struct pci_dev *dev = NULL; 149 struct pci_dev *dev = NULL;
150 int idx, disabled; 150 int idx, disabled;
151 u16 command; 151 u16 command;
152 struct resource *r, *pr; 152 struct resource *r;
153 153
154 for_each_pci_dev(dev) { 154 for_each_pci_dev(dev) {
155 pci_read_config_word(dev, PCI_COMMAND, &command); 155 pci_read_config_word(dev, PCI_COMMAND, &command);
@@ -168,8 +168,7 @@ static void __init pcibios_allocate_resources(int pass)
168 (unsigned long long) r->start, 168 (unsigned long long) r->start,
169 (unsigned long long) r->end, 169 (unsigned long long) r->end,
170 r->flags, disabled, pass); 170 r->flags, disabled, pass);
171 pr = pci_find_parent_resource(dev, r); 171 if (pci_claim_resource(dev, idx) < 0) {
172 if (!pr || request_resource(pr, r) < 0) {
173 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 172 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx);
174 /* We'll assign a new address later */ 173 /* We'll assign a new address later */
175 r->end -= r->start; 174 r->end -= r->start;
@@ -197,7 +196,7 @@ static void __init pcibios_allocate_resources(int pass)
197static int __init pcibios_assign_resources(void) 196static int __init pcibios_assign_resources(void)
198{ 197{
199 struct pci_dev *dev = NULL; 198 struct pci_dev *dev = NULL;
200 struct resource *r, *pr; 199 struct resource *r;
201 200
202 if (!(pci_probe & PCI_ASSIGN_ROMS)) { 201 if (!(pci_probe & PCI_ASSIGN_ROMS)) {
203 /* 202 /*
@@ -209,8 +208,7 @@ static int __init pcibios_assign_resources(void)
209 r = &dev->resource[PCI_ROM_RESOURCE]; 208 r = &dev->resource[PCI_ROM_RESOURCE];
210 if (!r->flags || !r->start) 209 if (!r->flags || !r->start)
211 continue; 210 continue;
212 pr = pci_find_parent_resource(dev, r); 211 if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
213 if (!pr || request_resource(pr, r) < 0) {
214 r->end -= r->start; 212 r->end -= r->start;
215 r->start = 0; 213 r->start = 0;
216 } 214 }
@@ -230,6 +228,12 @@ void __init pcibios_resource_survey(void)
230 pcibios_allocate_resources(1); 228 pcibios_allocate_resources(1);
231 229
232 e820_reserve_resources_late(); 230 e820_reserve_resources_late();
231 /*
232 * Insert the IO APIC resources after PCI initialization has
233 * occured to handle IO APICS that are mapped in on a BAR in
234 * PCI space, but before trying to assign unassigned pci res.
235 */
236 ioapic_insert_resources();
233} 237}
234 238
235/** 239/**