What's the Difference B/W _Raw_Readl/_Raw_Writel and Readl/Writel in Linux Kernel

What's the difference b/w __raw_readl/__raw_writel and readl/writel in linux kernel?

It seems to be the case that

  • raw denotes native byte ordering, non-raw means little-endian
  • the __ prefix alternatives don't include memory barriers

See this LKML discussion and also the comments in linux/arch/arm/include/asm/io.h

Explanation of function used in embeded systems

I am not entirely sure what implementation or where you are using it. But judging from this, it is use to write data into I/O memory and as it is also mention at What's the difference b/w __raw_readl/__raw_writel and readl/writel in linux kernel?,

  • raw denotes native byte ordering, non-raw means little-endian
  • the __prefix alternatives don't include memory barriers

Also, you should try to look at http://lxr.free-electrons.com/source/arch/microblaze/include/asm/io.h#L66 to figure out more details and arguments for the function.

force a bit field read to 32 bits

As an example, the Linux kernel has inline functions that explicitly handle memory-mapped IO reads and writes. In newer kernels it's a big macro wrapper that boils down to an inline assembly movl instruction, but it older kernels it was defined like this:

#define readl(addr) (*(volatile unsigned int *) (addr))
#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))


Related Topics



Leave a reply



Submit