aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-01-03 20:26:58 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-01-06 19:49:22 -0500
commite501b3d87f003dfad8fcbd0f55ae17ea52495a56 (patch)
tree1307d77ead535d134b6f62df53c923cf1247baa6 /drivers
parent06cf56e497c8c1469b0931caa7d5b1d827655fe2 (diff)
agp: Support 64-bit APBASE
Per the AGP 3.0 spec, APBASE is a standard PCI BAR and may be either 32 bits or 64 bits wide. Many drivers read APBASE directly, but they only handled 32-bit BARs. The PCI core reads APBASE at enumeration-time. Use pci_bus_address() instead of reading it again in the driver. This works correctly for both 32-bit and 64-bit BARs. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/agp/agp.h1
-rw-r--r--drivers/char/agp/ali-agp.c4
-rw-r--r--drivers/char/agp/amd-k7-agp.c4
-rw-r--r--drivers/char/agp/amd64-agp.c5
-rw-r--r--drivers/char/agp/ati-agp.c9
-rw-r--r--drivers/char/agp/efficeon-agp.c5
-rw-r--r--drivers/char/agp/generic.c4
-rw-r--r--drivers/char/agp/intel-agp.c48
-rw-r--r--drivers/char/agp/nvidia-agp.c5
-rw-r--r--drivers/char/agp/sis-agp.c5
-rw-r--r--drivers/char/agp/via-agp.c13
11 files changed, 43 insertions, 60 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 923f99df4f1c..b709749c8639 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -239,6 +239,7 @@ long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
239 239
240/* Chipset independent registers (from AGP Spec) */ 240/* Chipset independent registers (from AGP Spec) */
241#define AGP_APBASE 0x10 241#define AGP_APBASE 0x10
242#define AGP_APERTURE_BAR 0
242 243
243#define AGPSTAT 0x4 244#define AGPSTAT 0x4
244#define AGPCMD 0x8 245#define AGPCMD 0x8
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 443cd6751ca2..19db03667650 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -85,8 +85,8 @@ static int ali_configure(void)
85 pci_write_config_dword(agp_bridge->dev, ALI_TLBCTRL, ((temp & 0xffffff00) | 0x00000010)); 85 pci_write_config_dword(agp_bridge->dev, ALI_TLBCTRL, ((temp & 0xffffff00) | 0x00000010));
86 86
87 /* address to map to */ 87 /* address to map to */
88 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 88 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
89 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 89 AGP_APERTURE_BAR);
90 90
91#if 0 91#if 0
92 if (agp_bridge->type == ALI_M1541) { 92 if (agp_bridge->type == ALI_M1541) {
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 779f0ab845a9..5f028cb1d6e8 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -126,7 +126,6 @@ static int amd_create_gatt_table(struct agp_bridge_data *bridge)
126 unsigned long __iomem *cur_gatt; 126 unsigned long __iomem *cur_gatt;
127 unsigned long addr; 127 unsigned long addr;
128 int retval; 128 int retval;
129 u32 temp;
130 int i; 129 int i;
131 130
132 value = A_SIZE_LVL2(agp_bridge->current_size); 131 value = A_SIZE_LVL2(agp_bridge->current_size);
@@ -149,8 +148,7 @@ static int amd_create_gatt_table(struct agp_bridge_data *bridge)
149 * used to program the agp master not the cpu 148 * used to program the agp master not the cpu
150 */ 149 */
151 150
152 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 151 addr = pci_bus_address(agp_bridge->dev, AGP_APERTURE_BAR);
153 addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
154 agp_bridge->gart_bus_addr = addr; 152 agp_bridge->gart_bus_addr = addr;
155 153
156 /* Calculate the agp offset */ 154 /* Calculate the agp offset */
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index d79d692d05b8..95326ac610f6 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -269,7 +269,6 @@ static int agp_aperture_valid(u64 aper, u32 size)
269 */ 269 */
270static int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap) 270static int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap)
271{ 271{
272 u32 aper_low, aper_hi;
273 u64 aper, nb_aper; 272 u64 aper, nb_aper;
274 int order = 0; 273 int order = 0;
275 u32 nb_order, nb_base; 274 u32 nb_order, nb_base;
@@ -295,9 +294,7 @@ static int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap)
295 apsize |= 0xf00; 294 apsize |= 0xf00;
296 order = 7 - hweight16(apsize); 295 order = 7 - hweight16(apsize);
297 296
298 pci_read_config_dword(agp, 0x10, &aper_low); 297 aper = pci_bus_address(agp, AGP_APERTURE_BAR);
299 pci_read_config_dword(agp, 0x14, &aper_hi);
300 aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
301 298
302 /* 299 /*
303 * On some sick chips APSIZE is 0. This means it wants 4G 300 * On some sick chips APSIZE is 0. This means it wants 4G
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 03c1dc1ab552..53cb310d433e 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -211,10 +211,10 @@ static int ati_configure(void)
211 else 211 else
212 pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000); 212 pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000);
213 213
214 /* address to map too */ 214 /* address to map to */
215 /* 215 /*
216 pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp); 216 agp_bridge.gart_bus_addr = pci_bus_address(agp_bridge.dev,
217 agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 217 AGP_APERTURE_BAR);
218 printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); 218 printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr);
219 */ 219 */
220 writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); 220 writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID);
@@ -385,8 +385,7 @@ static int ati_create_gatt_table(struct agp_bridge_data *bridge)
385 * This is a bus address even on the alpha, b/c its 385 * This is a bus address even on the alpha, b/c its
386 * used to program the agp master not the cpu 386 * used to program the agp master not the cpu
387 */ 387 */
388 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 388 addr = pci_bus_address(agp_bridge->dev, AGP_APERTURE_BAR);
389 addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
390 agp_bridge->gart_bus_addr = addr; 389 agp_bridge->gart_bus_addr = addr;
391 390
392 /* Calculate the agp offset */ 391 /* Calculate the agp offset */
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 6974d5032053..533cb6d229b8 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -128,7 +128,6 @@ static void efficeon_cleanup(void)
128 128
129static int efficeon_configure(void) 129static int efficeon_configure(void)
130{ 130{
131 u32 temp;
132 u16 temp2; 131 u16 temp2;
133 struct aper_size_info_lvl2 *current_size; 132 struct aper_size_info_lvl2 *current_size;
134 133
@@ -141,8 +140,8 @@ static int efficeon_configure(void)
141 current_size->size_value); 140 current_size->size_value);
142 141
143 /* address to map to */ 142 /* address to map to */
144 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 143 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
145 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 144 AGP_APERTURE_BAR);
146 145
147 /* agpctrl */ 146 /* agpctrl */
148 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280); 147 pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index a0df182f6f7d..f39437addb58 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -1396,8 +1396,8 @@ int agp3_generic_configure(void)
1396 1396
1397 current_size = A_SIZE_16(agp_bridge->current_size); 1397 current_size = A_SIZE_16(agp_bridge->current_size);
1398 1398
1399 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 1399 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
1400 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 1400 AGP_APERTURE_BAR);
1401 1401
1402 /* set aperture size */ 1402 /* set aperture size */
1403 pci_write_config_word(agp_bridge->dev, agp_bridge->capndx+AGPAPSIZE, current_size->size_value); 1403 pci_write_config_word(agp_bridge->dev, agp_bridge->capndx+AGPAPSIZE, current_size->size_value);
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index a426ee1f57a6..a7c276585a9f 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -118,7 +118,6 @@ static void intel_8xx_cleanup(void)
118 118
119static int intel_configure(void) 119static int intel_configure(void)
120{ 120{
121 u32 temp;
122 u16 temp2; 121 u16 temp2;
123 struct aper_size_info_16 *current_size; 122 struct aper_size_info_16 *current_size;
124 123
@@ -128,8 +127,8 @@ static int intel_configure(void)
128 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 127 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
129 128
130 /* address to map to */ 129 /* address to map to */
131 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 130 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
132 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 131 AGP_APERTURE_BAR);
133 132
134 /* attbase - aperture base */ 133 /* attbase - aperture base */
135 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 134 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
@@ -148,7 +147,7 @@ static int intel_configure(void)
148 147
149static int intel_815_configure(void) 148static int intel_815_configure(void)
150{ 149{
151 u32 temp, addr; 150 u32 addr;
152 u8 temp2; 151 u8 temp2;
153 struct aper_size_info_8 *current_size; 152 struct aper_size_info_8 *current_size;
154 153
@@ -167,8 +166,8 @@ static int intel_815_configure(void)
167 current_size->size_value); 166 current_size->size_value);
168 167
169 /* address to map to */ 168 /* address to map to */
170 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 169 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
171 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 170 AGP_APERTURE_BAR);
172 171
173 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr); 172 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
174 addr &= INTEL_815_ATTBASE_MASK; 173 addr &= INTEL_815_ATTBASE_MASK;
@@ -208,7 +207,6 @@ static void intel_820_cleanup(void)
208 207
209static int intel_820_configure(void) 208static int intel_820_configure(void)
210{ 209{
211 u32 temp;
212 u8 temp2; 210 u8 temp2;
213 struct aper_size_info_8 *current_size; 211 struct aper_size_info_8 *current_size;
214 212
@@ -218,8 +216,8 @@ static int intel_820_configure(void)
218 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 216 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
219 217
220 /* address to map to */ 218 /* address to map to */
221 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 219 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
222 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 220 AGP_APERTURE_BAR);
223 221
224 /* attbase - aperture base */ 222 /* attbase - aperture base */
225 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 223 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
@@ -239,7 +237,6 @@ static int intel_820_configure(void)
239 237
240static int intel_840_configure(void) 238static int intel_840_configure(void)
241{ 239{
242 u32 temp;
243 u16 temp2; 240 u16 temp2;
244 struct aper_size_info_8 *current_size; 241 struct aper_size_info_8 *current_size;
245 242
@@ -249,8 +246,8 @@ static int intel_840_configure(void)
249 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 246 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
250 247
251 /* address to map to */ 248 /* address to map to */
252 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 249 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
253 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 250 AGP_APERTURE_BAR);
254 251
255 /* attbase - aperture base */ 252 /* attbase - aperture base */
256 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 253 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
@@ -268,7 +265,6 @@ static int intel_840_configure(void)
268 265
269static int intel_845_configure(void) 266static int intel_845_configure(void)
270{ 267{
271 u32 temp;
272 u8 temp2; 268 u8 temp2;
273 struct aper_size_info_8 *current_size; 269 struct aper_size_info_8 *current_size;
274 270
@@ -282,9 +278,9 @@ static int intel_845_configure(void)
282 agp_bridge->apbase_config); 278 agp_bridge->apbase_config);
283 } else { 279 } else {
284 /* address to map to */ 280 /* address to map to */
285 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 281 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
286 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 282 AGP_APERTURE_BAR);
287 agp_bridge->apbase_config = temp; 283 agp_bridge->apbase_config = agp_bridge->gart_bus_addr;
288 } 284 }
289 285
290 /* attbase - aperture base */ 286 /* attbase - aperture base */
@@ -303,7 +299,6 @@ static int intel_845_configure(void)
303 299
304static int intel_850_configure(void) 300static int intel_850_configure(void)
305{ 301{
306 u32 temp;
307 u16 temp2; 302 u16 temp2;
308 struct aper_size_info_8 *current_size; 303 struct aper_size_info_8 *current_size;
309 304
@@ -313,8 +308,8 @@ static int intel_850_configure(void)
313 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 308 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
314 309
315 /* address to map to */ 310 /* address to map to */
316 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 311 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
317 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 312 AGP_APERTURE_BAR);
318 313
319 /* attbase - aperture base */ 314 /* attbase - aperture base */
320 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 315 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
@@ -332,7 +327,6 @@ static int intel_850_configure(void)
332 327
333static int intel_860_configure(void) 328static int intel_860_configure(void)
334{ 329{
335 u32 temp;
336 u16 temp2; 330 u16 temp2;
337 struct aper_size_info_8 *current_size; 331 struct aper_size_info_8 *current_size;
338 332
@@ -342,8 +336,8 @@ static int intel_860_configure(void)
342 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 336 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
343 337
344 /* address to map to */ 338 /* address to map to */
345 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 339 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
346 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 340 AGP_APERTURE_BAR);
347 341
348 /* attbase - aperture base */ 342 /* attbase - aperture base */
349 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 343 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
@@ -361,7 +355,6 @@ static int intel_860_configure(void)
361 355
362static int intel_830mp_configure(void) 356static int intel_830mp_configure(void)
363{ 357{
364 u32 temp;
365 u16 temp2; 358 u16 temp2;
366 struct aper_size_info_8 *current_size; 359 struct aper_size_info_8 *current_size;
367 360
@@ -371,8 +364,8 @@ static int intel_830mp_configure(void)
371 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 364 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
372 365
373 /* address to map to */ 366 /* address to map to */
374 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 367 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
375 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 368 AGP_APERTURE_BAR);
376 369
377 /* attbase - aperture base */ 370 /* attbase - aperture base */
378 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 371 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
@@ -390,7 +383,6 @@ static int intel_830mp_configure(void)
390 383
391static int intel_7505_configure(void) 384static int intel_7505_configure(void)
392{ 385{
393 u32 temp;
394 u16 temp2; 386 u16 temp2;
395 struct aper_size_info_8 *current_size; 387 struct aper_size_info_8 *current_size;
396 388
@@ -400,8 +392,8 @@ static int intel_7505_configure(void)
400 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 392 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
401 393
402 /* address to map to */ 394 /* address to map to */
403 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 395 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
404 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 396 AGP_APERTURE_BAR);
405 397
406 /* attbase - aperture base */ 398 /* attbase - aperture base */
407 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 399 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index be42a2312dc9..ab65d55272c4 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -115,9 +115,8 @@ static int nvidia_configure(void)
115 pci_write_config_byte(agp_bridge->dev, NVIDIA_0_APSIZE, 115 pci_write_config_byte(agp_bridge->dev, NVIDIA_0_APSIZE,
116 current_size->size_value); 116 current_size->size_value);
117 117
118 /* address to map to */ 118 /* address to map to */
119 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &apbase); 119 apbase = pci_bus_address(agp_bridge->dev, AGP_APERTURE_BAR);
120 apbase &= PCI_BASE_ADDRESS_MEM_MASK;
121 agp_bridge->gart_bus_addr = apbase; 120 agp_bridge->gart_bus_addr = apbase;
122 aplimit = apbase + (current_size->size * 1024 * 1024) - 1; 121 aplimit = apbase + (current_size->size * 1024 * 1024) - 1;
123 pci_write_config_dword(nvidia_private.dev_2, NVIDIA_2_APBASE, apbase); 122 pci_write_config_dword(nvidia_private.dev_2, NVIDIA_2_APBASE, apbase);
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 79c838c434bc..2c74038da459 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -50,13 +50,12 @@ static void sis_tlbflush(struct agp_memory *mem)
50 50
51static int sis_configure(void) 51static int sis_configure(void)
52{ 52{
53 u32 temp;
54 struct aper_size_info_8 *current_size; 53 struct aper_size_info_8 *current_size;
55 54
56 current_size = A_SIZE_8(agp_bridge->current_size); 55 current_size = A_SIZE_8(agp_bridge->current_size);
57 pci_write_config_byte(agp_bridge->dev, SIS_TLBCNTRL, 0x05); 56 pci_write_config_byte(agp_bridge->dev, SIS_TLBCNTRL, 0x05);
58 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 57 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
59 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 58 AGP_APERTURE_BAR);
60 pci_write_config_dword(agp_bridge->dev, SIS_ATTBASE, 59 pci_write_config_dword(agp_bridge->dev, SIS_ATTBASE,
61 agp_bridge->gatt_bus_addr); 60 agp_bridge->gatt_bus_addr);
62 pci_write_config_byte(agp_bridge->dev, SIS_APSIZE, 61 pci_write_config_byte(agp_bridge->dev, SIS_APSIZE,
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 74d3aa3773bf..228f20cddc05 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -43,16 +43,15 @@ static int via_fetch_size(void)
43 43
44static int via_configure(void) 44static int via_configure(void)
45{ 45{
46 u32 temp;
47 struct aper_size_info_8 *current_size; 46 struct aper_size_info_8 *current_size;
48 47
49 current_size = A_SIZE_8(agp_bridge->current_size); 48 current_size = A_SIZE_8(agp_bridge->current_size);
50 /* aperture size */ 49 /* aperture size */
51 pci_write_config_byte(agp_bridge->dev, VIA_APSIZE, 50 pci_write_config_byte(agp_bridge->dev, VIA_APSIZE,
52 current_size->size_value); 51 current_size->size_value);
53 /* address to map too */ 52 /* address to map to */
54 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 53 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
55 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 54 AGP_APERTURE_BAR);
56 55
57 /* GART control register */ 56 /* GART control register */
58 pci_write_config_dword(agp_bridge->dev, VIA_GARTCTRL, 0x0000000f); 57 pci_write_config_dword(agp_bridge->dev, VIA_GARTCTRL, 0x0000000f);
@@ -132,9 +131,9 @@ static int via_configure_agp3(void)
132 131
133 current_size = A_SIZE_16(agp_bridge->current_size); 132 current_size = A_SIZE_16(agp_bridge->current_size);
134 133
135 /* address to map too */ 134 /* address to map to */
136 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 135 agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
137 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 136 AGP_APERTURE_BAR);
138 137
139 /* attbase - aperture GATT base */ 138 /* attbase - aperture GATT base */
140 pci_write_config_dword(agp_bridge->dev, VIA_AGP3_ATTBASE, 139 pci_write_config_dword(agp_bridge->dev, VIA_AGP3_ATTBASE,