diff options
author | Andi Kleen <ak@suse.de> | 2006-06-26 07:56:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 13:48:15 -0400 |
commit | a32073bffc656ca4bde6002b6cf7c1a8e0e22712 (patch) | |
tree | 5ddcd3107eca8807685a19490c2c849d728a51a6 /arch/x86_64/kernel/aperture.c | |
parent | 7c2d9cd218916276e52a5dae827b84a159fe5c96 (diff) |
[PATCH] x86_64: Clean and enhance up K8 northbridge access code
- Factor out the duplicated access/cache code into a single file
* Shared between i386/x86-64.
- Share flush code between AGP and IOMMU
* Fix a bug: AGP didn't wait for end of flush before
- Drop 8 northbridges limit and allocate dynamically
- Add lock to serialize AGP and IOMMU GART flushes
- Add PCI ID for next AMD northbridge
- Random related cleanups
The old K8 NUMA discovery code is unchanged. New systems
should all use SRAT for this.
Cc: "Navin Boppuri" <navin.boppuri@newisys.com>
Cc: Dave Jones <davej@redhat.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/aperture.c')
-rw-r--r-- | arch/x86_64/kernel/aperture.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c index 70b9d21ed675..a7ad03ee98cf 100644 --- a/arch/x86_64/kernel/aperture.c +++ b/arch/x86_64/kernel/aperture.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/proto.h> | 24 | #include <asm/proto.h> |
25 | #include <asm/pci-direct.h> | 25 | #include <asm/pci-direct.h> |
26 | #include <asm/dma.h> | 26 | #include <asm/dma.h> |
27 | #include <asm/k8.h> | ||
27 | 28 | ||
28 | int iommu_aperture; | 29 | int iommu_aperture; |
29 | int iommu_aperture_disabled __initdata = 0; | 30 | int iommu_aperture_disabled __initdata = 0; |
@@ -37,8 +38,6 @@ int fix_aperture __initdata = 1; | |||
37 | /* This code runs before the PCI subsystem is initialized, so just | 38 | /* This code runs before the PCI subsystem is initialized, so just |
38 | access the northbridge directly. */ | 39 | access the northbridge directly. */ |
39 | 40 | ||
40 | #define NB_ID_3 (PCI_VENDOR_ID_AMD | (0x1103<<16)) | ||
41 | |||
42 | static u32 __init allocate_aperture(void) | 41 | static u32 __init allocate_aperture(void) |
43 | { | 42 | { |
44 | pg_data_t *nd0 = NODE_DATA(0); | 43 | pg_data_t *nd0 = NODE_DATA(0); |
@@ -68,20 +67,20 @@ static u32 __init allocate_aperture(void) | |||
68 | return (u32)__pa(p); | 67 | return (u32)__pa(p); |
69 | } | 68 | } |
70 | 69 | ||
71 | static int __init aperture_valid(char *name, u64 aper_base, u32 aper_size) | 70 | static int __init aperture_valid(u64 aper_base, u32 aper_size) |
72 | { | 71 | { |
73 | if (!aper_base) | 72 | if (!aper_base) |
74 | return 0; | 73 | return 0; |
75 | if (aper_size < 64*1024*1024) { | 74 | if (aper_size < 64*1024*1024) { |
76 | printk("Aperture from %s too small (%d MB)\n", name, aper_size>>20); | 75 | printk("Aperture too small (%d MB)\n", aper_size>>20); |
77 | return 0; | 76 | return 0; |
78 | } | 77 | } |
79 | if (aper_base + aper_size >= 0xffffffff) { | 78 | if (aper_base + aper_size >= 0xffffffff) { |
80 | printk("Aperture from %s beyond 4GB. Ignoring.\n",name); | 79 | printk("Aperture beyond 4GB. Ignoring.\n"); |
81 | return 0; | 80 | return 0; |
82 | } | 81 | } |
83 | if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { | 82 | if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { |
84 | printk("Aperture from %s pointing to e820 RAM. Ignoring.\n",name); | 83 | printk("Aperture pointing to e820 RAM. Ignoring.\n"); |
85 | return 0; | 84 | return 0; |
86 | } | 85 | } |
87 | return 1; | 86 | return 1; |
@@ -140,7 +139,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", | 139 | printk("Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", |
141 | aper, 32 << *order, apsizereg); | 140 | aper, 32 << *order, apsizereg); |
142 | 141 | ||
143 | if (!aperture_valid("AGP bridge", aper, (32*1024*1024) << *order)) | 142 | if (!aperture_valid(aper, (32*1024*1024) << *order)) |
144 | return 0; | 143 | return 0; |
145 | return (u32)aper; | 144 | return (u32)aper; |
146 | } | 145 | } |
@@ -208,9 +207,8 @@ void __init iommu_hole_init(void) | |||
208 | 207 | ||
209 | fix = 0; | 208 | fix = 0; |
210 | for (num = 24; num < 32; num++) { | 209 | for (num = 24; num < 32; num++) { |
211 | char name[30]; | 210 | if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) |
212 | if (read_pci_config(0, num, 3, 0x00) != NB_ID_3) | 211 | continue; |
213 | continue; | ||
214 | 212 | ||
215 | iommu_aperture = 1; | 213 | iommu_aperture = 1; |
216 | 214 | ||
@@ -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. |