aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/amd64-agp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp/amd64-agp.c')
-rw-r--r--drivers/char/agp/amd64-agp.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 481ffe87c716..7495c522d8e4 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -34,6 +34,7 @@
34 34
35static struct resource *aperture_resource; 35static struct resource *aperture_resource;
36static int __initdata agp_try_unsupported = 1; 36static int __initdata agp_try_unsupported = 1;
37static int agp_bridges_found;
37 38
38static void amd64_tlbflush(struct agp_memory *temp) 39static void amd64_tlbflush(struct agp_memory *temp)
39{ 40{
@@ -293,12 +294,13 @@ static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
293 * so let double check that order, and lets trust the AMD NB settings 294 * so let double check that order, and lets trust the AMD NB settings
294 */ 295 */
295 if (order >=0 && aper + (32ULL<<(20 + order)) > 0x100000000ULL) { 296 if (order >=0 && aper + (32ULL<<(20 + order)) > 0x100000000ULL) {
296 printk(KERN_INFO "Aperture size %u MB is not right, using settings from NB\n", 297 dev_info(&agp->dev, "aperture size %u MB is not right, using settings from NB\n",
297 32 << order); 298 32 << order);
298 order = nb_order; 299 order = nb_order;
299 } 300 }
300 301
301 printk(KERN_INFO PFX "Aperture from AGP @ %Lx size %u MB\n", aper, 32 << order); 302 dev_info(&agp->dev, "aperture from AGP @ %Lx size %u MB\n",
303 aper, 32 << order);
302 if (order < 0 || !agp_aperture_valid(aper, (32*1024*1024)<<order)) 304 if (order < 0 || !agp_aperture_valid(aper, (32*1024*1024)<<order))
303 return -1; 305 return -1;
304 306
@@ -319,10 +321,10 @@ static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
319 for (i = 0; i < num_k8_northbridges; i++) { 321 for (i = 0; i < num_k8_northbridges; i++) {
320 struct pci_dev *dev = k8_northbridges[i]; 322 struct pci_dev *dev = k8_northbridges[i];
321 if (fix_northbridge(dev, pdev, cap_ptr) < 0) { 323 if (fix_northbridge(dev, pdev, cap_ptr) < 0) {
322 printk(KERN_ERR PFX "No usable aperture found.\n"); 324 dev_err(&dev->dev, "no usable aperture found\n");
323#ifdef __x86_64__ 325#ifdef __x86_64__
324 /* should port this to i386 */ 326 /* should port this to i386 */
325 printk(KERN_ERR PFX "Consider rebooting with iommu=memaper=2 to get a good aperture.\n"); 327 dev_err(&dev->dev, "consider rebooting with iommu=memaper=2 to get a good aperture\n");
326#endif 328#endif
327 return -1; 329 return -1;
328 } 330 }
@@ -345,14 +347,14 @@ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data
345 default: revstring="??"; break; 347 default: revstring="??"; break;
346 } 348 }
347 349
348 printk (KERN_INFO PFX "Detected AMD 8151 AGP Bridge rev %s\n", revstring); 350 dev_info(&pdev->dev, "AMD 8151 AGP Bridge rev %s\n", revstring);
349 351
350 /* 352 /*
351 * Work around errata. 353 * Work around errata.
352 * Chips before B2 stepping incorrectly reporting v3.5 354 * Chips before B2 stepping incorrectly reporting v3.5
353 */ 355 */
354 if (pdev->revision < 0x13) { 356 if (pdev->revision < 0x13) {
355 printk (KERN_INFO PFX "Correcting AGP revision (reports 3.5, is really 3.0)\n"); 357 dev_info(&pdev->dev, "correcting AGP revision (reports 3.5, is really 3.0)\n");
356 bridge->major_version = 3; 358 bridge->major_version = 3;
357 bridge->minor_version = 0; 359 bridge->minor_version = 0;
358 } 360 }
@@ -375,11 +377,11 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
375 struct pci_dev *dev1; 377 struct pci_dev *dev1;
376 int i; 378 int i;
377 unsigned size = amd64_fetch_size(); 379 unsigned size = amd64_fetch_size();
378 printk(KERN_INFO "Setting up ULi AGP.\n"); 380
381 dev_info(&pdev->dev, "setting up ULi AGP\n");
379 dev1 = pci_get_slot (pdev->bus,PCI_DEVFN(0,0)); 382 dev1 = pci_get_slot (pdev->bus,PCI_DEVFN(0,0));
380 if (dev1 == NULL) { 383 if (dev1 == NULL) {
381 printk(KERN_INFO PFX "Detected a ULi chipset, " 384 dev_info(&pdev->dev, "can't find ULi secondary device\n");
382 "but could not fine the secondary device.\n");
383 return -ENODEV; 385 return -ENODEV;
384 } 386 }
385 387
@@ -388,7 +390,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
388 break; 390 break;
389 391
390 if (i == ARRAY_SIZE(uli_sizes)) { 392 if (i == ARRAY_SIZE(uli_sizes)) {
391 printk(KERN_INFO PFX "No ULi size found for %d\n", size); 393 dev_info(&pdev->dev, "no ULi size found for %d\n", size);
392 return -ENODEV; 394 return -ENODEV;
393 } 395 }
394 396
@@ -433,13 +435,11 @@ static int nforce3_agp_init(struct pci_dev *pdev)
433 int i; 435 int i;
434 unsigned size = amd64_fetch_size(); 436 unsigned size = amd64_fetch_size();
435 437
436 printk(KERN_INFO PFX "Setting up Nforce3 AGP.\n"); 438 dev_info(&pdev->dev, "setting up Nforce3 AGP\n");
437 439
438 dev1 = pci_get_slot(pdev->bus, PCI_DEVFN(11, 0)); 440 dev1 = pci_get_slot(pdev->bus, PCI_DEVFN(11, 0));
439 if (dev1 == NULL) { 441 if (dev1 == NULL) {
440 printk(KERN_INFO PFX "agpgart: Detected an NVIDIA " 442 dev_info(&pdev->dev, "can't find Nforce3 secondary device\n");
441 "nForce3 chipset, but could not find "
442 "the secondary device.\n");
443 return -ENODEV; 443 return -ENODEV;
444 } 444 }
445 445
@@ -448,7 +448,7 @@ static int nforce3_agp_init(struct pci_dev *pdev)
448 break; 448 break;
449 449
450 if (i == ARRAY_SIZE(nforce3_sizes)) { 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 return -ENODEV; 452 return -ENODEV;
453 } 453 }
454 454
@@ -462,7 +462,7 @@ static int nforce3_agp_init(struct pci_dev *pdev)
462 462
463 /* if x86-64 aperture base is beyond 4G, exit here */ 463 /* if x86-64 aperture base is beyond 4G, exit here */
464 if ( (apbase & 0x7fff) >> (32 - 25) ) { 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 return -ENODEV; 466 return -ENODEV;
467 } 467 }
468 468
@@ -489,6 +489,7 @@ static int __devinit agp_amd64_probe(struct pci_dev *pdev,
489{ 489{
490 struct agp_bridge_data *bridge; 490 struct agp_bridge_data *bridge;
491 u8 cap_ptr; 491 u8 cap_ptr;
492 int err;
492 493
493 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); 494 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
494 if (!cap_ptr) 495 if (!cap_ptr)
@@ -504,7 +505,8 @@ static int __devinit agp_amd64_probe(struct pci_dev *pdev,
504 pdev->device == PCI_DEVICE_ID_AMD_8151_0) { 505 pdev->device == PCI_DEVICE_ID_AMD_8151_0) {
505 amd8151_init(pdev, bridge); 506 amd8151_init(pdev, bridge);
506 } else { 507 } else {
507 printk(KERN_INFO PFX "Detected AGP bridge %x\n", pdev->devfn); 508 dev_info(&pdev->dev, "AGP bridge [%04x/%04x]\n",
509 pdev->vendor, pdev->device);
508 } 510 }
509 511
510 bridge->driver = &amd_8151_driver; 512 bridge->driver = &amd_8151_driver;
@@ -536,7 +538,12 @@ static int __devinit agp_amd64_probe(struct pci_dev *pdev,
536 } 538 }
537 539
538 pci_set_drvdata(pdev, bridge); 540 pci_set_drvdata(pdev, bridge);
539 return agp_add_bridge(bridge); 541 err = agp_add_bridge(bridge);
542 if (err < 0)
543 return err;
544
545 agp_bridges_found++;
546 return 0;
540} 547}
541 548
542static void __devexit agp_amd64_remove(struct pci_dev *pdev) 549static void __devexit agp_amd64_remove(struct pci_dev *pdev)
@@ -713,7 +720,11 @@ int __init agp_amd64_init(void)
713 720
714 if (agp_off) 721 if (agp_off)
715 return -EINVAL; 722 return -EINVAL;
716 if (pci_register_driver(&agp_amd64_pci_driver) < 0) { 723 err = pci_register_driver(&agp_amd64_pci_driver);
724 if (err < 0)
725 return err;
726
727 if (agp_bridges_found == 0) {
717 struct pci_dev *dev; 728 struct pci_dev *dev;
718 if (!agp_try_unsupported && !agp_try_unsupported_boot) { 729 if (!agp_try_unsupported && !agp_try_unsupported_boot) {
719 printk(KERN_INFO PFX "No supported AGP bridge found.\n"); 730 printk(KERN_INFO PFX "No supported AGP bridge found.\n");