diff options
Diffstat (limited to 'drivers/char/agp/intel-agp.c')
-rw-r--r-- | drivers/char/agp/intel-agp.c | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index df702642ab8f..016fdf0623a4 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, | |||
1182 | static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) | 1190 | static 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 | ||
@@ -2117,8 +2125,8 @@ static const struct intel_driver_description { | |||
2117 | NULL, &intel_g33_driver }, | 2125 | NULL, &intel_g33_driver }, |
2118 | { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33", | 2126 | { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33", |
2119 | NULL, &intel_g33_driver }, | 2127 | NULL, &intel_g33_driver }, |
2120 | { PCI_DEVICE_ID_INTEL_IGD_HB, PCI_DEVICE_ID_INTEL_IGD_IG, 0, | 2128 | { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0, |
2121 | "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, | 2129 | "Mobile Intel? GM45 Express", NULL, &intel_i965_driver }, |
2122 | { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0, | 2130 | { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0, |
2123 | "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, | 2131 | "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, |
2124 | { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0, | 2132 | { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0, |
@@ -2163,8 +2171,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
2163 | 2171 | ||
2164 | if (intel_agp_chipsets[i].name == NULL) { | 2172 | if (intel_agp_chipsets[i].name == NULL) { |
2165 | if (cap_ptr) | 2173 | if (cap_ptr) |
2166 | printk(KERN_WARNING PFX "Unsupported Intel chipset" | 2174 | dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", |
2167 | "(device id: %04x)\n", pdev->device); | 2175 | pdev->vendor, pdev->device); |
2168 | agp_put_bridge(bridge); | 2176 | agp_put_bridge(bridge); |
2169 | return -ENODEV; | 2177 | return -ENODEV; |
2170 | } | 2178 | } |
@@ -2172,9 +2180,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
2172 | if (bridge->driver == NULL) { | 2180 | if (bridge->driver == NULL) { |
2173 | /* bridge has no AGP and no IGD detected */ | 2181 | /* bridge has no AGP and no IGD detected */ |
2174 | if (cap_ptr) | 2182 | if (cap_ptr) |
2175 | printk(KERN_WARNING PFX "Failed to find bridge device " | 2183 | dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n", |
2176 | "(chip_id: %04x)\n", | 2184 | intel_agp_chipsets[i].gmch_chip_id); |
2177 | intel_agp_chipsets[i].gmch_chip_id); | ||
2178 | agp_put_bridge(bridge); | 2185 | agp_put_bridge(bridge); |
2179 | return -ENODEV; | 2186 | return -ENODEV; |
2180 | } | 2187 | } |
@@ -2183,8 +2190,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
2183 | bridge->capndx = cap_ptr; | 2190 | bridge->capndx = cap_ptr; |
2184 | bridge->dev_private_data = &intel_private; | 2191 | bridge->dev_private_data = &intel_private; |
2185 | 2192 | ||
2186 | printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", | 2193 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
2187 | intel_agp_chipsets[i].name); | ||
2188 | 2194 | ||
2189 | /* | 2195 | /* |
2190 | * The following fixes the case where the BIOS has "forgotten" to | 2196 | * The following fixes the case where the BIOS has "forgotten" to |
@@ -2194,7 +2200,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
2194 | r = &pdev->resource[0]; | 2200 | r = &pdev->resource[0]; |
2195 | if (!r->start && r->end) { | 2201 | if (!r->start && r->end) { |
2196 | if (pci_assign_resource(pdev, 0)) { | 2202 | if (pci_assign_resource(pdev, 0)) { |
2197 | printk(KERN_ERR PFX "could not assign resource 0\n"); | 2203 | dev_err(&pdev->dev, "can't assign resource 0\n"); |
2198 | agp_put_bridge(bridge); | 2204 | agp_put_bridge(bridge); |
2199 | return -ENODEV; | 2205 | return -ENODEV; |
2200 | } | 2206 | } |
@@ -2206,7 +2212,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
2206 | * 20030610 - hamish@zot.org | 2212 | * 20030610 - hamish@zot.org |
2207 | */ | 2213 | */ |
2208 | if (pci_enable_device(pdev)) { | 2214 | if (pci_enable_device(pdev)) { |
2209 | printk(KERN_ERR PFX "Unable to Enable PCI device\n"); | 2215 | dev_err(&pdev->dev, "can't enable PCI device\n"); |
2210 | agp_put_bridge(bridge); | 2216 | agp_put_bridge(bridge); |
2211 | return -ENODEV; | 2217 | return -ENODEV; |
2212 | } | 2218 | } |
@@ -2238,6 +2244,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) | |||
2238 | static int agp_intel_resume(struct pci_dev *pdev) | 2244 | static int agp_intel_resume(struct pci_dev *pdev) |
2239 | { | 2245 | { |
2240 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); | 2246 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); |
2247 | int ret_val; | ||
2241 | 2248 | ||
2242 | pci_restore_state(pdev); | 2249 | pci_restore_state(pdev); |
2243 | 2250 | ||
@@ -2265,6 +2272,10 @@ static int agp_intel_resume(struct pci_dev *pdev) | |||
2265 | else if (bridge->driver == &intel_i965_driver) | 2272 | else if (bridge->driver == &intel_i965_driver) |
2266 | intel_i915_configure(); | 2273 | intel_i915_configure(); |
2267 | 2274 | ||
2275 | ret_val = agp_rebind_memory(); | ||
2276 | if (ret_val != 0) | ||
2277 | return ret_val; | ||
2278 | |||
2268 | return 0; | 2279 | return 0; |
2269 | } | 2280 | } |
2270 | #endif | 2281 | #endif |
@@ -2315,7 +2326,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
2315 | ID(PCI_DEVICE_ID_INTEL_G33_HB), | 2326 | ID(PCI_DEVICE_ID_INTEL_G33_HB), |
2316 | ID(PCI_DEVICE_ID_INTEL_Q35_HB), | 2327 | ID(PCI_DEVICE_ID_INTEL_Q35_HB), |
2317 | ID(PCI_DEVICE_ID_INTEL_Q33_HB), | 2328 | ID(PCI_DEVICE_ID_INTEL_Q33_HB), |
2318 | ID(PCI_DEVICE_ID_INTEL_IGD_HB), | 2329 | ID(PCI_DEVICE_ID_INTEL_GM45_HB), |
2319 | ID(PCI_DEVICE_ID_INTEL_IGD_E_HB), | 2330 | ID(PCI_DEVICE_ID_INTEL_IGD_E_HB), |
2320 | ID(PCI_DEVICE_ID_INTEL_Q45_HB), | 2331 | ID(PCI_DEVICE_ID_INTEL_Q45_HB), |
2321 | ID(PCI_DEVICE_ID_INTEL_G45_HB), | 2332 | ID(PCI_DEVICE_ID_INTEL_G45_HB), |