diff options
Diffstat (limited to 'drivers/char/agp/generic.c')
-rw-r--r-- | drivers/char/agp/generic.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index eaa1a355bb32..118dbde25dc7 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -429,6 +429,10 @@ int agp_bind_memory(struct agp_memory *curr, off_t pg_start) | |||
429 | 429 | ||
430 | curr->is_bound = true; | 430 | curr->is_bound = true; |
431 | curr->pg_start = pg_start; | 431 | curr->pg_start = pg_start; |
432 | spin_lock(&agp_bridge->mapped_lock); | ||
433 | list_add(&curr->mapped_list, &agp_bridge->mapped_list); | ||
434 | spin_unlock(&agp_bridge->mapped_lock); | ||
435 | |||
432 | return 0; | 436 | return 0; |
433 | } | 437 | } |
434 | EXPORT_SYMBOL(agp_bind_memory); | 438 | EXPORT_SYMBOL(agp_bind_memory); |
@@ -461,10 +465,34 @@ int agp_unbind_memory(struct agp_memory *curr) | |||
461 | 465 | ||
462 | curr->is_bound = false; | 466 | curr->is_bound = false; |
463 | curr->pg_start = 0; | 467 | curr->pg_start = 0; |
468 | spin_lock(&curr->bridge->mapped_lock); | ||
469 | list_del(&curr->mapped_list); | ||
470 | spin_unlock(&curr->bridge->mapped_lock); | ||
464 | return 0; | 471 | return 0; |
465 | } | 472 | } |
466 | EXPORT_SYMBOL(agp_unbind_memory); | 473 | EXPORT_SYMBOL(agp_unbind_memory); |
467 | 474 | ||
475 | /** | ||
476 | * agp_rebind_emmory - Rewrite the entire GATT, useful on resume | ||
477 | */ | ||
478 | int agp_rebind_memory(void) | ||
479 | { | ||
480 | struct agp_memory *curr; | ||
481 | int ret_val = 0; | ||
482 | |||
483 | spin_lock(&agp_bridge->mapped_lock); | ||
484 | list_for_each_entry(curr, &agp_bridge->mapped_list, mapped_list) { | ||
485 | ret_val = curr->bridge->driver->insert_memory(curr, | ||
486 | curr->pg_start, | ||
487 | curr->type); | ||
488 | if (ret_val != 0) | ||
489 | break; | ||
490 | } | ||
491 | spin_unlock(&agp_bridge->mapped_lock); | ||
492 | return ret_val; | ||
493 | } | ||
494 | EXPORT_SYMBOL(agp_rebind_memory); | ||
495 | |||
468 | /* End - Routines for handling swapping of agp_memory into the GATT */ | 496 | /* End - Routines for handling swapping of agp_memory into the GATT */ |
469 | 497 | ||
470 | 498 | ||
@@ -771,8 +799,8 @@ void agp_device_command(u32 bridge_agpstat, bool agp_v3) | |||
771 | if (!agp) | 799 | if (!agp) |
772 | continue; | 800 | continue; |
773 | 801 | ||
774 | printk(KERN_INFO PFX "Putting AGP V%d device at %s into %dx mode\n", | 802 | dev_info(&device->dev, "putting AGP V%d device into %dx mode\n", |
775 | agp_v3 ? 3 : 2, pci_name(device), mode); | 803 | agp_v3 ? 3 : 2, mode); |
776 | pci_write_config_dword(device, agp + PCI_AGP_COMMAND, bridge_agpstat); | 804 | pci_write_config_dword(device, agp + PCI_AGP_COMMAND, bridge_agpstat); |
777 | } | 805 | } |
778 | } | 806 | } |
@@ -800,10 +828,8 @@ void agp_generic_enable(struct agp_bridge_data *bridge, u32 requested_mode) | |||
800 | 828 | ||
801 | get_agp_version(agp_bridge); | 829 | get_agp_version(agp_bridge); |
802 | 830 | ||
803 | printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n", | 831 | dev_info(&agp_bridge->dev->dev, "AGP %d.%d bridge\n", |
804 | agp_bridge->major_version, | 832 | agp_bridge->major_version, agp_bridge->minor_version); |
805 | agp_bridge->minor_version, | ||
806 | pci_name(agp_bridge->dev)); | ||
807 | 833 | ||
808 | pci_read_config_dword(agp_bridge->dev, | 834 | pci_read_config_dword(agp_bridge->dev, |
809 | agp_bridge->capndx + PCI_AGP_STATUS, &bridge_agpstat); | 835 | agp_bridge->capndx + PCI_AGP_STATUS, &bridge_agpstat); |
@@ -832,8 +858,7 @@ void agp_generic_enable(struct agp_bridge_data *bridge, u32 requested_mode) | |||
832 | pci_write_config_dword(bridge->dev, | 858 | pci_write_config_dword(bridge->dev, |
833 | bridge->capndx+AGPCTRL, temp); | 859 | bridge->capndx+AGPCTRL, temp); |
834 | 860 | ||
835 | printk(KERN_INFO PFX "Device is in legacy mode," | 861 | dev_info(&bridge->dev->dev, "bridge is in legacy mode, falling back to 2.x\n"); |
836 | " falling back to 2.x\n"); | ||
837 | } | 862 | } |
838 | } | 863 | } |
839 | 864 | ||