59 bcode_val = (
uint32_t)(*bcode_val_ptr);
61 if (bcode_val == 0xFFFFFFFF) {
64 "No FCP Priority config data.\n");
68 if (bcode[0] !=
'H' || bcode[1] !=
'Q' || bcode[2] !=
'O' ||
72 "Invalid FCP Priority data header. bcode=0x%x.\n",
79 pri_entry = &pri_cfg->
entry[0];
89 "No valid FCP Priority data entries.\n");
94 "Valid FCP priority data. num entries = %d.\n",
113 goto exit_fcp_prio_cfg;
117 oper = bsg_job->
request->rqst_data.h_vendor.vendor_cmd[1];
122 goto exit_fcp_prio_cfg;
126 if (ha->
flags.fcp_prio_enabled) {
127 ha->
flags.fcp_prio_enabled = 0;
135 goto exit_fcp_prio_cfg;
140 if (!ha->
flags.fcp_prio_enabled) {
142 ha->
flags.fcp_prio_enabled = 1;
150 goto exit_fcp_prio_cfg;
160 goto exit_fcp_prio_cfg;
164 bsg_job->
reply->reply_payload_rcv_len =
177 goto exit_fcp_prio_cfg;
184 "Unable to allocate memory for fcp prio "
188 goto exit_fcp_prio_cfg;
208 goto exit_fcp_prio_cfg;
211 ha->
flags.fcp_prio_enabled = 0;
213 ha->
flags.fcp_prio_enabled = 1;
227 qla2x00_process_els(
struct fc_bsg_job *bsg_job)
236 int req_sg_cnt, rsp_sg_cnt;
241 rport = bsg_job->
rport;
244 vha = shost_priv(host);
246 type =
"FC_BSG_RPT_ELS";
248 host = bsg_job->
shost;
249 vha = shost_priv(host);
251 type =
"FC_BSG_HST_ELS_NOLOGIN";
257 "ELS passthru not supported for ISP23xx based adapters.\n");
266 "Multiple SG's are not suppored for ELS requests, "
267 "request_sg_cnt=%x reply_sg_cnt=%x.\n",
281 "Failed to login port %06X for ELS passthru.\n",
300 fcport->
d_id.
b.al_pa =
301 bsg_job->
request->rqst_data.h_els.port_id[0];
302 fcport->
d_id.
b.area =
303 bsg_job->
request->rqst_data.h_els.port_id[1];
304 fcport->
d_id.
b.domain =
305 bsg_job->
request->rqst_data.h_els.port_id[2];
307 (fcport->
d_id.
b.al_pa == 0xFD) ?
311 if (!vha->
flags.online) {
322 goto done_free_fcport;
329 goto done_free_fcport;
335 "dma mapping resulted in different sg counts, "
336 "request_sg_cnt: %x dma_request_sg_cnt:%x reply_sg_cnt:%x "
355 "bsg_els_rpt" :
"bsg_els_hst");
361 "bsg rqst type: %s els type: %x - loop-id=%x "
362 "portid=%-2x%02x%02x.\n", type,
369 "qla2x00_start_sp failed = %d\n", rval);
381 goto done_free_fcport;
397 iocbs += (dsds - 2) / 5;
405 qla2x00_process_ct(
struct fc_bsg_job *bsg_job)
412 int req_sg_cnt, rsp_sg_cnt;
415 char *type =
"FC_BSG_HST_CT";
422 "dma_map_sg return %d for request\n", req_sg_cnt);
431 "dma_map_sg return %d for reply\n", rsp_sg_cnt);
439 "request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x "
446 if (!vha->
flags.online) {
448 "Host is not online.\n");
454 (bsg_job->
request->rqst_data.h_ct.preamble_word1 & 0xFF000000)
465 "Unknown loop id: %x.\n", loop_id);
478 "Failed to allocate fcport.\n");
485 fcport->
d_id.
b.al_pa = bsg_job->
request->rqst_data.h_ct.port_id[0];
486 fcport->
d_id.
b.area = bsg_job->
request->rqst_data.h_ct.port_id[1];
487 fcport->
d_id.
b.domain = bsg_job->
request->rqst_data.h_ct.port_id[2];
494 "qla2x00_get_sp failed.\n");
496 goto done_free_fcport;
507 "bsg rqst type: %s else type: %x - "
508 "loop-id=%x portid=%02x%02x%02x.\n", type,
509 (bsg_job->
request->rqst_data.h_ct.preamble_word2 >> 16),
511 fcport->
d_id.
b.al_pa);
516 "qla2x00_start_sp failed=%d.\n", rval);
519 goto done_free_fcport;
546 goto done_set_internal;
561 "set port config failed.\n");
564 goto done_set_internal;
570 "State change notification not received.\n");
573 if (ha->
flags.idc_compl_status) {
575 "Bad status in IDC Completion AEN\n");
577 ha->
flags.idc_compl_status = 0;
580 "State change received.\n");
600 goto done_reset_internal;
602 memset(new_config, 0 ,
sizeof(new_config));
605 (config[0] & INTERNAL_LOOPBACK_MASK) >> 1 ==
607 new_config[0] = config[0] & ~INTERNAL_LOOPBACK_MASK;
609 (new_config[0] & INTERNAL_LOOPBACK_MASK));
616 "Set port config failed.\n");
619 goto done_reset_internal;
626 "State change notification not received.\n");
629 goto done_reset_internal;
632 "State change received.\n");
641 qla2x00_process_loopback(
struct fc_bsg_job *bsg_job)
660 if (!vha->
flags.online) {
669 if (!elreq.req_sg_cnt) {
671 "dma_map_sg returned %d for request.\n", elreq.req_sg_cnt);
679 if (!elreq.rsp_sg_cnt) {
681 "dma_map_sg returned %d for reply.\n", elreq.rsp_sg_cnt);
683 goto done_unmap_req_sg;
689 "dma mapping resulted in different sg counts, "
690 "request_sg_cnt: %x dma_request_sg_cnt: %x "
691 "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n",
702 "dma alloc failed for req_data.\n");
711 "dma alloc failed for rsp_data.\n");
713 goto done_free_dma_req;
720 elreq.send_dma = req_data_dma;
721 elreq.rcv_dma = rsp_data_dma;
722 elreq.transfer_size = req_data_len;
724 elreq.options = bsg_job->
request->rqst_data.h_vendor.vendor_cmd[1];
732 type =
"FC_BSG_HST_VENDOR_ECHO_DIAG";
734 "BSG request type: %s.\n", type);
739 memset(config, 0,
sizeof(config));
740 memset(new_config, 0,
sizeof(new_config));
743 "Get port config failed.\n");
746 goto done_free_dma_req;
750 "elreq.options=%04x\n", elreq.options);
754 rval = qla81xx_set_loopback_mode(vha,
755 config, new_config, elreq.options);
757 rval = qla81xx_reset_loopback_mode(vha,
760 rval = qla81xx_set_loopback_mode(vha, config,
761 new_config, elreq.options);
766 goto done_free_dma_req;
769 type =
"FC_BSG_HST_VENDOR_LOOPBACK";
771 "BSG request type: %s.\n", type);
780 qla81xx_reset_loopback_mode(vha,
787 "MBX command error, Aborting ISP.\n");
795 "MPI reset failed.\n");
800 goto done_free_dma_req;
803 type =
"FC_BSG_HST_VENDOR_LOOPBACK";
805 "BSG request type: %s.\n", type);
813 "Vendor request %s failed.\n", type);
815 fw_sts_ptr = ((
uint8_t *)bsg_job->
req->sense) +
818 memcpy(fw_sts_ptr, response,
sizeof(response));
820 *fw_sts_ptr = command_sent;
825 "Vendor request %s completed.\n", type);
829 bsg_job->
reply->reply_payload_rcv_len =
831 fw_sts_ptr = ((
uint8_t *)bsg_job->
req->sense) +
833 memcpy(fw_sts_ptr, response,
sizeof(response));
835 *fw_sts_ptr = command_sent;
844 rsp_data, rsp_data_dma);
847 req_data, req_data_dma);
873 flag = bsg_job->
request->rqst_data.h_vendor.vendor_cmd[1];
879 "Vendor request 84xx reset failed.\n");
885 "Vendor request 84xx reset completed.\n");
911 "Not 84xx, exiting.\n");
919 "dma_map_sg returned %d for request.\n", sg_cnt);
925 "DMA mapping resulted in different sg counts, "
926 "request_sg_cnt: %x dma_request_sg_cnt: %x.\n",
937 "DMA alloc failed for fw_buf.\n");
948 "DMA alloc failed for fw buffer.\n");
950 goto done_free_fw_buf;
953 flag = bsg_job->
request->rqst_data.h_vendor.vendor_cmd[1];
977 "Vendor request 84xx updatefw failed.\n");
983 "Vendor request 84xx updatefw completed.\n");
1010 void *mgmt_b =
NULL;
1019 "Not 84xx, exiting.\n");
1027 "MGMT header not provided, exiting.\n");
1034 "DMA alloc failed for fw buffer.\n");
1042 switch (ql84_mgmt->
mgmt.cmd) {
1050 "dma_map_sg returned %d for reply.\n", sg_cnt);
1059 "DMA mapping resulted in different sg counts, "
1060 "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n",
1072 "DMA alloc failed for mgmt_b.\n");
1081 ql84_mgmt->
mgmt.mgmtp.u.mem.start_addr);
1090 ql84_mgmt->
mgmt.mgmtp.u.info.context);
1101 "dma_map_sg returned %d.\n", sg_cnt);
1110 "DMA mapping resulted in different sg counts, "
1111 "request_sg_cnt: %x dma_request_sg_cnt: %x.\n",
1122 "DMA alloc failed for mgmt_b.\n");
1164 "Vendor request 84xx mgmt failed.\n");
1171 "Vendor request 84xx mgmt completed.\n");
1178 bsg_job->
reply->reply_payload_rcv_len =
1226 "port_param header not provided.\n");
1232 "Invalid destination type.\n");
1248 "Failed to find port.\n");
1254 "Port is not online.\n");
1260 "Remote port not logged in flags = 0x%x.\n", fcport->
flags);
1264 if (port_param->
mode)
1266 port_param->
speed, mb);
1269 &port_param->
speed, mb);
1273 "iIDMA cmd failed for %02x%02x%02x%02x%02x%02x%02x%02x -- "
1274 "%04x %x %04x %04x.\n", fcport->
port_name[0],
1283 if (!port_param->
mode) {
1290 memcpy(rsp_ptr, port_param,
1312 start = bsg_job->
request->rqst_data.h_vendor.vendor_cmd[1];
1315 "start %d > optrom_size %d.\n", start, ha->
optrom_size);
1338 "Invalid start region 0x%x/0x%x.\n", start,
1359 "Read: Unable to allocate memory for optrom retrieval "
1371 qla2x00_read_optrom(
struct fc_bsg_job *bsg_job)
1378 if (ha->
flags.nic_core_reset_hdlr_active)
1381 rval = qla2x00_optrom_setup(bsg_job, vha, 0);
1402 qla2x00_update_optrom(
struct fc_bsg_job *bsg_job)
1409 rval = qla2x00_optrom_setup(bsg_job, vha, 1);
1414 ha->
flags.isp82xx_no_md_cap = 1;
1432 qla2x00_update_fru_versions(
struct fc_bsg_job *bsg_job)
1445 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1454 count = list->
count;
1461 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1468 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] = 0;
1482 qla2x00_read_fru_status(
struct fc_bsg_job *bsg_job)
1493 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1507 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1515 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] = 0;
1522 bsg_job->
reply->reply_payload_rcv_len =
sizeof(*sr);
1530 qla2x00_write_fru_status(
struct fc_bsg_job *bsg_job)
1541 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1555 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1560 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] = 0;
1574 qla2x00_write_i2c(
struct fc_bsg_job *bsg_job)
1585 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1598 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1603 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] = 0;
1628 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1640 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] =
1649 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] = 0;
1656 bsg_job->
reply->reply_payload_rcv_len =
sizeof(*i2c);
1664 qla24xx_process_bidir_cmd(
struct fc_bsg_job *bsg_job)
1682 "This adapter is not supported\n");
1695 if (!vha->
flags.online) {
1697 "Host is not online\n");
1705 "Cable is unplugged...\n");
1713 "Host is not connected to the switch\n");
1721 "Host is operating mode is not P2p\n");
1726 thread_id = bsg_job->
request->rqst_data.h_vendor.vendor_cmd[1];
1739 "Failed to login port %06X for bidirectional IOCB\n",
1769 goto done_unmap_req_sg;
1775 "Dma mapping resulted in different sg counts "
1776 "[request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt: "
1777 "%x dma_reply_sg_cnt: %x]\n",
1784 if (req_data_len != rsp_data_len) {
1787 "req_data_len != rsp_data_len\n");
1799 "Alloc SRB structure failed\n");
1811 tot_dsds = rsp_sg_cnt + req_sg_cnt;
1834 bsg_job->
reply->reply_data.vendor_reply.vendor_rsp[0] = rval;
1836 bsg_job->
reply->reply_payload_rcv_len = 0;
1844 qla2x00_process_vendor_specific(
struct fc_bsg_job *bsg_job)
1846 switch (bsg_job->
request->rqst_data.h_vendor.vendor_cmd[0]) {
1848 return qla2x00_process_loopback(bsg_job);
1851 return qla84xx_reset(bsg_job);
1854 return qla84xx_updatefw(bsg_job);
1857 return qla84xx_mgmt_cmd(bsg_job);
1860 return qla24xx_iidma(bsg_job);
1863 return qla24xx_proc_fcp_prio_cfg_cmd(bsg_job);
1866 return qla2x00_read_optrom(bsg_job);
1869 return qla2x00_update_optrom(bsg_job);
1872 return qla2x00_update_fru_versions(bsg_job);
1875 return qla2x00_read_fru_status(bsg_job);
1878 return qla2x00_write_fru_status(bsg_job);
1881 return qla2x00_write_i2c(bsg_job);
1884 return qla2x00_read_i2c(bsg_job);
1887 return qla24xx_process_bidir_cmd(bsg_job);
1906 bsg_job->
reply->reply_payload_rcv_len = 0;
1909 rport = bsg_job->
rport;
1912 vha = shost_priv(host);
1914 host = bsg_job->
shost;
1915 vha = shost_priv(host);
1918 if (qla2x00_reset_active(vha)) {
1920 "BSG: ISP abort active/needed -- cmd=%d.\n",
1928 "Entered %s msgcode=0x%x.\n", __func__, bsg_job->
request->msgcode);
1930 switch (bsg_job->
request->msgcode) {
1933 ret = qla2x00_process_els(bsg_job);
1936 ret = qla2x00_process_ct(bsg_job);
1939 ret = qla2x00_process_vendor_specific(bsg_job);
1959 unsigned long flags;
1975 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1976 if (ha->
isp_ops->abort_command(sp)) {
1978 "mbx abort_command "
1980 bsg_job->
req->errors =
1984 "mbx abort_command "
1986 bsg_job->
req->errors =
1987 bsg_job->
reply->result = 0;
1995 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2001 spin_unlock_irqrestore(&ha->hardware_lock, flags);