aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/ati-agp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp/ati-agp.c')
-rw-r--r--drivers/char/agp/ati-agp.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 160564345993..f244c6682738 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -41,7 +41,6 @@ static struct gatt_mask ati_generic_masks[] =
41}; 41};
42 42
43 43
44
45typedef struct _ati_page_map { 44typedef struct _ati_page_map {
46 unsigned long *real; 45 unsigned long *real;
47 unsigned long __iomem *remapped; 46 unsigned long __iomem *remapped;
@@ -141,7 +140,8 @@ static int ati_create_gatt_pages(int nr_tables)
141 ati_generic_private.num_tables = nr_tables; 140 ati_generic_private.num_tables = nr_tables;
142 ati_generic_private.gatt_pages = tables; 141 ati_generic_private.gatt_pages = tables;
143 142
144 if (retval != 0) ati_free_gatt_pages(); 143 if (retval != 0)
144 ati_free_gatt_pages();
145 145
146 return retval; 146 return retval;
147} 147}
@@ -219,16 +219,16 @@ static int ati_configure(void)
219 ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); 219 ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
220 220
221 if (is_r200()) 221 if (is_r200())
222 pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); 222 pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000);
223 else 223 else
224 pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000); 224 pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000);
225 225
226 /* address to map too */ 226 /* address to map too */
227 /* 227 /*
228 pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp); 228 pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp);
229 agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 229 agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
230 printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); 230 printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr);
231 */ 231 */
232 writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); 232 writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID);
233 readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/ 233 readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/
234 234
@@ -245,18 +245,20 @@ static int ati_configure(void)
245 245
246 246
247#ifdef CONFIG_PM 247#ifdef CONFIG_PM
248static int agp_ati_resume(struct pci_dev *dev) 248static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
249{ 249{
250 pci_restore_state(dev); 250 pci_save_state(dev);
251 pci_set_power_state(dev, 3);
251 252
252 return ati_configure(); 253 return 0;
253} 254}
254 255
255static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) 256static int agp_ati_resume(struct pci_dev *dev)
256{ 257{
257 pci_save_state(dev); 258 pci_set_power_state(dev, 0);
259 pci_restore_state(dev);
258 260
259 return 0; 261 return ati_configure();
260} 262}
261#endif 263#endif
262 264
@@ -321,9 +323,9 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
321 unsigned long __iomem *cur_gatt; 323 unsigned long __iomem *cur_gatt;
322 unsigned long addr; 324 unsigned long addr;
323 325
324 if (type != 0 || mem->type != 0) { 326 if (type != 0 || mem->type != 0)
325 return -EINVAL; 327 return -EINVAL;
326 } 328
327 for (i = pg_start; i < (mem->page_count + pg_start); i++) { 329 for (i = pg_start; i < (mem->page_count + pg_start); i++) {
328 addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; 330 addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr;
329 cur_gatt = GET_GATT(addr); 331 cur_gatt = GET_GATT(addr);
@@ -502,9 +504,8 @@ found:
502 504
503 bridge->dev = pdev; 505 bridge->dev = pdev;
504 bridge->capndx = cap_ptr; 506 bridge->capndx = cap_ptr;
505
506 bridge->driver = &ati_generic_bridge;
507 507
508 bridge->driver = &ati_generic_bridge;
508 509
509 printk(KERN_INFO PFX "Detected Ati %s chipset\n", 510 printk(KERN_INFO PFX "Detected Ati %s chipset\n",
510 devs[j].chipset_name); 511 devs[j].chipset_name);
@@ -546,8 +547,8 @@ static struct pci_driver agp_ati_pci_driver = {
546 .probe = agp_ati_probe, 547 .probe = agp_ati_probe,
547 .remove = agp_ati_remove, 548 .remove = agp_ati_remove,
548#ifdef CONFIG_PM 549#ifdef CONFIG_PM
549 .resume = agp_ati_resume,
550 .suspend = agp_ati_suspend, 550 .suspend = agp_ati_suspend,
551 .resume = agp_ati_resume,
551#endif 552#endif
552}; 553};
553 554