Lines Matching full:bridge

70 	struct agp_bridge_data *bridge;  in agp_backend_acquire()  local
72 bridge = agp_find_bridge(pdev); in agp_backend_acquire()
74 if (!bridge) in agp_backend_acquire()
77 if (atomic_read(&bridge->agp_in_use)) in agp_backend_acquire()
79 atomic_inc(&bridge->agp_in_use); in agp_backend_acquire()
80 return bridge; in agp_backend_acquire()
87 * @bridge: the AGP backend to release
94 void agp_backend_release(struct agp_bridge_data *bridge) in agp_backend_release() argument
97 if (bridge) in agp_backend_release()
98 atomic_dec(&bridge->agp_in_use); in agp_backend_release()
139 static int agp_backend_initialize(struct agp_bridge_data *bridge) in agp_backend_initialize() argument
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()
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()
168 if (bridge->driver->create_gatt_table(bridge)) { in agp_backend_initialize()
169 dev_err(&bridge->dev->dev, 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()
187 if (bridge->driver->configure()) { in agp_backend_initialize()
188 dev_err(&bridge->dev->dev, "error configuring host chipset\n"); 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()
214 static void agp_backend_cleanup(struct agp_bridge_data *bridge) in agp_backend_cleanup() argument
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()
239 struct agp_bridge_data *bridge; in agp_alloc_bridge() local
241 bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); in agp_alloc_bridge()
242 if (!bridge) in agp_alloc_bridge()
245 atomic_set(&bridge->agp_in_use, 0); in agp_alloc_bridge()
246 atomic_set(&bridge->current_memory_agp, 0); in agp_alloc_bridge()
249 agp_bridge = bridge; in agp_alloc_bridge()
251 return bridge; in agp_alloc_bridge()
256 void agp_put_bridge(struct agp_bridge_data *bridge) in agp_put_bridge() argument
258 kfree(bridge); in agp_put_bridge()
266 int agp_add_bridge(struct agp_bridge_data *bridge) in agp_add_bridge() argument
275 if (!bridge->dev) { 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()
288 error = agp_backend_initialize(bridge); in agp_add_bridge()
290 dev_info(&bridge->dev->dev, in agp_add_bridge()
298 dev_info(&bridge->dev->dev, in agp_add_bridge()
303 dev_info(&bridge->dev->dev, "AGP aperture is %dM @ 0x%lx\n", in agp_add_bridge()
304 bridge->driver->fetch_size(), bridge->gart_bus_addr); in agp_add_bridge()
308 list_add(&bridge->list, &agp_bridges); in agp_add_bridge()
312 agp_backend_cleanup(bridge); in agp_add_bridge()
314 module_put(bridge->driver->owner); in agp_add_bridge()
316 agp_put_bridge(bridge); in agp_add_bridge()
322 void agp_remove_bridge(struct agp_bridge_data *bridge) in agp_remove_bridge() argument
324 agp_backend_cleanup(bridge); in agp_remove_bridge()
325 list_del(&bridge->list); in agp_remove_bridge()
328 module_put(bridge->driver->owner); in agp_remove_bridge()