1450N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 1450N/A * \author Rickard E. (Rik) Faith <faith@valinux.com> 1450N/A * \author Gareth Hughes <gareth@valinux.com> 1450N/A * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 1450N/A * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 1450N/A * Copyright (c) 2009, 2013, Intel Corporation. 1450N/A * Permission is hereby granted, free of charge, to any person obtaining a 1450N/A * copy of this software and associated documentation files (the "Software"), 1450N/A * to deal in the Software without restriction, including without limitation 1450N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1450N/A * and/or sell copies of the Software, and to permit persons to whom the 1450N/A * Software is furnished to do so, subject to the following conditions: 1450N/A * The above copyright notice and this permission notice (including the next 1450N/A * paragraph) shall be included in all copies or substantial portions of the 1450N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1450N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1450N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1450N/A * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 1450N/A * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1450N/A * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 1450N/A * OTHER DEALINGS IN THE SOFTWARE. 1450N/A * The agpa_key field of struct agp_allocate_t actually is 1450N/A * an index to an array. It can be zero. But we will use 1450N/A * this agpa_key as a handle returned to userland. Generally, 1450N/A * 0 is not a valid value for a handle, so we add an offset 1450N/A * to the key to get a handle. 1450N/A * \param inode device inode. 1450N/A * \param file_priv DRM file private. 1450N/A * \param arg pointer to a (output) drm_agp_info structure. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device has been initialized and acquired and fills in the 1450N/A * drm_agp_info structure with the information in drm_agp_head::agp_info. 1450N/A * \param dev DRM device that is to acquire AGP. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device hasn't been acquired before and calls 1450N/A * Acquire the AGP device (ioctl). 1450N/A * \param inode device inode. 1450N/A * \param file_priv DRM file private. 1450N/A * \param arg user argument. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device hasn't been acquired before and calls 1450N/A * \param dev DRM device that is to release AGP. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device has been acquired and calls \c agp_backend_release. 1450N/A * \param dev DRM device that has previously acquired AGP. 1450N/A * \param mode Requested AGP mode. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device has been acquired but not enabled, and calls 1450N/A * \param inode device inode. 1450N/A * \param file_priv file private pointer. 1450N/A * \param arg pointer to a drm_agp_buffer structure. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device is present and has been acquired, allocates the 1450N/A * memory via alloc_agp() and creates a drm_agp_mem entry for it. 1450N/A * Search for the AGP memory entry associated with a handle. 1450N/A * \param dev DRM device structure. 1450N/A * \param handle AGP memory handle. 1450N/A * \return pointer to the drm_agp_mem structure associated with \p handle. 1450N/A * Walks through drm_agp_head::memory until finding a matching handle. 1450N/A * Unbind AGP memory from the GATT (ioctl). 1450N/A * \param inode device inode. 1450N/A * \param file_priv DRM file private. 1450N/A * \param arg pointer to a drm_agp_binding structure. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device is present and acquired, looks-up the AGP memory 1450N/A * entry and passes it to the unbind_agp() function. 1450N/A * Bind AGP memory into the GATT (ioctl) 1450N/A * \param inode device inode. 1450N/A * \param file_priv DRM file private. 1450N/A * \param arg pointer to a drm_agp_binding structure. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device is present and has been acquired and that no memory 1450N/A * is currently bound into the GATT. Looks-up the AGP memory entry and passes 1450N/A * it to bind_agp() function. 1450N/A * \param inode device inode. 1450N/A * \param file_priv DRM file private. 1450N/A * \param arg pointer to a drm_agp_buffer structure. 1450N/A * \return zero on success or a negative number on failure. 1450N/A * Verifies the AGP device is present and has been acquired and looks up the 1450N/A * AGP memory entry. If the memory it's currently bound, unbind it via 1450N/A * unbind_agp(). Frees it via free_agp() as well as the entry itself 1450N/A * and unlinks from the doubly linked list it's inserted in. 1450N/A * Initialize the AGP resources. 1450N/A * \return pointer to a drm_agp_head structure. 1450N/A * Gets the drm_agp_t structure which is made available by the agpgart module 1450N/A * via the inter_module_* functions. Creates and initializes a drm_agp_head 1450N/A * Binds a collection of pages into AGP memory at the given offset, returning 1450N/A * the AGP memory structure containing them. 1450N/A * No reference is held on the pages during this time -- it is up to the