From: Matt Sealey <matt@genesi-usa.com>
To: Ira Snyder <iws@ovro.caltech.edu>
Cc: PowerPC dev list <linuxppc-dev@ozlabs.org>
Subject: Re: PCI reading without endian conversion
Date: Fri, 20 Feb 2009 15:56:39 -0600 [thread overview]
Message-ID: <b5e2fc790902201356v7e01b17al3ecd7e06ac59af3d@mail.gmail.com> (raw)
In-Reply-To: <20090220210744.GB21163@ovro.caltech.edu>
On Fri, Feb 20, 2009 at 3:07 PM, Ira Snyder <iws@ovro.caltech.edu> wrote:
> On Fri, Feb 20, 2009 at 02:05:08PM -0600, Matt Sealey wrote:
>> On Fri, Feb 20, 2009 at 1:11 PM, Ira Snyder <iws@ovro.caltech.edu> wrote:
>> > On Fri, Feb 20, 2009 at 12:57:36PM -0600, Matt Sealey wrote:
>> >
>> > I'm pretty sure memcpy_fromio() and memcpy_toio() will get you what you
>> > want. They don't change byte ordering.
>>
>> Are they guaranteed to only do 32-bit, aligned accesses?
>>
>
> I don't think so. I certainly wouldn't count on anything better than a
> byte-by-byte memcpy.
>
>> I made some cheats on my CPLD to ignore byte enables and so on,
>> because it makes the design cleaner and easier to read (for students)
>> plus, saves a ton of logic cells. It's totally within the PCI
>> standard, but it means if you do a byte read memcpy() you get.. very
>> weird results (i.e. not great).
>>
>
> Right, I understand how that works :)
>
> Some usage of cscope shows that __raw_readl() might be what you want,
> as well as __raw_writel() for writing. I'm not sure it is universally
> available, but maybe they are.
>
> The comment on PowerPC says "Non ordered and non-swapping "raw"
> accessors". Looks about right. ARM's implementation uses them to
> implement ioread32() and friends by adding byteswapping.
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?
--
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations
next prev parent reply other threads:[~2009-02-20 21:56 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 [this message]
2009-02-20 23:50 ` Ira Snyder
2009-02-21 4:33 ` Benjamin Herrenschmidt
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=b5e2fc790902201356v7e01b17al3ecd7e06ac59af3d@mail.gmail.com \
--to=matt@genesi-usa.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).