]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/char/agp/intel-agp.c
Update email addresses.
[mirror_ubuntu-artful-kernel.git] / drivers / char / agp / intel-agp.c
index 2cff0976a668d189e7d40aaa37f16e98ecf1756e..9cf6e9bb017e6dca0b537bb04b70e5c49dbf705b 100644 (file)
@@ -32,8 +32,8 @@
 #define PCI_DEVICE_ID_INTEL_Q35_IG          0x29B2
 #define PCI_DEVICE_ID_INTEL_Q33_HB          0x29D0
 #define PCI_DEVICE_ID_INTEL_Q33_IG          0x29D2
-#define PCI_DEVICE_ID_INTEL_IGD_HB          0x2A40
-#define PCI_DEVICE_ID_INTEL_IGD_IG          0x2A42
+#define PCI_DEVICE_ID_INTEL_GM45_HB         0x2A40
+#define PCI_DEVICE_ID_INTEL_GM45_IG         0x2A42
 #define PCI_DEVICE_ID_INTEL_IGD_E_HB        0x2E00
 #define PCI_DEVICE_ID_INTEL_IGD_E_IG        0x2E02
 #define PCI_DEVICE_ID_INTEL_Q45_HB          0x2E10
@@ -54,8 +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_IGD_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 @@
 
 #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;
 
@@ -161,7 +161,7 @@ static int intel_i810_fetch_size(void)
        values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes);
 
        if ((smram_miscc & I810_GMS) == I810_GMS_DISABLE) {
-               printk(KERN_WARNING PFX "i810 is disabled\n");
+               dev_warn(&agp_bridge->dev->dev, "i810 is disabled\n");
                return 0;
        }
        if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) {
@@ -193,7 +193,8 @@ static int intel_i810_configure(void)
 
                intel_private.registers = ioremap(temp, 128 * 4096);
                if (!intel_private.registers) {
-                       printk(KERN_ERR PFX "Unable to remap memory.\n");
+                       dev_err(&intel_private.pcidev->dev,
+                               "can't remap memory\n");
                        return -ENOMEM;
                }
        }
@@ -201,7 +202,8 @@ static int intel_i810_configure(void)
        if ((readl(intel_private.registers+I810_DRAM_CTL)
                & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) {
                /* This will need to be dynamically assigned */
-               printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n");
+               dev_info(&intel_private.pcidev->dev,
+                        "detected 4MB dedicated video ram\n");
                intel_private.num_dcache_entries = 1024;
        }
        pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp);
@@ -212,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;
@@ -500,8 +502,8 @@ static void intel_i830_init_gtt_entries(void)
                        size = 1024 + 512;
                        break;
                default:
-                       printk(KERN_INFO PFX "Unknown page table size, "
-                              "assuming 512KB\n");
+                       dev_info(&intel_private.pcidev->dev,
+                                "unknown page table size, assuming 512KB\n");
                        size = 512;
                }
                size += 4; /* add in BIOS popup space */
@@ -515,16 +517,18 @@ static void intel_i830_init_gtt_entries(void)
                        size = 2048;
                        break;
                default:
-                       printk(KERN_INFO PFX "Unknown page table size 0x%x, "
-                               "assuming 512KB\n",
+                       dev_info(&agp_bridge->dev->dev,
+                                "unknown page table size 0x%x, assuming 512KB\n",
                                (gmch_ctrl & G33_PGETBL_SIZE_MASK));
                        size = 512;
                }
                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.
@@ -627,11 +631,11 @@ static void intel_i830_init_gtt_entries(void)
                }
        }
        if (gtt_entries > 0)
-               printk(KERN_INFO PFX "Detected %dK %s memory.\n",
+               dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
                       gtt_entries / KB(1), local ? "local" : "stolen");
        else
-               printk(KERN_INFO PFX
-                      "No pre-allocated video memory detected.\n");
+               dev_info(&agp_bridge->dev->dev,
+                      "no pre-allocated video memory detected\n");
        gtt_entries /= KB(4);
 
        intel_private.gtt_entries = gtt_entries;
@@ -771,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();
@@ -801,10 +805,12 @@ static int intel_i830_insert_entries(struct agp_memory *mem, off_t pg_start,
        num_entries = A_SIZE_FIX(temp)->num_entries;
 
        if (pg_start < intel_private.gtt_entries) {
-               printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n",
-                               pg_start, intel_private.gtt_entries);
+               dev_printk(KERN_DEBUG, &intel_private.pcidev->dev,
+                          "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n",
+                          pg_start, intel_private.gtt_entries);
 
-               printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n");
+               dev_info(&intel_private.pcidev->dev,
+                        "trying to insert into local/stolen memory\n");
                goto out_err;
        }
 
@@ -851,7 +857,8 @@ static int intel_i830_remove_entries(struct agp_memory *mem, off_t pg_start,
                return 0;
 
        if (pg_start < intel_private.gtt_entries) {
-               printk(KERN_INFO PFX "Trying to disable local/stolen memory\n");
+               dev_info(&intel_private.pcidev->dev,
+                        "trying to disable local/stolen memory\n");
                return -EINVAL;
        }
 
@@ -957,7 +964,7 @@ static void intel_i9xx_setup_flush(void)
        if (intel_private.ifp_resource.start) {
                intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE);
                if (!intel_private.i9xx_flush_page)
-                       printk(KERN_INFO "unable to ioremap flush  page - no chipset flushing");
+                       dev_info(&intel_private.pcidev->dev, "can't ioremap flush page - no chipset flushing");
        }
 }
 
@@ -984,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();
@@ -1028,10 +1035,12 @@ static int intel_i915_insert_entries(struct agp_memory *mem, off_t pg_start,
        num_entries = A_SIZE_FIX(temp)->num_entries;
 
        if (pg_start < intel_private.gtt_entries) {
-               printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n",
-                               pg_start, intel_private.gtt_entries);
+               dev_printk(KERN_DEBUG, &intel_private.pcidev->dev,
+                          "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n",
+                          pg_start, intel_private.gtt_entries);
 
-               printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n");
+               dev_info(&intel_private.pcidev->dev,
+                        "trying to insert into local/stolen memory\n");
                goto out_err;
        }
 
@@ -1078,7 +1087,8 @@ static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start,
                return 0;
 
        if (pg_start < intel_private.gtt_entries) {
-               printk(KERN_INFO PFX "Trying to disable local/stolen memory\n");
+               dev_info(&intel_private.pcidev->dev,
+                        "trying to disable local/stolen memory\n");
                return -EINVAL;
        }
 
@@ -1182,7 +1192,7 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge,
 static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
 {
        switch (agp_bridge->dev->device) {
-       case PCI_DEVICE_ID_INTEL_IGD_HB:
+       case PCI_DEVICE_ID_INTEL_GM45_HB:
        case PCI_DEVICE_ID_INTEL_IGD_E_HB:
        case PCI_DEVICE_ID_INTEL_Q45_HB:
        case PCI_DEVICE_ID_INTEL_G45_HB:
@@ -1379,7 +1389,7 @@ static int intel_815_configure(void)
        /* the Intel 815 chipset spec. says that bits 29-31 in the
        * ATTBASE register are reserved -> try not to write them */
        if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
-               printk(KERN_EMERG PFX "gatt bus addr too high");
+               dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high");
                return -EINVAL;
        }
 
@@ -1705,6 +1715,7 @@ static const struct agp_bridge_driver intel_generic_driver = {
        .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,
 };
 
@@ -1731,6 +1742,7 @@ static const struct agp_bridge_driver intel_810_driver = {
        .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,
 };
 
@@ -1756,6 +1768,7 @@ static const struct agp_bridge_driver intel_815_driver = {
        .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,
 };
 
@@ -1782,6 +1795,7 @@ static const struct agp_bridge_driver intel_830_driver = {
        .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,
 };
@@ -1808,6 +1822,7 @@ static const struct agp_bridge_driver intel_820_driver = {
        .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,
 };
 
@@ -1833,6 +1848,7 @@ static const struct agp_bridge_driver intel_830mp_driver = {
        .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,
 };
 
@@ -1858,6 +1874,7 @@ static const struct agp_bridge_driver intel_840_driver = {
        .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,
 };
 
@@ -1883,6 +1900,7 @@ static const struct agp_bridge_driver intel_845_driver = {
        .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,
 };
@@ -1909,6 +1927,7 @@ static const struct agp_bridge_driver intel_850_driver = {
        .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,
 };
 
@@ -1934,6 +1953,7 @@ static const struct agp_bridge_driver intel_860_driver = {
        .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,
 };
 
@@ -1960,6 +1980,7 @@ static const struct agp_bridge_driver intel_915_driver = {
        .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,
 };
@@ -1987,6 +2008,7 @@ static const struct agp_bridge_driver intel_i965_driver = {
        .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,
 };
@@ -2013,6 +2035,7 @@ static const struct agp_bridge_driver intel_7505_driver = {
        .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,
 };
 
@@ -2039,6 +2062,7 @@ static const struct agp_bridge_driver intel_g33_driver = {
        .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,
 };
@@ -2131,8 +2155,8 @@ static const struct intel_driver_description {
                NULL, &intel_g33_driver },
        { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33",
                NULL, &intel_g33_driver },
-       { PCI_DEVICE_ID_INTEL_IGD_HB, PCI_DEVICE_ID_INTEL_IGD_IG, 0,
-           "Intel Integrated Graphics Device", NULL, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0,
+           "Mobile Intel? GM45 Express", NULL, &intel_i965_driver },
        { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0,
            "Intel Integrated Graphics Device", NULL, &intel_i965_driver },
        { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0,
@@ -2177,8 +2201,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
 
        if (intel_agp_chipsets[i].name == NULL) {
                if (cap_ptr)
-                       printk(KERN_WARNING PFX "Unsupported Intel chipset"
-                              "(device id: %04x)\n", pdev->device);
+                       dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n",
+                                pdev->vendor, pdev->device);
                agp_put_bridge(bridge);
                return -ENODEV;
        }
@@ -2186,9 +2210,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        if (bridge->driver == NULL) {
                /* bridge has no AGP and no IGD detected */
                if (cap_ptr)
-                       printk(KERN_WARNING PFX "Failed to find bridge device "
-                               "(chip_id: %04x)\n",
-                               intel_agp_chipsets[i].gmch_chip_id);
+                       dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n",
+                                intel_agp_chipsets[i].gmch_chip_id);
                agp_put_bridge(bridge);
                return -ENODEV;
        }
@@ -2197,8 +2220,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        bridge->capndx = cap_ptr;
        bridge->dev_private_data = &intel_private;
 
-       printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n",
-               intel_agp_chipsets[i].name);
+       dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
 
        /*
        * The following fixes the case where the BIOS has "forgotten" to
@@ -2208,7 +2230,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        r = &pdev->resource[0];
        if (!r->start && r->end) {
                if (pci_assign_resource(pdev, 0)) {
-                       printk(KERN_ERR PFX "could not assign resource 0\n");
+                       dev_err(&pdev->dev, "can't assign resource 0\n");
                        agp_put_bridge(bridge);
                        return -ENODEV;
                }
@@ -2220,7 +2242,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        * 20030610 - hamish@zot.org
        */
        if (pci_enable_device(pdev)) {
-               printk(KERN_ERR PFX "Unable to Enable PCI device\n");
+               dev_err(&pdev->dev, "can't enable PCI device\n");
                agp_put_bridge(bridge);
                return -ENODEV;
        }
@@ -2252,6 +2274,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
 static int agp_intel_resume(struct pci_dev *pdev)
 {
        struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+       int ret_val;
 
        pci_restore_state(pdev);
 
@@ -2279,6 +2302,10 @@ static int agp_intel_resume(struct pci_dev *pdev)
        else if (bridge->driver == &intel_i965_driver)
                intel_i915_configure();
 
+       ret_val = agp_rebind_memory();
+       if (ret_val != 0)
+               return ret_val;
+
        return 0;
 }
 #endif
@@ -2329,7 +2356,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
        ID(PCI_DEVICE_ID_INTEL_G33_HB),
        ID(PCI_DEVICE_ID_INTEL_Q35_HB),
        ID(PCI_DEVICE_ID_INTEL_Q33_HB),
-       ID(PCI_DEVICE_ID_INTEL_IGD_HB),
+       ID(PCI_DEVICE_ID_INTEL_GM45_HB),
        ID(PCI_DEVICE_ID_INTEL_IGD_E_HB),
        ID(PCI_DEVICE_ID_INTEL_Q45_HB),
        ID(PCI_DEVICE_ID_INTEL_G45_HB),
@@ -2363,5 +2390,5 @@ static void __exit agp_intel_cleanup(void)
 module_init(agp_intel_init);
 module_exit(agp_intel_cleanup);
 
-MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
+MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
 MODULE_LICENSE("GPL and additional rights");