FreeBSD/sys/dev/drm2/drm_agpsupport.c
/**
 * Bind AGP memory into the GATT (ioctl)
 *
 * \param inode device inode.
 * \param file_priv DRM file private.
 * \param cmd command.
 * \param arg pointer to a drm_agp_binding structure.
 * \return zero on success or a negative number on failure.
 *
 * Verifies the AGP device is present and has been acquired and that no memory
 * is currently bound into the GATT. Looks-up the AGP memory entry and passes
 * it to bind_agp() function.
 */
Bind AGP memory into the GATT (ioctl)
\param inode device inode.
\param file_priv DRM file private.
\param cmd command.
\param arg pointer to a drm_agp_binding structure.
\return zero on success or a negative number on failure.

Verifies the AGP device is present and has been acquired and that no memory
is currently bound into the GATT. Looks-up the AGP memory entry and passes
it to bind_agp() function.
Bind AGP memory into the GATT ( ioctl ) \ param inode device inode . \ param file_priv DRM file private . \ param cmd command . \ param arg pointer to a drm_agp_binding structure . \ return zero on success or a negative number on failure . Verifies the AGP device is present and has been acquired and that no memory is currently bound into the GATT . Looks - up the AGP memory entry and passes it to bind_agp () function .
int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
{
	struct drm_agp_mem *entry;
	int retcode;
	int page;
	if (!dev->agp || !dev->agp->acquired)
		return -EINVAL;
	if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
		return -EINVAL;
	if (entry->bound)
		return -EINVAL;
	page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE;
	if ((retcode = drm_bind_agp(entry->memory, page)))
		return retcode;
	entry->bound = dev->agp->base + (page << PAGE_SHIFT);
	DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
		  dev->agp->base, entry->bound);
	return 0;
}
int drm_agp_bind ( struct drm_device * dev , struct drm_agp_binding * request ) { struct drm_agp_mem * entry ; int retcode ; int page ; if ( ! dev -> agp || ! dev -> agp -> acquired ) return - EINVAL ; if ( ! ( entry = drm_agp_lookup_entry ( dev , request -> handle ) ) ) return - EINVAL ; if ( entry -> bound ) return - EINVAL ; page = ( request -> offset + PAGE_SIZE - 1 ) / PAGE_SIZE ; if ( ( retcode = drm_bind_agp ( entry -> memory , page ) ) ) return retcode ; entry -> bound = dev -> agp -> base + ( page << PAGE_SHIFT ) ; DRM_DEBUG ( " \n " , dev -> agp -> base , entry -> bound ) ; return 0 ; }
Bind AGP memory into the GATT (ioctl)
 \param inode device inode.
Bind AGP memory into the GATT ( ioctl ) \ param inode device inode .