aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/intel-agp.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-08-22 00:06:51 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-22 00:06:51 -0400
commit8b53b57576292b92b27769f9e213df19b6e57786 (patch)
treecd851ce4fa71b2653f120d7f11a9c6cbcf311b19 /drivers/char/agp/intel-agp.c
parentab7e79243746e2a9c5f00243e60108189c44c9eb (diff)
parent38cc1c3df77c1bb739a4766788eb9fa49f16ffdf (diff)
Merge branch 'x86/urgent' into x86/pat
Conflicts: arch/x86/mm/pageattr.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/char/agp/intel-agp.c')
-rw-r--r--drivers/char/agp/intel-agp.c83
1 files changed, 47 insertions, 36 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 290a1cf63925..043e36628d6d 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -32,8 +32,8 @@
32#define PCI_DEVICE_ID_INTEL_Q35_IG 0x29B2 32#define PCI_DEVICE_ID_INTEL_Q35_IG 0x29B2
33#define PCI_DEVICE_ID_INTEL_Q33_HB 0x29D0 33#define PCI_DEVICE_ID_INTEL_Q33_HB 0x29D0
34#define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2 34#define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2
35#define PCI_DEVICE_ID_INTEL_IGD_HB 0x2A40 35#define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40
36#define PCI_DEVICE_ID_INTEL_IGD_IG 0x2A42 36#define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42
37#define PCI_DEVICE_ID_INTEL_IGD_E_HB 0x2E00 37#define PCI_DEVICE_ID_INTEL_IGD_E_HB 0x2E00
38#define PCI_DEVICE_ID_INTEL_IGD_E_IG 0x2E02 38#define PCI_DEVICE_ID_INTEL_IGD_E_IG 0x2E02
39#define PCI_DEVICE_ID_INTEL_Q45_HB 0x2E10 39#define PCI_DEVICE_ID_INTEL_Q45_HB 0x2E10
@@ -55,7 +55,7 @@
55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \
57 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \ 57 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \
58 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_HB) 58 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
59 59
60#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ 60#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
61 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ 61 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
@@ -161,7 +161,7 @@ static int intel_i810_fetch_size(void)
161 values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes); 161 values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes);
162 162
163 if ((smram_miscc & I810_GMS) == I810_GMS_DISABLE) { 163 if ((smram_miscc & I810_GMS) == I810_GMS_DISABLE) {
164 printk(KERN_WARNING PFX "i810 is disabled\n"); 164 dev_warn(&agp_bridge->dev->dev, "i810 is disabled\n");
165 return 0; 165 return 0;
166 } 166 }
167 if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) { 167 if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) {
@@ -193,7 +193,8 @@ static int intel_i810_configure(void)
193 193
194 intel_private.registers = ioremap(temp, 128 * 4096); 194 intel_private.registers = ioremap(temp, 128 * 4096);
195 if (!intel_private.registers) { 195 if (!intel_private.registers) {
196 printk(KERN_ERR PFX "Unable to remap memory.\n"); 196 dev_err(&intel_private.pcidev->dev,
197 "can't remap memory\n");
197 return -ENOMEM; 198 return -ENOMEM;
198 } 199 }
199 } 200 }
@@ -201,7 +202,8 @@ static int intel_i810_configure(void)
201 if ((readl(intel_private.registers+I810_DRAM_CTL) 202 if ((readl(intel_private.registers+I810_DRAM_CTL)
202 & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) { 203 & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) {
203 /* This will need to be dynamically assigned */ 204 /* This will need to be dynamically assigned */
204 printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n"); 205 dev_info(&intel_private.pcidev->dev,
206 "detected 4MB dedicated video ram\n");
205 intel_private.num_dcache_entries = 1024; 207 intel_private.num_dcache_entries = 1024;
206 } 208 }
207 pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp); 209 pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp);
@@ -500,8 +502,8 @@ static void intel_i830_init_gtt_entries(void)
500 size = 1024 + 512; 502 size = 1024 + 512;
501 break; 503 break;
502 default: 504 default:
503 printk(KERN_INFO PFX "Unknown page table size, " 505 dev_info(&intel_private.pcidev->dev,
504 "assuming 512KB\n"); 506 "unknown page table size, assuming 512KB\n");
505 size = 512; 507 size = 512;
506 } 508 }
507 size += 4; /* add in BIOS popup space */ 509 size += 4; /* add in BIOS popup space */
@@ -515,8 +517,8 @@ static void intel_i830_init_gtt_entries(void)
515 size = 2048; 517 size = 2048;
516 break; 518 break;
517 default: 519 default:
518 printk(KERN_INFO PFX "Unknown page table size 0x%x, " 520 dev_info(&agp_bridge->dev->dev,
519 "assuming 512KB\n", 521 "unknown page table size 0x%x, assuming 512KB\n",
520 (gmch_ctrl & G33_PGETBL_SIZE_MASK)); 522 (gmch_ctrl & G33_PGETBL_SIZE_MASK));
521 size = 512; 523 size = 512;
522 } 524 }
@@ -627,11 +629,11 @@ static void intel_i830_init_gtt_entries(void)
627 } 629 }
628 } 630 }
629 if (gtt_entries > 0) 631 if (gtt_entries > 0)
630 printk(KERN_INFO PFX "Detected %dK %s memory.\n", 632 dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
631 gtt_entries / KB(1), local ? "local" : "stolen"); 633 gtt_entries / KB(1), local ? "local" : "stolen");
632 else 634 else
633 printk(KERN_INFO PFX 635 dev_info(&agp_bridge->dev->dev,
634 "No pre-allocated video memory detected.\n"); 636 "no pre-allocated video memory detected\n");
635 gtt_entries /= KB(4); 637 gtt_entries /= KB(4);
636 638
637 intel_private.gtt_entries = gtt_entries; 639 intel_private.gtt_entries = gtt_entries;
@@ -801,10 +803,12 @@ static int intel_i830_insert_entries(struct agp_memory *mem, off_t pg_start,
801 num_entries = A_SIZE_FIX(temp)->num_entries; 803 num_entries = A_SIZE_FIX(temp)->num_entries;
802 804
803 if (pg_start < intel_private.gtt_entries) { 805 if (pg_start < intel_private.gtt_entries) {
804 printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 806 dev_printk(KERN_DEBUG, &intel_private.pcidev->dev,
805 pg_start, intel_private.gtt_entries); 807 "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n",
808 pg_start, intel_private.gtt_entries);
806 809
807 printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 810 dev_info(&intel_private.pcidev->dev,
811 "trying to insert into local/stolen memory\n");
808 goto out_err; 812 goto out_err;
809 } 813 }
810 814
@@ -851,7 +855,8 @@ static int intel_i830_remove_entries(struct agp_memory *mem, off_t pg_start,
851 return 0; 855 return 0;
852 856
853 if (pg_start < intel_private.gtt_entries) { 857 if (pg_start < intel_private.gtt_entries) {
854 printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 858 dev_info(&intel_private.pcidev->dev,
859 "trying to disable local/stolen memory\n");
855 return -EINVAL; 860 return -EINVAL;
856 } 861 }
857 862
@@ -957,7 +962,7 @@ static void intel_i9xx_setup_flush(void)
957 if (intel_private.ifp_resource.start) { 962 if (intel_private.ifp_resource.start) {
958 intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE); 963 intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE);
959 if (!intel_private.i9xx_flush_page) 964 if (!intel_private.i9xx_flush_page)
960 printk(KERN_INFO "unable to ioremap flush page - no chipset flushing"); 965 dev_info(&intel_private.pcidev->dev, "can't ioremap flush page - no chipset flushing");
961 } 966 }
962} 967}
963 968
@@ -1028,10 +1033,12 @@ static int intel_i915_insert_entries(struct agp_memory *mem, off_t pg_start,
1028 num_entries = A_SIZE_FIX(temp)->num_entries; 1033 num_entries = A_SIZE_FIX(temp)->num_entries;
1029 1034
1030 if (pg_start < intel_private.gtt_entries) { 1035 if (pg_start < intel_private.gtt_entries) {
1031 printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 1036 dev_printk(KERN_DEBUG, &intel_private.pcidev->dev,
1032 pg_start, intel_private.gtt_entries); 1037 "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n",
1038 pg_start, intel_private.gtt_entries);
1033 1039
1034 printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 1040 dev_info(&intel_private.pcidev->dev,
1041 "trying to insert into local/stolen memory\n");
1035 goto out_err; 1042 goto out_err;
1036 } 1043 }
1037 1044
@@ -1078,7 +1085,8 @@ static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start,
1078 return 0; 1085 return 0;
1079 1086
1080 if (pg_start < intel_private.gtt_entries) { 1087 if (pg_start < intel_private.gtt_entries) {
1081 printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 1088 dev_info(&intel_private.pcidev->dev,
1089 "trying to disable local/stolen memory\n");
1082 return -EINVAL; 1090 return -EINVAL;
1083 } 1091 }
1084 1092
@@ -1182,7 +1190,7 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge,
1182static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) 1190static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
1183{ 1191{
1184 switch (agp_bridge->dev->device) { 1192 switch (agp_bridge->dev->device) {
1185 case PCI_DEVICE_ID_INTEL_IGD_HB: 1193 case PCI_DEVICE_ID_INTEL_GM45_HB:
1186 case PCI_DEVICE_ID_INTEL_IGD_E_HB: 1194 case PCI_DEVICE_ID_INTEL_IGD_E_HB:
1187 case PCI_DEVICE_ID_INTEL_Q45_HB: 1195 case PCI_DEVICE_ID_INTEL_Q45_HB:
1188 case PCI_DEVICE_ID_INTEL_G45_HB: 1196 case PCI_DEVICE_ID_INTEL_G45_HB:
@@ -1379,7 +1387,7 @@ static int intel_815_configure(void)
1379 /* the Intel 815 chipset spec. says that bits 29-31 in the 1387 /* the Intel 815 chipset spec. says that bits 29-31 in the
1380 * ATTBASE register are reserved -> try not to write them */ 1388 * ATTBASE register are reserved -> try not to write them */
1381 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) { 1389 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
1382 printk(KERN_EMERG PFX "gatt bus addr too high"); 1390 dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high");
1383 return -EINVAL; 1391 return -EINVAL;
1384 } 1392 }
1385 1393
@@ -2145,8 +2153,8 @@ static const struct intel_driver_description {
2145 NULL, &intel_g33_driver }, 2153 NULL, &intel_g33_driver },
2146 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33", 2154 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33",
2147 NULL, &intel_g33_driver }, 2155 NULL, &intel_g33_driver },
2148 { PCI_DEVICE_ID_INTEL_IGD_HB, PCI_DEVICE_ID_INTEL_IGD_IG, 0, 2156 { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0,
2149 "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, 2157 "Mobile Intel? GM45 Express", NULL, &intel_i965_driver },
2150 { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0, 2158 { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0,
2151 "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, 2159 "Intel Integrated Graphics Device", NULL, &intel_i965_driver },
2152 { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0, 2160 { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0,
@@ -2191,8 +2199,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2191 2199
2192 if (intel_agp_chipsets[i].name == NULL) { 2200 if (intel_agp_chipsets[i].name == NULL) {
2193 if (cap_ptr) 2201 if (cap_ptr)
2194 printk(KERN_WARNING PFX "Unsupported Intel chipset" 2202 dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n",
2195 "(device id: %04x)\n", pdev->device); 2203 pdev->vendor, pdev->device);
2196 agp_put_bridge(bridge); 2204 agp_put_bridge(bridge);
2197 return -ENODEV; 2205 return -ENODEV;
2198 } 2206 }
@@ -2200,9 +2208,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2200 if (bridge->driver == NULL) { 2208 if (bridge->driver == NULL) {
2201 /* bridge has no AGP and no IGD detected */ 2209 /* bridge has no AGP and no IGD detected */
2202 if (cap_ptr) 2210 if (cap_ptr)
2203 printk(KERN_WARNING PFX "Failed to find bridge device " 2211 dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n",
2204 "(chip_id: %04x)\n", 2212 intel_agp_chipsets[i].gmch_chip_id);
2205 intel_agp_chipsets[i].gmch_chip_id);
2206 agp_put_bridge(bridge); 2213 agp_put_bridge(bridge);
2207 return -ENODEV; 2214 return -ENODEV;
2208 } 2215 }
@@ -2211,8 +2218,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2211 bridge->capndx = cap_ptr; 2218 bridge->capndx = cap_ptr;
2212 bridge->dev_private_data = &intel_private; 2219 bridge->dev_private_data = &intel_private;
2213 2220
2214 printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", 2221 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
2215 intel_agp_chipsets[i].name);
2216 2222
2217 /* 2223 /*
2218 * The following fixes the case where the BIOS has "forgotten" to 2224 * The following fixes the case where the BIOS has "forgotten" to
@@ -2222,7 +2228,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2222 r = &pdev->resource[0]; 2228 r = &pdev->resource[0];
2223 if (!r->start && r->end) { 2229 if (!r->start && r->end) {
2224 if (pci_assign_resource(pdev, 0)) { 2230 if (pci_assign_resource(pdev, 0)) {
2225 printk(KERN_ERR PFX "could not assign resource 0\n"); 2231 dev_err(&pdev->dev, "can't assign resource 0\n");
2226 agp_put_bridge(bridge); 2232 agp_put_bridge(bridge);
2227 return -ENODEV; 2233 return -ENODEV;
2228 } 2234 }
@@ -2234,7 +2240,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2234 * 20030610 - hamish@zot.org 2240 * 20030610 - hamish@zot.org
2235 */ 2241 */
2236 if (pci_enable_device(pdev)) { 2242 if (pci_enable_device(pdev)) {
2237 printk(KERN_ERR PFX "Unable to Enable PCI device\n"); 2243 dev_err(&pdev->dev, "can't enable PCI device\n");
2238 agp_put_bridge(bridge); 2244 agp_put_bridge(bridge);
2239 return -ENODEV; 2245 return -ENODEV;
2240 } 2246 }
@@ -2266,6 +2272,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
2266static int agp_intel_resume(struct pci_dev *pdev) 2272static int agp_intel_resume(struct pci_dev *pdev)
2267{ 2273{
2268 struct agp_bridge_data *bridge = pci_get_drvdata(pdev); 2274 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
2275 int ret_val;
2269 2276
2270 pci_restore_state(pdev); 2277 pci_restore_state(pdev);
2271 2278
@@ -2293,6 +2300,10 @@ static int agp_intel_resume(struct pci_dev *pdev)
2293 else if (bridge->driver == &intel_i965_driver) 2300 else if (bridge->driver == &intel_i965_driver)
2294 intel_i915_configure(); 2301 intel_i915_configure();
2295 2302
2303 ret_val = agp_rebind_memory();
2304 if (ret_val != 0)
2305 return ret_val;
2306
2296 return 0; 2307 return 0;
2297} 2308}
2298#endif 2309#endif
@@ -2343,7 +2354,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
2343 ID(PCI_DEVICE_ID_INTEL_G33_HB), 2354 ID(PCI_DEVICE_ID_INTEL_G33_HB),
2344 ID(PCI_DEVICE_ID_INTEL_Q35_HB), 2355 ID(PCI_DEVICE_ID_INTEL_Q35_HB),
2345 ID(PCI_DEVICE_ID_INTEL_Q33_HB), 2356 ID(PCI_DEVICE_ID_INTEL_Q33_HB),
2346 ID(PCI_DEVICE_ID_INTEL_IGD_HB), 2357 ID(PCI_DEVICE_ID_INTEL_GM45_HB),
2347 ID(PCI_DEVICE_ID_INTEL_IGD_E_HB), 2358 ID(PCI_DEVICE_ID_INTEL_IGD_E_HB),
2348 ID(PCI_DEVICE_ID_INTEL_Q45_HB), 2359 ID(PCI_DEVICE_ID_INTEL_Q45_HB),
2349 ID(PCI_DEVICE_ID_INTEL_G45_HB), 2360 ID(PCI_DEVICE_ID_INTEL_G45_HB),