diff options
author | Harish Zunjarrao <harish.zunjarrao@qlogic.com> | 2010-07-23 06:28:32 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 10:06:13 -0400 |
commit | 9bc4f4fb44d22e5edc9369c87585a3b492073b8b (patch) | |
tree | 0d2469b389af3e4b020b8e96b2d5beaeec3cb1db /drivers/scsi/qla2xxx/qla_iocb.c | |
parent | 9a15eb4b514c526cf3181ce224967ab5d8dafe77 (diff) |
[SCSI] qla2xxx: Add CT passthru support for ISP23xx adapters
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_iocb.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_iocb.c | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 370646f7b3ff..e27d94713bdf 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -1765,6 +1765,82 @@ qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) | |||
1765 | } | 1765 | } |
1766 | 1766 | ||
1767 | static void | 1767 | static void |
1768 | qla2x00_ct_iocb(srb_t *sp, ms_iocb_entry_t *ct_iocb) | ||
1769 | { | ||
1770 | uint16_t avail_dsds; | ||
1771 | uint32_t *cur_dsd; | ||
1772 | struct scatterlist *sg; | ||
1773 | int index; | ||
1774 | uint16_t tot_dsds; | ||
1775 | scsi_qla_host_t *vha = sp->fcport->vha; | ||
1776 | struct qla_hw_data *ha = vha->hw; | ||
1777 | struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job; | ||
1778 | int loop_iterartion = 0; | ||
1779 | int cont_iocb_prsnt = 0; | ||
1780 | int entry_count = 1; | ||
1781 | |||
1782 | memset(ct_iocb, 0, sizeof(ms_iocb_entry_t)); | ||
1783 | ct_iocb->entry_type = CT_IOCB_TYPE; | ||
1784 | ct_iocb->entry_status = 0; | ||
1785 | ct_iocb->handle1 = sp->handle; | ||
1786 | SET_TARGET_ID(ha, ct_iocb->loop_id, sp->fcport->loop_id); | ||
1787 | ct_iocb->status = __constant_cpu_to_le16(0); | ||
1788 | ct_iocb->control_flags = __constant_cpu_to_le16(0); | ||
1789 | ct_iocb->timeout = 0; | ||
1790 | ct_iocb->cmd_dsd_count = | ||
1791 | __constant_cpu_to_le16(bsg_job->request_payload.sg_cnt); | ||
1792 | ct_iocb->total_dsd_count = | ||
1793 | __constant_cpu_to_le16(bsg_job->request_payload.sg_cnt + 1); | ||
1794 | ct_iocb->req_bytecount = | ||
1795 | cpu_to_le32(bsg_job->request_payload.payload_len); | ||
1796 | ct_iocb->rsp_bytecount = | ||
1797 | cpu_to_le32(bsg_job->reply_payload.payload_len); | ||
1798 | |||
1799 | ct_iocb->dseg_req_address[0] = cpu_to_le32(LSD(sg_dma_address | ||
1800 | (bsg_job->request_payload.sg_list))); | ||
1801 | ct_iocb->dseg_req_address[1] = cpu_to_le32(MSD(sg_dma_address | ||
1802 | (bsg_job->request_payload.sg_list))); | ||
1803 | ct_iocb->dseg_req_length = ct_iocb->req_bytecount; | ||
1804 | |||
1805 | ct_iocb->dseg_rsp_address[0] = cpu_to_le32(LSD(sg_dma_address | ||
1806 | (bsg_job->reply_payload.sg_list))); | ||
1807 | ct_iocb->dseg_rsp_address[1] = cpu_to_le32(MSD(sg_dma_address | ||
1808 | (bsg_job->reply_payload.sg_list))); | ||
1809 | ct_iocb->dseg_rsp_length = ct_iocb->rsp_bytecount; | ||
1810 | |||
1811 | avail_dsds = 1; | ||
1812 | cur_dsd = (uint32_t *)ct_iocb->dseg_rsp_address; | ||
1813 | index = 0; | ||
1814 | tot_dsds = bsg_job->reply_payload.sg_cnt; | ||
1815 | |||
1816 | for_each_sg(bsg_job->reply_payload.sg_list, sg, tot_dsds, index) { | ||
1817 | dma_addr_t sle_dma; | ||
1818 | cont_a64_entry_t *cont_pkt; | ||
1819 | |||
1820 | /* Allocate additional continuation packets? */ | ||
1821 | if (avail_dsds == 0) { | ||
1822 | /* | ||
1823 | * Five DSDs are available in the Cont. | ||
1824 | * Type 1 IOCB. | ||
1825 | */ | ||
1826 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); | ||
1827 | cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; | ||
1828 | avail_dsds = 5; | ||
1829 | cont_iocb_prsnt = 1; | ||
1830 | entry_count++; | ||
1831 | } | ||
1832 | |||
1833 | sle_dma = sg_dma_address(sg); | ||
1834 | *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); | ||
1835 | *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); | ||
1836 | *cur_dsd++ = cpu_to_le32(sg_dma_len(sg)); | ||
1837 | loop_iterartion++; | ||
1838 | avail_dsds--; | ||
1839 | } | ||
1840 | ct_iocb->entry_count = entry_count; | ||
1841 | } | ||
1842 | |||
1843 | static void | ||
1768 | qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) | 1844 | qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) |
1769 | { | 1845 | { |
1770 | uint16_t avail_dsds; | 1846 | uint16_t avail_dsds; |
@@ -1867,7 +1943,9 @@ qla2x00_start_sp(srb_t *sp) | |||
1867 | qla24xx_els_iocb(sp, pkt); | 1943 | qla24xx_els_iocb(sp, pkt); |
1868 | break; | 1944 | break; |
1869 | case SRB_CT_CMD: | 1945 | case SRB_CT_CMD: |
1870 | qla24xx_ct_iocb(sp, pkt); | 1946 | IS_FWI2_CAPABLE(ha) ? |
1947 | qla24xx_ct_iocb(sp, pkt) : | ||
1948 | qla2x00_ct_iocb(sp, pkt); | ||
1871 | break; | 1949 | break; |
1872 | case SRB_ADISC_CMD: | 1950 | case SRB_ADISC_CMD: |
1873 | IS_FWI2_CAPABLE(ha) ? | 1951 | IS_FWI2_CAPABLE(ha) ? |