aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-10-05 06:23:06 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-10-29 13:03:15 -0400
commit463217bfecbf5d17a30133a55553d94aa9fc255e (patch)
tree1e385db37b46584968c67be20396c5b905b12180 /drivers/scsi/mpt2sas
parentec9472c74c3074541ea8389517f406b5c7ad0632 (diff)
[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: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: Eric Moore <Eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c4
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c11
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c17
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_transport.c14
4 files changed, 24 insertions, 22 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index db5e36735e72..6422e258fd52 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -2949,6 +2949,7 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2949 Mpi2IOCInitReply_t mpi_reply; 2949 Mpi2IOCInitReply_t mpi_reply;
2950 int r; 2950 int r;
2951 struct timeval current_time; 2951 struct timeval current_time;
2952 u16 ioc_status;
2952 2953
2953 dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, 2954 dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
2954 __func__)); 2955 __func__));
@@ -3028,7 +3029,8 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3028 return r; 3029 return r;
3029 } 3030 }
3030 3031
3031 if (mpi_reply.IOCStatus != MPI2_IOCSTATUS_SUCCESS || 3032 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
3033 if (ioc_status != MPI2_IOCSTATUS_SUCCESS ||
3032 mpi_reply.IOCLogInfo) { 3034 mpi_reply.IOCLogInfo) {
3033 printk(MPT2SAS_ERR_FMT "%s: failed\n", ioc->name, __func__); 3035 printk(MPT2SAS_ERR_FMT "%s: failed\n", ioc->name, __func__);
3034 r = -EIO; 3036 r = -EIO;
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index afdb4f36c30d..84a124f8e21f 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -848,8 +848,9 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
848 printk(MPT2SAS_DEBUG_FMT "TASK_MGMT: " 848 printk(MPT2SAS_DEBUG_FMT "TASK_MGMT: "
849 "IOCStatus(0x%04x), IOCLogInfo(0x%08x), " 849 "IOCStatus(0x%04x), IOCLogInfo(0x%08x), "
850 "TerminationCount(0x%08x)\n", ioc->name, 850 "TerminationCount(0x%08x)\n", ioc->name,
851 tm_reply->IOCStatus, tm_reply->IOCLogInfo, 851 le16_to_cpu(tm_reply->IOCStatus),
852 tm_reply->TerminationCount); 852 le32_to_cpu(tm_reply->IOCLogInfo),
853 le32_to_cpu(tm_reply->TerminationCount));
853 } 854 }
854#endif 855#endif
855 /* copy out xdata to user */ 856 /* copy out xdata to user */
@@ -1411,7 +1412,7 @@ _ctl_diag_register_2(struct MPT2SAS_ADAPTER *ioc,
1411 } else { 1412 } else {
1412 printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) " 1413 printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) "
1413 "log_info(0x%08x)\n", ioc->name, __func__, 1414 "log_info(0x%08x)\n", ioc->name, __func__,
1414 ioc_status, mpi_reply->IOCLogInfo); 1415 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
1415 rc = -EFAULT; 1416 rc = -EFAULT;
1416 } 1417 }
1417 1418
@@ -1756,7 +1757,7 @@ _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset)
1756 } else { 1757 } else {
1757 printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) " 1758 printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) "
1758 "log_info(0x%08x)\n", ioc->name, __func__, 1759 "log_info(0x%08x)\n", ioc->name, __func__,
1759 ioc_status, mpi_reply->IOCLogInfo); 1760 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
1760 rc = -EFAULT; 1761 rc = -EFAULT;
1761 } 1762 }
1762 1763
@@ -2017,7 +2018,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)
2017 } else { 2018 } else {
2018 printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) " 2019 printk(MPT2SAS_DEBUG_FMT "%s: ioc_status(0x%04x) "
2019 "log_info(0x%08x)\n", ioc->name, __func__, 2020 "log_info(0x%08x)\n", ioc->name, __func__,
2020 ioc_status, mpi_reply->IOCLogInfo); 2021 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
2021 rc = -EFAULT; 2022 rc = -EFAULT;
2022 } 2023 }
2023 2024
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6f5e2e471b48..d0d66726ff69 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -2775,8 +2775,6 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request)
2775 else 2775 else
2776 return; 2776 return;
2777 2777
2778 mpi_request->EEDPBlockSize = scmd->device->sector_size;
2779
2780 switch (prot_type) { 2778 switch (prot_type) {
2781 case SCSI_PROT_DIF_TYPE1: 2779 case SCSI_PROT_DIF_TYPE1:
2782 2780
@@ -2784,8 +2782,7 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request)
2784 * enable ref/guard checking 2782 * enable ref/guard checking
2785 * auto increment ref tag 2783 * auto increment ref tag
2786 */ 2784 */
2787 mpi_request->EEDPFlags = eedp_flags | 2785 eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
2788 MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
2789 MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG | 2786 MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
2790 MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD; 2787 MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
2791 mpi_request->CDB.EEDP32.PrimaryReferenceTag = 2788 mpi_request->CDB.EEDP32.PrimaryReferenceTag =
@@ -2798,11 +2795,11 @@ _scsih_setup_eedp(struct scsi_cmnd *scmd, Mpi2SCSIIORequest_t *mpi_request)
2798 /* 2795 /*
2799 * enable guard checking 2796 * enable guard checking
2800 */ 2797 */
2801 mpi_request->EEDPFlags = eedp_flags | 2798 eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
2802 MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
2803
2804 break; 2799 break;
2805 } 2800 }
2801 mpi_request->EEDPBlockSize = cpu_to_le32(scmd->device->sector_size);
2802 mpi_request->EEDPFlags = cpu_to_le16(eedp_flags);
2806} 2803}
2807 2804
2808/** 2805/**
@@ -4395,6 +4392,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
4395#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4392#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4396 Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; 4393 Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data;
4397#endif 4394#endif
4395 u16 ioc_status;
4398 dewtprintk(ioc, printk(MPT2SAS_DEBUG_FMT "broadcast primative: " 4396 dewtprintk(ioc, printk(MPT2SAS_DEBUG_FMT "broadcast primative: "
4399 "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, 4397 "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum,
4400 event_data->PortWidth)); 4398 event_data->PortWidth));
@@ -4428,8 +4426,9 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
4428 mpt2sas_scsih_issue_tm(ioc, handle, lun, 4426 mpt2sas_scsih_issue_tm(ioc, handle, lun,
4429 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30); 4427 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30);
4430 ioc->tm_cmds.status = MPT2_CMD_NOT_USED; 4428 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
4431 4429 ioc_status = le16_to_cpu(mpi_reply->IOCStatus)
4432 if ((mpi_reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) && 4430 & MPI2_IOCSTATUS_MASK;
4431 if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) &&
4433 (mpi_reply->ResponseCode == 4432 (mpi_reply->ResponseCode ==
4434 MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || 4433 MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED ||
4435 mpi_reply->ResponseCode == 4434 mpi_reply->ResponseCode ==
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c
index 8030bc2774c8..3a82872bad44 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
@@ -258,8 +258,7 @@ struct rep_manu_reply{
258 u8 response_length; 258 u8 response_length;
259 u16 expander_change_count; 259 u16 expander_change_count;
260 u8 reserved0[2]; 260 u8 reserved0[2];
261 u8 sas_format:1; 261 u8 sas_format;
262 u8 reserved1:7;
263 u8 reserved2[3]; 262 u8 reserved2[3];
264 u8 vendor_id[SAS_EXPANDER_VENDOR_ID_LEN]; 263 u8 vendor_id[SAS_EXPANDER_VENDOR_ID_LEN];
265 u8 product_id[SAS_EXPANDER_PRODUCT_ID_LEN]; 264 u8 product_id[SAS_EXPANDER_PRODUCT_ID_LEN];
@@ -374,7 +373,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
374 mpi_request->VP_ID = 0; 373 mpi_request->VP_ID = 0;
375 sas_address_le = (u64 *)&mpi_request->SASAddress; 374 sas_address_le = (u64 *)&mpi_request->SASAddress;
376 *sas_address_le = cpu_to_le64(sas_address); 375 *sas_address_le = cpu_to_le64(sas_address);
377 mpi_request->RequestDataLength = sizeof(struct rep_manu_request); 376 mpi_request->RequestDataLength =
377 cpu_to_le16(sizeof(struct rep_manu_request));
378 psge = &mpi_request->SGL; 378 psge = &mpi_request->SGL;
379 379
380 /* WRITE sgel first */ 380 /* WRITE sgel first */
@@ -437,8 +437,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
437 SAS_EXPANDER_PRODUCT_ID_LEN); 437 SAS_EXPANDER_PRODUCT_ID_LEN);
438 strncpy(edev->product_rev, manufacture_reply->product_rev, 438 strncpy(edev->product_rev, manufacture_reply->product_rev,
439 SAS_EXPANDER_PRODUCT_REV_LEN); 439 SAS_EXPANDER_PRODUCT_REV_LEN);
440 edev->level = manufacture_reply->sas_format; 440 edev->level = manufacture_reply->sas_format & 1;
441 if (manufacture_reply->sas_format) { 441 if (edev->level) {
442 strncpy(edev->component_vendor_id, 442 strncpy(edev->component_vendor_id,
443 manufacture_reply->component_vendor_id, 443 manufacture_reply->component_vendor_id,
444 SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN); 444 SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN);
@@ -1116,7 +1116,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1116 dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), 1116 dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio),
1117 blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); 1117 blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL);
1118 if (!dma_addr_out) { 1118 if (!dma_addr_out) {
1119 mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); 1119 mpt2sas_base_free_smid(ioc, smid);
1120 goto unmap; 1120 goto unmap;
1121 } 1121 }
1122 1122
@@ -1134,7 +1134,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1134 dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), 1134 dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio),
1135 blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); 1135 blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL);
1136 if (!dma_addr_in) { 1136 if (!dma_addr_in) {
1137 mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); 1137 mpt2sas_base_free_smid(ioc, smid);
1138 goto unmap; 1138 goto unmap;
1139 } 1139 }
1140 1140