All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Cédric Cano" <ccano@interfaceconcept.com>
Cc: linuxppc-dev@lists.ozlabs.org,
	linux-scsi@vger.kernel.orglinux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver
Date: Sun, 12 Jun 2011 08:45:56 +1000	[thread overview]
Message-ID: <1307832356.2874.312.camel@pasglop> (raw)
In-Reply-To: <4DF2228E.7060806@ic.fr>

On Fri, 2011-06-10 at 15:56 +0200, Cédric Cano wrote:
> Hi,
> 
> Marvell SAS driver doesn't work on powerpc architecture due to big 
> endian swap. I've tested it with the MV6440 chip.
> Here you can find the patch for Linux 2.6.39.1.
> 
> Cedric Cano
> 
> Signed-off-by: Cedric Cano <ccano@interfaceconcept.com>
> ---
> --- drivers/scsi/mvsas/mv_sas.c    2011-06-10 15:50:04.000000000 +0200
> +++ drivers/scsi/mvsas/mv_sas.c    2011-06-10 15:50:12.000000000 +0200
> @@ -1143,6 +1143,14 @@
>       MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG0);
>       s[0] = MVS_CHIP_DISP->read_port_cfg_data(mvi, i);
> 
> +    /* swap for big endian devices because of use of these data in bytes */
> +#ifdef __BIG_ENDIAN
> +    s[0] = swab32(s[0]);
> +    s[1] = swab32(s[1]);
> +    s[2] = swab32(s[2]);
> +    s[3] = swab32(s[3]);
> +#endif /* __BIG_ENDIAN */

Hi Cedric !

Thanks for this. CC'ing linux-scsi.

Note that it would probably have been better to use le32_to_cpu, which
avoids the ifdef completely.

Cheers,
Ben.

>       /* Workaround: take some ATAPI devices for ATA */
>       if (((s[1] & 0x00FFFFFF) == 0x00EB1401) && (*(u8 *)&s[3] == 0x01))
>           s[1] = 0x00EB1401 | (*((u8 *)&s[1] + 3) & 0x10);
> 
> ---
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Cédric Cano" <ccano@interfaceconcept.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver
Date: Sun, 12 Jun 2011 08:45:56 +1000	[thread overview]
Message-ID: <1307832356.2874.312.camel@pasglop> (raw)
In-Reply-To: <4DF2228E.7060806@ic.fr>

On Fri, 2011-06-10 at 15:56 +0200, Cédric Cano wrote:
> Hi,
> 
> Marvell SAS driver doesn't work on powerpc architecture due to big 
> endian swap. I've tested it with the MV6440 chip.
> Here you can find the patch for Linux 2.6.39.1.
> 
> Cedric Cano
> 
> Signed-off-by: Cedric Cano <ccano@interfaceconcept.com>
> ---
> --- drivers/scsi/mvsas/mv_sas.c    2011-06-10 15:50:04.000000000 +0200
> +++ drivers/scsi/mvsas/mv_sas.c    2011-06-10 15:50:12.000000000 +0200
> @@ -1143,6 +1143,14 @@
>       MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG0);
>       s[0] = MVS_CHIP_DISP->read_port_cfg_data(mvi, i);
> 
> +    /* swap for big endian devices because of use of these data in bytes */
> +#ifdef __BIG_ENDIAN
> +    s[0] = swab32(s[0]);
> +    s[1] = swab32(s[1]);
> +    s[2] = swab32(s[2]);
> +    s[3] = swab32(s[3]);
> +#endif /* __BIG_ENDIAN */

Hi Cedric !

Thanks for this. CC'ing linux-scsi.

Note that it would probably have been better to use le32_to_cpu, which
avoids the ifdef completely.

Cheers,
Ben.

>       /* Workaround: take some ATAPI devices for ATA */
>       if (((s[1] & 0x00FFFFFF) == 0x00EB1401) && (*(u8 *)&s[3] == 0x01))
>           s[1] = 0x00EB1401 | (*((u8 *)&s[1] + 3) & 0x10);
> 
> ---
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

  reply	other threads:[~2011-06-11 22:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10 13:56 [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver Cédric Cano
2011-06-11 22:45 ` Benjamin Herrenschmidt [this message]
2011-06-11 22:45   ` Benjamin Herrenschmidt
2011-06-14  6:42   ` Cédric Cano
2011-06-14  6:42     ` Cédric Cano
2011-06-14  7:05     ` Benjamin Herrenschmidt
2011-06-14  7:05       ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2011-06-14  9:31 Cédric Cano

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=1307832356.2874.312.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=ccano@interfaceconcept.com \
    --cc=linux-scsi@vger.kernel.orglinux-scsi \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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.