Commit 6cd8ae1f authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGPGART] Fix two nasty bugs in the K8 AGP support:

From Andi.
                                                                  
- Don't kill AGP in the IOMMU code (Badari Pulavarty)
- Do checking for overlapping aperture/pci resource correctly
(thanks to Arjan van de Ven for noticing)
parent cf97bb26
...@@ -680,7 +680,7 @@ static int __init pci_iommu_init(void) ...@@ -680,7 +680,7 @@ static int __init pci_iommu_init(void)
unsigned long iommu_start; unsigned long iommu_start;
struct pci_dev *dev; struct pci_dev *dev;
#ifndef CONFIG_AGP_AMD_8151 #ifndef CONFIG_AGP_AMD64
no_agp = 1; no_agp = 1;
#else #else
/* Makefile puts PCI initialization via subsys_initcall first. */ /* Makefile puts PCI initialization via subsys_initcall first. */
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
static int nr_garts; static int nr_garts;
static struct pci_dev * hammers[MAX_HAMMER_GARTS]; static struct pci_dev * hammers[MAX_HAMMER_GARTS];
static struct resource *aperture_resource;
static int __initdata agp_try_unsupported; static int __initdata agp_try_unsupported;
static int gart_iterator; static int gart_iterator;
...@@ -250,7 +251,6 @@ struct agp_bridge_driver amd_8151_driver = { ...@@ -250,7 +251,6 @@ struct agp_bridge_driver amd_8151_driver = {
/* Some basic sanity checks for the aperture. */ /* Some basic sanity checks for the aperture. */
static int __devinit aperture_valid(u64 aper, u32 size) static int __devinit aperture_valid(u64 aper, u32 size)
{ {
static int not_first_call;
u32 pfn, c; u32 pfn, c;
if (aper == 0) { if (aper == 0) {
printk(KERN_ERR PFX "No aperture\n"); printk(KERN_ERR PFX "No aperture\n");
...@@ -279,12 +279,11 @@ static int __devinit aperture_valid(u64 aper, u32 size) ...@@ -279,12 +279,11 @@ static int __devinit aperture_valid(u64 aper, u32 size)
Maybe better to use pci_assign_resource/pci_enable_device instead trusting Maybe better to use pci_assign_resource/pci_enable_device instead trusting
the bridges? */ the bridges? */
if (!not_first_call && !request_mem_region(aper, size, "aperture")) { if (!aperture_resource &&
!(aperture_resource = request_mem_region(aper, size, "aperture"))) {
printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n"); printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n");
return 0; return 0;
} }
not_first_call = 1;
return 1; return 1;
} }
...@@ -537,6 +536,8 @@ int __init agp_amd64_init(void) ...@@ -537,6 +536,8 @@ int __init agp_amd64_init(void)
static void __exit agp_amd64_cleanup(void) static void __exit agp_amd64_cleanup(void)
{ {
if (aperture_resource)
release_resource(aperture_resource);
pci_unregister_driver(&agp_amd64_pci_driver); pci_unregister_driver(&agp_amd64_pci_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment