Messages in this thread | | | Date | Sat, 09 Jun 2001 11:23:20 +0100 | From | Adrian Cox <> | Subject | Re: Probable endianess problem in TLAN driver |
| |
Paulo Afonso Graner Fessel wrote:
> [...]
> He said me that these funtions don't address the endianess question, and > sent me a patch. He said that this probably wouldn't work, but I've > decided to give a try anyway. Here is the patch: > > --- tlan.c.old Thu Jun 7 21:24:25 2001 > +++ tlan.c Thu Jun 7 21:37:42 2001 > @@ -172,6 +172,12 @@ > #include <linux/delay.h> > #include <linux/spinlock.h> > > +#if defined(__powerpc__) > +#define inw(addr) le32_to_cpu(inw(addr)) > +#define inl(addr) le32_to_cpu(inl(addr)) > +#define outw(val, addr) outw(cpu_to_le32(val), addr) > +#define outl(val, addr) outl(cpu_to_le32(val), addr) > +#endif
On ppc the inw, inl, outw, and outl functions already byteswap, so by adding the extra byteswap you're now passing unswapped data to the chip. Take a look at include/asm-ppc/io.h and you'll see it uses byte reversed load and store instructions. Which means that either the chip is running in a big-endian mode, or that the problem is actually with data structures placed in host memory.
Often when porting a driver from i386 to ppc all that is required is to add the cpu_to_le32() macros around data in host memory that the device accesses, and to remove any #ifdef __powerpc__ code written by people who don't realise that ppc uses the standard linux pci code.
-- Adrian Cox http://www.humboldt.co.uk/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |