From: "Andi Kleen" <ak@suse.de>

Work around another aperture BIOS bug on Opteron

Based on debugging&code from Vincent ETIENNE <ve@vetienne.net>

>>
I have some problem with AGP initialization with my board : IWILL DK8N (Bi
opteron chipset NFORCE3 ). I use kernel 2.6.10-rc3-mm1, but i have try with

IOMMU reports a 128MB aperture for CPU0 ( that's the value i used in my bios)
at F0000000 but only 32MB at 4000000 for CPU1
<<

This patch checks for this condition and fixes the other CPUs up.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/x86_64/kernel/aperture.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff -puN arch/x86_64/kernel/aperture.c~x86_64-work-around-another-aperture-bios-bug-on-opteron arch/x86_64/kernel/aperture.c
--- 25/arch/x86_64/kernel/aperture.c~x86_64-work-around-another-aperture-bios-bug-on-opteron	2005-01-09 23:01:13.268366008 -0800
+++ 25-akpm/arch/x86_64/kernel/aperture.c	2005-01-09 23:01:13.272365400 -0800
@@ -200,8 +200,8 @@ static __u32 __init search_agp_bridge(u3
 void __init iommu_hole_init(void) 
 { 
 	int fix, num; 
-	u32 aper_size, aper_alloc = 0, aper_order;
-	u64 aper_base; 
+	u32 aper_size, aper_alloc = 0, aper_order, last_aper_order = 0;
+	u64 aper_base, last_aper_base = 0;
 	int valid_agp = 0;
 
 	if (iommu_aperture_disabled || !fix_aperture)
@@ -230,7 +230,15 @@ void __init iommu_hole_init(void) 
 		if (!aperture_valid(name, aper_base, aper_size)) { 
 			fix = 1; 
 			break; 
-		} 
+		}
+
+		if ((last_aper_order && aper_order != last_aper_order) ||
+		    (last_aper_base && aper_base != last_aper_base)) {
+			fix = 1;
+			break;
+		}
+		last_aper_order = aper_order;
+		last_aper_base = aper_base;
 	} 
 
 	if (!fix && !fallback_aper_force) 
_