aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h11
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c73
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c134
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c37
5 files changed, 19 insertions, 240 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 2bb187e23db0..7f9f86b8140b 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -250,16 +250,6 @@ struct srb_iocb {
250 uint32_t lun; 250 uint32_t lun;
251 uint32_t data; 251 uint32_t data;
252 } tmf; 252 } tmf;
253 struct {
254 /*
255 * values for modif field below are as
256 * defined in mrk_entry_24xx struct
257 * for the modifier field in qla_fw.h.
258 */
259 uint8_t modif;
260 uint16_t lun;
261 uint32_t data;
262 } marker;
263 } u; 253 } u;
264 254
265 struct timer_list timer; 255 struct timer_list timer;
@@ -277,7 +267,6 @@ struct srb_iocb {
277#define SRB_CT_CMD 5 267#define SRB_CT_CMD 5
278#define SRB_ADISC_CMD 6 268#define SRB_ADISC_CMD 6
279#define SRB_TM_CMD 7 269#define SRB_TM_CMD 7
280#define SRB_MARKER_CMD 8
281 270
282struct srb_ctx { 271struct srb_ctx {
283 uint16_t type; 272 uint16_t type;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 7ae2ee42564e..fd299911d7d6 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -59,7 +59,6 @@ extern int qla2x00_async_logout(struct scsi_qla_host *, fc_port_t *);
59extern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *, 59extern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *,
60 uint16_t *); 60 uint16_t *);
61extern int qla2x00_async_tm_cmd(fc_port_t *, uint32_t, uint32_t, uint32_t); 61extern int qla2x00_async_tm_cmd(fc_port_t *, uint32_t, uint32_t, uint32_t);
62extern int qla2x00_async_marker(fc_port_t *, uint16_t, uint8_t);
63extern void qla2x00_async_login_done(struct scsi_qla_host *, fc_port_t *, 62extern void qla2x00_async_login_done(struct scsi_qla_host *, fc_port_t *,
64 uint16_t *); 63 uint16_t *);
65extern void qla2x00_async_logout_done(struct scsi_qla_host *, fc_port_t *, 64extern void qla2x00_async_logout_done(struct scsi_qla_host *, fc_port_t *,
@@ -68,8 +67,7 @@ extern void qla2x00_async_adisc_done(struct scsi_qla_host *, fc_port_t *,
68 uint16_t *); 67 uint16_t *);
69extern void qla2x00_async_tm_cmd_done(struct scsi_qla_host *, fc_port_t *, 68extern void qla2x00_async_tm_cmd_done(struct scsi_qla_host *, fc_port_t *,
70 struct srb_iocb *); 69 struct srb_iocb *);
71extern void qla2x00_async_marker_done(struct scsi_qla_host *, fc_port_t *, 70extern void *qla2x00_alloc_iocbs(struct scsi_qla_host *, srb_t *);
72 struct srb_iocb *);
73 71
74extern fc_port_t * 72extern fc_port_t *
75qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t ); 73qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t );
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index d0b993c8a189..5bc317070371 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -367,58 +367,6 @@ done:
367 return rval; 367 return rval;
368} 368}
369 369
370static void
371qla2x00_async_marker_ctx_done(srb_t *sp)
372{
373 struct srb_ctx *ctx = sp->ctx;
374 struct srb_iocb *iocb = (struct srb_iocb *)ctx->u.iocb_cmd;
375
376 qla2x00_async_marker_done(sp->fcport->vha, sp->fcport, iocb);
377 iocb->free(sp);
378}
379
380int
381qla2x00_async_marker(fc_port_t *fcport, uint16_t lun, uint8_t modif)
382{
383 struct scsi_qla_host *vha = fcport->vha;
384 srb_t *sp;
385 struct srb_ctx *ctx;
386 struct srb_iocb *mrk;
387 int rval;
388
389 rval = QLA_FUNCTION_FAILED;
390 sp = qla2x00_get_ctx_sp(vha, fcport, sizeof(struct srb_ctx), 0);
391 if (!sp)
392 goto done;
393
394 ctx = sp->ctx;
395 ctx->type = SRB_MARKER_CMD;
396 ctx->name = "marker";
397 mrk = ctx->u.iocb_cmd;
398 mrk->u.marker.lun = lun;
399 mrk->u.marker.modif = modif;
400 mrk->timeout = qla2x00_async_iocb_timeout;
401 mrk->done = qla2x00_async_marker_ctx_done;
402
403 rval = qla2x00_start_sp(sp);
404 if (rval != QLA_SUCCESS)
405 goto done_free_sp;
406
407 DEBUG2(printk(KERN_DEBUG
408 "scsi(%ld:%x): Async-marker - loop-id=%x "
409 "portid=%02x%02x%02x.\n",
410 fcport->vha->host_no, sp->handle, fcport->loop_id,
411 fcport->d_id.b.domain, fcport->d_id.b.area,
412 fcport->d_id.b.al_pa));
413
414 return rval;
415
416done_free_sp:
417 mrk->free(sp);
418done:
419 return rval;
420}
421
422void 370void
423qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport, 371qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport,
424 uint16_t *data) 372 uint16_t *data)
@@ -500,7 +448,8 @@ qla2x00_async_tm_cmd_done(struct scsi_qla_host *vha, fc_port_t *fcport,
500 lun = (uint16_t)iocb->u.tmf.lun; 448 lun = (uint16_t)iocb->u.tmf.lun;
501 449
502 /* Issue Marker IOCB */ 450 /* Issue Marker IOCB */
503 rval = qla2x00_async_marker(fcport, lun, 451 rval = qla2x00_marker(vha, vha->hw->req_q_map[0],
452 vha->hw->rsp_q_map[0], fcport->loop_id, lun,
504 flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID); 453 flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID);
505 454
506 if ((rval != QLA_SUCCESS) || iocb->u.tmf.data) { 455 if ((rval != QLA_SUCCESS) || iocb->u.tmf.data) {
@@ -512,24 +461,6 @@ qla2x00_async_tm_cmd_done(struct scsi_qla_host *vha, fc_port_t *fcport,
512 return; 461 return;
513} 462}
514 463
515void
516qla2x00_async_marker_done(struct scsi_qla_host *vha, fc_port_t *fcport,
517 struct srb_iocb *iocb)
518{
519 /*
520 * Currently we dont have any specific post response processing
521 * for this IOCB. We'll just return success or failed
522 * depending on whether the IOCB command succeeded or failed.
523 */
524 if (iocb->u.tmf.data) {
525 DEBUG2_3_11(printk(KERN_WARNING
526 "%s(%ld): Marker IOCB failed (%x).\n",
527 __func__, vha->host_no, iocb->u.tmf.data));
528 }
529
530 return;
531}
532
533/****************************************************************************/ 464/****************************************************************************/
534/* QLogic ISP2x00 Hardware Support Functions. */ 465/* QLogic ISP2x00 Hardware Support Functions. */
535/****************************************************************************/ 466/****************************************************************************/
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 5d0e99c2b522..370646f7b3ff 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -11,8 +11,6 @@
11 11
12#include <scsi/scsi_tcq.h> 12#include <scsi/scsi_tcq.h>
13 13
14static request_t *qla2x00_req_pkt(struct scsi_qla_host *, struct req_que *,
15 struct rsp_que *rsp);
16static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *); 14static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *);
17 15
18static void qla25xx_set_que(srb_t *, struct rsp_que **); 16static void qla25xx_set_que(srb_t *, struct rsp_que **);
@@ -474,7 +472,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
474 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); 472 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
475 473
476 mrk24 = NULL; 474 mrk24 = NULL;
477 mrk = (mrk_entry_t *)qla2x00_req_pkt(vha, req, rsp); 475 mrk = (mrk_entry_t *)qla2x00_alloc_iocbs(vha, 0);
478 if (mrk == NULL) { 476 if (mrk == NULL) {
479 DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n", 477 DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n",
480 __func__, base_vha->host_no)); 478 __func__, base_vha->host_no));
@@ -521,84 +519,6 @@ qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
521} 519}
522 520
523/** 521/**
524 * qla2x00_req_pkt() - Retrieve a request packet from the request ring.
525 * @ha: HA context
526 *
527 * Note: The caller must hold the hardware lock before calling this routine.
528 *
529 * Returns NULL if function failed, else, a pointer to the request packet.
530 */
531static request_t *
532qla2x00_req_pkt(struct scsi_qla_host *vha, struct req_que *req,
533 struct rsp_que *rsp)
534{
535 struct qla_hw_data *ha = vha->hw;
536 device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id);
537 request_t *pkt = NULL;
538 uint16_t cnt;
539 uint32_t *dword_ptr;
540 uint32_t timer;
541 uint16_t req_cnt = 1;
542
543 /* Wait 1 second for slot. */
544 for (timer = HZ; timer; timer--) {
545 if ((req_cnt + 2) >= req->cnt) {
546 /* Calculate number of free request entries. */
547 if (ha->mqenable)
548 cnt = (uint16_t)
549 RD_REG_DWORD(&reg->isp25mq.req_q_out);
550 else {
551 if (IS_QLA82XX(ha))
552 cnt = (uint16_t)RD_REG_DWORD(
553 &reg->isp82.req_q_out);
554 else if (IS_FWI2_CAPABLE(ha))
555 cnt = (uint16_t)RD_REG_DWORD(
556 &reg->isp24.req_q_out);
557 else
558 cnt = qla2x00_debounce_register(
559 ISP_REQ_Q_OUT(ha, &reg->isp));
560 }
561 if (req->ring_index < cnt)
562 req->cnt = cnt - req->ring_index;
563 else
564 req->cnt = req->length -
565 (req->ring_index - cnt);
566 }
567 /* If room for request in request ring. */
568 if ((req_cnt + 2) < req->cnt) {
569 req->cnt--;
570 pkt = req->ring_ptr;
571
572 /* Zero out packet. */
573 dword_ptr = (uint32_t *)pkt;
574 for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++)
575 *dword_ptr++ = 0;
576
577 /* Set entry count. */
578 pkt->entry_count = 1;
579
580 break;
581 }
582
583 /* Release ring specific lock */
584 spin_unlock_irq(&ha->hardware_lock);
585
586 udelay(2); /* 2 us */
587
588 /* Check for pending interrupts. */
589 /* During init we issue marker directly */
590 if (!vha->marker_needed && !vha->flags.init_done)
591 qla2x00_poll(rsp);
592 spin_lock_irq(&ha->hardware_lock);
593 }
594 if (!pkt) {
595 DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
596 }
597
598 return (pkt);
599}
600
601/**
602 * qla2x00_isp_cmd() - Modify the request ring pointer. 522 * qla2x00_isp_cmd() - Modify the request ring pointer.
603 * @ha: HA context 523 * @ha: HA context
604 * 524 *
@@ -1559,11 +1479,9 @@ static void qla25xx_set_que(srb_t *sp, struct rsp_que **rsp)
1559} 1479}
1560 1480
1561/* Generic Control-SRB manipulation functions. */ 1481/* Generic Control-SRB manipulation functions. */
1562 1482void *
1563static void * 1483qla2x00_alloc_iocbs(scsi_qla_host_t *vha, srb_t *sp)
1564qla2x00_alloc_iocbs(srb_t *sp)
1565{ 1484{
1566 scsi_qla_host_t *vha = sp->fcport->vha;
1567 struct qla_hw_data *ha = vha->hw; 1485 struct qla_hw_data *ha = vha->hw;
1568 struct req_que *req = ha->req_q_map[0]; 1486 struct req_que *req = ha->req_q_map[0];
1569 device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id); 1487 device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id);
@@ -1573,6 +1491,10 @@ qla2x00_alloc_iocbs(srb_t *sp)
1573 1491
1574 pkt = NULL; 1492 pkt = NULL;
1575 req_cnt = 1; 1493 req_cnt = 1;
1494 handle = 0;
1495
1496 if (!sp)
1497 goto skip_cmd_array;
1576 1498
1577 /* Check for room in outstanding command list. */ 1499 /* Check for room in outstanding command list. */
1578 handle = req->current_outstanding_cmd; 1500 handle = req->current_outstanding_cmd;
@@ -1586,10 +1508,18 @@ qla2x00_alloc_iocbs(srb_t *sp)
1586 if (index == MAX_OUTSTANDING_COMMANDS) 1508 if (index == MAX_OUTSTANDING_COMMANDS)
1587 goto queuing_error; 1509 goto queuing_error;
1588 1510
1511 /* Prep command array. */
1512 req->current_outstanding_cmd = handle;
1513 req->outstanding_cmds[handle] = sp;
1514 sp->handle = handle;
1515
1516skip_cmd_array:
1589 /* Check for room on request queue. */ 1517 /* Check for room on request queue. */
1590 if (req->cnt < req_cnt) { 1518 if (req->cnt < req_cnt) {
1591 if (ha->mqenable) 1519 if (ha->mqenable)
1592 cnt = RD_REG_DWORD(&reg->isp25mq.req_q_out); 1520 cnt = RD_REG_DWORD(&reg->isp25mq.req_q_out);
1521 else if (IS_QLA82XX(ha))
1522 cnt = RD_REG_DWORD(&reg->isp82.req_q_out);
1593 else if (IS_FWI2_CAPABLE(ha)) 1523 else if (IS_FWI2_CAPABLE(ha))
1594 cnt = RD_REG_DWORD(&reg->isp24.req_q_out); 1524 cnt = RD_REG_DWORD(&reg->isp24.req_q_out);
1595 else 1525 else
@@ -1606,15 +1536,11 @@ qla2x00_alloc_iocbs(srb_t *sp)
1606 goto queuing_error; 1536 goto queuing_error;
1607 1537
1608 /* Prep packet */ 1538 /* Prep packet */
1609 req->current_outstanding_cmd = handle;
1610 req->outstanding_cmds[handle] = sp;
1611 req->cnt -= req_cnt; 1539 req->cnt -= req_cnt;
1612
1613 pkt = req->ring_ptr; 1540 pkt = req->ring_ptr;
1614 memset(pkt, 0, REQUEST_ENTRY_SIZE); 1541 memset(pkt, 0, REQUEST_ENTRY_SIZE);
1615 pkt->entry_count = req_cnt; 1542 pkt->entry_count = req_cnt;
1616 pkt->handle = handle; 1543 pkt->handle = handle;
1617 sp->handle = handle;
1618 1544
1619queuing_error: 1545queuing_error:
1620 return pkt; 1546 return pkt;
@@ -1795,31 +1721,6 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
1795} 1721}
1796 1722
1797static void 1723static void
1798qla24xx_marker_iocb(srb_t *sp, struct mrk_entry_24xx *mrk)
1799{
1800 uint16_t lun;
1801 uint8_t modif;
1802 struct fc_port *fcport = sp->fcport;
1803 scsi_qla_host_t *vha = fcport->vha;
1804 struct srb_ctx *ctx = sp->ctx;
1805 struct srb_iocb *iocb = ctx->u.iocb_cmd;
1806 struct req_que *req = vha->req;
1807
1808 lun = iocb->u.marker.lun;
1809 modif = iocb->u.marker.modif;
1810 mrk->entry_type = MARKER_TYPE;
1811 mrk->modifier = modif;
1812 if (modif != MK_SYNC_ALL) {
1813 mrk->nport_handle = cpu_to_le16(fcport->loop_id);
1814 mrk->lun[1] = LSB(lun);
1815 mrk->lun[2] = MSB(lun);
1816 host_to_fcp_swap(mrk->lun, sizeof(mrk->lun));
1817 mrk->vp_index = vha->vp_idx;
1818 mrk->handle = MAKE_HANDLE(req->id, mrk->handle);
1819 }
1820}
1821
1822static void
1823qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) 1724qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
1824{ 1725{
1825 struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job; 1726 struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job;
@@ -1945,7 +1846,7 @@ qla2x00_start_sp(srb_t *sp)
1945 1846
1946 rval = QLA_FUNCTION_FAILED; 1847 rval = QLA_FUNCTION_FAILED;
1947 spin_lock_irqsave(&ha->hardware_lock, flags); 1848 spin_lock_irqsave(&ha->hardware_lock, flags);
1948 pkt = qla2x00_alloc_iocbs(sp); 1849 pkt = qla2x00_alloc_iocbs(sp->fcport->vha, sp);
1949 if (!pkt) 1850 if (!pkt)
1950 goto done; 1851 goto done;
1951 1852
@@ -1976,9 +1877,6 @@ qla2x00_start_sp(srb_t *sp)
1976 case SRB_TM_CMD: 1877 case SRB_TM_CMD:
1977 qla24xx_tm_iocb(sp, pkt); 1878 qla24xx_tm_iocb(sp, pkt);
1978 break; 1879 break;
1979 case SRB_MARKER_CMD:
1980 qla24xx_marker_iocb(sp, pkt);
1981 break;
1982 default: 1880 default:
1983 break; 1881 break;
1984 } 1882 }
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 8a608725eb76..ba971ac1c4e8 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1238,39 +1238,6 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
1238 iocb->done(sp); 1238 iocb->done(sp);
1239} 1239}
1240 1240
1241static void
1242qla24xx_marker_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
1243 struct mrk_entry_24xx *mrk)
1244{
1245 const char func[] = "MRK-IOCB";
1246 const char *type;
1247 fc_port_t *fcport;
1248 srb_t *sp;
1249 struct srb_iocb *iocb;
1250 struct srb_ctx *ctx;
1251 struct sts_entry_24xx *sts = (struct sts_entry_24xx *)mrk;
1252
1253 sp = qla2x00_get_sp_from_handle(vha, func, req, mrk);
1254 if (!sp)
1255 return;
1256
1257 ctx = sp->ctx;
1258 iocb = ctx->u.iocb_cmd;
1259 type = ctx->name;
1260 fcport = sp->fcport;
1261
1262 if (sts->entry_status) {
1263 iocb->u.marker.data = 1;
1264 DEBUG2(printk(KERN_WARNING
1265 "scsi(%ld:%x): Async-%s error entry - entry-status=%x.\n",
1266 fcport->vha->host_no, sp->handle, type,
1267 sts->entry_status));
1268 DEBUG2(qla2x00_dump_buffer((uint8_t *)mrk, sizeof(*sts)));
1269 }
1270
1271 iocb->done(sp);
1272}
1273
1274/** 1241/**
1275 * qla2x00_process_response_queue() - Process response queue entries. 1242 * qla2x00_process_response_queue() - Process response queue entries.
1276 * @ha: SCSI driver HA context 1243 * @ha: SCSI driver HA context
@@ -1942,10 +1909,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
1942 qla24xx_tm_iocb_entry(vha, rsp->req, 1909 qla24xx_tm_iocb_entry(vha, rsp->req,
1943 (struct tsk_mgmt_entry *)pkt); 1910 (struct tsk_mgmt_entry *)pkt);
1944 break; 1911 break;
1945 case MARKER_TYPE:
1946 qla24xx_marker_iocb_entry(vha, rsp->req,
1947 (struct mrk_entry_24xx *)pkt);
1948 break;
1949 case CT_IOCB_TYPE: 1912 case CT_IOCB_TYPE:
1950 qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); 1913 qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
1951 clear_bit(MBX_INTERRUPT, &vha->hw->mbx_cmd_flags); 1914 clear_bit(MBX_INTERRUPT, &vha->hw->mbx_cmd_flags);