Undestanding ioread32() / readl() and friends

Florian Boelstler euphoria at arcor.de
Wed Feb 21 20:50:58 EST 2007


Hi,

I just came across include/asm-ppc/io.h, which revealed that ioread32() 
maps to readl(), which in turn maps to in_le32() (when CONFIG_APUS and 
CONFIG_8260_PCI9 are both not defined).
in_le32() uses a asm instruction lwbrx to do byte swapping.

I don't really get why ioread32() effectively returns a little-endian 
value on a big-endian PPCs.

Is this a sort of general rule that ioread32() always returns 
little-endian values on all architectures?

BTW, "Linux Device Drivers, 3rd edition" by Corbet et al states that 
ioread32() does not perform any endian conversion.
May be they are based on x86...

Thanks,

   Florian




More information about the Linuxppc-embedded mailing list