Commit 51e6ed23 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] Add new IDs to VIA AGP.
  [AGPGART] Remove pointless assignment.
  [AGPGART] Remove pointless typedef in ati-agp
  [AGPGART] Prevent (unlikely) memory leak in amd_create_gatt_pages()
  [AGPGART] intel_agp: restore graphics device's pci space early in resume
parents 597049cc 43ed41f6
...@@ -101,6 +101,11 @@ static int amd_create_gatt_pages(int nr_tables) ...@@ -101,6 +101,11 @@ static int amd_create_gatt_pages(int nr_tables)
for (i = 0; i < nr_tables; i++) { for (i = 0; i < nr_tables; i++) {
entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL); entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);
if (entry == NULL) { if (entry == NULL) {
while (i > 0) {
kfree(tables[i-1]);
i--;
}
kfree(tables);
retval = -ENOMEM; retval = -ENOMEM;
break; break;
} }
......
...@@ -655,7 +655,7 @@ static struct pci_device_id agp_amd64_pci_table[] = { ...@@ -655,7 +655,7 @@ static struct pci_device_id agp_amd64_pci_table[] = {
.class = (PCI_CLASS_BRIDGE_HOST << 8), .class = (PCI_CLASS_BRIDGE_HOST << 8),
.class_mask = ~0, .class_mask = ~0,
.vendor = PCI_VENDOR_ID_VIA, .vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8M890CE, .device = PCI_DEVICE_ID_VIA_VT3336,
.subvendor = PCI_ANY_ID, .subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
}, },
......
...@@ -41,18 +41,18 @@ static struct gatt_mask ati_generic_masks[] = ...@@ -41,18 +41,18 @@ static struct gatt_mask ati_generic_masks[] =
}; };
typedef struct _ati_page_map { struct ati_page_map {
unsigned long *real; unsigned long *real;
unsigned long __iomem *remapped; unsigned long __iomem *remapped;
} ati_page_map; };
static struct _ati_generic_private { static struct _ati_generic_private {
volatile u8 __iomem *registers; volatile u8 __iomem *registers;
ati_page_map **gatt_pages; struct ati_page_map **gatt_pages;
int num_tables; int num_tables;
} ati_generic_private; } ati_generic_private;
static int ati_create_page_map(ati_page_map *page_map) static int ati_create_page_map(struct ati_page_map *page_map)
{ {
int i, err = 0; int i, err = 0;
...@@ -82,7 +82,7 @@ static int ati_create_page_map(ati_page_map *page_map) ...@@ -82,7 +82,7 @@ static int ati_create_page_map(ati_page_map *page_map)
} }
static void ati_free_page_map(ati_page_map *page_map) static void ati_free_page_map(struct ati_page_map *page_map)
{ {
unmap_page_from_agp(virt_to_page(page_map->real)); unmap_page_from_agp(virt_to_page(page_map->real));
iounmap(page_map->remapped); iounmap(page_map->remapped);
...@@ -94,8 +94,8 @@ static void ati_free_page_map(ati_page_map *page_map) ...@@ -94,8 +94,8 @@ static void ati_free_page_map(ati_page_map *page_map)
static void ati_free_gatt_pages(void) static void ati_free_gatt_pages(void)
{ {
int i; int i;
ati_page_map **tables; struct ati_page_map **tables;
ati_page_map *entry; struct ati_page_map *entry;
tables = ati_generic_private.gatt_pages; tables = ati_generic_private.gatt_pages;
for (i = 0; i < ati_generic_private.num_tables; i++) { for (i = 0; i < ati_generic_private.num_tables; i++) {
...@@ -112,30 +112,30 @@ static void ati_free_gatt_pages(void) ...@@ -112,30 +112,30 @@ static void ati_free_gatt_pages(void)
static int ati_create_gatt_pages(int nr_tables) static int ati_create_gatt_pages(int nr_tables)
{ {
ati_page_map **tables; struct ati_page_map **tables;
ati_page_map *entry; struct ati_page_map *entry;
int retval = 0; int retval = 0;
int i; int i;
tables = kzalloc((nr_tables + 1) * sizeof(ati_page_map *),GFP_KERNEL); tables = kzalloc((nr_tables + 1) * sizeof(struct ati_page_map *),GFP_KERNEL);
if (tables == NULL) if (tables == NULL)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < nr_tables; i++) { for (i = 0; i < nr_tables; i++) {
entry = kzalloc(sizeof(ati_page_map), GFP_KERNEL); entry = kzalloc(sizeof(struct ati_page_map), GFP_KERNEL);
if (entry == NULL) { if (entry == NULL) {
while (i>0) { while (i > 0) {
kfree (tables[i-1]); kfree(tables[i-1]);
i--; i--;
} }
kfree (tables); kfree(tables);
tables = NULL;
retval = -ENOMEM; retval = -ENOMEM;
break; break;
} }
tables[i] = entry; tables[i] = entry;
retval = ati_create_page_map(entry); retval = ati_create_page_map(entry);
if (retval != 0) break; if (retval != 0)
break;
} }
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;
...@@ -340,7 +340,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start, ...@@ -340,7 +340,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
static int ati_create_gatt_table(struct agp_bridge_data *bridge) static int ati_create_gatt_table(struct agp_bridge_data *bridge)
{ {
struct aper_size_info_lvl2 *value; struct aper_size_info_lvl2 *value;
ati_page_map page_dir; struct ati_page_map page_dir;
unsigned long addr; unsigned long addr;
int retval; int retval;
u32 temp; u32 temp;
...@@ -400,7 +400,7 @@ static int ati_create_gatt_table(struct agp_bridge_data *bridge) ...@@ -400,7 +400,7 @@ static int ati_create_gatt_table(struct agp_bridge_data *bridge)
static int ati_free_gatt_table(struct agp_bridge_data *bridge) static int ati_free_gatt_table(struct agp_bridge_data *bridge)
{ {
ati_page_map page_dir; struct ati_page_map page_dir;
page_dir.real = (unsigned long *)agp_bridge->gatt_table_real; page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table; page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table;
......
...@@ -1955,6 +1955,15 @@ static int agp_intel_resume(struct pci_dev *pdev) ...@@ -1955,6 +1955,15 @@ static int agp_intel_resume(struct pci_dev *pdev)
pci_restore_state(pdev); pci_restore_state(pdev);
/* We should restore our graphics device's config space,
* as host bridge (00:00) resumes before graphics device (02:00),
* then our access to its pci space can work right.
*/
if (intel_i810_private.i810_dev)
pci_restore_state(intel_i810_private.i810_dev);
if (intel_i830_private.i830_dev)
pci_restore_state(intel_i830_private.i830_dev);
if (bridge->driver == &intel_generic_driver) if (bridge->driver == &intel_generic_driver)
intel_configure(); intel_configure();
else if (bridge->driver == &intel_850_driver) else if (bridge->driver == &intel_850_driver)
......
...@@ -380,9 +380,23 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = ...@@ -380,9 +380,23 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
/* P4M800CE */ /* P4M800CE */
{ {
.device_id = PCI_DEVICE_ID_VIA_P4M800CE, .device_id = PCI_DEVICE_ID_VIA_P4M800CE,
.chipset_name = "P4M800CE", .chipset_name = "VT3314",
},
/* CX700 */
{
.device_id = PCI_DEVICE_ID_VIA_CX700,
.chipset_name = "CX700",
},
/* VT3336 */
{
.device_id = PCI_DEVICE_ID_VIA_VT3336,
.chipset_name = "VT3336",
},
/* P4M890 */
{
.device_id = PCI_DEVICE_ID_VIA_P4M890,
.chipset_name = "P4M890",
}, },
{ }, /* dummy final entry, always present */ { }, /* dummy final entry, always present */
}; };
...@@ -524,6 +538,9 @@ static const struct pci_device_id agp_via_pci_table[] = { ...@@ -524,6 +538,9 @@ static const struct pci_device_id agp_via_pci_table[] = {
ID(PCI_DEVICE_ID_VIA_83_87XX_1), ID(PCI_DEVICE_ID_VIA_83_87XX_1),
ID(PCI_DEVICE_ID_VIA_3296_0), ID(PCI_DEVICE_ID_VIA_3296_0),
ID(PCI_DEVICE_ID_VIA_P4M800CE), ID(PCI_DEVICE_ID_VIA_P4M800CE),
ID(PCI_DEVICE_ID_VIA_CX700),
ID(PCI_DEVICE_ID_VIA_VT3336),
ID(PCI_DEVICE_ID_VIA_P4M890),
{ } { }
}; };
......
...@@ -1277,7 +1277,8 @@ ...@@ -1277,7 +1277,8 @@
#define PCI_DEVICE_ID_VIA_3296_0 0x0296 #define PCI_DEVICE_ID_VIA_3296_0 0x0296
#define PCI_DEVICE_ID_VIA_8363_0 0x0305 #define PCI_DEVICE_ID_VIA_8363_0 0x0305
#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 #define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
#define PCI_DEVICE_ID_VIA_K8M890CE 0x0336 #define PCI_DEVICE_ID_VIA_P4M890 0x0327
#define PCI_DEVICE_ID_VIA_VT3336 0x0336
#define PCI_DEVICE_ID_VIA_8371_0 0x0391 #define PCI_DEVICE_ID_VIA_8371_0 0x0391
#define PCI_DEVICE_ID_VIA_8501_0 0x0501 #define PCI_DEVICE_ID_VIA_8501_0 0x0501
#define PCI_DEVICE_ID_VIA_82C561 0x0561 #define PCI_DEVICE_ID_VIA_82C561 0x0561
......
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