aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/generic.c
diff options
context:
space:
mode:
authorArjan van dev Ven <arjan@linux.intel.com>2008-02-05 23:16:00 -0500
committerDave Airlie <airlied@linux.ie>2008-02-18 23:46:39 -0500
commitfcea424d31868a78366ad5ee0cb3cc2a4cbe689b (patch)
tree9b3a2be661c07d8b094a5489ecafffe4befe5ec0 /drivers/char/agp/generic.c
parent16469a0ea0f6b7562eac98ebb8a7c41ce902d0b1 (diff)
fix historic ioremap() abuse in AGP
Several AGP drivers right now use ioremap_nocache() on kernel ram in order to turn a page of regular memory uncached. There are two problems with this: 1) This is a total nightmare for the ioremap() implementation to keep various mappings of the same page coherent. 2) It's a total nightmare for the AGP code since it adds a ton of complexity in terms of keeping track of 2 different pointers to the same thing, in terms of error handling etc etc. This patch fixes this by making the AGP drivers use the new set_memory_XX APIs instead. Note: amd-k7-agp.c is built on Alpha too, and generic.c is built on ia64 as well, which do not yet have the set_memory_*() APIs, so for them some we have a few ugly #ifdefs - hopefully they'll be fixed soon. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/agp/generic.c')
-rw-r--r--drivers/char/agp/generic.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 7484bc759c4c..7fc0c99a3a58 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -932,9 +932,14 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
932 agp_gatt_table = (void *)table; 932 agp_gatt_table = (void *)table;
933 933
934 bridge->driver->cache_flush(); 934 bridge->driver->cache_flush();
935#ifdef CONFIG_X86
936 set_memory_uc((unsigned long)table, 1 << page_order);
937 bridge->gatt_table = (void *)table;
938#else
935 bridge->gatt_table = ioremap_nocache(virt_to_gart(table), 939 bridge->gatt_table = ioremap_nocache(virt_to_gart(table),
936 (PAGE_SIZE * (1 << page_order))); 940 (PAGE_SIZE * (1 << page_order)));
937 bridge->driver->cache_flush(); 941 bridge->driver->cache_flush();
942#endif
938 943
939 if (bridge->gatt_table == NULL) { 944 if (bridge->gatt_table == NULL) {
940 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++) 945 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
@@ -991,7 +996,11 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
991 * called, then all agp memory is deallocated and removed 996 * called, then all agp memory is deallocated and removed
992 * from the table. */ 997 * from the table. */
993 998
999#ifdef CONFIG_X86
1000 set_memory_wb((unsigned long)bridge->gatt_table, 1 << page_order);
1001#else
994 iounmap(bridge->gatt_table); 1002 iounmap(bridge->gatt_table);
1003#endif
995 table = (char *) bridge->gatt_table_real; 1004 table = (char *) bridge->gatt_table_real;
996 table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); 1005 table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
997 1006