All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Ke Wei <kewei.mv@gmail.com>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, qswang@marvell.com,
	jfeng@marvell.com, qzhao@marvell.com, lil@marvell.com,
	saeed.bishara@gmail.com, kewei@marvell.com
Subject: Re: [PATCH] mvsas: Mainly add version info to run testing process.
Date: Thu, 28 Feb 2008 18:51:31 -0500	[thread overview]
Message-ID: <47C74903.40409@garzik.org> (raw)
In-Reply-To: <6b2481670802271916y62aa0588w81de83c08c9f128c@mail.gmail.com>

Ke Wei wrote:
> Yes,  the mvi->sas_addr array is in wire big endian format. And it
> will be written to two
> little-endian 32-bit registers after converting to little endian. So I
> think this is independent
> of system architecture.


BTW, just a reminder...  the values written by writel() [aka mw32, in 
mvsas] are converted by the API.

Thus, when writing to MMIO registers, you always pass in CPU-endian 
values, and mw32() will do the right thing regardless of platform.

Ditto for reading MMIO registers -- regardless of being on a big-endian 
or little-endian platform, the values returned are always in CPU-endian 
format.

So the typical cases where you must perform a conversion in the driver are

1) DMA memory.  You must use le32_to_cpu(), etc.  This is the most 
common case for endian conversions.

2) In rare cases, depending on your hardware, sometimes you must add a 
conversion even though you are reading data via readl() and writing via 
writel().  Often, this rare case occurs when reading data from EEPROM 
data-in registers, for example, where the EEPROM data is in big-endian 
format.

	Jeff



  reply	other threads:[~2008-02-28 23:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 12:50 [PATCH] mvsas: Mainly add version info to run testing process Ke Wei
2008-02-27 16:22 ` James Bottomley
2008-02-28  3:16   ` Ke Wei
2008-02-28 23:51     ` Jeff Garzik [this message]
2008-02-29  1:15     ` James Bottomley
2008-02-29 13:34       ` Ke Wei
2008-02-29 17:04         ` James Bottomley

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=47C74903.40409@garzik.org \
    --to=jeff@garzik.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jfeng@marvell.com \
    --cc=kewei.mv@gmail.com \
    --cc=kewei@marvell.com \
    --cc=lil@marvell.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=qswang@marvell.com \
    --cc=qzhao@marvell.com \
    --cc=saeed.bishara@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.