diff options
Diffstat (limited to 'arch/x86/kernel/pci-gart_64.c')
-rw-r--r-- | arch/x86/kernel/pci-gart_64.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 0f7f130caa67..ba0f0ca9f280 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -39,8 +39,9 @@ | |||
39 | #include <asm/cacheflush.h> | 39 | #include <asm/cacheflush.h> |
40 | #include <asm/swiotlb.h> | 40 | #include <asm/swiotlb.h> |
41 | #include <asm/dma.h> | 41 | #include <asm/dma.h> |
42 | #include <asm/k8.h> | 42 | #include <asm/amd_nb.h> |
43 | #include <asm/x86_init.h> | 43 | #include <asm/x86_init.h> |
44 | #include <asm/iommu_table.h> | ||
44 | 45 | ||
45 | static unsigned long iommu_bus_base; /* GART remapping area (physical) */ | 46 | static unsigned long iommu_bus_base; /* GART remapping area (physical) */ |
46 | static unsigned long iommu_size; /* size of remapping area bytes */ | 47 | static unsigned long iommu_size; /* size of remapping area bytes */ |
@@ -560,8 +561,11 @@ static void enable_gart_translations(void) | |||
560 | { | 561 | { |
561 | int i; | 562 | int i; |
562 | 563 | ||
563 | for (i = 0; i < num_k8_northbridges; i++) { | 564 | if (!k8_northbridges.gart_supported) |
564 | struct pci_dev *dev = k8_northbridges[i]; | 565 | return; |
566 | |||
567 | for (i = 0; i < k8_northbridges.num; i++) { | ||
568 | struct pci_dev *dev = k8_northbridges.nb_misc[i]; | ||
565 | 569 | ||
566 | enable_gart_translation(dev, __pa(agp_gatt_table)); | 570 | enable_gart_translation(dev, __pa(agp_gatt_table)); |
567 | } | 571 | } |
@@ -592,16 +596,19 @@ static void gart_fixup_northbridges(struct sys_device *dev) | |||
592 | if (!fix_up_north_bridges) | 596 | if (!fix_up_north_bridges) |
593 | return; | 597 | return; |
594 | 598 | ||
599 | if (!k8_northbridges.gart_supported) | ||
600 | return; | ||
601 | |||
595 | pr_info("PCI-DMA: Restoring GART aperture settings\n"); | 602 | pr_info("PCI-DMA: Restoring GART aperture settings\n"); |
596 | 603 | ||
597 | for (i = 0; i < num_k8_northbridges; i++) { | 604 | for (i = 0; i < k8_northbridges.num; i++) { |
598 | struct pci_dev *dev = k8_northbridges[i]; | 605 | struct pci_dev *dev = k8_northbridges.nb_misc[i]; |
599 | 606 | ||
600 | /* | 607 | /* |
601 | * Don't enable translations just yet. That is the next | 608 | * Don't enable translations just yet. That is the next |
602 | * step. Restore the pre-suspend aperture settings. | 609 | * step. Restore the pre-suspend aperture settings. |
603 | */ | 610 | */ |
604 | pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, aperture_order << 1); | 611 | gart_set_size_and_enable(dev, aperture_order); |
605 | pci_write_config_dword(dev, AMD64_GARTAPERTUREBASE, aperture_alloc >> 25); | 612 | pci_write_config_dword(dev, AMD64_GARTAPERTUREBASE, aperture_alloc >> 25); |
606 | } | 613 | } |
607 | } | 614 | } |
@@ -649,8 +656,8 @@ static __init int init_k8_gatt(struct agp_kern_info *info) | |||
649 | 656 | ||
650 | aper_size = aper_base = info->aper_size = 0; | 657 | aper_size = aper_base = info->aper_size = 0; |
651 | dev = NULL; | 658 | dev = NULL; |
652 | for (i = 0; i < num_k8_northbridges; i++) { | 659 | for (i = 0; i < k8_northbridges.num; i++) { |
653 | dev = k8_northbridges[i]; | 660 | dev = k8_northbridges.nb_misc[i]; |
654 | new_aper_base = read_aperture(dev, &new_aper_size); | 661 | new_aper_base = read_aperture(dev, &new_aper_size); |
655 | if (!new_aper_base) | 662 | if (!new_aper_base) |
656 | goto nommu; | 663 | goto nommu; |
@@ -718,10 +725,13 @@ static void gart_iommu_shutdown(void) | |||
718 | if (!no_agp) | 725 | if (!no_agp) |
719 | return; | 726 | return; |
720 | 727 | ||
721 | for (i = 0; i < num_k8_northbridges; i++) { | 728 | if (!k8_northbridges.gart_supported) |
729 | return; | ||
730 | |||
731 | for (i = 0; i < k8_northbridges.num; i++) { | ||
722 | u32 ctl; | 732 | u32 ctl; |
723 | 733 | ||
724 | dev = k8_northbridges[i]; | 734 | dev = k8_northbridges.nb_misc[i]; |
725 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl); | 735 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl); |
726 | 736 | ||
727 | ctl &= ~GARTEN; | 737 | ctl &= ~GARTEN; |
@@ -739,7 +749,7 @@ int __init gart_iommu_init(void) | |||
739 | unsigned long scratch; | 749 | unsigned long scratch; |
740 | long i; | 750 | long i; |
741 | 751 | ||
742 | if (num_k8_northbridges == 0) | 752 | if (!k8_northbridges.gart_supported) |
743 | return 0; | 753 | return 0; |
744 | 754 | ||
745 | #ifndef CONFIG_AGP_AMD64 | 755 | #ifndef CONFIG_AGP_AMD64 |
@@ -896,3 +906,4 @@ void __init gart_parse_options(char *p) | |||
896 | } | 906 | } |
897 | } | 907 | } |
898 | } | 908 | } |
909 | IOMMU_INIT_POST(gart_iommu_hole_init); | ||