[PATCH] sgi-agp: fixes a problem with accessing GART memory in sgi_tioca_insert_memor...
authorMichael Werner <werner@mrcoffee.engr.sgi.com>
Mon, 28 Mar 2005 06:08:42 +0000 (22:08 -0800)
committerDave Jones <davej@redhat.com>
Tue, 7 Jun 2005 19:35:43 +0000 (12:35 -0700)
This patch fixes a problem with accessing GART memory in
sgi_tioca_insert_memory and sgi_tioca_remove_memory.

 sgi-agp.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Signed-off-by: Mike Werner <werner@sgi.com>
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/char/agp/sgi-agp.c

index 4b3eda2679761ff5937ba044b2047422ad8c03ce..d3aa159c9decbfa0ba99e6b42db5aa7f22ac6859 100644 (file)
@@ -133,11 +133,14 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
        off_t j;
        void *temp;
        struct agp_bridge_data *bridge;
+       u64 *table;
 
        bridge = mem->bridge;
        if (!bridge)
                return -EINVAL;
 
+       table = (u64 *)bridge->gatt_table;
+
        temp = bridge->current_size;
 
        switch (bridge->driver->size_type) {
@@ -175,7 +178,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
        j = pg_start;
 
        while (j < (pg_start + mem->page_count)) {
-               if (*(bridge->gatt_table + j))
+               if (table[j])
                        return -EBUSY;
                j++;
        }
@@ -186,7 +189,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
        }
 
        for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-               *(bridge->gatt_table + j) =
+               table[j] =
                    bridge->driver->mask_memory(bridge, mem->memory[i],
                                                mem->type);
        }
@@ -200,6 +203,7 @@ static int sgi_tioca_remove_memory(struct agp_memory *mem, off_t pg_start,
 {
        size_t i;
        struct agp_bridge_data *bridge;
+       u64 *table;
 
        bridge = mem->bridge;
        if (!bridge)
@@ -209,8 +213,10 @@ static int sgi_tioca_remove_memory(struct agp_memory *mem, off_t pg_start,
                return -EINVAL;
        }
 
+       table = (u64 *)bridge->gatt_table;
+
        for (i = pg_start; i < (mem->page_count + pg_start); i++) {
-               *(bridge->gatt_table + i) = 0;
+               table[i] = 0;
        }
 
        bridge->driver->tlb_flush(mem);