Lines Matching +full:mctp +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
35 if (cmd == e->cmd) in mb_to_str()
36 return e->str; in mb_to_str()
79 if (wc->cmd == cmd) in is_rom_cmd()
119 struct qla_hw_data *ha = vha->hw; in qla2x00_mailbox_command()
120 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_mailbox_command()
126 if (ha->pdev->error_state == pci_channel_io_perm_failure) { in qla2x00_mailbox_command()
132 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_mailbox_command()
139 if (test_bit(PFLG_DISCONNECTED, &base_vha->dpc_flags) && in qla2x00_mailbox_command()
140 test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_mailbox_command()
146 reg = ha->iobase; in qla2x00_mailbox_command()
147 io_lock_on = base_vha->flags.init_done; in qla2x00_mailbox_command()
150 abort_active = test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2x00_mailbox_command()
151 chip_reset = ha->chip_reset; in qla2x00_mailbox_command()
153 if (ha->flags.pci_channel_io_perm_failure) { in qla2x00_mailbox_command()
159 if (IS_P3P_TYPE(ha) && ha->flags.isp82xx_fw_hung) { in qla2x00_mailbox_command()
160 /* Setting Link-Down error */ in qla2x00_mailbox_command()
161 mcp->mb[0] = MBS_LINK_DOWN_ERROR; in qla2x00_mailbox_command()
163 "FW hung = %d.\n", ha->flags.isp82xx_fw_hung); in qla2x00_mailbox_command()
168 if (((test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_mailbox_command()
169 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_mailbox_command()
170 test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) && in qla2x00_mailbox_command()
171 !is_rom_cmd(mcp->mb[0])) || ha->flags.eeh_busy) { in qla2x00_mailbox_command()
174 mcp->mb[0]); in qla2x00_mailbox_command()
178 atomic_inc(&ha->num_pend_mbx_stage1); in qla2x00_mailbox_command()
184 if (!wait_for_completion_timeout(&ha->mbx_cmd_comp, mcp->tov * HZ)) { in qla2x00_mailbox_command()
188 mcp->mb[0]); in qla2x00_mailbox_command()
189 vha->hw_err_cnt++; in qla2x00_mailbox_command()
190 atomic_dec(&ha->num_pend_mbx_stage1); in qla2x00_mailbox_command()
193 atomic_dec(&ha->num_pend_mbx_stage1); in qla2x00_mailbox_command()
194 if (ha->flags.purge_mbox || chip_reset != ha->chip_reset || in qla2x00_mailbox_command()
195 ha->flags.eeh_busy) { in qla2x00_mailbox_command()
198 ha->flags.purge_mbox, ha->flags.eeh_busy, mcp->mb[0]); in qla2x00_mailbox_command()
205 ha->mcp = mcp; in qla2x00_mailbox_command()
208 "Prepare to issue mbox cmd=0x%x.\n", mcp->mb[0]); in qla2x00_mailbox_command()
210 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
212 if (ha->flags.purge_mbox || chip_reset != ha->chip_reset || in qla2x00_mailbox_command()
213 ha->flags.mbox_busy) { in qla2x00_mailbox_command()
215 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
218 ha->flags.mbox_busy = 1; in qla2x00_mailbox_command()
222 optr = ®->isp82.mailbox_in[0]; in qla2x00_mailbox_command()
224 optr = ®->isp24.mailbox0; in qla2x00_mailbox_command()
226 optr = MAILBOX_REG(ha, ®->isp, 0); in qla2x00_mailbox_command()
228 iptr = mcp->mb; in qla2x00_mailbox_command()
229 command = mcp->mb[0]; in qla2x00_mailbox_command()
230 mboxes = mcp->out_mb; in qla2x00_mailbox_command()
234 for (cnt = 0; cnt < ha->mbx_count; cnt++) { in qla2x00_mailbox_command()
236 optr = MAILBOX_REG(ha, ®->isp, 8); in qla2x00_mailbox_command()
239 "mbox[%d]<-0x%04x\n", cnt, *iptr); in qla2x00_mailbox_command()
254 ha->flags.mbox_int = 0; in qla2x00_mailbox_command()
255 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); in qla2x00_mailbox_command()
263 atomic_inc(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
265 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); in qla2x00_mailbox_command()
268 wrt_reg_dword(®->isp82.hint, HINT_MBX_INT_PENDING); in qla2x00_mailbox_command()
270 wrt_reg_dword(®->isp24.hccr, HCCRX_SET_HOST_INT); in qla2x00_mailbox_command()
272 wrt_reg_word(®->isp.hccr, HCCR_SET_HOST_INT); in qla2x00_mailbox_command()
273 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
276 atomic_inc(&ha->num_pend_mbx_stage3); in qla2x00_mailbox_command()
277 if (!wait_for_completion_timeout(&ha->mbx_intr_comp, in qla2x00_mailbox_command()
278 mcp->tov * HZ)) { in qla2x00_mailbox_command()
281 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
282 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); in qla2x00_mailbox_command()
283 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
285 if (chip_reset != ha->chip_reset) { in qla2x00_mailbox_command()
286 eeh_delay = ha->flags.eeh_busy ? 1 : 0; in qla2x00_mailbox_command()
288 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
289 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
290 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
292 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
293 atomic_dec(&ha->num_pend_mbx_stage3); in qla2x00_mailbox_command()
297 } else if (ha->flags.purge_mbox || in qla2x00_mailbox_command()
298 chip_reset != ha->chip_reset) { in qla2x00_mailbox_command()
299 eeh_delay = ha->flags.eeh_busy ? 1 : 0; in qla2x00_mailbox_command()
301 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
302 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
303 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
304 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
305 atomic_dec(&ha->num_pend_mbx_stage3); in qla2x00_mailbox_command()
309 atomic_dec(&ha->num_pend_mbx_stage3); in qla2x00_mailbox_command()
313 command, jiffies_to_msecs(jiffies - wait_time)); in qla2x00_mailbox_command()
319 if (rd_reg_dword(®->isp82.hint) & in qla2x00_mailbox_command()
321 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
322 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
324 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
327 vha->hw_err_cnt++; in qla2x00_mailbox_command()
331 wrt_reg_dword(®->isp82.hint, HINT_MBX_INT_PENDING); in qla2x00_mailbox_command()
333 wrt_reg_dword(®->isp24.hccr, HCCRX_SET_HOST_INT); in qla2x00_mailbox_command()
335 wrt_reg_word(®->isp.hccr, HCCR_SET_HOST_INT); in qla2x00_mailbox_command()
336 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
338 wait_time = jiffies + mcp->tov * HZ; /* wait at most tov secs */ in qla2x00_mailbox_command()
339 while (!ha->flags.mbox_int) { in qla2x00_mailbox_command()
340 if (ha->flags.purge_mbox || in qla2x00_mailbox_command()
341 chip_reset != ha->chip_reset) { in qla2x00_mailbox_command()
342 eeh_delay = ha->flags.eeh_busy ? 1 : 0; in qla2x00_mailbox_command()
344 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
345 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
346 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
348 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
357 qla2x00_poll(ha->rsp_q_map[0]); in qla2x00_mailbox_command()
359 if (!ha->flags.mbox_int && in qla2x00_mailbox_command()
366 (uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ)); in qla2x00_mailbox_command()
368 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
371 if (ha->flags.mbox_int) { in qla2x00_mailbox_command()
378 ha->flags.mbox_int = 0; in qla2x00_mailbox_command()
379 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); in qla2x00_mailbox_command()
381 if (IS_P3P_TYPE(ha) && ha->flags.isp82xx_fw_hung) { in qla2x00_mailbox_command()
382 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
383 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
384 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
386 /* Setting Link-Down error */ in qla2x00_mailbox_command()
387 mcp->mb[0] = MBS_LINK_DOWN_ERROR; in qla2x00_mailbox_command()
388 ha->mcp = NULL; in qla2x00_mailbox_command()
391 "FW hung = %d.\n", ha->flags.isp82xx_fw_hung); in qla2x00_mailbox_command()
395 if (ha->mailbox_out[0] != MBS_COMMAND_COMPLETE) { in qla2x00_mailbox_command()
397 "mb_out[0] = %#x <> %#x\n", ha->mailbox_out[0], in qla2x00_mailbox_command()
403 iptr2 = mcp->mb; in qla2x00_mailbox_command()
404 iptr = (uint16_t *)&ha->mailbox_out[0]; in qla2x00_mailbox_command()
405 mboxes = mcp->in_mb; in qla2x00_mailbox_command()
409 for (cnt = 0; cnt < ha->mbx_count; cnt++) { in qla2x00_mailbox_command()
413 "mbox[%d]->0x%04x\n", cnt, *iptr2); in qla2x00_mailbox_command()
427 mb[0] = rd_reg_word(®->isp24.mailbox0); in qla2x00_mailbox_command()
428 mb[1] = rd_reg_word(®->isp24.mailbox1); in qla2x00_mailbox_command()
429 mb[2] = rd_reg_word(®->isp24.mailbox2); in qla2x00_mailbox_command()
430 mb[3] = rd_reg_word(®->isp24.mailbox3); in qla2x00_mailbox_command()
431 mb[7] = rd_reg_word(®->isp24.mailbox7); in qla2x00_mailbox_command()
432 ictrl = rd_reg_dword(®->isp24.ictrl); in qla2x00_mailbox_command()
433 host_status = rd_reg_dword(®->isp24.host_status); in qla2x00_mailbox_command()
434 hccr = rd_reg_dword(®->isp24.hccr); in qla2x00_mailbox_command()
438 "mb[0-3]=[0x%x 0x%x 0x%x 0x%x] mb7 0x%x host_status 0x%x hccr 0x%x\n", in qla2x00_mailbox_command()
441 vha->hw_err_cnt++; in qla2x00_mailbox_command()
444 mb[0] = RD_MAILBOX_REG(ha, ®->isp, 0); in qla2x00_mailbox_command()
445 ictrl = rd_reg_word(®->isp.ictrl); in qla2x00_mailbox_command()
449 vha->hw_err_cnt++; in qla2x00_mailbox_command()
454 if (!pci_channel_offline(vha->hw->pdev)) { in qla2x00_mailbox_command()
455 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_mailbox_command()
457 (chip_reset != ha->chip_reset)) { in qla2x00_mailbox_command()
464 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
465 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
466 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
477 if (mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) in qla2x00_mailbox_command()
482 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
483 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
484 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
487 ha->mcp = NULL; in qla2x00_mailbox_command()
494 qla2x00_poll(ha->rsp_q_map[0]); in qla2x00_mailbox_command()
498 mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) { in qla2x00_mailbox_command()
499 if (!io_lock_on || (mcp->flags & IOCTL_CMD) || in qla2x00_mailbox_command()
500 ha->flags.eeh_busy) { in qla2x00_mailbox_command()
505 if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && in qla2x00_mailbox_command()
506 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_mailbox_command()
507 !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { in qla2x00_mailbox_command()
520 "abort.\n", command, mcp->mb[0], in qla2x00_mailbox_command()
521 ha->flags.eeh_busy); in qla2x00_mailbox_command()
522 vha->hw_err_cnt++; in qla2x00_mailbox_command()
523 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_mailbox_command()
526 } else if (current == ha->dpc_thread) { in qla2x00_mailbox_command()
531 if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && in qla2x00_mailbox_command()
532 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_mailbox_command()
533 !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { in qla2x00_mailbox_command()
546 command, mcp->mb[0]); in qla2x00_mailbox_command()
547 vha->hw_err_cnt++; in qla2x00_mailbox_command()
548 set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); in qla2x00_mailbox_command()
549 clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_mailbox_command()
551 complete(&ha->mbx_cmd_comp); in qla2x00_mailbox_command()
552 if (ha->isp_ops->abort_isp(vha) && in qla2x00_mailbox_command()
553 !ha->flags.eeh_busy) { in qla2x00_mailbox_command()
556 &vha->dpc_flags); in qla2x00_mailbox_command()
558 clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); in qla2x00_mailbox_command()
568 complete(&ha->mbx_cmd_comp); in qla2x00_mailbox_command()
574 mcp->mb[0]); in qla2x00_mailbox_command()
577 pr_warn("%s [%s]-%04x:%ld: **** Failed=%x", QL_MSGHDR, in qla2x00_mailbox_command()
578 dev_name(&ha->pdev->dev), 0x1020+0x800, in qla2x00_mailbox_command()
579 vha->host_no, rval); in qla2x00_mailbox_command()
580 mboxes = mcp->in_mb; in qla2x00_mailbox_command()
582 for (i = 0; i < ha->mbx_count && cnt; i++, mboxes >>= 1) in qla2x00_mailbox_command()
584 printk(" mb[%u]=%x", i, mcp->mb[i]); in qla2x00_mailbox_command()
585 cnt--; in qla2x00_mailbox_command()
592 rd_reg_dword(®->isp24.host_status), in qla2x00_mailbox_command()
593 rd_reg_dword(®->isp24.ictrl), in qla2x00_mailbox_command()
594 rd_reg_dword(®->isp24.istatus)); in qla2x00_mailbox_command()
598 rd_reg_word(®->isp.ctrl_status), in qla2x00_mailbox_command()
599 rd_reg_word(®->isp.ictrl), in qla2x00_mailbox_command()
600 rd_reg_word(®->isp.istatus)); in qla2x00_mailbox_command()
607 while (i && eeh_delay && (ha->pci_error_state < QLA_PCI_SLOT_RESET)) { in qla2x00_mailbox_command()
615 i--; in qla2x00_mailbox_command()
625 struct qla_hw_data *ha = vha->hw; in qla2x00_load_ram()
633 mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED; in qla2x00_load_ram()
634 mcp->mb[8] = MSW(risc_addr); in qla2x00_load_ram()
635 mcp->out_mb = MBX_8|MBX_0; in qla2x00_load_ram()
637 mcp->mb[0] = MBC_LOAD_RISC_RAM; in qla2x00_load_ram()
638 mcp->out_mb = MBX_0; in qla2x00_load_ram()
640 mcp->mb[1] = LSW(risc_addr); in qla2x00_load_ram()
641 mcp->mb[2] = MSW(req_dma); in qla2x00_load_ram()
642 mcp->mb[3] = LSW(req_dma); in qla2x00_load_ram()
643 mcp->mb[6] = MSW(MSD(req_dma)); in qla2x00_load_ram()
644 mcp->mb[7] = LSW(MSD(req_dma)); in qla2x00_load_ram()
645 mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1; in qla2x00_load_ram()
647 mcp->mb[4] = MSW(risc_code_size); in qla2x00_load_ram()
648 mcp->mb[5] = LSW(risc_code_size); in qla2x00_load_ram()
649 mcp->out_mb |= MBX_5|MBX_4; in qla2x00_load_ram()
651 mcp->mb[4] = LSW(risc_code_size); in qla2x00_load_ram()
652 mcp->out_mb |= MBX_4; in qla2x00_load_ram()
655 mcp->in_mb = MBX_1|MBX_0; in qla2x00_load_ram()
656 mcp->tov = MBX_TOV_SECONDS; in qla2x00_load_ram()
657 mcp->flags = 0; in qla2x00_load_ram()
663 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_load_ram()
664 vha->hw_err_cnt++; in qla2x00_load_ram()
695 struct qla_hw_data *ha = vha->hw; in qla2x00_execute_fw()
706 mcp->mb[0] = MBC_EXECUTE_FIRMWARE; in qla2x00_execute_fw()
707 mcp->out_mb = MBX_0; in qla2x00_execute_fw()
708 mcp->in_mb = MBX_0; in qla2x00_execute_fw()
710 mcp->mb[1] = MSW(risc_addr); in qla2x00_execute_fw()
711 mcp->mb[2] = LSW(risc_addr); in qla2x00_execute_fw()
712 mcp->mb[3] = 0; in qla2x00_execute_fw()
713 mcp->mb[4] = 0; in qla2x00_execute_fw()
714 mcp->mb[11] = 0; in qla2x00_execute_fw()
717 if (ha->flags.lr_detected) { in qla2x00_execute_fw()
718 mcp->mb[4] = BIT_0; in qla2x00_execute_fw()
720 mcp->mb[4] |= in qla2x00_execute_fw()
721 ha->lr_distance << LR_DIST_FW_POS; in qla2x00_execute_fw()
725 mcp->mb[4] |= NVME_ENABLE_FLAG; in qla2x00_execute_fw()
728 struct nvram_81xx *nv = ha->nvram; in qla2x00_execute_fw()
730 if (nv->min_supported_speed >= 2 && in qla2x00_execute_fw()
731 nv->min_supported_speed <= 5) { in qla2x00_execute_fw()
732 mcp->mb[4] |= BIT_4; in qla2x00_execute_fw()
733 mcp->mb[11] |= nv->min_supported_speed & 0xF; in qla2x00_execute_fw()
734 mcp->out_mb |= MBX_11; in qla2x00_execute_fw()
735 mcp->in_mb |= BIT_5; in qla2x00_execute_fw()
736 vha->min_supported_speed = in qla2x00_execute_fw()
737 nv->min_supported_speed; in qla2x00_execute_fw()
741 mcp->mb[11] |= BIT_4; in qla2x00_execute_fw()
744 if (ha->flags.exlogins_enabled) in qla2x00_execute_fw()
745 mcp->mb[4] |= ENABLE_EXTENDED_LOGIN; in qla2x00_execute_fw()
747 if (ha->flags.exchoffld_enabled) in qla2x00_execute_fw()
748 mcp->mb[4] |= ENABLE_EXCHANGE_OFFLD; in qla2x00_execute_fw()
751 mcp->mb[11] |= EXE_FW_FORCE_SEMAPHORE; in qla2x00_execute_fw()
753 mcp->out_mb |= MBX_4 | MBX_3 | MBX_2 | MBX_1 | MBX_11; in qla2x00_execute_fw()
754 mcp->in_mb |= MBX_5 | MBX_3 | MBX_2 | MBX_1; in qla2x00_execute_fw()
756 mcp->mb[1] = LSW(risc_addr); in qla2x00_execute_fw()
757 mcp->out_mb |= MBX_1; in qla2x00_execute_fw()
759 mcp->mb[2] = 0; in qla2x00_execute_fw()
760 mcp->out_mb |= MBX_2; in qla2x00_execute_fw()
764 mcp->tov = MBX_TOV_SECONDS; in qla2x00_execute_fw()
765 mcp->flags = 0; in qla2x00_execute_fw()
770 mcp->mb[1] == 0x27 && retry) { in qla2x00_execute_fw()
772 retry--; in qla2x00_execute_fw()
779 retry--; in qla2x00_execute_fw()
781 "Exe FW retry: mb[0]=%x retry[%d]\n", mcp->mb[0], retry); in qla2x00_execute_fw()
785 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_execute_fw()
786 vha->hw_err_cnt++; in qla2x00_execute_fw()
793 ha->fw_ability_mask = mcp->mb[3] << 16 | mcp->mb[2]; in qla2x00_execute_fw()
795 "fw_ability_mask=%x.\n", ha->fw_ability_mask); in qla2x00_execute_fw()
796 ql_dbg(ql_dbg_mbx, vha, 0x1027, "exchanges=%x.\n", mcp->mb[1]); in qla2x00_execute_fw()
798 ha->max_supported_speed = mcp->mb[2] & (BIT_0|BIT_1); in qla2x00_execute_fw()
800 ha->max_supported_speed == 0 ? "16Gps" : in qla2x00_execute_fw()
801 ha->max_supported_speed == 1 ? "32Gps" : in qla2x00_execute_fw()
802 ha->max_supported_speed == 2 ? "64Gps" : "unknown"); in qla2x00_execute_fw()
803 if (vha->min_supported_speed) { in qla2x00_execute_fw()
804 ha->min_supported_speed = mcp->mb[5] & in qla2x00_execute_fw()
808 ha->min_supported_speed == 6 ? "64Gps" : in qla2x00_execute_fw()
809 ha->min_supported_speed == 5 ? "32Gps" : in qla2x00_execute_fw()
810 ha->min_supported_speed == 4 ? "16Gps" : in qla2x00_execute_fw()
811 ha->min_supported_speed == 3 ? "8Gps" : in qla2x00_execute_fw()
812 ha->min_supported_speed == 2 ? "4Gps" : "unknown"); in qla2x00_execute_fw()
816 if (IS_QLA28XX(ha) && (mcp->mb[5] & EDIF_HW_SUPPORT)) { in qla2x00_execute_fw()
817 ha->flags.edif_hw = 1; in qla2x00_execute_fw()
856 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_get_exlogin_status()
857 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_get_exlogin_status()
858 mcp->mb[1] = FETCH_XLOGINS_STAT; in qla_get_exlogin_status()
859 mcp->out_mb = MBX_1|MBX_0; in qla_get_exlogin_status()
860 mcp->in_mb = MBX_10|MBX_4|MBX_0; in qla_get_exlogin_status()
861 mcp->tov = MBX_TOV_SECONDS; in qla_get_exlogin_status()
862 mcp->flags = 0; in qla_get_exlogin_status()
868 *buf_sz = mcp->mb[4]; in qla_get_exlogin_status()
869 *ex_logins_cnt = mcp->mb[10]; in qla_get_exlogin_status()
873 mcp->mb[4], mcp->mb[10]); in qla_get_exlogin_status()
908 struct qla_hw_data *ha = vha->hw; in qla_set_exlogin_mem_cfg()
913 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_set_exlogin_mem_cfg()
914 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_set_exlogin_mem_cfg()
915 mcp->mb[1] = CONFIG_XLOGINS_MEM; in qla_set_exlogin_mem_cfg()
916 mcp->mb[2] = MSW(phys_addr); in qla_set_exlogin_mem_cfg()
917 mcp->mb[3] = LSW(phys_addr); in qla_set_exlogin_mem_cfg()
918 mcp->mb[6] = MSW(MSD(phys_addr)); in qla_set_exlogin_mem_cfg()
919 mcp->mb[7] = LSW(MSD(phys_addr)); in qla_set_exlogin_mem_cfg()
920 mcp->mb[8] = MSW(ha->exlogin_size); in qla_set_exlogin_mem_cfg()
921 mcp->mb[9] = LSW(ha->exlogin_size); in qla_set_exlogin_mem_cfg()
922 mcp->out_mb = MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla_set_exlogin_mem_cfg()
923 mcp->in_mb = MBX_11|MBX_0; in qla_set_exlogin_mem_cfg()
924 mcp->tov = MBX_TOV_SECONDS; in qla_set_exlogin_mem_cfg()
925 mcp->flags = 0; in qla_set_exlogin_mem_cfg()
930 rval, mcp->mb[0], mcp->mb[11]); in qla_set_exlogin_mem_cfg()
966 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_get_exchoffld_status()
967 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_get_exchoffld_status()
968 mcp->mb[1] = FETCH_XCHOFFLD_STAT; in qla_get_exchoffld_status()
969 mcp->out_mb = MBX_1|MBX_0; in qla_get_exchoffld_status()
970 mcp->in_mb = MBX_10|MBX_4|MBX_0; in qla_get_exchoffld_status()
971 mcp->tov = MBX_TOV_SECONDS; in qla_get_exchoffld_status()
972 mcp->flags = 0; in qla_get_exchoffld_status()
978 *buf_sz = mcp->mb[4]; in qla_get_exchoffld_status()
979 *ex_logins_cnt = mcp->mb[10]; in qla_get_exchoffld_status()
983 mcp->mb[4], mcp->mb[10]); in qla_get_exchoffld_status()
1018 struct qla_hw_data *ha = vha->hw; in qla_set_exchoffld_mem_cfg()
1023 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_set_exchoffld_mem_cfg()
1024 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_set_exchoffld_mem_cfg()
1025 mcp->mb[1] = CONFIG_XCHOFFLD_MEM; in qla_set_exchoffld_mem_cfg()
1026 mcp->mb[2] = MSW(ha->exchoffld_buf_dma); in qla_set_exchoffld_mem_cfg()
1027 mcp->mb[3] = LSW(ha->exchoffld_buf_dma); in qla_set_exchoffld_mem_cfg()
1028 mcp->mb[6] = MSW(MSD(ha->exchoffld_buf_dma)); in qla_set_exchoffld_mem_cfg()
1029 mcp->mb[7] = LSW(MSD(ha->exchoffld_buf_dma)); in qla_set_exchoffld_mem_cfg()
1030 mcp->mb[8] = MSW(ha->exchoffld_size); in qla_set_exchoffld_mem_cfg()
1031 mcp->mb[9] = LSW(ha->exchoffld_size); in qla_set_exchoffld_mem_cfg()
1032 mcp->out_mb = MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla_set_exchoffld_mem_cfg()
1033 mcp->in_mb = MBX_11|MBX_0; in qla_set_exchoffld_mem_cfg()
1034 mcp->tov = MBX_TOV_SECONDS; in qla_set_exchoffld_mem_cfg()
1035 mcp->flags = 0; in qla_set_exchoffld_mem_cfg()
1070 struct qla_hw_data *ha = vha->hw; in qla2x00_get_fw_version()
1075 mcp->mb[0] = MBC_GET_FIRMWARE_VERSION; in qla2x00_get_fw_version()
1076 mcp->out_mb = MBX_0; in qla2x00_get_fw_version()
1077 mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_fw_version()
1078 if (IS_QLA81XX(vha->hw) || IS_QLA8031(ha) || IS_QLA8044(ha)) in qla2x00_get_fw_version()
1079 mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8; in qla2x00_get_fw_version()
1081 mcp->in_mb |= MBX_17|MBX_16|MBX_15; in qla2x00_get_fw_version()
1083 mcp->in_mb |= in qla2x00_get_fw_version()
1087 mcp->flags = 0; in qla2x00_get_fw_version()
1088 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_fw_version()
1094 ha->fw_major_version = mcp->mb[1]; in qla2x00_get_fw_version()
1095 ha->fw_minor_version = mcp->mb[2]; in qla2x00_get_fw_version()
1096 ha->fw_subminor_version = mcp->mb[3]; in qla2x00_get_fw_version()
1097 ha->fw_attributes = mcp->mb[6]; in qla2x00_get_fw_version()
1098 if (IS_QLA2100(vha->hw) || IS_QLA2200(vha->hw)) in qla2x00_get_fw_version()
1099 ha->fw_memory_size = 0x1FFFF; /* Defaults to 128KB. */ in qla2x00_get_fw_version()
1101 ha->fw_memory_size = (mcp->mb[5] << 16) | mcp->mb[4]; in qla2x00_get_fw_version()
1103 if (IS_QLA81XX(vha->hw) || IS_QLA8031(vha->hw) || IS_QLA8044(ha)) { in qla2x00_get_fw_version()
1104 ha->mpi_version[0] = mcp->mb[10] & 0xff; in qla2x00_get_fw_version()
1105 ha->mpi_version[1] = mcp->mb[11] >> 8; in qla2x00_get_fw_version()
1106 ha->mpi_version[2] = mcp->mb[11] & 0xff; in qla2x00_get_fw_version()
1107 ha->mpi_capabilities = (mcp->mb[12] << 16) | mcp->mb[13]; in qla2x00_get_fw_version()
1108 ha->phy_version[0] = mcp->mb[8] & 0xff; in qla2x00_get_fw_version()
1109 ha->phy_version[1] = mcp->mb[9] >> 8; in qla2x00_get_fw_version()
1110 ha->phy_version[2] = mcp->mb[9] & 0xff; in qla2x00_get_fw_version()
1114 ha->fw_attributes_h = mcp->mb[15]; in qla2x00_get_fw_version()
1115 ha->fw_attributes_ext[0] = mcp->mb[16]; in qla2x00_get_fw_version()
1116 ha->fw_attributes_ext[1] = mcp->mb[17]; in qla2x00_get_fw_version()
1119 __func__, mcp->mb[15], mcp->mb[6]); in qla2x00_get_fw_version()
1122 __func__, mcp->mb[17], mcp->mb[16]); in qla2x00_get_fw_version()
1124 if (ha->fw_attributes_h & 0x4) in qla2x00_get_fw_version()
1127 __func__, ha->fw_attributes_h); in qla2x00_get_fw_version()
1129 if (ha->fw_attributes_h & 0x8) in qla2x00_get_fw_version()
1132 __func__, ha->fw_attributes_h); in qla2x00_get_fw_version()
1138 if ((ha->fw_attributes_h & in qla2x00_get_fw_version()
1141 if (ha->fw_attributes_h & FW_ATTR_H_NVME_FBURST) in qla2x00_get_fw_version()
1142 vha->flags.nvme_first_burst = 1; in qla2x00_get_fw_version()
1144 vha->flags.nvme_enabled = 1; in qla2x00_get_fw_version()
1146 "%s: FC-NVMe is Enabled (0x%x)\n", in qla2x00_get_fw_version()
1147 __func__, ha->fw_attributes_h); in qla2x00_get_fw_version()
1151 if (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_NVME2) { in qla2x00_get_fw_version()
1154 ha->fw_attributes_ext[0]); in qla2x00_get_fw_version()
1155 vha->flags.nvme2_enabled = 1; in qla2x00_get_fw_version()
1158 if (IS_QLA28XX(ha) && ha->flags.edif_hw && ql2xsecenable && in qla2x00_get_fw_version()
1159 (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_EDIF)) { in qla2x00_get_fw_version()
1160 ha->flags.edif_enabled = 1; in qla2x00_get_fw_version()
1167 ha->serdes_version[0] = mcp->mb[7] & 0xff; in qla2x00_get_fw_version()
1168 ha->serdes_version[1] = mcp->mb[8] >> 8; in qla2x00_get_fw_version()
1169 ha->serdes_version[2] = mcp->mb[8] & 0xff; in qla2x00_get_fw_version()
1170 ha->mpi_version[0] = mcp->mb[10] & 0xff; in qla2x00_get_fw_version()
1171 ha->mpi_version[1] = mcp->mb[11] >> 8; in qla2x00_get_fw_version()
1172 ha->mpi_version[2] = mcp->mb[11] & 0xff; in qla2x00_get_fw_version()
1173 ha->pep_version[0] = mcp->mb[13] & 0xff; in qla2x00_get_fw_version()
1174 ha->pep_version[1] = mcp->mb[14] >> 8; in qla2x00_get_fw_version()
1175 ha->pep_version[2] = mcp->mb[14] & 0xff; in qla2x00_get_fw_version()
1176 ha->fw_shared_ram_start = (mcp->mb[19] << 16) | mcp->mb[18]; in qla2x00_get_fw_version()
1177 ha->fw_shared_ram_end = (mcp->mb[21] << 16) | mcp->mb[20]; in qla2x00_get_fw_version()
1178 ha->fw_ddr_ram_start = (mcp->mb[23] << 16) | mcp->mb[22]; in qla2x00_get_fw_version()
1179 ha->fw_ddr_ram_end = (mcp->mb[25] << 16) | mcp->mb[24]; in qla2x00_get_fw_version()
1181 if (mcp->mb[16] & BIT_10) in qla2x00_get_fw_version()
1182 ha->flags.secure_fw = 1; in qla2x00_get_fw_version()
1186 (ha->flags.secure_fw) ? "Supported" : in qla2x00_get_fw_version()
1190 if (ha->flags.scm_supported_a && in qla2x00_get_fw_version()
1191 (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_SCM_SUPPORTED)) { in qla2x00_get_fw_version()
1192 ha->flags.scm_supported_f = 1; in qla2x00_get_fw_version()
1193 ha->sf_init_cb->flags |= cpu_to_le16(BIT_13); in qla2x00_get_fw_version()
1196 (ha->flags.scm_supported_f) ? "Supported" : in qla2x00_get_fw_version()
1199 if (vha->flags.nvme2_enabled) { in qla2x00_get_fw_version()
1201 ha->sf_init_cb->flags |= cpu_to_le16(BIT_15); in qla2x00_get_fw_version()
1203 ha->sf_init_cb->flags |= cpu_to_le16(BIT_14); in qla2x00_get_fw_version()
1243 mcp->mb[0] = MBC_GET_FIRMWARE_OPTION; in qla2x00_get_fw_options()
1244 mcp->out_mb = MBX_0; in qla2x00_get_fw_options()
1245 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_fw_options()
1246 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_fw_options()
1247 mcp->flags = 0; in qla2x00_get_fw_options()
1254 fwopts[0] = mcp->mb[0]; in qla2x00_get_fw_options()
1255 fwopts[1] = mcp->mb[1]; in qla2x00_get_fw_options()
1256 fwopts[2] = mcp->mb[2]; in qla2x00_get_fw_options()
1257 fwopts[3] = mcp->mb[3]; in qla2x00_get_fw_options()
1291 mcp->mb[0] = MBC_SET_FIRMWARE_OPTION; in qla2x00_set_fw_options()
1292 mcp->mb[1] = fwopts[1]; in qla2x00_set_fw_options()
1293 mcp->mb[2] = fwopts[2]; in qla2x00_set_fw_options()
1294 mcp->mb[3] = fwopts[3]; in qla2x00_set_fw_options()
1295 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_set_fw_options()
1296 mcp->in_mb = MBX_0; in qla2x00_set_fw_options()
1297 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_set_fw_options()
1298 mcp->in_mb |= MBX_1; in qla2x00_set_fw_options()
1299 mcp->mb[10] = fwopts[10]; in qla2x00_set_fw_options()
1300 mcp->out_mb |= MBX_10; in qla2x00_set_fw_options()
1302 mcp->mb[10] = fwopts[10]; in qla2x00_set_fw_options()
1303 mcp->mb[11] = fwopts[11]; in qla2x00_set_fw_options()
1304 mcp->mb[12] = 0; /* Undocumented, but used */ in qla2x00_set_fw_options()
1305 mcp->out_mb |= MBX_12|MBX_11|MBX_10; in qla2x00_set_fw_options()
1307 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_fw_options()
1308 mcp->flags = 0; in qla2x00_set_fw_options()
1311 fwopts[0] = mcp->mb[0]; in qla2x00_set_fw_options()
1316 "Failed=%x (%x/%x).\n", rval, mcp->mb[0], mcp->mb[1]); in qla2x00_set_fw_options()
1351 mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST; in qla2x00_mbx_reg_test()
1352 mcp->mb[1] = 0xAAAA; in qla2x00_mbx_reg_test()
1353 mcp->mb[2] = 0x5555; in qla2x00_mbx_reg_test()
1354 mcp->mb[3] = 0xAA55; in qla2x00_mbx_reg_test()
1355 mcp->mb[4] = 0x55AA; in qla2x00_mbx_reg_test()
1356 mcp->mb[5] = 0xA5A5; in qla2x00_mbx_reg_test()
1357 mcp->mb[6] = 0x5A5A; in qla2x00_mbx_reg_test()
1358 mcp->mb[7] = 0x2525; in qla2x00_mbx_reg_test()
1359 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_mbx_reg_test()
1360 mcp->in_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_mbx_reg_test()
1361 mcp->tov = MBX_TOV_SECONDS; in qla2x00_mbx_reg_test()
1362 mcp->flags = 0; in qla2x00_mbx_reg_test()
1366 if (mcp->mb[1] != 0xAAAA || mcp->mb[2] != 0x5555 || in qla2x00_mbx_reg_test()
1367 mcp->mb[3] != 0xAA55 || mcp->mb[4] != 0x55AA) in qla2x00_mbx_reg_test()
1369 if (mcp->mb[5] != 0xA5A5 || mcp->mb[6] != 0x5A5A || in qla2x00_mbx_reg_test()
1370 mcp->mb[7] != 0x2525) in qla2x00_mbx_reg_test()
1377 vha->hw_err_cnt++; in qla2x00_mbx_reg_test()
1412 mcp->mb[0] = MBC_VERIFY_CHECKSUM; in qla2x00_verify_checksum()
1413 mcp->out_mb = MBX_0; in qla2x00_verify_checksum()
1414 mcp->in_mb = MBX_0; in qla2x00_verify_checksum()
1415 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_verify_checksum()
1416 mcp->mb[1] = MSW(risc_addr); in qla2x00_verify_checksum()
1417 mcp->mb[2] = LSW(risc_addr); in qla2x00_verify_checksum()
1418 mcp->out_mb |= MBX_2|MBX_1; in qla2x00_verify_checksum()
1419 mcp->in_mb |= MBX_2|MBX_1; in qla2x00_verify_checksum()
1421 mcp->mb[1] = LSW(risc_addr); in qla2x00_verify_checksum()
1422 mcp->out_mb |= MBX_1; in qla2x00_verify_checksum()
1423 mcp->in_mb |= MBX_1; in qla2x00_verify_checksum()
1426 mcp->tov = MBX_TOV_SECONDS; in qla2x00_verify_checksum()
1427 mcp->flags = 0; in qla2x00_verify_checksum()
1432 "Failed=%x chm sum=%x.\n", rval, IS_FWI2_CAPABLE(vha->hw) ? in qla2x00_verify_checksum()
1433 (mcp->mb[2] << 16) | mcp->mb[1] : mcp->mb[1]); in qla2x00_verify_checksum()
1468 if (!vha->hw->flags.fw_started) in qla2x00_issue_iocb_timeout()
1474 mcp->mb[0] = MBC_IOCB_COMMAND_A64; in qla2x00_issue_iocb_timeout()
1475 mcp->mb[1] = 0; in qla2x00_issue_iocb_timeout()
1476 mcp->mb[2] = MSW(LSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1477 mcp->mb[3] = LSW(LSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1478 mcp->mb[6] = MSW(MSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1479 mcp->mb[7] = LSW(MSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1480 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_issue_iocb_timeout()
1481 mcp->in_mb = MBX_1|MBX_0; in qla2x00_issue_iocb_timeout()
1482 mcp->tov = tov; in qla2x00_issue_iocb_timeout()
1483 mcp->flags = 0; in qla2x00_issue_iocb_timeout()
1493 sts_entry->entry_status &= in qla2x00_issue_iocb_timeout()
1494 IS_FWI2_CAPABLE(vha->hw) ? RF_MASK_24XX : RF_MASK; in qla2x00_issue_iocb_timeout()
1497 sts_entry->entry_status); in qla2x00_issue_iocb_timeout()
1533 fc_port_t *fcport = sp->fcport; in qla2x00_abort_command()
1534 scsi_qla_host_t *vha = fcport->vha; in qla2x00_abort_command()
1535 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_command()
1542 if (sp->qpair) in qla2x00_abort_command()
1543 req = sp->qpair->req; in qla2x00_abort_command()
1545 req = vha->req; in qla2x00_abort_command()
1547 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_abort_command()
1548 for (handle = 1; handle < req->num_outstanding_cmds; handle++) { in qla2x00_abort_command()
1549 if (req->outstanding_cmds[handle] == sp) in qla2x00_abort_command()
1552 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_abort_command()
1554 if (handle == req->num_outstanding_cmds) { in qla2x00_abort_command()
1559 mcp->mb[0] = MBC_ABORT_COMMAND; in qla2x00_abort_command()
1561 mcp->mb[1] = fcport->loop_id; in qla2x00_abort_command()
1563 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_abort_command()
1564 mcp->mb[2] = (uint16_t)handle; in qla2x00_abort_command()
1565 mcp->mb[3] = (uint16_t)(handle >> 16); in qla2x00_abort_command()
1566 mcp->mb[6] = (uint16_t)cmd->device->lun; in qla2x00_abort_command()
1567 mcp->out_mb = MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_abort_command()
1568 mcp->in_mb = MBX_0; in qla2x00_abort_command()
1569 mcp->tov = MBX_TOV_SECONDS; in qla2x00_abort_command()
1570 mcp->flags = 0; in qla2x00_abort_command()
1591 vha = fcport->vha; in qla2x00_abort_target()
1596 mcp->mb[0] = MBC_ABORT_TARGET; in qla2x00_abort_target()
1597 mcp->out_mb = MBX_9|MBX_2|MBX_1|MBX_0; in qla2x00_abort_target()
1598 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_abort_target()
1599 mcp->mb[1] = fcport->loop_id; in qla2x00_abort_target()
1600 mcp->mb[10] = 0; in qla2x00_abort_target()
1601 mcp->out_mb |= MBX_10; in qla2x00_abort_target()
1603 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_abort_target()
1605 mcp->mb[2] = vha->hw->loop_reset_delay; in qla2x00_abort_target()
1606 mcp->mb[9] = vha->vp_idx; in qla2x00_abort_target()
1608 mcp->in_mb = MBX_0; in qla2x00_abort_target()
1609 mcp->tov = MBX_TOV_SECONDS; in qla2x00_abort_target()
1610 mcp->flags = 0; in qla2x00_abort_target()
1618 rval2 = qla2x00_marker(vha, vha->hw->base_qpair, fcport->loop_id, 0, in qla2x00_abort_target()
1639 vha = fcport->vha; in qla2x00_lun_reset()
1644 mcp->mb[0] = MBC_LUN_RESET; in qla2x00_lun_reset()
1645 mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_lun_reset()
1646 if (HAS_EXTENDED_IDS(vha->hw)) in qla2x00_lun_reset()
1647 mcp->mb[1] = fcport->loop_id; in qla2x00_lun_reset()
1649 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_lun_reset()
1650 mcp->mb[2] = (u32)l; in qla2x00_lun_reset()
1651 mcp->mb[3] = 0; in qla2x00_lun_reset()
1652 mcp->mb[9] = vha->vp_idx; in qla2x00_lun_reset()
1654 mcp->in_mb = MBX_0; in qla2x00_lun_reset()
1655 mcp->tov = MBX_TOV_SECONDS; in qla2x00_lun_reset()
1656 mcp->flags = 0; in qla2x00_lun_reset()
1663 rval2 = qla2x00_marker(vha, vha->hw->base_qpair, fcport->loop_id, l, in qla2x00_lun_reset()
1707 mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; in qla2x00_get_adapter_id()
1708 mcp->mb[9] = vha->vp_idx; in qla2x00_get_adapter_id()
1709 mcp->out_mb = MBX_9|MBX_0; in qla2x00_get_adapter_id()
1710 mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_adapter_id()
1711 if (IS_CNA_CAPABLE(vha->hw)) in qla2x00_get_adapter_id()
1712 mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10; in qla2x00_get_adapter_id()
1713 if (IS_FWI2_CAPABLE(vha->hw)) in qla2x00_get_adapter_id()
1714 mcp->in_mb |= MBX_19|MBX_18|MBX_17|MBX_16; in qla2x00_get_adapter_id()
1715 if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) in qla2x00_get_adapter_id()
1716 mcp->in_mb |= MBX_15|MBX_21|MBX_22|MBX_23; in qla2x00_get_adapter_id()
1718 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_adapter_id()
1719 mcp->flags = 0; in qla2x00_get_adapter_id()
1721 if (mcp->mb[0] == MBS_COMMAND_ERROR) in qla2x00_get_adapter_id()
1723 else if (mcp->mb[0] == MBS_INVALID_COMMAND) in qla2x00_get_adapter_id()
1727 *id = mcp->mb[1]; in qla2x00_get_adapter_id()
1728 *al_pa = LSB(mcp->mb[2]); in qla2x00_get_adapter_id()
1729 *area = MSB(mcp->mb[2]); in qla2x00_get_adapter_id()
1730 *domain = LSB(mcp->mb[3]); in qla2x00_get_adapter_id()
1731 *top = mcp->mb[6]; in qla2x00_get_adapter_id()
1732 *sw_cap = mcp->mb[7]; in qla2x00_get_adapter_id()
1741 if (IS_CNA_CAPABLE(vha->hw)) { in qla2x00_get_adapter_id()
1742 vha->fcoe_vlan_id = mcp->mb[9] & 0xfff; in qla2x00_get_adapter_id()
1743 vha->fcoe_fcf_idx = mcp->mb[10]; in qla2x00_get_adapter_id()
1744 vha->fcoe_vn_port_mac[5] = mcp->mb[11] >> 8; in qla2x00_get_adapter_id()
1745 vha->fcoe_vn_port_mac[4] = mcp->mb[11] & 0xff; in qla2x00_get_adapter_id()
1746 vha->fcoe_vn_port_mac[3] = mcp->mb[12] >> 8; in qla2x00_get_adapter_id()
1747 vha->fcoe_vn_port_mac[2] = mcp->mb[12] & 0xff; in qla2x00_get_adapter_id()
1748 vha->fcoe_vn_port_mac[1] = mcp->mb[13] >> 8; in qla2x00_get_adapter_id()
1749 vha->fcoe_vn_port_mac[0] = mcp->mb[13] & 0xff; in qla2x00_get_adapter_id()
1751 /* If FA-WWN supported */ in qla2x00_get_adapter_id()
1752 if (IS_FAWWN_CAPABLE(vha->hw)) { in qla2x00_get_adapter_id()
1753 if (mcp->mb[7] & BIT_14) { in qla2x00_get_adapter_id()
1754 vha->port_name[0] = MSB(mcp->mb[16]); in qla2x00_get_adapter_id()
1755 vha->port_name[1] = LSB(mcp->mb[16]); in qla2x00_get_adapter_id()
1756 vha->port_name[2] = MSB(mcp->mb[17]); in qla2x00_get_adapter_id()
1757 vha->port_name[3] = LSB(mcp->mb[17]); in qla2x00_get_adapter_id()
1758 vha->port_name[4] = MSB(mcp->mb[18]); in qla2x00_get_adapter_id()
1759 vha->port_name[5] = LSB(mcp->mb[18]); in qla2x00_get_adapter_id()
1760 vha->port_name[6] = MSB(mcp->mb[19]); in qla2x00_get_adapter_id()
1761 vha->port_name[7] = LSB(mcp->mb[19]); in qla2x00_get_adapter_id()
1762 fc_host_port_name(vha->host) = in qla2x00_get_adapter_id()
1763 wwn_to_u64(vha->port_name); in qla2x00_get_adapter_id()
1765 "FA-WWN acquired %016llx\n", in qla2x00_get_adapter_id()
1766 wwn_to_u64(vha->port_name)); in qla2x00_get_adapter_id()
1770 if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) { in qla2x00_get_adapter_id()
1771 vha->bbcr = mcp->mb[15]; in qla2x00_get_adapter_id()
1772 if (mcp->mb[7] & SCM_EDC_ACC_RECEIVED) { in qla2x00_get_adapter_id()
1775 mcp->mb[21]); in qla2x00_get_adapter_id()
1777 if (mcp->mb[7] & SCM_RDF_ACC_RECEIVED) { in qla2x00_get_adapter_id()
1778 vha->hw->flags.scm_enabled = 1; in qla2x00_get_adapter_id()
1779 vha->scm_fabric_connection_flags |= in qla2x00_get_adapter_id()
1783 mcp->mb[23]); in qla2x00_get_adapter_id()
1818 mcp->mb[0] = MBC_GET_RETRY_COUNT; in qla2x00_get_retry_cnt()
1819 mcp->out_mb = MBX_0; in qla2x00_get_retry_cnt()
1820 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_retry_cnt()
1821 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_retry_cnt()
1822 mcp->flags = 0; in qla2x00_get_retry_cnt()
1828 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_get_retry_cnt()
1831 *r_a_tov = mcp->mb[3] / 2; in qla2x00_get_retry_cnt()
1832 ratov = (mcp->mb[3]/2) / 10; /* mb[3] value is in 100ms */ in qla2x00_get_retry_cnt()
1833 if (mcp->mb[1] * ratov > (*retry_cnt) * (*tov)) { in qla2x00_get_retry_cnt()
1835 *retry_cnt = (uint8_t)mcp->mb[1]; in qla2x00_get_retry_cnt()
1840 "Done %s mb3=%d ratov=%d.\n", __func__, mcp->mb[3], ratov); in qla2x00_get_retry_cnt()
1869 struct qla_hw_data *ha = vha->hw; in qla2x00_init_firmware()
1875 qla82xx_wr_32(ha, (uintptr_t __force)ha->nxdb_wr_ptr, in qla2x00_init_firmware()
1876 (0x04 | (ha->portnum << 5) | (0 << 8) | (0 << 16))); in qla2x00_init_firmware()
1878 if (ha->flags.npiv_supported) in qla2x00_init_firmware()
1879 mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE; in qla2x00_init_firmware()
1881 mcp->mb[0] = MBC_INITIALIZE_FIRMWARE; in qla2x00_init_firmware()
1883 mcp->mb[1] = 0; in qla2x00_init_firmware()
1884 mcp->mb[2] = MSW(ha->init_cb_dma); in qla2x00_init_firmware()
1885 mcp->mb[3] = LSW(ha->init_cb_dma); in qla2x00_init_firmware()
1886 mcp->mb[6] = MSW(MSD(ha->init_cb_dma)); in qla2x00_init_firmware()
1887 mcp->mb[7] = LSW(MSD(ha->init_cb_dma)); in qla2x00_init_firmware()
1888 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_init_firmware()
1889 if (ha->ex_init_cb && ha->ex_init_cb->ex_version) { in qla2x00_init_firmware()
1890 mcp->mb[1] = BIT_0; in qla2x00_init_firmware()
1891 mcp->mb[10] = MSW(ha->ex_init_cb_dma); in qla2x00_init_firmware()
1892 mcp->mb[11] = LSW(ha->ex_init_cb_dma); in qla2x00_init_firmware()
1893 mcp->mb[12] = MSW(MSD(ha->ex_init_cb_dma)); in qla2x00_init_firmware()
1894 mcp->mb[13] = LSW(MSD(ha->ex_init_cb_dma)); in qla2x00_init_firmware()
1895 mcp->mb[14] = sizeof(*ha->ex_init_cb); in qla2x00_init_firmware()
1896 mcp->out_mb |= MBX_14|MBX_13|MBX_12|MBX_11|MBX_10; in qla2x00_init_firmware()
1899 if (ha->flags.scm_supported_f || vha->flags.nvme2_enabled) { in qla2x00_init_firmware()
1900 mcp->mb[1] |= BIT_1; in qla2x00_init_firmware()
1901 mcp->mb[16] = MSW(ha->sf_init_cb_dma); in qla2x00_init_firmware()
1902 mcp->mb[17] = LSW(ha->sf_init_cb_dma); in qla2x00_init_firmware()
1903 mcp->mb[18] = MSW(MSD(ha->sf_init_cb_dma)); in qla2x00_init_firmware()
1904 mcp->mb[19] = LSW(MSD(ha->sf_init_cb_dma)); in qla2x00_init_firmware()
1905 mcp->mb[15] = sizeof(*ha->sf_init_cb); in qla2x00_init_firmware()
1906 mcp->out_mb |= MBX_19|MBX_18|MBX_17|MBX_16|MBX_15; in qla2x00_init_firmware()
1910 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_init_firmware()
1913 mcp->in_mb |= MBX_3; in qla2x00_init_firmware()
1914 mcp->buf_size = size; in qla2x00_init_firmware()
1915 mcp->flags = MBX_DMA_OUT; in qla2x00_init_firmware()
1916 mcp->tov = MBX_TOV_SECONDS; in qla2x00_init_firmware()
1923 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3]); in qla2x00_init_firmware()
1924 if (ha->init_cb) { in qla2x00_init_firmware()
1927 0x0104d, ha->init_cb, sizeof(*ha->init_cb)); in qla2x00_init_firmware()
1929 if (ha->ex_init_cb && ha->ex_init_cb->ex_version) { in qla2x00_init_firmware()
1932 0x0104d, ha->ex_init_cb, sizeof(*ha->ex_init_cb)); in qla2x00_init_firmware()
1936 if (mcp->mb[2] == 6 || mcp->mb[3] == 2) in qla2x00_init_firmware()
1973 struct qla_hw_data *ha = vha->hw; in qla2x00_get_port_database()
1979 pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); in qla2x00_get_port_database()
1983 fcport->query = 0; in qla2x00_get_port_database()
1987 mcp->mb[0] = MBC_GET_PORT_DATABASE; in qla2x00_get_port_database()
1989 mcp->mb[0] = MBC_ENHANCED_GET_PORT_DATABASE; in qla2x00_get_port_database()
1990 mcp->mb[2] = MSW(pd_dma); in qla2x00_get_port_database()
1991 mcp->mb[3] = LSW(pd_dma); in qla2x00_get_port_database()
1992 mcp->mb[6] = MSW(MSD(pd_dma)); in qla2x00_get_port_database()
1993 mcp->mb[7] = LSW(MSD(pd_dma)); in qla2x00_get_port_database()
1994 mcp->mb[9] = vha->vp_idx; in qla2x00_get_port_database()
1995 mcp->out_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_port_database()
1996 mcp->in_mb = MBX_0; in qla2x00_get_port_database()
1998 mcp->mb[1] = fcport->loop_id; in qla2x00_get_port_database()
1999 mcp->mb[10] = opt; in qla2x00_get_port_database()
2000 mcp->out_mb |= MBX_10|MBX_1; in qla2x00_get_port_database()
2001 mcp->in_mb |= MBX_1; in qla2x00_get_port_database()
2003 mcp->mb[1] = fcport->loop_id; in qla2x00_get_port_database()
2004 mcp->mb[10] = opt; in qla2x00_get_port_database()
2005 mcp->out_mb |= MBX_10|MBX_1; in qla2x00_get_port_database()
2007 mcp->mb[1] = fcport->loop_id << 8 | opt; in qla2x00_get_port_database()
2008 mcp->out_mb |= MBX_1; in qla2x00_get_port_database()
2010 mcp->buf_size = IS_FWI2_CAPABLE(ha) ? in qla2x00_get_port_database()
2012 mcp->flags = MBX_DMA_IN; in qla2x00_get_port_database()
2013 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_get_port_database()
2026 current_login_state = pd24->current_login_state >> 4; in qla2x00_get_port_database()
2027 last_login_state = pd24->last_login_state >> 4; in qla2x00_get_port_database()
2029 current_login_state = pd24->current_login_state & 0xf; in qla2x00_get_port_database()
2030 last_login_state = pd24->last_login_state & 0xf; in qla2x00_get_port_database()
2032 fcport->current_login_state = pd24->current_login_state; in qla2x00_get_port_database()
2033 fcport->last_login_state = pd24->last_login_state; in qla2x00_get_port_database()
2039 "Unable to verify login-state (%x/%x) for loop_id %x.\n", in qla2x00_get_port_database()
2041 fcport->loop_id); in qla2x00_get_port_database()
2044 if (!fcport->query) in qla2x00_get_port_database()
2048 if (fcport->loop_id == FC_NO_LOOP_ID || in qla2x00_get_port_database()
2049 (memcmp(fcport->port_name, (uint8_t *)&zero, 8) && in qla2x00_get_port_database()
2050 memcmp(fcport->port_name, pd24->port_name, 8))) { in qla2x00_get_port_database()
2056 /* Names are little-endian. */ in qla2x00_get_port_database()
2057 memcpy(fcport->node_name, pd24->node_name, WWN_SIZE); in qla2x00_get_port_database()
2058 memcpy(fcport->port_name, pd24->port_name, WWN_SIZE); in qla2x00_get_port_database()
2061 fcport->d_id.b.domain = pd24->port_id[0]; in qla2x00_get_port_database()
2062 fcport->d_id.b.area = pd24->port_id[1]; in qla2x00_get_port_database()
2063 fcport->d_id.b.al_pa = pd24->port_id[2]; in qla2x00_get_port_database()
2064 fcport->d_id.b.rsvd_1 = 0; in qla2x00_get_port_database()
2067 if ((pd24->prli_svc_param_word_3[0] & BIT_4) == 0) in qla2x00_get_port_database()
2068 fcport->port_type = FCT_INITIATOR; in qla2x00_get_port_database()
2070 fcport->port_type = FCT_TARGET; in qla2x00_get_port_database()
2073 fcport->supported_classes = (pd24->flags & PDF_CLASS_2) ? in qla2x00_get_port_database()
2076 if (pd24->prli_svc_param_word_3[0] & BIT_7) in qla2x00_get_port_database()
2077 fcport->flags |= FCF_CONF_COMP_SUPPORTED; in qla2x00_get_port_database()
2082 if (pd->master_state != PD_STATE_PORT_LOGGED_IN && in qla2x00_get_port_database()
2083 pd->slave_state != PD_STATE_PORT_LOGGED_IN) { in qla2x00_get_port_database()
2085 "Unable to verify login-state (%x/%x) - " in qla2x00_get_port_database()
2086 "portid=%02x%02x%02x.\n", pd->master_state, in qla2x00_get_port_database()
2087 pd->slave_state, fcport->d_id.b.domain, in qla2x00_get_port_database()
2088 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_get_port_database()
2093 if (fcport->loop_id == FC_NO_LOOP_ID || in qla2x00_get_port_database()
2094 (memcmp(fcport->port_name, (uint8_t *)&zero, 8) && in qla2x00_get_port_database()
2095 memcmp(fcport->port_name, pd->port_name, 8))) { in qla2x00_get_port_database()
2101 /* Names are little-endian. */ in qla2x00_get_port_database()
2102 memcpy(fcport->node_name, pd->node_name, WWN_SIZE); in qla2x00_get_port_database()
2103 memcpy(fcport->port_name, pd->port_name, WWN_SIZE); in qla2x00_get_port_database()
2106 fcport->d_id.b.domain = pd->port_id[0]; in qla2x00_get_port_database()
2107 fcport->d_id.b.area = pd->port_id[3]; in qla2x00_get_port_database()
2108 fcport->d_id.b.al_pa = pd->port_id[2]; in qla2x00_get_port_database()
2109 fcport->d_id.b.rsvd_1 = 0; in qla2x00_get_port_database()
2112 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) in qla2x00_get_port_database()
2113 fcport->port_type = FCT_INITIATOR; in qla2x00_get_port_database()
2115 fcport->port_type = FCT_TARGET; in qla2x00_get_port_database()
2118 fcport->supported_classes = (pd->options & BIT_4) ? in qla2x00_get_port_database()
2123 dma_pool_free(ha->s_dma_pool, pd, pd_dma); in qla2x00_get_port_database()
2124 fcport->query = 0; in qla2x00_get_port_database()
2129 mcp->mb[0], mcp->mb[1]); in qla2x00_get_port_database()
2152 pdb_dma = dma_map_single(&vha->hw->pdev->dev, pdb, in qla24xx_get_port_database()
2159 mcp->mb[0] = MBC_GET_PORT_DATABASE; in qla24xx_get_port_database()
2160 mcp->mb[1] = nport_handle; in qla24xx_get_port_database()
2161 mcp->mb[2] = MSW(LSD(pdb_dma)); in qla24xx_get_port_database()
2162 mcp->mb[3] = LSW(LSD(pdb_dma)); in qla24xx_get_port_database()
2163 mcp->mb[6] = MSW(MSD(pdb_dma)); in qla24xx_get_port_database()
2164 mcp->mb[7] = LSW(MSD(pdb_dma)); in qla24xx_get_port_database()
2165 mcp->mb[9] = 0; in qla24xx_get_port_database()
2166 mcp->mb[10] = 0; in qla24xx_get_port_database()
2167 mcp->out_mb = MBX_10|MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_get_port_database()
2168 mcp->in_mb = MBX_1|MBX_0; in qla24xx_get_port_database()
2169 mcp->buf_size = sizeof(*pdb); in qla24xx_get_port_database()
2170 mcp->flags = MBX_DMA_IN; in qla24xx_get_port_database()
2171 mcp->tov = vha->hw->login_timeout * 2; in qla24xx_get_port_database()
2177 rval, mcp->mb[0], mcp->mb[1]); in qla24xx_get_port_database()
2183 dma_unmap_single(&vha->hw->pdev->dev, pdb_dma, in qla24xx_get_port_database()
2211 struct qla_hw_data *ha = vha->hw; in qla2x00_get_firmware_state()
2216 mcp->mb[0] = MBC_GET_FIRMWARE_STATE; in qla2x00_get_firmware_state()
2217 mcp->out_mb = MBX_0; in qla2x00_get_firmware_state()
2218 if (IS_FWI2_CAPABLE(vha->hw)) in qla2x00_get_firmware_state()
2219 mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_firmware_state()
2221 mcp->in_mb = MBX_1|MBX_0; in qla2x00_get_firmware_state()
2222 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_firmware_state()
2223 mcp->flags = 0; in qla2x00_get_firmware_state()
2227 states[0] = mcp->mb[1]; in qla2x00_get_firmware_state()
2228 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_get_firmware_state()
2229 states[1] = mcp->mb[2]; in qla2x00_get_firmware_state()
2230 states[2] = mcp->mb[3]; /* SFP info */ in qla2x00_get_firmware_state()
2231 states[3] = mcp->mb[4]; in qla2x00_get_firmware_state()
2232 states[4] = mcp->mb[5]; in qla2x00_get_firmware_state()
2233 states[5] = mcp->mb[6]; /* DPORT status */ in qla2x00_get_firmware_state()
2241 if (mcp->mb[2] == 6 || mcp->mb[3] == 2) in qla2x00_get_firmware_state()
2281 mcp->mb[0] = MBC_GET_PORT_NAME; in qla2x00_get_port_name()
2282 mcp->mb[9] = vha->vp_idx; in qla2x00_get_port_name()
2283 mcp->out_mb = MBX_9|MBX_1|MBX_0; in qla2x00_get_port_name()
2284 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_get_port_name()
2285 mcp->mb[1] = loop_id; in qla2x00_get_port_name()
2286 mcp->mb[10] = opt; in qla2x00_get_port_name()
2287 mcp->out_mb |= MBX_10; in qla2x00_get_port_name()
2289 mcp->mb[1] = loop_id << 8 | opt; in qla2x00_get_port_name()
2292 mcp->in_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_port_name()
2293 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_port_name()
2294 mcp->flags = 0; in qla2x00_get_port_name()
2303 name[0] = MSB(mcp->mb[2]); in qla2x00_get_port_name()
2304 name[1] = LSB(mcp->mb[2]); in qla2x00_get_port_name()
2305 name[2] = MSB(mcp->mb[3]); in qla2x00_get_port_name()
2306 name[3] = LSB(mcp->mb[3]); in qla2x00_get_port_name()
2307 name[4] = MSB(mcp->mb[6]); in qla2x00_get_port_name()
2308 name[5] = LSB(mcp->mb[6]); in qla2x00_get_port_name()
2309 name[6] = MSB(mcp->mb[7]); in qla2x00_get_port_name()
2310 name[7] = LSB(mcp->mb[7]); in qla2x00_get_port_name()
2345 if (!IS_FWI2_CAPABLE(vha->hw) || IS_CNA_CAPABLE(vha->hw)) in qla24xx_link_initialize()
2348 mcp->mb[0] = MBC_LINK_INITIALIZATION; in qla24xx_link_initialize()
2349 mcp->mb[1] = BIT_4; in qla24xx_link_initialize()
2350 if (vha->hw->operating_mode == LOOP) in qla24xx_link_initialize()
2351 mcp->mb[1] |= BIT_6; in qla24xx_link_initialize()
2353 mcp->mb[1] |= BIT_5; in qla24xx_link_initialize()
2354 mcp->mb[2] = 0; in qla24xx_link_initialize()
2355 mcp->mb[3] = 0; in qla24xx_link_initialize()
2356 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_link_initialize()
2357 mcp->in_mb = MBX_0; in qla24xx_link_initialize()
2358 mcp->tov = MBX_TOV_SECONDS; in qla24xx_link_initialize()
2359 mcp->flags = 0; in qla24xx_link_initialize()
2397 if (IS_CNA_CAPABLE(vha->hw)) { in qla2x00_lip_reset()
2399 mcp->mb[0] = MBC_LIP_FULL_LOGIN; in qla2x00_lip_reset()
2400 mcp->mb[1] = BIT_1; in qla2x00_lip_reset()
2401 mcp->mb[2] = 0; in qla2x00_lip_reset()
2402 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_lip_reset()
2403 } else if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_lip_reset()
2404 mcp->mb[0] = MBC_LIP_FULL_LOGIN; in qla2x00_lip_reset()
2405 mcp->mb[1] = BIT_4; in qla2x00_lip_reset()
2406 mcp->mb[2] = 0; in qla2x00_lip_reset()
2407 mcp->mb[3] = vha->hw->loop_reset_delay; in qla2x00_lip_reset()
2408 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_lip_reset()
2410 mcp->mb[0] = MBC_LIP_RESET; in qla2x00_lip_reset()
2411 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_lip_reset()
2412 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_lip_reset()
2413 mcp->mb[1] = 0x00ff; in qla2x00_lip_reset()
2414 mcp->mb[10] = 0; in qla2x00_lip_reset()
2415 mcp->out_mb |= MBX_10; in qla2x00_lip_reset()
2417 mcp->mb[1] = 0xff00; in qla2x00_lip_reset()
2419 mcp->mb[2] = vha->hw->loop_reset_delay; in qla2x00_lip_reset()
2420 mcp->mb[3] = 0; in qla2x00_lip_reset()
2422 mcp->in_mb = MBX_0; in qla2x00_lip_reset()
2423 mcp->tov = MBX_TOV_SECONDS; in qla2x00_lip_reset()
2424 mcp->flags = 0; in qla2x00_lip_reset()
2470 vha->hw->retry_count, vha->hw->login_timeout, mcp->tov); in qla2x00_send_sns()
2472 mcp->mb[0] = MBC_SEND_SNS_COMMAND; in qla2x00_send_sns()
2473 mcp->mb[1] = cmd_size; in qla2x00_send_sns()
2474 mcp->mb[2] = MSW(sns_phys_address); in qla2x00_send_sns()
2475 mcp->mb[3] = LSW(sns_phys_address); in qla2x00_send_sns()
2476 mcp->mb[6] = MSW(MSD(sns_phys_address)); in qla2x00_send_sns()
2477 mcp->mb[7] = LSW(MSD(sns_phys_address)); in qla2x00_send_sns()
2478 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_send_sns()
2479 mcp->in_mb = MBX_0|MBX_1; in qla2x00_send_sns()
2480 mcp->buf_size = buf_size; in qla2x00_send_sns()
2481 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN; in qla2x00_send_sns()
2482 mcp->tov = (vha->hw->login_timeout * 2) + (vha->hw->login_timeout / 2); in qla2x00_send_sns()
2489 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_send_sns()
2508 struct qla_hw_data *ha = vha->hw; in qla24xx_login_fabric()
2514 if (vha->vp_idx && vha->qpair) in qla24xx_login_fabric()
2515 req = vha->qpair->req; in qla24xx_login_fabric()
2517 req = ha->req_q_map[0]; in qla24xx_login_fabric()
2519 lg = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); in qla24xx_login_fabric()
2526 lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; in qla24xx_login_fabric()
2527 lg->entry_count = 1; in qla24xx_login_fabric()
2528 lg->handle = make_handle(req->id, lg->handle); in qla24xx_login_fabric()
2529 lg->nport_handle = cpu_to_le16(loop_id); in qla24xx_login_fabric()
2530 lg->control_flags = cpu_to_le16(LCF_COMMAND_PLOGI); in qla24xx_login_fabric()
2532 lg->control_flags |= cpu_to_le16(LCF_COND_PLOGI); in qla24xx_login_fabric()
2534 lg->control_flags |= cpu_to_le16(LCF_SKIP_PRLI); in qla24xx_login_fabric()
2535 lg->port_id[0] = al_pa; in qla24xx_login_fabric()
2536 lg->port_id[1] = area; in qla24xx_login_fabric()
2537 lg->port_id[2] = domain; in qla24xx_login_fabric()
2538 lg->vp_index = vha->vp_idx; in qla24xx_login_fabric()
2540 (ha->r_a_tov / 10 * 2) + 2); in qla24xx_login_fabric()
2544 } else if (lg->entry_status != 0) { in qla24xx_login_fabric()
2546 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_login_fabric()
2547 lg->entry_status); in qla24xx_login_fabric()
2549 } else if (lg->comp_status != cpu_to_le16(CS_COMPLETE)) { in qla24xx_login_fabric()
2550 iop[0] = le32_to_cpu(lg->io_parameter[0]); in qla24xx_login_fabric()
2551 iop[1] = le32_to_cpu(lg->io_parameter[1]); in qla24xx_login_fabric()
2554 "Failed to complete IOCB -- completion status (%x) " in qla24xx_login_fabric()
2555 "ioparam=%x/%x.\n", le16_to_cpu(lg->comp_status), in qla24xx_login_fabric()
2587 iop[0] = le32_to_cpu(lg->io_parameter[0]); in qla24xx_login_fabric()
2599 if (lg->io_parameter[7] || lg->io_parameter[8]) in qla24xx_login_fabric()
2601 if (lg->io_parameter[9] || lg->io_parameter[10]) in qla24xx_login_fabric()
2603 if (lg->io_parameter[0] & cpu_to_le32(BIT_7)) in qla24xx_login_fabric()
2609 dma_pool_free(ha->s_dma_pool, lg, lg_dma); in qla24xx_login_fabric()
2642 struct qla_hw_data *ha = vha->hw; in qla2x00_login_fabric()
2647 mcp->mb[0] = MBC_LOGIN_FABRIC_PORT; in qla2x00_login_fabric()
2648 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_login_fabric()
2650 mcp->mb[1] = loop_id; in qla2x00_login_fabric()
2651 mcp->mb[10] = opt; in qla2x00_login_fabric()
2652 mcp->out_mb |= MBX_10; in qla2x00_login_fabric()
2654 mcp->mb[1] = (loop_id << 8) | opt; in qla2x00_login_fabric()
2656 mcp->mb[2] = domain; in qla2x00_login_fabric()
2657 mcp->mb[3] = area << 8 | al_pa; in qla2x00_login_fabric()
2659 mcp->in_mb = MBX_7|MBX_6|MBX_2|MBX_1|MBX_0; in qla2x00_login_fabric()
2660 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_login_fabric()
2661 mcp->flags = 0; in qla2x00_login_fabric()
2666 mb[0] = mcp->mb[0]; in qla2x00_login_fabric()
2667 mb[1] = mcp->mb[1]; in qla2x00_login_fabric()
2668 mb[2] = mcp->mb[2]; in qla2x00_login_fabric()
2669 mb[6] = mcp->mb[6]; in qla2x00_login_fabric()
2670 mb[7] = mcp->mb[7]; in qla2x00_login_fabric()
2671 /* COS retrieved from Get-Port-Database mailbox command. */ in qla2x00_login_fabric()
2682 if (mcp->mb[0] == 0x4001 || mcp->mb[0] == 0x4002 || in qla2x00_login_fabric()
2683 mcp->mb[0] == 0x4003 || mcp->mb[0] == 0x4005 || in qla2x00_login_fabric()
2684 mcp->mb[0] == 0x4006) in qla2x00_login_fabric()
2690 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla2x00_login_fabric()
2723 struct qla_hw_data *ha = vha->hw; in qla2x00_login_local_device()
2729 return qla24xx_login_fabric(vha, fcport->loop_id, in qla2x00_login_local_device()
2730 fcport->d_id.b.domain, fcport->d_id.b.area, in qla2x00_login_local_device()
2731 fcport->d_id.b.al_pa, mb_ret, opt); in qla2x00_login_local_device()
2733 mcp->mb[0] = MBC_LOGIN_LOOP_PORT; in qla2x00_login_local_device()
2735 mcp->mb[1] = fcport->loop_id; in qla2x00_login_local_device()
2737 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_login_local_device()
2738 mcp->mb[2] = opt; in qla2x00_login_local_device()
2739 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_login_local_device()
2740 mcp->in_mb = MBX_7|MBX_6|MBX_1|MBX_0; in qla2x00_login_local_device()
2741 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_login_local_device()
2742 mcp->flags = 0; in qla2x00_login_local_device()
2747 mb_ret[0] = mcp->mb[0]; in qla2x00_login_local_device()
2748 mb_ret[1] = mcp->mb[1]; in qla2x00_login_local_device()
2749 mb_ret[6] = mcp->mb[6]; in qla2x00_login_local_device()
2750 mb_ret[7] = mcp->mb[7]; in qla2x00_login_local_device()
2760 if (mcp->mb[0] == 0x4005 || mcp->mb[0] == 0x4006) in qla2x00_login_local_device()
2765 rval, mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]); in qla2x00_login_local_device()
2782 struct qla_hw_data *ha = vha->hw; in qla24xx_fabric_logout()
2788 lg = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); in qla24xx_fabric_logout()
2795 req = vha->req; in qla24xx_fabric_logout()
2796 lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; in qla24xx_fabric_logout()
2797 lg->entry_count = 1; in qla24xx_fabric_logout()
2798 lg->handle = make_handle(req->id, lg->handle); in qla24xx_fabric_logout()
2799 lg->nport_handle = cpu_to_le16(loop_id); in qla24xx_fabric_logout()
2800 lg->control_flags = in qla24xx_fabric_logout()
2803 lg->port_id[0] = al_pa; in qla24xx_fabric_logout()
2804 lg->port_id[1] = area; in qla24xx_fabric_logout()
2805 lg->port_id[2] = domain; in qla24xx_fabric_logout()
2806 lg->vp_index = vha->vp_idx; in qla24xx_fabric_logout()
2808 (ha->r_a_tov / 10 * 2) + 2); in qla24xx_fabric_logout()
2812 } else if (lg->entry_status != 0) { in qla24xx_fabric_logout()
2814 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_fabric_logout()
2815 lg->entry_status); in qla24xx_fabric_logout()
2817 } else if (lg->comp_status != cpu_to_le16(CS_COMPLETE)) { in qla24xx_fabric_logout()
2819 "Failed to complete IOCB -- completion status (%x) " in qla24xx_fabric_logout()
2820 "ioparam=%x/%x.\n", le16_to_cpu(lg->comp_status), in qla24xx_fabric_logout()
2821 le32_to_cpu(lg->io_parameter[0]), in qla24xx_fabric_logout()
2822 le32_to_cpu(lg->io_parameter[1])); in qla24xx_fabric_logout()
2829 dma_pool_free(ha->s_dma_pool, lg, lg_dma); in qla24xx_fabric_logout()
2861 mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT; in qla2x00_fabric_logout()
2862 mcp->out_mb = MBX_1|MBX_0; in qla2x00_fabric_logout()
2863 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_fabric_logout()
2864 mcp->mb[1] = loop_id; in qla2x00_fabric_logout()
2865 mcp->mb[10] = 0; in qla2x00_fabric_logout()
2866 mcp->out_mb |= MBX_10; in qla2x00_fabric_logout()
2868 mcp->mb[1] = loop_id << 8; in qla2x00_fabric_logout()
2871 mcp->in_mb = MBX_1|MBX_0; in qla2x00_fabric_logout()
2872 mcp->tov = MBX_TOV_SECONDS; in qla2x00_fabric_logout()
2873 mcp->flags = 0; in qla2x00_fabric_logout()
2879 "Failed=%x mb[1]=%x.\n", rval, mcp->mb[1]); in qla2x00_fabric_logout()
2914 mcp->mb[0] = MBC_LIP_FULL_LOGIN; in qla2x00_full_login_lip()
2915 mcp->mb[1] = IS_FWI2_CAPABLE(vha->hw) ? BIT_4 : 0; in qla2x00_full_login_lip()
2916 mcp->mb[2] = 0; in qla2x00_full_login_lip()
2917 mcp->mb[3] = 0; in qla2x00_full_login_lip()
2918 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_full_login_lip()
2919 mcp->in_mb = MBX_0; in qla2x00_full_login_lip()
2920 mcp->tov = MBX_TOV_SECONDS; in qla2x00_full_login_lip()
2921 mcp->flags = 0; in qla2x00_full_login_lip()
2962 mcp->mb[0] = MBC_GET_ID_LIST; in qla2x00_get_id_list()
2963 mcp->out_mb = MBX_0; in qla2x00_get_id_list()
2964 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_get_id_list()
2965 mcp->mb[2] = MSW(id_list_dma); in qla2x00_get_id_list()
2966 mcp->mb[3] = LSW(id_list_dma); in qla2x00_get_id_list()
2967 mcp->mb[6] = MSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2968 mcp->mb[7] = LSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2969 mcp->mb[8] = 0; in qla2x00_get_id_list()
2970 mcp->mb[9] = vha->vp_idx; in qla2x00_get_id_list()
2971 mcp->out_mb |= MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2; in qla2x00_get_id_list()
2973 mcp->mb[1] = MSW(id_list_dma); in qla2x00_get_id_list()
2974 mcp->mb[2] = LSW(id_list_dma); in qla2x00_get_id_list()
2975 mcp->mb[3] = MSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2976 mcp->mb[6] = LSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2977 mcp->out_mb |= MBX_6|MBX_3|MBX_2|MBX_1; in qla2x00_get_id_list()
2979 mcp->in_mb = MBX_1|MBX_0; in qla2x00_get_id_list()
2980 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_id_list()
2981 mcp->flags = 0; in qla2x00_get_id_list()
2988 *entries = mcp->mb[1]; in qla2x00_get_id_list()
3012 struct qla_hw_data *ha = vha->hw; in qla2x00_get_resource_cnts()
3020 mcp->mb[0] = MBC_GET_RESOURCE_COUNTS; in qla2x00_get_resource_cnts()
3021 mcp->out_mb = MBX_0; in qla2x00_get_resource_cnts()
3022 mcp->in_mb = MBX_11|MBX_10|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_resource_cnts()
3025 mcp->in_mb |= MBX_12; in qla2x00_get_resource_cnts()
3026 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_resource_cnts()
3027 mcp->flags = 0; in qla2x00_get_resource_cnts()
3033 "Failed mb[0]=%x.\n", mcp->mb[0]); in qla2x00_get_resource_cnts()
3037 "mb11=%x mb12=%x.\n", __func__, mcp->mb[1], mcp->mb[2], in qla2x00_get_resource_cnts()
3038 mcp->mb[3], mcp->mb[6], mcp->mb[7], mcp->mb[10], in qla2x00_get_resource_cnts()
3039 mcp->mb[11], mcp->mb[12]); in qla2x00_get_resource_cnts()
3041 ha->orig_fw_tgt_xcb_count = mcp->mb[1]; in qla2x00_get_resource_cnts()
3042 ha->cur_fw_tgt_xcb_count = mcp->mb[2]; in qla2x00_get_resource_cnts()
3043 ha->cur_fw_xcb_count = mcp->mb[3]; in qla2x00_get_resource_cnts()
3044 ha->orig_fw_xcb_count = mcp->mb[6]; in qla2x00_get_resource_cnts()
3045 ha->cur_fw_iocb_count = mcp->mb[7]; in qla2x00_get_resource_cnts()
3046 ha->orig_fw_iocb_count = mcp->mb[10]; in qla2x00_get_resource_cnts()
3047 if (ha->flags.npiv_supported) in qla2x00_get_resource_cnts()
3048 ha->max_npiv_vports = mcp->mb[11]; in qla2x00_get_resource_cnts()
3050 ha->fw_max_fcf_count = mcp->mb[12]; in qla2x00_get_resource_cnts()
3079 struct qla_hw_data *ha = vha->hw; in qla2x00_get_fcal_position_map()
3084 pmap = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pmap_dma); in qla2x00_get_fcal_position_map()
3091 mcp->mb[0] = MBC_GET_FC_AL_POSITION_MAP; in qla2x00_get_fcal_position_map()
3092 mcp->mb[2] = MSW(pmap_dma); in qla2x00_get_fcal_position_map()
3093 mcp->mb[3] = LSW(pmap_dma); in qla2x00_get_fcal_position_map()
3094 mcp->mb[6] = MSW(MSD(pmap_dma)); in qla2x00_get_fcal_position_map()
3095 mcp->mb[7] = LSW(MSD(pmap_dma)); in qla2x00_get_fcal_position_map()
3096 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_fcal_position_map()
3097 mcp->in_mb = MBX_1|MBX_0; in qla2x00_get_fcal_position_map()
3098 mcp->buf_size = FCAL_MAP_SIZE; in qla2x00_get_fcal_position_map()
3099 mcp->flags = MBX_DMA_IN; in qla2x00_get_fcal_position_map()
3100 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_get_fcal_position_map()
3106 mcp->mb[0], mcp->mb[1], (unsigned)pmap[0]); in qla2x00_get_fcal_position_map()
3115 dma_pool_free(ha->s_dma_pool, pmap, pmap_dma); in qla2x00_get_fcal_position_map()
3149 struct qla_hw_data *ha = vha->hw; in qla2x00_get_link_status()
3154 mcp->mb[0] = MBC_GET_LINK_STATUS; in qla2x00_get_link_status()
3155 mcp->mb[2] = MSW(LSD(stats_dma)); in qla2x00_get_link_status()
3156 mcp->mb[3] = LSW(LSD(stats_dma)); in qla2x00_get_link_status()
3157 mcp->mb[6] = MSW(MSD(stats_dma)); in qla2x00_get_link_status()
3158 mcp->mb[7] = LSW(MSD(stats_dma)); in qla2x00_get_link_status()
3159 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_link_status()
3160 mcp->in_mb = MBX_0; in qla2x00_get_link_status()
3162 mcp->mb[1] = loop_id; in qla2x00_get_link_status()
3163 mcp->mb[4] = 0; in qla2x00_get_link_status()
3164 mcp->mb[10] = 0; in qla2x00_get_link_status()
3165 mcp->out_mb |= MBX_10|MBX_4|MBX_1; in qla2x00_get_link_status()
3166 mcp->in_mb |= MBX_1; in qla2x00_get_link_status()
3168 mcp->mb[1] = loop_id; in qla2x00_get_link_status()
3169 mcp->mb[10] = 0; in qla2x00_get_link_status()
3170 mcp->out_mb |= MBX_10|MBX_1; in qla2x00_get_link_status()
3172 mcp->mb[1] = loop_id << 8; in qla2x00_get_link_status()
3173 mcp->out_mb |= MBX_1; in qla2x00_get_link_status()
3175 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_link_status()
3176 mcp->flags = IOCTL_CMD; in qla2x00_get_link_status()
3180 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { in qla2x00_get_link_status()
3182 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_get_link_status()
3185 /* Re-endianize - firmware data is le32. */ in qla2x00_get_link_status()
3188 for ( ; dwords--; iter++) in qla2x00_get_link_status()
3219 mc.mb[9] = vha->vp_idx; in qla24xx_get_isp_stats()
3225 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { in qla24xx_get_isp_stats()
3227 "Failed mb[0]=%x.\n", mcp->mb[0]); in qla24xx_get_isp_stats()
3232 /* Re-endianize - firmware data is le32. */ in qla24xx_get_isp_stats()
3233 for ( ; dwords--; iter++) in qla24xx_get_isp_stats()
3253 fc_port_t *fcport = sp->fcport; in qla24xx_abort_command()
3254 struct scsi_qla_host *vha = fcport->vha; in qla24xx_abort_command()
3255 struct qla_hw_data *ha = vha->hw; in qla24xx_abort_command()
3257 struct qla_qpair *qpair = sp->qpair; in qla24xx_abort_command()
3262 if (sp->qpair) in qla24xx_abort_command()
3263 req = sp->qpair->req; in qla24xx_abort_command()
3270 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla24xx_abort_command()
3271 for (handle = 1; handle < req->num_outstanding_cmds; handle++) { in qla24xx_abort_command()
3272 if (req->outstanding_cmds[handle] == sp) in qla24xx_abort_command()
3275 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla24xx_abort_command()
3276 if (handle == req->num_outstanding_cmds) { in qla24xx_abort_command()
3281 abt = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &abt_dma); in qla24xx_abort_command()
3288 abt->entry_type = ABORT_IOCB_TYPE; in qla24xx_abort_command()
3289 abt->entry_count = 1; in qla24xx_abort_command()
3290 abt->handle = make_handle(req->id, abt->handle); in qla24xx_abort_command()
3291 abt->nport_handle = cpu_to_le16(fcport->loop_id); in qla24xx_abort_command()
3292 abt->handle_to_abort = make_handle(req->id, handle); in qla24xx_abort_command()
3293 abt->port_id[0] = fcport->d_id.b.al_pa; in qla24xx_abort_command()
3294 abt->port_id[1] = fcport->d_id.b.area; in qla24xx_abort_command()
3295 abt->port_id[2] = fcport->d_id.b.domain; in qla24xx_abort_command()
3296 abt->vp_index = fcport->vha->vp_idx; in qla24xx_abort_command()
3298 abt->req_que_no = cpu_to_le16(req->id); in qla24xx_abort_command()
3306 } else if (abt->entry_status != 0) { in qla24xx_abort_command()
3308 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_abort_command()
3309 abt->entry_status); in qla24xx_abort_command()
3311 } else if (abt->nport_handle != cpu_to_le16(0)) { in qla24xx_abort_command()
3313 "Failed to complete IOCB -- completion status (%x).\n", in qla24xx_abort_command()
3314 le16_to_cpu(abt->nport_handle)); in qla24xx_abort_command()
3315 if (abt->nport_handle == cpu_to_le16(CS_IOCB_ERROR)) in qla24xx_abort_command()
3328 dma_pool_free(ha->s_dma_pool, abt, abt_dma); in qla24xx_abort_command()
3353 vha = fcport->vha; in __qla24xx_issue_tmf()
3354 ha = vha->hw; in __qla24xx_issue_tmf()
3355 req = vha->req; in __qla24xx_issue_tmf()
3360 if (vha->vp_idx && vha->qpair) { in __qla24xx_issue_tmf()
3362 qpair = vha->qpair; in __qla24xx_issue_tmf()
3363 req = qpair->req; in __qla24xx_issue_tmf()
3366 tsk = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma); in __qla24xx_issue_tmf()
3373 tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE; in __qla24xx_issue_tmf()
3374 tsk->p.tsk.entry_count = 1; in __qla24xx_issue_tmf()
3375 tsk->p.tsk.handle = make_handle(req->id, tsk->p.tsk.handle); in __qla24xx_issue_tmf()
3376 tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id); in __qla24xx_issue_tmf()
3377 tsk->p.tsk.timeout = cpu_to_le16(ha->r_a_tov / 10 * 2); in __qla24xx_issue_tmf()
3378 tsk->p.tsk.control_flags = cpu_to_le32(type); in __qla24xx_issue_tmf()
3379 tsk->p.tsk.port_id[0] = fcport->d_id.b.al_pa; in __qla24xx_issue_tmf()
3380 tsk->p.tsk.port_id[1] = fcport->d_id.b.area; in __qla24xx_issue_tmf()
3381 tsk->p.tsk.port_id[2] = fcport->d_id.b.domain; in __qla24xx_issue_tmf()
3382 tsk->p.tsk.vp_index = fcport->vha->vp_idx; in __qla24xx_issue_tmf()
3384 int_to_scsilun(l, &tsk->p.tsk.lun); in __qla24xx_issue_tmf()
3385 host_to_fcp_swap((uint8_t *)&tsk->p.tsk.lun, in __qla24xx_issue_tmf()
3386 sizeof(tsk->p.tsk.lun)); in __qla24xx_issue_tmf()
3389 sts = &tsk->p.sts; in __qla24xx_issue_tmf()
3394 } else if (sts->entry_status != 0) { in __qla24xx_issue_tmf()
3396 "Failed to complete IOCB -- error status (%x).\n", in __qla24xx_issue_tmf()
3397 sts->entry_status); in __qla24xx_issue_tmf()
3399 } else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) { in __qla24xx_issue_tmf()
3401 "Failed to complete IOCB -- completion status (%x).\n", in __qla24xx_issue_tmf()
3402 le16_to_cpu(sts->comp_status)); in __qla24xx_issue_tmf()
3404 } else if (le16_to_cpu(sts->scsi_status) & in __qla24xx_issue_tmf()
3406 if (le32_to_cpu(sts->rsp_data_len) < 4) { in __qla24xx_issue_tmf()
3408 "Ignoring inconsistent data length -- not enough " in __qla24xx_issue_tmf()
3410 le32_to_cpu(sts->rsp_data_len)); in __qla24xx_issue_tmf()
3411 } else if (sts->data[3]) { in __qla24xx_issue_tmf()
3413 "Failed to complete IOCB -- response (%x).\n", in __qla24xx_issue_tmf()
3414 sts->data[3]); in __qla24xx_issue_tmf()
3420 rval2 = qla2x00_marker(vha, ha->base_qpair, fcport->loop_id, l, in __qla24xx_issue_tmf()
3430 dma_pool_free(ha->s_dma_pool, tsk, tsk_dma); in __qla24xx_issue_tmf()
3438 struct qla_hw_data *ha = fcport->vha->hw; in qla24xx_abort_target()
3449 struct qla_hw_data *ha = fcport->vha->hw; in qla24xx_lun_reset()
3463 struct qla_hw_data *ha = vha->hw; in qla2x00_system_error()
3471 mcp->mb[0] = MBC_GEN_SYSTEM_ERROR; in qla2x00_system_error()
3472 mcp->out_mb = MBX_0; in qla2x00_system_error()
3473 mcp->in_mb = MBX_0; in qla2x00_system_error()
3474 mcp->tov = 5; in qla2x00_system_error()
3475 mcp->flags = 0; in qla2x00_system_error()
3495 if (!IS_QLA25XX(vha->hw) && !IS_QLA2031(vha->hw) && in qla2x00_write_serdes_word()
3496 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla2x00_write_serdes_word()
3502 mcp->mb[0] = MBC_WRITE_SERDES; in qla2x00_write_serdes_word()
3503 mcp->mb[1] = addr; in qla2x00_write_serdes_word()
3504 if (IS_QLA2031(vha->hw)) in qla2x00_write_serdes_word()
3505 mcp->mb[2] = data & 0xff; in qla2x00_write_serdes_word()
3507 mcp->mb[2] = data; in qla2x00_write_serdes_word()
3509 mcp->mb[3] = 0; in qla2x00_write_serdes_word()
3510 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_write_serdes_word()
3511 mcp->in_mb = MBX_0; in qla2x00_write_serdes_word()
3512 mcp->tov = MBX_TOV_SECONDS; in qla2x00_write_serdes_word()
3513 mcp->flags = 0; in qla2x00_write_serdes_word()
3518 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_write_serdes_word()
3534 if (!IS_QLA25XX(vha->hw) && !IS_QLA2031(vha->hw) && in qla2x00_read_serdes_word()
3535 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla2x00_read_serdes_word()
3541 mcp->mb[0] = MBC_READ_SERDES; in qla2x00_read_serdes_word()
3542 mcp->mb[1] = addr; in qla2x00_read_serdes_word()
3543 mcp->mb[3] = 0; in qla2x00_read_serdes_word()
3544 mcp->out_mb = MBX_3|MBX_1|MBX_0; in qla2x00_read_serdes_word()
3545 mcp->in_mb = MBX_1|MBX_0; in qla2x00_read_serdes_word()
3546 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_serdes_word()
3547 mcp->flags = 0; in qla2x00_read_serdes_word()
3550 if (IS_QLA2031(vha->hw)) in qla2x00_read_serdes_word()
3551 *data = mcp->mb[1] & 0xff; in qla2x00_read_serdes_word()
3553 *data = mcp->mb[1]; in qla2x00_read_serdes_word()
3557 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_read_serdes_word()
3573 if (!IS_QLA8044(vha->hw)) in qla8044_write_serdes_word()
3579 mcp->mb[0] = MBC_SET_GET_ETH_SERDES_REG; in qla8044_write_serdes_word()
3580 mcp->mb[1] = HCS_WRITE_SERDES; in qla8044_write_serdes_word()
3581 mcp->mb[3] = LSW(addr); in qla8044_write_serdes_word()
3582 mcp->mb[4] = MSW(addr); in qla8044_write_serdes_word()
3583 mcp->mb[5] = LSW(data); in qla8044_write_serdes_word()
3584 mcp->mb[6] = MSW(data); in qla8044_write_serdes_word()
3585 mcp->out_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; in qla8044_write_serdes_word()
3586 mcp->in_mb = MBX_0; in qla8044_write_serdes_word()
3587 mcp->tov = MBX_TOV_SECONDS; in qla8044_write_serdes_word()
3588 mcp->flags = 0; in qla8044_write_serdes_word()
3593 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla8044_write_serdes_word()
3609 if (!IS_QLA8044(vha->hw)) in qla8044_read_serdes_word()
3615 mcp->mb[0] = MBC_SET_GET_ETH_SERDES_REG; in qla8044_read_serdes_word()
3616 mcp->mb[1] = HCS_READ_SERDES; in qla8044_read_serdes_word()
3617 mcp->mb[3] = LSW(addr); in qla8044_read_serdes_word()
3618 mcp->mb[4] = MSW(addr); in qla8044_read_serdes_word()
3619 mcp->out_mb = MBX_4|MBX_3|MBX_1|MBX_0; in qla8044_read_serdes_word()
3620 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla8044_read_serdes_word()
3621 mcp->tov = MBX_TOV_SECONDS; in qla8044_read_serdes_word()
3622 mcp->flags = 0; in qla8044_read_serdes_word()
3625 *data = mcp->mb[2] << 16 | mcp->mb[1]; in qla8044_read_serdes_word()
3629 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla8044_read_serdes_word()
3639 * qla2x00_set_serdes_params() -
3658 mcp->mb[0] = MBC_SERDES_PARAMS; in qla2x00_set_serdes_params()
3659 mcp->mb[1] = BIT_0; in qla2x00_set_serdes_params()
3660 mcp->mb[2] = sw_em_1g | BIT_15; in qla2x00_set_serdes_params()
3661 mcp->mb[3] = sw_em_2g | BIT_15; in qla2x00_set_serdes_params()
3662 mcp->mb[4] = sw_em_4g | BIT_15; in qla2x00_set_serdes_params()
3663 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_set_serdes_params()
3664 mcp->in_mb = MBX_0; in qla2x00_set_serdes_params()
3665 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_serdes_params()
3666 mcp->flags = 0; in qla2x00_set_serdes_params()
3672 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_set_serdes_params()
3689 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_stop_firmware()
3695 mcp->mb[0] = MBC_STOP_FIRMWARE; in qla2x00_stop_firmware()
3696 mcp->mb[1] = 0; in qla2x00_stop_firmware()
3697 mcp->out_mb = MBX_1|MBX_0; in qla2x00_stop_firmware()
3698 mcp->in_mb = MBX_0; in qla2x00_stop_firmware()
3699 mcp->tov = 5; in qla2x00_stop_firmware()
3700 mcp->flags = 0; in qla2x00_stop_firmware()
3705 if (mcp->mb[0] == MBS_INVALID_COMMAND) in qla2x00_stop_firmware()
3726 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_enable_eft_trace()
3729 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_enable_eft_trace()
3732 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_enable_eft_trace()
3733 mcp->mb[1] = TC_EFT_ENABLE; in qla2x00_enable_eft_trace()
3734 mcp->mb[2] = LSW(eft_dma); in qla2x00_enable_eft_trace()
3735 mcp->mb[3] = MSW(eft_dma); in qla2x00_enable_eft_trace()
3736 mcp->mb[4] = LSW(MSD(eft_dma)); in qla2x00_enable_eft_trace()
3737 mcp->mb[5] = MSW(MSD(eft_dma)); in qla2x00_enable_eft_trace()
3738 mcp->mb[6] = buffers; in qla2x00_enable_eft_trace()
3739 mcp->mb[7] = TC_AEN_DISABLE; in qla2x00_enable_eft_trace()
3740 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_enable_eft_trace()
3741 mcp->in_mb = MBX_1|MBX_0; in qla2x00_enable_eft_trace()
3742 mcp->tov = MBX_TOV_SECONDS; in qla2x00_enable_eft_trace()
3743 mcp->flags = 0; in qla2x00_enable_eft_trace()
3748 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_enable_eft_trace()
3767 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_disable_eft_trace()
3770 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_disable_eft_trace()
3773 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_disable_eft_trace()
3774 mcp->mb[1] = TC_EFT_DISABLE; in qla2x00_disable_eft_trace()
3775 mcp->out_mb = MBX_1|MBX_0; in qla2x00_disable_eft_trace()
3776 mcp->in_mb = MBX_1|MBX_0; in qla2x00_disable_eft_trace()
3777 mcp->tov = MBX_TOV_SECONDS; in qla2x00_disable_eft_trace()
3778 mcp->flags = 0; in qla2x00_disable_eft_trace()
3783 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_disable_eft_trace()
3803 if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw) && in qla2x00_enable_fce_trace()
3804 !IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw) && in qla2x00_enable_fce_trace()
3805 !IS_QLA28XX(vha->hw)) in qla2x00_enable_fce_trace()
3808 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_enable_fce_trace()
3811 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_enable_fce_trace()
3812 mcp->mb[1] = TC_FCE_ENABLE; in qla2x00_enable_fce_trace()
3813 mcp->mb[2] = LSW(fce_dma); in qla2x00_enable_fce_trace()
3814 mcp->mb[3] = MSW(fce_dma); in qla2x00_enable_fce_trace()
3815 mcp->mb[4] = LSW(MSD(fce_dma)); in qla2x00_enable_fce_trace()
3816 mcp->mb[5] = MSW(MSD(fce_dma)); in qla2x00_enable_fce_trace()
3817 mcp->mb[6] = buffers; in qla2x00_enable_fce_trace()
3818 mcp->mb[7] = TC_AEN_DISABLE; in qla2x00_enable_fce_trace()
3819 mcp->mb[8] = 0; in qla2x00_enable_fce_trace()
3820 mcp->mb[9] = TC_FCE_DEFAULT_RX_SIZE; in qla2x00_enable_fce_trace()
3821 mcp->mb[10] = TC_FCE_DEFAULT_TX_SIZE; in qla2x00_enable_fce_trace()
3822 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2| in qla2x00_enable_fce_trace()
3824 mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_enable_fce_trace()
3825 mcp->tov = MBX_TOV_SECONDS; in qla2x00_enable_fce_trace()
3826 mcp->flags = 0; in qla2x00_enable_fce_trace()
3831 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_enable_fce_trace()
3837 memcpy(mb, mcp->mb, 8 * sizeof(*mb)); in qla2x00_enable_fce_trace()
3855 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_disable_fce_trace()
3858 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_disable_fce_trace()
3861 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_disable_fce_trace()
3862 mcp->mb[1] = TC_FCE_DISABLE; in qla2x00_disable_fce_trace()
3863 mcp->mb[2] = TC_FCE_DISABLE_TRACE; in qla2x00_disable_fce_trace()
3864 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_disable_fce_trace()
3865 mcp->in_mb = MBX_9|MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2| in qla2x00_disable_fce_trace()
3867 mcp->tov = MBX_TOV_SECONDS; in qla2x00_disable_fce_trace()
3868 mcp->flags = 0; in qla2x00_disable_fce_trace()
3873 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_disable_fce_trace()
3879 *wr = (uint64_t) mcp->mb[5] << 48 | in qla2x00_disable_fce_trace()
3880 (uint64_t) mcp->mb[4] << 32 | in qla2x00_disable_fce_trace()
3881 (uint64_t) mcp->mb[3] << 16 | in qla2x00_disable_fce_trace()
3882 (uint64_t) mcp->mb[2]; in qla2x00_disable_fce_trace()
3884 *rd = (uint64_t) mcp->mb[9] << 48 | in qla2x00_disable_fce_trace()
3885 (uint64_t) mcp->mb[8] << 32 | in qla2x00_disable_fce_trace()
3886 (uint64_t) mcp->mb[7] << 16 | in qla2x00_disable_fce_trace()
3887 (uint64_t) mcp->mb[6]; in qla2x00_disable_fce_trace()
3904 if (!IS_IIDMA_CAPABLE(vha->hw)) in qla2x00_get_idma_speed()
3907 mcp->mb[0] = MBC_PORT_PARAMS; in qla2x00_get_idma_speed()
3908 mcp->mb[1] = loop_id; in qla2x00_get_idma_speed()
3909 mcp->mb[2] = mcp->mb[3] = 0; in qla2x00_get_idma_speed()
3910 mcp->mb[9] = vha->vp_idx; in qla2x00_get_idma_speed()
3911 mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_idma_speed()
3912 mcp->in_mb = MBX_3|MBX_1|MBX_0; in qla2x00_get_idma_speed()
3913 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_idma_speed()
3914 mcp->flags = 0; in qla2x00_get_idma_speed()
3919 mb[0] = mcp->mb[0]; in qla2x00_get_idma_speed()
3920 mb[1] = mcp->mb[1]; in qla2x00_get_idma_speed()
3921 mb[3] = mcp->mb[3]; in qla2x00_get_idma_speed()
3930 *port_speed = mcp->mb[3]; in qla2x00_get_idma_speed()
3947 if (!IS_IIDMA_CAPABLE(vha->hw)) in qla2x00_set_idma_speed()
3950 mcp->mb[0] = MBC_PORT_PARAMS; in qla2x00_set_idma_speed()
3951 mcp->mb[1] = loop_id; in qla2x00_set_idma_speed()
3952 mcp->mb[2] = BIT_0; in qla2x00_set_idma_speed()
3953 mcp->mb[3] = port_speed & 0x3F; in qla2x00_set_idma_speed()
3954 mcp->mb[9] = vha->vp_idx; in qla2x00_set_idma_speed()
3955 mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_set_idma_speed()
3956 mcp->in_mb = MBX_3|MBX_1|MBX_0; in qla2x00_set_idma_speed()
3957 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_idma_speed()
3958 mcp->flags = 0; in qla2x00_set_idma_speed()
3963 mb[0] = mcp->mb[0]; in qla2x00_set_idma_speed()
3964 mb[1] = mcp->mb[1]; in qla2x00_set_idma_speed()
3965 mb[3] = mcp->mb[3]; in qla2x00_set_idma_speed()
3983 struct qla_hw_data *ha = vha->hw; in qla24xx_report_id_acquisition()
3993 if (rptid_entry->entry_status != 0) in qla24xx_report_id_acquisition()
3996 id.b.domain = rptid_entry->port_id[2]; in qla24xx_report_id_acquisition()
3997 id.b.area = rptid_entry->port_id[1]; in qla24xx_report_id_acquisition()
3998 id.b.al_pa = rptid_entry->port_id[0]; in qla24xx_report_id_acquisition()
4000 ha->flags.n2n_ae = 0; in qla24xx_report_id_acquisition()
4002 if (rptid_entry->format == 0) { in qla24xx_report_id_acquisition()
4006 "VPs acquired %d.\n", rptid_entry->vp_setup, in qla24xx_report_id_acquisition()
4007 rptid_entry->vp_acquired); in qla24xx_report_id_acquisition()
4010 rptid_entry->port_id[2], rptid_entry->port_id[1], in qla24xx_report_id_acquisition()
4011 rptid_entry->port_id[0]); in qla24xx_report_id_acquisition()
4012 ha->current_topology = ISP_CFG_NL; in qla24xx_report_id_acquisition()
4015 } else if (rptid_entry->format == 1) { in qla24xx_report_id_acquisition()
4018 "Format 1: VP[%d] enabled - status %d - with " in qla24xx_report_id_acquisition()
4019 "port id %02x%02x%02x.\n", rptid_entry->vp_idx, in qla24xx_report_id_acquisition()
4020 rptid_entry->vp_status, in qla24xx_report_id_acquisition()
4021 rptid_entry->port_id[2], rptid_entry->port_id[1], in qla24xx_report_id_acquisition()
4022 rptid_entry->port_id[0]); in qla24xx_report_id_acquisition()
4025 rptid_entry->u.f1.port_name); in qla24xx_report_id_acquisition()
4029 vha->port_name); in qla24xx_report_id_acquisition()
4031 switch (rptid_entry->u.f1.flags & TOPO_MASK) { in qla24xx_report_id_acquisition()
4033 ha->current_topology = ISP_CFG_N; in qla24xx_report_id_acquisition()
4034 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_report_id_acquisition()
4035 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla24xx_report_id_acquisition()
4036 fcport->scan_state = QLA_FCPORT_SCAN; in qla24xx_report_id_acquisition()
4037 fcport->n2n_flag = 0; in qla24xx_report_id_acquisition()
4040 if (wwn_to_u64(vha->port_name) > in qla24xx_report_id_acquisition()
4041 wwn_to_u64(rptid_entry->u.f1.port_name)) { in qla24xx_report_id_acquisition()
4042 vha->d_id.b24 = 0; in qla24xx_report_id_acquisition()
4043 vha->d_id.b.al_pa = 1; in qla24xx_report_id_acquisition()
4044 ha->flags.n2n_bigger = 1; in qla24xx_report_id_acquisition()
4049 vha->d_id.b24, id.b24); in qla24xx_report_id_acquisition()
4052 "Format 1: Remote login - Waiting for WWPN %8phC.\n", in qla24xx_report_id_acquisition()
4053 rptid_entry->u.f1.port_name); in qla24xx_report_id_acquisition()
4054 ha->flags.n2n_bigger = 0; in qla24xx_report_id_acquisition()
4058 rptid_entry->u.f1.port_name, 1); in qla24xx_report_id_acquisition()
4059 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_report_id_acquisition()
4063 fcport->plogi_nack_done_deadline = jiffies + HZ; in qla24xx_report_id_acquisition()
4064 fcport->dm_login_expire = jiffies + in qla24xx_report_id_acquisition()
4066 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_report_id_acquisition()
4067 fcport->n2n_flag = 1; in qla24xx_report_id_acquisition()
4068 fcport->keep_nport_handle = 1; in qla24xx_report_id_acquisition()
4069 fcport->login_retry = vha->hw->login_retry_count; in qla24xx_report_id_acquisition()
4070 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_report_id_acquisition()
4071 if (vha->flags.nvme_enabled) in qla24xx_report_id_acquisition()
4072 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_report_id_acquisition()
4074 if (wwn_to_u64(vha->port_name) > in qla24xx_report_id_acquisition()
4075 wwn_to_u64(fcport->port_name)) { in qla24xx_report_id_acquisition()
4076 fcport->d_id = id; in qla24xx_report_id_acquisition()
4079 switch (fcport->disc_state) { in qla24xx_report_id_acquisition()
4082 &vha->dpc_flags); in qla24xx_report_id_acquisition()
4092 rptid_entry->u.f1.port_name, in qla24xx_report_id_acquisition()
4093 rptid_entry->u.f1.node_name, in qla24xx_report_id_acquisition()
4100 set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4103 ha->current_topology = ISP_CFG_FL; in qla24xx_report_id_acquisition()
4106 ha->current_topology = ISP_CFG_F; in qla24xx_report_id_acquisition()
4112 ha->flags.gpsc_supported = 1; in qla24xx_report_id_acquisition()
4113 ha->current_topology = ISP_CFG_F; in qla24xx_report_id_acquisition()
4115 vha->flags.bbcr_enable = (rptid_entry->u.f1.bbcr & 0xf) != 0; in qla24xx_report_id_acquisition()
4117 if (rptid_entry->vp_idx == 0) { in qla24xx_report_id_acquisition()
4118 if (rptid_entry->vp_status == VP_STAT_COMPL) { in qla24xx_report_id_acquisition()
4119 /* FA-WWN is only for physical port */ in qla24xx_report_id_acquisition()
4121 ha->flags.fawwpn_enabled && in qla24xx_report_id_acquisition()
4122 (rptid_entry->u.f1.flags & in qla24xx_report_id_acquisition()
4124 memcpy(vha->port_name, in qla24xx_report_id_acquisition()
4125 rptid_entry->u.f1.port_name, in qla24xx_report_id_acquisition()
4132 set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4133 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4135 if (rptid_entry->vp_status != VP_STAT_COMPL && in qla24xx_report_id_acquisition()
4136 rptid_entry->vp_status != VP_STAT_ID_CHG) { in qla24xx_report_id_acquisition()
4139 rptid_entry->vp_idx); in qla24xx_report_id_acquisition()
4144 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4145 list_for_each_entry(vp, &ha->vp_list, list) { in qla24xx_report_id_acquisition()
4146 if (rptid_entry->vp_idx == vp->vp_idx) { in qla24xx_report_id_acquisition()
4151 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4162 set_bit(VP_IDX_ACQUIRED, &vp->vp_flags); in qla24xx_report_id_acquisition()
4163 set_bit(REGISTER_FC4_NEEDED, &vp->dpc_flags); in qla24xx_report_id_acquisition()
4164 set_bit(REGISTER_FDMI_NEEDED, &vp->dpc_flags); in qla24xx_report_id_acquisition()
4166 set_bit(VP_DPC_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4168 } else if (rptid_entry->format == 2) { in qla24xx_report_id_acquisition()
4171 rptid_entry->port_id[2], rptid_entry->port_id[1], in qla24xx_report_id_acquisition()
4172 rptid_entry->port_id[0]); in qla24xx_report_id_acquisition()
4176 rptid_entry->u.f2.port_name); in qla24xx_report_id_acquisition()
4179 ha->current_topology = ISP_CFG_N; in qla24xx_report_id_acquisition()
4180 ha->flags.rida_fmt2 = 1; in qla24xx_report_id_acquisition()
4181 vha->d_id.b.domain = rptid_entry->port_id[2]; in qla24xx_report_id_acquisition()
4182 vha->d_id.b.area = rptid_entry->port_id[1]; in qla24xx_report_id_acquisition()
4183 vha->d_id.b.al_pa = rptid_entry->port_id[0]; in qla24xx_report_id_acquisition()
4185 ha->flags.n2n_ae = 1; in qla24xx_report_id_acquisition()
4186 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4188 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4190 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla24xx_report_id_acquisition()
4191 fcport->scan_state = QLA_FCPORT_SCAN; in qla24xx_report_id_acquisition()
4192 fcport->n2n_flag = 0; in qla24xx_report_id_acquisition()
4196 rptid_entry->u.f2.port_name, 1); in qla24xx_report_id_acquisition()
4199 fcport->login_retry = vha->hw->login_retry_count; in qla24xx_report_id_acquisition()
4200 fcport->plogi_nack_done_deadline = jiffies + HZ; in qla24xx_report_id_acquisition()
4201 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_report_id_acquisition()
4202 fcport->keep_nport_handle = 1; in qla24xx_report_id_acquisition()
4203 fcport->n2n_flag = 1; in qla24xx_report_id_acquisition()
4204 fcport->d_id.b.domain = in qla24xx_report_id_acquisition()
4205 rptid_entry->u.f2.remote_nport_id[2]; in qla24xx_report_id_acquisition()
4206 fcport->d_id.b.area = in qla24xx_report_id_acquisition()
4207 rptid_entry->u.f2.remote_nport_id[1]; in qla24xx_report_id_acquisition()
4208 fcport->d_id.b.al_pa = in qla24xx_report_id_acquisition()
4209 rptid_entry->u.f2.remote_nport_id[0]; in qla24xx_report_id_acquisition()
4218 if (atomic_read(&fcport->state) == FCS_ONLINE) in qla24xx_report_id_acquisition()
4243 struct qla_hw_data *ha = vha->hw; in qla24xx_modify_vp_config()
4244 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla24xx_modify_vp_config()
4251 vpmod = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &vpmod_dma); in qla24xx_modify_vp_config()
4258 vpmod->entry_type = VP_CONFIG_IOCB_TYPE; in qla24xx_modify_vp_config()
4259 vpmod->entry_count = 1; in qla24xx_modify_vp_config()
4260 vpmod->command = VCT_COMMAND_MOD_ENABLE_VPS; in qla24xx_modify_vp_config()
4261 vpmod->vp_count = 1; in qla24xx_modify_vp_config()
4262 vpmod->vp_index1 = vha->vp_idx; in qla24xx_modify_vp_config()
4263 vpmod->options_idx1 = BIT_3|BIT_4|BIT_5; in qla24xx_modify_vp_config()
4267 memcpy(vpmod->node_name_idx1, vha->node_name, WWN_SIZE); in qla24xx_modify_vp_config()
4268 memcpy(vpmod->port_name_idx1, vha->port_name, WWN_SIZE); in qla24xx_modify_vp_config()
4269 vpmod->entry_count = 1; in qla24xx_modify_vp_config()
4275 } else if (vpmod->comp_status != 0) { in qla24xx_modify_vp_config()
4277 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_modify_vp_config()
4278 vpmod->comp_status); in qla24xx_modify_vp_config()
4280 } else if (vpmod->comp_status != cpu_to_le16(CS_COMPLETE)) { in qla24xx_modify_vp_config()
4282 "Failed to complete IOCB -- completion status (%x).\n", in qla24xx_modify_vp_config()
4283 le16_to_cpu(vpmod->comp_status)); in qla24xx_modify_vp_config()
4289 fc_vport_set_state(vha->fc_vport, FC_VPORT_INITIALIZING); in qla24xx_modify_vp_config()
4291 dma_pool_free(ha->s_dma_pool, vpmod, vpmod_dma); in qla24xx_modify_vp_config()
4298 * Receive or disable RSCN request from fabric controller
4303 * 0 - Reserved
4304 * 1 - Fabric detected registration
4305 * 2 - N_port detected registration
4306 * 3 - Full registration
4307 * FF - clear registration
4328 mcp->mb[0] = MBC_SEND_CHANGE_REQUEST; in qla2x00_send_change_request()
4329 mcp->mb[1] = format; in qla2x00_send_change_request()
4330 mcp->mb[9] = vp_idx; in qla2x00_send_change_request()
4331 mcp->out_mb = MBX_9|MBX_1|MBX_0; in qla2x00_send_change_request()
4332 mcp->in_mb = MBX_0|MBX_1; in qla2x00_send_change_request()
4333 mcp->tov = MBX_TOV_SECONDS; in qla2x00_send_change_request()
4334 mcp->flags = 0; in qla2x00_send_change_request()
4338 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { in qla2x00_send_change_request()
4358 if (MSW(addr) || IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_dump_ram()
4359 mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; in qla2x00_dump_ram()
4360 mcp->mb[8] = MSW(addr); in qla2x00_dump_ram()
4361 mcp->mb[10] = 0; in qla2x00_dump_ram()
4362 mcp->out_mb = MBX_10|MBX_8|MBX_0; in qla2x00_dump_ram()
4364 mcp->mb[0] = MBC_DUMP_RISC_RAM; in qla2x00_dump_ram()
4365 mcp->out_mb = MBX_0; in qla2x00_dump_ram()
4367 mcp->mb[1] = LSW(addr); in qla2x00_dump_ram()
4368 mcp->mb[2] = MSW(req_dma); in qla2x00_dump_ram()
4369 mcp->mb[3] = LSW(req_dma); in qla2x00_dump_ram()
4370 mcp->mb[6] = MSW(MSD(req_dma)); in qla2x00_dump_ram()
4371 mcp->mb[7] = LSW(MSD(req_dma)); in qla2x00_dump_ram()
4372 mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1; in qla2x00_dump_ram()
4373 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_dump_ram()
4374 mcp->mb[4] = MSW(size); in qla2x00_dump_ram()
4375 mcp->mb[5] = LSW(size); in qla2x00_dump_ram()
4376 mcp->out_mb |= MBX_5|MBX_4; in qla2x00_dump_ram()
4378 mcp->mb[4] = LSW(size); in qla2x00_dump_ram()
4379 mcp->out_mb |= MBX_4; in qla2x00_dump_ram()
4382 mcp->in_mb = MBX_0; in qla2x00_dump_ram()
4383 mcp->tov = MBX_TOV_SECONDS; in qla2x00_dump_ram()
4384 mcp->flags = 0; in qla2x00_dump_ram()
4389 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_dump_ram()
4414 struct qla_hw_data *ha = vha->hw; in qla84xx_verify_chip()
4419 mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); in qla84xx_verify_chip()
4425 options = ha->cs84xx->fw_update ? VCO_FORCE_UPDATE : 0; in qla84xx_verify_chip()
4434 mn->p.req.entry_type = VERIFY_CHIP_IOCB_TYPE; in qla84xx_verify_chip()
4435 mn->p.req.entry_count = 1; in qla84xx_verify_chip()
4436 mn->p.req.options = cpu_to_le16(options); in qla84xx_verify_chip()
4455 status[0] = le16_to_cpu(mn->p.rsp.comp_status); in qla84xx_verify_chip()
4457 le16_to_cpu(mn->p.rsp.failure_code) : 0; in qla84xx_verify_chip()
4474 le32_to_cpu(mn->p.rsp.fw_ver)); in qla84xx_verify_chip()
4477 spin_lock_irqsave(&ha->cs84xx->access_lock, flags); in qla84xx_verify_chip()
4478 ha->cs84xx->op_fw_version = in qla84xx_verify_chip()
4479 le32_to_cpu(mn->p.rsp.fw_ver); in qla84xx_verify_chip()
4480 spin_unlock_irqrestore(&ha->cs84xx->access_lock, in qla84xx_verify_chip()
4486 dma_pool_free(ha->s_dma_pool, mn, mn_dma); in qla84xx_verify_chip()
4506 struct qla_hw_data *ha = vha->hw; in qla25xx_init_req_que()
4508 if (!ha->flags.fw_started) in qla25xx_init_req_que()
4515 req->options |= BIT_13; in qla25xx_init_req_que()
4517 mcp->mb[0] = MBC_INITIALIZE_MULTIQ; in qla25xx_init_req_que()
4518 mcp->mb[1] = req->options; in qla25xx_init_req_que()
4519 mcp->mb[2] = MSW(LSD(req->dma)); in qla25xx_init_req_que()
4520 mcp->mb[3] = LSW(LSD(req->dma)); in qla25xx_init_req_que()
4521 mcp->mb[6] = MSW(MSD(req->dma)); in qla25xx_init_req_que()
4522 mcp->mb[7] = LSW(MSD(req->dma)); in qla25xx_init_req_que()
4523 mcp->mb[5] = req->length; in qla25xx_init_req_que()
4524 if (req->rsp) in qla25xx_init_req_que()
4525 mcp->mb[10] = req->rsp->id; in qla25xx_init_req_que()
4526 mcp->mb[12] = req->qos; in qla25xx_init_req_que()
4527 mcp->mb[11] = req->vp_idx; in qla25xx_init_req_que()
4528 mcp->mb[13] = req->rid; in qla25xx_init_req_que()
4530 mcp->mb[15] = 0; in qla25xx_init_req_que()
4532 mcp->mb[4] = req->id; in qla25xx_init_req_que()
4534 mcp->mb[8] = 0; in qla25xx_init_req_que()
4536 mcp->mb[9] = *req->out_ptr = 0; in qla25xx_init_req_que()
4537 mcp->out_mb = MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8|MBX_7| in qla25xx_init_req_que()
4539 mcp->in_mb = MBX_0; in qla25xx_init_req_que()
4540 mcp->flags = MBX_DMA_OUT; in qla25xx_init_req_que()
4541 mcp->tov = MBX_TOV_SECONDS * 2; in qla25xx_init_req_que()
4545 mcp->in_mb |= MBX_1; in qla25xx_init_req_que()
4547 mcp->out_mb |= MBX_15; in qla25xx_init_req_que()
4548 /* debug q create issue in SR-IOV */ in qla25xx_init_req_que()
4549 mcp->in_mb |= MBX_9 | MBX_8 | MBX_7; in qla25xx_init_req_que()
4552 spin_lock_irqsave(&ha->hardware_lock, flags); in qla25xx_init_req_que()
4553 if (!(req->options & BIT_0)) { in qla25xx_init_req_que()
4554 wrt_reg_dword(req->req_q_in, 0); in qla25xx_init_req_que()
4556 wrt_reg_dword(req->req_q_out, 0); in qla25xx_init_req_que()
4558 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla25xx_init_req_que()
4563 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla25xx_init_req_que()
4579 struct qla_hw_data *ha = vha->hw; in qla25xx_init_rsp_que()
4581 if (!ha->flags.fw_started) in qla25xx_init_rsp_que()
4588 rsp->options |= BIT_13; in qla25xx_init_rsp_que()
4590 mcp->mb[0] = MBC_INITIALIZE_MULTIQ; in qla25xx_init_rsp_que()
4591 mcp->mb[1] = rsp->options; in qla25xx_init_rsp_que()
4592 mcp->mb[2] = MSW(LSD(rsp->dma)); in qla25xx_init_rsp_que()
4593 mcp->mb[3] = LSW(LSD(rsp->dma)); in qla25xx_init_rsp_que()
4594 mcp->mb[6] = MSW(MSD(rsp->dma)); in qla25xx_init_rsp_que()
4595 mcp->mb[7] = LSW(MSD(rsp->dma)); in qla25xx_init_rsp_que()
4596 mcp->mb[5] = rsp->length; in qla25xx_init_rsp_que()
4597 mcp->mb[14] = rsp->msix->entry; in qla25xx_init_rsp_que()
4598 mcp->mb[13] = rsp->rid; in qla25xx_init_rsp_que()
4600 mcp->mb[15] = 0; in qla25xx_init_rsp_que()
4602 mcp->mb[4] = rsp->id; in qla25xx_init_rsp_que()
4604 mcp->mb[8] = *rsp->in_ptr = 0; in qla25xx_init_rsp_que()
4606 mcp->mb[9] = 0; in qla25xx_init_rsp_que()
4607 mcp->out_mb = MBX_14|MBX_13|MBX_9|MBX_8|MBX_7 in qla25xx_init_rsp_que()
4609 mcp->in_mb = MBX_0; in qla25xx_init_rsp_que()
4610 mcp->flags = MBX_DMA_OUT; in qla25xx_init_rsp_que()
4611 mcp->tov = MBX_TOV_SECONDS * 2; in qla25xx_init_rsp_que()
4614 mcp->out_mb |= MBX_12|MBX_11|MBX_10; in qla25xx_init_rsp_que()
4615 mcp->in_mb |= MBX_1; in qla25xx_init_rsp_que()
4617 mcp->out_mb |= MBX_15|MBX_12|MBX_11|MBX_10; in qla25xx_init_rsp_que()
4618 mcp->in_mb |= MBX_1; in qla25xx_init_rsp_que()
4619 /* debug q create issue in SR-IOV */ in qla25xx_init_rsp_que()
4620 mcp->in_mb |= MBX_9 | MBX_8 | MBX_7; in qla25xx_init_rsp_que()
4623 spin_lock_irqsave(&ha->hardware_lock, flags); in qla25xx_init_rsp_que()
4624 if (!(rsp->options & BIT_0)) { in qla25xx_init_rsp_que()
4625 wrt_reg_dword(rsp->rsp_q_out, 0); in qla25xx_init_rsp_que()
4627 wrt_reg_dword(rsp->rsp_q_in, 0); in qla25xx_init_rsp_que()
4630 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla25xx_init_rsp_que()
4635 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla25xx_init_rsp_que()
4654 mcp->mb[0] = MBC_IDC_ACK; in qla81xx_idc_ack()
4655 memcpy(&mcp->mb[1], mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla81xx_idc_ack()
4656 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_idc_ack()
4657 mcp->in_mb = MBX_0; in qla81xx_idc_ack()
4658 mcp->tov = MBX_TOV_SECONDS; in qla81xx_idc_ack()
4659 mcp->flags = 0; in qla81xx_idc_ack()
4664 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_idc_ack()
4683 if (!IS_QLA81XX(vha->hw) && !IS_QLA83XX(vha->hw) && in qla81xx_fac_get_sector_size()
4684 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla81xx_fac_get_sector_size()
4687 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_get_sector_size()
4688 mcp->mb[1] = FAC_OPT_CMD_GET_SECTOR_SIZE; in qla81xx_fac_get_sector_size()
4689 mcp->out_mb = MBX_1|MBX_0; in qla81xx_fac_get_sector_size()
4690 mcp->in_mb = MBX_1|MBX_0; in qla81xx_fac_get_sector_size()
4691 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_get_sector_size()
4692 mcp->flags = 0; in qla81xx_fac_get_sector_size()
4698 rval, mcp->mb[0], mcp->mb[1]); in qla81xx_fac_get_sector_size()
4702 *sector_size = mcp->mb[1]; in qla81xx_fac_get_sector_size()
4715 if (!IS_QLA81XX(vha->hw) && !IS_QLA83XX(vha->hw) && in qla81xx_fac_do_write_enable()
4716 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla81xx_fac_do_write_enable()
4722 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_do_write_enable()
4723 mcp->mb[1] = enable ? FAC_OPT_CMD_WRITE_ENABLE : in qla81xx_fac_do_write_enable()
4725 mcp->out_mb = MBX_1|MBX_0; in qla81xx_fac_do_write_enable()
4726 mcp->in_mb = MBX_1|MBX_0; in qla81xx_fac_do_write_enable()
4727 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_do_write_enable()
4728 mcp->flags = 0; in qla81xx_fac_do_write_enable()
4734 rval, mcp->mb[0], mcp->mb[1]); in qla81xx_fac_do_write_enable()
4750 if (!IS_QLA81XX(vha->hw) && !IS_QLA83XX(vha->hw) && in qla81xx_fac_erase_sector()
4751 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla81xx_fac_erase_sector()
4757 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_erase_sector()
4758 mcp->mb[1] = FAC_OPT_CMD_ERASE_SECTOR; in qla81xx_fac_erase_sector()
4759 mcp->mb[2] = LSW(start); in qla81xx_fac_erase_sector()
4760 mcp->mb[3] = MSW(start); in qla81xx_fac_erase_sector()
4761 mcp->mb[4] = LSW(finish); in qla81xx_fac_erase_sector()
4762 mcp->mb[5] = MSW(finish); in qla81xx_fac_erase_sector()
4763 mcp->out_mb = MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_fac_erase_sector()
4764 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla81xx_fac_erase_sector()
4765 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_erase_sector()
4766 mcp->flags = 0; in qla81xx_fac_erase_sector()
4772 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla81xx_fac_erase_sector()
4787 struct qla_hw_data *ha = vha->hw; in qla81xx_fac_semaphore_access()
4796 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_semaphore_access()
4797 mcp->mb[1] = (lock ? FAC_OPT_CMD_LOCK_SEMAPHORE : in qla81xx_fac_semaphore_access()
4799 mcp->out_mb = MBX_1|MBX_0; in qla81xx_fac_semaphore_access()
4800 mcp->in_mb = MBX_1|MBX_0; in qla81xx_fac_semaphore_access()
4801 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_semaphore_access()
4802 mcp->flags = 0; in qla81xx_fac_semaphore_access()
4808 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla81xx_fac_semaphore_access()
4827 mcp->mb[0] = MBC_RESTART_MPI_FW; in qla81xx_restart_mpi_firmware()
4828 mcp->out_mb = MBX_0; in qla81xx_restart_mpi_firmware()
4829 mcp->in_mb = MBX_0|MBX_1; in qla81xx_restart_mpi_firmware()
4830 mcp->tov = MBX_TOV_SECONDS; in qla81xx_restart_mpi_firmware()
4831 mcp->flags = 0; in qla81xx_restart_mpi_firmware()
4837 rval, mcp->mb[0], mcp->mb[1]); in qla81xx_restart_mpi_firmware()
4855 struct qla_hw_data *ha = vha->hw; in qla82xx_set_driver_version()
4866 mcp->mb[0] = MBC_SET_RNID_PARAMS; in qla82xx_set_driver_version()
4867 mcp->mb[1] = RNID_TYPE_SET_VERSION << 8; in qla82xx_set_driver_version()
4868 mcp->out_mb = MBX_1|MBX_0; in qla82xx_set_driver_version()
4869 for (i = 4; i < 16 && len; i++, str++, len -= 2) { in qla82xx_set_driver_version()
4870 mcp->mb[i] = le16_to_cpup(str); in qla82xx_set_driver_version()
4871 mcp->out_mb |= 1<<i; in qla82xx_set_driver_version()
4874 mcp->mb[i] = 0; in qla82xx_set_driver_version()
4875 mcp->out_mb |= 1<<i; in qla82xx_set_driver_version()
4877 mcp->in_mb = MBX_1|MBX_0; in qla82xx_set_driver_version()
4878 mcp->tov = MBX_TOV_SECONDS; in qla82xx_set_driver_version()
4879 mcp->flags = 0; in qla82xx_set_driver_version()
4884 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla82xx_set_driver_version()
4903 struct qla_hw_data *ha = vha->hw; in qla25xx_set_driver_version()
4912 str = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &str_dma); in qla25xx_set_driver_version()
4921 len = dwlen * 4 - 4; in qla25xx_set_driver_version()
4927 mcp->mb[0] = MBC_SET_RNID_PARAMS; in qla25xx_set_driver_version()
4928 mcp->mb[1] = RNID_TYPE_SET_VERSION << 8 | dwlen; in qla25xx_set_driver_version()
4929 mcp->mb[2] = MSW(LSD(str_dma)); in qla25xx_set_driver_version()
4930 mcp->mb[3] = LSW(LSD(str_dma)); in qla25xx_set_driver_version()
4931 mcp->mb[6] = MSW(MSD(str_dma)); in qla25xx_set_driver_version()
4932 mcp->mb[7] = LSW(MSD(str_dma)); in qla25xx_set_driver_version()
4933 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla25xx_set_driver_version()
4934 mcp->in_mb = MBX_1|MBX_0; in qla25xx_set_driver_version()
4935 mcp->tov = MBX_TOV_SECONDS; in qla25xx_set_driver_version()
4936 mcp->flags = 0; in qla25xx_set_driver_version()
4941 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla25xx_set_driver_version()
4947 dma_pool_free(ha->s_dma_pool, str, str_dma); in qla25xx_set_driver_version()
4961 if (!IS_FWI2_CAPABLE(vha->hw)) in qla24xx_get_port_login_templ()
4967 mcp->mb[0] = MBC_GET_RNID_PARAMS; in qla24xx_get_port_login_templ()
4968 mcp->mb[1] = RNID_TYPE_PORT_LOGIN << 8; in qla24xx_get_port_login_templ()
4969 mcp->mb[2] = MSW(buf_dma); in qla24xx_get_port_login_templ()
4970 mcp->mb[3] = LSW(buf_dma); in qla24xx_get_port_login_templ()
4971 mcp->mb[6] = MSW(MSD(buf_dma)); in qla24xx_get_port_login_templ()
4972 mcp->mb[7] = LSW(MSD(buf_dma)); in qla24xx_get_port_login_templ()
4973 mcp->mb[8] = bufsiz/4; in qla24xx_get_port_login_templ()
4974 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_get_port_login_templ()
4975 mcp->in_mb = MBX_1|MBX_0; in qla24xx_get_port_login_templ()
4976 mcp->tov = MBX_TOV_SECONDS; in qla24xx_get_port_login_templ()
4977 mcp->flags = 0; in qla24xx_get_port_login_templ()
4982 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla24xx_get_port_login_templ()
4987 for (i = 0; i < (bufsiz-4)/4; i++, bp++) in qla24xx_get_port_login_templ()
5006 struct qla_hw_data *ha = vha->hw; in qla25xx_set_els_cmds_supported()
5015 els_cmd_map = dma_alloc_coherent(&ha->pdev->dev, ELS_CMD_MAP_SIZE, in qla25xx_set_els_cmds_supported()
5028 if (ha->flags.scm_supported_f) { in qla25xx_set_els_cmds_supported()
5032 if (ha->flags.edif_enabled) { in qla25xx_set_els_cmds_supported()
5043 mcp->mb[0] = MBC_SET_RNID_PARAMS; in qla25xx_set_els_cmds_supported()
5044 mcp->mb[1] = RNID_TYPE_ELS_CMD << 8; in qla25xx_set_els_cmds_supported()
5045 mcp->mb[2] = MSW(LSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5046 mcp->mb[3] = LSW(LSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5047 mcp->mb[6] = MSW(MSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5048 mcp->mb[7] = LSW(MSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5049 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla25xx_set_els_cmds_supported()
5050 mcp->in_mb = MBX_1|MBX_0; in qla25xx_set_els_cmds_supported()
5051 mcp->tov = MBX_TOV_SECONDS; in qla25xx_set_els_cmds_supported()
5052 mcp->flags = MBX_DMA_OUT; in qla25xx_set_els_cmds_supported()
5053 mcp->buf_size = ELS_CMD_MAP_SIZE; in qla25xx_set_els_cmds_supported()
5058 "Failed=%x (%x,%x).\n", rval, mcp->mb[0], mcp->mb[1]); in qla25xx_set_els_cmds_supported()
5064 dma_free_coherent(&ha->pdev->dev, ELS_CMD_MAP_SIZE, in qla25xx_set_els_cmds_supported()
5077 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_read_asic_temperature()
5083 mcp->mb[0] = MBC_GET_RNID_PARAMS; in qla2x00_read_asic_temperature()
5084 mcp->mb[1] = RNID_TYPE_ASIC_TEMP << 8; in qla2x00_read_asic_temperature()
5085 mcp->out_mb = MBX_1|MBX_0; in qla2x00_read_asic_temperature()
5086 mcp->in_mb = MBX_1|MBX_0; in qla2x00_read_asic_temperature()
5087 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_asic_temperature()
5088 mcp->flags = 0; in qla2x00_read_asic_temperature()
5090 *temp = mcp->mb[1]; in qla2x00_read_asic_temperature()
5094 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla2x00_read_asic_temperature()
5110 struct qla_hw_data *ha = vha->hw; in qla2x00_read_sfp()
5121 mcp->mb[0] = MBC_READ_SFP; in qla2x00_read_sfp()
5122 mcp->mb[1] = dev; in qla2x00_read_sfp()
5123 mcp->mb[2] = MSW(LSD(sfp_dma)); in qla2x00_read_sfp()
5124 mcp->mb[3] = LSW(LSD(sfp_dma)); in qla2x00_read_sfp()
5125 mcp->mb[6] = MSW(MSD(sfp_dma)); in qla2x00_read_sfp()
5126 mcp->mb[7] = LSW(MSD(sfp_dma)); in qla2x00_read_sfp()
5127 mcp->mb[8] = len; in qla2x00_read_sfp()
5128 mcp->mb[9] = off; in qla2x00_read_sfp()
5129 mcp->mb[10] = opt; in qla2x00_read_sfp()
5130 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_read_sfp()
5131 mcp->in_mb = MBX_1|MBX_0; in qla2x00_read_sfp()
5132 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_sfp()
5133 mcp->flags = 0; in qla2x00_read_sfp()
5137 *sfp = mcp->mb[1]; in qla2x00_read_sfp()
5141 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_read_sfp()
5142 if (mcp->mb[0] == MBS_COMMAND_ERROR && mcp->mb[1] == 0x22) { in qla2x00_read_sfp()
5161 struct qla_hw_data *ha = vha->hw; in qla2x00_write_sfp()
5175 mcp->mb[0] = MBC_WRITE_SFP; in qla2x00_write_sfp()
5176 mcp->mb[1] = dev; in qla2x00_write_sfp()
5177 mcp->mb[2] = MSW(LSD(sfp_dma)); in qla2x00_write_sfp()
5178 mcp->mb[3] = LSW(LSD(sfp_dma)); in qla2x00_write_sfp()
5179 mcp->mb[6] = MSW(MSD(sfp_dma)); in qla2x00_write_sfp()
5180 mcp->mb[7] = LSW(MSD(sfp_dma)); in qla2x00_write_sfp()
5181 mcp->mb[8] = len; in qla2x00_write_sfp()
5182 mcp->mb[9] = off; in qla2x00_write_sfp()
5183 mcp->mb[10] = opt; in qla2x00_write_sfp()
5184 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_write_sfp()
5185 mcp->in_mb = MBX_1|MBX_0; in qla2x00_write_sfp()
5186 mcp->tov = MBX_TOV_SECONDS; in qla2x00_write_sfp()
5187 mcp->flags = 0; in qla2x00_write_sfp()
5192 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_write_sfp()
5212 if (!IS_CNA_CAPABLE(vha->hw)) in qla2x00_get_xgmac_stats()
5215 mcp->mb[0] = MBC_GET_XGMAC_STATS; in qla2x00_get_xgmac_stats()
5216 mcp->mb[2] = MSW(stats_dma); in qla2x00_get_xgmac_stats()
5217 mcp->mb[3] = LSW(stats_dma); in qla2x00_get_xgmac_stats()
5218 mcp->mb[6] = MSW(MSD(stats_dma)); in qla2x00_get_xgmac_stats()
5219 mcp->mb[7] = LSW(MSD(stats_dma)); in qla2x00_get_xgmac_stats()
5220 mcp->mb[8] = size_in_bytes >> 2; in qla2x00_get_xgmac_stats()
5221 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_xgmac_stats()
5222 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_get_xgmac_stats()
5223 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_xgmac_stats()
5224 mcp->flags = 0; in qla2x00_get_xgmac_stats()
5230 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla2x00_get_xgmac_stats()
5236 *actual_size = mcp->mb[2] << 2; in qla2x00_get_xgmac_stats()
5253 if (!IS_CNA_CAPABLE(vha->hw)) in qla2x00_get_dcbx_params()
5256 mcp->mb[0] = MBC_GET_DCBX_PARAMS; in qla2x00_get_dcbx_params()
5257 mcp->mb[1] = 0; in qla2x00_get_dcbx_params()
5258 mcp->mb[2] = MSW(tlv_dma); in qla2x00_get_dcbx_params()
5259 mcp->mb[3] = LSW(tlv_dma); in qla2x00_get_dcbx_params()
5260 mcp->mb[6] = MSW(MSD(tlv_dma)); in qla2x00_get_dcbx_params()
5261 mcp->mb[7] = LSW(MSD(tlv_dma)); in qla2x00_get_dcbx_params()
5262 mcp->mb[8] = size; in qla2x00_get_dcbx_params()
5263 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_dcbx_params()
5264 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_get_dcbx_params()
5265 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_dcbx_params()
5266 mcp->flags = 0; in qla2x00_get_dcbx_params()
5272 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla2x00_get_dcbx_params()
5291 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_read_ram_word()
5294 mcp->mb[0] = MBC_READ_RAM_EXTENDED; in qla2x00_read_ram_word()
5295 mcp->mb[1] = LSW(risc_addr); in qla2x00_read_ram_word()
5296 mcp->mb[8] = MSW(risc_addr); in qla2x00_read_ram_word()
5297 mcp->out_mb = MBX_8|MBX_1|MBX_0; in qla2x00_read_ram_word()
5298 mcp->in_mb = MBX_3|MBX_2|MBX_0; in qla2x00_read_ram_word()
5299 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_ram_word()
5300 mcp->flags = 0; in qla2x00_read_ram_word()
5304 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_read_ram_word()
5308 *data = mcp->mb[3] << 16 | mcp->mb[2]; in qla2x00_read_ram_word()
5325 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla2x00_loopback_test()
5326 mcp->mb[0] = MBC_DIAGNOSTIC_LOOP_BACK; in qla2x00_loopback_test()
5327 mcp->mb[1] = mreq->options | BIT_6; // BIT_6 specifies 64 bit addressing in qla2x00_loopback_test()
5330 mcp->mb[10] = LSW(mreq->transfer_size); in qla2x00_loopback_test()
5331 mcp->mb[11] = MSW(mreq->transfer_size); in qla2x00_loopback_test()
5334 mcp->mb[14] = LSW(mreq->send_dma); in qla2x00_loopback_test()
5335 mcp->mb[15] = MSW(mreq->send_dma); in qla2x00_loopback_test()
5336 mcp->mb[20] = LSW(MSD(mreq->send_dma)); in qla2x00_loopback_test()
5337 mcp->mb[21] = MSW(MSD(mreq->send_dma)); in qla2x00_loopback_test()
5340 mcp->mb[16] = LSW(mreq->rcv_dma); in qla2x00_loopback_test()
5341 mcp->mb[17] = MSW(mreq->rcv_dma); in qla2x00_loopback_test()
5342 mcp->mb[6] = LSW(MSD(mreq->rcv_dma)); in qla2x00_loopback_test()
5343 mcp->mb[7] = MSW(MSD(mreq->rcv_dma)); in qla2x00_loopback_test()
5346 mcp->mb[18] = LSW(mreq->iteration_count); in qla2x00_loopback_test()
5347 mcp->mb[19] = MSW(mreq->iteration_count); in qla2x00_loopback_test()
5349 mcp->out_mb = MBX_21|MBX_20|MBX_19|MBX_18|MBX_17|MBX_16|MBX_15| in qla2x00_loopback_test()
5351 if (IS_CNA_CAPABLE(vha->hw)) in qla2x00_loopback_test()
5352 mcp->out_mb |= MBX_2; in qla2x00_loopback_test()
5353 mcp->in_mb = MBX_19|MBX_18|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_loopback_test()
5355 mcp->buf_size = mreq->transfer_size; in qla2x00_loopback_test()
5356 mcp->tov = MBX_TOV_SECONDS; in qla2x00_loopback_test()
5357 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla2x00_loopback_test()
5364 "mb[19]=%x.\n", rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], in qla2x00_loopback_test()
5365 mcp->mb[3], mcp->mb[18], mcp->mb[19]); in qla2x00_loopback_test()
5372 memcpy( mresp, mcp->mb, 64); in qla2x00_loopback_test()
5383 struct qla_hw_data *ha = vha->hw; in qla2x00_echo_test()
5388 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla2x00_echo_test()
5389 mcp->mb[0] = MBC_DIAGNOSTIC_ECHO; in qla2x00_echo_test()
5391 mcp->mb[1] = mreq->options | BIT_15 | BIT_6; in qla2x00_echo_test()
5393 mcp->mb[2] = vha->fcoe_fcf_idx; in qla2x00_echo_test()
5395 mcp->mb[16] = LSW(mreq->rcv_dma); in qla2x00_echo_test()
5396 mcp->mb[17] = MSW(mreq->rcv_dma); in qla2x00_echo_test()
5397 mcp->mb[6] = LSW(MSD(mreq->rcv_dma)); in qla2x00_echo_test()
5398 mcp->mb[7] = MSW(MSD(mreq->rcv_dma)); in qla2x00_echo_test()
5400 mcp->mb[10] = LSW(mreq->transfer_size); in qla2x00_echo_test()
5402 mcp->mb[14] = LSW(mreq->send_dma); in qla2x00_echo_test()
5403 mcp->mb[15] = MSW(mreq->send_dma); in qla2x00_echo_test()
5404 mcp->mb[20] = LSW(MSD(mreq->send_dma)); in qla2x00_echo_test()
5405 mcp->mb[21] = MSW(MSD(mreq->send_dma)); in qla2x00_echo_test()
5407 mcp->out_mb = MBX_21|MBX_20|MBX_17|MBX_16|MBX_15| in qla2x00_echo_test()
5410 mcp->out_mb |= MBX_2; in qla2x00_echo_test()
5412 mcp->in_mb = MBX_0; in qla2x00_echo_test()
5415 mcp->in_mb |= MBX_1; in qla2x00_echo_test()
5418 mcp->in_mb |= MBX_3; in qla2x00_echo_test()
5420 mcp->tov = MBX_TOV_SECONDS; in qla2x00_echo_test()
5421 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla2x00_echo_test()
5422 mcp->buf_size = mreq->transfer_size; in qla2x00_echo_test()
5429 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_echo_test()
5436 memcpy(mresp, mcp->mb, 64); in qla2x00_echo_test()
5450 mcp->mb[0] = MBC_ISP84XX_RESET; in qla84xx_reset_chip()
5451 mcp->mb[1] = enable_diagnostic; in qla84xx_reset_chip()
5452 mcp->out_mb = MBX_1|MBX_0; in qla84xx_reset_chip()
5453 mcp->in_mb = MBX_1|MBX_0; in qla84xx_reset_chip()
5454 mcp->tov = MBX_TOV_SECONDS; in qla84xx_reset_chip()
5455 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla84xx_reset_chip()
5477 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_write_ram_word()
5480 mcp->mb[0] = MBC_WRITE_RAM_WORD_EXTENDED; in qla2x00_write_ram_word()
5481 mcp->mb[1] = LSW(risc_addr); in qla2x00_write_ram_word()
5482 mcp->mb[2] = LSW(data); in qla2x00_write_ram_word()
5483 mcp->mb[3] = MSW(data); in qla2x00_write_ram_word()
5484 mcp->mb[8] = MSW(risc_addr); in qla2x00_write_ram_word()
5485 mcp->out_mb = MBX_8|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_write_ram_word()
5486 mcp->in_mb = MBX_1|MBX_0; in qla2x00_write_ram_word()
5487 mcp->tov = MBX_TOV_SECONDS; in qla2x00_write_ram_word()
5488 mcp->flags = 0; in qla2x00_write_ram_word()
5493 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_write_ram_word()
5508 struct qla_hw_data *ha = vha->hw; in qla81xx_write_mpi_register()
5509 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla81xx_write_mpi_register()
5516 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); in qla81xx_write_mpi_register()
5519 wrt_reg_word(®->mailbox0, MBC_WRITE_MPI_REGISTER); in qla81xx_write_mpi_register()
5520 wrt_reg_word(®->mailbox1, mb[0]); in qla81xx_write_mpi_register()
5521 wrt_reg_word(®->mailbox2, mb[1]); in qla81xx_write_mpi_register()
5522 wrt_reg_word(®->mailbox3, mb[2]); in qla81xx_write_mpi_register()
5523 wrt_reg_word(®->mailbox4, mb[3]); in qla81xx_write_mpi_register()
5525 wrt_reg_dword(®->hccr, HCCRX_SET_HOST_INT); in qla81xx_write_mpi_register()
5528 for (timer = 6000000; timer; timer--) { in qla81xx_write_mpi_register()
5530 stat = rd_reg_dword(®->host_status); in qla81xx_write_mpi_register()
5537 &ha->mbx_cmd_flags); in qla81xx_write_mpi_register()
5538 mb0 = rd_reg_word(®->mailbox0); in qla81xx_write_mpi_register()
5539 wrt_reg_dword(®->hccr, in qla81xx_write_mpi_register()
5541 rd_reg_dword(®->hccr); in qla81xx_write_mpi_register()
5548 if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) in qla81xx_write_mpi_register()
5571 struct qla_hw_data *ha = vha->hw; in qla2x00_set_data_rate()
5575 "Entered %s speed:0x%x mode:0x%x.\n", __func__, ha->set_data_rate, in qla2x00_set_data_rate()
5582 switch (ha->set_data_rate) { in qla2x00_set_data_rate()
5588 val = ha->set_data_rate; in qla2x00_set_data_rate()
5593 ha->set_data_rate); in qla2x00_set_data_rate()
5594 val = ha->set_data_rate = PORT_SPEED_AUTO; in qla2x00_set_data_rate()
5598 mcp->mb[0] = MBC_DATA_RATE; in qla2x00_set_data_rate()
5599 mcp->mb[1] = mode; in qla2x00_set_data_rate()
5600 mcp->mb[2] = val; in qla2x00_set_data_rate()
5602 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_set_data_rate()
5603 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_set_data_rate()
5605 mcp->in_mb |= MBX_4|MBX_3; in qla2x00_set_data_rate()
5606 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_data_rate()
5607 mcp->flags = 0; in qla2x00_set_data_rate()
5611 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_set_data_rate()
5613 if (mcp->mb[1] != 0x7) in qla2x00_set_data_rate()
5615 "Speed set:0x%x\n", mcp->mb[1]); in qla2x00_set_data_rate()
5630 struct qla_hw_data *ha = vha->hw; in qla2x00_get_data_rate()
5638 mcp->mb[0] = MBC_DATA_RATE; in qla2x00_get_data_rate()
5639 mcp->mb[1] = QLA_GET_DATA_RATE; in qla2x00_get_data_rate()
5640 mcp->out_mb = MBX_1|MBX_0; in qla2x00_get_data_rate()
5641 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_get_data_rate()
5643 mcp->in_mb |= MBX_4|MBX_3; in qla2x00_get_data_rate()
5644 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_data_rate()
5645 mcp->flags = 0; in qla2x00_get_data_rate()
5649 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_get_data_rate()
5651 if (mcp->mb[1] != 0x7) in qla2x00_get_data_rate()
5652 ha->link_data_rate = mcp->mb[1]; in qla2x00_get_data_rate()
5655 if (mcp->mb[4] & BIT_0) in qla2x00_get_data_rate()
5662 if (mcp->mb[1] != 0x7) in qla2x00_get_data_rate()
5663 ha->link_data_rate = mcp->mb[1]; in qla2x00_get_data_rate()
5675 struct qla_hw_data *ha = vha->hw; in qla81xx_get_port_config()
5683 mcp->mb[0] = MBC_GET_PORT_CONFIG; in qla81xx_get_port_config()
5684 mcp->out_mb = MBX_0; in qla81xx_get_port_config()
5685 mcp->in_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_get_port_config()
5686 mcp->tov = MBX_TOV_SECONDS; in qla81xx_get_port_config()
5687 mcp->flags = 0; in qla81xx_get_port_config()
5693 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_get_port_config()
5696 memcpy(mb, &mcp->mb[1], sizeof(uint16_t) * 4); in qla81xx_get_port_config()
5714 mcp->mb[0] = MBC_SET_PORT_CONFIG; in qla81xx_set_port_config()
5716 memcpy(&mcp->mb[1], mb, sizeof(uint16_t) * 4); in qla81xx_set_port_config()
5717 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_set_port_config()
5718 mcp->in_mb = MBX_0; in qla81xx_set_port_config()
5719 mcp->tov = MBX_TOV_SECONDS; in qla81xx_set_port_config()
5720 mcp->flags = 0; in qla81xx_set_port_config()
5725 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_set_port_config()
5741 struct qla_hw_data *ha = vha->hw; in qla24xx_set_fcp_prio()
5749 mcp->mb[0] = MBC_PORT_PARAMS; in qla24xx_set_fcp_prio()
5750 mcp->mb[1] = loop_id; in qla24xx_set_fcp_prio()
5751 if (ha->flags.fcp_prio_enabled) in qla24xx_set_fcp_prio()
5752 mcp->mb[2] = BIT_1; in qla24xx_set_fcp_prio()
5754 mcp->mb[2] = BIT_2; in qla24xx_set_fcp_prio()
5755 mcp->mb[4] = priority & 0xf; in qla24xx_set_fcp_prio()
5756 mcp->mb[9] = vha->vp_idx; in qla24xx_set_fcp_prio()
5757 mcp->out_mb = MBX_9|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_set_fcp_prio()
5758 mcp->in_mb = MBX_4|MBX_3|MBX_1|MBX_0; in qla24xx_set_fcp_prio()
5759 mcp->tov = MBX_TOV_SECONDS; in qla24xx_set_fcp_prio()
5760 mcp->flags = 0; in qla24xx_set_fcp_prio()
5763 mb[0] = mcp->mb[0]; in qla24xx_set_fcp_prio()
5764 mb[1] = mcp->mb[1]; in qla24xx_set_fcp_prio()
5765 mb[3] = mcp->mb[3]; in qla24xx_set_fcp_prio()
5766 mb[4] = mcp->mb[4]; in qla24xx_set_fcp_prio()
5783 struct qla_hw_data *ha = vha->hw; in qla2x00_get_thermal_temp()
5793 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && in qla2x00_get_thermal_temp()
5794 ha->pdev->subsystem_device == 0x0175) { in qla2x00_get_thermal_temp()
5800 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP && in qla2x00_get_thermal_temp()
5801 ha->pdev->subsystem_device == 0x338e) { in qla2x00_get_thermal_temp()
5830 struct qla_hw_data *ha = vha->hw; in qla82xx_mbx_intr_enable()
5841 mcp->mb[0] = MBC_TOGGLE_INTERRUPT; in qla82xx_mbx_intr_enable()
5842 mcp->mb[1] = 1; in qla82xx_mbx_intr_enable()
5844 mcp->out_mb = MBX_1|MBX_0; in qla82xx_mbx_intr_enable()
5845 mcp->in_mb = MBX_0; in qla82xx_mbx_intr_enable()
5846 mcp->tov = MBX_TOV_SECONDS; in qla82xx_mbx_intr_enable()
5847 mcp->flags = 0; in qla82xx_mbx_intr_enable()
5852 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla82xx_mbx_intr_enable()
5865 struct qla_hw_data *ha = vha->hw; in qla82xx_mbx_intr_disable()
5876 mcp->mb[0] = MBC_TOGGLE_INTERRUPT; in qla82xx_mbx_intr_disable()
5877 mcp->mb[1] = 0; in qla82xx_mbx_intr_disable()
5879 mcp->out_mb = MBX_1|MBX_0; in qla82xx_mbx_intr_disable()
5880 mcp->in_mb = MBX_0; in qla82xx_mbx_intr_disable()
5881 mcp->tov = MBX_TOV_SECONDS; in qla82xx_mbx_intr_disable()
5882 mcp->flags = 0; in qla82xx_mbx_intr_disable()
5887 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla82xx_mbx_intr_disable()
5899 struct qla_hw_data *ha = vha->hw; in qla82xx_md_get_template_size()
5907 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla82xx_md_get_template_size()
5908 mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template_size()
5909 mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template_size()
5910 mcp->mb[2] = LSW(RQST_TMPLT_SIZE); in qla82xx_md_get_template_size()
5911 mcp->mb[3] = MSW(RQST_TMPLT_SIZE); in qla82xx_md_get_template_size()
5913 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla82xx_md_get_template_size()
5914 mcp->in_mb = MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8| in qla82xx_md_get_template_size()
5917 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla82xx_md_get_template_size()
5918 mcp->tov = MBX_TOV_SECONDS; in qla82xx_md_get_template_size()
5925 (mcp->mb[1] << 16) | mcp->mb[0], in qla82xx_md_get_template_size()
5926 (mcp->mb[3] << 16) | mcp->mb[2]); in qla82xx_md_get_template_size()
5930 ha->md_template_size = ((mcp->mb[3] << 16) | mcp->mb[2]); in qla82xx_md_get_template_size()
5931 if (!ha->md_template_size) { in qla82xx_md_get_template_size()
5943 struct qla_hw_data *ha = vha->hw; in qla82xx_md_get_template()
5951 ha->md_tmplt_hdr = dma_alloc_coherent(&ha->pdev->dev, in qla82xx_md_get_template()
5952 ha->md_template_size, &ha->md_tmplt_hdr_dma, GFP_KERNEL); in qla82xx_md_get_template()
5953 if (!ha->md_tmplt_hdr) { in qla82xx_md_get_template()
5959 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla82xx_md_get_template()
5960 mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template()
5961 mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template()
5962 mcp->mb[2] = LSW(RQST_TMPLT); in qla82xx_md_get_template()
5963 mcp->mb[3] = MSW(RQST_TMPLT); in qla82xx_md_get_template()
5964 mcp->mb[4] = LSW(LSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5965 mcp->mb[5] = MSW(LSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5966 mcp->mb[6] = LSW(MSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5967 mcp->mb[7] = MSW(MSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5968 mcp->mb[8] = LSW(ha->md_template_size); in qla82xx_md_get_template()
5969 mcp->mb[9] = MSW(ha->md_template_size); in qla82xx_md_get_template()
5971 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla82xx_md_get_template()
5972 mcp->tov = MBX_TOV_SECONDS; in qla82xx_md_get_template()
5973 mcp->out_mb = MBX_11|MBX_10|MBX_9|MBX_8| in qla82xx_md_get_template()
5975 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla82xx_md_get_template()
5981 ((mcp->mb[1] << 16) | mcp->mb[0]), in qla82xx_md_get_template()
5982 ((mcp->mb[3] << 16) | mcp->mb[2])); in qla82xx_md_get_template()
5992 struct qla_hw_data *ha = vha->hw; in qla8044_md_get_template()
6001 ha->md_tmplt_hdr = dma_alloc_coherent(&ha->pdev->dev, in qla8044_md_get_template()
6002 ha->md_template_size, &ha->md_tmplt_hdr_dma, GFP_KERNEL); in qla8044_md_get_template()
6003 if (!ha->md_tmplt_hdr) { in qla8044_md_get_template()
6009 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla8044_md_get_template()
6010 while (offset < ha->md_template_size) { in qla8044_md_get_template()
6011 mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla8044_md_get_template()
6012 mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla8044_md_get_template()
6013 mcp->mb[2] = LSW(RQST_TMPLT); in qla8044_md_get_template()
6014 mcp->mb[3] = MSW(RQST_TMPLT); in qla8044_md_get_template()
6015 mcp->mb[4] = LSW(LSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6016 mcp->mb[5] = MSW(LSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6017 mcp->mb[6] = LSW(MSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6018 mcp->mb[7] = MSW(MSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6019 mcp->mb[8] = LSW(size); in qla8044_md_get_template()
6020 mcp->mb[9] = MSW(size); in qla8044_md_get_template()
6021 mcp->mb[10] = offset & 0x0000FFFF; in qla8044_md_get_template()
6022 mcp->mb[11] = offset & 0xFFFF0000; in qla8044_md_get_template()
6023 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla8044_md_get_template()
6024 mcp->tov = MBX_TOV_SECONDS; in qla8044_md_get_template()
6025 mcp->out_mb = MBX_11|MBX_10|MBX_9|MBX_8| in qla8044_md_get_template()
6027 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla8044_md_get_template()
6033 ((mcp->mb[1] << 16) | mcp->mb[0]), in qla8044_md_get_template()
6034 ((mcp->mb[3] << 16) | mcp->mb[2])); in qla8044_md_get_template()
6048 struct qla_hw_data *ha = vha->hw; in qla81xx_set_led_config()
6059 mcp->mb[0] = MBC_SET_LED_CONFIG; in qla81xx_set_led_config()
6060 mcp->mb[1] = led_cfg[0]; in qla81xx_set_led_config()
6061 mcp->mb[2] = led_cfg[1]; in qla81xx_set_led_config()
6063 mcp->mb[3] = led_cfg[2]; in qla81xx_set_led_config()
6064 mcp->mb[4] = led_cfg[3]; in qla81xx_set_led_config()
6065 mcp->mb[5] = led_cfg[4]; in qla81xx_set_led_config()
6066 mcp->mb[6] = led_cfg[5]; in qla81xx_set_led_config()
6069 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla81xx_set_led_config()
6071 mcp->out_mb |= MBX_6|MBX_5|MBX_4|MBX_3; in qla81xx_set_led_config()
6072 mcp->in_mb = MBX_0; in qla81xx_set_led_config()
6073 mcp->tov = MBX_TOV_SECONDS; in qla81xx_set_led_config()
6074 mcp->flags = 0; in qla81xx_set_led_config()
6079 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_set_led_config()
6092 struct qla_hw_data *ha = vha->hw; in qla81xx_get_led_config()
6103 mcp->mb[0] = MBC_GET_LED_CONFIG; in qla81xx_get_led_config()
6105 mcp->out_mb = MBX_0; in qla81xx_get_led_config()
6106 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla81xx_get_led_config()
6108 mcp->in_mb |= MBX_6|MBX_5|MBX_4|MBX_3; in qla81xx_get_led_config()
6109 mcp->tov = MBX_TOV_SECONDS; in qla81xx_get_led_config()
6110 mcp->flags = 0; in qla81xx_get_led_config()
6115 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_get_led_config()
6117 led_cfg[0] = mcp->mb[1]; in qla81xx_get_led_config()
6118 led_cfg[1] = mcp->mb[2]; in qla81xx_get_led_config()
6120 led_cfg[2] = mcp->mb[3]; in qla81xx_get_led_config()
6121 led_cfg[3] = mcp->mb[4]; in qla81xx_get_led_config()
6122 led_cfg[4] = mcp->mb[5]; in qla81xx_get_led_config()
6123 led_cfg[5] = mcp->mb[6]; in qla81xx_get_led_config()
6136 struct qla_hw_data *ha = vha->hw; in qla82xx_mbx_beacon_ctl()
6147 mcp->mb[0] = MBC_SET_LED_CONFIG; in qla82xx_mbx_beacon_ctl()
6149 mcp->mb[7] = 0xE; in qla82xx_mbx_beacon_ctl()
6151 mcp->mb[7] = 0xD; in qla82xx_mbx_beacon_ctl()
6153 mcp->out_mb = MBX_7|MBX_0; in qla82xx_mbx_beacon_ctl()
6154 mcp->in_mb = MBX_0; in qla82xx_mbx_beacon_ctl()
6155 mcp->tov = MBX_TOV_SECONDS; in qla82xx_mbx_beacon_ctl()
6156 mcp->flags = 0; in qla82xx_mbx_beacon_ctl()
6161 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla82xx_mbx_beacon_ctl()
6174 struct qla_hw_data *ha = vha->hw; in qla83xx_wr_reg()
6184 mcp->mb[0] = MBC_WRITE_REMOTE_REG; in qla83xx_wr_reg()
6185 mcp->mb[1] = LSW(reg); in qla83xx_wr_reg()
6186 mcp->mb[2] = MSW(reg); in qla83xx_wr_reg()
6187 mcp->mb[3] = LSW(data); in qla83xx_wr_reg()
6188 mcp->mb[4] = MSW(data); in qla83xx_wr_reg()
6189 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla83xx_wr_reg()
6191 mcp->in_mb = MBX_1|MBX_0; in qla83xx_wr_reg()
6192 mcp->tov = MBX_TOV_SECONDS; in qla83xx_wr_reg()
6193 mcp->flags = 0; in qla83xx_wr_reg()
6198 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla83xx_wr_reg()
6211 struct qla_hw_data *ha = vha->hw; in qla2x00_port_logout()
6226 mcp->mb[0] = MBC_PORT_LOGOUT; in qla2x00_port_logout()
6227 mcp->mb[1] = fcport->loop_id; in qla2x00_port_logout()
6228 mcp->mb[10] = BIT_15; in qla2x00_port_logout()
6229 mcp->out_mb = MBX_10|MBX_1|MBX_0; in qla2x00_port_logout()
6230 mcp->in_mb = MBX_0; in qla2x00_port_logout()
6231 mcp->tov = MBX_TOV_SECONDS; in qla2x00_port_logout()
6232 mcp->flags = 0; in qla2x00_port_logout()
6236 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_port_logout()
6250 struct qla_hw_data *ha = vha->hw; in qla83xx_rd_reg()
6259 mcp->mb[0] = MBC_READ_REMOTE_REG; in qla83xx_rd_reg()
6260 mcp->mb[1] = LSW(reg); in qla83xx_rd_reg()
6261 mcp->mb[2] = MSW(reg); in qla83xx_rd_reg()
6262 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla83xx_rd_reg()
6263 mcp->in_mb = MBX_4|MBX_3|MBX_1|MBX_0; in qla83xx_rd_reg()
6264 mcp->tov = MBX_TOV_SECONDS; in qla83xx_rd_reg()
6265 mcp->flags = 0; in qla83xx_rd_reg()
6271 rval, mcp->mb[0], mcp->mb[1]); in qla83xx_rd_reg()
6273 *data = (mcp->mb[3] | (mcp->mb[4] << 16)); in qla83xx_rd_reg()
6276 * During soft-reset CAMRAM register reads might in qla83xx_rd_reg()
6301 struct qla_hw_data *ha = vha->hw; in qla83xx_restart_nic_firmware()
6308 mcp->mb[0] = MBC_RESTART_NIC_FIRMWARE; in qla83xx_restart_nic_firmware()
6309 mcp->out_mb = MBX_0; in qla83xx_restart_nic_firmware()
6310 mcp->in_mb = MBX_1|MBX_0; in qla83xx_restart_nic_firmware()
6311 mcp->tov = MBX_TOV_SECONDS; in qla83xx_restart_nic_firmware()
6312 mcp->flags = 0; in qla83xx_restart_nic_firmware()
6318 rval, mcp->mb[0], mcp->mb[1]); in qla83xx_restart_nic_firmware()
6335 struct qla_hw_data *ha = vha->hw; in qla83xx_access_control()
6342 mcp->mb[0] = MBC_SET_ACCESS_CONTROL; in qla83xx_access_control()
6343 mcp->mb[1] = options; in qla83xx_access_control()
6344 mcp->out_mb = MBX_1|MBX_0; in qla83xx_access_control()
6346 mcp->mb[2] = LSW(start_addr); in qla83xx_access_control()
6347 mcp->mb[3] = MSW(start_addr); in qla83xx_access_control()
6348 mcp->mb[4] = LSW(end_addr); in qla83xx_access_control()
6349 mcp->mb[5] = MSW(end_addr); in qla83xx_access_control()
6350 mcp->out_mb |= MBX_5|MBX_4|MBX_3|MBX_2; in qla83xx_access_control()
6352 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla83xx_access_control()
6354 mcp->in_mb |= MBX_4|MBX_3; in qla83xx_access_control()
6355 mcp->tov = MBX_TOV_SECONDS; in qla83xx_access_control()
6356 mcp->flags = 0; in qla83xx_access_control()
6362 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3], in qla83xx_access_control()
6363 mcp->mb[4]); in qla83xx_access_control()
6367 *sector_size = mcp->mb[1]; in qla83xx_access_control()
6370 "Driver-lock id=%x%x", mcp->mb[4], mcp->mb[3]); in qla83xx_access_control()
6373 "Flash-lock id=%x%x", mcp->mb[4], mcp->mb[3]); in qla83xx_access_control()
6389 if (!IS_MCTP_CAPABLE(vha->hw)) in qla2x00_dump_mctp_data()
6395 mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; in qla2x00_dump_mctp_data()
6396 mcp->mb[1] = LSW(addr); in qla2x00_dump_mctp_data()
6397 mcp->mb[2] = MSW(req_dma); in qla2x00_dump_mctp_data()
6398 mcp->mb[3] = LSW(req_dma); in qla2x00_dump_mctp_data()
6399 mcp->mb[4] = MSW(size); in qla2x00_dump_mctp_data()
6400 mcp->mb[5] = LSW(size); in qla2x00_dump_mctp_data()
6401 mcp->mb[6] = MSW(MSD(req_dma)); in qla2x00_dump_mctp_data()
6402 mcp->mb[7] = LSW(MSD(req_dma)); in qla2x00_dump_mctp_data()
6403 mcp->mb[8] = MSW(addr); in qla2x00_dump_mctp_data()
6405 /* For MCTP RAM ID is 0x40 */ in qla2x00_dump_mctp_data()
6406 mcp->mb[10] = BIT_7 | 0x40; in qla2x00_dump_mctp_data()
6408 mcp->out_mb |= MBX_10|MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1| in qla2x00_dump_mctp_data()
6411 mcp->in_mb = MBX_0; in qla2x00_dump_mctp_data()
6412 mcp->tov = MBX_TOV_SECONDS; in qla2x00_dump_mctp_data()
6413 mcp->flags = 0; in qla2x00_dump_mctp_data()
6418 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_dump_mctp_data()
6436 if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw) && in qla26xx_dport_diagnostics()
6437 !IS_QLA28XX(vha->hw)) in qla26xx_dport_diagnostics()
6443 dd_dma = dma_map_single(&vha->hw->pdev->dev, in qla26xx_dport_diagnostics()
6445 if (dma_mapping_error(&vha->hw->pdev->dev, dd_dma)) { in qla26xx_dport_diagnostics()
6452 mcp->mb[0] = MBC_DPORT_DIAGNOSTICS; in qla26xx_dport_diagnostics()
6453 mcp->mb[1] = options; in qla26xx_dport_diagnostics()
6454 mcp->mb[2] = MSW(LSD(dd_dma)); in qla26xx_dport_diagnostics()
6455 mcp->mb[3] = LSW(LSD(dd_dma)); in qla26xx_dport_diagnostics()
6456 mcp->mb[6] = MSW(MSD(dd_dma)); in qla26xx_dport_diagnostics()
6457 mcp->mb[7] = LSW(MSD(dd_dma)); in qla26xx_dport_diagnostics()
6458 mcp->mb[8] = size; in qla26xx_dport_diagnostics()
6459 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla26xx_dport_diagnostics()
6460 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla26xx_dport_diagnostics()
6461 mcp->buf_size = size; in qla26xx_dport_diagnostics()
6462 mcp->flags = MBX_DMA_IN; in qla26xx_dport_diagnostics()
6463 mcp->tov = MBX_TOV_SECONDS * 4; in qla26xx_dport_diagnostics()
6473 dma_unmap_single(&vha->hw->pdev->dev, dd_dma, in qla26xx_dport_diagnostics()
6485 uint size = sizeof(dd->buf); in qla26xx_dport_diagnostics_v2()
6486 uint16_t options = dd->options; in qla26xx_dport_diagnostics_v2()
6491 dd_dma = dma_map_single(&vha->hw->pdev->dev, in qla26xx_dport_diagnostics_v2()
6492 dd->buf, size, DMA_FROM_DEVICE); in qla26xx_dport_diagnostics_v2()
6493 if (dma_mapping_error(&vha->hw->pdev->dev, dd_dma)) { in qla26xx_dport_diagnostics_v2()
6499 memset(dd->buf, 0, size); in qla26xx_dport_diagnostics_v2()
6501 mcp->mb[0] = MBC_DPORT_DIAGNOSTICS; in qla26xx_dport_diagnostics_v2()
6502 mcp->mb[1] = options; in qla26xx_dport_diagnostics_v2()
6503 mcp->mb[2] = MSW(LSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6504 mcp->mb[3] = LSW(LSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6505 mcp->mb[6] = MSW(MSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6506 mcp->mb[7] = LSW(MSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6507 mcp->mb[8] = size; in qla26xx_dport_diagnostics_v2()
6508 mcp->out_mb = MBX_8 | MBX_7 | MBX_6 | MBX_3 | MBX_2 | MBX_1 | MBX_0; in qla26xx_dport_diagnostics_v2()
6509 mcp->in_mb = MBX_3 | MBX_2 | MBX_1 | MBX_0; in qla26xx_dport_diagnostics_v2()
6510 mcp->buf_size = size; in qla26xx_dport_diagnostics_v2()
6511 mcp->flags = MBX_DMA_IN; in qla26xx_dport_diagnostics_v2()
6512 mcp->tov = MBX_TOV_SECONDS * 4; in qla26xx_dport_diagnostics_v2()
6522 dma_unmap_single(&vha->hw->pdev->dev, dd_dma, size, DMA_FROM_DEVICE); in qla26xx_dport_diagnostics_v2()
6529 sp->u.iocb_cmd.u.mbx.rc = res; in qla2x00_async_mb_sp_done()
6531 complete(&sp->u.iocb_cmd.u.mbx.comp); in qla2x00_async_mb_sp_done()
6537 * This allows non-critial (non chip setup) command to go
6546 if (!vha->hw->flags.fw_started) in qla24xx_send_mb_cmd()
6554 c = &sp->u.iocb_cmd; in qla24xx_send_mb_cmd()
6555 init_completion(&c->u.mbx.comp); in qla24xx_send_mb_cmd()
6557 sp->type = SRB_MB_IOCB; in qla24xx_send_mb_cmd()
6558 sp->name = mb_to_str(mcp->mb[0]); in qla24xx_send_mb_cmd()
6562 memcpy(sp->u.iocb_cmd.u.mbx.out_mb, mcp->mb, SIZEOF_IOCB_MB_REG); in qla24xx_send_mb_cmd()
6568 __func__, sp->name, rval); in qla24xx_send_mb_cmd()
6573 sp->name, sp->handle); in qla24xx_send_mb_cmd()
6575 wait_for_completion(&c->u.mbx.comp); in qla24xx_send_mb_cmd()
6576 memcpy(mcp->mb, sp->u.iocb_cmd.u.mbx.in_mb, SIZEOF_IOCB_MB_REG); in qla24xx_send_mb_cmd()
6578 rval = c->u.mbx.rc; in qla24xx_send_mb_cmd()
6582 __func__, sp->name, rval); in qla24xx_send_mb_cmd()
6586 __func__, sp->name); in qla24xx_send_mb_cmd()
6590 __func__, sp->name, rval); in qla24xx_send_mb_cmd()
6596 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_send_mb_cmd()
6610 struct qla_hw_data *ha = vha->hw; in qla24xx_gpdb_wait()
6613 if (!vha->hw->flags.fw_started) in qla24xx_gpdb_wait()
6616 pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); in qla24xx_gpdb_wait()
6625 mc.mb[1] = fcport->loop_id; in qla24xx_gpdb_wait()
6630 mc.mb[9] = vha->vp_idx; in qla24xx_gpdb_wait()
6636 "%s: %8phC fail\n", __func__, fcport->port_name); in qla24xx_gpdb_wait()
6643 __func__, fcport->port_name); in qla24xx_gpdb_wait()
6647 dma_pool_free(ha->s_dma_pool, pd, pd_dma); in qla24xx_gpdb_wait()
6659 if (NVME_TARGET(vha->hw, fcport)) { in __qla24xx_parse_gpdb()
6660 current_login_state = pd->current_login_state >> 4; in __qla24xx_parse_gpdb()
6661 last_login_state = pd->last_login_state >> 4; in __qla24xx_parse_gpdb()
6663 current_login_state = pd->current_login_state & 0xf; in __qla24xx_parse_gpdb()
6664 last_login_state = pd->last_login_state & 0xf; in __qla24xx_parse_gpdb()
6670 "Unable to verify login-state (%x/%x) for loop_id %x.\n", in __qla24xx_parse_gpdb()
6671 current_login_state, last_login_state, fcport->loop_id); in __qla24xx_parse_gpdb()
6676 if (fcport->loop_id == FC_NO_LOOP_ID || in __qla24xx_parse_gpdb()
6677 (memcmp(fcport->port_name, (uint8_t *)&zero, 8) && in __qla24xx_parse_gpdb()
6678 memcmp(fcport->port_name, pd->port_name, 8))) { in __qla24xx_parse_gpdb()
6684 /* Names are little-endian. */ in __qla24xx_parse_gpdb()
6685 memcpy(fcport->node_name, pd->node_name, WWN_SIZE); in __qla24xx_parse_gpdb()
6686 memcpy(fcport->port_name, pd->port_name, WWN_SIZE); in __qla24xx_parse_gpdb()
6689 fcport->d_id.b.domain = pd->port_id[0]; in __qla24xx_parse_gpdb()
6690 fcport->d_id.b.area = pd->port_id[1]; in __qla24xx_parse_gpdb()
6691 fcport->d_id.b.al_pa = pd->port_id[2]; in __qla24xx_parse_gpdb()
6692 fcport->d_id.b.rsvd_1 = 0; in __qla24xx_parse_gpdb()
6696 fcport->port_name, in __qla24xx_parse_gpdb()
6697 pd->prli_svc_param_word_3[1], in __qla24xx_parse_gpdb()
6698 pd->prli_svc_param_word_3[0]); in __qla24xx_parse_gpdb()
6700 if (NVME_TARGET(vha->hw, fcport)) { in __qla24xx_parse_gpdb()
6701 fcport->port_type = FCT_NVME; in __qla24xx_parse_gpdb()
6702 if ((pd->prli_svc_param_word_3[0] & BIT_5) == 0) in __qla24xx_parse_gpdb()
6703 fcport->port_type |= FCT_NVME_INITIATOR; in __qla24xx_parse_gpdb()
6704 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) in __qla24xx_parse_gpdb()
6705 fcport->port_type |= FCT_NVME_TARGET; in __qla24xx_parse_gpdb()
6706 if ((pd->prli_svc_param_word_3[0] & BIT_3) == 0) in __qla24xx_parse_gpdb()
6707 fcport->port_type |= FCT_NVME_DISCOVERY; in __qla24xx_parse_gpdb()
6710 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) in __qla24xx_parse_gpdb()
6711 fcport->port_type = FCT_INITIATOR; in __qla24xx_parse_gpdb()
6713 fcport->port_type = FCT_TARGET; in __qla24xx_parse_gpdb()
6716 fcport->supported_classes = (pd->flags & PDF_CLASS_2) ? in __qla24xx_parse_gpdb()
6719 if (pd->prli_svc_param_word_3[0] & BIT_7) { in __qla24xx_parse_gpdb()
6720 fcport->flags |= FCF_CONF_COMP_SUPPORTED; in __qla24xx_parse_gpdb()
6721 fcport->conf_compl_supported = 1; in __qla24xx_parse_gpdb()
6738 if (!vha->hw->flags.fw_started) in qla24xx_gidlist_wait()
6748 mc.mb[9] = vha->vp_idx; in qla24xx_gidlist_wait()
6772 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla27xx_set_zio_threshold()
6773 mcp->mb[0] = MBC_GET_SET_ZIO_THRESHOLD; in qla27xx_set_zio_threshold()
6774 mcp->mb[1] = 1; in qla27xx_set_zio_threshold()
6775 mcp->mb[2] = value; in qla27xx_set_zio_threshold()
6776 mcp->out_mb = MBX_2 | MBX_1 | MBX_0; in qla27xx_set_zio_threshold()
6777 mcp->in_mb = MBX_2 | MBX_0; in qla27xx_set_zio_threshold()
6778 mcp->tov = MBX_TOV_SECONDS; in qla27xx_set_zio_threshold()
6779 mcp->flags = 0; in qla27xx_set_zio_threshold()
6798 memset(mcp->mb, 0, sizeof(mcp->mb)); in qla27xx_get_zio_threshold()
6799 mcp->mb[0] = MBC_GET_SET_ZIO_THRESHOLD; in qla27xx_get_zio_threshold()
6800 mcp->mb[1] = 0; in qla27xx_get_zio_threshold()
6801 mcp->out_mb = MBX_1 | MBX_0; in qla27xx_get_zio_threshold()
6802 mcp->in_mb = MBX_2 | MBX_0; in qla27xx_get_zio_threshold()
6803 mcp->tov = MBX_TOV_SECONDS; in qla27xx_get_zio_threshold()
6804 mcp->flags = 0; in qla27xx_get_zio_threshold()
6819 struct qla_hw_data *ha = vha->hw; in qla2x00_read_sfp_dev()
6825 memset(ha->sfp_data, 0, SFP_DEV_SIZE); in qla2x00_read_sfp_dev()
6827 phys_addr = ha->sfp_data_dma; in qla2x00_read_sfp_dev()
6828 sfp_data = ha->sfp_data; in qla2x00_read_sfp_dev()
6851 if ((count - c) >= SFP_BLOCK_SIZE) in qla2x00_read_sfp_dev()
6854 sz = count - c; in qla2x00_read_sfp_dev()
6874 if (!vha->hw->flags.fw_started) in qla24xx_res_count_wait()
6905 mcp->mb[0] = MBC_SECURE_FLASH_UPDATE; in qla28xx_secure_flash_update()
6906 mcp->mb[1] = opts; in qla28xx_secure_flash_update()
6907 mcp->mb[2] = region; in qla28xx_secure_flash_update()
6908 mcp->mb[3] = MSW(len); in qla28xx_secure_flash_update()
6909 mcp->mb[4] = LSW(len); in qla28xx_secure_flash_update()
6910 mcp->mb[5] = MSW(sfub_dma_addr); in qla28xx_secure_flash_update()
6911 mcp->mb[6] = LSW(sfub_dma_addr); in qla28xx_secure_flash_update()
6912 mcp->mb[7] = MSW(MSD(sfub_dma_addr)); in qla28xx_secure_flash_update()
6913 mcp->mb[8] = LSW(MSD(sfub_dma_addr)); in qla28xx_secure_flash_update()
6914 mcp->mb[9] = sfub_len; in qla28xx_secure_flash_update()
6915 mcp->out_mb = in qla28xx_secure_flash_update()
6917 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla28xx_secure_flash_update()
6918 mcp->tov = MBX_TOV_SECONDS; in qla28xx_secure_flash_update()
6919 mcp->flags = 0; in qla28xx_secure_flash_update()
6924 __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1], in qla28xx_secure_flash_update()
6925 mcp->mb[2]); in qla28xx_secure_flash_update()
6941 mcp->mb[0] = MBC_WRITE_REMOTE_REG; in qla2xxx_write_remote_register()
6942 mcp->mb[1] = LSW(addr); in qla2xxx_write_remote_register()
6943 mcp->mb[2] = MSW(addr); in qla2xxx_write_remote_register()
6944 mcp->mb[3] = LSW(data); in qla2xxx_write_remote_register()
6945 mcp->mb[4] = MSW(data); in qla2xxx_write_remote_register()
6946 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2xxx_write_remote_register()
6947 mcp->in_mb = MBX_1|MBX_0; in qla2xxx_write_remote_register()
6948 mcp->tov = MBX_TOV_SECONDS; in qla2xxx_write_remote_register()
6949 mcp->flags = 0; in qla2xxx_write_remote_register()
6954 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2xxx_write_remote_register()
6973 mcp->mb[0] = MBC_READ_REMOTE_REG; in qla2xxx_read_remote_register()
6974 mcp->mb[1] = LSW(addr); in qla2xxx_read_remote_register()
6975 mcp->mb[2] = MSW(addr); in qla2xxx_read_remote_register()
6976 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2xxx_read_remote_register()
6977 mcp->in_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2xxx_read_remote_register()
6978 mcp->tov = MBX_TOV_SECONDS; in qla2xxx_read_remote_register()
6979 mcp->flags = 0; in qla2xxx_read_remote_register()
6982 *data = (uint32_t)((((uint32_t)mcp->mb[4]) << 16) | mcp->mb[3]); in qla2xxx_read_remote_register()
6986 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2xxx_read_remote_register()
6998 struct qla_hw_data *ha = vha->hw; in ql26xx_led_config()
7009 mcp->mb[0] = MBC_SET_GET_FC_LED_CONFIG; in ql26xx_led_config()
7010 mcp->mb[1] = options; in ql26xx_led_config()
7011 mcp->out_mb = MBX_1|MBX_0; in ql26xx_led_config()
7012 mcp->in_mb = MBX_1|MBX_0; in ql26xx_led_config()
7015 mcp->mb[2] = led[2]; in ql26xx_led_config()
7016 mcp->out_mb |= MBX_2; in ql26xx_led_config()
7019 mcp->mb[3] = led[0]; in ql26xx_led_config()
7020 mcp->out_mb |= MBX_3; in ql26xx_led_config()
7023 mcp->mb[4] = led[1]; in ql26xx_led_config()
7024 mcp->out_mb |= MBX_4; in ql26xx_led_config()
7027 mcp->in_mb |= MBX_4|MBX_3|MBX_2; in ql26xx_led_config()
7029 mcp->tov = MBX_TOV_SECONDS; in ql26xx_led_config()
7030 mcp->flags = 0; in ql26xx_led_config()
7034 __func__, rval, mcp->mb[0], mcp->mb[1]); in ql26xx_led_config()
7039 ha->beacon_blink_led = 0; in ql26xx_led_config()
7042 led[2] = mcp->mb[2]; in ql26xx_led_config()
7043 led[0] = mcp->mb[3]; in ql26xx_led_config()
7044 led[1] = mcp->mb[4]; in ql26xx_led_config()
7066 mcp->mb[0] = 0; // noop cmd= 0 in qla_no_op_mb()
7067 mcp->out_mb = MBX_0; in qla_no_op_mb()
7068 mcp->in_mb = MBX_0; in qla_no_op_mb()
7069 mcp->tov = 5; in qla_no_op_mb()
7070 mcp->flags = 0; in qla_no_op_mb()
7084 int rval = -EINVAL; in qla_mailbox_passthru()
7088 memcpy(&mcp->mb, (char *)mbx_in, (32 * sizeof(uint16_t))); in qla_mailbox_passthru()
7090 mcp->out_mb = 0xFFFFFFFF; in qla_mailbox_passthru()
7091 mcp->in_mb = 0xFFFFFFFF; in qla_mailbox_passthru()
7093 mcp->tov = MBX_TOV_SECONDS; in qla_mailbox_passthru()
7094 mcp->flags = 0; in qla_mailbox_passthru()
7095 mcp->bufp = NULL; in qla_mailbox_passthru()
7101 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla_mailbox_passthru()
7106 memcpy(mbx_out, &mcp->mb, 32 * sizeof(uint16_t)); in qla_mailbox_passthru()