diff options
-rw-r--r-- | arch/x86/kernel/aperture_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/pci-gart_64.c | 57 | ||||
-rw-r--r-- | include/asm-x86/gart.h | 1 |
3 files changed, 55 insertions, 5 deletions
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index eb20f168c0fd..3409abb231ac 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c | |||
@@ -496,4 +496,6 @@ out: | |||
496 | write_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE, aper_alloc >> 25); | 496 | write_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE, aper_alloc >> 25); |
497 | } | 497 | } |
498 | } | 498 | } |
499 | |||
500 | set_up_gart_resume(aper_order, aper_alloc); | ||
499 | } | 501 | } |
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 3710097f02eb..f505c3890358 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -549,14 +549,63 @@ static __init unsigned read_aperture(struct pci_dev *dev, u32 *size) | |||
549 | return aper_base; | 549 | return aper_base; |
550 | } | 550 | } |
551 | 551 | ||
552 | static void enable_gart_translations(void) | ||
553 | { | ||
554 | int i; | ||
555 | |||
556 | for (i = 0; i < num_k8_northbridges; i++) { | ||
557 | struct pci_dev *dev = k8_northbridges[i]; | ||
558 | |||
559 | enable_gart_translation(dev, __pa(agp_gatt_table)); | ||
560 | } | ||
561 | } | ||
562 | |||
563 | /* | ||
564 | * If fix_up_north_bridges is set, the north bridges have to be fixed up on | ||
565 | * resume in the same way as they are handled in gart_iommu_hole_init(). | ||
566 | */ | ||
567 | static bool fix_up_north_bridges; | ||
568 | static u32 aperture_order; | ||
569 | static u32 aperture_alloc; | ||
570 | |||
571 | void set_up_gart_resume(u32 aper_order, u32 aper_alloc) | ||
572 | { | ||
573 | fix_up_north_bridges = true; | ||
574 | aperture_order = aper_order; | ||
575 | aperture_alloc = aper_alloc; | ||
576 | } | ||
577 | |||
552 | static int gart_resume(struct sys_device *dev) | 578 | static int gart_resume(struct sys_device *dev) |
553 | { | 579 | { |
580 | printk(KERN_INFO "PCI-DMA: Resuming GART IOMMU\n"); | ||
581 | |||
582 | if (fix_up_north_bridges) { | ||
583 | int i; | ||
584 | |||
585 | printk(KERN_INFO "PCI-DMA: Restoring GART aperture settings\n"); | ||
586 | |||
587 | for (i = 0; i < num_k8_northbridges; i++) { | ||
588 | struct pci_dev *dev = k8_northbridges[i]; | ||
589 | |||
590 | /* | ||
591 | * Don't enable translations just yet. That is the next | ||
592 | * step. Restore the pre-suspend aperture settings. | ||
593 | */ | ||
594 | pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, | ||
595 | aperture_order << 1); | ||
596 | pci_write_config_dword(dev, AMD64_GARTAPERTUREBASE, | ||
597 | aperture_alloc >> 25); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | enable_gart_translations(); | ||
602 | |||
554 | return 0; | 603 | return 0; |
555 | } | 604 | } |
556 | 605 | ||
557 | static int gart_suspend(struct sys_device *dev, pm_message_t state) | 606 | static int gart_suspend(struct sys_device *dev, pm_message_t state) |
558 | { | 607 | { |
559 | return -EINVAL; | 608 | return 0; |
560 | } | 609 | } |
561 | 610 | ||
562 | static struct sysdev_class gart_sysdev_class = { | 611 | static struct sysdev_class gart_sysdev_class = { |
@@ -614,16 +663,14 @@ static __init int init_k8_gatt(struct agp_kern_info *info) | |||
614 | memset(gatt, 0, gatt_size); | 663 | memset(gatt, 0, gatt_size); |
615 | agp_gatt_table = gatt; | 664 | agp_gatt_table = gatt; |
616 | 665 | ||
617 | for (i = 0; i < num_k8_northbridges; i++) { | 666 | enable_gart_translations(); |
618 | dev = k8_northbridges[i]; | ||
619 | enable_gart_translation(dev, __pa(gatt)); | ||
620 | } | ||
621 | 667 | ||
622 | error = sysdev_class_register(&gart_sysdev_class); | 668 | error = sysdev_class_register(&gart_sysdev_class); |
623 | if (!error) | 669 | if (!error) |
624 | error = sysdev_register(&device_gart); | 670 | error = sysdev_register(&device_gart); |
625 | if (error) | 671 | if (error) |
626 | panic("Could not register gart_sysdev -- would corrupt data on next suspend"); | 672 | panic("Could not register gart_sysdev -- would corrupt data on next suspend"); |
673 | |||
627 | flush_gart(); | 674 | flush_gart(); |
628 | 675 | ||
629 | printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n", | 676 | printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n", |
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h index c818b96f936b..eeca2f51fd8f 100644 --- a/include/asm-x86/gart.h +++ b/include/asm-x86/gart.h | |||
@@ -14,6 +14,7 @@ extern void gart_iommu_shutdown(void); | |||
14 | extern void __init gart_parse_options(char *); | 14 | extern void __init gart_parse_options(char *); |
15 | extern void early_gart_iommu_check(void); | 15 | extern void early_gart_iommu_check(void); |
16 | extern void gart_iommu_hole_init(void); | 16 | extern void gart_iommu_hole_init(void); |
17 | extern void set_up_gart_resume(u32, u32); | ||
17 | extern int fallback_aper_order; | 18 | extern int fallback_aper_order; |
18 | extern int fallback_aper_force; | 19 | extern int fallback_aper_force; |
19 | extern int gart_iommu_aperture; | 20 | extern int gart_iommu_aperture; |