Commit 82991c6f authored by Linus Torvalds's avatar Linus Torvalds

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

* master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart:
  [AGPGART] Make AGP depend on PCI
  [AGPGART] remove unused variable
  [AGPGART] Fix pci_register_driver checking in amd64-agp
  [AGPGART] Compile fix for ati-agp
  [AGPGART] Suspend/Resume support for nVidia nForce AGP.
  [AGPGART] Suspend/Resume improvements for ATI AGP
  [AGPGART] Whitespace cleanups for ati-agp
parents 8d231c11 55b4d6a5
config AGP config AGP
tristate "/dev/agpgart (AGP Support)" tristate "/dev/agpgart (AGP Support)"
depends on ALPHA || IA64 || PPC || X86 depends on ALPHA || IA64 || PPC || X86
depends on PCI
---help--- ---help---
AGP (Accelerated Graphics Port) is a bus system mainly used to AGP (Accelerated Graphics Port) is a bus system mainly used to
connect graphics cards to the rest of the system. connect graphics cards to the rest of the system.
......
...@@ -734,7 +734,7 @@ int __init agp_amd64_init(void) ...@@ -734,7 +734,7 @@ int __init agp_amd64_init(void)
if (agp_off) if (agp_off)
return -EINVAL; return -EINVAL;
if (pci_register_driver(&agp_amd64_pci_driver) > 0) { if (pci_register_driver(&agp_amd64_pci_driver) < 0) {
struct pci_dev *dev; struct pci_dev *dev;
if (!agp_try_unsupported && !agp_try_unsupported_boot) { if (!agp_try_unsupported && !agp_try_unsupported_boot) {
printk(KERN_INFO PFX "No supported AGP bridge found.\n"); printk(KERN_INFO PFX "No supported AGP bridge found.\n");
......
...@@ -41,7 +41,6 @@ static struct gatt_mask ati_generic_masks[] = ...@@ -41,7 +41,6 @@ static struct gatt_mask ati_generic_masks[] =
}; };
typedef struct _ati_page_map { typedef struct _ati_page_map {
unsigned long *real; unsigned long *real;
unsigned long __iomem *remapped; unsigned long __iomem *remapped;
...@@ -141,7 +140,8 @@ static int ati_create_gatt_pages(int nr_tables) ...@@ -141,7 +140,8 @@ static int ati_create_gatt_pages(int nr_tables)
ati_generic_private.num_tables = nr_tables; ati_generic_private.num_tables = nr_tables;
ati_generic_private.gatt_pages = tables; ati_generic_private.gatt_pages = tables;
if (retval != 0) ati_free_gatt_pages(); if (retval != 0)
ati_free_gatt_pages();
return retval; return retval;
} }
...@@ -219,16 +219,16 @@ static int ati_configure(void) ...@@ -219,16 +219,16 @@ static int ati_configure(void)
ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
if (is_r200()) if (is_r200())
pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000);
else else
pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000); pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000);
/* address to map too */ /* address to map too */
/* /*
pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp); pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp);
agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr);
*/ */
writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID);
readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/ readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/
...@@ -245,18 +245,20 @@ static int ati_configure(void) ...@@ -245,18 +245,20 @@ static int ati_configure(void)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int agp_ati_resume(struct pci_dev *dev) static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
{ {
pci_restore_state(dev); pci_save_state(dev);
pci_set_power_state(dev, 3);
return ati_configure(); return 0;
} }
static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) static int agp_ati_resume(struct pci_dev *dev)
{ {
pci_save_state(dev); pci_set_power_state(dev, 0);
pci_restore_state(dev);
return 0; return ati_configure();
} }
#endif #endif
...@@ -321,9 +323,9 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start, ...@@ -321,9 +323,9 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
unsigned long __iomem *cur_gatt; unsigned long __iomem *cur_gatt;
unsigned long addr; unsigned long addr;
if (type != 0 || mem->type != 0) { if (type != 0 || mem->type != 0)
return -EINVAL; return -EINVAL;
}
for (i = pg_start; i < (mem->page_count + pg_start); i++) { for (i = pg_start; i < (mem->page_count + pg_start); i++) {
addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr); cur_gatt = GET_GATT(addr);
...@@ -502,9 +504,8 @@ static int __devinit agp_ati_probe(struct pci_dev *pdev, ...@@ -502,9 +504,8 @@ static int __devinit agp_ati_probe(struct pci_dev *pdev,
bridge->dev = pdev; bridge->dev = pdev;
bridge->capndx = cap_ptr; bridge->capndx = cap_ptr;
bridge->driver = &ati_generic_bridge;
bridge->driver = &ati_generic_bridge;
printk(KERN_INFO PFX "Detected Ati %s chipset\n", printk(KERN_INFO PFX "Detected Ati %s chipset\n",
devs[j].chipset_name); devs[j].chipset_name);
...@@ -546,8 +547,8 @@ static struct pci_driver agp_ati_pci_driver = { ...@@ -546,8 +547,8 @@ static struct pci_driver agp_ati_pci_driver = {
.probe = agp_ati_probe, .probe = agp_ati_probe,
.remove = agp_ati_remove, .remove = agp_ati_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.resume = agp_ati_resume,
.suspend = agp_ati_suspend, .suspend = agp_ati_suspend,
.resume = agp_ati_resume,
#endif #endif
}; };
......
...@@ -376,6 +376,29 @@ static void __devexit agp_nvidia_remove(struct pci_dev *pdev) ...@@ -376,6 +376,29 @@ static void __devexit agp_nvidia_remove(struct pci_dev *pdev)
agp_put_bridge(bridge); agp_put_bridge(bridge);
} }
#ifdef CONFIG_PM
static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state)
{
pci_save_state (pdev);
pci_set_power_state (pdev, 3);
return 0;
}
static int agp_nvidia_resume(struct pci_dev *pdev)
{
/* set power state 0 and restore PCI space */
pci_set_power_state (pdev, 0);
pci_restore_state(pdev);
/* reconfigure AGP hardware again */
nvidia_configure();
return 0;
}
#endif
static struct pci_device_id agp_nvidia_pci_table[] = { static struct pci_device_id agp_nvidia_pci_table[] = {
{ {
.class = (PCI_CLASS_BRIDGE_HOST << 8), .class = (PCI_CLASS_BRIDGE_HOST << 8),
...@@ -403,6 +426,10 @@ static struct pci_driver agp_nvidia_pci_driver = { ...@@ -403,6 +426,10 @@ static struct pci_driver agp_nvidia_pci_driver = {
.id_table = agp_nvidia_pci_table, .id_table = agp_nvidia_pci_table,
.probe = agp_nvidia_probe, .probe = agp_nvidia_probe,
.remove = agp_nvidia_remove, .remove = agp_nvidia_remove,
#ifdef CONFIG_PM
.suspend = agp_nvidia_suspend,
.resume = agp_nvidia_resume,
#endif
}; };
static int __init agp_nvidia_init(void) static int __init agp_nvidia_init(void)
......
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