aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp/generic.c')
-rw-r--r--drivers/char/agp/generic.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index c321a924e38a..d62505b5d25a 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -153,7 +153,7 @@ void agp_free_memory(struct agp_memory *curr)
153 } 153 }
154 if (curr->page_count != 0) { 154 if (curr->page_count != 0) {
155 for (i = 0; i < curr->page_count; i++) { 155 for (i = 0; i < curr->page_count; i++) {
156 curr->bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i])); 156 curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i]));
157 } 157 }
158 } 158 }
159 agp_free_key(curr->key); 159 agp_free_key(curr->key);
@@ -209,7 +209,7 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
209 agp_free_memory(new); 209 agp_free_memory(new);
210 return NULL; 210 return NULL;
211 } 211 }
212 new->memory[i] = virt_to_phys(addr); 212 new->memory[i] = virt_to_gart(addr);
213 new->page_count++; 213 new->page_count++;
214 } 214 }
215 new->bridge = bridge; 215 new->bridge = bridge;
@@ -806,8 +806,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
806 break; 806 break;
807 } 807 }
808 808
809 table = (char *) __get_free_pages(GFP_KERNEL, 809 table = alloc_gatt_pages(page_order);
810 page_order);
811 810
812 if (table == NULL) { 811 if (table == NULL) {
813 i++; 812 i++;
@@ -838,7 +837,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
838 size = ((struct aper_size_info_fixed *) temp)->size; 837 size = ((struct aper_size_info_fixed *) temp)->size;
839 page_order = ((struct aper_size_info_fixed *) temp)->page_order; 838 page_order = ((struct aper_size_info_fixed *) temp)->page_order;
840 num_entries = ((struct aper_size_info_fixed *) temp)->num_entries; 839 num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
841 table = (char *) __get_free_pages(GFP_KERNEL, page_order); 840 table = alloc_gatt_pages(page_order);
842 } 841 }
843 842
844 if (table == NULL) 843 if (table == NULL)
@@ -853,7 +852,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
853 agp_gatt_table = (void *)table; 852 agp_gatt_table = (void *)table;
854 853
855 bridge->driver->cache_flush(); 854 bridge->driver->cache_flush();
856 bridge->gatt_table = ioremap_nocache(virt_to_phys(table), 855 bridge->gatt_table = ioremap_nocache(virt_to_gart(table),
857 (PAGE_SIZE * (1 << page_order))); 856 (PAGE_SIZE * (1 << page_order)));
858 bridge->driver->cache_flush(); 857 bridge->driver->cache_flush();
859 858
@@ -861,11 +860,11 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
861 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++) 860 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
862 ClearPageReserved(page); 861 ClearPageReserved(page);
863 862
864 free_pages((unsigned long) table, page_order); 863 free_gatt_pages(table, page_order);
865 864
866 return -ENOMEM; 865 return -ENOMEM;
867 } 866 }
868 bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real); 867 bridge->gatt_bus_addr = virt_to_gart(bridge->gatt_table_real);
869 868
870 /* AK: bogus, should encode addresses > 4GB */ 869 /* AK: bogus, should encode addresses > 4GB */
871 for (i = 0; i < num_entries; i++) { 870 for (i = 0; i < num_entries; i++) {
@@ -919,7 +918,7 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
919 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++) 918 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
920 ClearPageReserved(page); 919 ClearPageReserved(page);
921 920
922 free_pages((unsigned long) bridge->gatt_table_real, page_order); 921 free_gatt_pages(bridge->gatt_table_real, page_order);
923 922
924 agp_gatt_table = NULL; 923 agp_gatt_table = NULL;
925 bridge->gatt_table = NULL; 924 bridge->gatt_table = NULL;