diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 6974d50..64cd14b 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -238,6 +238,7 @@ static int efficeon_create_gatt_table(struct agp_bridge_data *bridge)
 
 static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
 {
+	struct agp_bridge_data *bridge = mem->bridge;
 	int i, count = mem->page_count, num_entries;
 	unsigned int *page, *last_page;
 	const int clflush_chunk = ((cpuid_ebx(1) >> 8) & 0xff) << 3;
@@ -248,7 +249,8 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t
 	num_entries = A_SIZE_LVL2(agp_bridge->current_size)->num_entries;
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
-	if (type != 0 || mem->type != 0)
+	if (!bridge || type != mem->type ||
+			bridge->driver->agp_type_to_mask_type(bridge,type))
 		return -EINVAL;
 
 	if (!mem->is_flushed) {
@@ -287,6 +289,7 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t
 
 static int efficeon_remove_memory(struct agp_memory * mem, off_t pg_start, int type)
 {
+	struct agp_bridge_data *bridge = mem->bridge;
 	int i, count = mem->page_count, num_entries;
 
 	printk(KERN_DEBUG PFX "efficeon_remove_memory(%lx, %d)\n", pg_start, count);
@@ -295,7 +298,8 @@ static int efficeon_remove_memory(struct agp_memory * mem, off_t pg_start, int t
 
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
-	if (type != 0 || mem->type != 0)
+	if (!bridge || type != mem->type ||
+			bridge->driver->agp_type_to_mask_type(bridge,type))
 		return -EINVAL;
 
 	for (i = 0; i < count; i++) {
