Commit b15c9fd8 authored by Chaitra P B's avatar Chaitra P B Committed by Martin K. Petersen

scsi: mpt3sas: Fix for regression caused by sparse cleanups

Commit cf6bf971 ("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: default avatarChaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent cb12ba35
...@@ -3321,7 +3321,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr, ...@@ -3321,7 +3321,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
spinlock_t *writeq_lock) spinlock_t *writeq_lock)
{ {
unsigned long flags; unsigned long flags;
__u64 data_out = b; __u64 data_out = cpu_to_le64(b);
spin_lock_irqsave(writeq_lock, flags); spin_lock_irqsave(writeq_lock, flags);
writel((u32)(data_out), addr); writel((u32)(data_out), addr);
...@@ -3344,7 +3344,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr, ...@@ -3344,7 +3344,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
static inline void static inline void
_base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock) _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
{ {
writeq(b, addr); writeq(cpu_to_le64(b), addr);
} }
#else #else
static inline void static inline void
...@@ -5215,7 +5215,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5215,7 +5215,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
/* send message 32-bits at a time */ /* send message 32-bits at a time */
for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) { for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) {
writel((u32)(request[i]), &ioc->chip->Doorbell); writel(cpu_to_le32(request[i]), &ioc->chip->Doorbell);
if ((_base_wait_for_doorbell_ack(ioc, 5))) if ((_base_wait_for_doorbell_ack(ioc, 5)))
failed = 1; failed = 1;
} }
...@@ -5236,7 +5236,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5236,7 +5236,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
} }
/* read the first two 16-bits, it gives the total length of the reply */ /* read the first two 16-bits, it gives the total length of the reply */
reply[0] = (u16)(readl(&ioc->chip->Doorbell) reply[0] = le16_to_cpu(readl(&ioc->chip->Doorbell)
& MPI2_DOORBELL_DATA_MASK); & MPI2_DOORBELL_DATA_MASK);
writel(0, &ioc->chip->HostInterruptStatus); writel(0, &ioc->chip->HostInterruptStatus);
if ((_base_wait_for_doorbell_int(ioc, 5))) { if ((_base_wait_for_doorbell_int(ioc, 5))) {
...@@ -5245,7 +5245,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5245,7 +5245,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
ioc->name, __LINE__); ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
reply[1] = (u16)(readl(&ioc->chip->Doorbell) reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell)
& MPI2_DOORBELL_DATA_MASK); & MPI2_DOORBELL_DATA_MASK);
writel(0, &ioc->chip->HostInterruptStatus); writel(0, &ioc->chip->HostInterruptStatus);
...@@ -5259,7 +5259,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5259,7 +5259,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
if (i >= reply_bytes/2) /* overflow case */ if (i >= reply_bytes/2) /* overflow case */
readl(&ioc->chip->Doorbell); readl(&ioc->chip->Doorbell);
else else
reply[i] = (u16)(readl(&ioc->chip->Doorbell) reply[i] = le16_to_cpu(readl(&ioc->chip->Doorbell)
& MPI2_DOORBELL_DATA_MASK); & MPI2_DOORBELL_DATA_MASK);
writel(0, &ioc->chip->HostInterruptStatus); writel(0, &ioc->chip->HostInterruptStatus);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment