Skip to contentSkip to conversation

Big endian swap for Marvell 6440 SAS driver

PATCH New Cédric Cano 1 participant 1 message Jun 14, 2011 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Big endian swap for Marvell 6440 SAS driver

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

---

scsi/mvsas/mv_sas.c 2011-06-14 09:27:15.000000000 +0200 renamed from scsi/mvsas/mv_sas.c 2011-06-03 02:34:20.000000000 +0200 +6 -0
diff -Naur drivers/scsi/mvsas/mv_sas.c drivers/scsi/mvsas/mv_sas.c
@@ -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);