diff options
-rw-r--r-- | include/drm/drm_os_linux.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 8dbd2572b7c3..013551d03c03 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h | |||
@@ -6,6 +6,19 @@ | |||
6 | #include <linux/interrupt.h> /* For task queue support */ | 6 | #include <linux/interrupt.h> /* For task queue support */ |
7 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
8 | 8 | ||
9 | #ifndef readq | ||
10 | static u64 readq(void __iomem *reg) | ||
11 | { | ||
12 | return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32); | ||
13 | } | ||
14 | |||
15 | static void writeq(u64 val, void __iomem *reg) | ||
16 | { | ||
17 | writel(val & 0xffffffff, reg); | ||
18 | writel(val >> 32, reg + 0x4UL); | ||
19 | } | ||
20 | #endif | ||
21 | |||
9 | /** Current process ID */ | 22 | /** Current process ID */ |
10 | #define DRM_CURRENTPID task_pid_nr(current) | 23 | #define DRM_CURRENTPID task_pid_nr(current) |
11 | #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) | 24 | #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) |
@@ -23,6 +36,12 @@ | |||
23 | /** Write a dword into a MMIO region */ | 36 | /** Write a dword into a MMIO region */ |
24 | #define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) | 37 | #define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) |
25 | /** Read memory barrier */ | 38 | /** Read memory barrier */ |
39 | |||
40 | /** Read a qword from a MMIO region - be careful using these unless you really understand them */ | ||
41 | #define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset)) | ||
42 | /** Write a qword into a MMIO region */ | ||
43 | #define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset)) | ||
44 | |||
26 | #define DRM_READMEMORYBARRIER() rmb() | 45 | #define DRM_READMEMORYBARRIER() rmb() |
27 | /** Write memory barrier */ | 46 | /** Write memory barrier */ |
28 | #define DRM_WRITEMEMORYBARRIER() wmb() | 47 | #define DRM_WRITEMEMORYBARRIER() wmb() |