aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/aperture_64.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 6eea42eb287b..e5b17f910f8b 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -271,16 +271,16 @@ void __init early_gart_iommu_check(void)
271 * or BIOS forget to put that in reserved. 271 * or BIOS forget to put that in reserved.
272 * try to update e820 to make that region as reserved. 272 * try to update e820 to make that region as reserved.
273 */ 273 */
274 int fix, slot; 274 int i, fix, slot;
275 u32 ctl; 275 u32 ctl;
276 u32 aper_size = 0, aper_order = 0, last_aper_order = 0; 276 u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
277 u64 aper_base = 0, last_aper_base = 0; 277 u64 aper_base = 0, last_aper_base = 0;
278 int aper_enabled = 0, last_aper_enabled = 0; 278 int aper_enabled = 0, last_aper_enabled = 0, last_valid = 0;
279 int i;
280 279
281 if (!early_pci_allowed()) 280 if (!early_pci_allowed())
282 return; 281 return;
283 282
283 /* This is mostly duplicate of iommu_hole_init */
284 fix = 0; 284 fix = 0;
285 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { 285 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
286 int bus; 286 int bus;
@@ -301,19 +301,22 @@ void __init early_gart_iommu_check(void)
301 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff; 301 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff;
302 aper_base <<= 25; 302 aper_base <<= 25;
303 303
304 if ((last_aper_order && aper_order != last_aper_order) || 304 if (last_valid) {
305 (last_aper_base && aper_base != last_aper_base) || 305 if ((aper_order != last_aper_order) ||
306 (last_aper_enabled && aper_enabled != last_aper_enabled)) { 306 (aper_base != last_aper_base) ||
307 fix = 1; 307 (aper_enabled != last_aper_enabled)) {
308 goto out; 308 fix = 1;
309 break;
310 }
309 } 311 }
312
310 last_aper_order = aper_order; 313 last_aper_order = aper_order;
311 last_aper_base = aper_base; 314 last_aper_base = aper_base;
312 last_aper_enabled = aper_enabled; 315 last_aper_enabled = aper_enabled;
316 last_valid = 1;
313 } 317 }
314 } 318 }
315 319
316out:
317 if (!fix && !aper_enabled) 320 if (!fix && !aper_enabled)
318 return; 321 return;
319 322