aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/Kconfig3
-rw-r--r--drivers/char/agp/amd64-agp.c20
-rw-r--r--drivers/char/agp/backend.c13
-rw-r--r--drivers/char/agp/hp-agp.c6
-rw-r--r--drivers/char/agp/intel-agp.c127
-rw-r--r--drivers/char/agp/uninorth-agp.c77
6 files changed, 121 insertions, 125 deletions
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index ccb1fa89de29..2fb3a480f6b0 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -56,9 +56,8 @@ config AGP_AMD
56 X on AMD Irongate, 761, and 762 chipsets. 56 X on AMD Irongate, 761, and 762 chipsets.
57 57
58config AGP_AMD64 58config AGP_AMD64
59 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU 59 tristate "AMD Opteron/Athlon64 on-CPU GART support"
60 depends on AGP && X86 60 depends on AGP && X86
61 default y if GART_IOMMU
62 help 61 help
63 This option gives you AGP support for the GLX component of 62 This option gives you AGP support for the GLX component of
64 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. 63 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 2fb2e6cc322a..fd50ead59c79 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -728,6 +728,7 @@ int __init agp_amd64_init(void)
728 728
729 if (agp_off) 729 if (agp_off)
730 return -EINVAL; 730 return -EINVAL;
731
731 err = pci_register_driver(&agp_amd64_pci_driver); 732 err = pci_register_driver(&agp_amd64_pci_driver);
732 if (err < 0) 733 if (err < 0)
733 return err; 734 return err;
@@ -764,19 +765,28 @@ int __init agp_amd64_init(void)
764 return err; 765 return err;
765} 766}
766 767
768static int __init agp_amd64_mod_init(void)
769{
770#ifndef MODULE
771 if (gart_iommu_aperture)
772 return agp_bridges_found ? 0 : -ENODEV;
773#endif
774 return agp_amd64_init();
775}
776
767static void __exit agp_amd64_cleanup(void) 777static void __exit agp_amd64_cleanup(void)
768{ 778{
779#ifndef MODULE
780 if (gart_iommu_aperture)
781 return;
782#endif
769 if (aperture_resource) 783 if (aperture_resource)
770 release_resource(aperture_resource); 784 release_resource(aperture_resource);
771 pci_unregister_driver(&agp_amd64_pci_driver); 785 pci_unregister_driver(&agp_amd64_pci_driver);
772} 786}
773 787
774/* On AMD64 the PCI driver needs to initialize this driver early 788module_init(agp_amd64_mod_init);
775 for the IOMMU, so it has to be called via a backdoor. */
776#ifndef CONFIG_GART_IOMMU
777module_init(agp_amd64_init);
778module_exit(agp_amd64_cleanup); 789module_exit(agp_amd64_cleanup);
779#endif
780 790
781MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); 791MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen");
782module_param(agp_try_unsupported, bool, 0); 792module_param(agp_try_unsupported, bool, 0);
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index a56ca080e108..c3ab46da51a3 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -285,18 +285,22 @@ int agp_add_bridge(struct agp_bridge_data *bridge)
285{ 285{
286 int error; 286 int error;
287 287
288 if (agp_off) 288 if (agp_off) {
289 return -ENODEV; 289 error = -ENODEV;
290 goto err_put_bridge;
291 }
290 292
291 if (!bridge->dev) { 293 if (!bridge->dev) {
292 printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); 294 printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n");
293 return -EINVAL; 295 error = -EINVAL;
296 goto err_put_bridge;
294 } 297 }
295 298
296 /* Grab reference on the chipset driver. */ 299 /* Grab reference on the chipset driver. */
297 if (!try_module_get(bridge->driver->owner)) { 300 if (!try_module_get(bridge->driver->owner)) {
298 dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); 301 dev_info(&bridge->dev->dev, "can't lock chipset driver\n");
299 return -EINVAL; 302 error = -EINVAL;
303 goto err_put_bridge;
300 } 304 }
301 305
302 error = agp_backend_initialize(bridge); 306 error = agp_backend_initialize(bridge);
@@ -326,6 +330,7 @@ frontend_err:
326 agp_backend_cleanup(bridge); 330 agp_backend_cleanup(bridge);
327err_out: 331err_out:
328 module_put(bridge->driver->owner); 332 module_put(bridge->driver->owner);
333err_put_bridge:
329 agp_put_bridge(bridge); 334 agp_put_bridge(bridge);
330 return error; 335 return error;
331} 336}
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 9047b2714653..58752b70efea 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -488,9 +488,8 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
488 handle = obj; 488 handle = obj;
489 do { 489 do {
490 status = acpi_get_object_info(handle, &info); 490 status = acpi_get_object_info(handle, &info);
491 if (ACPI_SUCCESS(status)) { 491 if (ACPI_SUCCESS(status) && (info->valid & ACPI_VALID_HID)) {
492 /* TBD check _CID also */ 492 /* TBD check _CID also */
493 info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0';
494 match = (strcmp(info->hardware_id.string, "HWP0001") == 0); 493 match = (strcmp(info->hardware_id.string, "HWP0001") == 0);
495 kfree(info); 494 kfree(info);
496 if (match) { 495 if (match) {
@@ -509,6 +508,9 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
509 handle = parent; 508 handle = parent;
510 } while (ACPI_SUCCESS(status)); 509 } while (ACPI_SUCCESS(status));
511 510
511 if (ACPI_FAILURE(status))
512 return AE_OK; /* found no enclosing IOC */
513
512 if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa)) 514 if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa))
513 return AE_OK; 515 return AE_OK;
514 516
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 4068467ce7b9..8a713f1e9653 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -8,6 +8,7 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/pagemap.h> 9#include <linux/pagemap.h>
10#include <linux/agp_backend.h> 10#include <linux/agp_backend.h>
11#include <asm/smp.h>
11#include "agp.h" 12#include "agp.h"
12 13
13/* 14/*
@@ -36,10 +37,10 @@
36#define PCI_DEVICE_ID_INTEL_82965GME_IG 0x2A12 37#define PCI_DEVICE_ID_INTEL_82965GME_IG 0x2A12
37#define PCI_DEVICE_ID_INTEL_82945GME_HB 0x27AC 38#define PCI_DEVICE_ID_INTEL_82945GME_HB 0x27AC
38#define PCI_DEVICE_ID_INTEL_82945GME_IG 0x27AE 39#define PCI_DEVICE_ID_INTEL_82945GME_IG 0x27AE
39#define PCI_DEVICE_ID_INTEL_IGDGM_HB 0xA010 40#define PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB 0xA010
40#define PCI_DEVICE_ID_INTEL_IGDGM_IG 0xA011 41#define PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG 0xA011
41#define PCI_DEVICE_ID_INTEL_IGDG_HB 0xA000 42#define PCI_DEVICE_ID_INTEL_PINEVIEW_HB 0xA000
42#define PCI_DEVICE_ID_INTEL_IGDG_IG 0xA001 43#define PCI_DEVICE_ID_INTEL_PINEVIEW_IG 0xA001
43#define PCI_DEVICE_ID_INTEL_G33_HB 0x29C0 44#define PCI_DEVICE_ID_INTEL_G33_HB 0x29C0
44#define PCI_DEVICE_ID_INTEL_G33_IG 0x29C2 45#define PCI_DEVICE_ID_INTEL_G33_IG 0x29C2
45#define PCI_DEVICE_ID_INTEL_Q35_HB 0x29B0 46#define PCI_DEVICE_ID_INTEL_Q35_HB 0x29B0
@@ -50,19 +51,20 @@
50#define PCI_DEVICE_ID_INTEL_B43_IG 0x2E42 51#define PCI_DEVICE_ID_INTEL_B43_IG 0x2E42
51#define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40 52#define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40
52#define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42 53#define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42
53#define PCI_DEVICE_ID_INTEL_IGD_E_HB 0x2E00 54#define PCI_DEVICE_ID_INTEL_EAGLELAKE_HB 0x2E00
54#define PCI_DEVICE_ID_INTEL_IGD_E_IG 0x2E02 55#define PCI_DEVICE_ID_INTEL_EAGLELAKE_IG 0x2E02
55#define PCI_DEVICE_ID_INTEL_Q45_HB 0x2E10 56#define PCI_DEVICE_ID_INTEL_Q45_HB 0x2E10
56#define PCI_DEVICE_ID_INTEL_Q45_IG 0x2E12 57#define PCI_DEVICE_ID_INTEL_Q45_IG 0x2E12
57#define PCI_DEVICE_ID_INTEL_G45_HB 0x2E20 58#define PCI_DEVICE_ID_INTEL_G45_HB 0x2E20
58#define PCI_DEVICE_ID_INTEL_G45_IG 0x2E22 59#define PCI_DEVICE_ID_INTEL_G45_IG 0x2E22
59#define PCI_DEVICE_ID_INTEL_G41_HB 0x2E30 60#define PCI_DEVICE_ID_INTEL_G41_HB 0x2E30
60#define PCI_DEVICE_ID_INTEL_G41_IG 0x2E32 61#define PCI_DEVICE_ID_INTEL_G41_IG 0x2E32
61#define PCI_DEVICE_ID_INTEL_IGDNG_D_HB 0x0040 62#define PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB 0x0040
62#define PCI_DEVICE_ID_INTEL_IGDNG_D_IG 0x0042 63#define PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG 0x0042
63#define PCI_DEVICE_ID_INTEL_IGDNG_M_HB 0x0044 64#define PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB 0x0044
64#define PCI_DEVICE_ID_INTEL_IGDNG_MA_HB 0x0062 65#define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB 0x0062
65#define PCI_DEVICE_ID_INTEL_IGDNG_M_IG 0x0046 66#define PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB 0x006a
67#define PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG 0x0046
66 68
67/* cover 915 and 945 variants */ 69/* cover 915 and 945 variants */
68#define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \ 70#define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \
@@ -82,21 +84,22 @@
82#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ 84#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
83 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ 85 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
84 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q33_HB || \ 86 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q33_HB || \
85 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDGM_HB || \ 87 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB || \
86 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDG_HB) 88 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB)
87 89
88#define IS_IGD (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDGM_HB || \ 90#define IS_PINEVIEW (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB || \
89 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDG_HB) 91 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB)
90 92
91#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \ 93#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \
92 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ 94 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
93 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \ 95 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
94 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB || \ 96 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB || \
95 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G41_HB || \ 97 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G41_HB || \
96 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_B43_HB || \ 98 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_B43_HB || \
97 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_D_HB || \ 99 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB || \
98 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_M_HB || \ 100 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || \
99 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MA_HB) 101 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB || \
102 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB)
100 103
101extern int agp_memory_reserved; 104extern int agp_memory_reserved;
102 105
@@ -176,6 +179,7 @@ static struct _intel_private {
176 * popup and for the GTT. 179 * popup and for the GTT.
177 */ 180 */
178 int gtt_entries; /* i830+ */ 181 int gtt_entries; /* i830+ */
182 int gtt_total_size;
179 union { 183 union {
180 void __iomem *i9xx_flush_page; 184 void __iomem *i9xx_flush_page;
181 void *i8xx_flush_page; 185 void *i8xx_flush_page;
@@ -651,7 +655,7 @@ static void intel_i830_init_gtt_entries(void)
651 size = 512; 655 size = 512;
652 } 656 }
653 size += 4; /* add in BIOS popup space */ 657 size += 4; /* add in BIOS popup space */
654 } else if (IS_G33 && !IS_IGD) { 658 } else if (IS_G33 && !IS_PINEVIEW) {
655 /* G33's GTT size defined in gmch_ctrl */ 659 /* G33's GTT size defined in gmch_ctrl */
656 switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { 660 switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) {
657 case G33_PGETBL_SIZE_1M: 661 case G33_PGETBL_SIZE_1M:
@@ -667,7 +671,7 @@ static void intel_i830_init_gtt_entries(void)
667 size = 512; 671 size = 512;
668 } 672 }
669 size += 4; 673 size += 4;
670 } else if (IS_G4X || IS_IGD) { 674 } else if (IS_G4X || IS_PINEVIEW) {
671 /* On 4 series hardware, GTT stolen is separate from graphics 675 /* On 4 series hardware, GTT stolen is separate from graphics
672 * stolen, ignore it in stolen gtt entries counting. However, 676 * stolen, ignore it in stolen gtt entries counting. However,
673 * 4KB of the stolen memory doesn't get mapped to the GTT. 677 * 4KB of the stolen memory doesn't get mapped to the GTT.
@@ -812,12 +816,6 @@ static void intel_i830_setup_flush(void)
812 intel_i830_fini_flush(); 816 intel_i830_fini_flush();
813} 817}
814 818
815static void
816do_wbinvd(void *null)
817{
818 wbinvd();
819}
820
821/* The chipset_flush interface needs to get data that has already been 819/* The chipset_flush interface needs to get data that has already been
822 * flushed out of the CPU all the way out to main memory, because the GPU 820 * flushed out of the CPU all the way out to main memory, because the GPU
823 * doesn't snoop those buffers. 821 * doesn't snoop those buffers.
@@ -834,12 +832,10 @@ static void intel_i830_chipset_flush(struct agp_bridge_data *bridge)
834 832
835 memset(pg, 0, 1024); 833 memset(pg, 0, 1024);
836 834
837 if (cpu_has_clflush) { 835 if (cpu_has_clflush)
838 clflush_cache_range(pg, 1024); 836 clflush_cache_range(pg, 1024);
839 } else { 837 else if (wbinvd_on_all_cpus() != 0)
840 if (on_each_cpu(do_wbinvd, NULL, 1) != 0) 838 printk(KERN_ERR "Timed out waiting for cache flush.\n");
841 printk(KERN_ERR "Timed out waiting for cache flush.\n");
842 }
843} 839}
844 840
845/* The intel i830 automatically initializes the agp aperture during POST. 841/* The intel i830 automatically initializes the agp aperture during POST.
@@ -1151,7 +1147,7 @@ static int intel_i915_configure(void)
1151 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ 1147 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
1152 1148
1153 if (agp_bridge->driver->needs_scratch_page) { 1149 if (agp_bridge->driver->needs_scratch_page) {
1154 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { 1150 for (i = intel_private.gtt_entries; i < intel_private.gtt_total_size; i++) {
1155 writel(agp_bridge->scratch_page, intel_private.gtt+i); 1151 writel(agp_bridge->scratch_page, intel_private.gtt+i);
1156 } 1152 }
1157 readl(intel_private.gtt+i-1); /* PCI Posting. */ 1153 readl(intel_private.gtt+i-1); /* PCI Posting. */
@@ -1161,12 +1157,6 @@ static int intel_i915_configure(void)
1161 1157
1162 intel_i9xx_setup_flush(); 1158 intel_i9xx_setup_flush();
1163 1159
1164#ifdef USE_PCI_DMA_API
1165 if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
1166 dev_err(&intel_private.pcidev->dev,
1167 "set gfx device dma mask 36bit failed!\n");
1168#endif
1169
1170 return 0; 1160 return 0;
1171} 1161}
1172 1162
@@ -1312,6 +1302,8 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
1312 if (!intel_private.gtt) 1302 if (!intel_private.gtt)
1313 return -ENOMEM; 1303 return -ENOMEM;
1314 1304
1305 intel_private.gtt_total_size = gtt_map_size / 4;
1306
1315 temp &= 0xfff80000; 1307 temp &= 0xfff80000;
1316 1308
1317 intel_private.registers = ioremap(temp, 128 * 4096); 1309 intel_private.registers = ioremap(temp, 128 * 4096);
@@ -1356,14 +1348,15 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
1356{ 1348{
1357 switch (agp_bridge->dev->device) { 1349 switch (agp_bridge->dev->device) {
1358 case PCI_DEVICE_ID_INTEL_GM45_HB: 1350 case PCI_DEVICE_ID_INTEL_GM45_HB:
1359 case PCI_DEVICE_ID_INTEL_IGD_E_HB: 1351 case PCI_DEVICE_ID_INTEL_EAGLELAKE_HB:
1360 case PCI_DEVICE_ID_INTEL_Q45_HB: 1352 case PCI_DEVICE_ID_INTEL_Q45_HB:
1361 case PCI_DEVICE_ID_INTEL_G45_HB: 1353 case PCI_DEVICE_ID_INTEL_G45_HB:
1362 case PCI_DEVICE_ID_INTEL_G41_HB: 1354 case PCI_DEVICE_ID_INTEL_G41_HB:
1363 case PCI_DEVICE_ID_INTEL_B43_HB: 1355 case PCI_DEVICE_ID_INTEL_B43_HB:
1364 case PCI_DEVICE_ID_INTEL_IGDNG_D_HB: 1356 case PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB:
1365 case PCI_DEVICE_ID_INTEL_IGDNG_M_HB: 1357 case PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB:
1366 case PCI_DEVICE_ID_INTEL_IGDNG_MA_HB: 1358 case PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB:
1359 case PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB:
1367 *gtt_offset = *gtt_size = MB(2); 1360 *gtt_offset = *gtt_size = MB(2);
1368 break; 1361 break;
1369 default: 1362 default:
@@ -1398,6 +1391,8 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
1398 if (!intel_private.gtt) 1391 if (!intel_private.gtt)
1399 return -ENOMEM; 1392 return -ENOMEM;
1400 1393
1394 intel_private.gtt_total_size = gtt_size / 4;
1395
1401 intel_private.registers = ioremap(temp, 128 * 4096); 1396 intel_private.registers = ioremap(temp, 128 * 4096);
1402 if (!intel_private.registers) { 1397 if (!intel_private.registers) {
1403 iounmap(intel_private.gtt); 1398 iounmap(intel_private.gtt);
@@ -2343,14 +2338,14 @@ static const struct intel_driver_description {
2343 NULL, &intel_g33_driver }, 2338 NULL, &intel_g33_driver },
2344 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33", 2339 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33",
2345 NULL, &intel_g33_driver }, 2340 NULL, &intel_g33_driver },
2346 { PCI_DEVICE_ID_INTEL_IGDGM_HB, PCI_DEVICE_ID_INTEL_IGDGM_IG, 0, "IGD", 2341 { PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB, PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG, 0, "Pineview",
2347 NULL, &intel_g33_driver }, 2342 NULL, &intel_g33_driver },
2348 { PCI_DEVICE_ID_INTEL_IGDG_HB, PCI_DEVICE_ID_INTEL_IGDG_IG, 0, "IGD", 2343 { PCI_DEVICE_ID_INTEL_PINEVIEW_HB, PCI_DEVICE_ID_INTEL_PINEVIEW_IG, 0, "Pineview",
2349 NULL, &intel_g33_driver }, 2344 NULL, &intel_g33_driver },
2350 { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0, 2345 { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0,
2351 "Mobile Intel® GM45 Express", NULL, &intel_i965_driver }, 2346 "GM45", NULL, &intel_i965_driver },
2352 { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0, 2347 { PCI_DEVICE_ID_INTEL_EAGLELAKE_HB, PCI_DEVICE_ID_INTEL_EAGLELAKE_IG, 0,
2353 "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, 2348 "Eaglelake", NULL, &intel_i965_driver },
2354 { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0, 2349 { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0,
2355 "Q45/Q43", NULL, &intel_i965_driver }, 2350 "Q45/Q43", NULL, &intel_i965_driver },
2356 { PCI_DEVICE_ID_INTEL_G45_HB, PCI_DEVICE_ID_INTEL_G45_IG, 0, 2351 { PCI_DEVICE_ID_INTEL_G45_HB, PCI_DEVICE_ID_INTEL_G45_IG, 0,
@@ -2359,12 +2354,14 @@ static const struct intel_driver_description {
2359 "B43", NULL, &intel_i965_driver }, 2354 "B43", NULL, &intel_i965_driver },
2360 { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, 0, 2355 { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, 0,
2361 "G41", NULL, &intel_i965_driver }, 2356 "G41", NULL, &intel_i965_driver },
2362 { PCI_DEVICE_ID_INTEL_IGDNG_D_HB, PCI_DEVICE_ID_INTEL_IGDNG_D_IG, 0, 2357 { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, 0,
2363 "IGDNG/D", NULL, &intel_i965_driver }, 2358 "Ironlake/D", NULL, &intel_i965_driver },
2364 { PCI_DEVICE_ID_INTEL_IGDNG_M_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0, 2359 { PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, 0,
2365 "IGDNG/M", NULL, &intel_i965_driver }, 2360 "Ironlake/M", NULL, &intel_i965_driver },
2366 { PCI_DEVICE_ID_INTEL_IGDNG_MA_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0, 2361 { PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, 0,
2367 "IGDNG/MA", NULL, &intel_i965_driver }, 2362 "Ironlake/MA", NULL, &intel_i965_driver },
2363 { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, 0,
2364 "Ironlake/MC2", NULL, &intel_i965_driver },
2368 { 0, 0, 0, NULL, NULL, NULL } 2365 { 0, 0, 0, NULL, NULL, NULL }
2369}; 2366};
2370 2367
@@ -2456,6 +2453,15 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2456 &bridge->mode); 2453 &bridge->mode);
2457 } 2454 }
2458 2455
2456 if (bridge->driver->mask_memory == intel_i965_mask_memory) {
2457 if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
2458 dev_err(&intel_private.pcidev->dev,
2459 "set gfx device dma mask 36bit failed!\n");
2460 else
2461 pci_set_consistent_dma_mask(intel_private.pcidev,
2462 DMA_BIT_MASK(36));
2463 }
2464
2459 pci_set_drvdata(pdev, bridge); 2465 pci_set_drvdata(pdev, bridge);
2460 return agp_add_bridge(bridge); 2466 return agp_add_bridge(bridge);
2461} 2467}
@@ -2541,8 +2547,8 @@ static struct pci_device_id agp_intel_pci_table[] = {
2541 ID(PCI_DEVICE_ID_INTEL_82945G_HB), 2547 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
2542 ID(PCI_DEVICE_ID_INTEL_82945GM_HB), 2548 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
2543 ID(PCI_DEVICE_ID_INTEL_82945GME_HB), 2549 ID(PCI_DEVICE_ID_INTEL_82945GME_HB),
2544 ID(PCI_DEVICE_ID_INTEL_IGDGM_HB), 2550 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB),
2545 ID(PCI_DEVICE_ID_INTEL_IGDG_HB), 2551 ID(PCI_DEVICE_ID_INTEL_PINEVIEW_HB),
2546 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB), 2552 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
2547 ID(PCI_DEVICE_ID_INTEL_82G35_HB), 2553 ID(PCI_DEVICE_ID_INTEL_82G35_HB),
2548 ID(PCI_DEVICE_ID_INTEL_82965Q_HB), 2554 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
@@ -2553,14 +2559,15 @@ static struct pci_device_id agp_intel_pci_table[] = {
2553 ID(PCI_DEVICE_ID_INTEL_Q35_HB), 2559 ID(PCI_DEVICE_ID_INTEL_Q35_HB),
2554 ID(PCI_DEVICE_ID_INTEL_Q33_HB), 2560 ID(PCI_DEVICE_ID_INTEL_Q33_HB),
2555 ID(PCI_DEVICE_ID_INTEL_GM45_HB), 2561 ID(PCI_DEVICE_ID_INTEL_GM45_HB),
2556 ID(PCI_DEVICE_ID_INTEL_IGD_E_HB), 2562 ID(PCI_DEVICE_ID_INTEL_EAGLELAKE_HB),
2557 ID(PCI_DEVICE_ID_INTEL_Q45_HB), 2563 ID(PCI_DEVICE_ID_INTEL_Q45_HB),
2558 ID(PCI_DEVICE_ID_INTEL_G45_HB), 2564 ID(PCI_DEVICE_ID_INTEL_G45_HB),
2559 ID(PCI_DEVICE_ID_INTEL_G41_HB), 2565 ID(PCI_DEVICE_ID_INTEL_G41_HB),
2560 ID(PCI_DEVICE_ID_INTEL_B43_HB), 2566 ID(PCI_DEVICE_ID_INTEL_B43_HB),
2561 ID(PCI_DEVICE_ID_INTEL_IGDNG_D_HB), 2567 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
2562 ID(PCI_DEVICE_ID_INTEL_IGDNG_M_HB), 2568 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
2563 ID(PCI_DEVICE_ID_INTEL_IGDNG_MA_HB), 2569 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
2570 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
2564 { } 2571 { }
2565}; 2572};
2566 2573
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 703959eba45a..d89da4ac061f 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -144,16 +144,13 @@ static int uninorth_configure(void)
144 return 0; 144 return 0;
145} 145}
146 146
147static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, 147static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
148 int type)
149{ 148{
150 int i, j, num_entries; 149 int i, num_entries;
151 void *temp; 150 void *temp;
151 u32 *gp;
152 int mask_type; 152 int mask_type;
153 153
154 temp = agp_bridge->current_size;
155 num_entries = A_SIZE_32(temp)->num_entries;
156
157 if (type != mem->type) 154 if (type != mem->type)
158 return -EINVAL; 155 return -EINVAL;
159 156
@@ -163,49 +160,12 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
163 return -EINVAL; 160 return -EINVAL;
164 } 161 }
165 162
166 if ((pg_start + mem->page_count) > num_entries) 163 if (mem->page_count == 0)
167 return -EINVAL; 164 return 0;
168
169 j = pg_start;
170
171 while (j < (pg_start + mem->page_count)) {
172 if (agp_bridge->gatt_table[j])
173 return -EBUSY;
174 j++;
175 }
176
177 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
178 agp_bridge->gatt_table[j] =
179 cpu_to_le32((page_to_phys(mem->pages[i]) & 0xFFFFF000UL) | 0x1UL);
180 flush_dcache_range((unsigned long)__va(page_to_phys(mem->pages[i])),
181 (unsigned long)__va(page_to_phys(mem->pages[i]))+0x1000);
182 }
183 (void)in_le32((volatile u32*)&agp_bridge->gatt_table[pg_start]);
184 mb();
185
186 uninorth_tlbflush(mem);
187 return 0;
188}
189
190static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
191{
192 int i, num_entries;
193 void *temp;
194 u32 *gp;
195 int mask_type;
196 165
197 temp = agp_bridge->current_size; 166 temp = agp_bridge->current_size;
198 num_entries = A_SIZE_32(temp)->num_entries; 167 num_entries = A_SIZE_32(temp)->num_entries;
199 168
200 if (type != mem->type)
201 return -EINVAL;
202
203 mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
204 if (mask_type != 0) {
205 /* We know nothing of memory types */
206 return -EINVAL;
207 }
208
209 if ((pg_start + mem->page_count) > num_entries) 169 if ((pg_start + mem->page_count) > num_entries)
210 return -EINVAL; 170 return -EINVAL;
211 171
@@ -213,14 +173,18 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
213 for (i = 0; i < mem->page_count; ++i) { 173 for (i = 0; i < mem->page_count; ++i) {
214 if (gp[i]) { 174 if (gp[i]) {
215 dev_info(&agp_bridge->dev->dev, 175 dev_info(&agp_bridge->dev->dev,
216 "u3_insert_memory: entry 0x%x occupied (%x)\n", 176 "uninorth_insert_memory: entry 0x%x occupied (%x)\n",
217 i, gp[i]); 177 i, gp[i]);
218 return -EBUSY; 178 return -EBUSY;
219 } 179 }
220 } 180 }
221 181
222 for (i = 0; i < mem->page_count; i++) { 182 for (i = 0; i < mem->page_count; i++) {
223 gp[i] = (page_to_phys(mem->pages[i]) >> PAGE_SHIFT) | 0x80000000UL; 183 if (is_u3)
184 gp[i] = (page_to_phys(mem->pages[i]) >> PAGE_SHIFT) | 0x80000000UL;
185 else
186 gp[i] = cpu_to_le32((page_to_phys(mem->pages[i]) & 0xFFFFF000UL) |
187 0x1UL);
224 flush_dcache_range((unsigned long)__va(page_to_phys(mem->pages[i])), 188 flush_dcache_range((unsigned long)__va(page_to_phys(mem->pages[i])),
225 (unsigned long)__va(page_to_phys(mem->pages[i]))+0x1000); 189 (unsigned long)__va(page_to_phys(mem->pages[i]))+0x1000);
226 } 190 }
@@ -230,14 +194,23 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
230 return 0; 194 return 0;
231} 195}
232 196
233int u3_remove_memory(struct agp_memory *mem, off_t pg_start, int type) 197int uninorth_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
234{ 198{
235 size_t i; 199 size_t i;
236 u32 *gp; 200 u32 *gp;
201 int mask_type;
202
203 if (type != mem->type)
204 return -EINVAL;
237 205
238 if (type != 0 || mem->type != 0) 206 mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
207 if (mask_type != 0) {
239 /* We know nothing of memory types */ 208 /* We know nothing of memory types */
240 return -EINVAL; 209 return -EINVAL;
210 }
211
212 if (mem->page_count == 0)
213 return 0;
241 214
242 gp = (u32 *) &agp_bridge->gatt_table[pg_start]; 215 gp = (u32 *) &agp_bridge->gatt_table[pg_start];
243 for (i = 0; i < mem->page_count; ++i) 216 for (i = 0; i < mem->page_count; ++i)
@@ -536,7 +509,7 @@ const struct agp_bridge_driver uninorth_agp_driver = {
536 .create_gatt_table = uninorth_create_gatt_table, 509 .create_gatt_table = uninorth_create_gatt_table,
537 .free_gatt_table = uninorth_free_gatt_table, 510 .free_gatt_table = uninorth_free_gatt_table,
538 .insert_memory = uninorth_insert_memory, 511 .insert_memory = uninorth_insert_memory,
539 .remove_memory = agp_generic_remove_memory, 512 .remove_memory = uninorth_remove_memory,
540 .alloc_by_type = agp_generic_alloc_by_type, 513 .alloc_by_type = agp_generic_alloc_by_type,
541 .free_by_type = agp_generic_free_by_type, 514 .free_by_type = agp_generic_free_by_type,
542 .agp_alloc_page = agp_generic_alloc_page, 515 .agp_alloc_page = agp_generic_alloc_page,
@@ -562,8 +535,8 @@ const struct agp_bridge_driver u3_agp_driver = {
562 .agp_enable = uninorth_agp_enable, 535 .agp_enable = uninorth_agp_enable,
563 .create_gatt_table = uninorth_create_gatt_table, 536 .create_gatt_table = uninorth_create_gatt_table,
564 .free_gatt_table = uninorth_free_gatt_table, 537 .free_gatt_table = uninorth_free_gatt_table,
565 .insert_memory = u3_insert_memory, 538 .insert_memory = uninorth_insert_memory,
566 .remove_memory = u3_remove_memory, 539 .remove_memory = uninorth_remove_memory,
567 .alloc_by_type = agp_generic_alloc_by_type, 540 .alloc_by_type = agp_generic_alloc_by_type,
568 .free_by_type = agp_generic_free_by_type, 541 .free_by_type = agp_generic_free_by_type,
569 .agp_alloc_page = agp_generic_alloc_page, 542 .agp_alloc_page = agp_generic_alloc_page,