235N/A/*
235N/A * file drm_os_solaris.h
606N/A *
742N/A * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
235N/A *
235N/A * Permission is hereby granted, free of charge, to any person obtaining a
235N/A * copy of this software and associated documentation files (the "Software"),
235N/A * to deal in the Software without restriction, including without limitation
235N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
235N/A * and/or sell copies of the Software, and to permit persons to whom the
235N/A * Software is furnished to do so, subject to the following conditions:
235N/A *
235N/A * The above copyright notice and this permission notice (including the next
235N/A * paragraph) shall be included in all copies or substantial portions of the
235N/A * Software.
235N/A *
235N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
235N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
235N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
235N/A * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
235N/A * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
235N/A * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
235N/A * OTHER DEALINGS IN THE SOFTWARE.
235N/A *
235N/A *
235N/A * Solaris OS abstractions
235N/A */
235N/A
235N/A#ifndef _DRM_OS_SOLARIS_H
235N/A#define _DRM_OS_SOLARIS_H
742N/A
235N/A/* Only Solaris builds should be here */
235N/A#if defined(__sun)
235N/A
235N/A#ifndef __user
235N/A#define __user
493N/A#endif
493N/A
493N/Atypedef uint64_t drm_u64_t;
493N/A
493N/A/*
235N/A * Some defines that are best put in ioccom.h, but live here till then.
742N/A */
235N/A
493N/A/* Reverse ioctl command lookup. */
493N/A#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
235N/A
493N/A/* These values come from constants in ioccom.h, and shouldn't change */
742N/A#define _IOC_NRBITS 8
235N/A#define _IOC_TYPEBITS 8
606N/A#define _IOC_SIZEBITS 13
606N/A#define _IOC_DIRBITS 3
235N/A
235N/A#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
235N/A#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
235N/A#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
235N/A#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
235N/A
705N/A#define _IOC_NRSHIFT 0
235N/A#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
235N/A#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
235N/A#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
742N/A
235N/A/* Solaris uses a bit for none, but calls it IOC_VOID */
493N/A#define _IOC_NONE 1U
235N/A#define _IOC_WRITE 2U
235N/A#define _IOC_READ 4U
606N/A
606N/A#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
606N/A
606N/A#if defined(__sun)
606N/A/* Things that should be defined in drmP.h */
235N/A#define DRM_IOCTL_NR(n) _IOC_NR(n)
606N/A#endif /* __sun */
705N/A
235N/A#define XFREE86_VERSION(major, minor, patch, snap) \
705N/A ((major << 16) | (minor << 8) | patch)
235N/A
235N/A#ifndef CONFIG_XFREE86_VERSION
235N/A#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4, 1, 0, 0)
644N/A#endif
644N/A
644N/A#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4, 1, 0, 0)
235N/A#define DRM_PROC_DEVICES "/proc/devices"
493N/A#define DRM_PROC_MISC "/proc/misc"
705N/A#define DRM_PROC_DRM "/proc/drm"
493N/A#define DRM_DEV_DRM "/dev/drm"
493N/A#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
606N/A#define DRM_DEV_UID 0
606N/A#define DRM_DEV_GID 0
235N/A#endif /* CONFIG_XFREE86_VERSION < XFREE86_VERSION(4, 1, 0, 0) */
606N/A
606N/A#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4, 1, 0, 0)
235N/A#ifdef __OpenBSD__
493N/A#define DRM_MAJOR 81
493N/A#endif
493N/A#if defined(__linux__) || defined(__NetBSD__)
493N/A#define DRM_MAJOR 226
493N/A#endif
493N/A#define DRM_MAX_MINORi 15
235N/A#endif /* CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) */
235N/A
235N/A
235N/A#ifdef _KERNEL
705N/A/* Defines that are only relevant for kernel modules and drivers */
493N/A
235N/A#ifdef __lint
235N/A/* Don't lint these macros. */
235N/A#define BUG_ON(a)
606N/A#define WARN_ON(a)
606N/A#else
606N/A#define BUG_ON(a) ASSERT(a)
606N/A#define WARN_ON(a) do { \
606N/A if(a) drm_debug_print(CE_WARN, __func__, __LINE__, #a);\
493N/A } while (__lintzero)
493N/A#endif /* __lint */
493N/A
493N/A#define BUG() BUG_ON(1)
371N/A
371N/A#endif /* _KERNEL */
371N/A#endif /* __sun */
235N/A#endif /* _DRM_OS_SOLARIS_H */
493N/A