linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* PCI reading without endian conversion
@ 2009-02-20 18:57 Matt Sealey
  2009-02-20 19:11 ` Ira Snyder
  2009-02-20 22:37 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 9+ messages in thread
From: Matt Sealey @ 2009-02-20 18:57 UTC (permalink / raw)
  To: PowerPC dev list

Hi guys,

What's the correct way to read from PCI address space (basically it's
guaranteed to be non-coherent memory bar) without flipping bits like
ioread32() does?

I need to be able to copy a bank of registers from PCI address space
into a temporary buffer so I can compare them in userspace through
UIO. Because of the flipping and the difference between the original
kernel driver (which used ioread32() and therefore "saw" big endian)
and the userspace app (which has a direct view of the PCI space, and
therefore "sees" little endian) I decided to give userspace an
absolutely consistent little-endian view seeing as this may get ported
to ARM in the coming months.

I want to put as little code in there as possible and not laboriously
manually flip from my ioread32() big endian values to little endian
again (waste of time and code) if I can help it. Being able to read
the raw value would help a lot, and if I need to do calculations on a
small portion of the data then I can do the flips manually then (using
le32_to_cpu and cpu_to_le32 which will be a noop on ARM), reducing the
amount of porting I need to do in both kernel and userspace alike.

So, is there something like a direct ioread32le() or so, which will
not change behaviour across architectures, is present on ARM and PPC,
and will handle both PCI address space, and "normal" "ioremapped"
memory?

-- 
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-02-23 10:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-02-23 10:37           ` Geert Uytterhoeven
2009-02-20 22:37 ` Benjamin Herrenschmidt

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).