diff options
Diffstat (limited to 'arch/x86_64/kernel/aperture.c')
-rw-r--r-- | arch/x86_64/kernel/aperture.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c index 58af8e73738b..b487396c4c5b 100644 --- a/arch/x86_64/kernel/aperture.c +++ b/arch/x86_64/kernel/aperture.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/pci_ids.h> | 17 | #include <linux/pci_ids.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
20 | #include <linux/ioport.h> | ||
20 | #include <asm/e820.h> | 21 | #include <asm/e820.h> |
21 | #include <asm/io.h> | 22 | #include <asm/io.h> |
22 | #include <asm/proto.h> | 23 | #include <asm/proto.h> |
@@ -33,6 +34,18 @@ int fallback_aper_force __initdata = 0; | |||
33 | 34 | ||
34 | int fix_aperture __initdata = 1; | 35 | int fix_aperture __initdata = 1; |
35 | 36 | ||
37 | static struct resource gart_resource = { | ||
38 | .name = "GART", | ||
39 | .flags = IORESOURCE_MEM, | ||
40 | }; | ||
41 | |||
42 | static void __init insert_aperture_resource(u32 aper_base, u32 aper_size) | ||
43 | { | ||
44 | gart_resource.start = aper_base; | ||
45 | gart_resource.end = aper_base + aper_size - 1; | ||
46 | insert_resource(&iomem_resource, &gart_resource); | ||
47 | } | ||
48 | |||
36 | /* This code runs before the PCI subsystem is initialized, so just | 49 | /* This code runs before the PCI subsystem is initialized, so just |
37 | access the northbridge directly. */ | 50 | access the northbridge directly. */ |
38 | 51 | ||
@@ -48,7 +61,7 @@ static u32 __init allocate_aperture(void) | |||
48 | 61 | ||
49 | /* | 62 | /* |
50 | * Aperture has to be naturally aligned. This means an 2GB aperture won't | 63 | * Aperture has to be naturally aligned. This means an 2GB aperture won't |
51 | * have much chances to find a place in the lower 4GB of memory. | 64 | * have much chance of finding a place in the lower 4GB of memory. |
52 | * Unfortunately we cannot move it up because that would make the | 65 | * Unfortunately we cannot move it up because that would make the |
53 | * IOMMU useless. | 66 | * IOMMU useless. |
54 | */ | 67 | */ |
@@ -62,6 +75,7 @@ static u32 __init allocate_aperture(void) | |||
62 | } | 75 | } |
63 | printk("Mapping aperture over %d KB of RAM @ %lx\n", | 76 | printk("Mapping aperture over %d KB of RAM @ %lx\n", |
64 | aper_size >> 10, __pa(p)); | 77 | aper_size >> 10, __pa(p)); |
78 | insert_aperture_resource((u32)__pa(p), aper_size); | ||
65 | return (u32)__pa(p); | 79 | return (u32)__pa(p); |
66 | } | 80 | } |
67 | 81 | ||
@@ -198,7 +212,7 @@ void __init iommu_hole_init(void) | |||
198 | u64 aper_base, last_aper_base = 0; | 212 | u64 aper_base, last_aper_base = 0; |
199 | int valid_agp = 0; | 213 | int valid_agp = 0; |
200 | 214 | ||
201 | if (iommu_aperture_disabled || !fix_aperture) | 215 | if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed()) |
202 | return; | 216 | return; |
203 | 217 | ||
204 | printk("Checking aperture...\n"); | 218 | printk("Checking aperture...\n"); |
@@ -233,8 +247,13 @@ void __init iommu_hole_init(void) | |||
233 | last_aper_base = aper_base; | 247 | last_aper_base = aper_base; |
234 | } | 248 | } |
235 | 249 | ||
236 | if (!fix && !fallback_aper_force) | 250 | if (!fix && !fallback_aper_force) { |
251 | if (last_aper_base) { | ||
252 | unsigned long n = (32 * 1024 * 1024) << last_aper_order; | ||
253 | insert_aperture_resource((u32)last_aper_base, n); | ||
254 | } | ||
237 | return; | 255 | return; |
256 | } | ||
238 | 257 | ||
239 | if (!fallback_aper_force) | 258 | if (!fallback_aper_force) |
240 | aper_alloc = search_agp_bridge(&aper_order, &valid_agp); | 259 | aper_alloc = search_agp_bridge(&aper_order, &valid_agp); |