diff options
Diffstat (limited to 'arch/x86_64/kernel/aperture.c')
-rw-r--r-- | arch/x86_64/kernel/aperture.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c index 70b9d21ed675..a195ef06ec55 100644 --- a/arch/x86_64/kernel/aperture.c +++ b/arch/x86_64/kernel/aperture.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * because only the bootmem allocator can allocate 32+MB. | 8 | * because only the bootmem allocator can allocate 32+MB. |
9 | * | 9 | * |
10 | * Copyright 2002 Andi Kleen, SuSE Labs. | 10 | * Copyright 2002 Andi Kleen, SuSE Labs. |
11 | * $Id: aperture.c,v 1.7 2003/08/01 03:36:18 ak Exp $ | ||
12 | */ | 11 | */ |
13 | #include <linux/config.h> | 12 | #include <linux/config.h> |
14 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
@@ -24,6 +23,7 @@ | |||
24 | #include <asm/proto.h> | 23 | #include <asm/proto.h> |
25 | #include <asm/pci-direct.h> | 24 | #include <asm/pci-direct.h> |
26 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
26 | #include <asm/k8.h> | ||
27 | 27 | ||
28 | int iommu_aperture; | 28 | int iommu_aperture; |
29 | int iommu_aperture_disabled __initdata = 0; | 29 | int iommu_aperture_disabled __initdata = 0; |
@@ -37,8 +37,6 @@ int fix_aperture __initdata = 1; | |||
37 | /* This code runs before the PCI subsystem is initialized, so just | 37 | /* This code runs before the PCI subsystem is initialized, so just |
38 | access the northbridge directly. */ | 38 | access the northbridge directly. */ |
39 | 39 | ||
40 | #define NB_ID_3 (PCI_VENDOR_ID_AMD | (0x1103<<16)) | ||
41 | |||
42 | static u32 __init allocate_aperture(void) | 40 | static u32 __init allocate_aperture(void) |
43 | { | 41 | { |
44 | pg_data_t *nd0 = NODE_DATA(0); | 42 | pg_data_t *nd0 = NODE_DATA(0); |
@@ -68,20 +66,20 @@ static u32 __init allocate_aperture(void) | |||
68 | return (u32)__pa(p); | 66 | return (u32)__pa(p); |
69 | } | 67 | } |
70 | 68 | ||
71 | static int __init aperture_valid(char *name, u64 aper_base, u32 aper_size) | 69 | static int __init aperture_valid(u64 aper_base, u32 aper_size) |
72 | { | 70 | { |
73 | if (!aper_base) | 71 | if (!aper_base) |
74 | return 0; | 72 | return 0; |
75 | if (aper_size < 64*1024*1024) { | 73 | if (aper_size < 64*1024*1024) { |
76 | printk("Aperture from %s too small (%d MB)\n", name, aper_size>>20); | 74 | printk("Aperture too small (%d MB)\n", aper_size>>20); |
77 | return 0; | 75 | return 0; |
78 | } | 76 | } |
79 | if (aper_base + aper_size >= 0xffffffff) { | 77 | if (aper_base + aper_size >= 0xffffffff) { |
80 | printk("Aperture from %s beyond 4GB. Ignoring.\n",name); | 78 | printk("Aperture beyond 4GB. Ignoring.\n"); |
81 | return 0; | 79 | return 0; |
82 | } | 80 | } |
83 | if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { | 81 | if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { |
84 | printk("Aperture from %s pointing to e820 RAM. Ignoring.\n",name); | 82 | printk("Aperture pointing to e820 RAM. Ignoring.\n"); |
85 | return 0; | 83 | return 0; |
86 | } | 84 | } |
87 | return 1; | 85 | return 1; |
@@ -140,7 +138,7 @@ static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order) | |||
140 | printk("Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", | 138 | printk("Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", |
141 | aper, 32 << *order, apsizereg); | 139 | aper, 32 << *order, apsizereg); |
142 | 140 | ||
143 | if (!aperture_valid("AGP bridge", aper, (32*1024*1024) << *order)) | 141 | if (!aperture_valid(aper, (32*1024*1024) << *order)) |
144 | return 0; | 142 | return 0; |
145 | return (u32)aper; | 143 | return (u32)aper; |
146 | } | 144 | } |
@@ -208,10 +206,10 @@ void __init iommu_hole_init(void) | |||
208 | 206 | ||
209 | fix = 0; | 207 | fix = 0; |
210 | for (num = 24; num < 32; num++) { | 208 | for (num = 24; num < 32; num++) { |
211 | char name[30]; | 209 | if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) |
212 | if (read_pci_config(0, num, 3, 0x00) != NB_ID_3) | 210 | continue; |
213 | continue; | ||
214 | 211 | ||
212 | iommu_detected = 1; | ||
215 | iommu_aperture = 1; | 213 | iommu_aperture = 1; |
216 | 214 | ||
217 | aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7; | 215 | aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7; |
@@ -222,9 +220,7 @@ void __init iommu_hole_init(void) | |||
222 | printk("CPU %d: aperture @ %Lx size %u MB\n", num-24, | 220 | printk("CPU %d: aperture @ %Lx size %u MB\n", num-24, |
223 | aper_base, aper_size>>20); | 221 | aper_base, aper_size>>20); |
224 | 222 | ||
225 | sprintf(name, "northbridge cpu %d", num-24); | 223 | if (!aperture_valid(aper_base, aper_size)) { |
226 | |||
227 | if (!aperture_valid(name, aper_base, aper_size)) { | ||
228 | fix = 1; | 224 | fix = 1; |
229 | break; | 225 | break; |
230 | } | 226 | } |
@@ -273,7 +269,7 @@ void __init iommu_hole_init(void) | |||
273 | 269 | ||
274 | /* Fix up the north bridges */ | 270 | /* Fix up the north bridges */ |
275 | for (num = 24; num < 32; num++) { | 271 | for (num = 24; num < 32; num++) { |
276 | if (read_pci_config(0, num, 3, 0x00) != NB_ID_3) | 272 | if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) |
277 | continue; | 273 | continue; |
278 | 274 | ||
279 | /* Don't enable translation yet. That is done later. | 275 | /* Don't enable translation yet. That is done later. |