linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Cox <adrian@humboldt.co.uk>
To: Paulo Afonso Graner Fessel <pafessel@zaz.com.br>
Cc: linux-kernel@vger.kernel.org, hollis@austin.rr.com,
	torben.mathiasen@compaq.com
Subject: Re: Probable endianess problem in TLAN driver
Date: Sat, 09 Jun 2001 11:23:20 +0100	[thread overview]
Message-ID: <3B21F918.4090101@humboldt.co.uk> (raw)
In-Reply-To: <3B21A790.63F428CE@zaz.com.br>

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/



  reply	other threads:[~2001-06-09 10:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-09  4:35 Probable endianess problem in TLAN driver Paulo Afonso Graner Fessel
2001-06-09 10:23 ` Adrian Cox [this message]
2001-06-09 22:38 ` David S. Miller
2001-06-09 22:58   ` Riley Williams
2001-06-09 23:36     ` David Woodhouse
2001-06-10  6:45     ` David S. Miller
2001-06-09 23:12   ` David S. Miller
2001-06-09 10:11 Mathiasen, Torben
2001-06-09 16:21 ` Paulo Afonso Graner Fessel

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=3B21F918.4090101@humboldt.co.uk \
    --to=adrian@humboldt.co.uk \
    --cc=hollis@austin.rr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pafessel@zaz.com.br \
    --cc=torben.mathiasen@compaq.com \
    /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).