aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2015-04-28 04:26:22 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-05-11 12:53:03 -0400
commit8b2564ec7410928639db5c09a34d7d8330f1d759 (patch)
tree97b4f240e4aaeee0649dd49870ebf46ba9ce4abe /drivers/scsi/lpfc
parentdc45708ca9988656d706940df5fd102672c5de92 (diff)
lpfc: Fix breakage on big endian kernels
This reverts 4fbdf9cb it breaks LPFC on POWER7 machine, big endian kernel. Without this, the kernel enters an infinite oops loop. This is the hardware used for verification: 0005:01:00.0 Fibre Channel [0c04]: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter [10df:f100] (rev 03) 0005:01:00.1 Fibre Channel [0c04]: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter [10df:f100] (rev 03) Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index cb73cf9e9ba5..c140f99772ca 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1130,25 +1130,6 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
1130} 1130}
1131 1131
1132/** 1132/**
1133 * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB
1134 * @data: A pointer to the immediate command data portion of the IOCB.
1135 * @fcp_cmnd: The FCP Command that is provided by the SCSI layer.
1136 *
1137 * The routine copies the entire FCP command from @fcp_cmnd to @data while
1138 * byte swapping the data to big endian format for transmission on the wire.
1139 **/
1140static void
1141lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd)
1142{
1143 int i, j;
1144
1145 for (i = 0, j = 0; i < sizeof(struct fcp_cmnd);
1146 i += sizeof(uint32_t), j++) {
1147 ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]);
1148 }
1149}
1150
1151/**
1152 * lpfc_scsi_prep_dma_buf_s3 - DMA mapping for scsi buffer to SLI3 IF spec 1133 * lpfc_scsi_prep_dma_buf_s3 - DMA mapping for scsi buffer to SLI3 IF spec
1153 * @phba: The Hba for which this call is being executed. 1134 * @phba: The Hba for which this call is being executed.
1154 * @lpfc_cmd: The scsi buffer which is going to be mapped. 1135 * @lpfc_cmd: The scsi buffer which is going to be mapped.
@@ -1283,7 +1264,6 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
1283 * we need to set word 4 of IOCB here 1264 * we need to set word 4 of IOCB here
1284 */ 1265 */
1285 iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd); 1266 iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd);
1286 lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd);
1287 return 0; 1267 return 0;
1288} 1268}
1289 1269
@@ -4147,6 +4127,24 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
4147} 4127}
4148 4128
4149/** 4129/**
4130 * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB
4131 * @data: A pointer to the immediate command data portion of the IOCB.
4132 * @fcp_cmnd: The FCP Command that is provided by the SCSI layer.
4133 *
4134 * The routine copies the entire FCP command from @fcp_cmnd to @data while
4135 * byte swapping the data to big endian format for transmission on the wire.
4136 **/
4137static void
4138lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd)
4139{
4140 int i, j;
4141 for (i = 0, j = 0; i < sizeof(struct fcp_cmnd);
4142 i += sizeof(uint32_t), j++) {
4143 ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]);
4144 }
4145}
4146
4147/**
4150 * lpfc_scsi_prep_cmnd - Wrapper func for convert scsi cmnd to FCP info unit 4148 * lpfc_scsi_prep_cmnd - Wrapper func for convert scsi cmnd to FCP info unit
4151 * @vport: The virtual port for which this call is being executed. 4149 * @vport: The virtual port for which this call is being executed.
4152 * @lpfc_cmd: The scsi command which needs to send. 4150 * @lpfc_cmd: The scsi command which needs to send.
@@ -4225,6 +4223,9 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
4225 fcp_cmnd->fcpCntl3 = 0; 4223 fcp_cmnd->fcpCntl3 = 0;
4226 phba->fc4ControlRequests++; 4224 phba->fc4ControlRequests++;
4227 } 4225 }
4226 if (phba->sli_rev == 3 &&
4227 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED))
4228 lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd);
4228 /* 4229 /*
4229 * Finish initializing those IOCB fields that are independent 4230 * Finish initializing those IOCB fields that are independent
4230 * of the scsi_cmnd request_buffer 4231 * of the scsi_cmnd request_buffer