Merge branch 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6

* 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
agp: fix SIS 5591/5592 wrong PCI id
intel/agp: rewrite GTT on resume
agp: use dev_printk when possible
amd64-agp: run fallback when no bridges found, not when driver registration fails
intel_agp: official name for GM45 chipset

+205 -144
+3
drivers/char/agp/agp.h
··· 148 148 char minor_version; 149 149 struct list_head list; 150 150 u32 apbase_config; 151 + /* list of agp_memory mapped to the aperture */ 152 + struct list_head mapped_list; 153 + spinlock_t mapped_lock; 151 154 }; 152 155 153 156 #define KB(x) ((x) * 1024)
+5 -5
drivers/char/agp/ali-agp.c
··· 110 110 111 111 nlvm_addr+= agp_bridge->gart_bus_addr; 112 112 nlvm_addr|=(agp_bridge->gart_bus_addr>>12); 113 - printk(KERN_INFO PFX "nlvm top &base = %8x\n",nlvm_addr); 113 + dev_info(&agp_bridge->dev->dev, "nlvm top &base = %8x\n", 114 + nlvm_addr); 114 115 } 115 116 #endif 116 117 ··· 316 315 goto found; 317 316 } 318 317 319 - printk(KERN_ERR PFX "Unsupported ALi chipset (device id: %04x)\n", 320 - pdev->device); 318 + dev_err(&pdev->dev, "unsupported ALi chipset [%04x/%04x])\n", 319 + pdev->vendor, pdev->device); 321 320 return -ENODEV; 322 321 323 322 ··· 362 361 bridge->driver = &ali_generic_bridge; 363 362 } 364 363 365 - printk(KERN_INFO PFX "Detected ALi %s chipset\n", 366 - devs[j].chipset_name); 364 + dev_info(&pdev->dev, "ALi %s chipset\n", devs[j].chipset_name); 367 365 368 366 /* Fill in the mode register */ 369 367 pci_read_config_dword(pdev,
+5 -5
drivers/char/agp/amd-k7-agp.c
··· 419 419 return -ENODEV; 420 420 421 421 j = ent - agp_amdk7_pci_table; 422 - printk(KERN_INFO PFX "Detected AMD %s chipset\n", 423 - amd_agp_device_ids[j].chipset_name); 422 + dev_info(&pdev->dev, "AMD %s chipset\n", 423 + amd_agp_device_ids[j].chipset_name); 424 424 425 425 bridge = agp_alloc_bridge(); 426 426 if (!bridge) ··· 442 442 while (!cap_ptr) { 443 443 gfxcard = pci_get_class(PCI_CLASS_DISPLAY_VGA<<8, gfxcard); 444 444 if (!gfxcard) { 445 - printk (KERN_INFO PFX "Couldn't find an AGP VGA controller.\n"); 445 + dev_info(&pdev->dev, "no AGP VGA controller\n"); 446 446 return -ENODEV; 447 447 } 448 448 cap_ptr = pci_find_capability(gfxcard, PCI_CAP_ID_AGP); ··· 453 453 (if necessary at all). */ 454 454 if (gfxcard->vendor == PCI_VENDOR_ID_NVIDIA) { 455 455 agp_bridge->flags |= AGP_ERRATA_1X; 456 - printk (KERN_INFO PFX "AMD 751 chipset with NVidia GeForce detected. Forcing to 1X due to errata.\n"); 456 + dev_info(&pdev->dev, "AMD 751 chipset with NVidia GeForce; forcing 1X due to errata\n"); 457 457 } 458 458 pci_dev_put(gfxcard); 459 459 } ··· 469 469 agp_bridge->flags = AGP_ERRATA_FASTWRITES; 470 470 agp_bridge->flags |= AGP_ERRATA_SBA; 471 471 agp_bridge->flags |= AGP_ERRATA_1X; 472 - printk (KERN_INFO PFX "AMD 761 chipset with errata detected - disabling AGP fast writes & SBA and forcing to 1X.\n"); 472 + dev_info(&pdev->dev, "AMD 761 chipset with errata; disabling AGP fast writes & SBA and forcing to 1X\n"); 473 473 } 474 474 } 475 475
+31 -20
drivers/char/agp/amd64-agp.c
··· 34 34 35 35 static struct resource *aperture_resource; 36 36 static int __initdata agp_try_unsupported = 1; 37 + static int agp_bridges_found; 37 38 38 39 static void amd64_tlbflush(struct agp_memory *temp) 39 40 { ··· 294 293 * so let double check that order, and lets trust the AMD NB settings 295 294 */ 296 295 if (order >=0 && aper + (32ULL<<(20 + order)) > 0x100000000ULL) { 297 - printk(KERN_INFO "Aperture size %u MB is not right, using settings from NB\n", 298 - 32 << order); 296 + dev_info(&agp->dev, "aperture size %u MB is not right, using settings from NB\n", 297 + 32 << order); 299 298 order = nb_order; 300 299 } 301 300 302 - printk(KERN_INFO PFX "Aperture from AGP @ %Lx size %u MB\n", aper, 32 << order); 301 + dev_info(&agp->dev, "aperture from AGP @ %Lx size %u MB\n", 302 + aper, 32 << order); 303 303 if (order < 0 || !agp_aperture_valid(aper, (32*1024*1024)<<order)) 304 304 return -1; 305 305 ··· 321 319 for (i = 0; i < num_k8_northbridges; i++) { 322 320 struct pci_dev *dev = k8_northbridges[i]; 323 321 if (fix_northbridge(dev, pdev, cap_ptr) < 0) { 324 - printk(KERN_ERR PFX "No usable aperture found.\n"); 322 + dev_err(&dev->dev, "no usable aperture found\n"); 325 323 #ifdef __x86_64__ 326 324 /* should port this to i386 */ 327 - printk(KERN_ERR PFX "Consider rebooting with iommu=memaper=2 to get a good aperture.\n"); 325 + dev_err(&dev->dev, "consider rebooting with iommu=memaper=2 to get a good aperture\n"); 328 326 #endif 329 327 return -1; 330 328 } ··· 347 345 default: revstring="??"; break; 348 346 } 349 347 350 - printk (KERN_INFO PFX "Detected AMD 8151 AGP Bridge rev %s\n", revstring); 348 + dev_info(&pdev->dev, "AMD 8151 AGP Bridge rev %s\n", revstring); 351 349 352 350 /* 353 351 * Work around errata. 354 352 * Chips before B2 stepping incorrectly reporting v3.5 355 353 */ 356 354 if (pdev->revision < 0x13) { 357 - printk (KERN_INFO PFX "Correcting AGP revision (reports 3.5, is really 3.0)\n"); 355 + dev_info(&pdev->dev, "correcting AGP revision (reports 3.5, is really 3.0)\n"); 358 356 bridge->major_version = 3; 359 357 bridge->minor_version = 0; 360 358 } ··· 377 375 struct pci_dev *dev1; 378 376 int i; 379 377 unsigned size = amd64_fetch_size(); 380 - printk(KERN_INFO "Setting up ULi AGP.\n"); 378 + 379 + dev_info(&pdev->dev, "setting up ULi AGP\n"); 381 380 dev1 = pci_get_slot (pdev->bus,PCI_DEVFN(0,0)); 382 381 if (dev1 == NULL) { 383 - printk(KERN_INFO PFX "Detected a ULi chipset, " 384 - "but could not fine the secondary device.\n"); 382 + dev_info(&pdev->dev, "can't find ULi secondary device\n"); 385 383 return -ENODEV; 386 384 } 387 385 ··· 390 388 break; 391 389 392 390 if (i == ARRAY_SIZE(uli_sizes)) { 393 - printk(KERN_INFO PFX "No ULi size found for %d\n", size); 391 + dev_info(&pdev->dev, "no ULi size found for %d\n", size); 394 392 return -ENODEV; 395 393 } 396 394 ··· 435 433 int i; 436 434 unsigned size = amd64_fetch_size(); 437 435 438 - printk(KERN_INFO PFX "Setting up Nforce3 AGP.\n"); 436 + dev_info(&pdev->dev, "setting up Nforce3 AGP\n"); 439 437 440 438 dev1 = pci_get_slot(pdev->bus, PCI_DEVFN(11, 0)); 441 439 if (dev1 == NULL) { 442 - printk(KERN_INFO PFX "agpgart: Detected an NVIDIA " 443 - "nForce3 chipset, but could not find " 444 - "the secondary device.\n"); 440 + dev_info(&pdev->dev, "can't find Nforce3 secondary device\n"); 445 441 return -ENODEV; 446 442 } 447 443 ··· 448 448 break; 449 449 450 450 if (i == ARRAY_SIZE(nforce3_sizes)) { 451 - printk(KERN_INFO PFX "No NForce3 size found for %d\n", size); 451 + dev_info(&pdev->dev, "no NForce3 size found for %d\n", size); 452 452 return -ENODEV; 453 453 } 454 454 ··· 462 462 463 463 /* if x86-64 aperture base is beyond 4G, exit here */ 464 464 if ( (apbase & 0x7fff) >> (32 - 25) ) { 465 - printk(KERN_INFO PFX "aperture base > 4G\n"); 465 + dev_info(&pdev->dev, "aperture base > 4G\n"); 466 466 return -ENODEV; 467 467 } 468 468 ··· 489 489 { 490 490 struct agp_bridge_data *bridge; 491 491 u8 cap_ptr; 492 + int err; 492 493 493 494 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); 494 495 if (!cap_ptr) ··· 505 504 pdev->device == PCI_DEVICE_ID_AMD_8151_0) { 506 505 amd8151_init(pdev, bridge); 507 506 } else { 508 - printk(KERN_INFO PFX "Detected AGP bridge %x\n", pdev->devfn); 507 + dev_info(&pdev->dev, "AGP bridge [%04x/%04x]\n", 508 + pdev->vendor, pdev->device); 509 509 } 510 510 511 511 bridge->driver = &amd_8151_driver; ··· 538 536 } 539 537 540 538 pci_set_drvdata(pdev, bridge); 541 - return agp_add_bridge(bridge); 539 + err = agp_add_bridge(bridge); 540 + if (err < 0) 541 + return err; 542 + 543 + agp_bridges_found++; 544 + return 0; 542 545 } 543 546 544 547 static void __devexit agp_amd64_remove(struct pci_dev *pdev) ··· 720 713 721 714 if (agp_off) 722 715 return -EINVAL; 723 - if (pci_register_driver(&agp_amd64_pci_driver) < 0) { 716 + err = pci_register_driver(&agp_amd64_pci_driver); 717 + if (err < 0) 718 + return err; 719 + 720 + if (agp_bridges_found == 0) { 724 721 struct pci_dev *dev; 725 722 if (!agp_try_unsupported && !agp_try_unsupported_boot) { 726 723 printk(KERN_INFO PFX "No supported AGP bridge found.\n");
+3 -4
drivers/char/agp/ati-agp.c
··· 486 486 goto found; 487 487 } 488 488 489 - printk(KERN_ERR PFX 490 - "Unsupported Ati chipset (device id: %04x)\n", pdev->device); 489 + dev_err(&pdev->dev, "unsupported Ati chipset [%04x/%04x])\n", 490 + pdev->vendor, pdev->device); 491 491 return -ENODEV; 492 492 493 493 found: ··· 500 500 501 501 bridge->driver = &ati_generic_bridge; 502 502 503 - printk(KERN_INFO PFX "Detected Ati %s chipset\n", 504 - devs[j].chipset_name); 503 + dev_info(&pdev->dev, "Ati %s chipset\n", devs[j].chipset_name); 505 504 506 505 /* Fill in the mode register */ 507 506 pci_read_config_dword(pdev,
+17 -11
drivers/char/agp/backend.c
··· 144 144 void *addr = bridge->driver->agp_alloc_page(bridge); 145 145 146 146 if (!addr) { 147 - printk(KERN_ERR PFX "unable to get memory for scratch page.\n"); 147 + dev_err(&bridge->dev->dev, 148 + "can't get memory for scratch page\n"); 148 149 return -ENOMEM; 149 150 } 150 151 ··· 156 155 157 156 size_value = bridge->driver->fetch_size(); 158 157 if (size_value == 0) { 159 - printk(KERN_ERR PFX "unable to determine aperture size.\n"); 158 + dev_err(&bridge->dev->dev, "can't determine aperture size\n"); 160 159 rc = -EINVAL; 161 160 goto err_out; 162 161 } 163 162 if (bridge->driver->create_gatt_table(bridge)) { 164 - printk(KERN_ERR PFX 165 - "unable to get memory for graphics translation table.\n"); 163 + dev_err(&bridge->dev->dev, 164 + "can't get memory for graphics translation table\n"); 166 165 rc = -ENOMEM; 167 166 goto err_out; 168 167 } ··· 170 169 171 170 bridge->key_list = vmalloc(PAGE_SIZE * 4); 172 171 if (bridge->key_list == NULL) { 173 - printk(KERN_ERR PFX "error allocating memory for key lists.\n"); 172 + dev_err(&bridge->dev->dev, 173 + "can't allocate memory for key lists\n"); 174 174 rc = -ENOMEM; 175 175 goto err_out; 176 176 } ··· 181 179 memset(bridge->key_list, 0, PAGE_SIZE * 4); 182 180 183 181 if (bridge->driver->configure()) { 184 - printk(KERN_ERR PFX "error configuring host chipset.\n"); 182 + dev_err(&bridge->dev->dev, "error configuring host chipset\n"); 185 183 rc = -EINVAL; 186 184 goto err_out; 187 185 } 186 + INIT_LIST_HEAD(&bridge->mapped_list); 187 + spin_lock_init(&bridge->mapped_lock); 188 188 189 189 return 0; 190 190 ··· 273 269 274 270 /* Grab reference on the chipset driver. */ 275 271 if (!try_module_get(bridge->driver->owner)) { 276 - printk (KERN_INFO PFX "Couldn't lock chipset driver.\n"); 272 + dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); 277 273 return -EINVAL; 278 274 } 279 275 280 276 error = agp_backend_initialize(bridge); 281 277 if (error) { 282 - printk (KERN_INFO PFX "agp_backend_initialize() failed.\n"); 278 + dev_info(&bridge->dev->dev, 279 + "agp_backend_initialize() failed\n"); 283 280 goto err_out; 284 281 } 285 282 286 283 if (list_empty(&agp_bridges)) { 287 284 error = agp_frontend_initialize(); 288 285 if (error) { 289 - printk (KERN_INFO PFX "agp_frontend_initialize() failed.\n"); 286 + dev_info(&bridge->dev->dev, 287 + "agp_frontend_initialize() failed\n"); 290 288 goto frontend_err; 291 289 } 292 290 293 - printk(KERN_INFO PFX "AGP aperture is %dM @ 0x%lx\n", 294 - bridge->driver->fetch_size(), bridge->gart_bus_addr); 291 + dev_info(&bridge->dev->dev, "AGP aperture is %dM @ 0x%lx\n", 292 + bridge->driver->fetch_size(), bridge->gart_bus_addr); 295 293 296 294 } 297 295
+33 -8
drivers/char/agp/generic.c
··· 429 429 430 430 curr->is_bound = true; 431 431 curr->pg_start = pg_start; 432 + spin_lock(&agp_bridge->mapped_lock); 433 + list_add(&curr->mapped_list, &agp_bridge->mapped_list); 434 + spin_unlock(&agp_bridge->mapped_lock); 435 + 432 436 return 0; 433 437 } 434 438 EXPORT_SYMBOL(agp_bind_memory); ··· 465 461 466 462 curr->is_bound = false; 467 463 curr->pg_start = 0; 464 + spin_lock(&curr->bridge->mapped_lock); 465 + list_del(&curr->mapped_list); 466 + spin_unlock(&curr->bridge->mapped_lock); 468 467 return 0; 469 468 } 470 469 EXPORT_SYMBOL(agp_unbind_memory); 470 + 471 + /** 472 + * agp_rebind_emmory - Rewrite the entire GATT, useful on resume 473 + */ 474 + int agp_rebind_memory(void) 475 + { 476 + struct agp_memory *curr; 477 + int ret_val = 0; 478 + 479 + spin_lock(&agp_bridge->mapped_lock); 480 + list_for_each_entry(curr, &agp_bridge->mapped_list, mapped_list) { 481 + ret_val = curr->bridge->driver->insert_memory(curr, 482 + curr->pg_start, 483 + curr->type); 484 + if (ret_val != 0) 485 + break; 486 + } 487 + spin_unlock(&agp_bridge->mapped_lock); 488 + return ret_val; 489 + } 490 + EXPORT_SYMBOL(agp_rebind_memory); 471 491 472 492 /* End - Routines for handling swapping of agp_memory into the GATT */ 473 493 ··· 799 771 if (!agp) 800 772 continue; 801 773 802 - printk(KERN_INFO PFX "Putting AGP V%d device at %s into %dx mode\n", 803 - agp_v3 ? 3 : 2, pci_name(device), mode); 774 + dev_info(&device->dev, "putting AGP V%d device into %dx mode\n", 775 + agp_v3 ? 3 : 2, mode); 804 776 pci_write_config_dword(device, agp + PCI_AGP_COMMAND, bridge_agpstat); 805 777 } 806 778 } ··· 828 800 829 801 get_agp_version(agp_bridge); 830 802 831 - printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n", 832 - agp_bridge->major_version, 833 - agp_bridge->minor_version, 834 - pci_name(agp_bridge->dev)); 803 + dev_info(&agp_bridge->dev->dev, "AGP %d.%d bridge\n", 804 + agp_bridge->major_version, agp_bridge->minor_version); 835 805 836 806 pci_read_config_dword(agp_bridge->dev, 837 807 agp_bridge->capndx + PCI_AGP_STATUS, &bridge_agpstat); ··· 858 832 pci_write_config_dword(bridge->dev, 859 833 bridge->capndx+AGPCTRL, temp); 860 834 861 - printk(KERN_INFO PFX "Device is in legacy mode," 862 - " falling back to 2.x\n"); 835 + dev_info(&bridge->dev->dev, "bridge is in legacy mode, falling back to 2.x\n"); 863 836 } 864 837 } 865 838
+47 -36
drivers/char/agp/intel-agp.c
··· 32 32 #define PCI_DEVICE_ID_INTEL_Q35_IG 0x29B2 33 33 #define PCI_DEVICE_ID_INTEL_Q33_HB 0x29D0 34 34 #define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2 35 - #define PCI_DEVICE_ID_INTEL_IGD_HB 0x2A40 36 - #define PCI_DEVICE_ID_INTEL_IGD_IG 0x2A42 35 + #define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40 36 + #define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42 37 37 #define PCI_DEVICE_ID_INTEL_IGD_E_HB 0x2E00 38 38 #define PCI_DEVICE_ID_INTEL_IGD_E_IG 0x2E02 39 39 #define PCI_DEVICE_ID_INTEL_Q45_HB 0x2E10 ··· 55 55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 56 56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 57 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 60 #define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ 61 61 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ ··· 161 161 values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes); 162 162 163 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 165 return 0; 166 166 } 167 167 if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) { ··· 193 193 194 194 intel_private.registers = ioremap(temp, 128 * 4096); 195 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 198 return -ENOMEM; 198 199 } 199 200 } ··· 202 201 if ((readl(intel_private.registers+I810_DRAM_CTL) 203 202 & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) { 204 203 /* This will need to be dynamically assigned */ 205 - printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n"); 204 + dev_info(&intel_private.pcidev->dev, 205 + "detected 4MB dedicated video ram\n"); 206 206 intel_private.num_dcache_entries = 1024; 207 207 } 208 208 pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp); ··· 502 500 size = 1024 + 512; 503 501 break; 504 502 default: 505 - printk(KERN_INFO PFX "Unknown page table size, " 506 - "assuming 512KB\n"); 503 + dev_info(&intel_private.pcidev->dev, 504 + "unknown page table size, assuming 512KB\n"); 507 505 size = 512; 508 506 } 509 507 size += 4; /* add in BIOS popup space */ ··· 517 515 size = 2048; 518 516 break; 519 517 default: 520 - printk(KERN_INFO PFX "Unknown page table size 0x%x, " 521 - "assuming 512KB\n", 518 + dev_info(&agp_bridge->dev->dev, 519 + "unknown page table size 0x%x, assuming 512KB\n", 522 520 (gmch_ctrl & G33_PGETBL_SIZE_MASK)); 523 521 size = 512; 524 522 } ··· 629 627 } 630 628 } 631 629 if (gtt_entries > 0) 632 - printk(KERN_INFO PFX "Detected %dK %s memory.\n", 630 + dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", 633 631 gtt_entries / KB(1), local ? "local" : "stolen"); 634 632 else 635 - printk(KERN_INFO PFX 636 - "No pre-allocated video memory detected.\n"); 633 + dev_info(&agp_bridge->dev->dev, 634 + "no pre-allocated video memory detected\n"); 637 635 gtt_entries /= KB(4); 638 636 639 637 intel_private.gtt_entries = gtt_entries; ··· 803 801 num_entries = A_SIZE_FIX(temp)->num_entries; 804 802 805 803 if (pg_start < intel_private.gtt_entries) { 806 - printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 807 - pg_start, intel_private.gtt_entries); 804 + dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, 805 + "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n", 806 + pg_start, intel_private.gtt_entries); 808 807 809 - printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 808 + dev_info(&intel_private.pcidev->dev, 809 + "trying to insert into local/stolen memory\n"); 810 810 goto out_err; 811 811 } 812 812 ··· 855 851 return 0; 856 852 857 853 if (pg_start < intel_private.gtt_entries) { 858 - printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 854 + dev_info(&intel_private.pcidev->dev, 855 + "trying to disable local/stolen memory\n"); 859 856 return -EINVAL; 860 857 } 861 858 ··· 962 957 if (intel_private.ifp_resource.start) { 963 958 intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE); 964 959 if (!intel_private.i9xx_flush_page) 965 - printk(KERN_INFO "unable to ioremap flush page - no chipset flushing"); 960 + dev_info(&intel_private.pcidev->dev, "can't ioremap flush page - no chipset flushing"); 966 961 } 967 962 } 968 963 ··· 1033 1028 num_entries = A_SIZE_FIX(temp)->num_entries; 1034 1029 1035 1030 if (pg_start < intel_private.gtt_entries) { 1036 - printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 1037 - pg_start, intel_private.gtt_entries); 1031 + dev_printk(KERN_DEBUG, &intel_private.pcidev->dev, 1032 + "pg_start == 0x%.8lx, intel_private.gtt_entries == 0x%.8x\n", 1033 + pg_start, intel_private.gtt_entries); 1038 1034 1039 - printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 1035 + dev_info(&intel_private.pcidev->dev, 1036 + "trying to insert into local/stolen memory\n"); 1040 1037 goto out_err; 1041 1038 } 1042 1039 ··· 1085 1078 return 0; 1086 1079 1087 1080 if (pg_start < intel_private.gtt_entries) { 1088 - printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 1081 + dev_info(&intel_private.pcidev->dev, 1082 + "trying to disable local/stolen memory\n"); 1089 1083 return -EINVAL; 1090 1084 } 1091 1085 ··· 1190 1182 static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) 1191 1183 { 1192 1184 switch (agp_bridge->dev->device) { 1193 - case PCI_DEVICE_ID_INTEL_IGD_HB: 1185 + case PCI_DEVICE_ID_INTEL_GM45_HB: 1194 1186 case PCI_DEVICE_ID_INTEL_IGD_E_HB: 1195 1187 case PCI_DEVICE_ID_INTEL_Q45_HB: 1196 1188 case PCI_DEVICE_ID_INTEL_G45_HB: ··· 1387 1379 /* the Intel 815 chipset spec. says that bits 29-31 in the 1388 1380 * ATTBASE register are reserved -> try not to write them */ 1389 1381 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) { 1390 - printk(KERN_EMERG PFX "gatt bus addr too high"); 1382 + dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high"); 1391 1383 return -EINVAL; 1392 1384 } 1393 1385 ··· 2125 2117 NULL, &intel_g33_driver }, 2126 2118 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33", 2127 2119 NULL, &intel_g33_driver }, 2128 - { PCI_DEVICE_ID_INTEL_IGD_HB, PCI_DEVICE_ID_INTEL_IGD_IG, 0, 2129 - "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, 2120 + { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0, 2121 + "Mobile Intel? GM45 Express", NULL, &intel_i965_driver }, 2130 2122 { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0, 2131 2123 "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, 2132 2124 { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0, ··· 2171 2163 2172 2164 if (intel_agp_chipsets[i].name == NULL) { 2173 2165 if (cap_ptr) 2174 - printk(KERN_WARNING PFX "Unsupported Intel chipset" 2175 - "(device id: %04x)\n", pdev->device); 2166 + dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n", 2167 + pdev->vendor, pdev->device); 2176 2168 agp_put_bridge(bridge); 2177 2169 return -ENODEV; 2178 2170 } ··· 2180 2172 if (bridge->driver == NULL) { 2181 2173 /* bridge has no AGP and no IGD detected */ 2182 2174 if (cap_ptr) 2183 - printk(KERN_WARNING PFX "Failed to find bridge device " 2184 - "(chip_id: %04x)\n", 2185 - intel_agp_chipsets[i].gmch_chip_id); 2175 + dev_warn(&pdev->dev, "can't find bridge device (chip_id: %04x)\n", 2176 + intel_agp_chipsets[i].gmch_chip_id); 2186 2177 agp_put_bridge(bridge); 2187 2178 return -ENODEV; 2188 2179 } ··· 2190 2183 bridge->capndx = cap_ptr; 2191 2184 bridge->dev_private_data = &intel_private; 2192 2185 2193 - printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", 2194 - intel_agp_chipsets[i].name); 2186 + dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); 2195 2187 2196 2188 /* 2197 2189 * The following fixes the case where the BIOS has "forgotten" to ··· 2200 2194 r = &pdev->resource[0]; 2201 2195 if (!r->start && r->end) { 2202 2196 if (pci_assign_resource(pdev, 0)) { 2203 - printk(KERN_ERR PFX "could not assign resource 0\n"); 2197 + dev_err(&pdev->dev, "can't assign resource 0\n"); 2204 2198 agp_put_bridge(bridge); 2205 2199 return -ENODEV; 2206 2200 } ··· 2212 2206 * 20030610 - hamish@zot.org 2213 2207 */ 2214 2208 if (pci_enable_device(pdev)) { 2215 - printk(KERN_ERR PFX "Unable to Enable PCI device\n"); 2209 + dev_err(&pdev->dev, "can't enable PCI device\n"); 2216 2210 agp_put_bridge(bridge); 2217 2211 return -ENODEV; 2218 2212 } ··· 2244 2238 static int agp_intel_resume(struct pci_dev *pdev) 2245 2239 { 2246 2240 struct agp_bridge_data *bridge = pci_get_drvdata(pdev); 2241 + int ret_val; 2247 2242 2248 2243 pci_restore_state(pdev); 2249 2244 ··· 2271 2264 intel_i810_configure(); 2272 2265 else if (bridge->driver == &intel_i965_driver) 2273 2266 intel_i915_configure(); 2267 + 2268 + ret_val = agp_rebind_memory(); 2269 + if (ret_val != 0) 2270 + return ret_val; 2274 2271 2275 2272 return 0; 2276 2273 } ··· 2326 2315 ID(PCI_DEVICE_ID_INTEL_G33_HB), 2327 2316 ID(PCI_DEVICE_ID_INTEL_Q35_HB), 2328 2317 ID(PCI_DEVICE_ID_INTEL_Q33_HB), 2329 - ID(PCI_DEVICE_ID_INTEL_IGD_HB), 2318 + ID(PCI_DEVICE_ID_INTEL_GM45_HB), 2330 2319 ID(PCI_DEVICE_ID_INTEL_IGD_E_HB), 2331 2320 ID(PCI_DEVICE_ID_INTEL_Q45_HB), 2332 2321 ID(PCI_DEVICE_ID_INTEL_G45_HB),
+19 -18
drivers/char/agp/isoch.c
··· 153 153 154 154 /* Check if this configuration has any chance of working */ 155 155 if (tot_bw > target.maxbw) { 156 - printk(KERN_ERR PFX "isochronous bandwidth required " 156 + dev_err(&td->dev, "isochronous bandwidth required " 157 157 "by AGP 3.0 devices exceeds that which is supported by " 158 158 "the AGP 3.0 bridge!\n"); 159 159 ret = -ENODEV; ··· 188 188 /* Exit if the minimal ISOCH_N allocation among the masters is more 189 189 * than the target can handle. */ 190 190 if (tot_n > target.n) { 191 - printk(KERN_ERR PFX "number of isochronous " 191 + dev_err(&td->dev, "number of isochronous " 192 192 "transactions per period required by AGP 3.0 devices " 193 193 "exceeds that which is supported by the AGP 3.0 " 194 194 "bridge!\n"); ··· 229 229 /* Exit if the minimal RQ needs of the masters exceeds what the target 230 230 * can provide. */ 231 231 if (tot_rq > rq_isoch) { 232 - printk(KERN_ERR PFX "number of request queue slots " 232 + dev_err(&td->dev, "number of request queue slots " 233 233 "required by the isochronous bandwidth requested by " 234 234 "AGP 3.0 devices exceeds the number provided by the " 235 235 "AGP 3.0 bridge!\n"); ··· 359 359 case 0x0001: /* Unclassified device */ 360 360 /* Don't know what this is, but log it for investigation. */ 361 361 if (mcapndx != 0) { 362 - printk (KERN_INFO PFX "Wacky, found unclassified AGP device. %x:%x\n", 363 - dev->vendor, dev->device); 362 + dev_info(&td->dev, "wacky, found unclassified AGP device %s [%04x/%04x]\n", 363 + pci_name(dev), 364 + dev->vendor, dev->device); 364 365 } 365 366 continue; 366 367 ··· 408 407 } 409 408 410 409 if (mcapndx == 0) { 411 - printk(KERN_ERR PFX "woah! Non-AGP device " 412 - "found on the secondary bus of an AGP 3.5 bridge!\n"); 410 + dev_err(&td->dev, "woah! Non-AGP device %s on " 411 + "secondary bus of AGP 3.5 bridge!\n", 412 + pci_name(dev)); 413 413 ret = -ENODEV; 414 414 goto free_and_exit; 415 415 } 416 416 417 417 mmajor = (ncapid >> AGP_MAJOR_VERSION_SHIFT) & 0xf; 418 418 if (mmajor < 3) { 419 - printk(KERN_ERR PFX "woah! AGP 2.0 device " 420 - "found on the secondary bus of an AGP 3.5 " 421 - "bridge operating with AGP 3.0 electricals!\n"); 419 + dev_err(&td->dev, "woah! AGP 2.0 device %s on " 420 + "secondary bus of AGP 3.5 bridge operating " 421 + "with AGP 3.0 electricals!\n", pci_name(dev)); 422 422 ret = -ENODEV; 423 423 goto free_and_exit; 424 424 } ··· 429 427 pci_read_config_dword(dev, cur->capndx+AGPSTAT, &mstatus); 430 428 431 429 if (((mstatus >> 3) & 0x1) == 0) { 432 - printk(KERN_ERR PFX "woah! AGP 3.x device " 433 - "not operating in AGP 3.x mode found on the " 434 - "secondary bus of an AGP 3.5 bridge operating " 435 - "with AGP 3.0 electricals!\n"); 430 + dev_err(&td->dev, "woah! AGP 3.x device %s not " 431 + "operating in AGP 3.x mode on secondary bus " 432 + "of AGP 3.5 bridge operating with AGP 3.0 " 433 + "electricals!\n", pci_name(dev)); 436 434 ret = -ENODEV; 437 435 goto free_and_exit; 438 436 } ··· 446 444 if (isoch) { 447 445 ret = agp_3_5_isochronous_node_enable(bridge, dev_list, ndevs); 448 446 if (ret) { 449 - printk(KERN_INFO PFX "Something bad happened setting " 450 - "up isochronous xfers. Falling back to " 451 - "non-isochronous xfer mode.\n"); 447 + dev_info(&td->dev, "something bad happened setting " 448 + "up isochronous xfers; falling back to " 449 + "non-isochronous xfer mode\n"); 452 450 } else { 453 451 goto free_and_exit; 454 452 } ··· 468 466 get_out: 469 467 return ret; 470 468 } 471 -
+8 -9
drivers/char/agp/sis-agp.c
··· 79 79 u32 command; 80 80 int rate; 81 81 82 - printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n", 83 - agp_bridge->major_version, 84 - agp_bridge->minor_version, 85 - pci_name(agp_bridge->dev)); 82 + dev_info(&agp_bridge->dev->dev, "AGP %d.%d bridge\n", 83 + agp_bridge->major_version, agp_bridge->minor_version); 86 84 87 85 pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx + PCI_AGP_STATUS, &command); 88 86 command = agp_collect_device_status(bridge, mode, command); ··· 92 94 if (!agp) 93 95 continue; 94 96 95 - printk(KERN_INFO PFX "Putting AGP V3 device at %s into %dx mode\n", 96 - pci_name(device), rate); 97 + dev_info(&agp_bridge->dev->dev, "putting AGP V3 device at %s into %dx mode\n", 98 + pci_name(device), rate); 97 99 98 100 pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command); 99 101 ··· 103 105 * cannot be configured 104 106 */ 105 107 if (device->device == bridge->dev->device) { 106 - printk(KERN_INFO PFX "SiS delay workaround: giving bridge time to recover.\n"); 108 + dev_info(&agp_bridge->dev->dev, "SiS delay workaround: giving bridge time to recover\n"); 107 109 msleep(10); 108 110 } 109 111 } ··· 188 190 return -ENODEV; 189 191 190 192 191 - printk(KERN_INFO PFX "Detected SiS chipset - id:%i\n", pdev->device); 193 + dev_info(&pdev->dev, "SiS chipset [%04x/%04x]\n", 194 + pdev->vendor, pdev->device); 192 195 bridge = agp_alloc_bridge(); 193 196 if (!bridge) 194 197 return -ENOMEM; ··· 241 242 .class = (PCI_CLASS_BRIDGE_HOST << 8), 242 243 .class_mask = ~0, 243 244 .vendor = PCI_VENDOR_ID_SI, 244 - .device = PCI_DEVICE_ID_SI_5591_AGP, 245 + .device = PCI_DEVICE_ID_SI_5591, 245 246 .subvendor = PCI_ANY_ID, 246 247 .subdevice = PCI_ANY_ID, 247 248 },
+13 -12
drivers/char/agp/sworks-agp.c
··· 241 241 while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) { 242 242 cpu_relax(); 243 243 if (time_after(jiffies, timeout)) { 244 - printk(KERN_ERR PFX "TLB post flush took more than 3 seconds\n"); 244 + dev_err(&serverworks_private.svrwrks_dev->dev, 245 + "TLB post flush took more than 3 seconds\n"); 245 246 break; 246 247 } 247 248 } ··· 252 251 while (readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) { 253 252 cpu_relax(); 254 253 if (time_after(jiffies, timeout)) { 255 - printk(KERN_ERR PFX "TLB Dir flush took more than 3 seconds\n"); 254 + dev_err(&serverworks_private.svrwrks_dev->dev, 255 + "TLB Dir flush took more than 3 seconds\n"); 256 256 break; 257 257 } 258 258 } ··· 273 271 temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); 274 272 serverworks_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); 275 273 if (!serverworks_private.registers) { 276 - printk (KERN_ERR PFX "Unable to ioremap() memory.\n"); 274 + dev_err(&agp_bridge->dev->dev, "can't ioremap(%#x)\n", temp); 277 275 return -ENOMEM; 278 276 } 279 277 ··· 453 451 454 452 switch (pdev->device) { 455 453 case 0x0006: 456 - printk (KERN_ERR PFX "ServerWorks CNB20HE is unsupported due to lack of documentation.\n"); 454 + dev_err(&pdev->dev, "ServerWorks CNB20HE is unsupported due to lack of documentation\n"); 457 455 return -ENODEV; 458 456 459 457 case PCI_DEVICE_ID_SERVERWORKS_HE: ··· 463 461 464 462 default: 465 463 if (cap_ptr) 466 - printk(KERN_ERR PFX "Unsupported Serverworks chipset " 467 - "(device id: %04x)\n", pdev->device); 464 + dev_err(&pdev->dev, "unsupported Serverworks chipset " 465 + "[%04x/%04x]\n", pdev->vendor, pdev->device); 468 466 return -ENODEV; 469 467 } 470 468 ··· 472 470 bridge_dev = pci_get_bus_and_slot((unsigned int)pdev->bus->number, 473 471 PCI_DEVFN(0, 1)); 474 472 if (!bridge_dev) { 475 - printk(KERN_INFO PFX "Detected a Serverworks chipset " 476 - "but could not find the secondary device.\n"); 473 + dev_info(&pdev->dev, "can't find secondary device\n"); 477 474 return -ENODEV; 478 475 } 479 476 ··· 483 482 if (temp & PCI_BASE_ADDRESS_MEM_TYPE_64) { 484 483 pci_read_config_dword(pdev, SVWRKS_APSIZE + 4, &temp2); 485 484 if (temp2 != 0) { 486 - printk(KERN_INFO PFX "Detected 64 bit aperture address, " 487 - "but top bits are not zero. Disabling agp\n"); 485 + dev_info(&pdev->dev, "64 bit aperture address, " 486 + "but top bits are not zero; disabling AGP\n"); 488 487 return -ENODEV; 489 488 } 490 489 serverworks_private.mm_addr_ofs = 0x18; ··· 496 495 pci_read_config_dword(pdev, 497 496 serverworks_private.mm_addr_ofs + 4, &temp2); 498 497 if (temp2 != 0) { 499 - printk(KERN_INFO PFX "Detected 64 bit MMIO address, " 500 - "but top bits are not zero. Disabling agp\n"); 498 + dev_info(&pdev->dev, "64 bit MMIO address, but top " 499 + "bits are not zero; disabling AGP\n"); 501 500 return -ENODEV; 502 501 } 503 502 }
+16 -16
drivers/char/agp/uninorth-agp.c
··· 46 46 break; 47 47 48 48 if (i == agp_bridge->driver->num_aperture_sizes) { 49 - printk(KERN_ERR PFX "Invalid aperture size, using" 50 - " default\n"); 49 + dev_err(&agp_bridge->dev->dev, "invalid aperture size, " 50 + "using default\n"); 51 51 size = 0; 52 52 aperture = NULL; 53 53 } ··· 108 108 109 109 current_size = A_SIZE_32(agp_bridge->current_size); 110 110 111 - printk(KERN_INFO PFX "configuring for size idx: %d\n", 112 - current_size->size_value); 111 + dev_info(&agp_bridge->dev->dev, "configuring for size idx: %d\n", 112 + current_size->size_value); 113 113 114 114 /* aperture size and gatt addr */ 115 115 pci_write_config_dword(agp_bridge->dev, ··· 197 197 gp = (u32 *) &agp_bridge->gatt_table[pg_start]; 198 198 for (i = 0; i < mem->page_count; ++i) { 199 199 if (gp[i]) { 200 - printk("u3_insert_memory: entry 0x%x occupied (%x)\n", 201 - i, gp[i]); 200 + dev_info(&agp_bridge->dev->dev, 201 + "u3_insert_memory: entry 0x%x occupied (%x)\n", 202 + i, gp[i]); 202 203 return -EBUSY; 203 204 } 204 205 } ··· 277 276 &scratch); 278 277 } while ((scratch & PCI_AGP_COMMAND_AGP) == 0 && ++timeout < 1000); 279 278 if ((scratch & PCI_AGP_COMMAND_AGP) == 0) 280 - printk(KERN_ERR PFX "failed to write UniNorth AGP" 281 - " command register\n"); 279 + dev_err(&bridge->dev->dev, "can't write UniNorth AGP " 280 + "command register\n"); 282 281 283 282 if (uninorth_rev >= 0x30) { 284 283 /* This is an AGP V3 */ ··· 331 330 pci_read_config_dword(device, agp + PCI_AGP_COMMAND, &cmd); 332 331 if (!(cmd & PCI_AGP_COMMAND_AGP)) 333 332 continue; 334 - printk("uninorth-agp: disabling AGP on device %s\n", 335 - pci_name(device)); 333 + dev_info(&pdev->dev, "disabling AGP on device %s\n", 334 + pci_name(device)); 336 335 cmd &= ~PCI_AGP_COMMAND_AGP; 337 336 pci_write_config_dword(device, agp + PCI_AGP_COMMAND, cmd); 338 337 } ··· 342 341 pci_read_config_dword(pdev, agp + PCI_AGP_COMMAND, &cmd); 343 342 bridge->dev_private_data = (void *)(long)cmd; 344 343 if (cmd & PCI_AGP_COMMAND_AGP) { 345 - printk("uninorth-agp: disabling AGP on bridge %s\n", 346 - pci_name(pdev)); 344 + dev_info(&pdev->dev, "disabling AGP on bridge\n"); 347 345 cmd &= ~PCI_AGP_COMMAND_AGP; 348 346 pci_write_config_dword(pdev, agp + PCI_AGP_COMMAND, cmd); 349 347 } ··· 591 591 /* probe for known chipsets */ 592 592 for (j = 0; devs[j].chipset_name != NULL; ++j) { 593 593 if (pdev->device == devs[j].device_id) { 594 - printk(KERN_INFO PFX "Detected Apple %s chipset\n", 595 - devs[j].chipset_name); 594 + dev_info(&pdev->dev, "Apple %s chipset\n", 595 + devs[j].chipset_name); 596 596 goto found; 597 597 } 598 598 } 599 599 600 - printk(KERN_ERR PFX "Unsupported Apple chipset (device id: %04x).\n", 601 - pdev->device); 600 + dev_err(&pdev->dev, "unsupported Apple chipset [%04x/%04x]\n", 601 + pdev->vendor, pdev->device); 602 602 return -ENODEV; 603 603 604 604 found:
+5
include/linux/agp_backend.h
··· 30 30 #ifndef _AGP_BACKEND_H 31 31 #define _AGP_BACKEND_H 1 32 32 33 + #include <linux/list.h> 34 + 33 35 enum chipset_type { 34 36 NOT_SUPPORTED, 35 37 SUPPORTED, ··· 80 78 bool is_bound; 81 79 bool is_flushed; 82 80 bool vmalloc_flag; 81 + /* list of agp_memory mapped to the aperture */ 82 + struct list_head mapped_list; 83 83 }; 84 84 85 85 #define AGP_NORMAL_MEMORY 0 ··· 100 96 extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); 101 97 extern int agp_bind_memory(struct agp_memory *, off_t); 102 98 extern int agp_unbind_memory(struct agp_memory *); 99 + extern int agp_rebind_memory(void); 103 100 extern void agp_enable(struct agp_bridge_data *, u32); 104 101 extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); 105 102 extern void agp_backend_release(struct agp_bridge_data *);