/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Copyright (c) 2012, 2012 Intel Corporation. All rights reserved.
*/
#ifndef __DRM_LINUX_H__
#define __DRM_LINUX_H__
#include <sys/byteorder.h>
#include "drm_atomic.h"
#define DRM_MEM_CACHED 0
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifdef __lint
/*
* The following is to keep lint happy when it encouters the use of 'flag'.
* On Linux, this allows a local variable to be used to retain context,
* but is unused on Solaris. Rather than trying to place LINTED
* directives in the source, we actually consue the flag for lint here.
*/
#else
#endif
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
#define time_in_range(a,b,c) \
(time_after_eq(a,b) && \
time_before_eq(a,c))
#ifdef _BIG_ENDIAN
#else
#define cpu_to_le16(x) (x)
#define le16_to_cpu(x) (x)
#endif
#define swap(a, b) \
#define abs(x) ((x < 0) ? -x : x)
#define unlikely(a) (a)
#define in_dbg_master() 0
typedef unsigned long dma_addr_t;
typedef int bool;
#define true (1)
#define false (0)
#define __init
#define __exit
#define __iomem
#ifdef _ILP32
#else /* _LP64 */
#endif
typedef struct kref {
} kref_t;
extern unsigned int hweight16(unsigned int w);
#ifdef __lint
/*
* The actual code for _wait_for() causes Solaris lint2 to fail, though
* by all appearances, the code actually works (may try and peek at
* the compiled code to understand why). So to get around the problem,
* we create a special lint version for _wait_for().
*/
#else /* !__lint */
int ret__ = 0; \
while (! (COND)) { \
break; \
} \
if (W) udelay(W); \
} \
ret__; \
})
#endif /* __lint */
#endif /* __DRM_LINUX_H__ */