]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/agp/generic.c
intel/agp: rewrite GTT on resume
[linux-2.6-omap-h63xx.git] / drivers / char / agp / generic.c
index 54c91000646f7fe4eb76d4083f240f79aae79e12..118dbde25dc71ac53ca2afa24f784d2a0dfbce17 100644 (file)
@@ -429,6 +429,10 @@ int agp_bind_memory(struct agp_memory *curr, off_t pg_start)
 
        curr->is_bound = true;
        curr->pg_start = pg_start;
+       spin_lock(&agp_bridge->mapped_lock);
+       list_add(&curr->mapped_list, &agp_bridge->mapped_list);
+       spin_unlock(&agp_bridge->mapped_lock);
+
        return 0;
 }
 EXPORT_SYMBOL(agp_bind_memory);
@@ -461,10 +465,34 @@ int agp_unbind_memory(struct agp_memory *curr)
 
        curr->is_bound = false;
        curr->pg_start = 0;
+       spin_lock(&curr->bridge->mapped_lock);
+       list_del(&curr->mapped_list);
+       spin_unlock(&curr->bridge->mapped_lock);
        return 0;
 }
 EXPORT_SYMBOL(agp_unbind_memory);
 
+/**
+ *     agp_rebind_emmory  -  Rewrite the entire GATT, useful on resume
+ */
+int agp_rebind_memory(void)
+{
+       struct agp_memory *curr;
+       int ret_val = 0;
+
+       spin_lock(&agp_bridge->mapped_lock);
+       list_for_each_entry(curr, &agp_bridge->mapped_list, mapped_list) {
+               ret_val = curr->bridge->driver->insert_memory(curr,
+                                                             curr->pg_start,
+                                                             curr->type);
+               if (ret_val != 0)
+                       break;
+       }
+       spin_unlock(&agp_bridge->mapped_lock);
+       return ret_val;
+}
+EXPORT_SYMBOL(agp_rebind_memory);
+
 /* End - Routines for handling swapping of agp_memory into the GATT */