* Re: [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver [not found] <4DF2228E.7060806@ic.fr> @ 2011-06-11 22:45 ` Benjamin Herrenschmidt 2011-06-14 6:42 ` Cédric Cano 0 siblings, 1 reply; 4+ messages in thread From: Benjamin Herrenschmidt @ 2011-06-11 22:45 UTC (permalink / raw) To: Cédric Cano; +Cc: linuxppc-dev, linux-scsi 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver 2011-06-11 22:45 ` [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver Benjamin Herrenschmidt @ 2011-06-14 6:42 ` Cédric Cano 2011-06-14 7:05 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 4+ messages in thread From: Cédric Cano @ 2011-06-14 6:42 UTC (permalink / raw) To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-scsi Hi Ben, You're alright! I hadn't thought to use le32_to_cpu. Do you want I make a new patch? Cedric Le 12/06/2011 00:45, Benjamin Herrenschmidt a écrit : > 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 > > _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver 2011-06-14 6:42 ` Cédric Cano @ 2011-06-14 7:05 ` Benjamin Herrenschmidt 0 siblings, 0 replies; 4+ messages in thread From: Benjamin Herrenschmidt @ 2011-06-14 7:05 UTC (permalink / raw) To: Cédric Cano; +Cc: linuxppc-dev, linux-scsi On Tue, 2011-06-14 at 08:42 +0200, Cédric Cano wrote: > Hi Ben, > > You're alright! I hadn't thought to use le32_to_cpu. > Do you want I make a new patch? Well, I'm not the maintainer of the subsystem or of the driver, so I'm not going to be the one accepting/merging it :-) I'm just reviewing the patch, but yes, I think you should, and you should send it to the right people, ie, I think at least linux-scsi and possibly the author/maintainer of the driver itself. Cheers, Ben. > Cedric > > Le 12/06/2011 00:45, Benjamin Herrenschmidt a écrit : > > 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver
@ 2011-06-14 9:31 Cédric Cano
0 siblings, 0 replies; 4+ messages in thread
From: Cédric Cano @ 2011-06-14 9:31 UTC (permalink / raw)
To: linux-scsi
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>
---
diff -Naur drivers/scsi/mvsas/mv_sas.c drivers/scsi/mvsas/mv_sas.c
--- drivers/scsi/mvsas/mv_sas.c 2011-06-03 02:34:20.000000000 +0200
+++ drivers/scsi/mvsas/mv_sas.c 2011-06-14 09:27:15.000000000 +0200
@@ -1143,6 +1143,12 @@
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 */
+ s[0] = le32_to_cpu(s[0]);
+ s[1] = le32_to_cpu(s[1]);
+ s[2] = le32_to_cpu(s[2]);
+ s[3] = le32_to_cpu(s[3]);
+
/* Workaround: take some ATAPI devices for ATA */
if (((s[1]& 0x00FFFFFF) == 0x00EB1401)&& (*(u8 *)&s[3] == 0x01))
s[1] = 0x00EB1401 | (*((u8 *)&s[1] + 3)& 0x10);
^ permalink raw reply [flat|nested] 4+ messages in threadend of thread, other threads:[~2011-06-14 9:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4DF2228E.7060806@ic.fr>
2011-06-11 22:45 ` [PATCH 1/1] Big endian swap for Marvell 6440 SAS driver Benjamin Herrenschmidt
2011-06-14 6:42 ` Cédric Cano
2011-06-14 7:05 ` Benjamin Herrenschmidt
2011-06-14 9:31 Cédric Cano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox