Commit 6581662b authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGPGART] Move AGP PM to individual drivers.

From Christoph Hellwig.
This is a lot cleaner by using the proper PCI PM infrastructure and also
fixes the breakage with the non-PCIish bridges on alpha and ia64
parent bd23c800
...@@ -113,8 +113,6 @@ struct agp_bridge_driver { ...@@ -113,8 +113,6 @@ struct agp_bridge_driver {
void (*free_by_type)(agp_memory *); void (*free_by_type)(agp_memory *);
void *(*agp_alloc_page)(void); void *(*agp_alloc_page)(void);
void (*agp_destroy_page)(void *); void (*agp_destroy_page)(void *);
int (*suspend)(void);
void (*resume)(void);
}; };
struct agp_bridge_data { struct agp_bridge_data {
...@@ -384,8 +382,6 @@ agp_memory *agp_generic_alloc_by_type(size_t page_count, int type); ...@@ -384,8 +382,6 @@ agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
void agp_generic_free_by_type(agp_memory * curr); void agp_generic_free_by_type(agp_memory * curr);
void *agp_generic_alloc_page(void); void *agp_generic_alloc_page(void);
void agp_generic_destroy_page(void *addr); void agp_generic_destroy_page(void *addr);
int agp_generic_suspend(void);
void agp_generic_resume(void);
void agp_free_key(int key); void agp_free_key(int key);
int agp_num_entries(void); int agp_num_entries(void);
u32 agp_collect_device_status(u32 mode, u32 command); u32 agp_collect_device_status(u32 mode, u32 command);
......
...@@ -217,8 +217,6 @@ struct agp_bridge_driver ali_generic_bridge = { ...@@ -217,8 +217,6 @@ struct agp_bridge_driver ali_generic_bridge = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = ali_destroy_page, .agp_destroy_page = ali_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver ali_m1541_bridge = { struct agp_bridge_driver ali_m1541_bridge = {
...@@ -242,8 +240,6 @@ struct agp_bridge_driver ali_m1541_bridge = { ...@@ -242,8 +240,6 @@ struct agp_bridge_driver ali_m1541_bridge = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = m1541_alloc_page, .agp_alloc_page = m1541_alloc_page,
.agp_destroy_page = m1541_destroy_page, .agp_destroy_page = m1541_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
......
...@@ -376,8 +376,6 @@ struct agp_bridge_driver amd_irongate_driver = { ...@@ -376,8 +376,6 @@ struct agp_bridge_driver amd_irongate_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_device_ids amd_agp_device_ids[] __initdata = struct agp_device_ids amd_agp_device_ids[] __initdata =
......
...@@ -244,8 +244,6 @@ struct agp_bridge_driver amd_8151_driver = { ...@@ -244,8 +244,6 @@ struct agp_bridge_driver amd_8151_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
static int __init agp_amdk8_probe(struct pci_dev *pdev, static int __init agp_amdk8_probe(struct pci_dev *pdev,
......
...@@ -210,19 +210,6 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge) ...@@ -210,19 +210,6 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
phys_to_virt(bridge->scratch_page_real)); phys_to_virt(bridge->scratch_page_real));
} }
static int agp_power(struct pm_dev *dev, pm_request_t rq, void *data)
{
switch(rq) {
case PM_SUSPEND:
return agp_bridge->driver->suspend();
case PM_RESUME:
agp_bridge->driver->resume();
return 0;
}
return 0;
}
static const drm_agp_t drm_agp = { static const drm_agp_t drm_agp = {
&agp_free_memory, &agp_free_memory,
&agp_allocate_memory, &agp_allocate_memory,
...@@ -280,7 +267,6 @@ int agp_add_bridge(struct agp_bridge_data *bridge) ...@@ -280,7 +267,6 @@ int agp_add_bridge(struct agp_bridge_data *bridge)
/* FIXME: What to do with this? */ /* FIXME: What to do with this? */
inter_module_register("drm_agp", THIS_MODULE, &drm_agp); inter_module_register("drm_agp", THIS_MODULE, &drm_agp);
pm_register(PM_PCI_DEV, PM_PCI_ID(bridge->dev), agp_power);
agp_count++; agp_count++;
return 0; return 0;
...@@ -297,7 +283,6 @@ EXPORT_SYMBOL_GPL(agp_add_bridge); ...@@ -297,7 +283,6 @@ EXPORT_SYMBOL_GPL(agp_add_bridge);
void agp_remove_bridge(struct agp_bridge_data *bridge) void agp_remove_bridge(struct agp_bridge_data *bridge)
{ {
bridge->type = NOT_SUPPORTED; bridge->type = NOT_SUPPORTED;
pm_unregister_all(agp_power);
agp_frontend_cleanup(); agp_frontend_cleanup();
agp_backend_cleanup(bridge); agp_backend_cleanup(bridge);
inter_module_unregister("drm_agp"); inter_module_unregister("drm_agp");
......
...@@ -671,20 +671,6 @@ int agp_generic_create_gatt_table(void) ...@@ -671,20 +671,6 @@ int agp_generic_create_gatt_table(void)
} }
EXPORT_SYMBOL(agp_generic_create_gatt_table); EXPORT_SYMBOL(agp_generic_create_gatt_table);
int agp_generic_suspend(void)
{
return 0;
}
EXPORT_SYMBOL(agp_generic_suspend);
void agp_generic_resume(void)
{
return;
}
EXPORT_SYMBOL(agp_generic_resume);
int agp_generic_free_gatt_table(void) int agp_generic_free_gatt_table(void)
{ {
int page_order; int page_order;
......
...@@ -551,8 +551,6 @@ struct agp_bridge_driver intel_i460_driver = { ...@@ -551,8 +551,6 @@ struct agp_bridge_driver intel_i460_driver = {
#endif #endif
.alloc_by_type = agp_generic_alloc_by_type, .alloc_by_type = agp_generic_alloc_by_type,
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
.cant_use_aperture = 1, .cant_use_aperture = 1,
}; };
......
...@@ -782,11 +782,6 @@ static int intel_845_configure(void) ...@@ -782,11 +782,6 @@ static int intel_845_configure(void)
return 0; return 0;
} }
static void intel_845_resume(void)
{
intel_845_configure();
}
static int intel_850_configure(void) static int intel_850_configure(void)
{ {
u32 temp; u32 temp;
...@@ -908,11 +903,6 @@ static unsigned long intel_mask_memory(unsigned long addr, int type) ...@@ -908,11 +903,6 @@ static unsigned long intel_mask_memory(unsigned long addr, int type)
return addr | agp_bridge->driver->masks[0].mask; return addr | agp_bridge->driver->masks[0].mask;
} }
static void intel_resume(void)
{
intel_configure();
}
/* Setup function */ /* Setup function */
static struct gatt_mask intel_generic_masks[] = static struct gatt_mask intel_generic_masks[] =
{ {
...@@ -976,8 +966,6 @@ struct agp_bridge_driver intel_generic_driver = { ...@@ -976,8 +966,6 @@ struct agp_bridge_driver intel_generic_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = intel_resume,
}; };
struct agp_bridge_driver intel_810_driver = { struct agp_bridge_driver intel_810_driver = {
...@@ -1002,8 +990,6 @@ struct agp_bridge_driver intel_810_driver = { ...@@ -1002,8 +990,6 @@ struct agp_bridge_driver intel_810_driver = {
.free_by_type = intel_i810_free_by_type, .free_by_type = intel_i810_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
...@@ -1028,8 +1014,6 @@ struct agp_bridge_driver intel_815_driver = { ...@@ -1028,8 +1014,6 @@ struct agp_bridge_driver intel_815_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver intel_830_driver = { struct agp_bridge_driver intel_830_driver = {
...@@ -1054,8 +1038,6 @@ struct agp_bridge_driver intel_830_driver = { ...@@ -1054,8 +1038,6 @@ struct agp_bridge_driver intel_830_driver = {
.free_by_type = intel_i810_free_by_type, .free_by_type = intel_i810_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
...@@ -1080,8 +1062,6 @@ struct agp_bridge_driver intel_820_driver = { ...@@ -1080,8 +1062,6 @@ struct agp_bridge_driver intel_820_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver intel_830mp_driver = { struct agp_bridge_driver intel_830mp_driver = {
...@@ -1105,8 +1085,6 @@ struct agp_bridge_driver intel_830mp_driver = { ...@@ -1105,8 +1085,6 @@ struct agp_bridge_driver intel_830mp_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver intel_840_driver = { struct agp_bridge_driver intel_840_driver = {
...@@ -1130,8 +1108,6 @@ struct agp_bridge_driver intel_840_driver = { ...@@ -1130,8 +1108,6 @@ struct agp_bridge_driver intel_840_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver intel_845_driver = { struct agp_bridge_driver intel_845_driver = {
...@@ -1155,8 +1131,6 @@ struct agp_bridge_driver intel_845_driver = { ...@@ -1155,8 +1131,6 @@ struct agp_bridge_driver intel_845_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = intel_845_resume,
}; };
struct agp_bridge_driver intel_850_driver = { struct agp_bridge_driver intel_850_driver = {
...@@ -1180,8 +1154,6 @@ struct agp_bridge_driver intel_850_driver = { ...@@ -1180,8 +1154,6 @@ struct agp_bridge_driver intel_850_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver intel_860_driver = { struct agp_bridge_driver intel_860_driver = {
...@@ -1205,8 +1177,6 @@ struct agp_bridge_driver intel_860_driver = { ...@@ -1205,8 +1177,6 @@ struct agp_bridge_driver intel_860_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver intel_7505_driver = { struct agp_bridge_driver intel_7505_driver = {
...@@ -1230,8 +1200,6 @@ struct agp_bridge_driver intel_7505_driver = { ...@@ -1230,8 +1200,6 @@ struct agp_bridge_driver intel_7505_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
static int find_i810(u16 device, const char *name) static int find_i810(u16 device, const char *name)
...@@ -1436,6 +1404,23 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) ...@@ -1436,6 +1404,23 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
agp_put_bridge(bridge); agp_put_bridge(bridge);
} }
static int agp_intel_suspend(struct pci_dev *dev, u32 state)
{
return 0;
}
static int agp_intel_resume(struct pci_dev *pdev)
{
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
if (bridge->driver == &intel_generic_driver)
intel_configure();
else if (bridge->driver == &intel_845_driver)
intel_845_configure();
return 0;
}
static struct pci_device_id agp_intel_pci_table[] __initdata = { static struct pci_device_id agp_intel_pci_table[] __initdata = {
{ {
.class = (PCI_CLASS_BRIDGE_HOST << 8), .class = (PCI_CLASS_BRIDGE_HOST << 8),
...@@ -1455,6 +1440,8 @@ static struct __initdata pci_driver agp_intel_pci_driver = { ...@@ -1455,6 +1440,8 @@ static struct __initdata pci_driver agp_intel_pci_driver = {
.id_table = agp_intel_pci_table, .id_table = agp_intel_pci_table,
.probe = agp_intel_probe, .probe = agp_intel_probe,
.remove = agp_intel_remove, .remove = agp_intel_remove,
.suspend = agp_intel_suspend,
.resume = agp_intel_resume,
}; };
/* intel_agp_init() must not be declared static for explicit /* intel_agp_init() must not be declared static for explicit
......
...@@ -263,8 +263,6 @@ struct agp_bridge_driver nvidia_driver = { ...@@ -263,8 +263,6 @@ struct agp_bridge_driver nvidia_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
static int __init agp_nvidia_probe(struct pci_dev *pdev, static int __init agp_nvidia_probe(struct pci_dev *pdev,
......
...@@ -107,8 +107,6 @@ struct agp_bridge_driver sis_driver = { ...@@ -107,8 +107,6 @@ struct agp_bridge_driver sis_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_device_ids sis_agp_device_ids[] __initdata = struct agp_device_ids sis_agp_device_ids[] __initdata =
......
...@@ -440,8 +440,6 @@ struct agp_bridge_driver sworks_driver = { ...@@ -440,8 +440,6 @@ struct agp_bridge_driver sworks_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
static int __init agp_serverworks_probe(struct pci_dev *pdev, static int __init agp_serverworks_probe(struct pci_dev *pdev,
......
...@@ -195,8 +195,6 @@ struct agp_bridge_driver via_agp3_driver = { ...@@ -195,8 +195,6 @@ struct agp_bridge_driver via_agp3_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
struct agp_bridge_driver via_driver = { struct agp_bridge_driver via_driver = {
...@@ -220,8 +218,6 @@ struct agp_bridge_driver via_driver = { ...@@ -220,8 +218,6 @@ struct agp_bridge_driver via_driver = {
.free_by_type = agp_generic_free_by_type, .free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page, .agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page, .agp_destroy_page = agp_generic_destroy_page,
.suspend = agp_generic_suspend,
.resume = agp_generic_resume,
}; };
static struct agp_device_ids via_agp_device_ids[] __initdata = static struct agp_device_ids via_agp_device_ids[] __initdata =
......
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