hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/scsi/qla2xxx/qla_mr.c
....@@ -1,8 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * QLogic Fibre Channel HBA Driver
34 * Copyright (c) 2003-2014 QLogic Corporation
4
- *
5
- * See LICENSE.qla2xxx for copyright and licensing details.
65 */
76 #include "qla_def.h"
87 #include <linux/delay.h>
....@@ -10,7 +9,6 @@
109 #include <linux/pci.h>
1110 #include <linux/ratelimit.h>
1211 #include <linux/vmalloc.h>
13
-#include <linux/bsg-lib.h>
1412 #include <scsi/scsi_tcq.h>
1513 #include <linux/utsname.h>
1614
....@@ -47,17 +45,16 @@
4745 uint8_t io_lock_on;
4846 uint16_t command = 0;
4947 uint32_t *iptr;
50
- uint32_t __iomem *optr;
48
+ __le32 __iomem *optr;
5149 uint32_t cnt;
5250 uint32_t mboxes;
5351 unsigned long wait_time;
5452 struct qla_hw_data *ha = vha->hw;
5553 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
5654
57
- if (ha->pdev->error_state > pci_channel_io_frozen) {
55
+ if (ha->pdev->error_state == pci_channel_io_perm_failure) {
5856 ql_log(ql_log_warn, vha, 0x115c,
59
- "error_state is greater than pci_channel_io_frozen, "
60
- "exiting.\n");
57
+ "PCI channel failed permanently, exiting.\n");
6158 return QLA_FUNCTION_TIMEOUT;
6259 }
6360
....@@ -111,7 +108,7 @@
111108 spin_lock_irqsave(&ha->hardware_lock, flags);
112109
113110 /* Load mailbox registers. */
114
- optr = (uint32_t __iomem *)&reg->ispfx00.mailbox0;
111
+ optr = &reg->ispfx00.mailbox0;
115112
116113 iptr = mcp->mb;
117114 command = mcp->mb[0];
....@@ -119,7 +116,7 @@
119116
120117 for (cnt = 0; cnt < ha->mbx_count; cnt++) {
121118 if (mboxes & BIT_0)
122
- WRT_REG_DWORD(optr, *iptr);
119
+ wrt_reg_dword(optr, *iptr);
123120
124121 mboxes >>= 1;
125122 optr++;
....@@ -149,7 +146,8 @@
149146 QLAFX00_SET_HST_INTR(ha, ha->mbx_intr_code);
150147 spin_unlock_irqrestore(&ha->hardware_lock, flags);
151148
152
- wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ);
149
+ WARN_ON_ONCE(wait_for_completion_timeout(&ha->mbx_intr_comp,
150
+ mcp->tov * HZ) != 0);
153151 } else {
154152 ql_dbg(ql_dbg_mbx, vha, 0x112c,
155153 "Cmd=%x Polling Mode.\n", command);
....@@ -273,9 +271,9 @@
273271
274272 if (rval) {
275273 ql_log(ql_log_warn, base_vha, 0x1163,
276
- "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, "
277
- "mb[3]=%x, cmd=%x ****.\n",
278
- mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3], command);
274
+ "**** Failed=%x mbx[0]=%x, mb[1]=%x, mb[2]=%x, mb[3]=%x, cmd=%x ****.\n",
275
+ rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3],
276
+ command);
279277 } else {
280278 ql_dbg(ql_dbg_mbx, base_vha, 0x1164, "Done %s.\n", __func__);
281279 }
....@@ -629,17 +627,20 @@
629627 *
630628 * Returns 0 on success.
631629 */
632
-void
630
+int
633631 qlafx00_soft_reset(scsi_qla_host_t *vha)
634632 {
635633 struct qla_hw_data *ha = vha->hw;
634
+ int rval = QLA_FUNCTION_FAILED;
636635
637636 if (unlikely(pci_channel_offline(ha->pdev) &&
638637 ha->flags.pci_channel_io_perm_failure))
639
- return;
638
+ return rval;
640639
641640 ha->isp_ops->disable_intrs(ha);
642641 qlafx00_soc_cpu_reset(vha);
642
+
643
+ return QLA_SUCCESS;
643644 }
644645
645646 /**
....@@ -674,25 +675,23 @@
674675 struct qla_hw_data *ha = vha->hw;
675676 struct device_reg_fx00 __iomem *reg = &ha->iobase->ispfx00;
676677
677
- WRT_REG_DWORD(&reg->req_q_in, 0);
678
- WRT_REG_DWORD(&reg->req_q_out, 0);
678
+ wrt_reg_dword(&reg->req_q_in, 0);
679
+ wrt_reg_dword(&reg->req_q_out, 0);
679680
680
- WRT_REG_DWORD(&reg->rsp_q_in, 0);
681
- WRT_REG_DWORD(&reg->rsp_q_out, 0);
681
+ wrt_reg_dword(&reg->rsp_q_in, 0);
682
+ wrt_reg_dword(&reg->rsp_q_out, 0);
682683
683684 /* PCI posting */
684
- RD_REG_DWORD(&reg->rsp_q_out);
685
+ rd_reg_dword(&reg->rsp_q_out);
685686 }
686687
687688 char *
688
-qlafx00_pci_info_str(struct scsi_qla_host *vha, char *str)
689
+qlafx00_pci_info_str(struct scsi_qla_host *vha, char *str, size_t str_len)
689690 {
690691 struct qla_hw_data *ha = vha->hw;
691692
692
- if (pci_is_pcie(ha->pdev)) {
693
- strcpy(str, "PCIe iSA");
694
- return str;
695
- }
693
+ if (pci_is_pcie(ha->pdev))
694
+ strlcpy(str, "PCIe iSA", str_len);
696695 return str;
697696 }
698697
....@@ -765,7 +764,7 @@
765764 }
766765
767766 ha->cregbase =
768
- ioremap_nocache(pci_resource_start(ha->pdev, 0), BAR0_LEN_FX00);
767
+ ioremap(pci_resource_start(ha->pdev, 0), BAR0_LEN_FX00);
769768 if (!ha->cregbase) {
770769 ql_log_pci(ql_log_fatal, ha->pdev, 0x0128,
771770 "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
....@@ -786,7 +785,7 @@
786785 }
787786
788787 ha->iobase =
789
- ioremap_nocache(pci_resource_start(ha->pdev, 2), BAR2_LEN_FX00);
788
+ ioremap(pci_resource_start(ha->pdev, 2), BAR2_LEN_FX00);
790789 if (!ha->iobase) {
791790 ql_log_pci(ql_log_fatal, ha->pdev, 0x012b,
792791 "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
....@@ -889,9 +888,9 @@
889888 /* 30 seconds wait - Adjust if required */
890889 wait_time = 30;
891890
892
- pseudo_aen = RD_REG_DWORD(&reg->pseudoaen);
891
+ pseudo_aen = rd_reg_dword(&reg->pseudoaen);
893892 if (pseudo_aen == 1) {
894
- aenmbx7 = RD_REG_DWORD(&reg->initval7);
893
+ aenmbx7 = rd_reg_dword(&reg->initval7);
895894 ha->mbx_intr_code = MSW(aenmbx7);
896895 ha->rqstq_intr_code = LSW(aenmbx7);
897896 rval = qlafx00_driver_shutdown(vha, 10);
....@@ -902,7 +901,7 @@
902901 /* wait time before firmware ready */
903902 wtime = jiffies + (wait_time * HZ);
904903 do {
905
- aenmbx = RD_REG_DWORD(&reg->aenmailbox0);
904
+ aenmbx = rd_reg_dword(&reg->aenmailbox0);
906905 barrier();
907906 ql_dbg(ql_dbg_mbx, vha, 0x0133,
908907 "aenmbx: 0x%x\n", aenmbx);
....@@ -921,15 +920,15 @@
921920
922921 case MBA_FW_RESTART_CMPLT:
923922 /* Set the mbx and rqstq intr code */
924
- aenmbx7 = RD_REG_DWORD(&reg->aenmailbox7);
923
+ aenmbx7 = rd_reg_dword(&reg->aenmailbox7);
925924 ha->mbx_intr_code = MSW(aenmbx7);
926925 ha->rqstq_intr_code = LSW(aenmbx7);
927
- ha->req_que_off = RD_REG_DWORD(&reg->aenmailbox1);
928
- ha->rsp_que_off = RD_REG_DWORD(&reg->aenmailbox3);
929
- ha->req_que_len = RD_REG_DWORD(&reg->aenmailbox5);
930
- ha->rsp_que_len = RD_REG_DWORD(&reg->aenmailbox6);
931
- WRT_REG_DWORD(&reg->aenmailbox0, 0);
932
- RD_REG_DWORD_RELAXED(&reg->aenmailbox0);
926
+ ha->req_que_off = rd_reg_dword(&reg->aenmailbox1);
927
+ ha->rsp_que_off = rd_reg_dword(&reg->aenmailbox3);
928
+ ha->req_que_len = rd_reg_dword(&reg->aenmailbox5);
929
+ ha->rsp_que_len = rd_reg_dword(&reg->aenmailbox6);
930
+ wrt_reg_dword(&reg->aenmailbox0, 0);
931
+ rd_reg_dword_relaxed(&reg->aenmailbox0);
933932 ql_dbg(ql_dbg_init, vha, 0x0134,
934933 "f/w returned mbx_intr_code: 0x%x, "
935934 "rqstq_intr_code: 0x%x\n",
....@@ -959,13 +958,13 @@
959958 * 3. issue Get FW State Mbox cmd to determine fw state
960959 * Set the mbx and rqstq intr code from Shadow Regs
961960 */
962
- aenmbx7 = RD_REG_DWORD(&reg->initval7);
961
+ aenmbx7 = rd_reg_dword(&reg->initval7);
963962 ha->mbx_intr_code = MSW(aenmbx7);
964963 ha->rqstq_intr_code = LSW(aenmbx7);
965
- ha->req_que_off = RD_REG_DWORD(&reg->initval1);
966
- ha->rsp_que_off = RD_REG_DWORD(&reg->initval3);
967
- ha->req_que_len = RD_REG_DWORD(&reg->initval5);
968
- ha->rsp_que_len = RD_REG_DWORD(&reg->initval6);
964
+ ha->req_que_off = rd_reg_dword(&reg->initval1);
965
+ ha->rsp_que_off = rd_reg_dword(&reg->initval3);
966
+ ha->req_que_len = rd_reg_dword(&reg->initval5);
967
+ ha->rsp_que_len = rd_reg_dword(&reg->initval6);
969968 ql_dbg(ql_dbg_init, vha, 0x0135,
970969 "f/w returned mbx_intr_code: 0x%x, "
971970 "rqstq_intr_code: 0x%x\n",
....@@ -1011,7 +1010,7 @@
10111010 if (time_after_eq(jiffies, wtime)) {
10121011 ql_dbg(ql_dbg_init, vha, 0x0137,
10131012 "Init f/w failed: aen[7]: 0x%x\n",
1014
- RD_REG_DWORD(&reg->aenmailbox7));
1013
+ rd_reg_dword(&reg->aenmailbox7));
10151014 rval = QLA_FUNCTION_FAILED;
10161015 done = true;
10171016 break;
....@@ -1115,8 +1114,8 @@
11151114
11161115 ql_dbg(ql_dbg_disc + ql_dbg_init, vha, 0x2088,
11171116 "Listing Target bit map...\n");
1118
- ql_dump_buffer(ql_dbg_disc + ql_dbg_init, vha,
1119
- 0x2089, (uint8_t *)ha->gid_list, 32);
1117
+ ql_dump_buffer(ql_dbg_disc + ql_dbg_init, vha, 0x2089,
1118
+ ha->gid_list, 32);
11201119
11211120 /* Allocate temporary rmtport for any new rmtports discovered. */
11221121 new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
....@@ -1186,9 +1185,9 @@
11861185 " Existing TGT-ID %x did not get "
11871186 " offline event from firmware.\n",
11881187 fcport->old_tgt_id);
1189
- qla2x00_mark_device_lost(vha, fcport, 0, 0);
1188
+ qla2x00_mark_device_lost(vha, fcport, 0);
11901189 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
1191
- kfree(new_fcport);
1190
+ qla2x00_free_fcport(new_fcport);
11921191 return rval;
11931192 }
11941193 break;
....@@ -1206,7 +1205,7 @@
12061205 return QLA_MEMORY_ALLOC_FAILED;
12071206 }
12081207
1209
- kfree(new_fcport);
1208
+ qla2x00_free_fcport(new_fcport);
12101209 return rval;
12111210 }
12121211
....@@ -1250,7 +1249,7 @@
12501249
12511250 if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
12521251 if (fcport->port_type != FCT_INITIATOR)
1253
- qla2x00_mark_device_lost(vha, fcport, 0, 0);
1252
+ qla2x00_mark_device_lost(vha, fcport, 0);
12541253 }
12551254 }
12561255
....@@ -1274,7 +1273,7 @@
12741273 /* Free all new device structures not processed. */
12751274 list_for_each_entry_safe(fcport, rmptemp, &new_fcports, list) {
12761275 list_del(&fcport->list);
1277
- kfree(fcport);
1276
+ qla2x00_free_fcport(fcport);
12781277 }
12791278
12801279 return rval;
....@@ -1297,6 +1296,7 @@
12971296 {
12981297 int rval;
12991298 unsigned long flags;
1299
+
13001300 rval = QLA_SUCCESS;
13011301
13021302 flags = vha->dpc_flags;
....@@ -1404,7 +1404,7 @@
14041404 pkt = rsp->ring_ptr;
14051405 for (cnt = 0; cnt < rsp->length; cnt++) {
14061406 pkt->signature = RESPONSE_PROCESSED;
1407
- WRT_REG_DWORD((void __force __iomem *)&pkt->signature,
1407
+ wrt_reg_dword((void __force __iomem *)&pkt->signature,
14081408 RESPONSE_PROCESSED);
14091409 pkt++;
14101410 }
....@@ -1420,13 +1420,13 @@
14201420
14211421 qla2x00_request_irqs(ha, ha->rsp_q_map[0]);
14221422
1423
- aenmbx7 = RD_REG_DWORD(&reg->aenmailbox7);
1423
+ aenmbx7 = rd_reg_dword(&reg->aenmailbox7);
14241424 ha->mbx_intr_code = MSW(aenmbx7);
14251425 ha->rqstq_intr_code = LSW(aenmbx7);
1426
- ha->req_que_off = RD_REG_DWORD(&reg->aenmailbox1);
1427
- ha->rsp_que_off = RD_REG_DWORD(&reg->aenmailbox3);
1428
- ha->req_que_len = RD_REG_DWORD(&reg->aenmailbox5);
1429
- ha->rsp_que_len = RD_REG_DWORD(&reg->aenmailbox6);
1426
+ ha->req_que_off = rd_reg_dword(&reg->aenmailbox1);
1427
+ ha->rsp_que_off = rd_reg_dword(&reg->aenmailbox3);
1428
+ ha->req_que_len = rd_reg_dword(&reg->aenmailbox5);
1429
+ ha->rsp_que_len = rd_reg_dword(&reg->aenmailbox6);
14301430
14311431 ql_dbg(ql_dbg_disc, vha, 0x2094,
14321432 "fw returned mbx_intr_code: 0x%x, rqstq_intr_code: 0x%x "
....@@ -1471,7 +1471,7 @@
14711471 (!test_bit(UNLOADING, &vha->dpc_flags)) &&
14721472 (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) &&
14731473 (ha->mr.fw_hbt_en)) {
1474
- fw_heart_beat = RD_REG_DWORD(&reg->fwheartbeat);
1474
+ fw_heart_beat = rd_reg_dword(&reg->fwheartbeat);
14751475 if (fw_heart_beat != ha->mr.old_fw_hbt_cnt) {
14761476 ha->mr.old_fw_hbt_cnt = fw_heart_beat;
14771477 ha->mr.fw_hbt_miss_cnt = 0;
....@@ -1491,7 +1491,7 @@
14911491
14921492 if (test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags)) {
14931493 /* Reset recovery to be performed in timer routine */
1494
- aenmbx0 = RD_REG_DWORD(&reg->aenmailbox0);
1494
+ aenmbx0 = rd_reg_dword(&reg->aenmailbox0);
14951495 if (ha->mr.fw_reset_timer_exp) {
14961496 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
14971497 qla2xxx_wake_dpc(vha);
....@@ -1681,15 +1681,14 @@
16811681 if (!fcport)
16821682 return;
16831683
1684
- qla2x00_mark_device_lost(vha, fcport, 0, 0);
1684
+ qla2x00_mark_device_lost(vha, fcport, 0);
16851685
16861686 return;
16871687 }
16881688
1689
-int
1689
+void
16901690 qlafx00_process_aen(struct scsi_qla_host *vha, struct qla_work_evt *evt)
16911691 {
1692
- int rval = 0;
16931692 uint32_t aen_code, aen_data;
16941693
16951694 aen_code = FCH_EVT_VENDOR_UNIQUE;
....@@ -1715,7 +1714,7 @@
17151714 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
17161715 } else if (evt->u.aenfx.mbx[2] == 2) {
17171716 vha->device_flags |= DFLG_NO_CABLE;
1718
- qla2x00_mark_all_devices_lost(vha, 1);
1717
+ qla2x00_mark_all_devices_lost(vha);
17191718 }
17201719 }
17211720 break;
....@@ -1740,8 +1739,6 @@
17401739
17411740 fc_host_post_event(vha->host, fc_get_event_number(),
17421741 aen_code, aen_data);
1743
-
1744
- return rval;
17451742 }
17461743
17471744 static void
....@@ -1772,10 +1769,8 @@
17721769 complete(&lio->u.fxiocb.fxiocb_comp);
17731770 }
17741771
1775
-static void
1776
-qla2x00_fxdisc_sp_done(void *ptr, int res)
1772
+static void qla2x00_fxdisc_sp_done(srb_t *sp, int res)
17771773 {
1778
- srb_t *sp = ptr;
17791774 struct srb_iocb *lio = &sp->u.iocb_cmd;
17801775
17811776 complete(&lio->u.fxiocb.fxiocb_comp);
....@@ -1854,22 +1849,22 @@
18541849 phost_info = &preg_hsi->hsi;
18551850 memset(preg_hsi, 0, sizeof(struct register_host_info));
18561851 phost_info->os_type = OS_TYPE_LINUX;
1857
- strncpy(phost_info->sysname,
1858
- p_sysid->sysname, SYSNAME_LENGTH);
1859
- strncpy(phost_info->nodename,
1860
- p_sysid->nodename, NODENAME_LENGTH);
1852
+ strlcpy(phost_info->sysname, p_sysid->sysname,
1853
+ sizeof(phost_info->sysname));
1854
+ strlcpy(phost_info->nodename, p_sysid->nodename,
1855
+ sizeof(phost_info->nodename));
18611856 if (!strcmp(phost_info->nodename, "(none)"))
18621857 ha->mr.host_info_resend = true;
1863
- strncpy(phost_info->release,
1864
- p_sysid->release, RELEASE_LENGTH);
1865
- strncpy(phost_info->version,
1866
- p_sysid->version, VERSION_LENGTH);
1867
- strncpy(phost_info->machine,
1868
- p_sysid->machine, MACHINE_LENGTH);
1869
- strncpy(phost_info->domainname,
1870
- p_sysid->domainname, DOMNAME_LENGTH);
1871
- strncpy(phost_info->hostdriver,
1872
- QLA2XXX_VERSION, VERSION_LENGTH);
1858
+ strlcpy(phost_info->release, p_sysid->release,
1859
+ sizeof(phost_info->release));
1860
+ strlcpy(phost_info->version, p_sysid->version,
1861
+ sizeof(phost_info->version));
1862
+ strlcpy(phost_info->machine, p_sysid->machine,
1863
+ sizeof(phost_info->machine));
1864
+ strlcpy(phost_info->domainname, p_sysid->domainname,
1865
+ sizeof(phost_info->domainname));
1866
+ strlcpy(phost_info->hostdriver, QLA2XXX_VERSION,
1867
+ sizeof(phost_info->hostdriver));
18731868 preg_hsi->utc = (uint64_t)ktime_get_real_seconds();
18741869 ql_dbg(ql_dbg_init, vha, 0x0149,
18751870 "ISP%04X: Host registration with firmware\n",
....@@ -1890,8 +1885,7 @@
18901885 phost_info->domainname,
18911886 phost_info->hostdriver);
18921887 ql_dump_buffer(ql_dbg_init + ql_dbg_disc, vha, 0x014d,
1893
- (uint8_t *)phost_info,
1894
- sizeof(struct host_system_info));
1888
+ phost_info, sizeof(*phost_info));
18951889 }
18961890 }
18971891
....@@ -1915,8 +1909,10 @@
19151909 if (fx_type == FXDISC_GET_CONFIG_INFO) {
19161910 struct config_info_data *pinfo =
19171911 (struct config_info_data *) fdisc->u.fxiocb.rsp_addr;
1918
- strcpy(vha->hw->model_number, pinfo->model_num);
1919
- strcpy(vha->hw->model_desc, pinfo->model_description);
1912
+ strlcpy(vha->hw->model_number, pinfo->model_num,
1913
+ ARRAY_SIZE(vha->hw->model_number));
1914
+ strlcpy(vha->hw->model_desc, pinfo->model_description,
1915
+ ARRAY_SIZE(vha->hw->model_desc));
19201916 memcpy(&vha->hw->mr.symbolic_name, pinfo->symbolic_name,
19211917 sizeof(vha->hw->mr.symbolic_name));
19221918 memcpy(&vha->hw->mr.serial_num, pinfo->serial_num,
....@@ -1945,7 +1941,7 @@
19451941 vha->d_id.b.al_pa = pinfo->port_id[2];
19461942 qlafx00_update_host_attr(vha, pinfo);
19471943 ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0141,
1948
- (uint8_t *)pinfo, 16);
1944
+ pinfo, 16);
19491945 } else if (fx_type == FXDISC_GET_TGT_NODE_INFO) {
19501946 struct qlafx00_tgt_node_info *pinfo =
19511947 (struct qlafx00_tgt_node_info *) fdisc->u.fxiocb.rsp_addr;
....@@ -1953,12 +1949,12 @@
19531949 memcpy(fcport->port_name, pinfo->tgt_node_wwpn, WWN_SIZE);
19541950 fcport->port_type = FCT_TARGET;
19551951 ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0144,
1956
- (uint8_t *)pinfo, 16);
1952
+ pinfo, 16);
19571953 } else if (fx_type == FXDISC_GET_TGT_NODE_LIST) {
19581954 struct qlafx00_tgt_node_info *pinfo =
19591955 (struct qlafx00_tgt_node_info *) fdisc->u.fxiocb.rsp_addr;
19601956 ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0146,
1961
- (uint8_t *)pinfo, 16);
1957
+ pinfo, 16);
19621958 memcpy(vha->hw->gid_list, pinfo, QLAFX00_TGT_NODE_LIST_SIZE);
19631959 } else if (fx_type == FXDISC_ABORT_IOCTL)
19641960 fdisc->u.fxiocb.result =
....@@ -2189,7 +2185,7 @@
21892185 struct bsg_job *bsg_job;
21902186 struct fc_bsg_reply *bsg_reply;
21912187 struct srb_iocb *iocb_job;
2192
- int res;
2188
+ int res = 0;
21932189 struct qla_mt_iocb_rsp_fx00 fstatus;
21942190 uint8_t *fw_sts_ptr;
21952191
....@@ -2225,18 +2221,16 @@
22252221
22262222 fw_sts_ptr = bsg_job->reply + sizeof(struct fc_bsg_reply);
22272223
2228
- memcpy(fw_sts_ptr, (uint8_t *)&fstatus,
2229
- sizeof(struct qla_mt_iocb_rsp_fx00));
2224
+ memcpy(fw_sts_ptr, &fstatus, sizeof(fstatus));
22302225 bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
22312226 sizeof(struct qla_mt_iocb_rsp_fx00) + sizeof(uint8_t);
22322227
22332228 ql_dump_buffer(ql_dbg_user + ql_dbg_verbose,
2234
- sp->fcport->vha, 0x5080,
2235
- (uint8_t *)pkt, sizeof(struct ioctl_iocb_entry_fx00));
2229
+ sp->vha, 0x5080, pkt, sizeof(*pkt));
22362230
22372231 ql_dump_buffer(ql_dbg_user + ql_dbg_verbose,
2238
- sp->fcport->vha, 0x5074,
2239
- (uint8_t *)fw_sts_ptr, sizeof(struct qla_mt_iocb_rsp_fx00));
2232
+ sp->vha, 0x5074,
2233
+ fw_sts_ptr, sizeof(fstatus));
22402234
22412235 res = bsg_reply->result = DID_OK << 16;
22422236 bsg_reply->reply_payload_rcv_len =
....@@ -2491,7 +2485,7 @@
24912485 atomic_read(&fcport->state));
24922486
24932487 if (atomic_read(&fcport->state) == FCS_ONLINE)
2494
- qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
2488
+ qla2x00_mark_device_lost(fcport->vha, fcport, 1);
24952489 break;
24962490
24972491 case CS_ABORTED:
....@@ -2517,6 +2511,8 @@
25172511
25182512 if (rsp->status_srb == NULL)
25192513 sp->done(sp, res);
2514
+ else
2515
+ WARN_ON_ONCE(true);
25202516 }
25212517
25222518 /**
....@@ -2574,7 +2570,7 @@
25742570
25752571 /* Move sense data. */
25762572 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x304e,
2577
- (uint8_t *)pkt, sizeof(sts_cont_entry_t));
2573
+ pkt, sizeof(*pkt));
25782574 memcpy(sense_ptr, pkt->data, sense_sz);
25792575 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x304a,
25802576 sense_ptr, sense_sz);
....@@ -2594,6 +2590,8 @@
25942590 if (sense_len == 0) {
25952591 rsp->status_srb = NULL;
25962592 sp->done(sp, cp->result);
2593
+ } else {
2594
+ WARN_ON_ONCE(true);
25972595 }
25982596 }
25992597
....@@ -2601,7 +2599,7 @@
26012599 * qlafx00_multistatus_entry() - Process Multi response queue entries.
26022600 * @vha: SCSI driver HA context
26032601 * @rsp: response queue
2604
- * @pkt:
2602
+ * @pkt: received packet
26052603 */
26062604 static void
26072605 qlafx00_multistatus_entry(struct scsi_qla_host *vha,
....@@ -2658,12 +2656,10 @@
26582656 * @vha: SCSI driver HA context
26592657 * @rsp: response queue
26602658 * @pkt: Entry pointer
2661
- * @estatus:
2662
- * @etype:
26632659 */
26642660 static void
26652661 qlafx00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp,
2666
- struct sts_entry_fx00 *pkt, uint8_t estatus, uint8_t etype)
2662
+ struct sts_entry_fx00 *pkt)
26672663 {
26682664 srb_t *sp;
26692665 struct qla_hw_data *ha = vha->hw;
....@@ -2671,9 +2667,6 @@
26712667 uint16_t que = 0;
26722668 struct req_que *req = NULL;
26732669 int res = DID_ERROR << 16;
2674
-
2675
- ql_dbg(ql_dbg_async, vha, 0x507f,
2676
- "type of error status in response: 0x%x\n", estatus);
26772670
26782671 req = ha->req_q_map[que];
26792672
....@@ -2701,7 +2694,7 @@
27012694 uint16_t lreq_q_in = 0;
27022695 uint16_t lreq_q_out = 0;
27032696
2704
- lreq_q_in = RD_REG_DWORD(rsp->rsp_q_in);
2697
+ lreq_q_in = rd_reg_dword(rsp->rsp_q_in);
27052698 lreq_q_out = rsp->ring_index;
27062699
27072700 while (lreq_q_in != lreq_q_out) {
....@@ -2722,9 +2715,11 @@
27222715
27232716 if (pkt->entry_status != 0 &&
27242717 pkt->entry_type != IOCTL_IOSB_TYPE_FX00) {
2718
+ ql_dbg(ql_dbg_async, vha, 0x507f,
2719
+ "type of error status in response: 0x%x\n",
2720
+ pkt->entry_status);
27252721 qlafx00_error_entry(vha, rsp,
2726
- (struct sts_entry_fx00 *)pkt, pkt->entry_status,
2727
- pkt->entry_type);
2722
+ (struct sts_entry_fx00 *)pkt);
27282723 continue;
27292724 }
27302725
....@@ -2761,7 +2756,7 @@
27612756 }
27622757
27632758 /* Adjust ring index */
2764
- WRT_REG_DWORD(rsp->rsp_q_out, rsp->ring_index);
2759
+ wrt_reg_dword(rsp->rsp_q_out, rsp->ring_index);
27652760 }
27662761
27672762 /**
....@@ -2792,9 +2787,9 @@
27922787 break;
27932788
27942789 case QLAFX00_MBA_PORT_UPDATE: /* Port database update */
2795
- ha->aenmb[1] = RD_REG_DWORD(&reg->aenmailbox1);
2796
- ha->aenmb[2] = RD_REG_DWORD(&reg->aenmailbox2);
2797
- ha->aenmb[3] = RD_REG_DWORD(&reg->aenmailbox3);
2790
+ ha->aenmb[1] = rd_reg_dword(&reg->aenmailbox1);
2791
+ ha->aenmb[2] = rd_reg_dword(&reg->aenmailbox2);
2792
+ ha->aenmb[3] = rd_reg_dword(&reg->aenmailbox3);
27982793 ql_dbg(ql_dbg_async, vha, 0x5077,
27992794 "Asynchronous port Update received "
28002795 "aenmb[0]: %x, aenmb[1]: %x, aenmb[2]: %x, aenmb[3]: %x\n",
....@@ -2824,13 +2819,13 @@
28242819 break;
28252820
28262821 default:
2827
- ha->aenmb[1] = RD_REG_WORD(&reg->aenmailbox1);
2828
- ha->aenmb[2] = RD_REG_WORD(&reg->aenmailbox2);
2829
- ha->aenmb[3] = RD_REG_WORD(&reg->aenmailbox3);
2830
- ha->aenmb[4] = RD_REG_WORD(&reg->aenmailbox4);
2831
- ha->aenmb[5] = RD_REG_WORD(&reg->aenmailbox5);
2832
- ha->aenmb[6] = RD_REG_WORD(&reg->aenmailbox6);
2833
- ha->aenmb[7] = RD_REG_WORD(&reg->aenmailbox7);
2822
+ ha->aenmb[1] = rd_reg_dword(&reg->aenmailbox1);
2823
+ ha->aenmb[2] = rd_reg_dword(&reg->aenmailbox2);
2824
+ ha->aenmb[3] = rd_reg_dword(&reg->aenmailbox3);
2825
+ ha->aenmb[4] = rd_reg_dword(&reg->aenmailbox4);
2826
+ ha->aenmb[5] = rd_reg_dword(&reg->aenmailbox5);
2827
+ ha->aenmb[6] = rd_reg_dword(&reg->aenmailbox6);
2828
+ ha->aenmb[7] = rd_reg_dword(&reg->aenmailbox7);
28342829 ql_dbg(ql_dbg_async, vha, 0x5078,
28352830 "AEN:%04x %04x %04x %04x :%04x %04x %04x %04x\n",
28362831 ha->aenmb[0], ha->aenmb[1], ha->aenmb[2], ha->aenmb[3],
....@@ -2844,13 +2839,13 @@
28442839 /**
28452840 * qlafx00x_mbx_completion() - Process mailbox command completions.
28462841 * @vha: SCSI driver HA context
2847
- * @mb0:
2842
+ * @mb0: value to be written into mailbox register 0
28482843 */
28492844 static void
28502845 qlafx00_mbx_completion(scsi_qla_host_t *vha, uint32_t mb0)
28512846 {
28522847 uint16_t cnt;
2853
- uint32_t __iomem *wptr;
2848
+ __le32 __iomem *wptr;
28542849 struct qla_hw_data *ha = vha->hw;
28552850 struct device_reg_fx00 __iomem *reg = &ha->iobase->ispfx00;
28562851
....@@ -2860,17 +2855,17 @@
28602855 /* Load return mailbox registers. */
28612856 ha->flags.mbox_int = 1;
28622857 ha->mailbox_out32[0] = mb0;
2863
- wptr = (uint32_t __iomem *)&reg->mailbox17;
2858
+ wptr = &reg->mailbox17;
28642859
28652860 for (cnt = 1; cnt < ha->mbx_count; cnt++) {
2866
- ha->mailbox_out32[cnt] = RD_REG_DWORD(wptr);
2861
+ ha->mailbox_out32[cnt] = rd_reg_dword(wptr);
28672862 wptr++;
28682863 }
28692864 }
28702865
28712866 /**
28722867 * qlafx00_intr_handler() - Process interrupts for the ISPFX00.
2873
- * @irq:
2868
+ * @irq: interrupt number
28742869 * @dev_id: SCSI driver HA context
28752870 *
28762871 * Called by system whenever the host adapter generates an interrupt.
....@@ -2917,13 +2912,13 @@
29172912 break;
29182913
29192914 if (stat & QLAFX00_INTR_MB_CMPLT) {
2920
- mb[0] = RD_REG_WORD(&reg->mailbox16);
2915
+ mb[0] = rd_reg_dword(&reg->mailbox16);
29212916 qlafx00_mbx_completion(vha, mb[0]);
29222917 status |= MBX_INTERRUPT;
29232918 clr_intr |= QLAFX00_INTR_MB_CMPLT;
29242919 }
29252920 if (intr_stat & QLAFX00_INTR_ASYNC_CMPLT) {
2926
- ha->aenmb[0] = RD_REG_WORD(&reg->aenmailbox0);
2921
+ ha->aenmb[0] = rd_reg_dword(&reg->aenmailbox0);
29272922 qlafx00_async_event(vha);
29282923 clr_intr |= QLAFX00_INTR_ASYNC_CMPLT;
29292924 }
....@@ -2972,7 +2967,7 @@
29722967 uint16_t tot_dsds, struct cmd_type_7_fx00 *lcmd_pkt)
29732968 {
29742969 uint16_t avail_dsds;
2975
- __le32 *cur_dsd;
2970
+ struct dsd64 *cur_dsd;
29762971 scsi_qla_host_t *vha;
29772972 struct scsi_cmnd *cmd;
29782973 struct scatterlist *sg;
....@@ -3008,12 +3003,10 @@
30083003
30093004 /* One DSD is available in the Command Type 3 IOCB */
30103005 avail_dsds = 1;
3011
- cur_dsd = (__le32 *)&lcmd_pkt->dseg_0_address;
3006
+ cur_dsd = &lcmd_pkt->dsd;
30123007
30133008 /* Load data segments */
30143009 scsi_for_each_sg(cmd, sg, tot_dsds, i) {
3015
- dma_addr_t sle_dma;
3016
-
30173010 /* Allocate additional continuation packets? */
30183011 if (avail_dsds == 0) {
30193012 /*
....@@ -3023,26 +3016,23 @@
30233016 memset(&lcont_pkt, 0, REQUEST_ENTRY_SIZE);
30243017 cont_pkt =
30253018 qlafx00_prep_cont_type1_iocb(req, &lcont_pkt);
3026
- cur_dsd = (__le32 *)lcont_pkt.dseg_0_address;
3019
+ cur_dsd = lcont_pkt.dsd;
30273020 avail_dsds = 5;
30283021 cont = 1;
30293022 }
30303023
3031
- sle_dma = sg_dma_address(sg);
3032
- *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
3033
- *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
3034
- *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
3024
+ append_dsd64(&cur_dsd, sg);
30353025 avail_dsds--;
30363026 if (avail_dsds == 0 && cont == 1) {
30373027 cont = 0;
30383028 memcpy_toio((void __iomem *)cont_pkt, &lcont_pkt,
3039
- REQUEST_ENTRY_SIZE);
3029
+ sizeof(lcont_pkt));
30403030 }
30413031
30423032 }
30433033 if (avail_dsds != 0 && cont == 1) {
30443034 memcpy_toio((void __iomem *)cont_pkt, &lcont_pkt,
3045
- REQUEST_ENTRY_SIZE);
3035
+ sizeof(lcont_pkt));
30463036 }
30473037 }
30483038
....@@ -3057,7 +3047,6 @@
30573047 {
30583048 int nseg;
30593049 unsigned long flags;
3060
- uint32_t index;
30613050 uint32_t handle;
30623051 uint16_t cnt;
30633052 uint16_t req_cnt;
....@@ -3081,16 +3070,8 @@
30813070 /* Acquire ring specific lock */
30823071 spin_lock_irqsave(&ha->hardware_lock, flags);
30833072
3084
- /* Check for room in outstanding command list. */
3085
- handle = req->current_outstanding_cmd;
3086
- for (index = 1; index < req->num_outstanding_cmds; index++) {
3087
- handle++;
3088
- if (handle == req->num_outstanding_cmds)
3089
- handle = 1;
3090
- if (!req->outstanding_cmds[handle])
3091
- break;
3092
- }
3093
- if (index == req->num_outstanding_cmds)
3073
+ handle = qla2xxx_get_next_handle(req);
3074
+ if (handle == 0)
30943075 goto queuing_error;
30953076
30963077 /* Map the sg table so we have an accurate count of sg entries needed */
....@@ -3105,7 +3086,7 @@
31053086 tot_dsds = nseg;
31063087 req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
31073088 if (req->cnt < (req_cnt + 2)) {
3108
- cnt = RD_REG_DWORD_RELAXED(req->req_q_out);
3089
+ cnt = rd_reg_dword_relaxed(req->req_q_out);
31093090
31103091 if (req->ring_index < cnt)
31113092 req->cnt = cnt - req->ring_index;
....@@ -3127,7 +3108,7 @@
31273108
31283109 memset(&lcmd_pkt, 0, REQUEST_ENTRY_SIZE);
31293110
3130
- lcmd_pkt.handle = MAKE_HANDLE(req->id, sp->handle);
3111
+ lcmd_pkt.handle = make_handle(req->id, sp->handle);
31313112 lcmd_pkt.reserved_0 = 0;
31323113 lcmd_pkt.port_path_ctrl = 0;
31333114 lcmd_pkt.reserved_1 = 0;
....@@ -3152,9 +3133,9 @@
31523133 lcmd_pkt.entry_status = (uint8_t) rsp->id;
31533134
31543135 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302e,
3155
- (uint8_t *)cmd->cmnd, cmd->cmd_len);
3136
+ cmd->cmnd, cmd->cmd_len);
31563137 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x3032,
3157
- (uint8_t *)&lcmd_pkt, REQUEST_ENTRY_SIZE);
3138
+ &lcmd_pkt, sizeof(lcmd_pkt));
31583139
31593140 memcpy_toio((void __iomem *)cmd_pkt, &lcmd_pkt, REQUEST_ENTRY_SIZE);
31603141 wmb();
....@@ -3170,7 +3151,7 @@
31703151 sp->flags |= SRB_DMA_VALID;
31713152
31723153 /* Set chip new ring index. */
3173
- WRT_REG_DWORD(req->req_q_in, req->ring_index);
3154
+ wrt_reg_dword(req->req_q_in, req->ring_index);
31743155 QLAFX00_SET_HST_INTR(ha, ha->rqstq_intr_code);
31753156
31763157 spin_unlock_irqrestore(&ha->hardware_lock, flags);
....@@ -3197,7 +3178,7 @@
31973178 memset(&tm_iocb, 0, sizeof(struct tsk_mgmt_entry_fx00));
31983179 tm_iocb.entry_type = TSK_MGMT_IOCB_TYPE_FX00;
31993180 tm_iocb.entry_count = 1;
3200
- tm_iocb.handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
3181
+ tm_iocb.handle = make_handle(req->id, sp->handle);
32013182 tm_iocb.reserved_0 = 0;
32023183 tm_iocb.tgt_id = cpu_to_le16(sp->fcport->tgt_id);
32033184 tm_iocb.control_flags = cpu_to_le32(fxio->u.tmf.flags);
....@@ -3207,7 +3188,7 @@
32073188 sizeof(struct scsi_lun));
32083189 }
32093190
3210
- memcpy((void *)ptm_iocb, &tm_iocb,
3191
+ memcpy(ptm_iocb, &tm_iocb,
32113192 sizeof(struct tsk_mgmt_entry_fx00));
32123193 wmb();
32133194 }
....@@ -3223,13 +3204,12 @@
32233204 memset(&abt_iocb, 0, sizeof(struct abort_iocb_entry_fx00));
32243205 abt_iocb.entry_type = ABORT_IOCB_TYPE_FX00;
32253206 abt_iocb.entry_count = 1;
3226
- abt_iocb.handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
3227
- abt_iocb.abort_handle =
3228
- cpu_to_le32(MAKE_HANDLE(req->id, fxio->u.abt.cmd_hndl));
3207
+ abt_iocb.handle = make_handle(req->id, sp->handle);
3208
+ abt_iocb.abort_handle = make_handle(req->id, fxio->u.abt.cmd_hndl);
32293209 abt_iocb.tgt_id_sts = cpu_to_le16(sp->fcport->tgt_id);
32303210 abt_iocb.req_que_no = cpu_to_le16(req->id);
32313211
3232
- memcpy((void *)pabt_iocb, &abt_iocb,
3212
+ memcpy(pabt_iocb, &abt_iocb,
32333213 sizeof(struct abort_iocb_entry_fx00));
32343214 wmb();
32353215 }
....@@ -3246,7 +3226,7 @@
32463226
32473227 memset(&fx_iocb, 0, sizeof(struct fxdisc_entry_fx00));
32483228 fx_iocb.entry_type = FX00_IOCB_TYPE;
3249
- fx_iocb.handle = cpu_to_le32(sp->handle);
3229
+ fx_iocb.handle = sp->handle;
32503230 fx_iocb.entry_count = entry_cnt;
32513231
32523232 if (sp->type == SRB_FXIOCB_DCMD) {
....@@ -3262,11 +3242,9 @@
32623242 fx_iocb.req_dsdcnt = cpu_to_le16(1);
32633243 fx_iocb.req_xfrcnt =
32643244 cpu_to_le16(fxio->u.fxiocb.req_len);
3265
- fx_iocb.dseg_rq_address[0] =
3266
- cpu_to_le32(LSD(fxio->u.fxiocb.req_dma_handle));
3267
- fx_iocb.dseg_rq_address[1] =
3268
- cpu_to_le32(MSD(fxio->u.fxiocb.req_dma_handle));
3269
- fx_iocb.dseg_rq_len =
3245
+ put_unaligned_le64(fxio->u.fxiocb.req_dma_handle,
3246
+ &fx_iocb.dseg_rq.address);
3247
+ fx_iocb.dseg_rq.length =
32703248 cpu_to_le32(fxio->u.fxiocb.req_len);
32713249 }
32723250
....@@ -3274,11 +3252,9 @@
32743252 fx_iocb.rsp_dsdcnt = cpu_to_le16(1);
32753253 fx_iocb.rsp_xfrcnt =
32763254 cpu_to_le16(fxio->u.fxiocb.rsp_len);
3277
- fx_iocb.dseg_rsp_address[0] =
3278
- cpu_to_le32(LSD(fxio->u.fxiocb.rsp_dma_handle));
3279
- fx_iocb.dseg_rsp_address[1] =
3280
- cpu_to_le32(MSD(fxio->u.fxiocb.rsp_dma_handle));
3281
- fx_iocb.dseg_rsp_len =
3255
+ put_unaligned_le64(fxio->u.fxiocb.rsp_dma_handle,
3256
+ &fx_iocb.dseg_rsp.address);
3257
+ fx_iocb.dseg_rsp.length =
32823258 cpu_to_le32(fxio->u.fxiocb.rsp_len);
32833259 }
32843260
....@@ -3288,6 +3264,7 @@
32883264 fx_iocb.flags = fxio->u.fxiocb.flags;
32893265 } else {
32903266 struct scatterlist *sg;
3267
+
32913268 bsg_job = sp->u.bsg_job;
32923269 bsg_request = bsg_job->request;
32933270 piocb_rqst = (struct qla_mt_iocb_rqst_fx00 *)
....@@ -3307,19 +3284,17 @@
33073284 int avail_dsds, tot_dsds;
33083285 cont_a64_entry_t lcont_pkt;
33093286 cont_a64_entry_t *cont_pkt = NULL;
3310
- __le32 *cur_dsd;
3287
+ struct dsd64 *cur_dsd;
33113288 int index = 0, cont = 0;
33123289
33133290 fx_iocb.req_dsdcnt =
33143291 cpu_to_le16(bsg_job->request_payload.sg_cnt);
33153292 tot_dsds =
33163293 bsg_job->request_payload.sg_cnt;
3317
- cur_dsd = (__le32 *)&fx_iocb.dseg_rq_address[0];
3294
+ cur_dsd = &fx_iocb.dseg_rq;
33183295 avail_dsds = 1;
33193296 for_each_sg(bsg_job->request_payload.sg_list, sg,
33203297 tot_dsds, index) {
3321
- dma_addr_t sle_dma;
3322
-
33233298 /* Allocate additional continuation packets? */
33243299 if (avail_dsds == 0) {
33253300 /*
....@@ -3331,17 +3306,13 @@
33313306 cont_pkt =
33323307 qlafx00_prep_cont_type1_iocb(
33333308 sp->vha->req, &lcont_pkt);
3334
- cur_dsd = (__le32 *)
3335
- lcont_pkt.dseg_0_address;
3309
+ cur_dsd = lcont_pkt.dsd;
33363310 avail_dsds = 5;
33373311 cont = 1;
33383312 entry_cnt++;
33393313 }
33403314
3341
- sle_dma = sg_dma_address(sg);
3342
- *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
3343
- *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
3344
- *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
3315
+ append_dsd64(&cur_dsd, sg);
33453316 avail_dsds--;
33463317
33473318 if (avail_dsds == 0 && cont == 1) {
....@@ -3369,19 +3340,17 @@
33693340 int avail_dsds, tot_dsds;
33703341 cont_a64_entry_t lcont_pkt;
33713342 cont_a64_entry_t *cont_pkt = NULL;
3372
- __le32 *cur_dsd;
3343
+ struct dsd64 *cur_dsd;
33733344 int index = 0, cont = 0;
33743345
33753346 fx_iocb.rsp_dsdcnt =
33763347 cpu_to_le16(bsg_job->reply_payload.sg_cnt);
33773348 tot_dsds = bsg_job->reply_payload.sg_cnt;
3378
- cur_dsd = (__le32 *)&fx_iocb.dseg_rsp_address[0];
3349
+ cur_dsd = &fx_iocb.dseg_rsp;
33793350 avail_dsds = 1;
33803351
33813352 for_each_sg(bsg_job->reply_payload.sg_list, sg,
33823353 tot_dsds, index) {
3383
- dma_addr_t sle_dma;
3384
-
33853354 /* Allocate additional continuation packets? */
33863355 if (avail_dsds == 0) {
33873356 /*
....@@ -3393,17 +3362,13 @@
33933362 cont_pkt =
33943363 qlafx00_prep_cont_type1_iocb(
33953364 sp->vha->req, &lcont_pkt);
3396
- cur_dsd = (__le32 *)
3397
- lcont_pkt.dseg_0_address;
3365
+ cur_dsd = lcont_pkt.dsd;
33983366 avail_dsds = 5;
33993367 cont = 1;
34003368 entry_cnt++;
34013369 }
34023370
3403
- sle_dma = sg_dma_address(sg);
3404
- *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
3405
- *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
3406
- *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
3371
+ append_dsd64(&cur_dsd, sg);
34073372 avail_dsds--;
34083373
34093374 if (avail_dsds == 0 && cont == 1) {
....@@ -3434,10 +3399,8 @@
34343399 }
34353400
34363401 ql_dump_buffer(ql_dbg_user + ql_dbg_verbose,
3437
- sp->vha, 0x3047,
3438
- (uint8_t *)&fx_iocb, sizeof(struct fxdisc_entry_fx00));
3402
+ sp->vha, 0x3047, &fx_iocb, sizeof(fx_iocb));
34393403
3440
- memcpy_toio((void __iomem *)pfxiocb, &fx_iocb,
3441
- sizeof(struct fxdisc_entry_fx00));
3404
+ memcpy_toio((void __iomem *)pfxiocb, &fx_iocb, sizeof(fx_iocb));
34423405 wmb();
34433406 }