From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Ira Snyder <iws@ovro.caltech.edu>
Cc: PowerPC dev list <linuxppc-dev@ozlabs.org>
Subject: Re: PCI reading without endian conversion
Date: Sat, 21 Feb 2009 15:33:17 +1100 [thread overview]
Message-ID: <1235190797.8805.202.camel@pasglop> (raw)
In-Reply-To: <20090220235054.GA27349@ovro.caltech.edu>
> > Am I correct in saying that cpu_to_le32 and le32_to_cpu are the
> > functions/macros I need to use to do byte swapping to make everything
> > go little endian (and back again when I read them back in the kernel)?
> >
> > Or is there some cleverer way already implemented in the kernel?
> >
>
> I would say that the __raw_readl() reads in cpu order. If you wanted to
> convert that to le32, you'd use cpu_to_le32().
Beware that __raw_* forms also don't have memory barriers.
In general, you know what byte order your device uses (which is often
little endian) and you use the appropriate ioread32{be}. Now, for
userspace, you simply need to mimmic those accessors.
Ben.
next prev parent reply other threads:[~2009-02-21 4:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-20 18:57 PCI reading without endian conversion Matt Sealey
2009-02-20 19:11 ` Ira Snyder
2009-02-20 20:05 ` Matt Sealey
2009-02-20 21:07 ` Ira Snyder
2009-02-20 21:56 ` Matt Sealey
2009-02-20 23:50 ` Ira Snyder
2009-02-21 4:33 ` Benjamin Herrenschmidt [this message]
2009-02-23 10:37 ` Geert Uytterhoeven
2009-02-20 22:37 ` Benjamin Herrenschmidt
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=1235190797.8805.202.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=iws@ovro.caltech.edu \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.