Commit 87f0da55 authored by Dave Airlie's avatar Dave Airlie

drm: add DRM_READ/WRITE64 wrappers around readq/writeq.

The readq/writeq stuff is from Dave Miller, and he
warns users to be careful about using these. Plans are only
r600 to use it so far.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 8ced9c75
...@@ -6,6 +6,19 @@ ...@@ -6,6 +6,19 @@
#include <linux/interrupt.h> /* For task queue support */ #include <linux/interrupt.h> /* For task queue support */
#include <linux/delay.h> #include <linux/delay.h>
#ifndef readq
static u64 readq(void __iomem *reg)
{
return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32);
}
static void writeq(u64 val, void __iomem *reg)
{
writel(val & 0xffffffff, reg);
writel(val >> 32, reg + 0x4UL);
}
#endif
/** Current process ID */ /** Current process ID */
#define DRM_CURRENTPID task_pid_nr(current) #define DRM_CURRENTPID task_pid_nr(current)
#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
...@@ -23,6 +36,12 @@ ...@@ -23,6 +36,12 @@
/** Write a dword into a MMIO region */ /** Write a dword into a MMIO region */
#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) #define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset))
/** Read memory barrier */ /** Read memory barrier */
/** Read a qword from a MMIO region - be careful using these unless you really understand them */
#define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset))
/** Write a qword into a MMIO region */
#define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset))
#define DRM_READMEMORYBARRIER() rmb() #define DRM_READMEMORYBARRIER() rmb()
/** Write memory barrier */ /** Write memory barrier */
#define DRM_WRITEMEMORYBARRIER() wmb() #define DRM_WRITEMEMORYBARRIER() wmb()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment