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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Konrad Rzeszutek Wilk
Date: Monday, December 6, 2010 - 4:24 pm

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@oracle.com>
---
 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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 17/23] agp: Make agp_generic_[create|free]_gatt_tab ..., Konrad Rzeszutek Wilk, (Mon Dec 6, 4:24 pm)