diff options
Diffstat (limited to 'drivers/char/agp/generic.c')
-rw-r--r-- | drivers/char/agp/generic.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 1e8b461b91f1..c50543966eb2 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -437,6 +437,12 @@ int agp_bind_memory(struct agp_memory *curr, off_t pg_start) | |||
437 | curr->bridge->driver->cache_flush(); | 437 | curr->bridge->driver->cache_flush(); |
438 | curr->is_flushed = true; | 438 | curr->is_flushed = true; |
439 | } | 439 | } |
440 | |||
441 | if (curr->bridge->driver->agp_map_memory) { | ||
442 | ret_val = curr->bridge->driver->agp_map_memory(curr); | ||
443 | if (ret_val) | ||
444 | return ret_val; | ||
445 | } | ||
440 | ret_val = curr->bridge->driver->insert_memory(curr, pg_start, curr->type); | 446 | ret_val = curr->bridge->driver->insert_memory(curr, pg_start, curr->type); |
441 | 447 | ||
442 | if (ret_val != 0) | 448 | if (ret_val != 0) |
@@ -478,6 +484,9 @@ int agp_unbind_memory(struct agp_memory *curr) | |||
478 | if (ret_val != 0) | 484 | if (ret_val != 0) |
479 | return ret_val; | 485 | return ret_val; |
480 | 486 | ||
487 | if (curr->bridge->driver->agp_unmap_memory) | ||
488 | curr->bridge->driver->agp_unmap_memory(curr); | ||
489 | |||
481 | curr->is_bound = false; | 490 | curr->is_bound = false; |
482 | curr->pg_start = 0; | 491 | curr->pg_start = 0; |
483 | spin_lock(&curr->bridge->mapped_lock); | 492 | spin_lock(&curr->bridge->mapped_lock); |
@@ -979,7 +988,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge) | |||
979 | set_memory_uc((unsigned long)table, 1 << page_order); | 988 | set_memory_uc((unsigned long)table, 1 << page_order); |
980 | bridge->gatt_table = (void *)table; | 989 | bridge->gatt_table = (void *)table; |
981 | #else | 990 | #else |
982 | bridge->gatt_table = ioremap_nocache(virt_to_gart(table), | 991 | bridge->gatt_table = ioremap_nocache(virt_to_phys(table), |
983 | (PAGE_SIZE * (1 << page_order))); | 992 | (PAGE_SIZE * (1 << page_order))); |
984 | bridge->driver->cache_flush(); | 993 | bridge->driver->cache_flush(); |
985 | #endif | 994 | #endif |
@@ -992,7 +1001,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge) | |||
992 | 1001 | ||
993 | return -ENOMEM; | 1002 | return -ENOMEM; |
994 | } | 1003 | } |
995 | bridge->gatt_bus_addr = virt_to_gart(bridge->gatt_table_real); | 1004 | bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real); |
996 | 1005 | ||
997 | /* AK: bogus, should encode addresses > 4GB */ | 1006 | /* AK: bogus, should encode addresses > 4GB */ |
998 | for (i = 0; i < num_entries; i++) { | 1007 | for (i = 0; i < num_entries; i++) { |
@@ -1132,7 +1141,9 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) | |||
1132 | } | 1141 | } |
1133 | 1142 | ||
1134 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { | 1143 | for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { |
1135 | writel(bridge->driver->mask_memory(bridge, mem->pages[i], mask_type), | 1144 | writel(bridge->driver->mask_memory(bridge, |
1145 | page_to_phys(mem->pages[i]), | ||
1146 | mask_type), | ||
1136 | bridge->gatt_table+j); | 1147 | bridge->gatt_table+j); |
1137 | } | 1148 | } |
1138 | readl(bridge->gatt_table+j-1); /* PCI Posting. */ | 1149 | readl(bridge->gatt_table+j-1); /* PCI Posting. */ |
@@ -1347,9 +1358,8 @@ void global_cache_flush(void) | |||
1347 | EXPORT_SYMBOL(global_cache_flush); | 1358 | EXPORT_SYMBOL(global_cache_flush); |
1348 | 1359 | ||
1349 | unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge, | 1360 | unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge, |
1350 | struct page *page, int type) | 1361 | dma_addr_t addr, int type) |
1351 | { | 1362 | { |
1352 | unsigned long addr = phys_to_gart(page_to_phys(page)); | ||
1353 | /* memory type is ignored in the generic routine */ | 1363 | /* memory type is ignored in the generic routine */ |
1354 | if (bridge->driver->masks) | 1364 | if (bridge->driver->masks) |
1355 | return addr | bridge->driver->masks[0].mask; | 1365 | return addr | bridge->driver->masks[0].mask; |