aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp/generic.c')
-rw-r--r--drivers/char/agp/generic.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index dd370be00d68..10d6cbd7c05e 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -446,6 +446,10 @@ int agp_bind_memory(struct agp_memory *curr, off_t pg_start)
446 446
447 curr->is_bound = true; 447 curr->is_bound = true;
448 curr->pg_start = pg_start; 448 curr->pg_start = pg_start;
449 spin_lock(&agp_bridge->mapped_lock);
450 list_add(&curr->mapped_list, &agp_bridge->mapped_list);
451 spin_unlock(&agp_bridge->mapped_lock);
452
449 return 0; 453 return 0;
450} 454}
451EXPORT_SYMBOL(agp_bind_memory); 455EXPORT_SYMBOL(agp_bind_memory);
@@ -478,10 +482,34 @@ int agp_unbind_memory(struct agp_memory *curr)
478 482
479 curr->is_bound = false; 483 curr->is_bound = false;
480 curr->pg_start = 0; 484 curr->pg_start = 0;
485 spin_lock(&curr->bridge->mapped_lock);
486 list_del(&curr->mapped_list);
487 spin_unlock(&curr->bridge->mapped_lock);
481 return 0; 488 return 0;
482} 489}
483EXPORT_SYMBOL(agp_unbind_memory); 490EXPORT_SYMBOL(agp_unbind_memory);
484 491
492/**
493 * agp_rebind_emmory - Rewrite the entire GATT, useful on resume
494 */
495int agp_rebind_memory(void)
496{
497 struct agp_memory *curr;
498 int ret_val = 0;
499
500 spin_lock(&agp_bridge->mapped_lock);
501 list_for_each_entry(curr, &agp_bridge->mapped_list, mapped_list) {
502 ret_val = curr->bridge->driver->insert_memory(curr,
503 curr->pg_start,
504 curr->type);
505 if (ret_val != 0)
506 break;
507 }
508 spin_unlock(&agp_bridge->mapped_lock);
509 return ret_val;
510}
511EXPORT_SYMBOL(agp_rebind_memory);
512
485/* End - Routines for handling swapping of agp_memory into the GATT */ 513/* End - Routines for handling swapping of agp_memory into the GATT */
486 514
487 515
@@ -788,8 +816,8 @@ void agp_device_command(u32 bridge_agpstat, bool agp_v3)
788 if (!agp) 816 if (!agp)
789 continue; 817 continue;
790 818
791 printk(KERN_INFO PFX "Putting AGP V%d device at %s into %dx mode\n", 819 dev_info(&device->dev, "putting AGP V%d device into %dx mode\n",
792 agp_v3 ? 3 : 2, pci_name(device), mode); 820 agp_v3 ? 3 : 2, mode);
793 pci_write_config_dword(device, agp + PCI_AGP_COMMAND, bridge_agpstat); 821 pci_write_config_dword(device, agp + PCI_AGP_COMMAND, bridge_agpstat);
794 } 822 }
795} 823}
@@ -817,10 +845,8 @@ void agp_generic_enable(struct agp_bridge_data *bridge, u32 requested_mode)
817 845
818 get_agp_version(agp_bridge); 846 get_agp_version(agp_bridge);
819 847
820 printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n", 848 dev_info(&agp_bridge->dev->dev, "AGP %d.%d bridge\n",
821 agp_bridge->major_version, 849 agp_bridge->major_version, agp_bridge->minor_version);
822 agp_bridge->minor_version,
823 pci_name(agp_bridge->dev));
824 850
825 pci_read_config_dword(agp_bridge->dev, 851 pci_read_config_dword(agp_bridge->dev,
826 agp_bridge->capndx + PCI_AGP_STATUS, &bridge_agpstat); 852 agp_bridge->capndx + PCI_AGP_STATUS, &bridge_agpstat);
@@ -849,8 +875,7 @@ void agp_generic_enable(struct agp_bridge_data *bridge, u32 requested_mode)
849 pci_write_config_dword(bridge->dev, 875 pci_write_config_dword(bridge->dev,
850 bridge->capndx+AGPCTRL, temp); 876 bridge->capndx+AGPCTRL, temp);
851 877
852 printk(KERN_INFO PFX "Device is in legacy mode," 878 dev_info(&bridge->dev->dev, "bridge is in legacy mode, falling back to 2.x\n");
853 " falling back to 2.x\n");
854 } 879 }
855 } 880 }
856 881