diff mbox

[U-Boot,3/5] scsi/ahci: ata id little endian fix

Message ID 1308692003-2488-4-git-send-email-robherring2@gmail.com
State Changes Requested
Headers show

Commit Message

Rob Herring June 21, 2011, 9:33 p.m. UTC
From: Rob Herring <rob.herring@calxeda.com>

The ata id string always needs swapping, not just on BE machines.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Wolfgang Denk <wd@denx.de>
---
 drivers/block/ahci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Wolfgang Denk July 25, 2011, 10:06 p.m. UTC | #1
Dear Rob Herring,

In message <1308692003-2488-4-git-send-email-robherring2@gmail.com> you wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> The ata id string always needs swapping, not just on BE machines.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
>  drivers/block/ahci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
Vadim Bendebury (вб) Sept. 6, 2011, 7:16 p.m. UTC | #2
On Tue, Sep 6, 2011 at 12:07 PM, <vb@vsbe.com> wrote:

> ---------- Forwarded message ----------
> From: Rob Herring <robherring2@gmail.com>
> Date: Tue, Jun 21, 2011 at 2:33 PM
> Subject: [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix
> To: u-boot@lists.denx.de
> Cc: Rob Herring <rob.herring@calxeda.com>
>
>
> From: Rob Herring <rob.herring@calxeda.com>
>
> The ata id string always needs swapping, not just on BE machines.
>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
>  drivers/block/ahci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
> index a3ca2dc..d431c5a 100644
> --- a/drivers/block/ahci.c
> +++ b/drivers/block/ahci.c
> @@ -468,7 +468,7 @@ static char *ata_id_strcpy(u16 *target, u16 *src, int
> len)
>  {
>        int i;
>        for (i = 0; i < len / 2; i++)
> -               target[i] = le16_to_cpu(src[i]);
> +               target[i] = swab16(src[i]);
>        return (char *)target;
>  }
>
> --
> 1.7.4.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
>
guys, I am looking into enabling the AHCI driver on the x86 platforms
(working off an older version of drivers/block/ahci.c, but planning to
reconcile).

One of my internal reviewers brought this up (and it seems quite a
reasonable question): why does one need to swap bytes always, no matter the
CPU endianness?

Also, can you  please comment on what is going on in ata_scsiop_inquiry(),
in particular, what are the contents of the hdr[] array? Any hints would be
highly appreciated,

cheers,
/vb
diff mbox

Patch

diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index a3ca2dc..d431c5a 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -468,7 +468,7 @@  static char *ata_id_strcpy(u16 *target, u16 *src, int len)
 {
 	int i;
 	for (i = 0; i < len / 2; i++)
-		target[i] = le16_to_cpu(src[i]);
+		target[i] = swab16(src[i]);
 	return (char *)target;
 }