]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'agp-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Oct 2008 19:43:49 +0000 (12:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Oct 2008 19:43:49 +0000 (12:43 -0700)
* 'agp-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
  agp/nvidia: Support agp user-memory on nvidia agp.
  agp/amd-k7: Suspend support for AMD K7 GART driver
  agp/intel: Reduce extraneous PCI posting reads during init
  agp: Fix stolen memory counting on G4X.

1  2 
drivers/char/agp/amd-k7-agp.c
drivers/char/agp/intel-agp.c
drivers/char/agp/nvidia-agp.c

index 603a986e96af6299bd6bc9b2e10bb54edc3aea2c,c9e3310a7d9d5c0002aa663bdeae0a74c785f896..3f98254b911f01cfaae8711dbfda8cadaf451c77
@@@ -223,12 -223,14 +223,14 @@@ static int amd_irongate_configure(void
  
        current_size = A_SIZE_LVL2(agp_bridge->current_size);
  
-       /* Get the memory mapped registers */
-       pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp);
-       temp = (temp & PCI_BASE_ADDRESS_MEM_MASK);
-       amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
-       if (!amd_irongate_private.registers)
-               return -ENOMEM;
+       if (!amd_irongate_private.registers) {
+               /* Get the memory mapped registers */
+               pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp);
+               temp = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+               amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
+               if (!amd_irongate_private.registers)
+                       return -ENOMEM;
+       }
  
        /* Write out the address of the gatt table */
        writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE);
@@@ -386,9 -388,7 +388,9 @@@ static const struct agp_bridge_driver a
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -492,6 -492,26 +494,26 @@@ static void __devexit agp_amdk7_remove(
        agp_put_bridge(bridge);
  }
  
+ #ifdef CONFIG_PM
+ static int agp_amdk7_suspend(struct pci_dev *pdev, pm_message_t state)
+ {
+       pci_save_state(pdev);
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+       return 0;
+ }
+ static int agp_amdk7_resume(struct pci_dev *pdev)
+ {
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       return amd_irongate_driver.configure();
+ }
+ #endif /* CONFIG_PM */
  /* must be the same order as name table above */
  static struct pci_device_id agp_amdk7_pci_table[] = {
        {
@@@ -528,6 -548,10 +550,10 @@@ static struct pci_driver agp_amdk7_pci_
        .id_table       = agp_amdk7_pci_table,
        .probe          = agp_amdk7_probe,
        .remove         = agp_amdk7_remove,
+ #ifdef CONFIG_PM
+       .suspend        = agp_amdk7_suspend,
+       .resume         = agp_amdk7_resume,
+ #endif
  };
  
  static int __init agp_amdk7_init(void)
index 043e36628d6d7faf03c34e5f7a2f9956f5429694,81f094244471afde3fcbd1afea78784c76d47ea9..1108665913e207da892459750377400db809c961
@@@ -54,8 -54,7 +54,7 @@@
                 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
                 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
                 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \
-                agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \
-                agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
+                agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB)
  
  #define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
                agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
@@@ -63,7 -62,8 +62,8 @@@
  
  #define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \
                agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
-               agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB)
+               agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
+               agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
  
  extern int agp_memory_reserved;
  
@@@ -214,8 -214,8 +214,8 @@@ static int intel_i810_configure(void
        if (agp_bridge->driver->needs_scratch_page) {
                for (i = 0; i < current_size->num_entries; i++) {
                        writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
-                       readl(intel_private.registers+I810_PTE_BASE+(i*4));     /* PCI posting. */
                }
+               readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI posting. */
        }
        global_cache_flush();
        return 0;
@@@ -525,8 -525,10 +525,10 @@@ static void intel_i830_init_gtt_entries
                size += 4;
        } else if (IS_G4X) {
                /* On 4 series hardware, GTT stolen is separate from graphics
-                * stolen, ignore it in stolen gtt entries counting */
-               size = 0;
+                * stolen, ignore it in stolen gtt entries counting.  However,
+                * 4KB of the stolen memory doesn't get mapped to the GTT.
+                */
+               size = 4;
        } else {
                /* On previous hardware, the GTT size was just what was
                 * required to map the aperture.
@@@ -773,8 -775,8 +775,8 @@@ static int intel_i830_configure(void
        if (agp_bridge->driver->needs_scratch_page) {
                for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
                        writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
-                       readl(intel_private.registers+I810_PTE_BASE+(i*4));     /* PCI Posting. */
                }
+               readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */
        }
  
        global_cache_flush();
@@@ -989,8 -991,8 +991,8 @@@ static int intel_i915_configure(void
        if (agp_bridge->driver->needs_scratch_page) {
                for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
                        writel(agp_bridge->scratch_page, intel_private.gtt+i);
-                       readl(intel_private.gtt+i);     /* PCI Posting. */
                }
+               readl(intel_private.gtt+i-1);   /* PCI Posting. */
        }
  
        global_cache_flush();
@@@ -1711,9 -1713,7 +1713,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1738,9 -1738,7 +1740,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = intel_i810_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1764,9 -1762,7 +1766,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1791,9 -1787,7 +1793,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i830_chipset_flush,
  };
@@@ -1818,9 -1812,7 +1820,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1844,9 -1836,7 +1846,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1870,9 -1860,7 +1872,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1896,9 -1884,7 +1898,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
        .chipset_flush          = intel_i830_chipset_flush,
  };
@@@ -1923,9 -1909,7 +1925,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1949,9 -1933,7 +1951,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -1976,9 -1958,7 +1978,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i915_chipset_flush,
  };
@@@ -2004,9 -1984,7 +2006,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i915_chipset_flush,
  };
@@@ -2031,9 -2009,7 +2033,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };
  
@@@ -2058,9 -2034,7 +2060,9 @@@ static const struct agp_bridge_driver i
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i915_chipset_flush,
  };
index dc70d3771811a1d820bc020d73929ebfd491ad18,0cc1c5baced591ee02e76ce2b7953802b13fb97d..5bbed3d79db95f9d62ec32132817d645a961c7d2
@@@ -201,10 -201,15 +201,15 @@@ extern int agp_memory_reserved
  static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
  {
        int i, j;
+       int mask_type;
  
-       if ((type != 0) || (mem->type != 0))
+       mask_type = agp_generic_type_to_mask_type(mem->bridge, type);
+       if (mask_type != 0 || type != mem->type)
                return -EINVAL;
  
+       if (mem->page_count == 0)
+               return 0;
        if ((pg_start + mem->page_count) >
                (nvidia_private.num_active_entries - agp_memory_reserved/PAGE_SIZE))
                return -EINVAL;
        }
        for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
                writel(agp_bridge->driver->mask_memory(agp_bridge,
-                       mem->memory[i], mem->type),
+                       mem->memory[i], mask_type),
                        agp_bridge->gatt_table+nvidia_private.pg_offset+j);
-               readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j);       /* PCI Posting. */
        }
+       /* PCI Posting. */
+       readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j - 1);
        agp_bridge->driver->tlb_flush(mem);
        return 0;
  }
@@@ -233,9 -241,15 +241,15 @@@ static int nvidia_remove_memory(struct 
  {
        int i;
  
-       if ((type != 0) || (mem->type != 0))
+       int mask_type;
+       mask_type = agp_generic_type_to_mask_type(mem->bridge, type);
+       if (mask_type != 0 || type != mem->type)
                return -EINVAL;
  
+       if (mem->page_count == 0)
+               return 0;
        for (i = pg_start; i < (mem->page_count + pg_start); i++)
                writel(agp_bridge->scratch_page, agp_bridge->gatt_table+nvidia_private.pg_offset+i);
  
@@@ -312,9 -326,7 +326,9 @@@ static const struct agp_bridge_driver n
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
 +      .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
 +      .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
  };