aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-31 19:20:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-31 19:20:55 -0500
commit10379a25fee8ddc8698d2f6c54ccedd4664c2941 (patch)
treefba7fe3a1aa8e85104f9dcf08ff217dd4b0160c4 /drivers/char
parent63b3ced0f80ae1c437620d3f7d6ff2bcf0745b0a (diff)
parent3b0e8eadc511eaceba6d6b8d0743359a34ee23c6 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/amd64-agp.c24
-rw-r--r--drivers/char/agp/ati-agp.c20
-rw-r--r--drivers/char/agp/frontend.c28
-rw-r--r--drivers/char/agp/intel-agp.c15
-rw-r--r--drivers/char/agp/isoch.c4
5 files changed, 72 insertions, 19 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 810679dcbbb0..9964c508c111 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -600,6 +600,26 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev)
600 agp_put_bridge(bridge); 600 agp_put_bridge(bridge);
601} 601}
602 602
603#ifdef CONFIG_PM
604
605static int agp_amd64_suspend(struct pci_dev *pdev, pm_message_t state)
606{
607 pci_save_state(pdev);
608 pci_set_power_state(pdev, pci_choose_state(pdev, state));
609
610 return 0;
611}
612
613static int agp_amd64_resume(struct pci_dev *pdev)
614{
615 pci_set_power_state(pdev, PCI_D0);
616 pci_restore_state(pdev);
617
618 return amd_8151_configure();
619}
620
621#endif /* CONFIG_PM */
622
603static struct pci_device_id agp_amd64_pci_table[] = { 623static struct pci_device_id agp_amd64_pci_table[] = {
604 { 624 {
605 .class = (PCI_CLASS_BRIDGE_HOST << 8), 625 .class = (PCI_CLASS_BRIDGE_HOST << 8),
@@ -718,6 +738,10 @@ static struct pci_driver agp_amd64_pci_driver = {
718 .id_table = agp_amd64_pci_table, 738 .id_table = agp_amd64_pci_table,
719 .probe = agp_amd64_probe, 739 .probe = agp_amd64_probe,
720 .remove = agp_amd64_remove, 740 .remove = agp_amd64_remove,
741#ifdef CONFIG_PM
742 .suspend = agp_amd64_suspend,
743 .resume = agp_amd64_resume,
744#endif
721}; 745};
722 746
723 747
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 53372a83b675..5b74c36c116c 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -244,6 +244,22 @@ static int ati_configure(void)
244} 244}
245 245
246 246
247#ifdef CONFIG_PM
248static int agp_ati_resume(struct pci_dev *dev)
249{
250 pci_restore_state(dev);
251
252 return ati_configure();
253}
254
255static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
256{
257 pci_save_state(dev);
258
259 return 0;
260}
261#endif
262
247/* 263/*
248 *Since we don't need contigious memory we just try 264 *Since we don't need contigious memory we just try
249 * to get the gatt table once 265 * to get the gatt table once
@@ -525,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = {
525 .id_table = agp_ati_pci_table, 541 .id_table = agp_ati_pci_table,
526 .probe = agp_ati_probe, 542 .probe = agp_ati_probe,
527 .remove = agp_ati_remove, 543 .remove = agp_ati_remove,
544#ifdef CONFIG_PM
545 .resume = agp_ati_resume,
546 .suspend = agp_ati_suspend,
547#endif
528}; 548};
529 549
530static int __init agp_ati_init(void) 550static int __init agp_ati_init(void)
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 17f520c9d471..97eeb2345b18 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
592 struct agp_file_private *priv = file->private_data; 592 struct agp_file_private *priv = file->private_data;
593 struct agp_kern_info kerninfo; 593 struct agp_kern_info kerninfo;
594 594
595 down(&(agp_fe.agp_mutex)); 595 mutex_lock(&(agp_fe.agp_mutex));
596 596
597 if (agp_fe.backend_acquired != TRUE) 597 if (agp_fe.backend_acquired != TRUE)
598 goto out_eperm; 598 goto out_eperm;
@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
627 size, vma->vm_page_prot)) { 627 size, vma->vm_page_prot)) {
628 goto out_again; 628 goto out_again;
629 } 629 }
630 up(&(agp_fe.agp_mutex)); 630 mutex_unlock(&(agp_fe.agp_mutex));
631 return 0; 631 return 0;
632 } 632 }
633 633
@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
643 size, vma->vm_page_prot)) { 643 size, vma->vm_page_prot)) {
644 goto out_again; 644 goto out_again;
645 } 645 }
646 up(&(agp_fe.agp_mutex)); 646 mutex_unlock(&(agp_fe.agp_mutex));
647 return 0; 647 return 0;
648 } 648 }
649 649
650out_eperm: 650out_eperm:
651 up(&(agp_fe.agp_mutex)); 651 mutex_unlock(&(agp_fe.agp_mutex));
652 return -EPERM; 652 return -EPERM;
653 653
654out_inval: 654out_inval:
655 up(&(agp_fe.agp_mutex)); 655 mutex_unlock(&(agp_fe.agp_mutex));
656 return -EINVAL; 656 return -EINVAL;
657 657
658out_again: 658out_again:
659 up(&(agp_fe.agp_mutex)); 659 mutex_unlock(&(agp_fe.agp_mutex));
660 return -EAGAIN; 660 return -EAGAIN;
661} 661}
662 662
@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file)
664{ 664{
665 struct agp_file_private *priv = file->private_data; 665 struct agp_file_private *priv = file->private_data;
666 666
667 down(&(agp_fe.agp_mutex)); 667 mutex_lock(&(agp_fe.agp_mutex));
668 668
669 DBG("priv=%p", priv); 669 DBG("priv=%p", priv);
670 670
@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file)
687 agp_remove_file_private(priv); 687 agp_remove_file_private(priv);
688 kfree(priv); 688 kfree(priv);
689 file->private_data = NULL; 689 file->private_data = NULL;
690 up(&(agp_fe.agp_mutex)); 690 mutex_unlock(&(agp_fe.agp_mutex));
691 return 0; 691 return 0;
692} 692}
693 693
@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file)
698 struct agp_client *client; 698 struct agp_client *client;
699 int rc = -ENXIO; 699 int rc = -ENXIO;
700 700
701 down(&(agp_fe.agp_mutex)); 701 mutex_lock(&(agp_fe.agp_mutex));
702 702
703 if (minor != AGPGART_MINOR) 703 if (minor != AGPGART_MINOR)
704 goto err_out; 704 goto err_out;
@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file)
723 file->private_data = (void *) priv; 723 file->private_data = (void *) priv;
724 agp_insert_file_private(priv); 724 agp_insert_file_private(priv);
725 DBG("private=%p, client=%p", priv, client); 725 DBG("private=%p, client=%p", priv, client);
726 up(&(agp_fe.agp_mutex)); 726 mutex_unlock(&(agp_fe.agp_mutex));
727 return 0; 727 return 0;
728 728
729err_out_nomem: 729err_out_nomem:
730 rc = -ENOMEM; 730 rc = -ENOMEM;
731err_out: 731err_out:
732 up(&(agp_fe.agp_mutex)); 732 mutex_unlock(&(agp_fe.agp_mutex));
733 return rc; 733 return rc;
734} 734}
735 735
@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
985 int ret_val = -ENOTTY; 985 int ret_val = -ENOTTY;
986 986
987 DBG("priv=%p, cmd=%x", curr_priv, cmd); 987 DBG("priv=%p, cmd=%x", curr_priv, cmd);
988 down(&(agp_fe.agp_mutex)); 988 mutex_lock(&(agp_fe.agp_mutex));
989 989
990 if ((agp_fe.current_controller == NULL) && 990 if ((agp_fe.current_controller == NULL) &&
991 (cmd != AGPIOC_ACQUIRE)) { 991 (cmd != AGPIOC_ACQUIRE)) {
@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
1055 1055
1056ioctl_out: 1056ioctl_out:
1057 DBG("ioctl returns %d\n", ret_val); 1057 DBG("ioctl returns %d\n", ret_val);
1058 up(&(agp_fe.agp_mutex)); 1058 mutex_unlock(&(agp_fe.agp_mutex));
1059 return ret_val; 1059 return ret_val;
1060} 1060}
1061 1061
@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev =
1081int agp_frontend_initialize(void) 1081int agp_frontend_initialize(void)
1082{ 1082{
1083 memset(&agp_fe, 0, sizeof(struct agp_front_data)); 1083 memset(&agp_fe, 0, sizeof(struct agp_front_data));
1084 sema_init(&(agp_fe.agp_mutex), 1); 1084 mutex_init(&(agp_fe.agp_mutex));
1085 1085
1086 if (misc_register(&agp_miscdev)) { 1086 if (misc_register(&agp_miscdev)) {
1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); 1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index e7bed5047dcc..631531fd97a5 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -422,7 +422,8 @@ static void intel_i830_init_gtt_entries(void)
422 /* Check it's really I915G */ 422 /* Check it's really I915G */
423 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 423 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
424 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 424 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
425 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) 425 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
426 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB)
426 gtt_entries = MB(48) - KB(size); 427 gtt_entries = MB(48) - KB(size);
427 else 428 else
428 gtt_entries = 0; 429 gtt_entries = 0;
@@ -431,7 +432,8 @@ static void intel_i830_init_gtt_entries(void)
431 /* Check it's really I915G */ 432 /* Check it's really I915G */
432 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 433 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
433 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 434 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
434 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) 435 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
436 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB)
435 gtt_entries = MB(64) - KB(size); 437 gtt_entries = MB(64) - KB(size);
436 else 438 else
437 gtt_entries = 0; 439 gtt_entries = 0;
@@ -1681,6 +1683,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1681 } 1683 }
1682 name = "945G"; 1684 name = "945G";
1683 break; 1685 break;
1686 case PCI_DEVICE_ID_INTEL_82945GM_HB:
1687 if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG)) {
1688 bridge->driver = &intel_915_driver;
1689 } else {
1690 bridge->driver = &intel_845_driver;
1691 }
1692 name = "945GM";
1693 break;
1684 case PCI_DEVICE_ID_INTEL_7505_0: 1694 case PCI_DEVICE_ID_INTEL_7505_0:
1685 bridge->driver = &intel_7505_driver; 1695 bridge->driver = &intel_7505_driver;
1686 name = "E7505"; 1696 name = "E7505";
@@ -1821,6 +1831,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
1821 ID(PCI_DEVICE_ID_INTEL_82915G_HB), 1831 ID(PCI_DEVICE_ID_INTEL_82915G_HB),
1822 ID(PCI_DEVICE_ID_INTEL_82915GM_HB), 1832 ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
1823 ID(PCI_DEVICE_ID_INTEL_82945G_HB), 1833 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
1834 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
1824 { } 1835 { }
1825}; 1836};
1826 1837
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c
index 40083241804e..7c14a096b85e 100644
--- a/drivers/char/agp/isoch.c
+++ b/drivers/char/agp/isoch.c
@@ -218,10 +218,8 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge,
218 master[cdev].rq *= (1 << (master[cdev].y - 1)); 218 master[cdev].rq *= (1 << (master[cdev].y - 1));
219 219
220 tot_rq += master[cdev].rq; 220 tot_rq += master[cdev].rq;
221
222 if (cdev == ndevs-1)
223 master[cdev].n += rem;
224 } 221 }
222 master[ndevs-1].n += rem;
225 223
226 /* Figure the number of isochronous and asynchronous RQ slots the 224 /* Figure the number of isochronous and asynchronous RQ slots the
227 * target is providing. */ 225 * target is providing. */