da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * drm_context.h -- IOCTLs for generic contexts -*- linux-c -*-
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * All Rights Reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Permission is hereby granted, free of charge, to any person obtaining a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * copy of this software and associated documentation files (the "Software"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * to deal in the Software without restriction, including without limitation
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the rights to use, copy, modify, merge, publish, distribute, sublicense,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and/or sell copies of the Software, and to permit persons to whom the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Software is furnished to do so, subject to the following conditions:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The above copyright notice and this permission notice (including the next
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * paragraph) shall be included in all copies or substantial portions of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Software.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * OTHER DEALINGS IN THE SOFTWARE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Authors:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Rickard E. (Rik) Faith <faith@valinux.com>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Gareth Hughes <gareth@valinux.com>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic inline int
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (;;) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (b);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Context bitmap support
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (ctx_handle < 0 || ctx_handle >= DRM_MAX_CTXBITMAP ||
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin invalid context handle: %d\n",
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* Is supposed to return -1 if any error by calling functions */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* max_context == 1 at this point */
DRM_UNLOCK();
DRM_UNLOCK();
return (bit);
DRM_LOCK();
DRM_UNLOCK();
return (ENOMEM);
DRM_UNLOCK();
for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
DRM_LOCK();
DRM_UNLOCK();
#ifdef _MULTI_DATAMODEL
sizeof (drm_ctx_priv_map_32_t));
sizeof (request));
DRM_LOCK();
DRM_UNLOCK();
return (EINVAL);
DRM_UNLOCK();
if (!map)
return (EINVAL);
#ifdef _MULTI_DATAMODEL
sizeof (drm_ctx_priv_map_32_t));
#ifdef _MULTI_DATAMODEL
sizeof (drm_ctx_priv_map_32_t));
DRM_LOCK();
goto bad;
goto bad;
DRM_UNLOCK();
bad:
DRM_UNLOCK();
return (EINVAL);
return (EBUSY);
#ifdef _MULTI_DATAMODEL
for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
#ifdef _MULTI_DATAMODEL
sizeof (drm_ctx_res_32_t));
return (ENOMEM);
DRM_LOCK();
DRM_UNLOCK();