diff options
Diffstat (limited to 'drivers/char/agp')
-rw-r--r-- | drivers/char/agp/amd-k7-agp.c | 7 | ||||
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 1 | ||||
-rw-r--r-- | drivers/char/agp/ati-agp.c | 7 | ||||
-rw-r--r-- | drivers/char/agp/backend.c | 15 | ||||
-rw-r--r-- | drivers/char/agp/efficeon-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/frontend.c | 15 | ||||
-rw-r--r-- | drivers/char/agp/generic.c | 19 | ||||
-rw-r--r-- | drivers/char/agp/i460-agp.c | 23 | ||||
-rw-r--r-- | drivers/char/agp/intel-agp.c | 5 | ||||
-rw-r--r-- | drivers/char/agp/sgi-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/sworks-agp.c | 28 | ||||
-rw-r--r-- | drivers/char/agp/uninorth-agp.c | 4 |
12 files changed, 74 insertions, 54 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index 3a41672e4d66..1f776651ac64 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -94,19 +94,16 @@ static int amd_create_gatt_pages(int nr_tables) | |||
94 | int retval = 0; | 94 | int retval = 0; |
95 | int i; | 95 | int i; |
96 | 96 | ||
97 | tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *), | 97 | tables = kzalloc((nr_tables + 1) * sizeof(struct amd_page_map *),GFP_KERNEL); |
98 | GFP_KERNEL); | ||
99 | if (tables == NULL) | 98 | if (tables == NULL) |
100 | return -ENOMEM; | 99 | return -ENOMEM; |
101 | 100 | ||
102 | memset (tables, 0, sizeof(struct amd_page_map *) * (nr_tables + 1)); | ||
103 | for (i = 0; i < nr_tables; i++) { | 101 | for (i = 0; i < nr_tables; i++) { |
104 | entry = kmalloc(sizeof(struct amd_page_map), GFP_KERNEL); | 102 | entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL); |
105 | if (entry == NULL) { | 103 | if (entry == NULL) { |
106 | retval = -ENOMEM; | 104 | retval = -ENOMEM; |
107 | break; | 105 | break; |
108 | } | 106 | } |
109 | memset (entry, 0, sizeof(struct amd_page_map)); | ||
110 | tables[i] = entry; | 107 | tables[i] = entry; |
111 | retval = amd_create_page_map(entry); | 108 | retval = amd_create_page_map(entry); |
112 | if (retval != 0) | 109 | if (retval != 0) |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 49996c692a73..76589782adcb 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/agp_backend.h> | 15 | #include <linux/agp_backend.h> |
16 | #include <linux/mmzone.h> | ||
16 | #include <asm/page.h> /* PAGE_SIZE */ | 17 | #include <asm/page.h> /* PAGE_SIZE */ |
17 | #include "agp.h" | 18 | #include "agp.h" |
18 | 19 | ||
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 0b6e72642d6e..53372a83b675 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -118,14 +118,12 @@ static int ati_create_gatt_pages(int nr_tables) | |||
118 | int retval = 0; | 118 | int retval = 0; |
119 | int i; | 119 | int i; |
120 | 120 | ||
121 | tables = kmalloc((nr_tables + 1) * sizeof(ati_page_map *), | 121 | tables = kzalloc((nr_tables + 1) * sizeof(ati_page_map *),GFP_KERNEL); |
122 | GFP_KERNEL); | ||
123 | if (tables == NULL) | 122 | if (tables == NULL) |
124 | return -ENOMEM; | 123 | return -ENOMEM; |
125 | 124 | ||
126 | memset(tables, 0, sizeof(ati_page_map *) * (nr_tables + 1)); | ||
127 | for (i = 0; i < nr_tables; i++) { | 125 | for (i = 0; i < nr_tables; i++) { |
128 | entry = kmalloc(sizeof(ati_page_map), GFP_KERNEL); | 126 | entry = kzalloc(sizeof(ati_page_map), GFP_KERNEL); |
129 | if (entry == NULL) { | 127 | if (entry == NULL) { |
130 | while (i>0) { | 128 | while (i>0) { |
131 | kfree (tables[i-1]); | 129 | kfree (tables[i-1]); |
@@ -136,7 +134,6 @@ static int ati_create_gatt_pages(int nr_tables) | |||
136 | retval = -ENOMEM; | 134 | retval = -ENOMEM; |
137 | break; | 135 | break; |
138 | } | 136 | } |
139 | memset(entry, 0, sizeof(ati_page_map)); | ||
140 | tables[i] = entry; | 137 | tables[i] = entry; |
141 | retval = ati_create_page_map(entry); | 138 | retval = ati_create_page_map(entry); |
142 | if (retval != 0) break; | 139 | if (retval != 0) break; |
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 82b43c541c8d..27bca34b4a65 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -147,6 +147,7 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) | |||
147 | printk(KERN_ERR PFX "unable to get memory for scratch page.\n"); | 147 | printk(KERN_ERR PFX "unable to get memory for scratch page.\n"); |
148 | return -ENOMEM; | 148 | return -ENOMEM; |
149 | } | 149 | } |
150 | flush_agp_mappings(); | ||
150 | 151 | ||
151 | bridge->scratch_page_real = virt_to_gart(addr); | 152 | bridge->scratch_page_real = virt_to_gart(addr); |
152 | bridge->scratch_page = | 153 | bridge->scratch_page = |
@@ -187,9 +188,11 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) | |||
187 | return 0; | 188 | return 0; |
188 | 189 | ||
189 | err_out: | 190 | err_out: |
190 | if (bridge->driver->needs_scratch_page) | 191 | if (bridge->driver->needs_scratch_page) { |
191 | bridge->driver->agp_destroy_page( | 192 | bridge->driver->agp_destroy_page( |
192 | gart_to_virt(bridge->scratch_page_real)); | 193 | gart_to_virt(bridge->scratch_page_real)); |
194 | flush_agp_mappings(); | ||
195 | } | ||
193 | if (got_gatt) | 196 | if (got_gatt) |
194 | bridge->driver->free_gatt_table(bridge); | 197 | bridge->driver->free_gatt_table(bridge); |
195 | if (got_keylist) { | 198 | if (got_keylist) { |
@@ -211,9 +214,11 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge) | |||
211 | bridge->key_list = NULL; | 214 | bridge->key_list = NULL; |
212 | 215 | ||
213 | if (bridge->driver->agp_destroy_page && | 216 | if (bridge->driver->agp_destroy_page && |
214 | bridge->driver->needs_scratch_page) | 217 | bridge->driver->needs_scratch_page) { |
215 | bridge->driver->agp_destroy_page( | 218 | bridge->driver->agp_destroy_page( |
216 | gart_to_virt(bridge->scratch_page_real)); | 219 | gart_to_virt(bridge->scratch_page_real)); |
220 | flush_agp_mappings(); | ||
221 | } | ||
217 | } | 222 | } |
218 | 223 | ||
219 | /* When we remove the global variable agp_bridge from all drivers | 224 | /* When we remove the global variable agp_bridge from all drivers |
@@ -222,12 +227,12 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge) | |||
222 | 227 | ||
223 | struct agp_bridge_data *agp_alloc_bridge(void) | 228 | struct agp_bridge_data *agp_alloc_bridge(void) |
224 | { | 229 | { |
225 | struct agp_bridge_data *bridge = kmalloc(sizeof(*bridge), GFP_KERNEL); | 230 | struct agp_bridge_data *bridge; |
226 | 231 | ||
232 | bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); | ||
227 | if (!bridge) | 233 | if (!bridge) |
228 | return NULL; | 234 | return NULL; |
229 | 235 | ||
230 | memset(bridge, 0, sizeof(*bridge)); | ||
231 | atomic_set(&bridge->agp_in_use, 0); | 236 | atomic_set(&bridge->agp_in_use, 0); |
232 | atomic_set(&bridge->current_memory_agp, 0); | 237 | atomic_set(&bridge->current_memory_agp, 0); |
233 | 238 | ||
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c index ac19fdcd21c1..e7aea77a60f9 100644 --- a/drivers/char/agp/efficeon-agp.c +++ b/drivers/char/agp/efficeon-agp.c | |||
@@ -219,7 +219,7 @@ static int efficeon_create_gatt_table(struct agp_bridge_data *bridge) | |||
219 | 219 | ||
220 | efficeon_private.l1_table[index] = page; | 220 | efficeon_private.l1_table[index] = page; |
221 | 221 | ||
222 | value = virt_to_gart(page) | pati | present | index; | 222 | value = virt_to_gart((unsigned long *)page) | pati | present | index; |
223 | 223 | ||
224 | pci_write_config_dword(agp_bridge->dev, | 224 | pci_write_config_dword(agp_bridge->dev, |
225 | EFFICEON_ATTPAGE, value); | 225 | EFFICEON_ATTPAGE, value); |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 3dfb6648547b..17f520c9d471 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -189,13 +189,12 @@ static int agp_create_segment(struct agp_client *client, struct agp_region *regi | |||
189 | struct agp_segment *user_seg; | 189 | struct agp_segment *user_seg; |
190 | size_t i; | 190 | size_t i; |
191 | 191 | ||
192 | seg = kmalloc((sizeof(struct agp_segment_priv) * region->seg_count), GFP_KERNEL); | 192 | seg = kzalloc((sizeof(struct agp_segment_priv) * region->seg_count), GFP_KERNEL); |
193 | if (seg == NULL) { | 193 | if (seg == NULL) { |
194 | kfree(region->seg_list); | 194 | kfree(region->seg_list); |
195 | region->seg_list = NULL; | 195 | region->seg_list = NULL; |
196 | return -ENOMEM; | 196 | return -ENOMEM; |
197 | } | 197 | } |
198 | memset(seg, 0, (sizeof(struct agp_segment_priv) * region->seg_count)); | ||
199 | user_seg = region->seg_list; | 198 | user_seg = region->seg_list; |
200 | 199 | ||
201 | for (i = 0; i < region->seg_count; i++) { | 200 | for (i = 0; i < region->seg_count; i++) { |
@@ -332,14 +331,11 @@ static struct agp_controller *agp_create_controller(pid_t id) | |||
332 | { | 331 | { |
333 | struct agp_controller *controller; | 332 | struct agp_controller *controller; |
334 | 333 | ||
335 | controller = kmalloc(sizeof(struct agp_controller), GFP_KERNEL); | 334 | controller = kzalloc(sizeof(struct agp_controller), GFP_KERNEL); |
336 | |||
337 | if (controller == NULL) | 335 | if (controller == NULL) |
338 | return NULL; | 336 | return NULL; |
339 | 337 | ||
340 | memset(controller, 0, sizeof(struct agp_controller)); | ||
341 | controller->pid = id; | 338 | controller->pid = id; |
342 | |||
343 | return controller; | 339 | return controller; |
344 | } | 340 | } |
345 | 341 | ||
@@ -540,12 +536,10 @@ static struct agp_client *agp_create_client(pid_t id) | |||
540 | { | 536 | { |
541 | struct agp_client *new_client; | 537 | struct agp_client *new_client; |
542 | 538 | ||
543 | new_client = kmalloc(sizeof(struct agp_client), GFP_KERNEL); | 539 | new_client = kzalloc(sizeof(struct agp_client), GFP_KERNEL); |
544 | |||
545 | if (new_client == NULL) | 540 | if (new_client == NULL) |
546 | return NULL; | 541 | return NULL; |
547 | 542 | ||
548 | memset(new_client, 0, sizeof(struct agp_client)); | ||
549 | new_client->pid = id; | 543 | new_client->pid = id; |
550 | agp_insert_client(new_client); | 544 | agp_insert_client(new_client); |
551 | return new_client; | 545 | return new_client; |
@@ -709,11 +703,10 @@ static int agp_open(struct inode *inode, struct file *file) | |||
709 | if (minor != AGPGART_MINOR) | 703 | if (minor != AGPGART_MINOR) |
710 | goto err_out; | 704 | goto err_out; |
711 | 705 | ||
712 | priv = kmalloc(sizeof(struct agp_file_private), GFP_KERNEL); | 706 | priv = kzalloc(sizeof(struct agp_file_private), GFP_KERNEL); |
713 | if (priv == NULL) | 707 | if (priv == NULL) |
714 | goto err_out_nomem; | 708 | goto err_out_nomem; |
715 | 709 | ||
716 | memset(priv, 0, sizeof(struct agp_file_private)); | ||
717 | set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags); | 710 | set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags); |
718 | priv->my_pid = current->pid; | 711 | priv->my_pid = current->pid; |
719 | 712 | ||
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index ac9da0ca36b7..5567ce8d72b0 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -57,7 +57,8 @@ int map_page_into_agp(struct page *page) | |||
57 | { | 57 | { |
58 | int i; | 58 | int i; |
59 | i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); | 59 | i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); |
60 | global_flush_tlb(); | 60 | /* Caller's responsibility to call global_flush_tlb() for |
61 | * performance reasons */ | ||
61 | return i; | 62 | return i; |
62 | } | 63 | } |
63 | EXPORT_SYMBOL_GPL(map_page_into_agp); | 64 | EXPORT_SYMBOL_GPL(map_page_into_agp); |
@@ -66,7 +67,8 @@ int unmap_page_from_agp(struct page *page) | |||
66 | { | 67 | { |
67 | int i; | 68 | int i; |
68 | i = change_page_attr(page, 1, PAGE_KERNEL); | 69 | i = change_page_attr(page, 1, PAGE_KERNEL); |
69 | global_flush_tlb(); | 70 | /* Caller's responsibility to call global_flush_tlb() for |
71 | * performance reasons */ | ||
70 | return i; | 72 | return i; |
71 | } | 73 | } |
72 | EXPORT_SYMBOL_GPL(unmap_page_from_agp); | 74 | EXPORT_SYMBOL_GPL(unmap_page_from_agp); |
@@ -105,12 +107,10 @@ struct agp_memory *agp_create_memory(int scratch_pages) | |||
105 | { | 107 | { |
106 | struct agp_memory *new; | 108 | struct agp_memory *new; |
107 | 109 | ||
108 | new = kmalloc(sizeof(struct agp_memory), GFP_KERNEL); | 110 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); |
109 | |||
110 | if (new == NULL) | 111 | if (new == NULL) |
111 | return NULL; | 112 | return NULL; |
112 | 113 | ||
113 | memset(new, 0, sizeof(struct agp_memory)); | ||
114 | new->key = agp_get_key(); | 114 | new->key = agp_get_key(); |
115 | 115 | ||
116 | if (new->key < 0) { | 116 | if (new->key < 0) { |
@@ -155,6 +155,7 @@ void agp_free_memory(struct agp_memory *curr) | |||
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(gart_to_virt(curr->memory[i])); | 156 | curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i])); |
157 | } | 157 | } |
158 | flush_agp_mappings(); | ||
158 | } | 159 | } |
159 | agp_free_key(curr->key); | 160 | agp_free_key(curr->key); |
160 | vfree(curr->memory); | 161 | vfree(curr->memory); |
@@ -212,7 +213,7 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, | |||
212 | new->memory[i] = virt_to_gart(addr); | 213 | new->memory[i] = virt_to_gart(addr); |
213 | new->page_count++; | 214 | new->page_count++; |
214 | } | 215 | } |
215 | new->bridge = bridge; | 216 | new->bridge = bridge; |
216 | 217 | ||
217 | flush_agp_mappings(); | 218 | flush_agp_mappings(); |
218 | 219 | ||
@@ -414,7 +415,8 @@ static void agp_v2_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_ | |||
414 | u32 tmp; | 415 | u32 tmp; |
415 | 416 | ||
416 | if (*requested_mode & AGP2_RESERVED_MASK) { | 417 | if (*requested_mode & AGP2_RESERVED_MASK) { |
417 | printk(KERN_INFO PFX "reserved bits set in mode 0x%x. Fixed.\n", *requested_mode); | 418 | printk(KERN_INFO PFX "reserved bits set (%x) in mode 0x%x. Fixed.\n", |
419 | *requested_mode & AGP2_RESERVED_MASK, *requested_mode); | ||
418 | *requested_mode &= ~AGP2_RESERVED_MASK; | 420 | *requested_mode &= ~AGP2_RESERVED_MASK; |
419 | } | 421 | } |
420 | 422 | ||
@@ -492,7 +494,8 @@ static void agp_v3_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_ | |||
492 | u32 tmp; | 494 | u32 tmp; |
493 | 495 | ||
494 | if (*requested_mode & AGP3_RESERVED_MASK) { | 496 | if (*requested_mode & AGP3_RESERVED_MASK) { |
495 | printk(KERN_INFO PFX "reserved bits set in mode 0x%x. Fixed.\n", *requested_mode); | 497 | printk(KERN_INFO PFX "reserved bits set (%x) in mode 0x%x. Fixed.\n", |
498 | *requested_mode & AGP3_RESERVED_MASK, *requested_mode); | ||
496 | *requested_mode &= ~AGP3_RESERVED_MASK; | 499 | *requested_mode &= ~AGP3_RESERVED_MASK; |
497 | } | 500 | } |
498 | 501 | ||
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index a2d9e5e48bbe..8ee19a4a6bce 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c | |||
@@ -111,8 +111,10 @@ static int i460_fetch_size (void) | |||
111 | 111 | ||
112 | if (i460.io_page_shift != I460_IO_PAGE_SHIFT) { | 112 | if (i460.io_page_shift != I460_IO_PAGE_SHIFT) { |
113 | printk(KERN_ERR PFX | 113 | printk(KERN_ERR PFX |
114 | "I/O (GART) page-size %ZuKB doesn't match expected size %ZuKB\n", | 114 | "I/O (GART) page-size %luKB doesn't match expected " |
115 | 1UL << (i460.io_page_shift - 10), 1UL << (I460_IO_PAGE_SHIFT)); | 115 | "size %luKB\n", |
116 | 1UL << (i460.io_page_shift - 10), | ||
117 | 1UL << (I460_IO_PAGE_SHIFT)); | ||
116 | return 0; | 118 | return 0; |
117 | } | 119 | } |
118 | 120 | ||
@@ -227,10 +229,9 @@ static int i460_configure (void) | |||
227 | */ | 229 | */ |
228 | if (I460_IO_PAGE_SHIFT > PAGE_SHIFT) { | 230 | if (I460_IO_PAGE_SHIFT > PAGE_SHIFT) { |
229 | size = current_size->num_entries * sizeof(i460.lp_desc[0]); | 231 | size = current_size->num_entries * sizeof(i460.lp_desc[0]); |
230 | i460.lp_desc = kmalloc(size, GFP_KERNEL); | 232 | i460.lp_desc = kzalloc(size, GFP_KERNEL); |
231 | if (!i460.lp_desc) | 233 | if (!i460.lp_desc) |
232 | return -ENOMEM; | 234 | return -ENOMEM; |
233 | memset(i460.lp_desc, 0, size); | ||
234 | } | 235 | } |
235 | return 0; | 236 | return 0; |
236 | } | 237 | } |
@@ -366,13 +367,12 @@ static int i460_alloc_large_page (struct lp_desc *lp) | |||
366 | } | 367 | } |
367 | 368 | ||
368 | map_size = ((I460_KPAGES_PER_IOPAGE + BITS_PER_LONG - 1) & -BITS_PER_LONG)/8; | 369 | map_size = ((I460_KPAGES_PER_IOPAGE + BITS_PER_LONG - 1) & -BITS_PER_LONG)/8; |
369 | lp->alloced_map = kmalloc(map_size, GFP_KERNEL); | 370 | lp->alloced_map = kzalloc(map_size, GFP_KERNEL); |
370 | if (!lp->alloced_map) { | 371 | if (!lp->alloced_map) { |
371 | free_pages((unsigned long) lpage, order); | 372 | free_pages((unsigned long) lpage, order); |
372 | printk(KERN_ERR PFX "Out of memory, we're in trouble...\n"); | 373 | printk(KERN_ERR PFX "Out of memory, we're in trouble...\n"); |
373 | return -ENOMEM; | 374 | return -ENOMEM; |
374 | } | 375 | } |
375 | memset(lp->alloced_map, 0, map_size); | ||
376 | 376 | ||
377 | lp->paddr = virt_to_gart(lpage); | 377 | lp->paddr = virt_to_gart(lpage); |
378 | lp->refcount = 0; | 378 | lp->refcount = 0; |
@@ -516,9 +516,10 @@ static void *i460_alloc_page (struct agp_bridge_data *bridge) | |||
516 | { | 516 | { |
517 | void *page; | 517 | void *page; |
518 | 518 | ||
519 | if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) | 519 | if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) { |
520 | page = agp_generic_alloc_page(agp_bridge); | 520 | page = agp_generic_alloc_page(agp_bridge); |
521 | else | 521 | global_flush_tlb(); |
522 | } else | ||
522 | /* Returning NULL would cause problems */ | 523 | /* Returning NULL would cause problems */ |
523 | /* AK: really dubious code. */ | 524 | /* AK: really dubious code. */ |
524 | page = (void *)~0UL; | 525 | page = (void *)~0UL; |
@@ -527,8 +528,10 @@ static void *i460_alloc_page (struct agp_bridge_data *bridge) | |||
527 | 528 | ||
528 | static void i460_destroy_page (void *page) | 529 | static void i460_destroy_page (void *page) |
529 | { | 530 | { |
530 | if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) | 531 | if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) { |
531 | agp_generic_destroy_page(page); | 532 | agp_generic_destroy_page(page); |
533 | global_flush_tlb(); | ||
534 | } | ||
532 | } | 535 | } |
533 | 536 | ||
534 | #endif /* I460_LARGE_IO_PAGES */ | 537 | #endif /* I460_LARGE_IO_PAGES */ |
@@ -538,7 +541,7 @@ static unsigned long i460_mask_memory (struct agp_bridge_data *bridge, | |||
538 | { | 541 | { |
539 | /* Make sure the returned address is a valid GATT entry */ | 542 | /* Make sure the returned address is a valid GATT entry */ |
540 | return bridge->driver->masks[0].mask | 543 | return bridge->driver->masks[0].mask |
541 | | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xffffff000) >> 12); | 544 | | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12); |
542 | } | 545 | } |
543 | 546 | ||
544 | struct agp_bridge_driver intel_i460_driver = { | 547 | struct agp_bridge_driver intel_i460_driver = { |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 1f7d415f432c..e7bed5047dcc 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -270,6 +270,7 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type) | |||
270 | 270 | ||
271 | switch (pg_count) { | 271 | switch (pg_count) { |
272 | case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge); | 272 | case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge); |
273 | global_flush_tlb(); | ||
273 | break; | 274 | break; |
274 | case 4: | 275 | case 4: |
275 | /* kludge to get 4 physical pages for ARGB cursor */ | 276 | /* kludge to get 4 physical pages for ARGB cursor */ |
@@ -330,9 +331,11 @@ static void intel_i810_free_by_type(struct agp_memory *curr) | |||
330 | if(curr->type == AGP_PHYS_MEMORY) { | 331 | if(curr->type == AGP_PHYS_MEMORY) { |
331 | if (curr->page_count == 4) | 332 | if (curr->page_count == 4) |
332 | i8xx_destroy_pages(gart_to_virt(curr->memory[0])); | 333 | i8xx_destroy_pages(gart_to_virt(curr->memory[0])); |
333 | else | 334 | else { |
334 | agp_bridge->driver->agp_destroy_page( | 335 | agp_bridge->driver->agp_destroy_page( |
335 | gart_to_virt(curr->memory[0])); | 336 | gart_to_virt(curr->memory[0])); |
337 | global_flush_tlb(); | ||
338 | } | ||
336 | vfree(curr->memory); | 339 | vfree(curr->memory); |
337 | } | 340 | } |
338 | kfree(curr); | 341 | kfree(curr); |
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c index 7957fc91f6ad..4df7734b51c2 100644 --- a/drivers/char/agp/sgi-agp.c +++ b/drivers/char/agp/sgi-agp.c | |||
@@ -289,6 +289,8 @@ static int __devinit agp_sgi_init(void) | |||
289 | j = 0; | 289 | j = 0; |
290 | list_for_each_entry(info, &tioca_list, ca_list) { | 290 | list_for_each_entry(info, &tioca_list, ca_list) { |
291 | struct list_head *tmp; | 291 | struct list_head *tmp; |
292 | if (list_empty(info->ca_devices)) | ||
293 | continue; | ||
292 | list_for_each(tmp, info->ca_devices) { | 294 | list_for_each(tmp, info->ca_devices) { |
293 | u8 cap_ptr; | 295 | u8 cap_ptr; |
294 | pdev = pci_dev_b(tmp); | 296 | pdev = pci_dev_b(tmp); |
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index 71ea59a1dbeb..3f8f7fa6b0ff 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -102,19 +102,17 @@ static int serverworks_create_gatt_pages(int nr_tables) | |||
102 | int retval = 0; | 102 | int retval = 0; |
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | tables = kmalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *), | 105 | tables = kzalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *), |
106 | GFP_KERNEL); | 106 | GFP_KERNEL); |
107 | if (tables == NULL) { | 107 | if (tables == NULL) |
108 | return -ENOMEM; | 108 | return -ENOMEM; |
109 | } | 109 | |
110 | memset(tables, 0, sizeof(struct serverworks_page_map *) * (nr_tables + 1)); | ||
111 | for (i = 0; i < nr_tables; i++) { | 110 | for (i = 0; i < nr_tables; i++) { |
112 | entry = kmalloc(sizeof(struct serverworks_page_map), GFP_KERNEL); | 111 | entry = kzalloc(sizeof(struct serverworks_page_map), GFP_KERNEL); |
113 | if (entry == NULL) { | 112 | if (entry == NULL) { |
114 | retval = -ENOMEM; | 113 | retval = -ENOMEM; |
115 | break; | 114 | break; |
116 | } | 115 | } |
117 | memset(entry, 0, sizeof(struct serverworks_page_map)); | ||
118 | tables[i] = entry; | 116 | tables[i] = entry; |
119 | retval = serverworks_create_page_map(entry); | 117 | retval = serverworks_create_page_map(entry); |
120 | if (retval != 0) break; | 118 | if (retval != 0) break; |
@@ -244,13 +242,27 @@ static int serverworks_fetch_size(void) | |||
244 | */ | 242 | */ |
245 | static void serverworks_tlbflush(struct agp_memory *temp) | 243 | static void serverworks_tlbflush(struct agp_memory *temp) |
246 | { | 244 | { |
245 | unsigned long timeout; | ||
246 | |||
247 | writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH); | 247 | writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH); |
248 | while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) | 248 | timeout = jiffies + 3*HZ; |
249 | while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) { | ||
249 | cpu_relax(); | 250 | cpu_relax(); |
251 | if (time_after(jiffies, timeout)) { | ||
252 | printk(KERN_ERR PFX "TLB post flush took more than 3 seconds\n"); | ||
253 | break; | ||
254 | } | ||
255 | } | ||
250 | 256 | ||
251 | writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH); | 257 | writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH); |
252 | while(readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) | 258 | timeout = jiffies + 3*HZ; |
259 | while (readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) { | ||
253 | cpu_relax(); | 260 | cpu_relax(); |
261 | if (time_after(jiffies, timeout)) { | ||
262 | printk(KERN_ERR PFX "TLB Dir flush took more than 3 seconds\n"); | ||
263 | break; | ||
264 | } | ||
265 | } | ||
254 | } | 266 | } |
255 | 267 | ||
256 | static int serverworks_configure(void) | 268 | static int serverworks_configure(void) |
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index c8255312b8c1..50947e38501a 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -557,6 +557,10 @@ static struct agp_device_ids uninorth_agp_device_ids[] __devinitdata = { | |||
557 | .device_id = PCI_DEVICE_ID_APPLE_U3H_AGP, | 557 | .device_id = PCI_DEVICE_ID_APPLE_U3H_AGP, |
558 | .chipset_name = "U3H", | 558 | .chipset_name = "U3H", |
559 | }, | 559 | }, |
560 | { | ||
561 | .device_id = PCI_DEVICE_ID_APPLE_IPID2_AGP, | ||
562 | .chipset_name = "UniNorth/Intrepid2", | ||
563 | }, | ||
560 | }; | 564 | }; |
561 | 565 | ||
562 | static int __devinit agp_uninorth_probe(struct pci_dev *pdev, | 566 | static int __devinit agp_uninorth_probe(struct pci_dev *pdev, |