Commit 463217bf authored by Kashyap, Desai's avatar Kashyap, Desai Committed by James Bottomley

[SCSI] mpt2sas : PPC (power pc) endian bug fix's

(1) EEDP(End to End data protection) was not working. This was due to not
setting EEDP BlockSize and Flags to little endian format in the message
frame.
(2) Some expander sysfs attributes were not getting set properly.  The sas
format was not getting set due to endian issues with sas_format field in the
struct rep_manu_reply. Since sas_format was not set properly, the
component_vendor_id, component_revision_id, and component_id were not set.
(3) In _transport_smp_handler: we don't need to convert the smid from little
endian to cpu prior to calling mpt2sas_base_free_smid, because its allready
in cpu format. (4) Some loginfos and ioc status were not xonverted from
little endian to cpu.
Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: default avatarEric Moore <Eric.moore@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent ec9472c7
...@@ -2949,6 +2949,7 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) ...@@ -2949,6 +2949,7 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
Mpi2IOCInitReply_t mpi_reply; Mpi2IOCInitReply_t mpi_reply;
int r; int r;
struct timeval current_time; struct timeval current_time;
u16 ioc_status;
dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
__func__)); __func__));
...@@ -3028,7 +3029,8 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) ...@@ -3028,7 +3029,8 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
return r; return r;
} }
if (mpi_reply.IOCStatus != MPI2_IOCSTATUS_SUCCESS || ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS ||
mpi_reply.IOCLogInfo) { mpi_reply.IOCLogInfo) {
printk(MPT2SAS_ERR_FMT "%s: failed\n", ioc->name, __func__); printk(MPT2SAS_ERR_FMT "%s: failed\n", ioc->name, __func__);
r = -EIO; r = -EIO;
......
...@@ -848,8 +848,9 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc, ...@@ -848,8 +848,9 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
printk(MPT2SAS_DEBUG_FMT "TASK_MGMT: " printk(MPT2SAS_DEBUG_FMT "TASK_MGMT: "
"IOCStatus(0x%04x), IOCLogInfo(0x%08x), " "IOCStatus(0x%04x), IOCLogInfo(0x%08x), "
"TerminationCount(0x%08x)\n", ioc->name, "TerminationCount(0x%08x)\n", ioc->name,
tm_reply->IOCStatus, tm_reply->IOCLogInfo, le16_to_cpu(tm_reply->IOCStatus),
tm_reply->TerminationCount); le32_to_cpu(tm_reply->IOCLogInfo),
le32_to_cpu(tm_reply->TerminationCount));
} }
#endif #endif
/* copy out xdata to user */ /* copy out xdata to user */
...@@ -1411,7 +1412,7 @@ _ctl_diag_register_2(struct MPT2SAS_ADAPTER *ioc, ...@@ -1411,7 +1412,7 @@ _ctl_diag_register_2(struct MPT2SAS_ADAPTER *ioc,
} else { } else {
printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) " printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) "
"log_info(0x%08x)\n", ioc->name, __func__, "log_info(0x%08x)\n", ioc->name, __func__,
ioc_status, mpi_reply->IOCLogInfo); ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
rc = -EFAULT; rc = -EFAULT;
} }
...@@ -1756,7 +1757,7 @@ _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset) ...@@ -1756,7 +1757,7 @@ _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset)
} else { } else {
printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) " printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) "
"log_info(0x%08x)\n", ioc->name, __func__, "log_info(0x%08x)\n", ioc->name, __func__,
ioc_status, mpi_reply->IOCLogInfo); ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
rc = -EFAULT; rc = -EFAULT;
} }
...@@ -2017,7 +2018,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state) ...@@ -2017,7 +2018,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)
} else { } else {
printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) " printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) "
"log_info(0x%08x)\n", ioc->name, __func__, "log_info(0x%08x)\n", ioc->name, __func__,
ioc_status, mpi_reply->IOCLogInfo); ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
rc = -EFAULT; rc = -EFAULT;
} }
......
...@@ -2775,8 +2775,6 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request) ...@@ -2775,8 +2775,6 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request)
else else
return; return;
mpi_request->EEDPBlockSize = scmd->device->sector_size;
switch (prot_type) { switch (prot_type) {
case SCSI_PROT_DIF_TYPE1: case SCSI_PROT_DIF_TYPE1:
...@@ -2784,8 +2782,7 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request) ...@@ -2784,8 +2782,7 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request)
* enable ref/guard checking * enable ref/guard checking
* auto increment ref tag * auto increment ref tag
*/ */
mpi_request->EEDPFlags = eedp_flags | eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG | MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD; MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
mpi_request->CDB.EEDP32.PrimaryReferenceTag = mpi_request->CDB.EEDP32.PrimaryReferenceTag =
...@@ -2798,11 +2795,11 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request) ...@@ -2798,11 +2795,11 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request)
/* /*
* enable guard checking * enable guard checking
*/ */
mpi_request->EEDPFlags = eedp_flags | eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
break; break;
} }
mpi_request->EEDPBlockSize = cpu_to_le32(scmd->device->sector_size);
mpi_request->EEDPFlags = cpu_to_le16(eedp_flags);
} }
/** /**
...@@ -4395,6 +4392,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, ...@@ -4395,6 +4392,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
#ifdef CONFIG_SCSI_MPT2SAS_LOGGING #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data;
#endif #endif
u16 ioc_status;
dewtprintk(ioc, printk(MPT2SAS_DEBUG_FMT "broadcast primative: " dewtprintk(ioc, printk(MPT2SAS_DEBUG_FMT "broadcast primative: "
"phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum,
event_data->PortWidth)); event_data->PortWidth));
...@@ -4428,8 +4426,9 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, ...@@ -4428,8 +4426,9 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
mpt2sas_scsih_issue_tm(ioc, handle, lun, mpt2sas_scsih_issue_tm(ioc, handle, lun,
MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30); MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30);
ioc->tm_cmds.status = MPT2_CMD_NOT_USED; ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
ioc_status = le16_to_cpu(mpi_reply->IOCStatus)
if ((mpi_reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) && & MPI2_IOCSTATUS_MASK;
if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) &&
(mpi_reply->ResponseCode == (mpi_reply->ResponseCode ==
MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED ||
mpi_reply->ResponseCode == mpi_reply->ResponseCode ==
......
...@@ -258,8 +258,7 @@ struct rep_manu_reply{ ...@@ -258,8 +258,7 @@ struct rep_manu_reply{
u8 response_length; u8 response_length;
u16 expander_change_count; u16 expander_change_count;
u8 reserved0[2]; u8 reserved0[2];
u8 sas_format:1; u8 sas_format;
u8 reserved1:7;
u8 reserved2[3]; u8 reserved2[3];
u8 vendor_id[SAS_EXPANDER_VENDOR_ID_LEN]; u8 vendor_id[SAS_EXPANDER_VENDOR_ID_LEN];
u8 product_id[SAS_EXPANDER_PRODUCT_ID_LEN]; u8 product_id[SAS_EXPANDER_PRODUCT_ID_LEN];
...@@ -374,7 +373,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc, ...@@ -374,7 +373,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
mpi_request->VP_ID = 0; mpi_request->VP_ID = 0;
sas_address_le = (u64 *)&mpi_request->SASAddress; sas_address_le = (u64 *)&mpi_request->SASAddress;
*sas_address_le = cpu_to_le64(sas_address); *sas_address_le = cpu_to_le64(sas_address);
mpi_request->RequestDataLength = sizeof(struct rep_manu_request); mpi_request->RequestDataLength =
cpu_to_le16(sizeof(struct rep_manu_request));
psge = &mpi_request->SGL; psge = &mpi_request->SGL;
/* WRITE sgel first */ /* WRITE sgel first */
...@@ -437,8 +437,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc, ...@@ -437,8 +437,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
SAS_EXPANDER_PRODUCT_ID_LEN); SAS_EXPANDER_PRODUCT_ID_LEN);
strncpy(edev->product_rev, manufacture_reply->product_rev, strncpy(edev->product_rev, manufacture_reply->product_rev,
SAS_EXPANDER_PRODUCT_REV_LEN); SAS_EXPANDER_PRODUCT_REV_LEN);
edev->level = manufacture_reply->sas_format; edev->level = manufacture_reply->sas_format & 1;
if (manufacture_reply->sas_format) { if (edev->level) {
strncpy(edev->component_vendor_id, strncpy(edev->component_vendor_id,
manufacture_reply->component_vendor_id, manufacture_reply->component_vendor_id,
SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN); SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN);
...@@ -1116,7 +1116,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, ...@@ -1116,7 +1116,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio),
blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL);
if (!dma_addr_out) { if (!dma_addr_out) {
mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); mpt2sas_base_free_smid(ioc, smid);
goto unmap; goto unmap;
} }
...@@ -1134,7 +1134,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, ...@@ -1134,7 +1134,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio),
blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL);
if (!dma_addr_in) { if (!dma_addr_in) {
mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); mpt2sas_base_free_smid(ioc, smid);
goto unmap; goto unmap;
} }
......
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