Skip to content

Commit b15c9fd

Browse files
Chaitra P Bmartinkpetersen
authored andcommitted
scsi: mpt3sas: Fix for regression caused by sparse cleanups
Commit cf6bf97 ("scsi: mpt3sas: Bug fix for big endian systems") was merged to address sparse warnings. However, the patch introduced a regression on big endian since the code accidentally mixed I/O memory accessors, which do endian swaps, and regular CPU loads and stores. Do a partial revert of the offending commit. [mkp: replaced commit message] Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent cb12ba3 commit b15c9fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3321,7 +3321,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
33213321
spinlock_t *writeq_lock)
33223322
{
33233323
unsigned long flags;
3324-
__u64 data_out = b;
3324+
__u64 data_out = cpu_to_le64(b);
33253325

33263326
spin_lock_irqsave(writeq_lock, flags);
33273327
writel((u32)(data_out), addr);
@@ -3344,7 +3344,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
33443344
static inline void
33453345
_base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
33463346
{
3347-
writeq(b, addr);
3347+
writeq(cpu_to_le64(b), addr);
33483348
}
33493349
#else
33503350
static inline void
@@ -5215,7 +5215,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
52155215

52165216
/* send message 32-bits at a time */
52175217
for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) {
5218-
writel((u32)(request[i]), &ioc->chip->Doorbell);
5218+
writel(cpu_to_le32(request[i]), &ioc->chip->Doorbell);
52195219
if ((_base_wait_for_doorbell_ack(ioc, 5)))
52205220
failed = 1;
52215221
}
@@ -5236,7 +5236,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
52365236
}
52375237

52385238
/* read the first two 16-bits, it gives the total length of the reply */
5239-
reply[0] = (u16)(readl(&ioc->chip->Doorbell)
5239+
reply[0] = le16_to_cpu(readl(&ioc->chip->Doorbell)
52405240
& MPI2_DOORBELL_DATA_MASK);
52415241
writel(0, &ioc->chip->HostInterruptStatus);
52425242
if ((_base_wait_for_doorbell_int(ioc, 5))) {
@@ -5245,7 +5245,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
52455245
ioc->name, __LINE__);
52465246
return -EFAULT;
52475247
}
5248-
reply[1] = (u16)(readl(&ioc->chip->Doorbell)
5248+
reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell)
52495249
& MPI2_DOORBELL_DATA_MASK);
52505250
writel(0, &ioc->chip->HostInterruptStatus);
52515251

@@ -5259,7 +5259,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
52595259
if (i >= reply_bytes/2) /* overflow case */
52605260
readl(&ioc->chip->Doorbell);
52615261
else
5262-
reply[i] = (u16)(readl(&ioc->chip->Doorbell)
5262+
reply[i] = le16_to_cpu(readl(&ioc->chip->Doorbell)
52635263
& MPI2_DOORBELL_DATA_MASK);
52645264
writel(0, &ioc->chip->HostInterruptStatus);
52655265
}

0 commit comments

Comments
 (0)