Commit 10379a25 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart

parents 63b3ced0 3b0e8ead
...@@ -600,6 +600,26 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev) ...@@ -600,6 +600,26 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev)
agp_put_bridge(bridge); agp_put_bridge(bridge);
} }
#ifdef CONFIG_PM
static int agp_amd64_suspend(struct pci_dev *pdev, pm_message_t state)
{
pci_save_state(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
static int agp_amd64_resume(struct pci_dev *pdev)
{
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
return amd_8151_configure();
}
#endif /* CONFIG_PM */
static struct pci_device_id agp_amd64_pci_table[] = { static struct pci_device_id agp_amd64_pci_table[] = {
{ {
.class = (PCI_CLASS_BRIDGE_HOST << 8), .class = (PCI_CLASS_BRIDGE_HOST << 8),
...@@ -718,6 +738,10 @@ static struct pci_driver agp_amd64_pci_driver = { ...@@ -718,6 +738,10 @@ static struct pci_driver agp_amd64_pci_driver = {
.id_table = agp_amd64_pci_table, .id_table = agp_amd64_pci_table,
.probe = agp_amd64_probe, .probe = agp_amd64_probe,
.remove = agp_amd64_remove, .remove = agp_amd64_remove,
#ifdef CONFIG_PM
.suspend = agp_amd64_suspend,
.resume = agp_amd64_resume,
#endif
}; };
......
...@@ -244,6 +244,22 @@ static int ati_configure(void) ...@@ -244,6 +244,22 @@ static int ati_configure(void)
} }
#ifdef CONFIG_PM
static int agp_ati_resume(struct pci_dev *dev)
{
pci_restore_state(dev);
return ati_configure();
}
static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
{
pci_save_state(dev);
return 0;
}
#endif
/* /*
*Since we don't need contigious memory we just try *Since we don't need contigious memory we just try
* to get the gatt table once * to get the gatt table once
...@@ -525,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = { ...@@ -525,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = {
.id_table = agp_ati_pci_table, .id_table = agp_ati_pci_table,
.probe = agp_ati_probe, .probe = agp_ati_probe,
.remove = agp_ati_remove, .remove = agp_ati_remove,
#ifdef CONFIG_PM
.resume = agp_ati_resume,
.suspend = agp_ati_suspend,
#endif
}; };
static int __init agp_ati_init(void) static int __init agp_ati_init(void)
......
...@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
struct agp_file_private *priv = file->private_data; struct agp_file_private *priv = file->private_data;
struct agp_kern_info kerninfo; struct agp_kern_info kerninfo;
down(&(agp_fe.agp_mutex)); mutex_lock(&(agp_fe.agp_mutex));
if (agp_fe.backend_acquired != TRUE) if (agp_fe.backend_acquired != TRUE)
goto out_eperm; goto out_eperm;
...@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
size, vma->vm_page_prot)) { size, vma->vm_page_prot)) {
goto out_again; goto out_again;
} }
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return 0; return 0;
} }
...@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
size, vma->vm_page_prot)) { size, vma->vm_page_prot)) {
goto out_again; goto out_again;
} }
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return 0; return 0;
} }
out_eperm: out_eperm:
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return -EPERM; return -EPERM;
out_inval: out_inval:
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return -EINVAL; return -EINVAL;
out_again: out_again:
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return -EAGAIN; return -EAGAIN;
} }
...@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file) ...@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file)
{ {
struct agp_file_private *priv = file->private_data; struct agp_file_private *priv = file->private_data;
down(&(agp_fe.agp_mutex)); mutex_lock(&(agp_fe.agp_mutex));
DBG("priv=%p", priv); DBG("priv=%p", priv);
...@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file) ...@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file)
agp_remove_file_private(priv); agp_remove_file_private(priv);
kfree(priv); kfree(priv);
file->private_data = NULL; file->private_data = NULL;
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return 0; return 0;
} }
...@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file) ...@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file)
struct agp_client *client; struct agp_client *client;
int rc = -ENXIO; int rc = -ENXIO;
down(&(agp_fe.agp_mutex)); mutex_lock(&(agp_fe.agp_mutex));
if (minor != AGPGART_MINOR) if (minor != AGPGART_MINOR)
goto err_out; goto err_out;
...@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file) ...@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file)
file->private_data = (void *) priv; file->private_data = (void *) priv;
agp_insert_file_private(priv); agp_insert_file_private(priv);
DBG("private=%p, client=%p", priv, client); DBG("private=%p, client=%p", priv, client);
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return 0; return 0;
err_out_nomem: err_out_nomem:
rc = -ENOMEM; rc = -ENOMEM;
err_out: err_out:
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return rc; return rc;
} }
...@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file, ...@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
int ret_val = -ENOTTY; int ret_val = -ENOTTY;
DBG("priv=%p, cmd=%x", curr_priv, cmd); DBG("priv=%p, cmd=%x", curr_priv, cmd);
down(&(agp_fe.agp_mutex)); mutex_lock(&(agp_fe.agp_mutex));
if ((agp_fe.current_controller == NULL) && if ((agp_fe.current_controller == NULL) &&
(cmd != AGPIOC_ACQUIRE)) { (cmd != AGPIOC_ACQUIRE)) {
...@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file, ...@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
ioctl_out: ioctl_out:
DBG("ioctl returns %d\n", ret_val); DBG("ioctl returns %d\n", ret_val);
up(&(agp_fe.agp_mutex)); mutex_unlock(&(agp_fe.agp_mutex));
return ret_val; return ret_val;
} }
...@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev = ...@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev =
int agp_frontend_initialize(void) int agp_frontend_initialize(void)
{ {
memset(&agp_fe, 0, sizeof(struct agp_front_data)); memset(&agp_fe, 0, sizeof(struct agp_front_data));
sema_init(&(agp_fe.agp_mutex), 1); mutex_init(&(agp_fe.agp_mutex));
if (misc_register(&agp_miscdev)) { if (misc_register(&agp_miscdev)) {
printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);
......
...@@ -422,7 +422,8 @@ static void intel_i830_init_gtt_entries(void) ...@@ -422,7 +422,8 @@ static void intel_i830_init_gtt_entries(void)
/* Check it's really I915G */ /* Check it's really I915G */
if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB)
gtt_entries = MB(48) - KB(size); gtt_entries = MB(48) - KB(size);
else else
gtt_entries = 0; gtt_entries = 0;
...@@ -431,7 +432,8 @@ static void intel_i830_init_gtt_entries(void) ...@@ -431,7 +432,8 @@ static void intel_i830_init_gtt_entries(void)
/* Check it's really I915G */ /* Check it's really I915G */
if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB)
gtt_entries = MB(64) - KB(size); gtt_entries = MB(64) - KB(size);
else else
gtt_entries = 0; gtt_entries = 0;
...@@ -1681,6 +1683,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, ...@@ -1681,6 +1683,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
} }
name = "945G"; name = "945G";
break; break;
case PCI_DEVICE_ID_INTEL_82945GM_HB:
if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG)) {
bridge->driver = &intel_915_driver;
} else {
bridge->driver = &intel_845_driver;
}
name = "945GM";
break;
case PCI_DEVICE_ID_INTEL_7505_0: case PCI_DEVICE_ID_INTEL_7505_0:
bridge->driver = &intel_7505_driver; bridge->driver = &intel_7505_driver;
name = "E7505"; name = "E7505";
...@@ -1821,6 +1831,7 @@ static struct pci_device_id agp_intel_pci_table[] = { ...@@ -1821,6 +1831,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
ID(PCI_DEVICE_ID_INTEL_82915G_HB), ID(PCI_DEVICE_ID_INTEL_82915G_HB),
ID(PCI_DEVICE_ID_INTEL_82915GM_HB), ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
ID(PCI_DEVICE_ID_INTEL_82945G_HB), ID(PCI_DEVICE_ID_INTEL_82945G_HB),
ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
{ } { }
}; };
......
...@@ -218,10 +218,8 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge, ...@@ -218,10 +218,8 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge,
master[cdev].rq *= (1 << (master[cdev].y - 1)); master[cdev].rq *= (1 << (master[cdev].y - 1));
tot_rq += master[cdev].rq; tot_rq += master[cdev].rq;
if (cdev == ndevs-1)
master[cdev].n += rem;
} }
master[ndevs-1].n += rem;
/* Figure the number of isochronous and asynchronous RQ slots the /* Figure the number of isochronous and asynchronous RQ slots the
* target is providing. */ * target is providing. */
......
...@@ -111,6 +111,7 @@ typedef struct _agp_unbind { ...@@ -111,6 +111,7 @@ typedef struct _agp_unbind {
} agp_unbind; } agp_unbind;
#else /* __KERNEL__ */ #else /* __KERNEL__ */
#include <linux/mutex.h>
#define AGPGART_MINOR 175 #define AGPGART_MINOR 175
...@@ -201,7 +202,7 @@ struct agp_file_private { ...@@ -201,7 +202,7 @@ struct agp_file_private {
}; };
struct agp_front_data { struct agp_front_data {
struct semaphore agp_mutex; struct mutex agp_mutex;
struct agp_controller *current_controller; struct agp_controller *current_controller;
struct agp_controller *controllers; struct agp_controller *controllers;
struct agp_file_private *file_priv_list; struct agp_file_private *file_priv_list;
......
...@@ -2085,6 +2085,8 @@ ...@@ -2085,6 +2085,8 @@
#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 #define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 #define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 #define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
#define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0
#define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2
#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 #define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640
#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 #define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641
#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 #define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment