/* * AGPGART driver backend routines. * Copyright (C) 2004 Silicon Graphics, Inc. * Copyright (C) 2002-2003 Dave Jones. * Copyright (C) 1999 Jeff Hartmann. * Copyright (C) 1999 Precision Insight, Inc. * Copyright (C) 1999 Xi Graphics, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * JEFF HARTMANN, DAVE JONES, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * TODO: * - Allocate more than order 0 pages to avoid too much linear map splitting.
*/ #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/pagemap.h> #include <linux/miscdevice.h> #include <linux/pm.h> #include <linux/agp_backend.h> #include <linux/agpgart.h> #include <linux/vmalloc.h> #include <asm/io.h> #include"agp.h"
/* Due to XFree86 brain-damage, we can't go to 1.0 until they * fix some real stupidity. It's only by chance we can bump
* past 0.99 at all due to some boolean logic error. */ #define AGPGART_VERSION_MAJOR 0 #define AGPGART_VERSION_MINOR 103 staticconststruct agp_version agp_current_version =
{
.major = AGPGART_VERSION_MAJOR,
.minor = AGPGART_VERSION_MINOR,
};
/** * agp_backend_acquire - attempt to acquire an agp backend. * @pdev: the PCI device *
*/ struct agp_bridge_data *agp_backend_acquire(struct pci_dev *pdev)
{ struct agp_bridge_data *bridge;
bridge = agp_find_bridge(pdev);
if (!bridge) return NULL;
if (atomic_read(&bridge->agp_in_use)) return NULL;
atomic_inc(&bridge->agp_in_use); return bridge;
}
EXPORT_SYMBOL(agp_backend_acquire);
/** * agp_backend_release - release the lock on the agp backend. * @bridge: the AGP backend to release * * The caller must insure that the graphics aperture translation table * is read for use by another entity. * * (Ensure that all memory it bound is unbound.)
*/ void agp_backend_release(struct agp_bridge_data *bridge)
{
if (bridge)
atomic_dec(&bridge->agp_in_use);
}
EXPORT_SYMBOL(agp_backend_release);
err_out: if (bridge->driver->needs_scratch_page) { struct page *page = bridge->scratch_page_page;
bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_FREE);
} if (got_gatt)
bridge->driver->free_gatt_table(bridge); if (got_keylist) {
vfree(bridge->key_list);
bridge->key_list = NULL;
} return rc;
}
/* cannot be __exit b/c as it could be called from __init code */ staticvoid agp_backend_cleanup(struct agp_bridge_data *bridge)
{ if (bridge->driver->cleanup)
bridge->driver->cleanup(); if (bridge->driver->free_gatt_table)
bridge->driver->free_gatt_table(bridge);
vfree(bridge->key_list);
bridge->key_list = NULL;
if (bridge->driver->agp_destroy_page &&
bridge->driver->needs_scratch_page) { struct page *page = bridge->scratch_page_page;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.