3 #include <linux/interrupt.h> /* For task queue support */
4 #include <linux/delay.h>
6 #define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
7 #define DRM_ERR(d) -(d)
8 #define DRM_CURRENTPID current->pid
9 #define DRM_UDELAY(d) udelay(d)
10 #define DRM_READ8(addr) readb(addr)
11 #define DRM_READ32(addr) readl(addr)
12 #define DRM_WRITE8(addr, val) writeb(val, addr)
13 #define DRM_WRITE32(addr, val) writel(val, addr)
14 #define DRM_READMEMORYBARRIER() mb()
15 #define DRM_WRITEMEMORYBARRIER() wmb()
16 #define DRM_DEVICE drm_file_t *priv = filp->private_data; \
17 drm_device_t *dev = priv->dev
19 /* For data going from/to the kernel through the ioctl argument */
20 #define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \
21 if ( copy_from_user(&arg1, arg2, arg3) ) \
23 #define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \
24 if ( copy_to_user(arg1, &arg2, arg3) ) \
26 /* Other copying of data from/to kernel space */
27 #define DRM_COPY_FROM_USER(arg1, arg2, arg3) \
28 copy_from_user(arg1, arg2, arg3)
29 #define DRM_COPY_TO_USER(arg1, arg2, arg3) \
30 copy_to_user(arg1, arg2, arg3)
31 /* Macros for copyfrom user, but checking readability only once */
32 #define DRM_VERIFYAREA_READ( uaddr, size ) \
33 verify_area( VERIFY_READ, uaddr, size )
34 #define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
35 __copy_from_user(arg1, arg2, arg3)
36 #define DRM_GET_USER_UNCHECKED(val, uaddr) \
37 __get_user(val, uaddr)
40 /* malloc/free without the overhead of DRM(alloc) */
41 #define DRM_MALLOC(x) kmalloc(x, GFP_KERNEL)
42 #define DRM_FREE(x) kfree(x)
44 #define DRM_GETSAREA() \
46 struct list_head *list; \
47 list_for_each( list, &dev->maplist->head ) { \
48 drm_map_list_t *entry = (drm_map_list_t *)list; \
50 entry->map->type == _DRM_SHM && \
51 (entry->map->flags & _DRM_CONTAINS_LOCK) ) { \
52 dev_priv->sarea = entry->map; \