Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Linus Torvalds committed Jun 29, 2006
2 parents 8d231c1 + 55b4d6a commit 82991c6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
1 change: 1 addition & 0 deletions drivers/char/agp/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config AGP
tristate "/dev/agpgart (AGP Support)"
depends on ALPHA || IA64 || PPC || X86
depends on PCI
---help---
AGP (Accelerated Graphics Port) is a bus system mainly used to
connect graphics cards to the rest of the system.
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/agp/amd64-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ int __init agp_amd64_init(void)

if (agp_off)
return -EINVAL;
if (pci_register_driver(&agp_amd64_pci_driver) > 0) {
if (pci_register_driver(&agp_amd64_pci_driver) < 0) {
struct pci_dev *dev;
if (!agp_try_unsupported && !agp_try_unsupported_boot) {
printk(KERN_INFO PFX "No supported AGP bridge found.\n");
Expand Down
33 changes: 17 additions & 16 deletions drivers/char/agp/ati-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ static struct gatt_mask ati_generic_masks[] =
};



typedef struct _ati_page_map {
unsigned long *real;
unsigned long __iomem *remapped;
Expand Down Expand Up @@ -141,7 +140,8 @@ static int ati_create_gatt_pages(int nr_tables)
ati_generic_private.num_tables = nr_tables;
ati_generic_private.gatt_pages = tables;

if (retval != 0) ati_free_gatt_pages();
if (retval != 0)
ati_free_gatt_pages();

return retval;
}
Expand Down Expand Up @@ -219,16 +219,16 @@ static int ati_configure(void)
ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);

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
pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000);

/* address to map too */
/*
/*
pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp);
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);
*/
*/
writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID);
readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/

Expand All @@ -245,18 +245,20 @@ static int ati_configure(void)


#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

Expand Down Expand Up @@ -321,9 +323,9 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
unsigned long __iomem *cur_gatt;
unsigned long addr;

if (type != 0 || mem->type != 0) {
if (type != 0 || mem->type != 0)
return -EINVAL;
}

for (i = pg_start; i < (mem->page_count + pg_start); i++) {
addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr;
cur_gatt = GET_GATT(addr);
Expand Down Expand Up @@ -502,9 +504,8 @@ static int __devinit agp_ati_probe(struct pci_dev *pdev,

bridge->dev = pdev;
bridge->capndx = cap_ptr;

bridge->driver = &ati_generic_bridge;

bridge->driver = &ati_generic_bridge;

printk(KERN_INFO PFX "Detected Ati %s chipset\n",
devs[j].chipset_name);
Expand Down Expand Up @@ -546,8 +547,8 @@ static struct pci_driver agp_ati_pci_driver = {
.probe = agp_ati_probe,
.remove = agp_ati_remove,
#ifdef CONFIG_PM
.resume = agp_ati_resume,
.suspend = agp_ati_suspend,
.resume = agp_ati_resume,
#endif
};

Expand Down
27 changes: 27 additions & 0 deletions drivers/char/agp/nvidia-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ static void __devexit agp_nvidia_remove(struct pci_dev *pdev)
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[] = {
{
.class = (PCI_CLASS_BRIDGE_HOST << 8),
Expand Down Expand Up @@ -403,6 +426,10 @@ static struct pci_driver agp_nvidia_pci_driver = {
.id_table = agp_nvidia_pci_table,
.probe = agp_nvidia_probe,
.remove = agp_nvidia_remove,
#ifdef CONFIG_PM
.suspend = agp_nvidia_suspend,
.resume = agp_nvidia_resume,
#endif
};

static int __init agp_nvidia_init(void)
Expand Down

0 comments on commit 82991c6

Please sign in to comment.