public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-embedded@ozlabs•org
Subject: Re: Undestanding ioread32() / readl() and friends
Date: Wed, 21 Feb 2007 10:56:27 +0100	[thread overview]
Message-ID: <200702211056.28313.arnd@arndb.de> (raw)
In-Reply-To: <erh4m0$n83$1@sea.gmane.org>

On Wednesday 21 February 2007 10:50, Florian Boelstler wrote:
> 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?

the ioread family of functions is used for PCI devices, which
are little-endian by definition.

If you want to access on-chip devices that are not behind PCI,
you should use the in_be family of functions.

	Arnd <><

  reply	other threads:[~2007-02-21  9:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21  9:50 Undestanding ioread32() / readl() and friends Florian Boelstler
2007-02-21  9:56 ` Arnd Bergmann [this message]
2007-02-21 14:33   ` Florian Boelstler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200702211056.28313.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox