[PATCH 17/23] agp: Make agp_generic_[create|free]_gatt_table be aware of PCI API.

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


In case the platform does not use the PCI API, we want to
still use the old mechanism of saving the gatt_bus_addr.

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

diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index b21eebb..534dccb 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -911,6 +911,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
temp = bridge->current_size;
size = page_order = num_entries = 0;

+ bridge->gatt_bus_addr = DMA_ERROR_CODE;
if (bridge->driver->size_type != FIXED_APER_SIZE) {
do {
switch (bridge->driver->size_type) {
@@ -999,10 +1000,12 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
ClearPageReserved(page);

free_gatt_pages(bridge, page_order);
-
+ bridge->gatt_bus_addr = DMA_ERROR_CODE;
return -ENOMEM;
}
- bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real);
+ /* If using PCI API, alloc_gatt_pages would fill in gatt_bus_addr. */
+ if (bridge->gatt_bus_addr == DMA_ERROR_CODE)
+ bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real);

/* AK: bogus, should encode addresses > 4GB */
for (i = 0; i < num_entries; i++) {
--
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/