Re: PCI reading without endian conversion

2009-02-23 Thread Geert Uytterhoeven
On Fri, 20 Feb 2009, Ira Snyder wrote: > On Fri, Feb 20, 2009 at 03:56:39PM -0600, Matt Sealey wrote: > > 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 b

Re: PCI reading without endian conversion

2009-02-20 Thread Benjamin Herrenschmidt
> > 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? > > >

Re: PCI reading without endian conversion

2009-02-20 Thread Ira Snyder
On Fri, Feb 20, 2009 at 03:56:39PM -0600, Matt Sealey wrote: > On Fri, Feb 20, 2009 at 3:07 PM, Ira Snyder 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 wrote: > >> > On Fri, Feb 20, 2009 at 12:57:36PM -0600, Matt Sealey w

Re: PCI reading without endian conversion

2009-02-20 Thread Benjamin Herrenschmidt
On Fri, 2009-02-20 at 12:57 -0600, Matt Sealey wrote: > 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? ioread32be() ? :-) But from what you say below, it seems the wrong a

Re: PCI reading without endian conversion

2009-02-20 Thread Matt Sealey
On Fri, Feb 20, 2009 at 3:07 PM, Ira Snyder 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 wrote: >> > On Fri, Feb 20, 2009 at 12:57:36PM -0600, Matt Sealey wrote: >> > >> > I'm pretty sure memcpy_fromio() and memcpy_toio() wil

Re: PCI reading without endian conversion

2009-02-20 Thread Ira Snyder
On Fri, Feb 20, 2009 at 02:05:08PM -0600, Matt Sealey wrote: > On Fri, Feb 20, 2009 at 1:11 PM, Ira Snyder 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 orderi

Re: PCI reading without endian conversion

2009-02-20 Thread Matt Sealey
On Fri, Feb 20, 2009 at 1:11 PM, Ira Snyder 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 made s

Re: PCI reading without endian conversion

2009-02-20 Thread Ira Snyder
On Fri, Feb 20, 2009 at 12:57:36PM -0600, Matt Sealey wrote: > 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 ad

PCI reading without endian conversion

2009-02-20 Thread Matt Sealey
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 thro