]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/agp/sgi-agp.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6-omap-h63xx.git] / drivers / char / agp / sgi-agp.c
index 4b3eda2679761ff5937ba044b2047422ad8c03ce..4df7734b51c2b37824715038e5e0f9eb1c38fa00 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/agp_backend.h>
 #include <asm/sn/addrs.h>
+#include <asm/sn/io.h>
 #include <asm/sn/pcidev.h>
 #include <asm/sn/pcibus_provider_defs.h>
 #include <asm/sn/tioca_provider.h>
@@ -133,11 +134,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 +179,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 +190,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 +204,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 +214,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);
@@ -282,6 +289,8 @@ static int __devinit agp_sgi_init(void)
        j = 0;
        list_for_each_entry(info, &tioca_list, ca_list) {
                struct list_head *tmp;
+               if (list_empty(info->ca_devices))
+                       continue;
                list_for_each(tmp, info->ca_devices) {
                        u8 cap_ptr;
                        pdev = pci_dev_b(tmp);