Dave,

Isn't readl, writel etc. not recommended in new code?
IIRC ldd3 recommends  iowrite32 ioread32 etc.

/Thomas


Dave Airlie wrote:
> From: Dave Airlie <[email protected]>
>
> 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: Dave Airlie <[email protected]>
> ---
>  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 8dbd257..013551d 100644
> --- a/include/drm/drm_os_linux.h
> +++ b/include/drm/drm_os_linux.h
> @@ -6,6 +6,19 @@
>  #include <linux/interrupt.h> /* For task queue support */
>  #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 */
>  #define DRM_CURRENTPID                       task_pid_nr(current)
>  #define DRM_SUSER(p)                 capable(CAP_SYS_ADMIN)
> @@ -23,6 +36,12 @@
>  /** Write a dword into a MMIO region */
>  #define DRM_WRITE32(map, offset, val)        writel(val, ((void __iomem 
> *)(map)->handle) + (offset))
>  /** 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()
>  /** Write memory barrier */
>  #define DRM_WRITEMEMORYBARRIER()     wmb()
>   




------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to