Lines Matching +full:software +full:- +full:driver
2 * AGPGART driver backend routines.
4 * Copyright (C) 2002-2003 Dave Jones.
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
25 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * - Allocate more than order 0 pages to avoid too much linear map splitting.
43 /* Due to XFree86 brain-damage, we can't go to 1.0 until they
64 * agp_backend_acquire - attempt to acquire an agp backend.
77 if (atomic_read(&bridge->agp_in_use)) in agp_backend_acquire()
79 atomic_inc(&bridge->agp_in_use); in agp_backend_acquire()
86 * agp_backend_release - release the lock on the agp backend.
98 atomic_dec(&bridge->agp_in_use); in agp_backend_release()
120 memory = totalram_pages() >> (20 - PAGE_SHIFT); in agp_find_max()
122 memory = totalram_pages() << (PAGE_SHIFT - 20); in agp_find_max()
129 result = maxes_table[index - 1].agp + in agp_find_max()
130 ( (memory - maxes_table[index - 1].mem) * in agp_find_max()
131 (maxes_table[index].agp - maxes_table[index - 1].agp)) / in agp_find_max()
132 (maxes_table[index].mem - maxes_table[index - 1].mem); in agp_find_max()
134 result = result << (20 - PAGE_SHIFT); in agp_find_max()
143 bridge->max_memory_agp = agp_find_max(); in agp_backend_initialize()
144 bridge->version = &agp_current_version; in agp_backend_initialize()
146 if (bridge->driver->needs_scratch_page) { in agp_backend_initialize()
147 struct page *page = bridge->driver->agp_alloc_page(bridge); in agp_backend_initialize()
150 dev_err(&bridge->dev->dev, in agp_backend_initialize()
152 return -ENOMEM; in agp_backend_initialize()
155 bridge->scratch_page_page = page; in agp_backend_initialize()
156 bridge->scratch_page_dma = page_to_phys(page); in agp_backend_initialize()
158 bridge->scratch_page = bridge->driver->mask_memory(bridge, in agp_backend_initialize()
159 bridge->scratch_page_dma, 0); in agp_backend_initialize()
162 size_value = bridge->driver->fetch_size(); in agp_backend_initialize()
164 dev_err(&bridge->dev->dev, "can't determine aperture size\n"); in agp_backend_initialize()
165 rc = -EINVAL; in agp_backend_initialize()
168 if (bridge->driver->create_gatt_table(bridge)) { in agp_backend_initialize()
169 dev_err(&bridge->dev->dev, in agp_backend_initialize()
171 rc = -ENOMEM; in agp_backend_initialize()
176 bridge->key_list = vzalloc(PAGE_SIZE * 4); in agp_backend_initialize()
177 if (bridge->key_list == NULL) { in agp_backend_initialize()
178 dev_err(&bridge->dev->dev, in agp_backend_initialize()
180 rc = -ENOMEM; in agp_backend_initialize()
187 if (bridge->driver->configure()) { in agp_backend_initialize()
188 dev_err(&bridge->dev->dev, "error configuring host chipset\n"); in agp_backend_initialize()
189 rc = -EINVAL; in agp_backend_initialize()
192 INIT_LIST_HEAD(&bridge->mapped_list); in agp_backend_initialize()
193 spin_lock_init(&bridge->mapped_lock); in agp_backend_initialize()
198 if (bridge->driver->needs_scratch_page) { in agp_backend_initialize()
199 struct page *page = bridge->scratch_page_page; in agp_backend_initialize()
201 bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_UNMAP); in agp_backend_initialize()
202 bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_FREE); in agp_backend_initialize()
205 bridge->driver->free_gatt_table(bridge); in agp_backend_initialize()
207 vfree(bridge->key_list); in agp_backend_initialize()
208 bridge->key_list = NULL; in agp_backend_initialize()
216 if (bridge->driver->cleanup) in agp_backend_cleanup()
217 bridge->driver->cleanup(); in agp_backend_cleanup()
218 if (bridge->driver->free_gatt_table) in agp_backend_cleanup()
219 bridge->driver->free_gatt_table(bridge); in agp_backend_cleanup()
221 vfree(bridge->key_list); in agp_backend_cleanup()
222 bridge->key_list = NULL; in agp_backend_cleanup()
224 if (bridge->driver->agp_destroy_page && in agp_backend_cleanup()
225 bridge->driver->needs_scratch_page) { in agp_backend_cleanup()
226 struct page *page = bridge->scratch_page_page; in agp_backend_cleanup()
228 bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_UNMAP); in agp_backend_cleanup()
229 bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_FREE); in agp_backend_cleanup()
245 atomic_set(&bridge->agp_in_use, 0); in agp_alloc_bridge()
246 atomic_set(&bridge->current_memory_agp, 0); in agp_alloc_bridge()
271 error = -ENODEV; in agp_add_bridge()
275 if (!bridge->dev) { in agp_add_bridge()
277 error = -EINVAL; in agp_add_bridge()
281 /* Grab reference on the chipset driver. */ in agp_add_bridge()
282 if (!try_module_get(bridge->driver->owner)) { in agp_add_bridge()
283 dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); in agp_add_bridge()
284 error = -EINVAL; in agp_add_bridge()
290 dev_info(&bridge->dev->dev, in agp_add_bridge()
296 dev_info(&bridge->dev->dev, "AGP aperture is %dM @ 0x%lx\n", in agp_add_bridge()
297 bridge->driver->fetch_size(), bridge->gart_bus_addr); in agp_add_bridge()
301 list_add(&bridge->list, &agp_bridges); in agp_add_bridge()
305 module_put(bridge->driver->owner); in agp_add_bridge()
316 list_del(&bridge->list); in agp_remove_bridge()
317 module_put(bridge->driver->owner); in agp_remove_bridge()
351 MODULE_DESCRIPTION("AGP GART driver");