aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-10-30 09:30:06 -0400
committerChristoph Hellwig <hch@lst.de>2014-11-12 05:19:41 -0500
commit5066863337afdb0ad7323f424f7959d9f9f066da (patch)
tree3901d3088c8698f10e1533298ae04a98116bc395 /drivers
parentabd0c533e37789ef56a73562d6d06d39897bd801 (diff)
scsi: remove abuses of scsi_populate_tag
Unless we want to build a SPI tag message we should just check SCMD_TAGGED instead of reverse engineering a tag type through the use of scsi_populate_tag_msg. Also rename the function to spi_populate_tag_msg, make it behave like the other spi message helpers, and move it to the spi transport class. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/scsi/zfcp_fc.h14
-rw-r--r--drivers/scsi/53c700.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c9
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c10
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c18
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c29
-rw-r--r--drivers/scsi/esp_scsi.c2
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c11
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c16
-rw-r--r--drivers/scsi/ipr.c34
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c16
-rw-r--r--drivers/scsi/pmcraid.c34
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c92
-rw-r--r--drivers/scsi/qla2xxx/qla_mr.c13
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c10
-rw-r--r--drivers/scsi/scsi_transport_spi.c23
-rw-r--r--drivers/scsi/tmscsim.c12
17 files changed, 55 insertions, 290 deletions
diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h
index b1d2024ed513..df2b541c8287 100644
--- a/drivers/s390/scsi/zfcp_fc.h
+++ b/drivers/s390/scsi/zfcp_fc.h
@@ -212,8 +212,6 @@ static inline
212void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi, 212void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi,
213 u8 tm_flags) 213 u8 tm_flags)
214{ 214{
215 char tag[2];
216
217 int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun); 215 int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun);
218 216
219 if (unlikely(tm_flags)) { 217 if (unlikely(tm_flags)) {
@@ -221,17 +219,7 @@ void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi,
221 return; 219 return;
222 } 220 }
223 221
224 if (scsi_populate_tag_msg(scsi, tag)) { 222 fcp->fc_pri_ta = FCP_PTA_SIMPLE;
225 switch (tag[0]) {
226 case MSG_ORDERED_TAG:
227 fcp->fc_pri_ta |= FCP_PTA_ORDERED;
228 break;
229 case MSG_SIMPLE_TAG:
230 fcp->fc_pri_ta |= FCP_PTA_SIMPLE;
231 break;
232 };
233 } else
234 fcp->fc_pri_ta = FCP_PTA_SIMPLE;
235 223
236 if (scsi->sc_data_direction == DMA_FROM_DEVICE) 224 if (scsi->sc_data_direction == DMA_FROM_DEVICE)
237 fcp->fc_flags |= FCP_CFL_RDDATA; 225 fcp->fc_flags |= FCP_CFL_RDDATA;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 5143d3213e86..1b36fd3a6e62 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1427,7 +1427,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
1427 if((hostdata->tag_negotiated & (1<<scmd_id(SCp))) 1427 if((hostdata->tag_negotiated & (1<<scmd_id(SCp)))
1428 && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE && 1428 && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE &&
1429 slot->flags != NCR_700_FLAG_AUTOSENSE)) { 1429 slot->flags != NCR_700_FLAG_AUTOSENSE)) {
1430 count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]); 1430 count += spi_populate_tag_msg(&hostdata->msgout[count], SCp);
1431 } 1431 }
1432 1432
1433 if(hostdata->fast && 1433 if(hostdata->fast &&
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index ed333669a7dc..d3b6d68107ea 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1619,15 +1619,6 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1619 } 1619 }
1620 1620
1621 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) { 1621 if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) {
1622 int msg_bytes;
1623 uint8_t tag_msgs[2];
1624
1625 msg_bytes = scsi_populate_tag_msg(cmd, tag_msgs);
1626 if (msg_bytes && tag_msgs[0] != MSG_SIMPLE_TASK) {
1627 hscb->control |= tag_msgs[0];
1628 if (tag_msgs[0] == MSG_ORDERED_TASK)
1629 dev->commands_since_idle_or_otag = 0;
1630 } else
1631 if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH 1622 if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH
1632 && (dev->flags & AHD_DEV_Q_TAGGED) != 0) { 1623 && (dev->flags & AHD_DEV_Q_TAGGED) != 0) {
1633 hscb->control |= MSG_ORDERED_TASK; 1624 hscb->control |= MSG_ORDERED_TASK;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 63bae7c65c9f..33a5f959e86a 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1501,15 +1501,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
1501 } 1501 }
1502 1502
1503 if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) { 1503 if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) {
1504 int msg_bytes; 1504 if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH
1505 uint8_t tag_msgs[2];
1506
1507 msg_bytes = scsi_populate_tag_msg(cmd, tag_msgs);
1508 if (msg_bytes && tag_msgs[0] != MSG_SIMPLE_TASK) {
1509 hscb->control |= tag_msgs[0];
1510 if (tag_msgs[0] == MSG_ORDERED_TASK)
1511 dev->commands_since_idle_or_otag = 0;
1512 } else if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH
1513 && (dev->flags & AHC_DEV_Q_TAGGED) != 0) { 1505 && (dev->flags & AHC_DEV_Q_TAGGED) != 0) {
1514 hscb->control |= MSG_ORDERED_TASK; 1506 hscb->control |= MSG_ORDERED_TASK;
1515 dev->commands_since_idle_or_otag = 0; 1507 dev->commands_since_idle_or_otag = 0;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 5b99844ef6bf..4b56858c1df2 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1725,7 +1725,6 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
1725 struct fcp_cmnd *fcp_cmnd) 1725 struct fcp_cmnd *fcp_cmnd)
1726{ 1726{
1727 struct scsi_cmnd *sc_cmd = io_req->sc_cmd; 1727 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
1728 char tag[2];
1729 1728
1730 memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd)); 1729 memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd));
1731 1730
@@ -1739,21 +1738,10 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
1739 fcp_cmnd->fc_tm_flags = io_req->mp_req.tm_flags; 1738 fcp_cmnd->fc_tm_flags = io_req->mp_req.tm_flags;
1740 fcp_cmnd->fc_flags = io_req->io_req_flags; 1739 fcp_cmnd->fc_flags = io_req->io_req_flags;
1741 1740
1742 if (scsi_populate_tag_msg(sc_cmd, tag)) { 1741 if (sc_cmd->flags & SCMD_TAGGED)
1743 switch (tag[0]) { 1742 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
1744 case HEAD_OF_QUEUE_TAG: 1743 else
1745 fcp_cmnd->fc_pri_ta = FCP_PTA_HEADQ;
1746 break;
1747 case ORDERED_QUEUE_TAG:
1748 fcp_cmnd->fc_pri_ta = FCP_PTA_ORDERED;
1749 break;
1750 default:
1751 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
1752 break;
1753 }
1754 } else {
1755 fcp_cmnd->fc_pri_ta = 0; 1744 fcp_cmnd->fc_pri_ta = 0;
1756 }
1757} 1745}
1758 1746
1759static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req, 1747static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 86103c8475d8..8231505cce0a 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -152,28 +152,6 @@ csio_scsi_itnexus_loss_error(uint16_t error)
152 return 0; 152 return 0;
153} 153}
154 154
155static inline void
156csio_scsi_tag(struct scsi_cmnd *scmnd, uint8_t *tag, uint8_t hq,
157 uint8_t oq, uint8_t sq)
158{
159 char stag[2];
160
161 if (scsi_populate_tag_msg(scmnd, stag)) {
162 switch (stag[0]) {
163 case HEAD_OF_QUEUE_TAG:
164 *tag = hq;
165 break;
166 case ORDERED_QUEUE_TAG:
167 *tag = oq;
168 break;
169 default:
170 *tag = sq;
171 break;
172 }
173 } else
174 *tag = 0;
175}
176
177/* 155/*
178 * csio_scsi_fcp_cmnd - Frame the SCSI FCP command paylod. 156 * csio_scsi_fcp_cmnd - Frame the SCSI FCP command paylod.
179 * @req: IO req structure. 157 * @req: IO req structure.
@@ -192,11 +170,12 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
192 int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun); 170 int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun);
193 fcp_cmnd->fc_tm_flags = 0; 171 fcp_cmnd->fc_tm_flags = 0;
194 fcp_cmnd->fc_cmdref = 0; 172 fcp_cmnd->fc_cmdref = 0;
195 fcp_cmnd->fc_pri_ta = 0;
196 173
197 memcpy(fcp_cmnd->fc_cdb, scmnd->cmnd, 16); 174 memcpy(fcp_cmnd->fc_cdb, scmnd->cmnd, 16);
198 csio_scsi_tag(scmnd, &fcp_cmnd->fc_pri_ta, 175 if (scmnd->flags & SCMD_TAGGED)
199 FCP_PTA_HEADQ, FCP_PTA_ORDERED, FCP_PTA_SIMPLE); 176 fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
177 else
178 fcp_cmnd->fc_pri_ta = 0;
200 fcp_cmnd->fc_dl = cpu_to_be32(scsi_bufflen(scmnd)); 179 fcp_cmnd->fc_dl = cpu_to_be32(scsi_bufflen(scmnd));
201 180
202 if (req->nsge) 181 if (req->nsge)
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 55548dc5cec3..b23101b28bfa 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -663,7 +663,7 @@ static struct esp_cmd_entry *find_and_prep_issuable_command(struct esp *esp)
663 return ent; 663 return ent;
664 } 664 }
665 665
666 if (!scsi_populate_tag_msg(cmd, &ent->tag[0])) { 666 if (!spi_populate_tag_msg(&ent->tag[0], cmd)) {
667 ent->tag[0] = 0; 667 ent->tag[0] = 0;
668 ent->tag[1] = 0; 668 ent->tag[1] = 0;
669 } 669 }
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 961bdf5d31cd..10d5c6bbc9e7 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -325,13 +325,11 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
325 struct fc_rport_libfc_priv *rp = rport->dd_data; 325 struct fc_rport_libfc_priv *rp = rport->dd_data;
326 struct host_sg_desc *desc; 326 struct host_sg_desc *desc;
327 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; 327 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats;
328 u8 pri_tag = 0;
329 unsigned int i; 328 unsigned int i;
330 unsigned long intr_flags; 329 unsigned long intr_flags;
331 int flags; 330 int flags;
332 u8 exch_flags; 331 u8 exch_flags;
333 struct scsi_lun fc_lun; 332 struct scsi_lun fc_lun;
334 char msg[2];
335 333
336 if (sg_count) { 334 if (sg_count) {
337 /* For each SGE, create a device desc entry */ 335 /* For each SGE, create a device desc entry */
@@ -357,12 +355,6 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
357 355
358 int_to_scsilun(sc->device->lun, &fc_lun); 356 int_to_scsilun(sc->device->lun, &fc_lun);
359 357
360 pri_tag = FCPIO_ICMND_PTA_SIMPLE;
361 msg[0] = MSG_SIMPLE_TAG;
362 scsi_populate_tag_msg(sc, msg);
363 if (msg[0] == MSG_ORDERED_TAG)
364 pri_tag = FCPIO_ICMND_PTA_ORDERED;
365
366 /* Enqueue the descriptor in the Copy WQ */ 358 /* Enqueue the descriptor in the Copy WQ */
367 spin_lock_irqsave(&fnic->wq_copy_lock[0], intr_flags); 359 spin_lock_irqsave(&fnic->wq_copy_lock[0], intr_flags);
368 360
@@ -394,7 +386,8 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
394 io_req->sgl_list_pa, 386 io_req->sgl_list_pa,
395 io_req->sense_buf_pa, 387 io_req->sense_buf_pa,
396 0, /* scsi cmd ref, always 0 */ 388 0, /* scsi cmd ref, always 0 */
397 pri_tag, /* scsi pri and tag */ 389 FCPIO_ICMND_PTA_SIMPLE,
390 /* scsi pri and tag */
398 flags, /* command flags */ 391 flags, /* command flags */
399 sc->cmnd, sc->cmd_len, 392 sc->cmnd, sc->cmd_len,
400 scsi_bufflen(sc), 393 scsi_bufflen(sc),
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 48d19a3256ce..a964f8c85833 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1643,19 +1643,9 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
1643 int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); 1643 int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun);
1644 memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); 1644 memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len);
1645 1645
1646 if (scsi_populate_tag_msg(cmnd, tag)) { 1646 if (cmnd->flags & SCMD_TAGGED) {
1647 vfc_cmd->task_tag = cpu_to_be64(tag[1]); 1647 vfc_cmd->task_tag = cpu_to_be64(cmnd->tag);
1648 switch (tag[0]) { 1648 vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK;
1649 case MSG_SIMPLE_TAG:
1650 vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK;
1651 break;
1652 case MSG_HEAD_TAG:
1653 vfc_cmd->iu.pri_task_attr = IBMVFC_HEAD_OF_QUEUE;
1654 break;
1655 case MSG_ORDERED_TAG:
1656 vfc_cmd->iu.pri_task_attr = IBMVFC_ORDERED_TASK;
1657 break;
1658 };
1659 } 1649 }
1660 1650
1661 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) 1651 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev))))
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 3d689f6023e9..6b52feafa929 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5659,35 +5659,6 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
5659} 5659}
5660 5660
5661/** 5661/**
5662 * ipr_get_task_attributes - Translate SPI Q-Tag to task attributes
5663 * @scsi_cmd: scsi command struct
5664 *
5665 * Return value:
5666 * task attributes
5667 **/
5668static u8 ipr_get_task_attributes(struct scsi_cmnd *scsi_cmd)
5669{
5670 u8 tag[2];
5671 u8 rc = IPR_FLAGS_LO_UNTAGGED_TASK;
5672
5673 if (scsi_populate_tag_msg(scsi_cmd, tag)) {
5674 switch (tag[0]) {
5675 case MSG_SIMPLE_TAG:
5676 rc = IPR_FLAGS_LO_SIMPLE_TASK;
5677 break;
5678 case MSG_HEAD_TAG:
5679 rc = IPR_FLAGS_LO_HEAD_OF_Q_TASK;
5680 break;
5681 case MSG_ORDERED_TAG:
5682 rc = IPR_FLAGS_LO_ORDERED_TASK;
5683 break;
5684 };
5685 }
5686
5687 return rc;
5688}
5689
5690/**
5691 * ipr_erp_done - Process completion of ERP for a device 5662 * ipr_erp_done - Process completion of ERP for a device
5692 * @ipr_cmd: ipr command struct 5663 * @ipr_cmd: ipr command struct
5693 * 5664 *
@@ -6222,7 +6193,10 @@ static int ipr_queuecommand(struct Scsi_Host *shost,
6222 ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_DELAY_AFTER_RST; 6193 ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_DELAY_AFTER_RST;
6223 } 6194 }
6224 ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_ALIGNED_BFR; 6195 ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_ALIGNED_BFR;
6225 ioarcb->cmd_pkt.flags_lo |= ipr_get_task_attributes(scsi_cmd); 6196 if (scsi_cmd->flags & SCMD_TAGGED)
6197 ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_SIMPLE_TASK;
6198 else
6199 ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_UNTAGGED_TASK;
6226 } 6200 }
6227 6201
6228 if (scsi_cmd->cmnd[0] >= 0xC0 && 6202 if (scsi_cmd->cmnd[0] >= 0xC0 &&
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 2896e52ac6cd..4a150063fb4d 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -4266,7 +4266,6 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
4266 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; 4266 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb;
4267 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq); 4267 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq);
4268 int datadir = scsi_cmnd->sc_data_direction; 4268 int datadir = scsi_cmnd->sc_data_direction;
4269 char tag[2];
4270 uint8_t *ptr; 4269 uint8_t *ptr;
4271 bool sli4; 4270 bool sli4;
4272 uint32_t fcpdl; 4271 uint32_t fcpdl;
@@ -4288,20 +4287,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
4288 memset(ptr, 0, (LPFC_FCP_CDB_LEN - scsi_cmnd->cmd_len)); 4287 memset(ptr, 0, (LPFC_FCP_CDB_LEN - scsi_cmnd->cmd_len));
4289 } 4288 }
4290 4289
4291 if (scsi_populate_tag_msg(scsi_cmnd, tag)) { 4290 fcp_cmnd->fcpCntl1 = SIMPLE_Q;
4292 switch (tag[0]) {
4293 case HEAD_OF_QUEUE_TAG:
4294 fcp_cmnd->fcpCntl1 = HEAD_OF_Q;
4295 break;
4296 case ORDERED_QUEUE_TAG:
4297 fcp_cmnd->fcpCntl1 = ORDERED_Q;
4298 break;
4299 default:
4300 fcp_cmnd->fcpCntl1 = SIMPLE_Q;
4301 break;
4302 }
4303 } else
4304 fcp_cmnd->fcpCntl1 = SIMPLE_Q;
4305 4291
4306 sli4 = (phba->sli_rev == LPFC_SLI_REV4); 4292 sli4 = (phba->sli_rev == LPFC_SLI_REV4);
4307 piocbq->iocb.un.fcpi.fcpi_XRdy = 0; 4293 piocbq->iocb.un.fcpi.fcpi_XRdy = 0;
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 2233ed6b89e3..d5fb31fa388b 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3169,36 +3169,6 @@ static int pmcraid_eh_host_reset_handler(struct scsi_cmnd *scmd)
3169} 3169}
3170 3170
3171/** 3171/**
3172 * pmcraid_task_attributes - Translate SPI Q-Tags to task attributes
3173 * @scsi_cmd: scsi command struct
3174 *
3175 * Return value
3176 * number of tags or 0 if the task is not tagged
3177 */
3178static u8 pmcraid_task_attributes(struct scsi_cmnd *scsi_cmd)
3179{
3180 char tag[2];
3181 u8 rc = 0;
3182
3183 if (scsi_populate_tag_msg(scsi_cmd, tag)) {
3184 switch (tag[0]) {
3185 case MSG_SIMPLE_TAG:
3186 rc = TASK_TAG_SIMPLE;
3187 break;
3188 case MSG_HEAD_TAG:
3189 rc = TASK_TAG_QUEUE_HEAD;
3190 break;
3191 case MSG_ORDERED_TAG:
3192 rc = TASK_TAG_ORDERED;
3193 break;
3194 };
3195 }
3196
3197 return rc;
3198}
3199
3200
3201/**
3202 * pmcraid_init_ioadls - initializes IOADL related fields in IOARCB 3172 * pmcraid_init_ioadls - initializes IOADL related fields in IOARCB
3203 * @cmd: pmcraid command struct 3173 * @cmd: pmcraid command struct
3204 * @sgcount: count of scatter-gather elements 3174 * @sgcount: count of scatter-gather elements
@@ -3553,7 +3523,9 @@ static int pmcraid_queuecommand_lck(
3553 } 3523 }
3554 3524
3555 ioarcb->request_flags0 |= NO_LINK_DESCS; 3525 ioarcb->request_flags0 |= NO_LINK_DESCS;
3556 ioarcb->request_flags1 |= pmcraid_task_attributes(scsi_cmd); 3526
3527 if (scsi_cmd->flags & SCMD_TAGGED)
3528 ioarcb->request_flags1 |= TASK_TAG_SIMPLE;
3557 3529
3558 if (RES_IS_GSCSI(res->cfg_entry)) 3530 if (RES_IS_GSCSI(res->cfg_entry))
3559 ioarcb->request_flags1 |= DELAY_AFTER_RESET; 3531 ioarcb->request_flags1 |= DELAY_AFTER_RESET;
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index f0edb07f3198..a1ab25fca874 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -325,7 +325,6 @@ qla2x00_start_scsi(srb_t *sp)
325 struct qla_hw_data *ha; 325 struct qla_hw_data *ha;
326 struct req_que *req; 326 struct req_que *req;
327 struct rsp_que *rsp; 327 struct rsp_que *rsp;
328 char tag[2];
329 328
330 /* Setup device pointers. */ 329 /* Setup device pointers. */
331 ret = 0; 330 ret = 0;
@@ -404,26 +403,7 @@ qla2x00_start_scsi(srb_t *sp)
404 /* Set target ID and LUN number*/ 403 /* Set target ID and LUN number*/
405 SET_TARGET_ID(ha, cmd_pkt->target, sp->fcport->loop_id); 404 SET_TARGET_ID(ha, cmd_pkt->target, sp->fcport->loop_id);
406 cmd_pkt->lun = cpu_to_le16(cmd->device->lun); 405 cmd_pkt->lun = cpu_to_le16(cmd->device->lun);
407 406 cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
408 /* Update tagged queuing modifier */
409 if (scsi_populate_tag_msg(cmd, tag)) {
410 switch (tag[0]) {
411 case HEAD_OF_QUEUE_TAG:
412 cmd_pkt->control_flags =
413 __constant_cpu_to_le16(CF_HEAD_TAG);
414 break;
415 case ORDERED_QUEUE_TAG:
416 cmd_pkt->control_flags =
417 __constant_cpu_to_le16(CF_ORDERED_TAG);
418 break;
419 default:
420 cmd_pkt->control_flags =
421 __constant_cpu_to_le16(CF_SIMPLE_TAG);
422 break;
423 }
424 } else {
425 cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
426 }
427 407
428 /* Load SCSI command packet. */ 408 /* Load SCSI command packet. */
429 memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len); 409 memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
@@ -1264,7 +1244,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1264 uint16_t fcp_cmnd_len; 1244 uint16_t fcp_cmnd_len;
1265 struct fcp_cmnd *fcp_cmnd; 1245 struct fcp_cmnd *fcp_cmnd;
1266 dma_addr_t crc_ctx_dma; 1246 dma_addr_t crc_ctx_dma;
1267 char tag[2];
1268 1247
1269 cmd = GET_CMD_SP(sp); 1248 cmd = GET_CMD_SP(sp);
1270 1249
@@ -1356,25 +1335,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1356 cmd_pkt->fcp_cmnd_dseg_address[1] = cpu_to_le32( 1335 cmd_pkt->fcp_cmnd_dseg_address[1] = cpu_to_le32(
1357 MSD(crc_ctx_dma + CRC_CONTEXT_FCPCMND_OFF)); 1336 MSD(crc_ctx_dma + CRC_CONTEXT_FCPCMND_OFF));
1358 fcp_cmnd->task_management = 0; 1337 fcp_cmnd->task_management = 0;
1359 1338 fcp_cmnd->task_attribute = TSK_SIMPLE;
1360 /*
1361 * Update tagged queuing modifier if using command tag queuing
1362 */
1363 if (scsi_populate_tag_msg(cmd, tag)) {
1364 switch (tag[0]) {
1365 case HEAD_OF_QUEUE_TAG:
1366 fcp_cmnd->task_attribute = TSK_HEAD_OF_QUEUE;
1367 break;
1368 case ORDERED_QUEUE_TAG:
1369 fcp_cmnd->task_attribute = TSK_ORDERED;
1370 break;
1371 default:
1372 fcp_cmnd->task_attribute = TSK_SIMPLE;
1373 break;
1374 }
1375 } else {
1376 fcp_cmnd->task_attribute = TSK_SIMPLE;
1377 }
1378 1339
1379 cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ 1340 cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */
1380 1341
@@ -1495,7 +1456,6 @@ qla24xx_start_scsi(srb_t *sp)
1495 struct scsi_cmnd *cmd = GET_CMD_SP(sp); 1456 struct scsi_cmnd *cmd = GET_CMD_SP(sp);
1496 struct scsi_qla_host *vha = sp->fcport->vha; 1457 struct scsi_qla_host *vha = sp->fcport->vha;
1497 struct qla_hw_data *ha = vha->hw; 1458 struct qla_hw_data *ha = vha->hw;
1498 char tag[2];
1499 1459
1500 /* Setup device pointers. */ 1460 /* Setup device pointers. */
1501 ret = 0; 1461 ret = 0;
@@ -1578,22 +1538,7 @@ qla24xx_start_scsi(srb_t *sp)
1578 int_to_scsilun(cmd->device->lun, &cmd_pkt->lun); 1538 int_to_scsilun(cmd->device->lun, &cmd_pkt->lun);
1579 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); 1539 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
1580 1540
1581 /* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */ 1541 cmd_pkt->task = TSK_SIMPLE;
1582 if (scsi_populate_tag_msg(cmd, tag)) {
1583 switch (tag[0]) {
1584 case HEAD_OF_QUEUE_TAG:
1585 cmd_pkt->task = TSK_HEAD_OF_QUEUE;
1586 break;
1587 case ORDERED_QUEUE_TAG:
1588 cmd_pkt->task = TSK_ORDERED;
1589 break;
1590 default:
1591 cmd_pkt->task = TSK_SIMPLE;
1592 break;
1593 }
1594 } else {
1595 cmd_pkt->task = TSK_SIMPLE;
1596 }
1597 1542
1598 /* Load SCSI command packet. */ 1543 /* Load SCSI command packet. */
1599 memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); 1544 memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
@@ -2310,7 +2255,6 @@ qla82xx_start_scsi(srb_t *sp)
2310 struct qla_hw_data *ha = vha->hw; 2255 struct qla_hw_data *ha = vha->hw;
2311 struct req_que *req = NULL; 2256 struct req_que *req = NULL;
2312 struct rsp_que *rsp = NULL; 2257 struct rsp_que *rsp = NULL;
2313 char tag[2];
2314 2258
2315 /* Setup device pointers. */ 2259 /* Setup device pointers. */
2316 ret = 0; 2260 ret = 0;
@@ -2489,22 +2433,6 @@ sufficient_dsds:
2489 else if (cmd->sc_data_direction == DMA_FROM_DEVICE) 2433 else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
2490 ctx->fcp_cmnd->additional_cdb_len |= 2; 2434 ctx->fcp_cmnd->additional_cdb_len |= 2;
2491 2435
2492 /*
2493 * Update tagged queuing modifier -- default is TSK_SIMPLE (0).
2494 */
2495 if (scsi_populate_tag_msg(cmd, tag)) {
2496 switch (tag[0]) {
2497 case HEAD_OF_QUEUE_TAG:
2498 ctx->fcp_cmnd->task_attribute =
2499 TSK_HEAD_OF_QUEUE;
2500 break;
2501 case ORDERED_QUEUE_TAG:
2502 ctx->fcp_cmnd->task_attribute =
2503 TSK_ORDERED;
2504 break;
2505 }
2506 }
2507
2508 /* Populate the FCP_PRIO. */ 2436 /* Populate the FCP_PRIO. */
2509 if (ha->flags.fcp_prio_enabled) 2437 if (ha->flags.fcp_prio_enabled)
2510 ctx->fcp_cmnd->task_attribute |= 2438 ctx->fcp_cmnd->task_attribute |=
@@ -2565,20 +2493,6 @@ sufficient_dsds:
2565 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, 2493 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun,
2566 sizeof(cmd_pkt->lun)); 2494 sizeof(cmd_pkt->lun));
2567 2495
2568 /*
2569 * Update tagged queuing modifier -- default is TSK_SIMPLE (0).
2570 */
2571 if (scsi_populate_tag_msg(cmd, tag)) {
2572 switch (tag[0]) {
2573 case HEAD_OF_QUEUE_TAG:
2574 cmd_pkt->task = TSK_HEAD_OF_QUEUE;
2575 break;
2576 case ORDERED_QUEUE_TAG:
2577 cmd_pkt->task = TSK_ORDERED;
2578 break;
2579 }
2580 }
2581
2582 /* Populate the FCP_PRIO. */ 2496 /* Populate the FCP_PRIO. */
2583 if (ha->flags.fcp_prio_enabled) 2497 if (ha->flags.fcp_prio_enabled)
2584 cmd_pkt->task |= sp->fcport->fcp_prio << 3; 2498 cmd_pkt->task |= sp->fcport->fcp_prio << 3;
diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index 80867599527d..6d190b4b82a0 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -3086,7 +3086,6 @@ qlafx00_start_scsi(srb_t *sp)
3086 struct cmd_type_7_fx00 *cmd_pkt; 3086 struct cmd_type_7_fx00 *cmd_pkt;
3087 struct cmd_type_7_fx00 lcmd_pkt; 3087 struct cmd_type_7_fx00 lcmd_pkt;
3088 struct scsi_lun llun; 3088 struct scsi_lun llun;
3089 char tag[2];
3090 3089
3091 /* Setup device pointers. */ 3090 /* Setup device pointers. */
3092 ret = 0; 3091 ret = 0;
@@ -3157,18 +3156,6 @@ qlafx00_start_scsi(srb_t *sp)
3157 host_to_adap((uint8_t *)&llun, (uint8_t *)&lcmd_pkt.lun, 3156 host_to_adap((uint8_t *)&llun, (uint8_t *)&lcmd_pkt.lun,
3158 sizeof(lcmd_pkt.lun)); 3157 sizeof(lcmd_pkt.lun));
3159 3158
3160 /* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */
3161 if (scsi_populate_tag_msg(cmd, tag)) {
3162 switch (tag[0]) {
3163 case HEAD_OF_QUEUE_TAG:
3164 lcmd_pkt.task = TSK_HEAD_OF_QUEUE;
3165 break;
3166 case ORDERED_QUEUE_TAG:
3167 lcmd_pkt.task = TSK_ORDERED;
3168 break;
3169 }
3170 }
3171
3172 /* Load SCSI command packet. */ 3159 /* Load SCSI command packet. */
3173 host_to_adap(cmd->cmnd, lcmd_pkt.fcp_cdb, sizeof(lcmd_pkt.fcp_cdb)); 3160 host_to_adap(cmd->cmnd, lcmd_pkt.fcp_cdb, sizeof(lcmd_pkt.fcp_cdb));
3174 lcmd_pkt.byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd)); 3161 lcmd_pkt.byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index 08ab6dac226d..17222eb49762 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -280,7 +280,6 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
280 uint16_t req_cnt; 280 uint16_t req_cnt;
281 unsigned long flags; 281 unsigned long flags;
282 uint32_t index; 282 uint32_t index;
283 char tag[2];
284 283
285 /* Get real lun and adapter */ 284 /* Get real lun and adapter */
286 ddb_entry = srb->ddb; 285 ddb_entry = srb->ddb;
@@ -352,15 +351,6 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
352 351
353 /* Set tagged queueing control flags */ 352 /* Set tagged queueing control flags */
354 cmd_entry->control_flags |= CF_SIMPLE_TAG; 353 cmd_entry->control_flags |= CF_SIMPLE_TAG;
355 if (scsi_populate_tag_msg(cmd, tag))
356 switch (tag[0]) {
357 case MSG_HEAD_TAG:
358 cmd_entry->control_flags |= CF_HEAD_TAG;
359 break;
360 case MSG_ORDERED_TAG:
361 cmd_entry->control_flags |= CF_ORDERED_TAG;
362 break;
363 }
364 354
365 qla4xxx_advance_req_ring_ptr(ha); 355 qla4xxx_advance_req_ring_ptr(ha);
366 qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds); 356 qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds);
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index cf08071a9b6e..fa2aece76cc2 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -32,6 +32,7 @@
32#include <scsi/scsi_host.h> 32#include <scsi/scsi_host.h>
33#include <scsi/scsi_cmnd.h> 33#include <scsi/scsi_cmnd.h>
34#include <scsi/scsi_eh.h> 34#include <scsi/scsi_eh.h>
35#include <scsi/scsi_tcq.h>
35#include <scsi/scsi_transport.h> 36#include <scsi/scsi_transport.h>
36#include <scsi/scsi_transport_spi.h> 37#include <scsi/scsi_transport_spi.h>
37 38
@@ -1207,6 +1208,28 @@ int spi_populate_ppr_msg(unsigned char *msg, int period, int offset,
1207} 1208}
1208EXPORT_SYMBOL_GPL(spi_populate_ppr_msg); 1209EXPORT_SYMBOL_GPL(spi_populate_ppr_msg);
1209 1210
1211/**
1212 * spi_populate_tag_msg - place a tag message in a buffer
1213 * @msg: pointer to the area to place the tag
1214 * @cmd: pointer to the scsi command for the tag
1215 *
1216 * Notes:
1217 * designed to create the correct type of tag message for the
1218 * particular request. Returns the size of the tag message.
1219 * May return 0 if TCQ is disabled for this device.
1220 **/
1221int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd)
1222{
1223 if (cmd->flags & SCMD_TAGGED) {
1224 *msg++ = MSG_SIMPLE_TAG;
1225 *msg++ = cmd->request->tag;
1226 return 2;
1227 }
1228
1229 return 0;
1230}
1231EXPORT_SYMBOL_GPL(spi_populate_tag_msg);
1232
1210#ifdef CONFIG_SCSI_CONSTANTS 1233#ifdef CONFIG_SCSI_CONSTANTS
1211static const char * const one_byte_msgs[] = { 1234static const char * const one_byte_msgs[] = {
1212/* 0x00 */ "Task Complete", NULL /* Extended Message */, "Save Pointers", 1235/* 0x00 */ "Task Complete", NULL /* Extended Message */, "Save Pointers",
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 764575726c85..547812437a7c 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -243,7 +243,6 @@
243#include <scsi/scsicam.h> 243#include <scsi/scsicam.h>
244#include <scsi/scsi_tcq.h> 244#include <scsi/scsi_tcq.h>
245 245
246
247#define DC390_BANNER "Tekram DC390/AM53C974" 246#define DC390_BANNER "Tekram DC390/AM53C974"
248#define DC390_VERSION "2.1d 2004-05-27" 247#define DC390_VERSION "2.1d 2004-05-27"
249 248
@@ -508,7 +507,6 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr
508 struct scsi_cmnd *scmd = pSRB->pcmd; 507 struct scsi_cmnd *scmd = pSRB->pcmd;
509 struct scsi_device *sdev = scmd->device; 508 struct scsi_device *sdev = scmd->device;
510 u8 cmd, disc_allowed, try_sync_nego; 509 u8 cmd, disc_allowed, try_sync_nego;
511 char tag[2];
512 510
513 pSRB->ScsiPhase = SCSI_NOP0; 511 pSRB->ScsiPhase = SCSI_NOP0;
514 512
@@ -560,11 +558,11 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr
560 cmd = SEL_W_ATN; 558 cmd = SEL_W_ATN;
561 DC390_write8 (ScsiFifo, IDENTIFY(disc_allowed, pDCB->TargetLUN)); 559 DC390_write8 (ScsiFifo, IDENTIFY(disc_allowed, pDCB->TargetLUN));
562 /* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */ 560 /* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */
563 if ((pDCB->SyncMode & EN_TAG_QUEUEING) && disc_allowed && scsi_populate_tag_msg(scmd, tag)) { 561 if ((pDCB->SyncMode & EN_TAG_QUEUEING) && disc_allowed && (scmd->flags & SCMD_TAGGED)) {
564 DC390_write8(ScsiFifo, tag[0]); 562 DC390_write8(ScsiFifo, MSG_SIMPLE_TAG);
565 pDCB->TagMask |= 1 << tag[1]; 563 pDCB->TagMask |= 1 << scmd->request->tag;
566 pSRB->TagNumber = tag[1]; 564 pSRB->TagNumber = scmd->request->tag;
567 DC390_write8(ScsiFifo, tag[1]); 565 DC390_write8(ScsiFifo, scmd->request->tag);
568 DEBUG1(printk(KERN_INFO "DC390: Select w/DisCn for SRB %p, block tag %02x\n", pSRB, tag[1])); 566 DEBUG1(printk(KERN_INFO "DC390: Select w/DisCn for SRB %p, block tag %02x\n", pSRB, tag[1]));
569 cmd = SEL_W_ATN3; 567 cmd = SEL_W_ATN3;
570 } else { 568 } else {