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] 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
  • Loading branch information
Linus Torvalds committed Jan 30, 2007
2 parents 597049c + 43ed41f commit 51e6ed2
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 22 deletions.
5 changes: 5 additions & 0 deletions drivers/char/agp/amd-k7-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ static int amd_create_gatt_pages(int nr_tables)
for (i = 0; i < nr_tables; i++) {
entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);
if (entry == NULL) {
while (i > 0) {
kfree(tables[i-1]);
i--;
}
kfree(tables);
retval = -ENOMEM;
break;
}
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 @@ -655,7 +655,7 @@ static struct pci_device_id agp_amd64_pci_table[] = {
.class = (PCI_CLASS_BRIDGE_HOST << 8),
.class_mask = ~0,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_K8M890CE,
.device = PCI_DEVICE_ID_VIA_VT3336,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},
Expand Down
36 changes: 18 additions & 18 deletions drivers/char/agp/ati-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 __iomem *remapped;
} ati_page_map;
};

static struct _ati_generic_private {
volatile u8 __iomem *registers;
ati_page_map **gatt_pages;
struct ati_page_map **gatt_pages;
int num_tables;
} 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;

Expand Down Expand Up @@ -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));
iounmap(page_map->remapped);
Expand All @@ -94,8 +94,8 @@ static void ati_free_page_map(ati_page_map *page_map)
static void ati_free_gatt_pages(void)
{
int i;
ati_page_map **tables;
ati_page_map *entry;
struct ati_page_map **tables;
struct ati_page_map *entry;

tables = ati_generic_private.gatt_pages;
for (i = 0; i < ati_generic_private.num_tables; i++) {
Expand All @@ -112,30 +112,30 @@ static void ati_free_gatt_pages(void)

static int ati_create_gatt_pages(int nr_tables)
{
ati_page_map **tables;
ati_page_map *entry;
struct ati_page_map **tables;
struct ati_page_map *entry;
int retval = 0;
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)
return -ENOMEM;

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) {
while (i>0) {
kfree (tables[i-1]);
while (i > 0) {
kfree(tables[i-1]);
i--;
}
kfree (tables);
tables = NULL;
kfree(tables);
retval = -ENOMEM;
break;
}
tables[i] = 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.gatt_pages = tables;
Expand Down Expand Up @@ -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)
{
struct aper_size_info_lvl2 *value;
ati_page_map page_dir;
struct ati_page_map page_dir;
unsigned long addr;
int retval;
u32 temp;
Expand Down Expand Up @@ -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)
{
ati_page_map page_dir;
struct ati_page_map page_dir;

page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table;
Expand Down
9 changes: 9 additions & 0 deletions drivers/char/agp/intel-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,15 @@ static int agp_intel_resume(struct pci_dev *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)
intel_configure();
else if (bridge->driver == &intel_850_driver)
Expand Down
21 changes: 19 additions & 2 deletions drivers/char/agp/via-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,23 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
/* 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 */
};

Expand Down Expand Up @@ -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_3296_0),
ID(PCI_DEVICE_ID_VIA_P4M800CE),
ID(PCI_DEVICE_ID_VIA_CX700),
ID(PCI_DEVICE_ID_VIA_VT3336),
ID(PCI_DEVICE_ID_VIA_P4M890),
{ }
};

Expand Down
3 changes: 2 additions & 1 deletion include/linux/pci_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,8 @@
#define PCI_DEVICE_ID_VIA_3296_0 0x0296
#define PCI_DEVICE_ID_VIA_8363_0 0x0305
#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_8501_0 0x0501
#define PCI_DEVICE_ID_VIA_82C561 0x0561
Expand Down

0 comments on commit 51e6ed2

Please sign in to comment.