Cross Reference: drm_linux.h
xref
: /
solaris-x11-s11
/
open-src
/
kernel
/
efb
/
src
/
drm_linux.h
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1450
N/A
/*
1450
N/A
* Copyright (c) 2006, 2015, Oracle
and
/
or
its affiliates. All rights reserved.
1450
N/A
*/
1450
N/A
1450
N/A
/*
1450
N/A
* Copyright (c) 2012, 2012 Intel Corporation. All rights reserved.
1450
N/A
*/
1450
N/A
1450
N/A
#
ifndef
__DRM_LINUX_H__
1450
N/A
#
define
__DRM_LINUX_H__
1450
N/A
1450
N/A
#
include
<
sys
/
types.h
>
1450
N/A
#
include
<
sys
/
byteorder.h
>
1450
N/A
#
include
"
drm_atomic.h
"
1450
N/A
1450
N/A
#
define
DRM_MEM_CACHED
0
1450
N/A
#
define
DRM_MEM_UNCACHED
1
1450
N/A
#
define
DRM_MEM_WC
2
1450
N/A
1450
N/A
#
ifndef
min
1450
N/A
#
define
min
(a, b) (((a) < (b)) ? (a) : (b))
1450
N/A
#
endif
1450
N/A
1450
N/A
#
ifndef
max
1450
N/A
#
define
max
(a, b) (((a) > (b)) ? (a) : (b))
1450
N/A
#
endif
1450
N/A
1450
N/A
#
define
clamp_int64_t
(
val
) \
1450
N/A
val
=
min
((
int64_t
)
INT_MAX
,
val
); \
1450
N/A
val
=
max
((
int64_t
)
INT_MIN
,
val
);
1450
N/A
1450
N/A
#
define
ioremap_wc
(
base
,
size
)
drm_sun_ioremap
((
base
), (
size
),
DRM_MEM_WC
)
1450
N/A
#
define
ioremap
(
base
,
size
)
drm_sun_ioremap
((
base
), (
size
),
DRM_MEM_UNCACHED
)
1450
N/A
#
define
iounmap
(
addr
)
drm_sun_iounmap
((
addr
))
1450
N/A
1450
N/A
#
define
spinlock_t
kmutex_t
1450
N/A
#
define
spin_lock_init
(l)
mutex_init
((l),
NULL
,
MUTEX_DRIVER
,
NULL
);
1450
N/A
#
define
spin_lock
(l)
mutex_enter
(l)
1450
N/A
#
define
spin_unlock
(u)
mutex_exit
(u)
1450
N/A
#
define
spin_lock_irq
(l)
mutex_enter
(l)
1450
N/A
#
define
spin_unlock_irq
(u)
mutex_exit
(u)
1450
N/A
#
ifdef
__lint
1450
N/A
/*
1450
N/A
* The following is to keep lint happy when it encouters the use of 'flag'.
1450
N/A
* On Linux, this allows a local variable to be used to retain context,
1450
N/A
* but is unused on Solaris. Rather than trying to place LINTED
1450
N/A
* directives in the source, we actually consue the flag for lint here.
1450
N/A
*/
1450
N/A
#
define
spin_lock_irqsave
(l,
flag
)
flag
= 0;
mutex_enter
(l)
1450
N/A
#
define
spin_unlock_irqrestore
(u,
flag
)
flag
&=
flag
;
mutex_exit
(u)
1450
N/A
#
else
1450
N/A
#
define
spin_lock_irqsave
(l,
flag
)
mutex_enter
(l)
1450
N/A
#
define
spin_unlock_irqrestore
(u,
flag
)
mutex_exit
(u)
1450
N/A
#
endif
1450
N/A
1450
N/A
#
define
mutex_lock
(l)
mutex_enter
(l)
1450
N/A
#
define
mutex_unlock
(u)
mutex_exit
(u)
1450
N/A
#
define
mutex_is_locked
(l)
mutex_owned
(l)
1450
N/A
1450
N/A
#
define
assert_spin_locked
(l)
ASSERT
(
MUTEX_HELD
(l))
1450
N/A
1450
N/A
#
define
kmalloc
kmem_alloc
1450
N/A
#
define
kzalloc
kmem_zalloc
1450
N/A
#
define
kcalloc
(x, y, z)
kzalloc
((x)*(y), z)
1450
N/A
#
define
kfree
kmem_free
1450
N/A
1450
N/A
#
define
do_gettimeofday
(
void
)
uniqtime
1450
N/A
#
define
msleep_interruptible
(s)
DRM_UDELAY
(s)
1450
N/A
#
define
timeval_to_ns
(
tvp
)
TICK_TO_NSEC
(
TIMEVAL_TO_TICK
(
tvp
))
1450
N/A
#
define
ns_to_timeval
(
nsec
,
tvp
)
TICK_TO_TIMEVAL
(
NSEC_TO_TICK
(
nsec
),
tvp
)
1450
N/A
1450
N/A
#
define
GFP_KERNEL
KM_SLEEP
1450
N/A
#
define
GFP_ATOMIC
KM_SLEEP
1450
N/A
1450
N/A
#
define
KHZ2PICOS
(a) (
1000000000UL
/(a))
1450
N/A
1450
N/A
#
define
udelay
drv_usecwait
1450
N/A
#
define
mdelay
(x)
udelay
((x) *
1000
)
1450
N/A
#
define
msleep
(x)
mdelay
((x))
1450
N/A
#
define
msecs_to_jiffies
(x)
drv_usectohz
((x) *
1000
)
1450
N/A
#
define
jiffies_to_msecs
(x)
drv_hztousec
(x) /
1000
1450
N/A
#
define
time_after
(a,b) ((
long
)(b) - (
long
)(a) < 0)
1450
N/A
#
define
time_after_eq
(a,b) ((
long
)(a) - (
long
)(b) >= 0)
1450
N/A
#
define
time_before_eq
(a,b)
time_after_eq
(b,a)
1450
N/A
#
define
time_in_range
(a,b,c) \
1450
N/A
(
time_after_eq
(a,b) && \
1450
N/A
time_before_eq
(a,c))
1450
N/A
1450
N/A
#
define
jiffies
ddi_get_lbolt
()
1450
N/A
1450
N/A
#
ifdef
_BIG_ENDIAN
1450
N/A
#
define
cpu_to_le16
(x)
LE_16
(x)
1450
N/A
#
define
le16_to_cpu
(x)
LE_16
(x)
1450
N/A
#
else
1450
N/A
#
define
cpu_to_le16
(x) (x)
1450
N/A
#
define
le16_to_cpu
(x) (x)
1450
N/A
#
endif
1450
N/A
1450
N/A
#
define
swap
(a, b) \
1450
N/A
do
{
int
tmp
= (a); (a) = (b); (b) =
tmp
; }
while
(
__lintzero
)
1450
N/A
1450
N/A
#
define
abs
(x) ((x < 0) ? -x : x)
1450
N/A
1450
N/A
#
define
div_u64
(x, y) ((
unsigned
long
long
)(x))/((
unsigned
long
long
)(y))
/* XXX FIXME */
1450
N/A
#
define
roundup
(x, y) ((((x) + ((y) -
1
)) / (y)) * (y))
1450
N/A
1450
N/A
#
define
put_user
(
val
,
ptr
)
DRM_COPY_TO_USER
(
ptr
,(&
val
),
sizeof
(
val
))
1450
N/A
#
define
get_user
(x,
ptr
)
DRM_COPY_FROM_USER
((&x),
ptr
,
sizeof
(x))
1450
N/A
#
define
copy_to_user
DRM_COPY_TO_USER
1450
N/A
#
define
copy_from_user
DRM_COPY_FROM_USER
1450
N/A
#
define
unlikely
(a) (a)
1450
N/A
1450
N/A
#
ifdef
__lint
1450
N/A
/* Don't lint these macros. */
1450
N/A
#
define
BUG_ON
(a)
1450
N/A
#
define
WARN_ON
(a)
1450
N/A
#
else
/* !__lint */
1450
N/A
#
define
BUG_ON
(a)
ASSERT
(!(a))
1450
N/A
#
define
WARN_ON
(a)
BUG_ON
(a)
1450
N/A
#
endif
/* __lint */
1450
N/A
1450
N/A
#
define
BUG
()
BUG_ON
(
1
)
1450
N/A
1450
N/A
#
define
AGP_USER_TYPES
(
1
<<
16
)
1450
N/A
#
define
AGP_USER_MEMORY
(
AGP_USER_TYPES
)
1450
N/A
#
define
AGP_USER_CACHED_MEMORY
(
AGP_USER_TYPES
+
1
)
1450
N/A
1450
N/A
#
define
ALIGN
(x, a) (((x) + ((a) -
1
)) & ~((a) -
1
))
1450
N/A
1450
N/A
#
define
page_to_phys
(x) *(
uint32_t
*)(
uintptr_t
)(x)
1450
N/A
#
define
in_dbg_master
() 0
1450
N/A
1450
N/A
#
define
BITS_PER_BYTE
8
1450
N/A
#
define
DIV_ROUND_UP
(n,d) (((n) + (d) -
1
) / (d))
1450
N/A
#
define
BITS_TO_LONGS
(
nr
)
DIV_ROUND_UP
(
nr
,
BITS_PER_BYTE
*
sizeof
(
long
))
1450
N/A
#
define
POS_DIV_ROUND_CLOSEST
(x, d) ((x + (d /
2
)) / d)
1450
N/A
#
define
POS_DIV_ROUND_UP_ULL
(x, d)
DIV_ROUND_UP
(x,d)
1450
N/A
1450
N/A
typedef
unsigned
long
dma_addr_t
;
1450
N/A
typedef
uint64_t
u64
;
1450
N/A
typedef
int64_t
s64
;
1450
N/A
typedef
uint32_t
u32
;
1450
N/A
typedef
int32_t
s32
;
1450
N/A
typedef
uint16_t
u16
;
1450
N/A
typedef
uint8_t
u8
;
1450
N/A
typedef
uint_t
irqreturn_t
;
1450
N/A
1450
N/A
typedef
int
bool
;
1450
N/A
1450
N/A
#
define
true
(
1
)
1450
N/A
#
define
false
(0)
1450
N/A
1450
N/A
#
define
__init
1450
N/A
#
define
__exit
1450
N/A
#
define
__iomem
1450
N/A
1450
N/A
#
ifdef
_ILP32
1450
N/A
typedef
u32
resource_size_t
;
1450
N/A
#
else
/* _LP64 */
1450
N/A
typedef
u64
resource_size_t
;
1450
N/A
#
endif
1450
N/A
1450
N/A
typedef
struct
kref
{
1450
N/A
atomic_t
refcount
;
1450
N/A
}
kref_t
;
1450
N/A
1450
N/A
extern
void
kref_init
(
struct
kref
*
kref
);
1450
N/A
extern
void
kref_get
(
struct
kref
*
kref
);
1450
N/A
extern
void
kref_put
(
struct
kref
*
kref
,
void
(*
release
)(
struct
kref
*
kref
));
1450
N/A
1450
N/A
extern
unsigned
int
hweight16
(
unsigned
int
w);
1450
N/A
1450
N/A
extern
long
IS_ERR
(
const
void
*
ptr
);
1450
N/A
#
define
IS_ERR_OR_NULL
(
ptr
) (!
ptr
||
IS_ERR
(
ptr
))
1450
N/A
1450
N/A
#
ifdef
__lint
1450
N/A
/*
1450
N/A
* The actual code for _wait_for() causes Solaris lint2 to fail, though
1450
N/A
* by all appearances, the code actually works (may try and peek at
1450
N/A
* the compiled code to understand why). So to get around the problem,
1450
N/A
* we create a special lint version for _wait_for().
1450
N/A
*/
1450
N/A
#
define
_wait_for
(
COND
,
MS
, W) (! (
COND
))
1450
N/A
#
else
/* !__lint */
1450
N/A
#
define
_wait_for
(
COND
,
MS
, W) ({ \
1450
N/A
unsigned
long
timeout__
=
jiffies
+
msecs_to_jiffies
(
MS
); \
1450
N/A
int
ret__
= 0; \
1450
N/A
while
(! (
COND
)) { \
1450
N/A
if
(
time_after
(
jiffies
,
timeout__
)) { \
1450
N/A
ret__
= -
ETIMEDOUT
; \
1450
N/A
break
; \
1450
N/A
} \
1450
N/A
if
(W)
udelay
(W); \
1450
N/A
} \
1450
N/A
ret__
; \
1450
N/A
})
1450
N/A
#
endif
/* __lint */
1450
N/A
1450
N/A
#
define
wait_for
(
COND
,
MS
)
_wait_for
(
COND
,
MS
,
1
)
1450
N/A
#
define
wait_for_atomic
(
COND
,
MS
)
_wait_for
(
COND
,
MS
, 0)
1450
N/A
1450
N/A
#
endif
/* __DRM_LINUX_H__ */