diff options
Diffstat (limited to 'drivers/char/agp/amd64-agp.c')
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index fd50ead59c79..67ea3a60de74 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -210,6 +210,7 @@ static const struct agp_bridge_driver amd_8151_driver = { | |||
210 | .aperture_sizes = amd_8151_sizes, | 210 | .aperture_sizes = amd_8151_sizes, |
211 | .size_type = U32_APER_SIZE, | 211 | .size_type = U32_APER_SIZE, |
212 | .num_aperture_sizes = 7, | 212 | .num_aperture_sizes = 7, |
213 | .needs_scratch_page = true, | ||
213 | .configure = amd_8151_configure, | 214 | .configure = amd_8151_configure, |
214 | .fetch_size = amd64_fetch_size, | 215 | .fetch_size = amd64_fetch_size, |
215 | .cleanup = amd64_cleanup, | 216 | .cleanup = amd64_cleanup, |
@@ -499,6 +500,10 @@ static int __devinit agp_amd64_probe(struct pci_dev *pdev, | |||
499 | u8 cap_ptr; | 500 | u8 cap_ptr; |
500 | int err; | 501 | int err; |
501 | 502 | ||
503 | /* The Highlander principle */ | ||
504 | if (agp_bridges_found) | ||
505 | return -ENODEV; | ||
506 | |||
502 | cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); | 507 | cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); |
503 | if (!cap_ptr) | 508 | if (!cap_ptr) |
504 | return -ENODEV; | 509 | return -ENODEV; |
@@ -562,6 +567,8 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev) | |||
562 | amd64_aperture_sizes[bridge->aperture_size_idx].size); | 567 | amd64_aperture_sizes[bridge->aperture_size_idx].size); |
563 | agp_remove_bridge(bridge); | 568 | agp_remove_bridge(bridge); |
564 | agp_put_bridge(bridge); | 569 | agp_put_bridge(bridge); |
570 | |||
571 | agp_bridges_found--; | ||
565 | } | 572 | } |
566 | 573 | ||
567 | #ifdef CONFIG_PM | 574 | #ifdef CONFIG_PM |
@@ -709,6 +716,11 @@ static struct pci_device_id agp_amd64_pci_table[] = { | |||
709 | 716 | ||
710 | MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table); | 717 | MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table); |
711 | 718 | ||
719 | static DEFINE_PCI_DEVICE_TABLE(agp_amd64_pci_promisc_table) = { | ||
720 | { PCI_DEVICE_CLASS(0, 0) }, | ||
721 | { } | ||
722 | }; | ||
723 | |||
712 | static struct pci_driver agp_amd64_pci_driver = { | 724 | static struct pci_driver agp_amd64_pci_driver = { |
713 | .name = "agpgart-amd64", | 725 | .name = "agpgart-amd64", |
714 | .id_table = agp_amd64_pci_table, | 726 | .id_table = agp_amd64_pci_table, |
@@ -734,7 +746,6 @@ int __init agp_amd64_init(void) | |||
734 | return err; | 746 | return err; |
735 | 747 | ||
736 | if (agp_bridges_found == 0) { | 748 | if (agp_bridges_found == 0) { |
737 | struct pci_dev *dev; | ||
738 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { | 749 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { |
739 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); | 750 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); |
740 | #ifdef MODULE | 751 | #ifdef MODULE |
@@ -750,17 +761,10 @@ int __init agp_amd64_init(void) | |||
750 | return -ENODEV; | 761 | return -ENODEV; |
751 | 762 | ||
752 | /* Look for any AGP bridge */ | 763 | /* Look for any AGP bridge */ |
753 | dev = NULL; | 764 | agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table; |
754 | err = -ENODEV; | 765 | err = driver_attach(&agp_amd64_pci_driver.driver); |
755 | for_each_pci_dev(dev) { | 766 | if (err == 0 && agp_bridges_found == 0) |
756 | if (!pci_find_capability(dev, PCI_CAP_ID_AGP)) | 767 | err = -ENODEV; |
757 | continue; | ||
758 | /* Only one bridge supported right now */ | ||
759 | if (agp_amd64_probe(dev, NULL) == 0) { | ||
760 | err = 0; | ||
761 | break; | ||
762 | } | ||
763 | } | ||
764 | } | 768 | } |
765 | return err; | 769 | return err; |
766 | } | 770 | } |