aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/amd-k7-agp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp/amd-k7-agp.c')
-rw-r--r--drivers/char/agp/amd-k7-agp.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index b6b1568314c8..f7e88787af97 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -41,22 +41,8 @@ static int amd_create_page_map(struct amd_page_map *page_map)
41 if (page_map->real == NULL) 41 if (page_map->real == NULL)
42 return -ENOMEM; 42 return -ENOMEM;
43 43
44#ifndef CONFIG_X86
45 SetPageReserved(virt_to_page(page_map->real));
46 global_cache_flush();
47 page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
48 PAGE_SIZE);
49 if (page_map->remapped == NULL) {
50 ClearPageReserved(virt_to_page(page_map->real));
51 free_page((unsigned long) page_map->real);
52 page_map->real = NULL;
53 return -ENOMEM;
54 }
55 global_cache_flush();
56#else
57 set_memory_uc((unsigned long)page_map->real, 1); 44 set_memory_uc((unsigned long)page_map->real, 1);
58 page_map->remapped = page_map->real; 45 page_map->remapped = page_map->real;
59#endif
60 46
61 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { 47 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
62 writel(agp_bridge->scratch_page, page_map->remapped+i); 48 writel(agp_bridge->scratch_page, page_map->remapped+i);
@@ -68,12 +54,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
68 54
69static void amd_free_page_map(struct amd_page_map *page_map) 55static void amd_free_page_map(struct amd_page_map *page_map)
70{ 56{
71#ifndef CONFIG_X86
72 iounmap(page_map->remapped);
73 ClearPageReserved(virt_to_page(page_map->real));
74#else
75 set_memory_wb((unsigned long)page_map->real, 1); 57 set_memory_wb((unsigned long)page_map->real, 1);
76#endif
77 free_page((unsigned long) page_map->real); 58 free_page((unsigned long) page_map->real);
78} 59}
79 60
@@ -291,7 +272,7 @@ static void amd_irongate_cleanup(void)
291 * This routine could be implemented by taking the addresses 272 * This routine could be implemented by taking the addresses
292 * written to the GATT, and flushing them individually. However 273 * written to the GATT, and flushing them individually. However
293 * currently it just flushes the whole table. Which is probably 274 * currently it just flushes the whole table. Which is probably
294 * more efficent, since agp_memory blocks can be a large number of 275 * more efficient, since agp_memory blocks can be a large number of
295 * entries. 276 * entries.
296 */ 277 */
297 278
@@ -309,7 +290,8 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
309 290
310 num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries; 291 num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries;
311 292
312 if (type != 0 || mem->type != 0) 293 if (type != mem->type ||
294 agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type))
313 return -EINVAL; 295 return -EINVAL;
314 296
315 if ((pg_start + mem->page_count) > num_entries) 297 if ((pg_start + mem->page_count) > num_entries)
@@ -348,7 +330,8 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
348 unsigned long __iomem *cur_gatt; 330 unsigned long __iomem *cur_gatt;
349 unsigned long addr; 331 unsigned long addr;
350 332
351 if (type != 0 || mem->type != 0) 333 if (type != mem->type ||
334 agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type))
352 return -EINVAL; 335 return -EINVAL;
353 336
354 for (i = pg_start; i < (mem->page_count + pg_start); i++) { 337 for (i = pg_start; i < (mem->page_count + pg_start); i++) {