diff options
Diffstat (limited to 'arch/x86/pci/i386.c')
-rw-r--r-- | arch/x86/pci/i386.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index b22d13b0c71d..5dc9e8c63fcd 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -129,7 +129,9 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
129 | continue; | 129 | continue; |
130 | if (!r->start || | 130 | if (!r->start || |
131 | pci_claim_resource(dev, idx) < 0) { | 131 | pci_claim_resource(dev, idx) < 0) { |
132 | dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); | 132 | dev_info(&dev->dev, |
133 | "can't reserve window %pR\n", | ||
134 | r); | ||
133 | /* | 135 | /* |
134 | * Something is wrong with the region. | 136 | * Something is wrong with the region. |
135 | * Invalidate the resource to prevent | 137 | * Invalidate the resource to prevent |
@@ -144,16 +146,29 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
144 | } | 146 | } |
145 | } | 147 | } |
146 | 148 | ||
149 | struct pci_check_idx_range { | ||
150 | int start; | ||
151 | int end; | ||
152 | }; | ||
153 | |||
147 | static void __init pcibios_allocate_resources(int pass) | 154 | static void __init pcibios_allocate_resources(int pass) |
148 | { | 155 | { |
149 | struct pci_dev *dev = NULL; | 156 | struct pci_dev *dev = NULL; |
150 | int idx, disabled; | 157 | int idx, disabled, i; |
151 | u16 command; | 158 | u16 command; |
152 | struct resource *r; | 159 | struct resource *r; |
153 | 160 | ||
161 | struct pci_check_idx_range idx_range[] = { | ||
162 | { PCI_STD_RESOURCES, PCI_STD_RESOURCE_END }, | ||
163 | #ifdef CONFIG_PCI_IOV | ||
164 | { PCI_IOV_RESOURCES, PCI_IOV_RESOURCE_END }, | ||
165 | #endif | ||
166 | }; | ||
167 | |||
154 | for_each_pci_dev(dev) { | 168 | for_each_pci_dev(dev) { |
155 | pci_read_config_word(dev, PCI_COMMAND, &command); | 169 | pci_read_config_word(dev, PCI_COMMAND, &command); |
156 | for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) { | 170 | for (i = 0; i < ARRAY_SIZE(idx_range); i++) |
171 | for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) { | ||
157 | r = &dev->resource[idx]; | 172 | r = &dev->resource[idx]; |
158 | if (r->parent) /* Already allocated */ | 173 | if (r->parent) /* Already allocated */ |
159 | continue; | 174 | continue; |
@@ -164,12 +179,12 @@ static void __init pcibios_allocate_resources(int pass) | |||
164 | else | 179 | else |
165 | disabled = !(command & PCI_COMMAND_MEMORY); | 180 | disabled = !(command & PCI_COMMAND_MEMORY); |
166 | if (pass == disabled) { | 181 | if (pass == disabled) { |
167 | dev_dbg(&dev->dev, "resource %#08llx-%#08llx (f=%lx, d=%d, p=%d)\n", | 182 | dev_dbg(&dev->dev, |
168 | (unsigned long long) r->start, | 183 | "BAR %d: reserving %pr (d=%d, p=%d)\n", |
169 | (unsigned long long) r->end, | 184 | idx, r, disabled, pass); |
170 | r->flags, disabled, pass); | ||
171 | if (pci_claim_resource(dev, idx) < 0) { | 185 | if (pci_claim_resource(dev, idx) < 0) { |
172 | dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); | 186 | dev_info(&dev->dev, |
187 | "can't reserve %pR\n", r); | ||
173 | /* We'll assign a new address later */ | 188 | /* We'll assign a new address later */ |
174 | r->end -= r->start; | 189 | r->end -= r->start; |
175 | r->start = 0; | 190 | r->start = 0; |
@@ -182,7 +197,7 @@ static void __init pcibios_allocate_resources(int pass) | |||
182 | /* Turn the ROM off, leave the resource region, | 197 | /* Turn the ROM off, leave the resource region, |
183 | * but keep it unregistered. */ | 198 | * but keep it unregistered. */ |
184 | u32 reg; | 199 | u32 reg; |
185 | dev_dbg(&dev->dev, "disabling ROM\n"); | 200 | dev_dbg(&dev->dev, "disabling ROM %pR\n", r); |
186 | r->flags &= ~IORESOURCE_ROM_ENABLE; | 201 | r->flags &= ~IORESOURCE_ROM_ENABLE; |
187 | pci_read_config_dword(dev, | 202 | pci_read_config_dword(dev, |
188 | dev->rom_base_reg, ®); | 203 | dev->rom_base_reg, ®); |
@@ -282,6 +297,15 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
282 | return -EINVAL; | 297 | return -EINVAL; |
283 | 298 | ||
284 | prot = pgprot_val(vma->vm_page_prot); | 299 | prot = pgprot_val(vma->vm_page_prot); |
300 | |||
301 | /* | ||
302 | * Return error if pat is not enabled and write_combine is requested. | ||
303 | * Caller can followup with UC MINUS request and add a WC mtrr if there | ||
304 | * is a free mtrr slot. | ||
305 | */ | ||
306 | if (!pat_enabled && write_combine) | ||
307 | return -EINVAL; | ||
308 | |||
285 | if (pat_enabled && write_combine) | 309 | if (pat_enabled && write_combine) |
286 | prot |= _PAGE_CACHE_WC; | 310 | prot |= _PAGE_CACHE_WC; |
287 | else if (pat_enabled || boot_cpu_data.x86 > 3) | 311 | else if (pat_enabled || boot_cpu_data.x86 > 3) |