diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/agp/Kconfig | 1 | ||||
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/ati-agp.c | 33 | ||||
-rw-r--r-- | drivers/char/agp/nvidia-agp.c | 27 |
4 files changed, 46 insertions, 17 deletions
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 9826a399fa02..22f8cf218cc6 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config AGP | 1 | config AGP |
2 | tristate "/dev/agpgart (AGP Support)" | 2 | tristate "/dev/agpgart (AGP Support)" |
3 | depends on ALPHA || IA64 || PPC || X86 | 3 | depends on ALPHA || IA64 || PPC || X86 |
4 | depends on PCI | ||
4 | ---help--- | 5 | ---help--- |
5 | AGP (Accelerated Graphics Port) is a bus system mainly used to | 6 | AGP (Accelerated Graphics Port) is a bus system mainly used to |
6 | connect graphics cards to the rest of the system. | 7 | connect graphics cards to the rest of the system. |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index f690ee8cb732..f74eeeb8e377 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -734,7 +734,7 @@ int __init agp_amd64_init(void) | |||
734 | 734 | ||
735 | if (agp_off) | 735 | if (agp_off) |
736 | return -EINVAL; | 736 | return -EINVAL; |
737 | if (pci_register_driver(&agp_amd64_pci_driver) > 0) { | 737 | if (pci_register_driver(&agp_amd64_pci_driver) < 0) { |
738 | struct pci_dev *dev; | 738 | struct pci_dev *dev; |
739 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { | 739 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { |
740 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); | 740 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); |
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 | |||
45 | typedef struct _ati_page_map { | 44 | typedef 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 |
248 | static int agp_ati_resume(struct pci_dev *dev) | 248 | static 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 | ||
255 | static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) | 256 | static 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 | ||
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c index 4c67135c12d8..df7f37b2739a 100644 --- a/drivers/char/agp/nvidia-agp.c +++ b/drivers/char/agp/nvidia-agp.c | |||
@@ -376,6 +376,29 @@ static void __devexit agp_nvidia_remove(struct pci_dev *pdev) | |||
376 | agp_put_bridge(bridge); | 376 | agp_put_bridge(bridge); |
377 | } | 377 | } |
378 | 378 | ||
379 | #ifdef CONFIG_PM | ||
380 | static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state) | ||
381 | { | ||
382 | pci_save_state (pdev); | ||
383 | pci_set_power_state (pdev, 3); | ||
384 | |||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static int agp_nvidia_resume(struct pci_dev *pdev) | ||
389 | { | ||
390 | /* set power state 0 and restore PCI space */ | ||
391 | pci_set_power_state (pdev, 0); | ||
392 | pci_restore_state(pdev); | ||
393 | |||
394 | /* reconfigure AGP hardware again */ | ||
395 | nvidia_configure(); | ||
396 | |||
397 | return 0; | ||
398 | } | ||
399 | #endif | ||
400 | |||
401 | |||
379 | static struct pci_device_id agp_nvidia_pci_table[] = { | 402 | static struct pci_device_id agp_nvidia_pci_table[] = { |
380 | { | 403 | { |
381 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | 404 | .class = (PCI_CLASS_BRIDGE_HOST << 8), |
@@ -403,6 +426,10 @@ static struct pci_driver agp_nvidia_pci_driver = { | |||
403 | .id_table = agp_nvidia_pci_table, | 426 | .id_table = agp_nvidia_pci_table, |
404 | .probe = agp_nvidia_probe, | 427 | .probe = agp_nvidia_probe, |
405 | .remove = agp_nvidia_remove, | 428 | .remove = agp_nvidia_remove, |
429 | #ifdef CONFIG_PM | ||
430 | .suspend = agp_nvidia_suspend, | ||
431 | .resume = agp_nvidia_resume, | ||
432 | #endif | ||
406 | }; | 433 | }; |
407 | 434 | ||
408 | static int __init agp_nvidia_init(void) | 435 | static int __init agp_nvidia_init(void) |