[PATCH 16/23] agp: save the size of GATT table.

From: Konrad Rzeszutek Wilk
Date: Mon Dec 06 2010 - 18:26:44 EST


From: Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx>

We need this extra value when we use the PCI API for
de-allocating the GART pages.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
drivers/char/agp/agp.h | 1 +
drivers/char/agp/generic.c | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 6c60d68..6569d01 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -133,6 +133,7 @@ struct agp_bridge_data {
struct pci_dev *dev;
u32 __iomem *gatt_table;
u32 *gatt_table_real;
+ ssize_t gatt_table_size;
unsigned long scratch_page;
struct page *scratch_page_page;
dma_addr_t scratch_page_dma;
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 4cf3f94..b21eebb 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -974,14 +974,14 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
if (table == NULL)
return -ENOMEM;

- table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
+ bridge->gatt_table_size = PAGE_SIZE * (1 << page_order);
+ table_end = table + bridge->gatt_table_size - 1;

for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
SetPageReserved(page);

bridge->gatt_table_real = (u32 *) table;
agp_gatt_table = (void *)table;
-
bridge->driver->cache_flush();
#ifdef CONFIG_X86
if (set_memory_uc((unsigned long)table, 1 << page_order))
@@ -990,7 +990,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
bridge->gatt_table = (void *)table;
#else
bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
- (PAGE_SIZE * (1 << page_order)));
+ bridge->gatt_table_size);
bridge->driver->cache_flush();
#endif

@@ -1055,7 +1055,7 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
iounmap(bridge->gatt_table);
#endif
table = (char *) bridge->gatt_table_real;
- table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
+ table_end = table + bridge->gatt_table_size - 1;

for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
ClearPageReserved(page);
@@ -1066,7 +1066,7 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
bridge->gatt_table = NULL;
bridge->gatt_table_real = NULL;
bridge->gatt_bus_addr = 0;
-
+ bridge->gatt_table_size = 0;
return 0;
}
EXPORT_SYMBOL(agp_generic_free_gatt_table);
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/