aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/Kconfig16
-rw-r--r--drivers/char/agp/ali-agp.c1
-rw-r--r--drivers/char/agp/amd-k7-agp.c7
-rw-r--r--drivers/char/agp/amd64-agp.c23
-rw-r--r--drivers/char/agp/ati-agp.c9
-rw-r--r--drivers/char/agp/backend.c17
-rw-r--r--drivers/char/agp/efficeon-agp.c2
-rw-r--r--drivers/char/agp/frontend.c15
-rw-r--r--drivers/char/agp/generic.c19
-rw-r--r--drivers/char/agp/i460-agp.c25
-rw-r--r--drivers/char/agp/intel-agp.c5
-rw-r--r--drivers/char/agp/isoch.c1
-rw-r--r--drivers/char/agp/sgi-agp.c3
-rw-r--r--drivers/char/agp/sworks-agp.c30
-rw-r--r--drivers/char/agp/uninorth-agp.c4
-rw-r--r--drivers/char/agp/via-agp.c6
16 files changed, 115 insertions, 68 deletions
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index 7f8c1b53b754..486ed8a11b59 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -27,7 +27,7 @@ config AGP
27 27
28config AGP_ALI 28config AGP_ALI
29 tristate "ALI chipset support" 29 tristate "ALI chipset support"
30 depends on AGP && X86 && !X86_64 30 depends on AGP && X86_32
31 ---help--- 31 ---help---
32 This option gives you AGP support for the GLX component of 32 This option gives you AGP support for the GLX component of
33 XFree86 4.x on the following ALi chipsets. The supported chipsets 33 XFree86 4.x on the following ALi chipsets. The supported chipsets
@@ -45,7 +45,7 @@ config AGP_ALI
45 45
46config AGP_ATI 46config AGP_ATI
47 tristate "ATI chipset support" 47 tristate "ATI chipset support"
48 depends on AGP && X86 && !X86_64 48 depends on AGP && X86_32
49 ---help--- 49 ---help---
50 This option gives you AGP support for the GLX component of 50 This option gives you AGP support for the GLX component of
51 XFree86 4.x on the ATI RadeonIGP family of chipsets. 51 XFree86 4.x on the ATI RadeonIGP family of chipsets.
@@ -55,7 +55,7 @@ config AGP_ATI
55 55
56config AGP_AMD 56config AGP_AMD
57 tristate "AMD Irongate, 761, and 762 chipset support" 57 tristate "AMD Irongate, 761, and 762 chipset support"
58 depends on AGP && X86 && !X86_64 58 depends on AGP && X86_32
59 help 59 help
60 This option gives you AGP support for the GLX component of 60 This option gives you AGP support for the GLX component of
61 XFree86 4.x on AMD Irongate, 761, and 762 chipsets. 61 XFree86 4.x on AMD Irongate, 761, and 762 chipsets.
@@ -91,7 +91,7 @@ config AGP_INTEL
91 91
92config AGP_NVIDIA 92config AGP_NVIDIA
93 tristate "NVIDIA nForce/nForce2 chipset support" 93 tristate "NVIDIA nForce/nForce2 chipset support"
94 depends on AGP && X86 && !X86_64 94 depends on AGP && X86_32
95 help 95 help
96 This option gives you AGP support for the GLX component of 96 This option gives you AGP support for the GLX component of
97 XFree86 4.x on the following NVIDIA chipsets. The supported chipsets 97 XFree86 4.x on the following NVIDIA chipsets. The supported chipsets
@@ -99,7 +99,7 @@ config AGP_NVIDIA
99 99
100config AGP_SIS 100config AGP_SIS
101 tristate "SiS chipset support" 101 tristate "SiS chipset support"
102 depends on AGP && X86 && !X86_64 102 depends on AGP && X86_32
103 help 103 help
104 This option gives you AGP support for the GLX component of 104 This option gives you AGP support for the GLX component of
105 XFree86 4.x on Silicon Integrated Systems [SiS] chipsets. 105 XFree86 4.x on Silicon Integrated Systems [SiS] chipsets.
@@ -111,14 +111,14 @@ config AGP_SIS
111 111
112config AGP_SWORKS 112config AGP_SWORKS
113 tristate "Serverworks LE/HE chipset support" 113 tristate "Serverworks LE/HE chipset support"
114 depends on AGP && X86 && !X86_64 114 depends on AGP && X86_32
115 help 115 help
116 Say Y here to support the Serverworks AGP card. See 116 Say Y here to support the Serverworks AGP card. See
117 <http://www.serverworks.com/> for product descriptions and images. 117 <http://www.serverworks.com/> for product descriptions and images.
118 118
119config AGP_VIA 119config AGP_VIA
120 tristate "VIA chipset support" 120 tristate "VIA chipset support"
121 depends on AGP && X86 && !X86_64 121 depends on AGP && X86_32
122 help 122 help
123 This option gives you AGP support for the GLX component of 123 This option gives you AGP support for the GLX component of
124 XFree86 4.x on VIA MVP3/Apollo Pro chipsets. 124 XFree86 4.x on VIA MVP3/Apollo Pro chipsets.
@@ -154,7 +154,7 @@ config AGP_UNINORTH
154 154
155config AGP_EFFICEON 155config AGP_EFFICEON
156 tristate "Transmeta Efficeon support" 156 tristate "Transmeta Efficeon support"
157 depends on AGP && X86 && !X86_64 157 depends on AGP && X86_32
158 help 158 help
159 This option gives you AGP support for the Transmeta Efficeon 159 This option gives you AGP support for the Transmeta Efficeon
160 series processors with integrated northbridges. 160 series processors with integrated northbridges.
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 9c9c9c2247ce..b02fc2267159 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -7,6 +7,7 @@
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/agp_backend.h> 9#include <linux/agp_backend.h>
10#include <asm/page.h> /* PAGE_SIZE */
10#include "agp.h" 11#include "agp.h"
11 12
12#define ALI_AGPCTRL 0xb8 13#define ALI_AGPCTRL 0xb8
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 0a7624a9b1c1..810679dcbbb0 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -13,6 +13,8 @@
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>
17#include <asm/page.h> /* PAGE_SIZE */
16#include "agp.h" 18#include "agp.h"
17 19
18/* Will need to be increased if AMD64 ever goes >8-way. */ 20/* Will need to be increased if AMD64 ever goes >8-way. */
@@ -55,9 +57,8 @@ static int nr_garts;
55static struct pci_dev * hammers[MAX_HAMMER_GARTS]; 57static struct pci_dev * hammers[MAX_HAMMER_GARTS];
56 58
57static struct resource *aperture_resource; 59static struct resource *aperture_resource;
58static int __initdata agp_try_unsupported; 60static int __initdata agp_try_unsupported = 1;
59 61
60static int gart_iterator;
61#define for_each_nb() for(gart_iterator=0;gart_iterator<nr_garts;gart_iterator++) 62#define for_each_nb() for(gart_iterator=0;gart_iterator<nr_garts;gart_iterator++)
62 63
63static void flush_amd64_tlb(struct pci_dev *dev) 64static void flush_amd64_tlb(struct pci_dev *dev)
@@ -71,6 +72,7 @@ static void flush_amd64_tlb(struct pci_dev *dev)
71 72
72static void amd64_tlbflush(struct agp_memory *temp) 73static void amd64_tlbflush(struct agp_memory *temp)
73{ 74{
75 int gart_iterator;
74 for_each_nb() 76 for_each_nb()
75 flush_amd64_tlb(hammers[gart_iterator]); 77 flush_amd64_tlb(hammers[gart_iterator]);
76} 78}
@@ -220,6 +222,7 @@ static struct aper_size_info_32 amd_8151_sizes[7] =
220static int amd_8151_configure(void) 222static int amd_8151_configure(void)
221{ 223{
222 unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real); 224 unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real);
225 int gart_iterator;
223 226
224 /* Configure AGP regs in each x86-64 host bridge. */ 227 /* Configure AGP regs in each x86-64 host bridge. */
225 for_each_nb() { 228 for_each_nb() {
@@ -233,7 +236,7 @@ static int amd_8151_configure(void)
233static void amd64_cleanup(void) 236static void amd64_cleanup(void)
234{ 237{
235 u32 tmp; 238 u32 tmp;
236 239 int gart_iterator;
237 for_each_nb() { 240 for_each_nb() {
238 /* disable gart translation */ 241 /* disable gart translation */
239 pci_read_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, &tmp); 242 pci_read_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, &tmp);
@@ -413,7 +416,7 @@ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data
413} 416}
414 417
415 418
416static struct aper_size_info_32 uli_sizes[7] = 419static const struct aper_size_info_32 uli_sizes[7] =
417{ 420{
418 {256, 65536, 6, 10}, 421 {256, 65536, 6, 10},
419 {128, 32768, 5, 9}, 422 {128, 32768, 5, 9},
@@ -467,7 +470,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
467} 470}
468 471
469 472
470static struct aper_size_info_32 nforce3_sizes[5] = 473static const struct aper_size_info_32 nforce3_sizes[5] =
471{ 474{
472 {512, 131072, 7, 0x00000000 }, 475 {512, 131072, 7, 0x00000000 },
473 {256, 65536, 6, 0x00000008 }, 476 {256, 65536, 6, 0x00000008 },
@@ -695,6 +698,16 @@ static struct pci_device_id agp_amd64_pci_table[] = {
695 .subvendor = PCI_ANY_ID, 698 .subvendor = PCI_ANY_ID,
696 .subdevice = PCI_ANY_ID, 699 .subdevice = PCI_ANY_ID,
697 }, 700 },
701 /* ALI/ULI M1695 */
702 {
703 .class = (PCI_CLASS_BRIDGE_HOST << 8),
704 .class_mask = ~0,
705 .vendor = PCI_VENDOR_ID_AL,
706 .device = 0x1689,
707 .subvendor = PCI_ANY_ID,
708 .subdevice = PCI_ANY_ID,
709 },
710
698 { } 711 { }
699}; 712};
700 713
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index e572ced9100a..53372a83b675 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -6,6 +6,8 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/string.h>
10#include <linux/slab.h>
9#include <linux/agp_backend.h> 11#include <linux/agp_backend.h>
10#include <asm/agp.h> 12#include <asm/agp.h>
11#include "agp.h" 13#include "agp.h"
@@ -116,14 +118,12 @@ static int ati_create_gatt_pages(int nr_tables)
116 int retval = 0; 118 int retval = 0;
117 int i; 119 int i;
118 120
119 tables = kmalloc((nr_tables + 1) * sizeof(ati_page_map *), 121 tables = kzalloc((nr_tables + 1) * sizeof(ati_page_map *),GFP_KERNEL);
120 GFP_KERNEL);
121 if (tables == NULL) 122 if (tables == NULL)
122 return -ENOMEM; 123 return -ENOMEM;
123 124
124 memset(tables, 0, sizeof(ati_page_map *) * (nr_tables + 1));
125 for (i = 0; i < nr_tables; i++) { 125 for (i = 0; i < nr_tables; i++) {
126 entry = kmalloc(sizeof(ati_page_map), GFP_KERNEL); 126 entry = kzalloc(sizeof(ati_page_map), GFP_KERNEL);
127 if (entry == NULL) { 127 if (entry == NULL) {
128 while (i>0) { 128 while (i>0) {
129 kfree (tables[i-1]); 129 kfree (tables[i-1]);
@@ -134,7 +134,6 @@ static int ati_create_gatt_pages(int nr_tables)
134 retval = -ENOMEM; 134 retval = -ENOMEM;
135 break; 135 break;
136 } 136 }
137 memset(entry, 0, sizeof(ati_page_map));
138 tables[i] = entry; 137 tables[i] = entry;
139 retval = ati_create_page_map(entry); 138 retval = ati_create_page_map(entry);
140 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..80ee17a8fc23 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -97,7 +97,7 @@ void agp_backend_release(struct agp_bridge_data *bridge)
97EXPORT_SYMBOL(agp_backend_release); 97EXPORT_SYMBOL(agp_backend_release);
98 98
99 99
100static struct { int mem, agp; } maxes_table[] = { 100static const struct { int mem, agp; } maxes_table[] = {
101 {0, 0}, 101 {0, 0},
102 {32, 4}, 102 {32, 4},
103 {64, 28}, 103 {64, 28},
@@ -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
189err_out: 190err_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
223struct agp_bridge_data *agp_alloc_bridge(void) 228struct 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}
63EXPORT_SYMBOL_GPL(map_page_into_agp); 64EXPORT_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}
72EXPORT_SYMBOL_GPL(unmap_page_from_agp); 74EXPORT_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 94943298c03e..8ee19a4a6bce 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -10,6 +10,8 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/string.h>
14#include <linux/slab.h>
13#include <linux/agp_backend.h> 15#include <linux/agp_backend.h>
14 16
15#include "agp.h" 17#include "agp.h"
@@ -109,8 +111,10 @@ static int i460_fetch_size (void)
109 111
110 if (i460.io_page_shift != I460_IO_PAGE_SHIFT) { 112 if (i460.io_page_shift != I460_IO_PAGE_SHIFT) {
111 printk(KERN_ERR PFX 113 printk(KERN_ERR PFX
112 "I/O (GART) page-size %ZuKB doesn't match expected size %ZuKB\n", 114 "I/O (GART) page-size %luKB doesn't match expected "
113 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));
114 return 0; 118 return 0;
115 } 119 }
116 120
@@ -225,10 +229,9 @@ static int i460_configure (void)
225 */ 229 */
226 if (I460_IO_PAGE_SHIFT > PAGE_SHIFT) { 230 if (I460_IO_PAGE_SHIFT > PAGE_SHIFT) {
227 size = current_size->num_entries * sizeof(i460.lp_desc[0]); 231 size = current_size->num_entries * sizeof(i460.lp_desc[0]);
228 i460.lp_desc = kmalloc(size, GFP_KERNEL); 232 i460.lp_desc = kzalloc(size, GFP_KERNEL);
229 if (!i460.lp_desc) 233 if (!i460.lp_desc)
230 return -ENOMEM; 234 return -ENOMEM;
231 memset(i460.lp_desc, 0, size);
232 } 235 }
233 return 0; 236 return 0;
234} 237}
@@ -364,13 +367,12 @@ static int i460_alloc_large_page (struct lp_desc *lp)
364 } 367 }
365 368
366 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;
367 lp->alloced_map = kmalloc(map_size, GFP_KERNEL); 370 lp->alloced_map = kzalloc(map_size, GFP_KERNEL);
368 if (!lp->alloced_map) { 371 if (!lp->alloced_map) {
369 free_pages((unsigned long) lpage, order); 372 free_pages((unsigned long) lpage, order);
370 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");
371 return -ENOMEM; 374 return -ENOMEM;
372 } 375 }
373 memset(lp->alloced_map, 0, map_size);
374 376
375 lp->paddr = virt_to_gart(lpage); 377 lp->paddr = virt_to_gart(lpage);
376 lp->refcount = 0; 378 lp->refcount = 0;
@@ -514,9 +516,10 @@ static void *i460_alloc_page (struct agp_bridge_data *bridge)
514{ 516{
515 void *page; 517 void *page;
516 518
517 if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) 519 if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) {
518 page = agp_generic_alloc_page(agp_bridge); 520 page = agp_generic_alloc_page(agp_bridge);
519 else 521 global_flush_tlb();
522 } else
520 /* Returning NULL would cause problems */ 523 /* Returning NULL would cause problems */
521 /* AK: really dubious code. */ 524 /* AK: really dubious code. */
522 page = (void *)~0UL; 525 page = (void *)~0UL;
@@ -525,8 +528,10 @@ static void *i460_alloc_page (struct agp_bridge_data *bridge)
525 528
526static void i460_destroy_page (void *page) 529static void i460_destroy_page (void *page)
527{ 530{
528 if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) 531 if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) {
529 agp_generic_destroy_page(page); 532 agp_generic_destroy_page(page);
533 global_flush_tlb();
534 }
530} 535}
531 536
532#endif /* I460_LARGE_IO_PAGES */ 537#endif /* I460_LARGE_IO_PAGES */
@@ -536,7 +541,7 @@ static unsigned long i460_mask_memory (struct agp_bridge_data *bridge,
536{ 541{
537 /* Make sure the returned address is a valid GATT entry */ 542 /* Make sure the returned address is a valid GATT entry */
538 return bridge->driver->masks[0].mask 543 return bridge->driver->masks[0].mask
539 | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xffffff000) >> 12); 544 | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12);
540} 545}
541 546
542struct agp_bridge_driver intel_i460_driver = { 547struct 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/isoch.c b/drivers/char/agp/isoch.c
index c9ac731504f2..40083241804e 100644
--- a/drivers/char/agp/isoch.c
+++ b/drivers/char/agp/isoch.c
@@ -6,6 +6,7 @@
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/agp_backend.h> 7#include <linux/agp_backend.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/slab.h>
9 10
10#include "agp.h" 11#include "agp.h"
11 12
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index d3aa159c9dec..4df7734b51c2 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/agp_backend.h> 18#include <linux/agp_backend.h>
19#include <asm/sn/addrs.h> 19#include <asm/sn/addrs.h>
20#include <asm/sn/io.h>
20#include <asm/sn/pcidev.h> 21#include <asm/sn/pcidev.h>
21#include <asm/sn/pcibus_provider_defs.h> 22#include <asm/sn/pcibus_provider_defs.h>
22#include <asm/sn/tioca_provider.h> 23#include <asm/sn/tioca_provider.h>
@@ -288,6 +289,8 @@ static int __devinit agp_sgi_init(void)
288 j = 0; 289 j = 0;
289 list_for_each_entry(info, &tioca_list, ca_list) { 290 list_for_each_entry(info, &tioca_list, ca_list) {
290 struct list_head *tmp; 291 struct list_head *tmp;
292 if (list_empty(info->ca_devices))
293 continue;
291 list_for_each(tmp, info->ca_devices) { 294 list_for_each(tmp, info->ca_devices) {
292 u8 cap_ptr; 295 u8 cap_ptr;
293 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 a9fb12c20eb7..3f8f7fa6b0ff 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -5,6 +5,8 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/string.h>
9#include <linux/slab.h>
8#include <linux/agp_backend.h> 10#include <linux/agp_backend.h>
9#include "agp.h" 11#include "agp.h"
10 12
@@ -100,19 +102,17 @@ static int serverworks_create_gatt_pages(int nr_tables)
100 int retval = 0; 102 int retval = 0;
101 int i; 103 int i;
102 104
103 tables = kmalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *), 105 tables = kzalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *),
104 GFP_KERNEL); 106 GFP_KERNEL);
105 if (tables == NULL) { 107 if (tables == NULL)
106 return -ENOMEM; 108 return -ENOMEM;
107 } 109
108 memset(tables, 0, sizeof(struct serverworks_page_map *) * (nr_tables + 1));
109 for (i = 0; i < nr_tables; i++) { 110 for (i = 0; i < nr_tables; i++) {
110 entry = kmalloc(sizeof(struct serverworks_page_map), GFP_KERNEL); 111 entry = kzalloc(sizeof(struct serverworks_page_map), GFP_KERNEL);
111 if (entry == NULL) { 112 if (entry == NULL) {
112 retval = -ENOMEM; 113 retval = -ENOMEM;
113 break; 114 break;
114 } 115 }
115 memset(entry, 0, sizeof(struct serverworks_page_map));
116 tables[i] = entry; 116 tables[i] = entry;
117 retval = serverworks_create_page_map(entry); 117 retval = serverworks_create_page_map(entry);
118 if (retval != 0) break; 118 if (retval != 0) break;
@@ -242,13 +242,27 @@ static int serverworks_fetch_size(void)
242 */ 242 */
243static void serverworks_tlbflush(struct agp_memory *temp) 243static void serverworks_tlbflush(struct agp_memory *temp)
244{ 244{
245 unsigned long timeout;
246
245 writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH); 247 writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH);
246 while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) 248 timeout = jiffies + 3*HZ;
249 while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) {
247 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 }
248 256
249 writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH); 257 writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH);
250 while(readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) 258 timeout = jiffies + 3*HZ;
259 while (readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) {
251 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 }
252} 266}
253 267
254static int serverworks_configure(void) 268static 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
562static int __devinit agp_uninorth_probe(struct pci_dev *pdev, 566static int __devinit agp_uninorth_probe(struct pci_dev *pdev,
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index c847df575cf5..97b0a890ba7f 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -371,6 +371,11 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
371 .device_id = PCI_DEVICE_ID_VIA_3296_0, 371 .device_id = PCI_DEVICE_ID_VIA_3296_0,
372 .chipset_name = "P4M800", 372 .chipset_name = "P4M800",
373 }, 373 },
374 /* P4M800CE */
375 {
376 .device_id = PCI_DEVICE_ID_VIA_P4M800CE,
377 .chipset_name = "P4M800CE",
378 },
374 379
375 { }, /* dummy final entry, always present */ 380 { }, /* dummy final entry, always present */
376}; 381};
@@ -511,6 +516,7 @@ static struct pci_device_id agp_via_pci_table[] = {
511 ID(PCI_DEVICE_ID_VIA_3269_0), 516 ID(PCI_DEVICE_ID_VIA_3269_0),
512 ID(PCI_DEVICE_ID_VIA_83_87XX_1), 517 ID(PCI_DEVICE_ID_VIA_83_87XX_1),
513 ID(PCI_DEVICE_ID_VIA_3296_0), 518 ID(PCI_DEVICE_ID_VIA_3296_0),
519 ID(PCI_DEVICE_ID_VIA_P4M800CE),
514 { } 520 { }
515}; 521};
516 522