Skip to content

Commit 56dd669

Browse files
adurbinAndi Kleen
authored andcommitted
[PATCH] Insert GART region into resource map
Patch inserts the GART region into the iomem resource map. The GART will then be visible within /proc/iomem. It will also allow for other users utilizing the GART to subreserve the region (agp or IOMMU). Signed-off-by: Aaron Durbin <adurbin@google.com> Signed-off-by: Andi Kleen <ak@suse.de>
1 parent 9abd792 commit 56dd669

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

arch/x86_64/kernel/aperture.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/pci_ids.h>
1818
#include <linux/pci.h>
1919
#include <linux/bitops.h>
20+
#include <linux/ioport.h>
2021
#include <asm/e820.h>
2122
#include <asm/io.h>
2223
#include <asm/proto.h>
@@ -33,6 +34,18 @@ int fallback_aper_force __initdata = 0;
3334

3435
int fix_aperture __initdata = 1;
3536

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+
3649
/* This code runs before the PCI subsystem is initialized, so just
3750
access the northbridge directly. */
3851

@@ -62,6 +75,7 @@ static u32 __init allocate_aperture(void)
6275
}
6376
printk("Mapping aperture over %d KB of RAM @ %lx\n",
6477
aper_size >> 10, __pa(p));
78+
insert_aperture_resource((u32)__pa(p), aper_size);
6579
return (u32)__pa(p);
6680
}
6781

@@ -233,8 +247,13 @@ void __init iommu_hole_init(void)
233247
last_aper_base = aper_base;
234248
}
235249

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+
}
237255
return;
256+
}
238257

239258
if (!fallback_aper_force)
240259
aper_alloc = search_agp_bridge(&aper_order, &valid_agp);

0 commit comments

Comments
 (0)