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 if (!wait_for_completion_timeout(&ha->mbx_intr_comp, in qla2x00_mailbox_command()
277 mcp->tov * HZ)) { in qla2x00_mailbox_command()
280 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
281 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); in qla2x00_mailbox_command()
282 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
284 if (chip_reset != ha->chip_reset) { in qla2x00_mailbox_command()
285 eeh_delay = ha->flags.eeh_busy ? 1 : 0; in qla2x00_mailbox_command()
287 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
288 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
289 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
291 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
295 } else if (ha->flags.purge_mbox || in qla2x00_mailbox_command()
296 chip_reset != ha->chip_reset) { in qla2x00_mailbox_command()
297 eeh_delay = ha->flags.eeh_busy ? 1 : 0; in qla2x00_mailbox_command()
299 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
300 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
301 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
302 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
309 command, jiffies_to_msecs(jiffies - wait_time)); in qla2x00_mailbox_command()
315 if (rd_reg_dword(®->isp82.hint) & in qla2x00_mailbox_command()
317 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
318 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
320 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
323 vha->hw_err_cnt++; in qla2x00_mailbox_command()
327 wrt_reg_dword(®->isp82.hint, HINT_MBX_INT_PENDING); in qla2x00_mailbox_command()
329 wrt_reg_dword(®->isp24.hccr, HCCRX_SET_HOST_INT); in qla2x00_mailbox_command()
331 wrt_reg_word(®->isp.hccr, HCCR_SET_HOST_INT); in qla2x00_mailbox_command()
332 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
334 wait_time = jiffies + mcp->tov * HZ; /* wait at most tov secs */ in qla2x00_mailbox_command()
335 while (!ha->flags.mbox_int) { in qla2x00_mailbox_command()
336 if (ha->flags.purge_mbox || in qla2x00_mailbox_command()
337 chip_reset != ha->chip_reset) { in qla2x00_mailbox_command()
338 eeh_delay = ha->flags.eeh_busy ? 1 : 0; in qla2x00_mailbox_command()
340 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
341 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
342 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
344 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
353 qla2x00_poll(ha->rsp_q_map[0]); in qla2x00_mailbox_command()
355 if (!ha->flags.mbox_int && in qla2x00_mailbox_command()
362 (uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ)); in qla2x00_mailbox_command()
364 atomic_dec(&ha->num_pend_mbx_stage2); in qla2x00_mailbox_command()
367 if (ha->flags.mbox_int) { in qla2x00_mailbox_command()
374 ha->flags.mbox_int = 0; in qla2x00_mailbox_command()
375 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); in qla2x00_mailbox_command()
377 if (IS_P3P_TYPE(ha) && ha->flags.isp82xx_fw_hung) { in qla2x00_mailbox_command()
378 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
379 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
380 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
382 /* Setting Link-Down error */ in qla2x00_mailbox_command()
383 mcp->mb[0] = MBS_LINK_DOWN_ERROR; in qla2x00_mailbox_command()
384 ha->mcp = NULL; in qla2x00_mailbox_command()
387 "FW hung = %d.\n", ha->flags.isp82xx_fw_hung); in qla2x00_mailbox_command()
391 if (ha->mailbox_out[0] != MBS_COMMAND_COMPLETE) { in qla2x00_mailbox_command()
393 "mb_out[0] = %#x <> %#x\n", ha->mailbox_out[0], in qla2x00_mailbox_command()
399 iptr2 = mcp->mb; in qla2x00_mailbox_command()
400 iptr = (uint16_t *)&ha->mailbox_out[0]; in qla2x00_mailbox_command()
401 mboxes = mcp->in_mb; in qla2x00_mailbox_command()
405 for (cnt = 0; cnt < ha->mbx_count; cnt++) { in qla2x00_mailbox_command()
409 "mbox[%d]->0x%04x\n", cnt, *iptr2); in qla2x00_mailbox_command()
423 mb[0] = rd_reg_word(®->isp24.mailbox0); in qla2x00_mailbox_command()
424 mb[1] = rd_reg_word(®->isp24.mailbox1); in qla2x00_mailbox_command()
425 mb[2] = rd_reg_word(®->isp24.mailbox2); in qla2x00_mailbox_command()
426 mb[3] = rd_reg_word(®->isp24.mailbox3); in qla2x00_mailbox_command()
427 mb[7] = rd_reg_word(®->isp24.mailbox7); in qla2x00_mailbox_command()
428 ictrl = rd_reg_dword(®->isp24.ictrl); in qla2x00_mailbox_command()
429 host_status = rd_reg_dword(®->isp24.host_status); in qla2x00_mailbox_command()
430 hccr = rd_reg_dword(®->isp24.hccr); in qla2x00_mailbox_command()
434 "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()
437 vha->hw_err_cnt++; in qla2x00_mailbox_command()
440 mb[0] = RD_MAILBOX_REG(ha, ®->isp, 0); in qla2x00_mailbox_command()
441 ictrl = rd_reg_word(®->isp.ictrl); in qla2x00_mailbox_command()
445 vha->hw_err_cnt++; in qla2x00_mailbox_command()
450 if (!pci_channel_offline(vha->hw->pdev)) { in qla2x00_mailbox_command()
451 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_mailbox_command()
453 (chip_reset != ha->chip_reset)) { in qla2x00_mailbox_command()
460 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
461 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
462 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_mailbox_command()
473 if (mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) in qla2x00_mailbox_command()
478 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
479 ha->flags.mbox_busy = 0; in qla2x00_mailbox_command()
480 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_mailbox_command()
483 ha->mcp = NULL; in qla2x00_mailbox_command()
490 qla2x00_poll(ha->rsp_q_map[0]); in qla2x00_mailbox_command()
494 mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) { in qla2x00_mailbox_command()
495 if (!io_lock_on || (mcp->flags & IOCTL_CMD) || in qla2x00_mailbox_command()
496 ha->flags.eeh_busy) { in qla2x00_mailbox_command()
501 if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && in qla2x00_mailbox_command()
502 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_mailbox_command()
503 !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { in qla2x00_mailbox_command()
516 "abort.\n", command, mcp->mb[0], in qla2x00_mailbox_command()
517 ha->flags.eeh_busy); in qla2x00_mailbox_command()
518 vha->hw_err_cnt++; in qla2x00_mailbox_command()
519 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_mailbox_command()
522 } else if (current == ha->dpc_thread) { in qla2x00_mailbox_command()
527 if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && in qla2x00_mailbox_command()
528 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_mailbox_command()
529 !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { in qla2x00_mailbox_command()
542 command, mcp->mb[0]); in qla2x00_mailbox_command()
543 vha->hw_err_cnt++; in qla2x00_mailbox_command()
544 set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); in qla2x00_mailbox_command()
545 clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_mailbox_command()
547 complete(&ha->mbx_cmd_comp); in qla2x00_mailbox_command()
548 if (ha->isp_ops->abort_isp(vha) && in qla2x00_mailbox_command()
549 !ha->flags.eeh_busy) { in qla2x00_mailbox_command()
552 &vha->dpc_flags); in qla2x00_mailbox_command()
554 clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); in qla2x00_mailbox_command()
564 complete(&ha->mbx_cmd_comp); in qla2x00_mailbox_command()
570 mcp->mb[0]); in qla2x00_mailbox_command()
573 pr_warn("%s [%s]-%04x:%ld: **** Failed=%x", QL_MSGHDR, in qla2x00_mailbox_command()
574 dev_name(&ha->pdev->dev), 0x1020+0x800, in qla2x00_mailbox_command()
575 vha->host_no, rval); in qla2x00_mailbox_command()
576 mboxes = mcp->in_mb; in qla2x00_mailbox_command()
578 for (i = 0; i < ha->mbx_count && cnt; i++, mboxes >>= 1) in qla2x00_mailbox_command()
580 printk(" mb[%u]=%x", i, mcp->mb[i]); in qla2x00_mailbox_command()
581 cnt--; in qla2x00_mailbox_command()
588 rd_reg_dword(®->isp24.host_status), in qla2x00_mailbox_command()
589 rd_reg_dword(®->isp24.ictrl), in qla2x00_mailbox_command()
590 rd_reg_dword(®->isp24.istatus)); in qla2x00_mailbox_command()
594 rd_reg_word(®->isp.ctrl_status), in qla2x00_mailbox_command()
595 rd_reg_word(®->isp.ictrl), in qla2x00_mailbox_command()
596 rd_reg_word(®->isp.istatus)); in qla2x00_mailbox_command()
603 while (i && eeh_delay && (ha->pci_error_state < QLA_PCI_SLOT_RESET)) { in qla2x00_mailbox_command()
611 i--; in qla2x00_mailbox_command()
621 struct qla_hw_data *ha = vha->hw; in qla2x00_load_ram()
629 mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED; in qla2x00_load_ram()
630 mcp->mb[8] = MSW(risc_addr); in qla2x00_load_ram()
631 mcp->out_mb = MBX_8|MBX_0; in qla2x00_load_ram()
633 mcp->mb[0] = MBC_LOAD_RISC_RAM; in qla2x00_load_ram()
634 mcp->out_mb = MBX_0; in qla2x00_load_ram()
636 mcp->mb[1] = LSW(risc_addr); in qla2x00_load_ram()
637 mcp->mb[2] = MSW(req_dma); in qla2x00_load_ram()
638 mcp->mb[3] = LSW(req_dma); in qla2x00_load_ram()
639 mcp->mb[6] = MSW(MSD(req_dma)); in qla2x00_load_ram()
640 mcp->mb[7] = LSW(MSD(req_dma)); in qla2x00_load_ram()
641 mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1; in qla2x00_load_ram()
643 mcp->mb[4] = MSW(risc_code_size); in qla2x00_load_ram()
644 mcp->mb[5] = LSW(risc_code_size); in qla2x00_load_ram()
645 mcp->out_mb |= MBX_5|MBX_4; in qla2x00_load_ram()
647 mcp->mb[4] = LSW(risc_code_size); in qla2x00_load_ram()
648 mcp->out_mb |= MBX_4; in qla2x00_load_ram()
651 mcp->in_mb = MBX_1|MBX_0; in qla2x00_load_ram()
652 mcp->tov = MBX_TOV_SECONDS; in qla2x00_load_ram()
653 mcp->flags = 0; in qla2x00_load_ram()
659 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_load_ram()
660 vha->hw_err_cnt++; in qla2x00_load_ram()
691 struct qla_hw_data *ha = vha->hw; in qla2x00_execute_fw()
702 mcp->mb[0] = MBC_EXECUTE_FIRMWARE; in qla2x00_execute_fw()
703 mcp->out_mb = MBX_0; in qla2x00_execute_fw()
704 mcp->in_mb = MBX_0; in qla2x00_execute_fw()
706 mcp->mb[1] = MSW(risc_addr); in qla2x00_execute_fw()
707 mcp->mb[2] = LSW(risc_addr); in qla2x00_execute_fw()
708 mcp->mb[3] = 0; in qla2x00_execute_fw()
709 mcp->mb[4] = 0; in qla2x00_execute_fw()
710 mcp->mb[11] = 0; in qla2x00_execute_fw()
713 if (ha->flags.lr_detected) { in qla2x00_execute_fw()
714 mcp->mb[4] = BIT_0; in qla2x00_execute_fw()
716 mcp->mb[4] |= in qla2x00_execute_fw()
717 ha->lr_distance << LR_DIST_FW_POS; in qla2x00_execute_fw()
721 mcp->mb[4] |= NVME_ENABLE_FLAG; in qla2x00_execute_fw()
724 struct nvram_81xx *nv = ha->nvram; in qla2x00_execute_fw()
726 if (nv->min_supported_speed >= 2 && in qla2x00_execute_fw()
727 nv->min_supported_speed <= 5) { in qla2x00_execute_fw()
728 mcp->mb[4] |= BIT_4; in qla2x00_execute_fw()
729 mcp->mb[11] |= nv->min_supported_speed & 0xF; in qla2x00_execute_fw()
730 mcp->out_mb |= MBX_11; in qla2x00_execute_fw()
731 mcp->in_mb |= BIT_5; in qla2x00_execute_fw()
732 vha->min_supported_speed = in qla2x00_execute_fw()
733 nv->min_supported_speed; in qla2x00_execute_fw()
737 mcp->mb[11] |= BIT_4; in qla2x00_execute_fw()
740 if (ha->flags.exlogins_enabled) in qla2x00_execute_fw()
741 mcp->mb[4] |= ENABLE_EXTENDED_LOGIN; in qla2x00_execute_fw()
743 if (ha->flags.exchoffld_enabled) in qla2x00_execute_fw()
744 mcp->mb[4] |= ENABLE_EXCHANGE_OFFLD; in qla2x00_execute_fw()
747 mcp->mb[11] |= EXE_FW_FORCE_SEMAPHORE; in qla2x00_execute_fw()
749 mcp->out_mb |= MBX_4 | MBX_3 | MBX_2 | MBX_1 | MBX_11; in qla2x00_execute_fw()
750 mcp->in_mb |= MBX_5 | MBX_3 | MBX_2 | MBX_1; in qla2x00_execute_fw()
752 mcp->mb[1] = LSW(risc_addr); in qla2x00_execute_fw()
753 mcp->out_mb |= MBX_1; in qla2x00_execute_fw()
755 mcp->mb[2] = 0; in qla2x00_execute_fw()
756 mcp->out_mb |= MBX_2; in qla2x00_execute_fw()
760 mcp->tov = MBX_TOV_SECONDS; in qla2x00_execute_fw()
761 mcp->flags = 0; in qla2x00_execute_fw()
766 mcp->mb[1] == 0x27 && retry) { in qla2x00_execute_fw()
768 retry--; in qla2x00_execute_fw()
775 retry--; in qla2x00_execute_fw()
777 "Exe FW retry: mb[0]=%x retry[%d]\n", mcp->mb[0], retry); in qla2x00_execute_fw()
781 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_execute_fw()
782 vha->hw_err_cnt++; in qla2x00_execute_fw()
789 ha->fw_ability_mask = mcp->mb[3] << 16 | mcp->mb[2]; in qla2x00_execute_fw()
791 "fw_ability_mask=%x.\n", ha->fw_ability_mask); in qla2x00_execute_fw()
792 ql_dbg(ql_dbg_mbx, vha, 0x1027, "exchanges=%x.\n", mcp->mb[1]); in qla2x00_execute_fw()
794 ha->max_supported_speed = mcp->mb[2] & (BIT_0|BIT_1); in qla2x00_execute_fw()
796 ha->max_supported_speed == 0 ? "16Gps" : in qla2x00_execute_fw()
797 ha->max_supported_speed == 1 ? "32Gps" : in qla2x00_execute_fw()
798 ha->max_supported_speed == 2 ? "64Gps" : "unknown"); in qla2x00_execute_fw()
799 if (vha->min_supported_speed) { in qla2x00_execute_fw()
800 ha->min_supported_speed = mcp->mb[5] & in qla2x00_execute_fw()
804 ha->min_supported_speed == 6 ? "64Gps" : in qla2x00_execute_fw()
805 ha->min_supported_speed == 5 ? "32Gps" : in qla2x00_execute_fw()
806 ha->min_supported_speed == 4 ? "16Gps" : in qla2x00_execute_fw()
807 ha->min_supported_speed == 3 ? "8Gps" : in qla2x00_execute_fw()
808 ha->min_supported_speed == 2 ? "4Gps" : "unknown"); in qla2x00_execute_fw()
812 if (IS_QLA28XX(ha) && (mcp->mb[5] & EDIF_HW_SUPPORT)) { in qla2x00_execute_fw()
813 ha->flags.edif_hw = 1; in qla2x00_execute_fw()
852 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_get_exlogin_status()
853 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_get_exlogin_status()
854 mcp->mb[1] = FETCH_XLOGINS_STAT; in qla_get_exlogin_status()
855 mcp->out_mb = MBX_1|MBX_0; in qla_get_exlogin_status()
856 mcp->in_mb = MBX_10|MBX_4|MBX_0; in qla_get_exlogin_status()
857 mcp->tov = MBX_TOV_SECONDS; in qla_get_exlogin_status()
858 mcp->flags = 0; in qla_get_exlogin_status()
864 *buf_sz = mcp->mb[4]; in qla_get_exlogin_status()
865 *ex_logins_cnt = mcp->mb[10]; in qla_get_exlogin_status()
869 mcp->mb[4], mcp->mb[10]); in qla_get_exlogin_status()
904 struct qla_hw_data *ha = vha->hw; in qla_set_exlogin_mem_cfg()
909 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_set_exlogin_mem_cfg()
910 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_set_exlogin_mem_cfg()
911 mcp->mb[1] = CONFIG_XLOGINS_MEM; in qla_set_exlogin_mem_cfg()
912 mcp->mb[2] = MSW(phys_addr); in qla_set_exlogin_mem_cfg()
913 mcp->mb[3] = LSW(phys_addr); in qla_set_exlogin_mem_cfg()
914 mcp->mb[6] = MSW(MSD(phys_addr)); in qla_set_exlogin_mem_cfg()
915 mcp->mb[7] = LSW(MSD(phys_addr)); in qla_set_exlogin_mem_cfg()
916 mcp->mb[8] = MSW(ha->exlogin_size); in qla_set_exlogin_mem_cfg()
917 mcp->mb[9] = LSW(ha->exlogin_size); in qla_set_exlogin_mem_cfg()
918 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()
919 mcp->in_mb = MBX_11|MBX_0; in qla_set_exlogin_mem_cfg()
920 mcp->tov = MBX_TOV_SECONDS; in qla_set_exlogin_mem_cfg()
921 mcp->flags = 0; in qla_set_exlogin_mem_cfg()
926 rval, mcp->mb[0], mcp->mb[11]); in qla_set_exlogin_mem_cfg()
962 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_get_exchoffld_status()
963 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_get_exchoffld_status()
964 mcp->mb[1] = FETCH_XCHOFFLD_STAT; in qla_get_exchoffld_status()
965 mcp->out_mb = MBX_1|MBX_0; in qla_get_exchoffld_status()
966 mcp->in_mb = MBX_10|MBX_4|MBX_0; in qla_get_exchoffld_status()
967 mcp->tov = MBX_TOV_SECONDS; in qla_get_exchoffld_status()
968 mcp->flags = 0; in qla_get_exchoffld_status()
974 *buf_sz = mcp->mb[4]; in qla_get_exchoffld_status()
975 *ex_logins_cnt = mcp->mb[10]; in qla_get_exchoffld_status()
979 mcp->mb[4], mcp->mb[10]); in qla_get_exchoffld_status()
1014 struct qla_hw_data *ha = vha->hw; in qla_set_exchoffld_mem_cfg()
1019 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla_set_exchoffld_mem_cfg()
1020 mcp->mb[0] = MBC_GET_MEM_OFFLOAD_CNTRL_STAT; in qla_set_exchoffld_mem_cfg()
1021 mcp->mb[1] = CONFIG_XCHOFFLD_MEM; in qla_set_exchoffld_mem_cfg()
1022 mcp->mb[2] = MSW(ha->exchoffld_buf_dma); in qla_set_exchoffld_mem_cfg()
1023 mcp->mb[3] = LSW(ha->exchoffld_buf_dma); in qla_set_exchoffld_mem_cfg()
1024 mcp->mb[6] = MSW(MSD(ha->exchoffld_buf_dma)); in qla_set_exchoffld_mem_cfg()
1025 mcp->mb[7] = LSW(MSD(ha->exchoffld_buf_dma)); in qla_set_exchoffld_mem_cfg()
1026 mcp->mb[8] = MSW(ha->exchoffld_size); in qla_set_exchoffld_mem_cfg()
1027 mcp->mb[9] = LSW(ha->exchoffld_size); in qla_set_exchoffld_mem_cfg()
1028 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()
1029 mcp->in_mb = MBX_11|MBX_0; in qla_set_exchoffld_mem_cfg()
1030 mcp->tov = MBX_TOV_SECONDS; in qla_set_exchoffld_mem_cfg()
1031 mcp->flags = 0; in qla_set_exchoffld_mem_cfg()
1066 struct qla_hw_data *ha = vha->hw; in qla2x00_get_fw_version()
1071 mcp->mb[0] = MBC_GET_FIRMWARE_VERSION; in qla2x00_get_fw_version()
1072 mcp->out_mb = MBX_0; in qla2x00_get_fw_version()
1073 mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_fw_version()
1074 if (IS_QLA81XX(vha->hw) || IS_QLA8031(ha) || IS_QLA8044(ha)) in qla2x00_get_fw_version()
1075 mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8; in qla2x00_get_fw_version()
1077 mcp->in_mb |= MBX_17|MBX_16|MBX_15; in qla2x00_get_fw_version()
1079 mcp->in_mb |= in qla2x00_get_fw_version()
1083 mcp->flags = 0; in qla2x00_get_fw_version()
1084 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_fw_version()
1090 ha->fw_major_version = mcp->mb[1]; in qla2x00_get_fw_version()
1091 ha->fw_minor_version = mcp->mb[2]; in qla2x00_get_fw_version()
1092 ha->fw_subminor_version = mcp->mb[3]; in qla2x00_get_fw_version()
1093 ha->fw_attributes = mcp->mb[6]; in qla2x00_get_fw_version()
1094 if (IS_QLA2100(vha->hw) || IS_QLA2200(vha->hw)) in qla2x00_get_fw_version()
1095 ha->fw_memory_size = 0x1FFFF; /* Defaults to 128KB. */ in qla2x00_get_fw_version()
1097 ha->fw_memory_size = (mcp->mb[5] << 16) | mcp->mb[4]; in qla2x00_get_fw_version()
1099 if (IS_QLA81XX(vha->hw) || IS_QLA8031(vha->hw) || IS_QLA8044(ha)) { in qla2x00_get_fw_version()
1100 ha->mpi_version[0] = mcp->mb[10] & 0xff; in qla2x00_get_fw_version()
1101 ha->mpi_version[1] = mcp->mb[11] >> 8; in qla2x00_get_fw_version()
1102 ha->mpi_version[2] = mcp->mb[11] & 0xff; in qla2x00_get_fw_version()
1103 ha->mpi_capabilities = (mcp->mb[12] << 16) | mcp->mb[13]; in qla2x00_get_fw_version()
1104 ha->phy_version[0] = mcp->mb[8] & 0xff; in qla2x00_get_fw_version()
1105 ha->phy_version[1] = mcp->mb[9] >> 8; in qla2x00_get_fw_version()
1106 ha->phy_version[2] = mcp->mb[9] & 0xff; in qla2x00_get_fw_version()
1110 ha->fw_attributes_h = mcp->mb[15]; in qla2x00_get_fw_version()
1111 ha->fw_attributes_ext[0] = mcp->mb[16]; in qla2x00_get_fw_version()
1112 ha->fw_attributes_ext[1] = mcp->mb[17]; in qla2x00_get_fw_version()
1115 __func__, mcp->mb[15], mcp->mb[6]); in qla2x00_get_fw_version()
1118 __func__, mcp->mb[17], mcp->mb[16]); in qla2x00_get_fw_version()
1120 if (ha->fw_attributes_h & 0x4) in qla2x00_get_fw_version()
1123 __func__, ha->fw_attributes_h); in qla2x00_get_fw_version()
1125 if (ha->fw_attributes_h & 0x8) in qla2x00_get_fw_version()
1128 __func__, ha->fw_attributes_h); in qla2x00_get_fw_version()
1134 if ((ha->fw_attributes_h & in qla2x00_get_fw_version()
1137 if (ha->fw_attributes_h & FW_ATTR_H_NVME_FBURST) in qla2x00_get_fw_version()
1138 vha->flags.nvme_first_burst = 1; in qla2x00_get_fw_version()
1140 vha->flags.nvme_enabled = 1; in qla2x00_get_fw_version()
1142 "%s: FC-NVMe is Enabled (0x%x)\n", in qla2x00_get_fw_version()
1143 __func__, ha->fw_attributes_h); in qla2x00_get_fw_version()
1147 if (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_NVME2) { in qla2x00_get_fw_version()
1150 ha->fw_attributes_ext[0]); in qla2x00_get_fw_version()
1151 vha->flags.nvme2_enabled = 1; in qla2x00_get_fw_version()
1154 if (IS_QLA28XX(ha) && ha->flags.edif_hw && ql2xsecenable && in qla2x00_get_fw_version()
1155 (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_EDIF)) { in qla2x00_get_fw_version()
1156 ha->flags.edif_enabled = 1; in qla2x00_get_fw_version()
1163 ha->serdes_version[0] = mcp->mb[7] & 0xff; in qla2x00_get_fw_version()
1164 ha->serdes_version[1] = mcp->mb[8] >> 8; in qla2x00_get_fw_version()
1165 ha->serdes_version[2] = mcp->mb[8] & 0xff; in qla2x00_get_fw_version()
1166 ha->mpi_version[0] = mcp->mb[10] & 0xff; in qla2x00_get_fw_version()
1167 ha->mpi_version[1] = mcp->mb[11] >> 8; in qla2x00_get_fw_version()
1168 ha->mpi_version[2] = mcp->mb[11] & 0xff; in qla2x00_get_fw_version()
1169 ha->pep_version[0] = mcp->mb[13] & 0xff; in qla2x00_get_fw_version()
1170 ha->pep_version[1] = mcp->mb[14] >> 8; in qla2x00_get_fw_version()
1171 ha->pep_version[2] = mcp->mb[14] & 0xff; in qla2x00_get_fw_version()
1172 ha->fw_shared_ram_start = (mcp->mb[19] << 16) | mcp->mb[18]; in qla2x00_get_fw_version()
1173 ha->fw_shared_ram_end = (mcp->mb[21] << 16) | mcp->mb[20]; in qla2x00_get_fw_version()
1174 ha->fw_ddr_ram_start = (mcp->mb[23] << 16) | mcp->mb[22]; in qla2x00_get_fw_version()
1175 ha->fw_ddr_ram_end = (mcp->mb[25] << 16) | mcp->mb[24]; in qla2x00_get_fw_version()
1177 if (mcp->mb[16] & BIT_10) in qla2x00_get_fw_version()
1178 ha->flags.secure_fw = 1; in qla2x00_get_fw_version()
1182 (ha->flags.secure_fw) ? "Supported" : in qla2x00_get_fw_version()
1186 if (ha->flags.scm_supported_a && in qla2x00_get_fw_version()
1187 (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_SCM_SUPPORTED)) { in qla2x00_get_fw_version()
1188 ha->flags.scm_supported_f = 1; in qla2x00_get_fw_version()
1189 ha->sf_init_cb->flags |= cpu_to_le16(BIT_13); in qla2x00_get_fw_version()
1192 (ha->flags.scm_supported_f) ? "Supported" : in qla2x00_get_fw_version()
1195 if (vha->flags.nvme2_enabled) { in qla2x00_get_fw_version()
1197 ha->sf_init_cb->flags |= cpu_to_le16(BIT_15); in qla2x00_get_fw_version()
1199 ha->sf_init_cb->flags |= cpu_to_le16(BIT_14); in qla2x00_get_fw_version()
1239 mcp->mb[0] = MBC_GET_FIRMWARE_OPTION; in qla2x00_get_fw_options()
1240 mcp->out_mb = MBX_0; in qla2x00_get_fw_options()
1241 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_fw_options()
1242 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_fw_options()
1243 mcp->flags = 0; in qla2x00_get_fw_options()
1250 fwopts[0] = mcp->mb[0]; in qla2x00_get_fw_options()
1251 fwopts[1] = mcp->mb[1]; in qla2x00_get_fw_options()
1252 fwopts[2] = mcp->mb[2]; in qla2x00_get_fw_options()
1253 fwopts[3] = mcp->mb[3]; in qla2x00_get_fw_options()
1287 mcp->mb[0] = MBC_SET_FIRMWARE_OPTION; in qla2x00_set_fw_options()
1288 mcp->mb[1] = fwopts[1]; in qla2x00_set_fw_options()
1289 mcp->mb[2] = fwopts[2]; in qla2x00_set_fw_options()
1290 mcp->mb[3] = fwopts[3]; in qla2x00_set_fw_options()
1291 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_set_fw_options()
1292 mcp->in_mb = MBX_0; in qla2x00_set_fw_options()
1293 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_set_fw_options()
1294 mcp->in_mb |= MBX_1; in qla2x00_set_fw_options()
1295 mcp->mb[10] = fwopts[10]; in qla2x00_set_fw_options()
1296 mcp->out_mb |= MBX_10; in qla2x00_set_fw_options()
1298 mcp->mb[10] = fwopts[10]; in qla2x00_set_fw_options()
1299 mcp->mb[11] = fwopts[11]; in qla2x00_set_fw_options()
1300 mcp->mb[12] = 0; /* Undocumented, but used */ in qla2x00_set_fw_options()
1301 mcp->out_mb |= MBX_12|MBX_11|MBX_10; in qla2x00_set_fw_options()
1303 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_fw_options()
1304 mcp->flags = 0; in qla2x00_set_fw_options()
1307 fwopts[0] = mcp->mb[0]; in qla2x00_set_fw_options()
1312 "Failed=%x (%x/%x).\n", rval, mcp->mb[0], mcp->mb[1]); in qla2x00_set_fw_options()
1347 mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST; in qla2x00_mbx_reg_test()
1348 mcp->mb[1] = 0xAAAA; in qla2x00_mbx_reg_test()
1349 mcp->mb[2] = 0x5555; in qla2x00_mbx_reg_test()
1350 mcp->mb[3] = 0xAA55; in qla2x00_mbx_reg_test()
1351 mcp->mb[4] = 0x55AA; in qla2x00_mbx_reg_test()
1352 mcp->mb[5] = 0xA5A5; in qla2x00_mbx_reg_test()
1353 mcp->mb[6] = 0x5A5A; in qla2x00_mbx_reg_test()
1354 mcp->mb[7] = 0x2525; in qla2x00_mbx_reg_test()
1355 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_mbx_reg_test()
1356 mcp->in_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_mbx_reg_test()
1357 mcp->tov = MBX_TOV_SECONDS; in qla2x00_mbx_reg_test()
1358 mcp->flags = 0; in qla2x00_mbx_reg_test()
1362 if (mcp->mb[1] != 0xAAAA || mcp->mb[2] != 0x5555 || in qla2x00_mbx_reg_test()
1363 mcp->mb[3] != 0xAA55 || mcp->mb[4] != 0x55AA) in qla2x00_mbx_reg_test()
1365 if (mcp->mb[5] != 0xA5A5 || mcp->mb[6] != 0x5A5A || in qla2x00_mbx_reg_test()
1366 mcp->mb[7] != 0x2525) in qla2x00_mbx_reg_test()
1373 vha->hw_err_cnt++; in qla2x00_mbx_reg_test()
1408 mcp->mb[0] = MBC_VERIFY_CHECKSUM; in qla2x00_verify_checksum()
1409 mcp->out_mb = MBX_0; in qla2x00_verify_checksum()
1410 mcp->in_mb = MBX_0; in qla2x00_verify_checksum()
1411 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_verify_checksum()
1412 mcp->mb[1] = MSW(risc_addr); in qla2x00_verify_checksum()
1413 mcp->mb[2] = LSW(risc_addr); in qla2x00_verify_checksum()
1414 mcp->out_mb |= MBX_2|MBX_1; in qla2x00_verify_checksum()
1415 mcp->in_mb |= MBX_2|MBX_1; in qla2x00_verify_checksum()
1417 mcp->mb[1] = LSW(risc_addr); in qla2x00_verify_checksum()
1418 mcp->out_mb |= MBX_1; in qla2x00_verify_checksum()
1419 mcp->in_mb |= MBX_1; in qla2x00_verify_checksum()
1422 mcp->tov = MBX_TOV_SECONDS; in qla2x00_verify_checksum()
1423 mcp->flags = 0; in qla2x00_verify_checksum()
1428 "Failed=%x chm sum=%x.\n", rval, IS_FWI2_CAPABLE(vha->hw) ? in qla2x00_verify_checksum()
1429 (mcp->mb[2] << 16) | mcp->mb[1] : mcp->mb[1]); in qla2x00_verify_checksum()
1464 if (!vha->hw->flags.fw_started) in qla2x00_issue_iocb_timeout()
1470 mcp->mb[0] = MBC_IOCB_COMMAND_A64; in qla2x00_issue_iocb_timeout()
1471 mcp->mb[1] = 0; in qla2x00_issue_iocb_timeout()
1472 mcp->mb[2] = MSW(LSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1473 mcp->mb[3] = LSW(LSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1474 mcp->mb[6] = MSW(MSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1475 mcp->mb[7] = LSW(MSD(phys_addr)); in qla2x00_issue_iocb_timeout()
1476 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_issue_iocb_timeout()
1477 mcp->in_mb = MBX_1|MBX_0; in qla2x00_issue_iocb_timeout()
1478 mcp->tov = tov; in qla2x00_issue_iocb_timeout()
1479 mcp->flags = 0; in qla2x00_issue_iocb_timeout()
1489 sts_entry->entry_status &= in qla2x00_issue_iocb_timeout()
1490 IS_FWI2_CAPABLE(vha->hw) ? RF_MASK_24XX : RF_MASK; in qla2x00_issue_iocb_timeout()
1493 sts_entry->entry_status); in qla2x00_issue_iocb_timeout()
1529 fc_port_t *fcport = sp->fcport; in qla2x00_abort_command()
1530 scsi_qla_host_t *vha = fcport->vha; in qla2x00_abort_command()
1531 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_command()
1538 if (sp->qpair) in qla2x00_abort_command()
1539 req = sp->qpair->req; in qla2x00_abort_command()
1541 req = vha->req; in qla2x00_abort_command()
1543 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_abort_command()
1544 for (handle = 1; handle < req->num_outstanding_cmds; handle++) { in qla2x00_abort_command()
1545 if (req->outstanding_cmds[handle] == sp) in qla2x00_abort_command()
1548 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_abort_command()
1550 if (handle == req->num_outstanding_cmds) { in qla2x00_abort_command()
1555 mcp->mb[0] = MBC_ABORT_COMMAND; in qla2x00_abort_command()
1557 mcp->mb[1] = fcport->loop_id; in qla2x00_abort_command()
1559 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_abort_command()
1560 mcp->mb[2] = (uint16_t)handle; in qla2x00_abort_command()
1561 mcp->mb[3] = (uint16_t)(handle >> 16); in qla2x00_abort_command()
1562 mcp->mb[6] = (uint16_t)cmd->device->lun; in qla2x00_abort_command()
1563 mcp->out_mb = MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_abort_command()
1564 mcp->in_mb = MBX_0; in qla2x00_abort_command()
1565 mcp->tov = MBX_TOV_SECONDS; in qla2x00_abort_command()
1566 mcp->flags = 0; in qla2x00_abort_command()
1587 vha = fcport->vha; in qla2x00_abort_target()
1592 mcp->mb[0] = MBC_ABORT_TARGET; in qla2x00_abort_target()
1593 mcp->out_mb = MBX_9|MBX_2|MBX_1|MBX_0; in qla2x00_abort_target()
1594 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_abort_target()
1595 mcp->mb[1] = fcport->loop_id; in qla2x00_abort_target()
1596 mcp->mb[10] = 0; in qla2x00_abort_target()
1597 mcp->out_mb |= MBX_10; in qla2x00_abort_target()
1599 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_abort_target()
1601 mcp->mb[2] = vha->hw->loop_reset_delay; in qla2x00_abort_target()
1602 mcp->mb[9] = vha->vp_idx; in qla2x00_abort_target()
1604 mcp->in_mb = MBX_0; in qla2x00_abort_target()
1605 mcp->tov = MBX_TOV_SECONDS; in qla2x00_abort_target()
1606 mcp->flags = 0; in qla2x00_abort_target()
1614 rval2 = qla2x00_marker(vha, vha->hw->base_qpair, fcport->loop_id, 0, in qla2x00_abort_target()
1635 vha = fcport->vha; in qla2x00_lun_reset()
1640 mcp->mb[0] = MBC_LUN_RESET; in qla2x00_lun_reset()
1641 mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_lun_reset()
1642 if (HAS_EXTENDED_IDS(vha->hw)) in qla2x00_lun_reset()
1643 mcp->mb[1] = fcport->loop_id; in qla2x00_lun_reset()
1645 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_lun_reset()
1646 mcp->mb[2] = (u32)l; in qla2x00_lun_reset()
1647 mcp->mb[3] = 0; in qla2x00_lun_reset()
1648 mcp->mb[9] = vha->vp_idx; in qla2x00_lun_reset()
1650 mcp->in_mb = MBX_0; in qla2x00_lun_reset()
1651 mcp->tov = MBX_TOV_SECONDS; in qla2x00_lun_reset()
1652 mcp->flags = 0; in qla2x00_lun_reset()
1659 rval2 = qla2x00_marker(vha, vha->hw->base_qpair, fcport->loop_id, l, in qla2x00_lun_reset()
1703 mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; in qla2x00_get_adapter_id()
1704 mcp->mb[9] = vha->vp_idx; in qla2x00_get_adapter_id()
1705 mcp->out_mb = MBX_9|MBX_0; in qla2x00_get_adapter_id()
1706 mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_adapter_id()
1707 if (IS_CNA_CAPABLE(vha->hw)) in qla2x00_get_adapter_id()
1708 mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10; in qla2x00_get_adapter_id()
1709 if (IS_FWI2_CAPABLE(vha->hw)) in qla2x00_get_adapter_id()
1710 mcp->in_mb |= MBX_19|MBX_18|MBX_17|MBX_16; in qla2x00_get_adapter_id()
1711 if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) in qla2x00_get_adapter_id()
1712 mcp->in_mb |= MBX_15|MBX_21|MBX_22|MBX_23; in qla2x00_get_adapter_id()
1714 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_adapter_id()
1715 mcp->flags = 0; in qla2x00_get_adapter_id()
1717 if (mcp->mb[0] == MBS_COMMAND_ERROR) in qla2x00_get_adapter_id()
1719 else if (mcp->mb[0] == MBS_INVALID_COMMAND) in qla2x00_get_adapter_id()
1723 *id = mcp->mb[1]; in qla2x00_get_adapter_id()
1724 *al_pa = LSB(mcp->mb[2]); in qla2x00_get_adapter_id()
1725 *area = MSB(mcp->mb[2]); in qla2x00_get_adapter_id()
1726 *domain = LSB(mcp->mb[3]); in qla2x00_get_adapter_id()
1727 *top = mcp->mb[6]; in qla2x00_get_adapter_id()
1728 *sw_cap = mcp->mb[7]; in qla2x00_get_adapter_id()
1737 if (IS_CNA_CAPABLE(vha->hw)) { in qla2x00_get_adapter_id()
1738 vha->fcoe_vlan_id = mcp->mb[9] & 0xfff; in qla2x00_get_adapter_id()
1739 vha->fcoe_fcf_idx = mcp->mb[10]; in qla2x00_get_adapter_id()
1740 vha->fcoe_vn_port_mac[5] = mcp->mb[11] >> 8; in qla2x00_get_adapter_id()
1741 vha->fcoe_vn_port_mac[4] = mcp->mb[11] & 0xff; in qla2x00_get_adapter_id()
1742 vha->fcoe_vn_port_mac[3] = mcp->mb[12] >> 8; in qla2x00_get_adapter_id()
1743 vha->fcoe_vn_port_mac[2] = mcp->mb[12] & 0xff; in qla2x00_get_adapter_id()
1744 vha->fcoe_vn_port_mac[1] = mcp->mb[13] >> 8; in qla2x00_get_adapter_id()
1745 vha->fcoe_vn_port_mac[0] = mcp->mb[13] & 0xff; in qla2x00_get_adapter_id()
1747 /* If FA-WWN supported */ in qla2x00_get_adapter_id()
1748 if (IS_FAWWN_CAPABLE(vha->hw)) { in qla2x00_get_adapter_id()
1749 if (mcp->mb[7] & BIT_14) { in qla2x00_get_adapter_id()
1750 vha->port_name[0] = MSB(mcp->mb[16]); in qla2x00_get_adapter_id()
1751 vha->port_name[1] = LSB(mcp->mb[16]); in qla2x00_get_adapter_id()
1752 vha->port_name[2] = MSB(mcp->mb[17]); in qla2x00_get_adapter_id()
1753 vha->port_name[3] = LSB(mcp->mb[17]); in qla2x00_get_adapter_id()
1754 vha->port_name[4] = MSB(mcp->mb[18]); in qla2x00_get_adapter_id()
1755 vha->port_name[5] = LSB(mcp->mb[18]); in qla2x00_get_adapter_id()
1756 vha->port_name[6] = MSB(mcp->mb[19]); in qla2x00_get_adapter_id()
1757 vha->port_name[7] = LSB(mcp->mb[19]); in qla2x00_get_adapter_id()
1758 fc_host_port_name(vha->host) = in qla2x00_get_adapter_id()
1759 wwn_to_u64(vha->port_name); in qla2x00_get_adapter_id()
1761 "FA-WWN acquired %016llx\n", in qla2x00_get_adapter_id()
1762 wwn_to_u64(vha->port_name)); in qla2x00_get_adapter_id()
1766 if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) { in qla2x00_get_adapter_id()
1767 vha->bbcr = mcp->mb[15]; in qla2x00_get_adapter_id()
1768 if (mcp->mb[7] & SCM_EDC_ACC_RECEIVED) { in qla2x00_get_adapter_id()
1771 mcp->mb[21]); in qla2x00_get_adapter_id()
1773 if (mcp->mb[7] & SCM_RDF_ACC_RECEIVED) { in qla2x00_get_adapter_id()
1774 vha->hw->flags.scm_enabled = 1; in qla2x00_get_adapter_id()
1775 vha->scm_fabric_connection_flags |= in qla2x00_get_adapter_id()
1779 mcp->mb[23]); in qla2x00_get_adapter_id()
1814 mcp->mb[0] = MBC_GET_RETRY_COUNT; in qla2x00_get_retry_cnt()
1815 mcp->out_mb = MBX_0; in qla2x00_get_retry_cnt()
1816 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_retry_cnt()
1817 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_retry_cnt()
1818 mcp->flags = 0; in qla2x00_get_retry_cnt()
1824 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_get_retry_cnt()
1827 *r_a_tov = mcp->mb[3] / 2; in qla2x00_get_retry_cnt()
1828 ratov = (mcp->mb[3]/2) / 10; /* mb[3] value is in 100ms */ in qla2x00_get_retry_cnt()
1829 if (mcp->mb[1] * ratov > (*retry_cnt) * (*tov)) { in qla2x00_get_retry_cnt()
1831 *retry_cnt = (uint8_t)mcp->mb[1]; in qla2x00_get_retry_cnt()
1836 "Done %s mb3=%d ratov=%d.\n", __func__, mcp->mb[3], ratov); in qla2x00_get_retry_cnt()
1865 struct qla_hw_data *ha = vha->hw; in qla2x00_init_firmware()
1871 qla82xx_wr_32(ha, (uintptr_t __force)ha->nxdb_wr_ptr, in qla2x00_init_firmware()
1872 (0x04 | (ha->portnum << 5) | (0 << 8) | (0 << 16))); in qla2x00_init_firmware()
1874 if (ha->flags.npiv_supported) in qla2x00_init_firmware()
1875 mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE; in qla2x00_init_firmware()
1877 mcp->mb[0] = MBC_INITIALIZE_FIRMWARE; in qla2x00_init_firmware()
1879 mcp->mb[1] = 0; in qla2x00_init_firmware()
1880 mcp->mb[2] = MSW(ha->init_cb_dma); in qla2x00_init_firmware()
1881 mcp->mb[3] = LSW(ha->init_cb_dma); in qla2x00_init_firmware()
1882 mcp->mb[6] = MSW(MSD(ha->init_cb_dma)); in qla2x00_init_firmware()
1883 mcp->mb[7] = LSW(MSD(ha->init_cb_dma)); in qla2x00_init_firmware()
1884 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_init_firmware()
1885 if (ha->ex_init_cb && ha->ex_init_cb->ex_version) { in qla2x00_init_firmware()
1886 mcp->mb[1] = BIT_0; in qla2x00_init_firmware()
1887 mcp->mb[10] = MSW(ha->ex_init_cb_dma); in qla2x00_init_firmware()
1888 mcp->mb[11] = LSW(ha->ex_init_cb_dma); in qla2x00_init_firmware()
1889 mcp->mb[12] = MSW(MSD(ha->ex_init_cb_dma)); in qla2x00_init_firmware()
1890 mcp->mb[13] = LSW(MSD(ha->ex_init_cb_dma)); in qla2x00_init_firmware()
1891 mcp->mb[14] = sizeof(*ha->ex_init_cb); in qla2x00_init_firmware()
1892 mcp->out_mb |= MBX_14|MBX_13|MBX_12|MBX_11|MBX_10; in qla2x00_init_firmware()
1895 if (ha->flags.scm_supported_f || vha->flags.nvme2_enabled) { in qla2x00_init_firmware()
1896 mcp->mb[1] |= BIT_1; in qla2x00_init_firmware()
1897 mcp->mb[16] = MSW(ha->sf_init_cb_dma); in qla2x00_init_firmware()
1898 mcp->mb[17] = LSW(ha->sf_init_cb_dma); in qla2x00_init_firmware()
1899 mcp->mb[18] = MSW(MSD(ha->sf_init_cb_dma)); in qla2x00_init_firmware()
1900 mcp->mb[19] = LSW(MSD(ha->sf_init_cb_dma)); in qla2x00_init_firmware()
1901 mcp->mb[15] = sizeof(*ha->sf_init_cb); in qla2x00_init_firmware()
1902 mcp->out_mb |= MBX_19|MBX_18|MBX_17|MBX_16|MBX_15; in qla2x00_init_firmware()
1906 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_init_firmware()
1909 mcp->in_mb |= MBX_3; in qla2x00_init_firmware()
1910 mcp->buf_size = size; in qla2x00_init_firmware()
1911 mcp->flags = MBX_DMA_OUT; in qla2x00_init_firmware()
1912 mcp->tov = MBX_TOV_SECONDS; in qla2x00_init_firmware()
1919 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3]); in qla2x00_init_firmware()
1920 if (ha->init_cb) { in qla2x00_init_firmware()
1923 0x0104d, ha->init_cb, sizeof(*ha->init_cb)); in qla2x00_init_firmware()
1925 if (ha->ex_init_cb && ha->ex_init_cb->ex_version) { in qla2x00_init_firmware()
1928 0x0104d, ha->ex_init_cb, sizeof(*ha->ex_init_cb)); in qla2x00_init_firmware()
1932 if (mcp->mb[2] == 6 || mcp->mb[3] == 2) in qla2x00_init_firmware()
1969 struct qla_hw_data *ha = vha->hw; in qla2x00_get_port_database()
1975 pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); in qla2x00_get_port_database()
1979 fcport->query = 0; in qla2x00_get_port_database()
1983 mcp->mb[0] = MBC_GET_PORT_DATABASE; in qla2x00_get_port_database()
1985 mcp->mb[0] = MBC_ENHANCED_GET_PORT_DATABASE; in qla2x00_get_port_database()
1986 mcp->mb[2] = MSW(pd_dma); in qla2x00_get_port_database()
1987 mcp->mb[3] = LSW(pd_dma); in qla2x00_get_port_database()
1988 mcp->mb[6] = MSW(MSD(pd_dma)); in qla2x00_get_port_database()
1989 mcp->mb[7] = LSW(MSD(pd_dma)); in qla2x00_get_port_database()
1990 mcp->mb[9] = vha->vp_idx; in qla2x00_get_port_database()
1991 mcp->out_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_port_database()
1992 mcp->in_mb = MBX_0; in qla2x00_get_port_database()
1994 mcp->mb[1] = fcport->loop_id; in qla2x00_get_port_database()
1995 mcp->mb[10] = opt; in qla2x00_get_port_database()
1996 mcp->out_mb |= MBX_10|MBX_1; in qla2x00_get_port_database()
1997 mcp->in_mb |= MBX_1; in qla2x00_get_port_database()
1999 mcp->mb[1] = fcport->loop_id; in qla2x00_get_port_database()
2000 mcp->mb[10] = opt; in qla2x00_get_port_database()
2001 mcp->out_mb |= MBX_10|MBX_1; in qla2x00_get_port_database()
2003 mcp->mb[1] = fcport->loop_id << 8 | opt; in qla2x00_get_port_database()
2004 mcp->out_mb |= MBX_1; in qla2x00_get_port_database()
2006 mcp->buf_size = IS_FWI2_CAPABLE(ha) ? in qla2x00_get_port_database()
2008 mcp->flags = MBX_DMA_IN; in qla2x00_get_port_database()
2009 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_get_port_database()
2022 current_login_state = pd24->current_login_state >> 4; in qla2x00_get_port_database()
2023 last_login_state = pd24->last_login_state >> 4; in qla2x00_get_port_database()
2025 current_login_state = pd24->current_login_state & 0xf; in qla2x00_get_port_database()
2026 last_login_state = pd24->last_login_state & 0xf; in qla2x00_get_port_database()
2028 fcport->current_login_state = pd24->current_login_state; in qla2x00_get_port_database()
2029 fcport->last_login_state = pd24->last_login_state; in qla2x00_get_port_database()
2035 "Unable to verify login-state (%x/%x) for loop_id %x.\n", in qla2x00_get_port_database()
2037 fcport->loop_id); in qla2x00_get_port_database()
2040 if (!fcport->query) in qla2x00_get_port_database()
2044 if (fcport->loop_id == FC_NO_LOOP_ID || in qla2x00_get_port_database()
2045 (memcmp(fcport->port_name, (uint8_t *)&zero, 8) && in qla2x00_get_port_database()
2046 memcmp(fcport->port_name, pd24->port_name, 8))) { in qla2x00_get_port_database()
2052 /* Names are little-endian. */ in qla2x00_get_port_database()
2053 memcpy(fcport->node_name, pd24->node_name, WWN_SIZE); in qla2x00_get_port_database()
2054 memcpy(fcport->port_name, pd24->port_name, WWN_SIZE); in qla2x00_get_port_database()
2057 fcport->d_id.b.domain = pd24->port_id[0]; in qla2x00_get_port_database()
2058 fcport->d_id.b.area = pd24->port_id[1]; in qla2x00_get_port_database()
2059 fcport->d_id.b.al_pa = pd24->port_id[2]; in qla2x00_get_port_database()
2060 fcport->d_id.b.rsvd_1 = 0; in qla2x00_get_port_database()
2063 if ((pd24->prli_svc_param_word_3[0] & BIT_4) == 0) in qla2x00_get_port_database()
2064 fcport->port_type = FCT_INITIATOR; in qla2x00_get_port_database()
2066 fcport->port_type = FCT_TARGET; in qla2x00_get_port_database()
2069 fcport->supported_classes = (pd24->flags & PDF_CLASS_2) ? in qla2x00_get_port_database()
2072 if (pd24->prli_svc_param_word_3[0] & BIT_7) in qla2x00_get_port_database()
2073 fcport->flags |= FCF_CONF_COMP_SUPPORTED; in qla2x00_get_port_database()
2078 if (pd->master_state != PD_STATE_PORT_LOGGED_IN && in qla2x00_get_port_database()
2079 pd->slave_state != PD_STATE_PORT_LOGGED_IN) { in qla2x00_get_port_database()
2081 "Unable to verify login-state (%x/%x) - " in qla2x00_get_port_database()
2082 "portid=%02x%02x%02x.\n", pd->master_state, in qla2x00_get_port_database()
2083 pd->slave_state, fcport->d_id.b.domain, in qla2x00_get_port_database()
2084 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_get_port_database()
2089 if (fcport->loop_id == FC_NO_LOOP_ID || in qla2x00_get_port_database()
2090 (memcmp(fcport->port_name, (uint8_t *)&zero, 8) && in qla2x00_get_port_database()
2091 memcmp(fcport->port_name, pd->port_name, 8))) { in qla2x00_get_port_database()
2097 /* Names are little-endian. */ in qla2x00_get_port_database()
2098 memcpy(fcport->node_name, pd->node_name, WWN_SIZE); in qla2x00_get_port_database()
2099 memcpy(fcport->port_name, pd->port_name, WWN_SIZE); in qla2x00_get_port_database()
2102 fcport->d_id.b.domain = pd->port_id[0]; in qla2x00_get_port_database()
2103 fcport->d_id.b.area = pd->port_id[3]; in qla2x00_get_port_database()
2104 fcport->d_id.b.al_pa = pd->port_id[2]; in qla2x00_get_port_database()
2105 fcport->d_id.b.rsvd_1 = 0; in qla2x00_get_port_database()
2108 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) in qla2x00_get_port_database()
2109 fcport->port_type = FCT_INITIATOR; in qla2x00_get_port_database()
2111 fcport->port_type = FCT_TARGET; in qla2x00_get_port_database()
2114 fcport->supported_classes = (pd->options & BIT_4) ? in qla2x00_get_port_database()
2119 dma_pool_free(ha->s_dma_pool, pd, pd_dma); in qla2x00_get_port_database()
2120 fcport->query = 0; in qla2x00_get_port_database()
2125 mcp->mb[0], mcp->mb[1]); in qla2x00_get_port_database()
2148 pdb_dma = dma_map_single(&vha->hw->pdev->dev, pdb, in qla24xx_get_port_database()
2155 mcp->mb[0] = MBC_GET_PORT_DATABASE; in qla24xx_get_port_database()
2156 mcp->mb[1] = nport_handle; in qla24xx_get_port_database()
2157 mcp->mb[2] = MSW(LSD(pdb_dma)); in qla24xx_get_port_database()
2158 mcp->mb[3] = LSW(LSD(pdb_dma)); in qla24xx_get_port_database()
2159 mcp->mb[6] = MSW(MSD(pdb_dma)); in qla24xx_get_port_database()
2160 mcp->mb[7] = LSW(MSD(pdb_dma)); in qla24xx_get_port_database()
2161 mcp->mb[9] = 0; in qla24xx_get_port_database()
2162 mcp->mb[10] = 0; in qla24xx_get_port_database()
2163 mcp->out_mb = MBX_10|MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_get_port_database()
2164 mcp->in_mb = MBX_1|MBX_0; in qla24xx_get_port_database()
2165 mcp->buf_size = sizeof(*pdb); in qla24xx_get_port_database()
2166 mcp->flags = MBX_DMA_IN; in qla24xx_get_port_database()
2167 mcp->tov = vha->hw->login_timeout * 2; in qla24xx_get_port_database()
2173 rval, mcp->mb[0], mcp->mb[1]); in qla24xx_get_port_database()
2179 dma_unmap_single(&vha->hw->pdev->dev, pdb_dma, in qla24xx_get_port_database()
2207 struct qla_hw_data *ha = vha->hw; in qla2x00_get_firmware_state()
2212 if (!ha->flags.fw_started) in qla2x00_get_firmware_state()
2215 mcp->mb[0] = MBC_GET_FIRMWARE_STATE; in qla2x00_get_firmware_state()
2216 mcp->out_mb = MBX_0; in qla2x00_get_firmware_state()
2217 if (IS_FWI2_CAPABLE(vha->hw)) in qla2x00_get_firmware_state()
2218 mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_firmware_state()
2220 mcp->in_mb = MBX_1|MBX_0; in qla2x00_get_firmware_state()
2221 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_firmware_state()
2222 mcp->flags = 0; in qla2x00_get_firmware_state()
2226 states[0] = mcp->mb[1]; in qla2x00_get_firmware_state()
2227 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_get_firmware_state()
2228 states[1] = mcp->mb[2]; in qla2x00_get_firmware_state()
2229 states[2] = mcp->mb[3]; /* SFP info */ in qla2x00_get_firmware_state()
2230 states[3] = mcp->mb[4]; in qla2x00_get_firmware_state()
2231 states[4] = mcp->mb[5]; in qla2x00_get_firmware_state()
2232 states[5] = mcp->mb[6]; /* DPORT status */ in qla2x00_get_firmware_state()
2240 if (mcp->mb[2] == 6 || mcp->mb[3] == 2) in qla2x00_get_firmware_state()
2280 mcp->mb[0] = MBC_GET_PORT_NAME; in qla2x00_get_port_name()
2281 mcp->mb[9] = vha->vp_idx; in qla2x00_get_port_name()
2282 mcp->out_mb = MBX_9|MBX_1|MBX_0; in qla2x00_get_port_name()
2283 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_get_port_name()
2284 mcp->mb[1] = loop_id; in qla2x00_get_port_name()
2285 mcp->mb[10] = opt; in qla2x00_get_port_name()
2286 mcp->out_mb |= MBX_10; in qla2x00_get_port_name()
2288 mcp->mb[1] = loop_id << 8 | opt; in qla2x00_get_port_name()
2291 mcp->in_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_port_name()
2292 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_port_name()
2293 mcp->flags = 0; in qla2x00_get_port_name()
2302 name[0] = MSB(mcp->mb[2]); in qla2x00_get_port_name()
2303 name[1] = LSB(mcp->mb[2]); in qla2x00_get_port_name()
2304 name[2] = MSB(mcp->mb[3]); in qla2x00_get_port_name()
2305 name[3] = LSB(mcp->mb[3]); in qla2x00_get_port_name()
2306 name[4] = MSB(mcp->mb[6]); in qla2x00_get_port_name()
2307 name[5] = LSB(mcp->mb[6]); in qla2x00_get_port_name()
2308 name[6] = MSB(mcp->mb[7]); in qla2x00_get_port_name()
2309 name[7] = LSB(mcp->mb[7]); in qla2x00_get_port_name()
2344 if (!IS_FWI2_CAPABLE(vha->hw) || IS_CNA_CAPABLE(vha->hw)) in qla24xx_link_initialize()
2347 mcp->mb[0] = MBC_LINK_INITIALIZATION; in qla24xx_link_initialize()
2348 mcp->mb[1] = BIT_4; in qla24xx_link_initialize()
2349 if (vha->hw->operating_mode == LOOP) in qla24xx_link_initialize()
2350 mcp->mb[1] |= BIT_6; in qla24xx_link_initialize()
2352 mcp->mb[1] |= BIT_5; in qla24xx_link_initialize()
2353 mcp->mb[2] = 0; in qla24xx_link_initialize()
2354 mcp->mb[3] = 0; in qla24xx_link_initialize()
2355 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_link_initialize()
2356 mcp->in_mb = MBX_0; in qla24xx_link_initialize()
2357 mcp->tov = MBX_TOV_SECONDS; in qla24xx_link_initialize()
2358 mcp->flags = 0; in qla24xx_link_initialize()
2396 if (IS_CNA_CAPABLE(vha->hw)) { in qla2x00_lip_reset()
2398 mcp->mb[0] = MBC_LIP_FULL_LOGIN; in qla2x00_lip_reset()
2399 mcp->mb[1] = BIT_1; in qla2x00_lip_reset()
2400 mcp->mb[2] = 0; in qla2x00_lip_reset()
2401 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_lip_reset()
2402 } else if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_lip_reset()
2403 mcp->mb[0] = MBC_LIP_FULL_LOGIN; in qla2x00_lip_reset()
2404 mcp->mb[1] = BIT_4; in qla2x00_lip_reset()
2405 mcp->mb[2] = 0; in qla2x00_lip_reset()
2406 mcp->mb[3] = vha->hw->loop_reset_delay; in qla2x00_lip_reset()
2407 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_lip_reset()
2409 mcp->mb[0] = MBC_LIP_RESET; in qla2x00_lip_reset()
2410 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_lip_reset()
2411 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_lip_reset()
2412 mcp->mb[1] = 0x00ff; in qla2x00_lip_reset()
2413 mcp->mb[10] = 0; in qla2x00_lip_reset()
2414 mcp->out_mb |= MBX_10; in qla2x00_lip_reset()
2416 mcp->mb[1] = 0xff00; in qla2x00_lip_reset()
2418 mcp->mb[2] = vha->hw->loop_reset_delay; in qla2x00_lip_reset()
2419 mcp->mb[3] = 0; in qla2x00_lip_reset()
2421 mcp->in_mb = MBX_0; in qla2x00_lip_reset()
2422 mcp->tov = MBX_TOV_SECONDS; in qla2x00_lip_reset()
2423 mcp->flags = 0; in qla2x00_lip_reset()
2469 vha->hw->retry_count, vha->hw->login_timeout, mcp->tov); in qla2x00_send_sns()
2471 mcp->mb[0] = MBC_SEND_SNS_COMMAND; in qla2x00_send_sns()
2472 mcp->mb[1] = cmd_size; in qla2x00_send_sns()
2473 mcp->mb[2] = MSW(sns_phys_address); in qla2x00_send_sns()
2474 mcp->mb[3] = LSW(sns_phys_address); in qla2x00_send_sns()
2475 mcp->mb[6] = MSW(MSD(sns_phys_address)); in qla2x00_send_sns()
2476 mcp->mb[7] = LSW(MSD(sns_phys_address)); in qla2x00_send_sns()
2477 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_send_sns()
2478 mcp->in_mb = MBX_0|MBX_1; in qla2x00_send_sns()
2479 mcp->buf_size = buf_size; in qla2x00_send_sns()
2480 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN; in qla2x00_send_sns()
2481 mcp->tov = (vha->hw->login_timeout * 2) + (vha->hw->login_timeout / 2); in qla2x00_send_sns()
2488 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_send_sns()
2507 struct qla_hw_data *ha = vha->hw; in qla24xx_login_fabric()
2513 if (vha->vp_idx && vha->qpair) in qla24xx_login_fabric()
2514 req = vha->qpair->req; in qla24xx_login_fabric()
2516 req = ha->req_q_map[0]; in qla24xx_login_fabric()
2518 lg = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); in qla24xx_login_fabric()
2525 lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; in qla24xx_login_fabric()
2526 lg->entry_count = 1; in qla24xx_login_fabric()
2527 lg->handle = make_handle(req->id, lg->handle); in qla24xx_login_fabric()
2528 lg->nport_handle = cpu_to_le16(loop_id); in qla24xx_login_fabric()
2529 lg->control_flags = cpu_to_le16(LCF_COMMAND_PLOGI); in qla24xx_login_fabric()
2531 lg->control_flags |= cpu_to_le16(LCF_COND_PLOGI); in qla24xx_login_fabric()
2533 lg->control_flags |= cpu_to_le16(LCF_SKIP_PRLI); in qla24xx_login_fabric()
2534 lg->port_id[0] = al_pa; in qla24xx_login_fabric()
2535 lg->port_id[1] = area; in qla24xx_login_fabric()
2536 lg->port_id[2] = domain; in qla24xx_login_fabric()
2537 lg->vp_index = vha->vp_idx; in qla24xx_login_fabric()
2539 (ha->r_a_tov / 10 * 2) + 2); in qla24xx_login_fabric()
2543 } else if (lg->entry_status != 0) { in qla24xx_login_fabric()
2545 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_login_fabric()
2546 lg->entry_status); in qla24xx_login_fabric()
2548 } else if (lg->comp_status != cpu_to_le16(CS_COMPLETE)) { in qla24xx_login_fabric()
2549 iop[0] = le32_to_cpu(lg->io_parameter[0]); in qla24xx_login_fabric()
2550 iop[1] = le32_to_cpu(lg->io_parameter[1]); in qla24xx_login_fabric()
2553 "Failed to complete IOCB -- completion status (%x) " in qla24xx_login_fabric()
2554 "ioparam=%x/%x.\n", le16_to_cpu(lg->comp_status), in qla24xx_login_fabric()
2586 iop[0] = le32_to_cpu(lg->io_parameter[0]); in qla24xx_login_fabric()
2598 if (lg->io_parameter[7] || lg->io_parameter[8]) in qla24xx_login_fabric()
2600 if (lg->io_parameter[9] || lg->io_parameter[10]) in qla24xx_login_fabric()
2602 if (lg->io_parameter[0] & cpu_to_le32(BIT_7)) in qla24xx_login_fabric()
2608 dma_pool_free(ha->s_dma_pool, lg, lg_dma); in qla24xx_login_fabric()
2641 struct qla_hw_data *ha = vha->hw; in qla2x00_login_fabric()
2646 mcp->mb[0] = MBC_LOGIN_FABRIC_PORT; in qla2x00_login_fabric()
2647 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_login_fabric()
2649 mcp->mb[1] = loop_id; in qla2x00_login_fabric()
2650 mcp->mb[10] = opt; in qla2x00_login_fabric()
2651 mcp->out_mb |= MBX_10; in qla2x00_login_fabric()
2653 mcp->mb[1] = (loop_id << 8) | opt; in qla2x00_login_fabric()
2655 mcp->mb[2] = domain; in qla2x00_login_fabric()
2656 mcp->mb[3] = area << 8 | al_pa; in qla2x00_login_fabric()
2658 mcp->in_mb = MBX_7|MBX_6|MBX_2|MBX_1|MBX_0; in qla2x00_login_fabric()
2659 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_login_fabric()
2660 mcp->flags = 0; in qla2x00_login_fabric()
2665 mb[0] = mcp->mb[0]; in qla2x00_login_fabric()
2666 mb[1] = mcp->mb[1]; in qla2x00_login_fabric()
2667 mb[2] = mcp->mb[2]; in qla2x00_login_fabric()
2668 mb[6] = mcp->mb[6]; in qla2x00_login_fabric()
2669 mb[7] = mcp->mb[7]; in qla2x00_login_fabric()
2670 /* COS retrieved from Get-Port-Database mailbox command. */ in qla2x00_login_fabric()
2681 if (mcp->mb[0] == 0x4001 || mcp->mb[0] == 0x4002 || in qla2x00_login_fabric()
2682 mcp->mb[0] == 0x4003 || mcp->mb[0] == 0x4005 || in qla2x00_login_fabric()
2683 mcp->mb[0] == 0x4006) in qla2x00_login_fabric()
2689 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla2x00_login_fabric()
2722 struct qla_hw_data *ha = vha->hw; in qla2x00_login_local_device()
2728 return qla24xx_login_fabric(vha, fcport->loop_id, in qla2x00_login_local_device()
2729 fcport->d_id.b.domain, fcport->d_id.b.area, in qla2x00_login_local_device()
2730 fcport->d_id.b.al_pa, mb_ret, opt); in qla2x00_login_local_device()
2732 mcp->mb[0] = MBC_LOGIN_LOOP_PORT; in qla2x00_login_local_device()
2734 mcp->mb[1] = fcport->loop_id; in qla2x00_login_local_device()
2736 mcp->mb[1] = fcport->loop_id << 8; in qla2x00_login_local_device()
2737 mcp->mb[2] = opt; in qla2x00_login_local_device()
2738 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_login_local_device()
2739 mcp->in_mb = MBX_7|MBX_6|MBX_1|MBX_0; in qla2x00_login_local_device()
2740 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_login_local_device()
2741 mcp->flags = 0; in qla2x00_login_local_device()
2746 mb_ret[0] = mcp->mb[0]; in qla2x00_login_local_device()
2747 mb_ret[1] = mcp->mb[1]; in qla2x00_login_local_device()
2748 mb_ret[6] = mcp->mb[6]; in qla2x00_login_local_device()
2749 mb_ret[7] = mcp->mb[7]; in qla2x00_login_local_device()
2759 if (mcp->mb[0] == 0x4005 || mcp->mb[0] == 0x4006) in qla2x00_login_local_device()
2764 rval, mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]); in qla2x00_login_local_device()
2781 struct qla_hw_data *ha = vha->hw; in qla24xx_fabric_logout()
2787 lg = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); in qla24xx_fabric_logout()
2794 req = vha->req; in qla24xx_fabric_logout()
2795 lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; in qla24xx_fabric_logout()
2796 lg->entry_count = 1; in qla24xx_fabric_logout()
2797 lg->handle = make_handle(req->id, lg->handle); in qla24xx_fabric_logout()
2798 lg->nport_handle = cpu_to_le16(loop_id); in qla24xx_fabric_logout()
2799 lg->control_flags = in qla24xx_fabric_logout()
2802 lg->port_id[0] = al_pa; in qla24xx_fabric_logout()
2803 lg->port_id[1] = area; in qla24xx_fabric_logout()
2804 lg->port_id[2] = domain; in qla24xx_fabric_logout()
2805 lg->vp_index = vha->vp_idx; in qla24xx_fabric_logout()
2807 (ha->r_a_tov / 10 * 2) + 2); in qla24xx_fabric_logout()
2811 } else if (lg->entry_status != 0) { in qla24xx_fabric_logout()
2813 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_fabric_logout()
2814 lg->entry_status); in qla24xx_fabric_logout()
2816 } else if (lg->comp_status != cpu_to_le16(CS_COMPLETE)) { in qla24xx_fabric_logout()
2818 "Failed to complete IOCB -- completion status (%x) " in qla24xx_fabric_logout()
2819 "ioparam=%x/%x.\n", le16_to_cpu(lg->comp_status), in qla24xx_fabric_logout()
2820 le32_to_cpu(lg->io_parameter[0]), in qla24xx_fabric_logout()
2821 le32_to_cpu(lg->io_parameter[1])); in qla24xx_fabric_logout()
2828 dma_pool_free(ha->s_dma_pool, lg, lg_dma); in qla24xx_fabric_logout()
2860 mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT; in qla2x00_fabric_logout()
2861 mcp->out_mb = MBX_1|MBX_0; in qla2x00_fabric_logout()
2862 if (HAS_EXTENDED_IDS(vha->hw)) { in qla2x00_fabric_logout()
2863 mcp->mb[1] = loop_id; in qla2x00_fabric_logout()
2864 mcp->mb[10] = 0; in qla2x00_fabric_logout()
2865 mcp->out_mb |= MBX_10; in qla2x00_fabric_logout()
2867 mcp->mb[1] = loop_id << 8; in qla2x00_fabric_logout()
2870 mcp->in_mb = MBX_1|MBX_0; in qla2x00_fabric_logout()
2871 mcp->tov = MBX_TOV_SECONDS; in qla2x00_fabric_logout()
2872 mcp->flags = 0; in qla2x00_fabric_logout()
2878 "Failed=%x mb[1]=%x.\n", rval, mcp->mb[1]); in qla2x00_fabric_logout()
2913 mcp->mb[0] = MBC_LIP_FULL_LOGIN; in qla2x00_full_login_lip()
2914 mcp->mb[1] = IS_FWI2_CAPABLE(vha->hw) ? BIT_4 : 0; in qla2x00_full_login_lip()
2915 mcp->mb[2] = 0; in qla2x00_full_login_lip()
2916 mcp->mb[3] = 0; in qla2x00_full_login_lip()
2917 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_full_login_lip()
2918 mcp->in_mb = MBX_0; in qla2x00_full_login_lip()
2919 mcp->tov = MBX_TOV_SECONDS; in qla2x00_full_login_lip()
2920 mcp->flags = 0; in qla2x00_full_login_lip()
2961 mcp->mb[0] = MBC_GET_ID_LIST; in qla2x00_get_id_list()
2962 mcp->out_mb = MBX_0; in qla2x00_get_id_list()
2963 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_get_id_list()
2964 mcp->mb[2] = MSW(id_list_dma); in qla2x00_get_id_list()
2965 mcp->mb[3] = LSW(id_list_dma); in qla2x00_get_id_list()
2966 mcp->mb[6] = MSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2967 mcp->mb[7] = LSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2968 mcp->mb[8] = 0; in qla2x00_get_id_list()
2969 mcp->mb[9] = vha->vp_idx; in qla2x00_get_id_list()
2970 mcp->out_mb |= MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2; in qla2x00_get_id_list()
2972 mcp->mb[1] = MSW(id_list_dma); in qla2x00_get_id_list()
2973 mcp->mb[2] = LSW(id_list_dma); in qla2x00_get_id_list()
2974 mcp->mb[3] = MSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2975 mcp->mb[6] = LSW(MSD(id_list_dma)); in qla2x00_get_id_list()
2976 mcp->out_mb |= MBX_6|MBX_3|MBX_2|MBX_1; in qla2x00_get_id_list()
2978 mcp->in_mb = MBX_1|MBX_0; in qla2x00_get_id_list()
2979 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_id_list()
2980 mcp->flags = 0; in qla2x00_get_id_list()
2987 *entries = mcp->mb[1]; in qla2x00_get_id_list()
3011 struct qla_hw_data *ha = vha->hw; in qla2x00_get_resource_cnts()
3019 mcp->mb[0] = MBC_GET_RESOURCE_COUNTS; in qla2x00_get_resource_cnts()
3020 mcp->out_mb = MBX_0; in qla2x00_get_resource_cnts()
3021 mcp->in_mb = MBX_11|MBX_10|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_resource_cnts()
3024 mcp->in_mb |= MBX_12; in qla2x00_get_resource_cnts()
3025 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_resource_cnts()
3026 mcp->flags = 0; in qla2x00_get_resource_cnts()
3032 "Failed mb[0]=%x.\n", mcp->mb[0]); in qla2x00_get_resource_cnts()
3036 "mb11=%x mb12=%x.\n", __func__, mcp->mb[1], mcp->mb[2], in qla2x00_get_resource_cnts()
3037 mcp->mb[3], mcp->mb[6], mcp->mb[7], mcp->mb[10], in qla2x00_get_resource_cnts()
3038 mcp->mb[11], mcp->mb[12]); in qla2x00_get_resource_cnts()
3040 ha->orig_fw_tgt_xcb_count = mcp->mb[1]; in qla2x00_get_resource_cnts()
3041 ha->cur_fw_tgt_xcb_count = mcp->mb[2]; in qla2x00_get_resource_cnts()
3042 ha->cur_fw_xcb_count = mcp->mb[3]; in qla2x00_get_resource_cnts()
3043 ha->orig_fw_xcb_count = mcp->mb[6]; in qla2x00_get_resource_cnts()
3044 ha->cur_fw_iocb_count = mcp->mb[7]; in qla2x00_get_resource_cnts()
3045 ha->orig_fw_iocb_count = mcp->mb[10]; in qla2x00_get_resource_cnts()
3046 if (ha->flags.npiv_supported) in qla2x00_get_resource_cnts()
3047 ha->max_npiv_vports = mcp->mb[11]; in qla2x00_get_resource_cnts()
3049 ha->fw_max_fcf_count = mcp->mb[12]; in qla2x00_get_resource_cnts()
3078 struct qla_hw_data *ha = vha->hw; in qla2x00_get_fcal_position_map()
3083 pmap = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pmap_dma); in qla2x00_get_fcal_position_map()
3090 mcp->mb[0] = MBC_GET_FC_AL_POSITION_MAP; in qla2x00_get_fcal_position_map()
3091 mcp->mb[2] = MSW(pmap_dma); in qla2x00_get_fcal_position_map()
3092 mcp->mb[3] = LSW(pmap_dma); in qla2x00_get_fcal_position_map()
3093 mcp->mb[6] = MSW(MSD(pmap_dma)); in qla2x00_get_fcal_position_map()
3094 mcp->mb[7] = LSW(MSD(pmap_dma)); in qla2x00_get_fcal_position_map()
3095 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_fcal_position_map()
3096 mcp->in_mb = MBX_1|MBX_0; in qla2x00_get_fcal_position_map()
3097 mcp->buf_size = FCAL_MAP_SIZE; in qla2x00_get_fcal_position_map()
3098 mcp->flags = MBX_DMA_IN; in qla2x00_get_fcal_position_map()
3099 mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); in qla2x00_get_fcal_position_map()
3105 mcp->mb[0], mcp->mb[1], (unsigned)pmap[0]); in qla2x00_get_fcal_position_map()
3114 dma_pool_free(ha->s_dma_pool, pmap, pmap_dma); in qla2x00_get_fcal_position_map()
3148 struct qla_hw_data *ha = vha->hw; in qla2x00_get_link_status()
3153 mcp->mb[0] = MBC_GET_LINK_STATUS; in qla2x00_get_link_status()
3154 mcp->mb[2] = MSW(LSD(stats_dma)); in qla2x00_get_link_status()
3155 mcp->mb[3] = LSW(LSD(stats_dma)); in qla2x00_get_link_status()
3156 mcp->mb[6] = MSW(MSD(stats_dma)); in qla2x00_get_link_status()
3157 mcp->mb[7] = LSW(MSD(stats_dma)); in qla2x00_get_link_status()
3158 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_link_status()
3159 mcp->in_mb = MBX_0; in qla2x00_get_link_status()
3161 mcp->mb[1] = loop_id; in qla2x00_get_link_status()
3162 mcp->mb[4] = 0; in qla2x00_get_link_status()
3163 mcp->mb[10] = 0; in qla2x00_get_link_status()
3164 mcp->out_mb |= MBX_10|MBX_4|MBX_1; in qla2x00_get_link_status()
3165 mcp->in_mb |= MBX_1; in qla2x00_get_link_status()
3167 mcp->mb[1] = loop_id; in qla2x00_get_link_status()
3168 mcp->mb[10] = 0; in qla2x00_get_link_status()
3169 mcp->out_mb |= MBX_10|MBX_1; in qla2x00_get_link_status()
3171 mcp->mb[1] = loop_id << 8; in qla2x00_get_link_status()
3172 mcp->out_mb |= MBX_1; in qla2x00_get_link_status()
3174 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_link_status()
3175 mcp->flags = IOCTL_CMD; in qla2x00_get_link_status()
3179 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { in qla2x00_get_link_status()
3181 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_get_link_status()
3184 /* Re-endianize - firmware data is le32. */ in qla2x00_get_link_status()
3187 for ( ; dwords--; iter++) in qla2x00_get_link_status()
3218 mc.mb[9] = vha->vp_idx; in qla24xx_get_isp_stats()
3224 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { in qla24xx_get_isp_stats()
3226 "Failed mb[0]=%x.\n", mcp->mb[0]); in qla24xx_get_isp_stats()
3231 /* Re-endianize - firmware data is le32. */ in qla24xx_get_isp_stats()
3232 for ( ; dwords--; iter++) in qla24xx_get_isp_stats()
3252 fc_port_t *fcport = sp->fcport; in qla24xx_abort_command()
3253 struct scsi_qla_host *vha = fcport->vha; in qla24xx_abort_command()
3254 struct qla_hw_data *ha = vha->hw; in qla24xx_abort_command()
3256 struct qla_qpair *qpair = sp->qpair; in qla24xx_abort_command()
3261 if (sp->qpair) in qla24xx_abort_command()
3262 req = sp->qpair->req; in qla24xx_abort_command()
3269 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla24xx_abort_command()
3270 for (handle = 1; handle < req->num_outstanding_cmds; handle++) { in qla24xx_abort_command()
3271 if (req->outstanding_cmds[handle] == sp) in qla24xx_abort_command()
3274 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla24xx_abort_command()
3275 if (handle == req->num_outstanding_cmds) { in qla24xx_abort_command()
3280 abt = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &abt_dma); in qla24xx_abort_command()
3287 abt->entry_type = ABORT_IOCB_TYPE; in qla24xx_abort_command()
3288 abt->entry_count = 1; in qla24xx_abort_command()
3289 abt->handle = make_handle(req->id, abt->handle); in qla24xx_abort_command()
3290 abt->nport_handle = cpu_to_le16(fcport->loop_id); in qla24xx_abort_command()
3291 abt->handle_to_abort = make_handle(req->id, handle); in qla24xx_abort_command()
3292 abt->port_id[0] = fcport->d_id.b.al_pa; in qla24xx_abort_command()
3293 abt->port_id[1] = fcport->d_id.b.area; in qla24xx_abort_command()
3294 abt->port_id[2] = fcport->d_id.b.domain; in qla24xx_abort_command()
3295 abt->vp_index = fcport->vha->vp_idx; in qla24xx_abort_command()
3297 abt->req_que_no = cpu_to_le16(req->id); in qla24xx_abort_command()
3305 } else if (abt->entry_status != 0) { in qla24xx_abort_command()
3307 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_abort_command()
3308 abt->entry_status); in qla24xx_abort_command()
3310 } else if (abt->nport_handle != cpu_to_le16(0)) { in qla24xx_abort_command()
3312 "Failed to complete IOCB -- completion status (%x).\n", in qla24xx_abort_command()
3313 le16_to_cpu(abt->nport_handle)); in qla24xx_abort_command()
3314 if (abt->nport_handle == cpu_to_le16(CS_IOCB_ERROR)) in qla24xx_abort_command()
3327 dma_pool_free(ha->s_dma_pool, abt, abt_dma); in qla24xx_abort_command()
3352 vha = fcport->vha; in __qla24xx_issue_tmf()
3353 ha = vha->hw; in __qla24xx_issue_tmf()
3354 req = vha->req; in __qla24xx_issue_tmf()
3359 if (vha->vp_idx && vha->qpair) { in __qla24xx_issue_tmf()
3361 qpair = vha->qpair; in __qla24xx_issue_tmf()
3362 req = qpair->req; in __qla24xx_issue_tmf()
3365 tsk = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma); in __qla24xx_issue_tmf()
3372 tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE; in __qla24xx_issue_tmf()
3373 tsk->p.tsk.entry_count = 1; in __qla24xx_issue_tmf()
3374 tsk->p.tsk.handle = make_handle(req->id, tsk->p.tsk.handle); in __qla24xx_issue_tmf()
3375 tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id); in __qla24xx_issue_tmf()
3376 tsk->p.tsk.timeout = cpu_to_le16(ha->r_a_tov / 10 * 2); in __qla24xx_issue_tmf()
3377 tsk->p.tsk.control_flags = cpu_to_le32(type); in __qla24xx_issue_tmf()
3378 tsk->p.tsk.port_id[0] = fcport->d_id.b.al_pa; in __qla24xx_issue_tmf()
3379 tsk->p.tsk.port_id[1] = fcport->d_id.b.area; in __qla24xx_issue_tmf()
3380 tsk->p.tsk.port_id[2] = fcport->d_id.b.domain; in __qla24xx_issue_tmf()
3381 tsk->p.tsk.vp_index = fcport->vha->vp_idx; in __qla24xx_issue_tmf()
3383 int_to_scsilun(l, &tsk->p.tsk.lun); in __qla24xx_issue_tmf()
3384 host_to_fcp_swap((uint8_t *)&tsk->p.tsk.lun, in __qla24xx_issue_tmf()
3385 sizeof(tsk->p.tsk.lun)); in __qla24xx_issue_tmf()
3388 sts = &tsk->p.sts; in __qla24xx_issue_tmf()
3393 } else if (sts->entry_status != 0) { in __qla24xx_issue_tmf()
3395 "Failed to complete IOCB -- error status (%x).\n", in __qla24xx_issue_tmf()
3396 sts->entry_status); in __qla24xx_issue_tmf()
3398 } else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) { in __qla24xx_issue_tmf()
3400 "Failed to complete IOCB -- completion status (%x).\n", in __qla24xx_issue_tmf()
3401 le16_to_cpu(sts->comp_status)); in __qla24xx_issue_tmf()
3403 } else if (le16_to_cpu(sts->scsi_status) & in __qla24xx_issue_tmf()
3405 if (le32_to_cpu(sts->rsp_data_len) < 4) { in __qla24xx_issue_tmf()
3407 "Ignoring inconsistent data length -- not enough " in __qla24xx_issue_tmf()
3409 le32_to_cpu(sts->rsp_data_len)); in __qla24xx_issue_tmf()
3410 } else if (sts->data[3]) { in __qla24xx_issue_tmf()
3412 "Failed to complete IOCB -- response (%x).\n", in __qla24xx_issue_tmf()
3413 sts->data[3]); in __qla24xx_issue_tmf()
3419 rval2 = qla2x00_marker(vha, ha->base_qpair, fcport->loop_id, l, in __qla24xx_issue_tmf()
3429 dma_pool_free(ha->s_dma_pool, tsk, tsk_dma); in __qla24xx_issue_tmf()
3437 struct qla_hw_data *ha = fcport->vha->hw; in qla24xx_abort_target()
3448 struct qla_hw_data *ha = fcport->vha->hw; in qla24xx_lun_reset()
3462 struct qla_hw_data *ha = vha->hw; in qla2x00_system_error()
3470 mcp->mb[0] = MBC_GEN_SYSTEM_ERROR; in qla2x00_system_error()
3471 mcp->out_mb = MBX_0; in qla2x00_system_error()
3472 mcp->in_mb = MBX_0; in qla2x00_system_error()
3473 mcp->tov = 5; in qla2x00_system_error()
3474 mcp->flags = 0; in qla2x00_system_error()
3494 if (!IS_QLA25XX(vha->hw) && !IS_QLA2031(vha->hw) && in qla2x00_write_serdes_word()
3495 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla2x00_write_serdes_word()
3501 mcp->mb[0] = MBC_WRITE_SERDES; in qla2x00_write_serdes_word()
3502 mcp->mb[1] = addr; in qla2x00_write_serdes_word()
3503 if (IS_QLA2031(vha->hw)) in qla2x00_write_serdes_word()
3504 mcp->mb[2] = data & 0xff; in qla2x00_write_serdes_word()
3506 mcp->mb[2] = data; in qla2x00_write_serdes_word()
3508 mcp->mb[3] = 0; in qla2x00_write_serdes_word()
3509 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_write_serdes_word()
3510 mcp->in_mb = MBX_0; in qla2x00_write_serdes_word()
3511 mcp->tov = MBX_TOV_SECONDS; in qla2x00_write_serdes_word()
3512 mcp->flags = 0; in qla2x00_write_serdes_word()
3517 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_write_serdes_word()
3533 if (!IS_QLA25XX(vha->hw) && !IS_QLA2031(vha->hw) && in qla2x00_read_serdes_word()
3534 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla2x00_read_serdes_word()
3540 mcp->mb[0] = MBC_READ_SERDES; in qla2x00_read_serdes_word()
3541 mcp->mb[1] = addr; in qla2x00_read_serdes_word()
3542 mcp->mb[3] = 0; in qla2x00_read_serdes_word()
3543 mcp->out_mb = MBX_3|MBX_1|MBX_0; in qla2x00_read_serdes_word()
3544 mcp->in_mb = MBX_1|MBX_0; in qla2x00_read_serdes_word()
3545 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_serdes_word()
3546 mcp->flags = 0; in qla2x00_read_serdes_word()
3549 if (IS_QLA2031(vha->hw)) in qla2x00_read_serdes_word()
3550 *data = mcp->mb[1] & 0xff; in qla2x00_read_serdes_word()
3552 *data = mcp->mb[1]; in qla2x00_read_serdes_word()
3556 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_read_serdes_word()
3572 if (!IS_QLA8044(vha->hw)) in qla8044_write_serdes_word()
3578 mcp->mb[0] = MBC_SET_GET_ETH_SERDES_REG; in qla8044_write_serdes_word()
3579 mcp->mb[1] = HCS_WRITE_SERDES; in qla8044_write_serdes_word()
3580 mcp->mb[3] = LSW(addr); in qla8044_write_serdes_word()
3581 mcp->mb[4] = MSW(addr); in qla8044_write_serdes_word()
3582 mcp->mb[5] = LSW(data); in qla8044_write_serdes_word()
3583 mcp->mb[6] = MSW(data); in qla8044_write_serdes_word()
3584 mcp->out_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; in qla8044_write_serdes_word()
3585 mcp->in_mb = MBX_0; in qla8044_write_serdes_word()
3586 mcp->tov = MBX_TOV_SECONDS; in qla8044_write_serdes_word()
3587 mcp->flags = 0; in qla8044_write_serdes_word()
3592 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla8044_write_serdes_word()
3608 if (!IS_QLA8044(vha->hw)) in qla8044_read_serdes_word()
3614 mcp->mb[0] = MBC_SET_GET_ETH_SERDES_REG; in qla8044_read_serdes_word()
3615 mcp->mb[1] = HCS_READ_SERDES; in qla8044_read_serdes_word()
3616 mcp->mb[3] = LSW(addr); in qla8044_read_serdes_word()
3617 mcp->mb[4] = MSW(addr); in qla8044_read_serdes_word()
3618 mcp->out_mb = MBX_4|MBX_3|MBX_1|MBX_0; in qla8044_read_serdes_word()
3619 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla8044_read_serdes_word()
3620 mcp->tov = MBX_TOV_SECONDS; in qla8044_read_serdes_word()
3621 mcp->flags = 0; in qla8044_read_serdes_word()
3624 *data = mcp->mb[2] << 16 | mcp->mb[1]; in qla8044_read_serdes_word()
3628 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla8044_read_serdes_word()
3638 * qla2x00_set_serdes_params() -
3657 mcp->mb[0] = MBC_SERDES_PARAMS; in qla2x00_set_serdes_params()
3658 mcp->mb[1] = BIT_0; in qla2x00_set_serdes_params()
3659 mcp->mb[2] = sw_em_1g | BIT_15; in qla2x00_set_serdes_params()
3660 mcp->mb[3] = sw_em_2g | BIT_15; in qla2x00_set_serdes_params()
3661 mcp->mb[4] = sw_em_4g | BIT_15; in qla2x00_set_serdes_params()
3662 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_set_serdes_params()
3663 mcp->in_mb = MBX_0; in qla2x00_set_serdes_params()
3664 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_serdes_params()
3665 mcp->flags = 0; in qla2x00_set_serdes_params()
3671 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_set_serdes_params()
3688 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_stop_firmware()
3694 mcp->mb[0] = MBC_STOP_FIRMWARE; in qla2x00_stop_firmware()
3695 mcp->mb[1] = 0; in qla2x00_stop_firmware()
3696 mcp->out_mb = MBX_1|MBX_0; in qla2x00_stop_firmware()
3697 mcp->in_mb = MBX_0; in qla2x00_stop_firmware()
3698 mcp->tov = 5; in qla2x00_stop_firmware()
3699 mcp->flags = 0; in qla2x00_stop_firmware()
3704 if (mcp->mb[0] == MBS_INVALID_COMMAND) in qla2x00_stop_firmware()
3725 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_enable_eft_trace()
3728 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_enable_eft_trace()
3731 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_enable_eft_trace()
3732 mcp->mb[1] = TC_EFT_ENABLE; in qla2x00_enable_eft_trace()
3733 mcp->mb[2] = LSW(eft_dma); in qla2x00_enable_eft_trace()
3734 mcp->mb[3] = MSW(eft_dma); in qla2x00_enable_eft_trace()
3735 mcp->mb[4] = LSW(MSD(eft_dma)); in qla2x00_enable_eft_trace()
3736 mcp->mb[5] = MSW(MSD(eft_dma)); in qla2x00_enable_eft_trace()
3737 mcp->mb[6] = buffers; in qla2x00_enable_eft_trace()
3738 mcp->mb[7] = TC_AEN_DISABLE; in qla2x00_enable_eft_trace()
3739 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_enable_eft_trace()
3740 mcp->in_mb = MBX_1|MBX_0; in qla2x00_enable_eft_trace()
3741 mcp->tov = MBX_TOV_SECONDS; in qla2x00_enable_eft_trace()
3742 mcp->flags = 0; in qla2x00_enable_eft_trace()
3747 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_enable_eft_trace()
3766 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_disable_eft_trace()
3769 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_disable_eft_trace()
3772 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_disable_eft_trace()
3773 mcp->mb[1] = TC_EFT_DISABLE; in qla2x00_disable_eft_trace()
3774 mcp->out_mb = MBX_1|MBX_0; in qla2x00_disable_eft_trace()
3775 mcp->in_mb = MBX_1|MBX_0; in qla2x00_disable_eft_trace()
3776 mcp->tov = MBX_TOV_SECONDS; in qla2x00_disable_eft_trace()
3777 mcp->flags = 0; in qla2x00_disable_eft_trace()
3782 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_disable_eft_trace()
3802 if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw) && in qla2x00_enable_fce_trace()
3803 !IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw) && in qla2x00_enable_fce_trace()
3804 !IS_QLA28XX(vha->hw)) in qla2x00_enable_fce_trace()
3807 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_enable_fce_trace()
3810 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_enable_fce_trace()
3811 mcp->mb[1] = TC_FCE_ENABLE; in qla2x00_enable_fce_trace()
3812 mcp->mb[2] = LSW(fce_dma); in qla2x00_enable_fce_trace()
3813 mcp->mb[3] = MSW(fce_dma); in qla2x00_enable_fce_trace()
3814 mcp->mb[4] = LSW(MSD(fce_dma)); in qla2x00_enable_fce_trace()
3815 mcp->mb[5] = MSW(MSD(fce_dma)); in qla2x00_enable_fce_trace()
3816 mcp->mb[6] = buffers; in qla2x00_enable_fce_trace()
3817 mcp->mb[7] = TC_AEN_DISABLE; in qla2x00_enable_fce_trace()
3818 mcp->mb[8] = 0; in qla2x00_enable_fce_trace()
3819 mcp->mb[9] = TC_FCE_DEFAULT_RX_SIZE; in qla2x00_enable_fce_trace()
3820 mcp->mb[10] = TC_FCE_DEFAULT_TX_SIZE; in qla2x00_enable_fce_trace()
3821 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()
3823 mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_enable_fce_trace()
3824 mcp->tov = MBX_TOV_SECONDS; in qla2x00_enable_fce_trace()
3825 mcp->flags = 0; in qla2x00_enable_fce_trace()
3830 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_enable_fce_trace()
3836 memcpy(mb, mcp->mb, 8 * sizeof(*mb)); in qla2x00_enable_fce_trace()
3854 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_disable_fce_trace()
3857 if (unlikely(pci_channel_offline(vha->hw->pdev))) in qla2x00_disable_fce_trace()
3860 mcp->mb[0] = MBC_TRACE_CONTROL; in qla2x00_disable_fce_trace()
3861 mcp->mb[1] = TC_FCE_DISABLE; in qla2x00_disable_fce_trace()
3862 mcp->mb[2] = TC_FCE_DISABLE_TRACE; in qla2x00_disable_fce_trace()
3863 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_disable_fce_trace()
3864 mcp->in_mb = MBX_9|MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2| in qla2x00_disable_fce_trace()
3866 mcp->tov = MBX_TOV_SECONDS; in qla2x00_disable_fce_trace()
3867 mcp->flags = 0; in qla2x00_disable_fce_trace()
3872 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_disable_fce_trace()
3878 *wr = (uint64_t) mcp->mb[5] << 48 | in qla2x00_disable_fce_trace()
3879 (uint64_t) mcp->mb[4] << 32 | in qla2x00_disable_fce_trace()
3880 (uint64_t) mcp->mb[3] << 16 | in qla2x00_disable_fce_trace()
3881 (uint64_t) mcp->mb[2]; in qla2x00_disable_fce_trace()
3883 *rd = (uint64_t) mcp->mb[9] << 48 | in qla2x00_disable_fce_trace()
3884 (uint64_t) mcp->mb[8] << 32 | in qla2x00_disable_fce_trace()
3885 (uint64_t) mcp->mb[7] << 16 | in qla2x00_disable_fce_trace()
3886 (uint64_t) mcp->mb[6]; in qla2x00_disable_fce_trace()
3903 if (!IS_IIDMA_CAPABLE(vha->hw)) in qla2x00_get_idma_speed()
3906 mcp->mb[0] = MBC_PORT_PARAMS; in qla2x00_get_idma_speed()
3907 mcp->mb[1] = loop_id; in qla2x00_get_idma_speed()
3908 mcp->mb[2] = mcp->mb[3] = 0; in qla2x00_get_idma_speed()
3909 mcp->mb[9] = vha->vp_idx; in qla2x00_get_idma_speed()
3910 mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_idma_speed()
3911 mcp->in_mb = MBX_3|MBX_1|MBX_0; in qla2x00_get_idma_speed()
3912 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_idma_speed()
3913 mcp->flags = 0; in qla2x00_get_idma_speed()
3918 mb[0] = mcp->mb[0]; in qla2x00_get_idma_speed()
3919 mb[1] = mcp->mb[1]; in qla2x00_get_idma_speed()
3920 mb[3] = mcp->mb[3]; in qla2x00_get_idma_speed()
3929 *port_speed = mcp->mb[3]; in qla2x00_get_idma_speed()
3946 if (!IS_IIDMA_CAPABLE(vha->hw)) in qla2x00_set_idma_speed()
3949 mcp->mb[0] = MBC_PORT_PARAMS; in qla2x00_set_idma_speed()
3950 mcp->mb[1] = loop_id; in qla2x00_set_idma_speed()
3951 mcp->mb[2] = BIT_0; in qla2x00_set_idma_speed()
3952 mcp->mb[3] = port_speed & 0x3F; in qla2x00_set_idma_speed()
3953 mcp->mb[9] = vha->vp_idx; in qla2x00_set_idma_speed()
3954 mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_set_idma_speed()
3955 mcp->in_mb = MBX_3|MBX_1|MBX_0; in qla2x00_set_idma_speed()
3956 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_idma_speed()
3957 mcp->flags = 0; in qla2x00_set_idma_speed()
3962 mb[0] = mcp->mb[0]; in qla2x00_set_idma_speed()
3963 mb[1] = mcp->mb[1]; in qla2x00_set_idma_speed()
3964 mb[3] = mcp->mb[3]; in qla2x00_set_idma_speed()
3982 struct qla_hw_data *ha = vha->hw; in qla24xx_report_id_acquisition()
3992 if (rptid_entry->entry_status != 0) in qla24xx_report_id_acquisition()
3995 id.b.domain = rptid_entry->port_id[2]; in qla24xx_report_id_acquisition()
3996 id.b.area = rptid_entry->port_id[1]; in qla24xx_report_id_acquisition()
3997 id.b.al_pa = rptid_entry->port_id[0]; in qla24xx_report_id_acquisition()
3999 ha->flags.n2n_ae = 0; in qla24xx_report_id_acquisition()
4001 if (rptid_entry->format == 0) { in qla24xx_report_id_acquisition()
4005 "VPs acquired %d.\n", rptid_entry->vp_setup, in qla24xx_report_id_acquisition()
4006 rptid_entry->vp_acquired); in qla24xx_report_id_acquisition()
4009 rptid_entry->port_id[2], rptid_entry->port_id[1], in qla24xx_report_id_acquisition()
4010 rptid_entry->port_id[0]); in qla24xx_report_id_acquisition()
4011 ha->current_topology = ISP_CFG_NL; in qla24xx_report_id_acquisition()
4014 } else if (rptid_entry->format == 1) { in qla24xx_report_id_acquisition()
4017 "Format 1: VP[%d] enabled - status %d - with " in qla24xx_report_id_acquisition()
4018 "port id %02x%02x%02x.\n", rptid_entry->vp_idx, in qla24xx_report_id_acquisition()
4019 rptid_entry->vp_status, in qla24xx_report_id_acquisition()
4020 rptid_entry->port_id[2], rptid_entry->port_id[1], in qla24xx_report_id_acquisition()
4021 rptid_entry->port_id[0]); in qla24xx_report_id_acquisition()
4024 rptid_entry->u.f1.port_name); in qla24xx_report_id_acquisition()
4028 vha->port_name); in qla24xx_report_id_acquisition()
4030 switch (rptid_entry->u.f1.flags & TOPO_MASK) { in qla24xx_report_id_acquisition()
4032 ha->current_topology = ISP_CFG_N; in qla24xx_report_id_acquisition()
4033 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_report_id_acquisition()
4034 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla24xx_report_id_acquisition()
4035 fcport->scan_state = QLA_FCPORT_SCAN; in qla24xx_report_id_acquisition()
4036 fcport->n2n_flag = 0; in qla24xx_report_id_acquisition()
4039 if (wwn_to_u64(vha->port_name) > in qla24xx_report_id_acquisition()
4040 wwn_to_u64(rptid_entry->u.f1.port_name)) { in qla24xx_report_id_acquisition()
4041 vha->d_id.b24 = 0; in qla24xx_report_id_acquisition()
4042 vha->d_id.b.al_pa = 1; in qla24xx_report_id_acquisition()
4043 ha->flags.n2n_bigger = 1; in qla24xx_report_id_acquisition()
4048 vha->d_id.b24, id.b24); in qla24xx_report_id_acquisition()
4051 "Format 1: Remote login - Waiting for WWPN %8phC.\n", in qla24xx_report_id_acquisition()
4052 rptid_entry->u.f1.port_name); in qla24xx_report_id_acquisition()
4053 ha->flags.n2n_bigger = 0; in qla24xx_report_id_acquisition()
4057 rptid_entry->u.f1.port_name, 1); in qla24xx_report_id_acquisition()
4058 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_report_id_acquisition()
4062 fcport->plogi_nack_done_deadline = jiffies + HZ; in qla24xx_report_id_acquisition()
4063 fcport->dm_login_expire = jiffies + in qla24xx_report_id_acquisition()
4065 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_report_id_acquisition()
4066 fcport->n2n_flag = 1; in qla24xx_report_id_acquisition()
4067 fcport->keep_nport_handle = 1; in qla24xx_report_id_acquisition()
4068 fcport->login_retry = vha->hw->login_retry_count; in qla24xx_report_id_acquisition()
4069 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_report_id_acquisition()
4070 if (vha->flags.nvme_enabled) in qla24xx_report_id_acquisition()
4071 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_report_id_acquisition()
4073 if (wwn_to_u64(vha->port_name) > in qla24xx_report_id_acquisition()
4074 wwn_to_u64(fcport->port_name)) { in qla24xx_report_id_acquisition()
4075 fcport->d_id = id; in qla24xx_report_id_acquisition()
4078 switch (fcport->disc_state) { in qla24xx_report_id_acquisition()
4081 &vha->dpc_flags); in qla24xx_report_id_acquisition()
4091 rptid_entry->u.f1.port_name, in qla24xx_report_id_acquisition()
4092 rptid_entry->u.f1.node_name, in qla24xx_report_id_acquisition()
4099 set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4102 ha->current_topology = ISP_CFG_FL; in qla24xx_report_id_acquisition()
4105 ha->current_topology = ISP_CFG_F; in qla24xx_report_id_acquisition()
4111 ha->flags.gpsc_supported = 1; in qla24xx_report_id_acquisition()
4112 ha->current_topology = ISP_CFG_F; in qla24xx_report_id_acquisition()
4114 vha->flags.bbcr_enable = (rptid_entry->u.f1.bbcr & 0xf) != 0; in qla24xx_report_id_acquisition()
4116 if (rptid_entry->vp_idx == 0) { in qla24xx_report_id_acquisition()
4117 if (rptid_entry->vp_status == VP_STAT_COMPL) { in qla24xx_report_id_acquisition()
4118 /* FA-WWN is only for physical port */ in qla24xx_report_id_acquisition()
4120 ha->flags.fawwpn_enabled && in qla24xx_report_id_acquisition()
4121 (rptid_entry->u.f1.flags & in qla24xx_report_id_acquisition()
4123 memcpy(vha->port_name, in qla24xx_report_id_acquisition()
4124 rptid_entry->u.f1.port_name, in qla24xx_report_id_acquisition()
4131 set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4132 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4134 if (rptid_entry->vp_status != VP_STAT_COMPL && in qla24xx_report_id_acquisition()
4135 rptid_entry->vp_status != VP_STAT_ID_CHG) { in qla24xx_report_id_acquisition()
4138 rptid_entry->vp_idx); in qla24xx_report_id_acquisition()
4143 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4144 list_for_each_entry(vp, &ha->vp_list, list) { in qla24xx_report_id_acquisition()
4145 if (rptid_entry->vp_idx == vp->vp_idx) { in qla24xx_report_id_acquisition()
4150 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4161 set_bit(VP_IDX_ACQUIRED, &vp->vp_flags); in qla24xx_report_id_acquisition()
4162 set_bit(REGISTER_FC4_NEEDED, &vp->dpc_flags); in qla24xx_report_id_acquisition()
4163 set_bit(REGISTER_FDMI_NEEDED, &vp->dpc_flags); in qla24xx_report_id_acquisition()
4165 set_bit(VP_DPC_NEEDED, &vha->dpc_flags); in qla24xx_report_id_acquisition()
4167 } else if (rptid_entry->format == 2) { in qla24xx_report_id_acquisition()
4170 rptid_entry->port_id[2], rptid_entry->port_id[1], in qla24xx_report_id_acquisition()
4171 rptid_entry->port_id[0]); in qla24xx_report_id_acquisition()
4175 rptid_entry->u.f2.port_name); in qla24xx_report_id_acquisition()
4178 ha->current_topology = ISP_CFG_N; in qla24xx_report_id_acquisition()
4179 ha->flags.rida_fmt2 = 1; in qla24xx_report_id_acquisition()
4180 vha->d_id.b.domain = rptid_entry->port_id[2]; in qla24xx_report_id_acquisition()
4181 vha->d_id.b.area = rptid_entry->port_id[1]; in qla24xx_report_id_acquisition()
4182 vha->d_id.b.al_pa = rptid_entry->port_id[0]; in qla24xx_report_id_acquisition()
4184 ha->flags.n2n_ae = 1; in qla24xx_report_id_acquisition()
4185 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4187 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_report_id_acquisition()
4189 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla24xx_report_id_acquisition()
4190 fcport->scan_state = QLA_FCPORT_SCAN; in qla24xx_report_id_acquisition()
4191 fcport->n2n_flag = 0; in qla24xx_report_id_acquisition()
4195 rptid_entry->u.f2.port_name, 1); in qla24xx_report_id_acquisition()
4198 fcport->login_retry = vha->hw->login_retry_count; in qla24xx_report_id_acquisition()
4199 fcport->plogi_nack_done_deadline = jiffies + HZ; in qla24xx_report_id_acquisition()
4200 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_report_id_acquisition()
4201 fcport->keep_nport_handle = 1; in qla24xx_report_id_acquisition()
4202 fcport->n2n_flag = 1; in qla24xx_report_id_acquisition()
4203 fcport->d_id.b.domain = in qla24xx_report_id_acquisition()
4204 rptid_entry->u.f2.remote_nport_id[2]; in qla24xx_report_id_acquisition()
4205 fcport->d_id.b.area = in qla24xx_report_id_acquisition()
4206 rptid_entry->u.f2.remote_nport_id[1]; in qla24xx_report_id_acquisition()
4207 fcport->d_id.b.al_pa = in qla24xx_report_id_acquisition()
4208 rptid_entry->u.f2.remote_nport_id[0]; in qla24xx_report_id_acquisition()
4217 if (atomic_read(&fcport->state) == FCS_ONLINE) in qla24xx_report_id_acquisition()
4242 struct qla_hw_data *ha = vha->hw; in qla24xx_modify_vp_config()
4243 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla24xx_modify_vp_config()
4250 vpmod = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &vpmod_dma); in qla24xx_modify_vp_config()
4257 vpmod->entry_type = VP_CONFIG_IOCB_TYPE; in qla24xx_modify_vp_config()
4258 vpmod->entry_count = 1; in qla24xx_modify_vp_config()
4259 vpmod->command = VCT_COMMAND_MOD_ENABLE_VPS; in qla24xx_modify_vp_config()
4260 vpmod->vp_count = 1; in qla24xx_modify_vp_config()
4261 vpmod->vp_index1 = vha->vp_idx; in qla24xx_modify_vp_config()
4262 vpmod->options_idx1 = BIT_3|BIT_4|BIT_5; in qla24xx_modify_vp_config()
4266 memcpy(vpmod->node_name_idx1, vha->node_name, WWN_SIZE); in qla24xx_modify_vp_config()
4267 memcpy(vpmod->port_name_idx1, vha->port_name, WWN_SIZE); in qla24xx_modify_vp_config()
4268 vpmod->entry_count = 1; in qla24xx_modify_vp_config()
4274 } else if (vpmod->comp_status != 0) { in qla24xx_modify_vp_config()
4276 "Failed to complete IOCB -- error status (%x).\n", in qla24xx_modify_vp_config()
4277 vpmod->comp_status); in qla24xx_modify_vp_config()
4279 } else if (vpmod->comp_status != cpu_to_le16(CS_COMPLETE)) { in qla24xx_modify_vp_config()
4281 "Failed to complete IOCB -- completion status (%x).\n", in qla24xx_modify_vp_config()
4282 le16_to_cpu(vpmod->comp_status)); in qla24xx_modify_vp_config()
4288 fc_vport_set_state(vha->fc_vport, FC_VPORT_INITIALIZING); in qla24xx_modify_vp_config()
4290 dma_pool_free(ha->s_dma_pool, vpmod, vpmod_dma); in qla24xx_modify_vp_config()
4297 * Receive or disable RSCN request from fabric controller
4302 * 0 - Reserved
4303 * 1 - Fabric detected registration
4304 * 2 - N_port detected registration
4305 * 3 - Full registration
4306 * FF - clear registration
4327 mcp->mb[0] = MBC_SEND_CHANGE_REQUEST; in qla2x00_send_change_request()
4328 mcp->mb[1] = format; in qla2x00_send_change_request()
4329 mcp->mb[9] = vp_idx; in qla2x00_send_change_request()
4330 mcp->out_mb = MBX_9|MBX_1|MBX_0; in qla2x00_send_change_request()
4331 mcp->in_mb = MBX_0|MBX_1; in qla2x00_send_change_request()
4332 mcp->tov = MBX_TOV_SECONDS; in qla2x00_send_change_request()
4333 mcp->flags = 0; in qla2x00_send_change_request()
4337 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { in qla2x00_send_change_request()
4357 if (MSW(addr) || IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_dump_ram()
4358 mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; in qla2x00_dump_ram()
4359 mcp->mb[8] = MSW(addr); in qla2x00_dump_ram()
4360 mcp->mb[10] = 0; in qla2x00_dump_ram()
4361 mcp->out_mb = MBX_10|MBX_8|MBX_0; in qla2x00_dump_ram()
4363 mcp->mb[0] = MBC_DUMP_RISC_RAM; in qla2x00_dump_ram()
4364 mcp->out_mb = MBX_0; in qla2x00_dump_ram()
4366 mcp->mb[1] = LSW(addr); in qla2x00_dump_ram()
4367 mcp->mb[2] = MSW(req_dma); in qla2x00_dump_ram()
4368 mcp->mb[3] = LSW(req_dma); in qla2x00_dump_ram()
4369 mcp->mb[6] = MSW(MSD(req_dma)); in qla2x00_dump_ram()
4370 mcp->mb[7] = LSW(MSD(req_dma)); in qla2x00_dump_ram()
4371 mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1; in qla2x00_dump_ram()
4372 if (IS_FWI2_CAPABLE(vha->hw)) { in qla2x00_dump_ram()
4373 mcp->mb[4] = MSW(size); in qla2x00_dump_ram()
4374 mcp->mb[5] = LSW(size); in qla2x00_dump_ram()
4375 mcp->out_mb |= MBX_5|MBX_4; in qla2x00_dump_ram()
4377 mcp->mb[4] = LSW(size); in qla2x00_dump_ram()
4378 mcp->out_mb |= MBX_4; in qla2x00_dump_ram()
4381 mcp->in_mb = MBX_0; in qla2x00_dump_ram()
4382 mcp->tov = MBX_TOV_SECONDS; in qla2x00_dump_ram()
4383 mcp->flags = 0; in qla2x00_dump_ram()
4388 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_dump_ram()
4413 struct qla_hw_data *ha = vha->hw; in qla84xx_verify_chip()
4418 mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); in qla84xx_verify_chip()
4424 options = ha->cs84xx->fw_update ? VCO_FORCE_UPDATE : 0; in qla84xx_verify_chip()
4433 mn->p.req.entry_type = VERIFY_CHIP_IOCB_TYPE; in qla84xx_verify_chip()
4434 mn->p.req.entry_count = 1; in qla84xx_verify_chip()
4435 mn->p.req.options = cpu_to_le16(options); in qla84xx_verify_chip()
4454 status[0] = le16_to_cpu(mn->p.rsp.comp_status); in qla84xx_verify_chip()
4456 le16_to_cpu(mn->p.rsp.failure_code) : 0; in qla84xx_verify_chip()
4473 le32_to_cpu(mn->p.rsp.fw_ver)); in qla84xx_verify_chip()
4476 spin_lock_irqsave(&ha->cs84xx->access_lock, flags); in qla84xx_verify_chip()
4477 ha->cs84xx->op_fw_version = in qla84xx_verify_chip()
4478 le32_to_cpu(mn->p.rsp.fw_ver); in qla84xx_verify_chip()
4479 spin_unlock_irqrestore(&ha->cs84xx->access_lock, in qla84xx_verify_chip()
4485 dma_pool_free(ha->s_dma_pool, mn, mn_dma); in qla84xx_verify_chip()
4505 struct qla_hw_data *ha = vha->hw; in qla25xx_init_req_que()
4507 if (!ha->flags.fw_started) in qla25xx_init_req_que()
4514 req->options |= BIT_13; in qla25xx_init_req_que()
4516 mcp->mb[0] = MBC_INITIALIZE_MULTIQ; in qla25xx_init_req_que()
4517 mcp->mb[1] = req->options; in qla25xx_init_req_que()
4518 mcp->mb[2] = MSW(LSD(req->dma)); in qla25xx_init_req_que()
4519 mcp->mb[3] = LSW(LSD(req->dma)); in qla25xx_init_req_que()
4520 mcp->mb[6] = MSW(MSD(req->dma)); in qla25xx_init_req_que()
4521 mcp->mb[7] = LSW(MSD(req->dma)); in qla25xx_init_req_que()
4522 mcp->mb[5] = req->length; in qla25xx_init_req_que()
4523 if (req->rsp) in qla25xx_init_req_que()
4524 mcp->mb[10] = req->rsp->id; in qla25xx_init_req_que()
4525 mcp->mb[12] = req->qos; in qla25xx_init_req_que()
4526 mcp->mb[11] = req->vp_idx; in qla25xx_init_req_que()
4527 mcp->mb[13] = req->rid; in qla25xx_init_req_que()
4529 mcp->mb[15] = 0; in qla25xx_init_req_que()
4531 mcp->mb[4] = req->id; in qla25xx_init_req_que()
4533 mcp->mb[8] = 0; in qla25xx_init_req_que()
4535 mcp->mb[9] = *req->out_ptr = 0; in qla25xx_init_req_que()
4536 mcp->out_mb = MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8|MBX_7| in qla25xx_init_req_que()
4538 mcp->in_mb = MBX_0; in qla25xx_init_req_que()
4539 mcp->flags = MBX_DMA_OUT; in qla25xx_init_req_que()
4540 mcp->tov = MBX_TOV_SECONDS * 2; in qla25xx_init_req_que()
4544 mcp->in_mb |= MBX_1; in qla25xx_init_req_que()
4546 mcp->out_mb |= MBX_15; in qla25xx_init_req_que()
4547 /* debug q create issue in SR-IOV */ in qla25xx_init_req_que()
4548 mcp->in_mb |= MBX_9 | MBX_8 | MBX_7; in qla25xx_init_req_que()
4551 spin_lock_irqsave(&ha->hardware_lock, flags); in qla25xx_init_req_que()
4552 if (!(req->options & BIT_0)) { in qla25xx_init_req_que()
4553 wrt_reg_dword(req->req_q_in, 0); in qla25xx_init_req_que()
4555 wrt_reg_dword(req->req_q_out, 0); in qla25xx_init_req_que()
4557 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla25xx_init_req_que()
4562 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla25xx_init_req_que()
4578 struct qla_hw_data *ha = vha->hw; in qla25xx_init_rsp_que()
4580 if (!ha->flags.fw_started) in qla25xx_init_rsp_que()
4587 rsp->options |= BIT_13; in qla25xx_init_rsp_que()
4589 mcp->mb[0] = MBC_INITIALIZE_MULTIQ; in qla25xx_init_rsp_que()
4590 mcp->mb[1] = rsp->options; in qla25xx_init_rsp_que()
4591 mcp->mb[2] = MSW(LSD(rsp->dma)); in qla25xx_init_rsp_que()
4592 mcp->mb[3] = LSW(LSD(rsp->dma)); in qla25xx_init_rsp_que()
4593 mcp->mb[6] = MSW(MSD(rsp->dma)); in qla25xx_init_rsp_que()
4594 mcp->mb[7] = LSW(MSD(rsp->dma)); in qla25xx_init_rsp_que()
4595 mcp->mb[5] = rsp->length; in qla25xx_init_rsp_que()
4596 mcp->mb[14] = rsp->msix->entry; in qla25xx_init_rsp_que()
4597 mcp->mb[13] = rsp->rid; in qla25xx_init_rsp_que()
4599 mcp->mb[15] = 0; in qla25xx_init_rsp_que()
4601 mcp->mb[4] = rsp->id; in qla25xx_init_rsp_que()
4603 mcp->mb[8] = *rsp->in_ptr = 0; in qla25xx_init_rsp_que()
4605 mcp->mb[9] = 0; in qla25xx_init_rsp_que()
4606 mcp->out_mb = MBX_14|MBX_13|MBX_9|MBX_8|MBX_7 in qla25xx_init_rsp_que()
4608 mcp->in_mb = MBX_0; in qla25xx_init_rsp_que()
4609 mcp->flags = MBX_DMA_OUT; in qla25xx_init_rsp_que()
4610 mcp->tov = MBX_TOV_SECONDS * 2; in qla25xx_init_rsp_que()
4613 mcp->out_mb |= MBX_12|MBX_11|MBX_10; in qla25xx_init_rsp_que()
4614 mcp->in_mb |= MBX_1; in qla25xx_init_rsp_que()
4616 mcp->out_mb |= MBX_15|MBX_12|MBX_11|MBX_10; in qla25xx_init_rsp_que()
4617 mcp->in_mb |= MBX_1; in qla25xx_init_rsp_que()
4618 /* debug q create issue in SR-IOV */ in qla25xx_init_rsp_que()
4619 mcp->in_mb |= MBX_9 | MBX_8 | MBX_7; in qla25xx_init_rsp_que()
4622 spin_lock_irqsave(&ha->hardware_lock, flags); in qla25xx_init_rsp_que()
4623 if (!(rsp->options & BIT_0)) { in qla25xx_init_rsp_que()
4624 wrt_reg_dword(rsp->rsp_q_out, 0); in qla25xx_init_rsp_que()
4626 wrt_reg_dword(rsp->rsp_q_in, 0); in qla25xx_init_rsp_que()
4629 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla25xx_init_rsp_que()
4634 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla25xx_init_rsp_que()
4653 mcp->mb[0] = MBC_IDC_ACK; in qla81xx_idc_ack()
4654 memcpy(&mcp->mb[1], mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla81xx_idc_ack()
4655 mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_idc_ack()
4656 mcp->in_mb = MBX_0; in qla81xx_idc_ack()
4657 mcp->tov = MBX_TOV_SECONDS; in qla81xx_idc_ack()
4658 mcp->flags = 0; in qla81xx_idc_ack()
4663 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_idc_ack()
4682 if (!IS_QLA81XX(vha->hw) && !IS_QLA83XX(vha->hw) && in qla81xx_fac_get_sector_size()
4683 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla81xx_fac_get_sector_size()
4686 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_get_sector_size()
4687 mcp->mb[1] = FAC_OPT_CMD_GET_SECTOR_SIZE; in qla81xx_fac_get_sector_size()
4688 mcp->out_mb = MBX_1|MBX_0; in qla81xx_fac_get_sector_size()
4689 mcp->in_mb = MBX_1|MBX_0; in qla81xx_fac_get_sector_size()
4690 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_get_sector_size()
4691 mcp->flags = 0; in qla81xx_fac_get_sector_size()
4697 rval, mcp->mb[0], mcp->mb[1]); in qla81xx_fac_get_sector_size()
4701 *sector_size = mcp->mb[1]; in qla81xx_fac_get_sector_size()
4714 if (!IS_QLA81XX(vha->hw) && !IS_QLA83XX(vha->hw) && in qla81xx_fac_do_write_enable()
4715 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla81xx_fac_do_write_enable()
4721 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_do_write_enable()
4722 mcp->mb[1] = enable ? FAC_OPT_CMD_WRITE_ENABLE : in qla81xx_fac_do_write_enable()
4724 mcp->out_mb = MBX_1|MBX_0; in qla81xx_fac_do_write_enable()
4725 mcp->in_mb = MBX_1|MBX_0; in qla81xx_fac_do_write_enable()
4726 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_do_write_enable()
4727 mcp->flags = 0; in qla81xx_fac_do_write_enable()
4733 rval, mcp->mb[0], mcp->mb[1]); in qla81xx_fac_do_write_enable()
4749 if (!IS_QLA81XX(vha->hw) && !IS_QLA83XX(vha->hw) && in qla81xx_fac_erase_sector()
4750 !IS_QLA27XX(vha->hw) && !IS_QLA28XX(vha->hw)) in qla81xx_fac_erase_sector()
4756 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_erase_sector()
4757 mcp->mb[1] = FAC_OPT_CMD_ERASE_SECTOR; in qla81xx_fac_erase_sector()
4758 mcp->mb[2] = LSW(start); in qla81xx_fac_erase_sector()
4759 mcp->mb[3] = MSW(start); in qla81xx_fac_erase_sector()
4760 mcp->mb[4] = LSW(finish); in qla81xx_fac_erase_sector()
4761 mcp->mb[5] = MSW(finish); in qla81xx_fac_erase_sector()
4762 mcp->out_mb = MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_fac_erase_sector()
4763 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla81xx_fac_erase_sector()
4764 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_erase_sector()
4765 mcp->flags = 0; in qla81xx_fac_erase_sector()
4771 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla81xx_fac_erase_sector()
4786 struct qla_hw_data *ha = vha->hw; in qla81xx_fac_semaphore_access()
4795 mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; in qla81xx_fac_semaphore_access()
4796 mcp->mb[1] = (lock ? FAC_OPT_CMD_LOCK_SEMAPHORE : in qla81xx_fac_semaphore_access()
4798 mcp->out_mb = MBX_1|MBX_0; in qla81xx_fac_semaphore_access()
4799 mcp->in_mb = MBX_1|MBX_0; in qla81xx_fac_semaphore_access()
4800 mcp->tov = MBX_TOV_SECONDS; in qla81xx_fac_semaphore_access()
4801 mcp->flags = 0; in qla81xx_fac_semaphore_access()
4807 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla81xx_fac_semaphore_access()
4826 mcp->mb[0] = MBC_RESTART_MPI_FW; in qla81xx_restart_mpi_firmware()
4827 mcp->out_mb = MBX_0; in qla81xx_restart_mpi_firmware()
4828 mcp->in_mb = MBX_0|MBX_1; in qla81xx_restart_mpi_firmware()
4829 mcp->tov = MBX_TOV_SECONDS; in qla81xx_restart_mpi_firmware()
4830 mcp->flags = 0; in qla81xx_restart_mpi_firmware()
4836 rval, mcp->mb[0], mcp->mb[1]); in qla81xx_restart_mpi_firmware()
4854 struct qla_hw_data *ha = vha->hw; in qla82xx_set_driver_version()
4865 mcp->mb[0] = MBC_SET_RNID_PARAMS; in qla82xx_set_driver_version()
4866 mcp->mb[1] = RNID_TYPE_SET_VERSION << 8; in qla82xx_set_driver_version()
4867 mcp->out_mb = MBX_1|MBX_0; in qla82xx_set_driver_version()
4868 for (i = 4; i < 16 && len; i++, str++, len -= 2) { in qla82xx_set_driver_version()
4869 mcp->mb[i] = le16_to_cpup(str); in qla82xx_set_driver_version()
4870 mcp->out_mb |= 1<<i; in qla82xx_set_driver_version()
4873 mcp->mb[i] = 0; in qla82xx_set_driver_version()
4874 mcp->out_mb |= 1<<i; in qla82xx_set_driver_version()
4876 mcp->in_mb = MBX_1|MBX_0; in qla82xx_set_driver_version()
4877 mcp->tov = MBX_TOV_SECONDS; in qla82xx_set_driver_version()
4878 mcp->flags = 0; in qla82xx_set_driver_version()
4883 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla82xx_set_driver_version()
4902 struct qla_hw_data *ha = vha->hw; in qla25xx_set_driver_version()
4911 str = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &str_dma); in qla25xx_set_driver_version()
4920 len = dwlen * 4 - 4; in qla25xx_set_driver_version()
4926 mcp->mb[0] = MBC_SET_RNID_PARAMS; in qla25xx_set_driver_version()
4927 mcp->mb[1] = RNID_TYPE_SET_VERSION << 8 | dwlen; in qla25xx_set_driver_version()
4928 mcp->mb[2] = MSW(LSD(str_dma)); in qla25xx_set_driver_version()
4929 mcp->mb[3] = LSW(LSD(str_dma)); in qla25xx_set_driver_version()
4930 mcp->mb[6] = MSW(MSD(str_dma)); in qla25xx_set_driver_version()
4931 mcp->mb[7] = LSW(MSD(str_dma)); in qla25xx_set_driver_version()
4932 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla25xx_set_driver_version()
4933 mcp->in_mb = MBX_1|MBX_0; in qla25xx_set_driver_version()
4934 mcp->tov = MBX_TOV_SECONDS; in qla25xx_set_driver_version()
4935 mcp->flags = 0; in qla25xx_set_driver_version()
4940 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla25xx_set_driver_version()
4946 dma_pool_free(ha->s_dma_pool, str, str_dma); in qla25xx_set_driver_version()
4960 if (!IS_FWI2_CAPABLE(vha->hw)) in qla24xx_get_port_login_templ()
4966 mcp->mb[0] = MBC_GET_RNID_PARAMS; in qla24xx_get_port_login_templ()
4967 mcp->mb[1] = RNID_TYPE_PORT_LOGIN << 8; in qla24xx_get_port_login_templ()
4968 mcp->mb[2] = MSW(buf_dma); in qla24xx_get_port_login_templ()
4969 mcp->mb[3] = LSW(buf_dma); in qla24xx_get_port_login_templ()
4970 mcp->mb[6] = MSW(MSD(buf_dma)); in qla24xx_get_port_login_templ()
4971 mcp->mb[7] = LSW(MSD(buf_dma)); in qla24xx_get_port_login_templ()
4972 mcp->mb[8] = bufsiz/4; in qla24xx_get_port_login_templ()
4973 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()
4974 mcp->in_mb = MBX_1|MBX_0; in qla24xx_get_port_login_templ()
4975 mcp->tov = MBX_TOV_SECONDS; in qla24xx_get_port_login_templ()
4976 mcp->flags = 0; in qla24xx_get_port_login_templ()
4981 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla24xx_get_port_login_templ()
4986 for (i = 0; i < (bufsiz-4)/4; i++, bp++) in qla24xx_get_port_login_templ()
5005 struct qla_hw_data *ha = vha->hw; in qla25xx_set_els_cmds_supported()
5014 els_cmd_map = dma_alloc_coherent(&ha->pdev->dev, ELS_CMD_MAP_SIZE, in qla25xx_set_els_cmds_supported()
5027 if (ha->flags.scm_supported_f) { in qla25xx_set_els_cmds_supported()
5031 if (ha->flags.edif_enabled) { in qla25xx_set_els_cmds_supported()
5042 mcp->mb[0] = MBC_SET_RNID_PARAMS; in qla25xx_set_els_cmds_supported()
5043 mcp->mb[1] = RNID_TYPE_ELS_CMD << 8; in qla25xx_set_els_cmds_supported()
5044 mcp->mb[2] = MSW(LSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5045 mcp->mb[3] = LSW(LSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5046 mcp->mb[6] = MSW(MSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5047 mcp->mb[7] = LSW(MSD(els_cmd_map_dma)); in qla25xx_set_els_cmds_supported()
5048 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla25xx_set_els_cmds_supported()
5049 mcp->in_mb = MBX_1|MBX_0; in qla25xx_set_els_cmds_supported()
5050 mcp->tov = MBX_TOV_SECONDS; in qla25xx_set_els_cmds_supported()
5051 mcp->flags = MBX_DMA_OUT; in qla25xx_set_els_cmds_supported()
5052 mcp->buf_size = ELS_CMD_MAP_SIZE; in qla25xx_set_els_cmds_supported()
5057 "Failed=%x (%x,%x).\n", rval, mcp->mb[0], mcp->mb[1]); in qla25xx_set_els_cmds_supported()
5063 dma_free_coherent(&ha->pdev->dev, ELS_CMD_MAP_SIZE, in qla25xx_set_els_cmds_supported()
5076 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_read_asic_temperature()
5082 mcp->mb[0] = MBC_GET_RNID_PARAMS; in qla2x00_read_asic_temperature()
5083 mcp->mb[1] = RNID_TYPE_ASIC_TEMP << 8; in qla2x00_read_asic_temperature()
5084 mcp->out_mb = MBX_1|MBX_0; in qla2x00_read_asic_temperature()
5085 mcp->in_mb = MBX_1|MBX_0; in qla2x00_read_asic_temperature()
5086 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_asic_temperature()
5087 mcp->flags = 0; in qla2x00_read_asic_temperature()
5089 *temp = mcp->mb[1]; in qla2x00_read_asic_temperature()
5093 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]); in qla2x00_read_asic_temperature()
5109 struct qla_hw_data *ha = vha->hw; in qla2x00_read_sfp()
5120 mcp->mb[0] = MBC_READ_SFP; in qla2x00_read_sfp()
5121 mcp->mb[1] = dev; in qla2x00_read_sfp()
5122 mcp->mb[2] = MSW(LSD(sfp_dma)); in qla2x00_read_sfp()
5123 mcp->mb[3] = LSW(LSD(sfp_dma)); in qla2x00_read_sfp()
5124 mcp->mb[6] = MSW(MSD(sfp_dma)); in qla2x00_read_sfp()
5125 mcp->mb[7] = LSW(MSD(sfp_dma)); in qla2x00_read_sfp()
5126 mcp->mb[8] = len; in qla2x00_read_sfp()
5127 mcp->mb[9] = off; in qla2x00_read_sfp()
5128 mcp->mb[10] = opt; in qla2x00_read_sfp()
5129 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()
5130 mcp->in_mb = MBX_1|MBX_0; in qla2x00_read_sfp()
5131 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_sfp()
5132 mcp->flags = 0; in qla2x00_read_sfp()
5136 *sfp = mcp->mb[1]; in qla2x00_read_sfp()
5140 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_read_sfp()
5141 if (mcp->mb[0] == MBS_COMMAND_ERROR && mcp->mb[1] == 0x22) { in qla2x00_read_sfp()
5160 struct qla_hw_data *ha = vha->hw; in qla2x00_write_sfp()
5174 mcp->mb[0] = MBC_WRITE_SFP; in qla2x00_write_sfp()
5175 mcp->mb[1] = dev; in qla2x00_write_sfp()
5176 mcp->mb[2] = MSW(LSD(sfp_dma)); in qla2x00_write_sfp()
5177 mcp->mb[3] = LSW(LSD(sfp_dma)); in qla2x00_write_sfp()
5178 mcp->mb[6] = MSW(MSD(sfp_dma)); in qla2x00_write_sfp()
5179 mcp->mb[7] = LSW(MSD(sfp_dma)); in qla2x00_write_sfp()
5180 mcp->mb[8] = len; in qla2x00_write_sfp()
5181 mcp->mb[9] = off; in qla2x00_write_sfp()
5182 mcp->mb[10] = opt; in qla2x00_write_sfp()
5183 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()
5184 mcp->in_mb = MBX_1|MBX_0; in qla2x00_write_sfp()
5185 mcp->tov = MBX_TOV_SECONDS; in qla2x00_write_sfp()
5186 mcp->flags = 0; in qla2x00_write_sfp()
5191 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_write_sfp()
5211 if (!IS_CNA_CAPABLE(vha->hw)) in qla2x00_get_xgmac_stats()
5214 mcp->mb[0] = MBC_GET_XGMAC_STATS; in qla2x00_get_xgmac_stats()
5215 mcp->mb[2] = MSW(stats_dma); in qla2x00_get_xgmac_stats()
5216 mcp->mb[3] = LSW(stats_dma); in qla2x00_get_xgmac_stats()
5217 mcp->mb[6] = MSW(MSD(stats_dma)); in qla2x00_get_xgmac_stats()
5218 mcp->mb[7] = LSW(MSD(stats_dma)); in qla2x00_get_xgmac_stats()
5219 mcp->mb[8] = size_in_bytes >> 2; in qla2x00_get_xgmac_stats()
5220 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; in qla2x00_get_xgmac_stats()
5221 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_get_xgmac_stats()
5222 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_xgmac_stats()
5223 mcp->flags = 0; in qla2x00_get_xgmac_stats()
5229 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla2x00_get_xgmac_stats()
5235 *actual_size = mcp->mb[2] << 2; in qla2x00_get_xgmac_stats()
5252 if (!IS_CNA_CAPABLE(vha->hw)) in qla2x00_get_dcbx_params()
5255 mcp->mb[0] = MBC_GET_DCBX_PARAMS; in qla2x00_get_dcbx_params()
5256 mcp->mb[1] = 0; in qla2x00_get_dcbx_params()
5257 mcp->mb[2] = MSW(tlv_dma); in qla2x00_get_dcbx_params()
5258 mcp->mb[3] = LSW(tlv_dma); in qla2x00_get_dcbx_params()
5259 mcp->mb[6] = MSW(MSD(tlv_dma)); in qla2x00_get_dcbx_params()
5260 mcp->mb[7] = LSW(MSD(tlv_dma)); in qla2x00_get_dcbx_params()
5261 mcp->mb[8] = size; in qla2x00_get_dcbx_params()
5262 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_get_dcbx_params()
5263 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_get_dcbx_params()
5264 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_dcbx_params()
5265 mcp->flags = 0; in qla2x00_get_dcbx_params()
5271 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]); in qla2x00_get_dcbx_params()
5290 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_read_ram_word()
5293 mcp->mb[0] = MBC_READ_RAM_EXTENDED; in qla2x00_read_ram_word()
5294 mcp->mb[1] = LSW(risc_addr); in qla2x00_read_ram_word()
5295 mcp->mb[8] = MSW(risc_addr); in qla2x00_read_ram_word()
5296 mcp->out_mb = MBX_8|MBX_1|MBX_0; in qla2x00_read_ram_word()
5297 mcp->in_mb = MBX_3|MBX_2|MBX_0; in qla2x00_read_ram_word()
5298 mcp->tov = MBX_TOV_SECONDS; in qla2x00_read_ram_word()
5299 mcp->flags = 0; in qla2x00_read_ram_word()
5303 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_read_ram_word()
5307 *data = mcp->mb[3] << 16 | mcp->mb[2]; in qla2x00_read_ram_word()
5324 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla2x00_loopback_test()
5325 mcp->mb[0] = MBC_DIAGNOSTIC_LOOP_BACK; in qla2x00_loopback_test()
5326 mcp->mb[1] = mreq->options | BIT_6; // BIT_6 specifies 64 bit addressing in qla2x00_loopback_test()
5329 mcp->mb[10] = LSW(mreq->transfer_size); in qla2x00_loopback_test()
5330 mcp->mb[11] = MSW(mreq->transfer_size); in qla2x00_loopback_test()
5333 mcp->mb[14] = LSW(mreq->send_dma); in qla2x00_loopback_test()
5334 mcp->mb[15] = MSW(mreq->send_dma); in qla2x00_loopback_test()
5335 mcp->mb[20] = LSW(MSD(mreq->send_dma)); in qla2x00_loopback_test()
5336 mcp->mb[21] = MSW(MSD(mreq->send_dma)); in qla2x00_loopback_test()
5339 mcp->mb[16] = LSW(mreq->rcv_dma); in qla2x00_loopback_test()
5340 mcp->mb[17] = MSW(mreq->rcv_dma); in qla2x00_loopback_test()
5341 mcp->mb[6] = LSW(MSD(mreq->rcv_dma)); in qla2x00_loopback_test()
5342 mcp->mb[7] = MSW(MSD(mreq->rcv_dma)); in qla2x00_loopback_test()
5345 mcp->mb[18] = LSW(mreq->iteration_count); in qla2x00_loopback_test()
5346 mcp->mb[19] = MSW(mreq->iteration_count); in qla2x00_loopback_test()
5348 mcp->out_mb = MBX_21|MBX_20|MBX_19|MBX_18|MBX_17|MBX_16|MBX_15| in qla2x00_loopback_test()
5350 if (IS_CNA_CAPABLE(vha->hw)) in qla2x00_loopback_test()
5351 mcp->out_mb |= MBX_2; in qla2x00_loopback_test()
5352 mcp->in_mb = MBX_19|MBX_18|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_loopback_test()
5354 mcp->buf_size = mreq->transfer_size; in qla2x00_loopback_test()
5355 mcp->tov = MBX_TOV_SECONDS; in qla2x00_loopback_test()
5356 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla2x00_loopback_test()
5363 "mb[19]=%x.\n", rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], in qla2x00_loopback_test()
5364 mcp->mb[3], mcp->mb[18], mcp->mb[19]); in qla2x00_loopback_test()
5371 memcpy( mresp, mcp->mb, 64); in qla2x00_loopback_test()
5382 struct qla_hw_data *ha = vha->hw; in qla2x00_echo_test()
5387 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla2x00_echo_test()
5388 mcp->mb[0] = MBC_DIAGNOSTIC_ECHO; in qla2x00_echo_test()
5390 mcp->mb[1] = mreq->options | BIT_15 | BIT_6; in qla2x00_echo_test()
5392 mcp->mb[2] = vha->fcoe_fcf_idx; in qla2x00_echo_test()
5394 mcp->mb[16] = LSW(mreq->rcv_dma); in qla2x00_echo_test()
5395 mcp->mb[17] = MSW(mreq->rcv_dma); in qla2x00_echo_test()
5396 mcp->mb[6] = LSW(MSD(mreq->rcv_dma)); in qla2x00_echo_test()
5397 mcp->mb[7] = MSW(MSD(mreq->rcv_dma)); in qla2x00_echo_test()
5399 mcp->mb[10] = LSW(mreq->transfer_size); in qla2x00_echo_test()
5401 mcp->mb[14] = LSW(mreq->send_dma); in qla2x00_echo_test()
5402 mcp->mb[15] = MSW(mreq->send_dma); in qla2x00_echo_test()
5403 mcp->mb[20] = LSW(MSD(mreq->send_dma)); in qla2x00_echo_test()
5404 mcp->mb[21] = MSW(MSD(mreq->send_dma)); in qla2x00_echo_test()
5406 mcp->out_mb = MBX_21|MBX_20|MBX_17|MBX_16|MBX_15| in qla2x00_echo_test()
5409 mcp->out_mb |= MBX_2; in qla2x00_echo_test()
5411 mcp->in_mb = MBX_0; in qla2x00_echo_test()
5414 mcp->in_mb |= MBX_1; in qla2x00_echo_test()
5417 mcp->in_mb |= MBX_3; in qla2x00_echo_test()
5419 mcp->tov = MBX_TOV_SECONDS; in qla2x00_echo_test()
5420 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla2x00_echo_test()
5421 mcp->buf_size = mreq->transfer_size; in qla2x00_echo_test()
5428 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_echo_test()
5435 memcpy(mresp, mcp->mb, 64); in qla2x00_echo_test()
5449 mcp->mb[0] = MBC_ISP84XX_RESET; in qla84xx_reset_chip()
5450 mcp->mb[1] = enable_diagnostic; in qla84xx_reset_chip()
5451 mcp->out_mb = MBX_1|MBX_0; in qla84xx_reset_chip()
5452 mcp->in_mb = MBX_1|MBX_0; in qla84xx_reset_chip()
5453 mcp->tov = MBX_TOV_SECONDS; in qla84xx_reset_chip()
5454 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla84xx_reset_chip()
5476 if (!IS_FWI2_CAPABLE(vha->hw)) in qla2x00_write_ram_word()
5479 mcp->mb[0] = MBC_WRITE_RAM_WORD_EXTENDED; in qla2x00_write_ram_word()
5480 mcp->mb[1] = LSW(risc_addr); in qla2x00_write_ram_word()
5481 mcp->mb[2] = LSW(data); in qla2x00_write_ram_word()
5482 mcp->mb[3] = MSW(data); in qla2x00_write_ram_word()
5483 mcp->mb[8] = MSW(risc_addr); in qla2x00_write_ram_word()
5484 mcp->out_mb = MBX_8|MBX_3|MBX_2|MBX_1|MBX_0; in qla2x00_write_ram_word()
5485 mcp->in_mb = MBX_1|MBX_0; in qla2x00_write_ram_word()
5486 mcp->tov = MBX_TOV_SECONDS; in qla2x00_write_ram_word()
5487 mcp->flags = 0; in qla2x00_write_ram_word()
5492 rval, mcp->mb[0], mcp->mb[1]); in qla2x00_write_ram_word()
5507 struct qla_hw_data *ha = vha->hw; in qla81xx_write_mpi_register()
5508 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla81xx_write_mpi_register()
5515 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); in qla81xx_write_mpi_register()
5518 wrt_reg_word(®->mailbox0, MBC_WRITE_MPI_REGISTER); in qla81xx_write_mpi_register()
5519 wrt_reg_word(®->mailbox1, mb[0]); in qla81xx_write_mpi_register()
5520 wrt_reg_word(®->mailbox2, mb[1]); in qla81xx_write_mpi_register()
5521 wrt_reg_word(®->mailbox3, mb[2]); in qla81xx_write_mpi_register()
5522 wrt_reg_word(®->mailbox4, mb[3]); in qla81xx_write_mpi_register()
5524 wrt_reg_dword(®->hccr, HCCRX_SET_HOST_INT); in qla81xx_write_mpi_register()
5527 for (timer = 6000000; timer; timer--) { in qla81xx_write_mpi_register()
5529 stat = rd_reg_dword(®->host_status); in qla81xx_write_mpi_register()
5536 &ha->mbx_cmd_flags); in qla81xx_write_mpi_register()
5537 mb0 = rd_reg_word(®->mailbox0); in qla81xx_write_mpi_register()
5538 wrt_reg_dword(®->hccr, in qla81xx_write_mpi_register()
5540 rd_reg_dword(®->hccr); in qla81xx_write_mpi_register()
5547 if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) in qla81xx_write_mpi_register()
5570 struct qla_hw_data *ha = vha->hw; in qla2x00_set_data_rate()
5574 "Entered %s speed:0x%x mode:0x%x.\n", __func__, ha->set_data_rate, in qla2x00_set_data_rate()
5581 switch (ha->set_data_rate) { in qla2x00_set_data_rate()
5587 val = ha->set_data_rate; in qla2x00_set_data_rate()
5592 ha->set_data_rate); in qla2x00_set_data_rate()
5593 val = ha->set_data_rate = PORT_SPEED_AUTO; in qla2x00_set_data_rate()
5597 mcp->mb[0] = MBC_DATA_RATE; in qla2x00_set_data_rate()
5598 mcp->mb[1] = mode; in qla2x00_set_data_rate()
5599 mcp->mb[2] = val; in qla2x00_set_data_rate()
5601 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2x00_set_data_rate()
5602 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_set_data_rate()
5604 mcp->in_mb |= MBX_4|MBX_3; in qla2x00_set_data_rate()
5605 mcp->tov = MBX_TOV_SECONDS; in qla2x00_set_data_rate()
5606 mcp->flags = 0; in qla2x00_set_data_rate()
5610 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_set_data_rate()
5612 if (mcp->mb[1] != 0x7) in qla2x00_set_data_rate()
5614 "Speed set:0x%x\n", mcp->mb[1]); in qla2x00_set_data_rate()
5629 struct qla_hw_data *ha = vha->hw; in qla2x00_get_data_rate()
5637 mcp->mb[0] = MBC_DATA_RATE; in qla2x00_get_data_rate()
5638 mcp->mb[1] = QLA_GET_DATA_RATE; in qla2x00_get_data_rate()
5639 mcp->out_mb = MBX_1|MBX_0; in qla2x00_get_data_rate()
5640 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla2x00_get_data_rate()
5642 mcp->in_mb |= MBX_4|MBX_3; in qla2x00_get_data_rate()
5643 mcp->tov = MBX_TOV_SECONDS; in qla2x00_get_data_rate()
5644 mcp->flags = 0; in qla2x00_get_data_rate()
5648 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_get_data_rate()
5650 if (mcp->mb[1] != 0x7) in qla2x00_get_data_rate()
5651 ha->link_data_rate = mcp->mb[1]; in qla2x00_get_data_rate()
5654 if (mcp->mb[4] & BIT_0) in qla2x00_get_data_rate()
5661 if (mcp->mb[1] != 0x7) in qla2x00_get_data_rate()
5662 ha->link_data_rate = mcp->mb[1]; in qla2x00_get_data_rate()
5674 struct qla_hw_data *ha = vha->hw; in qla81xx_get_port_config()
5682 mcp->mb[0] = MBC_GET_PORT_CONFIG; in qla81xx_get_port_config()
5683 mcp->out_mb = MBX_0; in qla81xx_get_port_config()
5684 mcp->in_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_get_port_config()
5685 mcp->tov = MBX_TOV_SECONDS; in qla81xx_get_port_config()
5686 mcp->flags = 0; in qla81xx_get_port_config()
5692 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_get_port_config()
5695 memcpy(mb, &mcp->mb[1], sizeof(uint16_t) * 4); in qla81xx_get_port_config()
5713 mcp->mb[0] = MBC_SET_PORT_CONFIG; in qla81xx_set_port_config()
5715 memcpy(&mcp->mb[1], mb, sizeof(uint16_t) * 4); in qla81xx_set_port_config()
5716 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla81xx_set_port_config()
5717 mcp->in_mb = MBX_0; in qla81xx_set_port_config()
5718 mcp->tov = MBX_TOV_SECONDS; in qla81xx_set_port_config()
5719 mcp->flags = 0; in qla81xx_set_port_config()
5724 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_set_port_config()
5740 struct qla_hw_data *ha = vha->hw; in qla24xx_set_fcp_prio()
5748 mcp->mb[0] = MBC_PORT_PARAMS; in qla24xx_set_fcp_prio()
5749 mcp->mb[1] = loop_id; in qla24xx_set_fcp_prio()
5750 if (ha->flags.fcp_prio_enabled) in qla24xx_set_fcp_prio()
5751 mcp->mb[2] = BIT_1; in qla24xx_set_fcp_prio()
5753 mcp->mb[2] = BIT_2; in qla24xx_set_fcp_prio()
5754 mcp->mb[4] = priority & 0xf; in qla24xx_set_fcp_prio()
5755 mcp->mb[9] = vha->vp_idx; in qla24xx_set_fcp_prio()
5756 mcp->out_mb = MBX_9|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla24xx_set_fcp_prio()
5757 mcp->in_mb = MBX_4|MBX_3|MBX_1|MBX_0; in qla24xx_set_fcp_prio()
5758 mcp->tov = MBX_TOV_SECONDS; in qla24xx_set_fcp_prio()
5759 mcp->flags = 0; in qla24xx_set_fcp_prio()
5762 mb[0] = mcp->mb[0]; in qla24xx_set_fcp_prio()
5763 mb[1] = mcp->mb[1]; in qla24xx_set_fcp_prio()
5764 mb[3] = mcp->mb[3]; in qla24xx_set_fcp_prio()
5765 mb[4] = mcp->mb[4]; in qla24xx_set_fcp_prio()
5782 struct qla_hw_data *ha = vha->hw; in qla2x00_get_thermal_temp()
5792 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && in qla2x00_get_thermal_temp()
5793 ha->pdev->subsystem_device == 0x0175) { in qla2x00_get_thermal_temp()
5799 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP && in qla2x00_get_thermal_temp()
5800 ha->pdev->subsystem_device == 0x338e) { in qla2x00_get_thermal_temp()
5829 struct qla_hw_data *ha = vha->hw; in qla82xx_mbx_intr_enable()
5840 mcp->mb[0] = MBC_TOGGLE_INTERRUPT; in qla82xx_mbx_intr_enable()
5841 mcp->mb[1] = 1; in qla82xx_mbx_intr_enable()
5843 mcp->out_mb = MBX_1|MBX_0; in qla82xx_mbx_intr_enable()
5844 mcp->in_mb = MBX_0; in qla82xx_mbx_intr_enable()
5845 mcp->tov = MBX_TOV_SECONDS; in qla82xx_mbx_intr_enable()
5846 mcp->flags = 0; in qla82xx_mbx_intr_enable()
5851 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla82xx_mbx_intr_enable()
5864 struct qla_hw_data *ha = vha->hw; in qla82xx_mbx_intr_disable()
5875 mcp->mb[0] = MBC_TOGGLE_INTERRUPT; in qla82xx_mbx_intr_disable()
5876 mcp->mb[1] = 0; in qla82xx_mbx_intr_disable()
5878 mcp->out_mb = MBX_1|MBX_0; in qla82xx_mbx_intr_disable()
5879 mcp->in_mb = MBX_0; in qla82xx_mbx_intr_disable()
5880 mcp->tov = MBX_TOV_SECONDS; in qla82xx_mbx_intr_disable()
5881 mcp->flags = 0; in qla82xx_mbx_intr_disable()
5886 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla82xx_mbx_intr_disable()
5898 struct qla_hw_data *ha = vha->hw; in qla82xx_md_get_template_size()
5906 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla82xx_md_get_template_size()
5907 mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template_size()
5908 mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template_size()
5909 mcp->mb[2] = LSW(RQST_TMPLT_SIZE); in qla82xx_md_get_template_size()
5910 mcp->mb[3] = MSW(RQST_TMPLT_SIZE); in qla82xx_md_get_template_size()
5912 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla82xx_md_get_template_size()
5913 mcp->in_mb = MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8| in qla82xx_md_get_template_size()
5916 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla82xx_md_get_template_size()
5917 mcp->tov = MBX_TOV_SECONDS; in qla82xx_md_get_template_size()
5924 (mcp->mb[1] << 16) | mcp->mb[0], in qla82xx_md_get_template_size()
5925 (mcp->mb[3] << 16) | mcp->mb[2]); in qla82xx_md_get_template_size()
5929 ha->md_template_size = ((mcp->mb[3] << 16) | mcp->mb[2]); in qla82xx_md_get_template_size()
5930 if (!ha->md_template_size) { in qla82xx_md_get_template_size()
5942 struct qla_hw_data *ha = vha->hw; in qla82xx_md_get_template()
5950 ha->md_tmplt_hdr = dma_alloc_coherent(&ha->pdev->dev, in qla82xx_md_get_template()
5951 ha->md_template_size, &ha->md_tmplt_hdr_dma, GFP_KERNEL); in qla82xx_md_get_template()
5952 if (!ha->md_tmplt_hdr) { in qla82xx_md_get_template()
5958 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla82xx_md_get_template()
5959 mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template()
5960 mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla82xx_md_get_template()
5961 mcp->mb[2] = LSW(RQST_TMPLT); in qla82xx_md_get_template()
5962 mcp->mb[3] = MSW(RQST_TMPLT); in qla82xx_md_get_template()
5963 mcp->mb[4] = LSW(LSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5964 mcp->mb[5] = MSW(LSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5965 mcp->mb[6] = LSW(MSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5966 mcp->mb[7] = MSW(MSD(ha->md_tmplt_hdr_dma)); in qla82xx_md_get_template()
5967 mcp->mb[8] = LSW(ha->md_template_size); in qla82xx_md_get_template()
5968 mcp->mb[9] = MSW(ha->md_template_size); in qla82xx_md_get_template()
5970 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla82xx_md_get_template()
5971 mcp->tov = MBX_TOV_SECONDS; in qla82xx_md_get_template()
5972 mcp->out_mb = MBX_11|MBX_10|MBX_9|MBX_8| in qla82xx_md_get_template()
5974 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla82xx_md_get_template()
5980 ((mcp->mb[1] << 16) | mcp->mb[0]), in qla82xx_md_get_template()
5981 ((mcp->mb[3] << 16) | mcp->mb[2])); in qla82xx_md_get_template()
5991 struct qla_hw_data *ha = vha->hw; in qla8044_md_get_template()
6000 ha->md_tmplt_hdr = dma_alloc_coherent(&ha->pdev->dev, in qla8044_md_get_template()
6001 ha->md_template_size, &ha->md_tmplt_hdr_dma, GFP_KERNEL); in qla8044_md_get_template()
6002 if (!ha->md_tmplt_hdr) { in qla8044_md_get_template()
6008 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla8044_md_get_template()
6009 while (offset < ha->md_template_size) { in qla8044_md_get_template()
6010 mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla8044_md_get_template()
6011 mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); in qla8044_md_get_template()
6012 mcp->mb[2] = LSW(RQST_TMPLT); in qla8044_md_get_template()
6013 mcp->mb[3] = MSW(RQST_TMPLT); in qla8044_md_get_template()
6014 mcp->mb[4] = LSW(LSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6015 mcp->mb[5] = MSW(LSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6016 mcp->mb[6] = LSW(MSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6017 mcp->mb[7] = MSW(MSD(ha->md_tmplt_hdr_dma + offset)); in qla8044_md_get_template()
6018 mcp->mb[8] = LSW(size); in qla8044_md_get_template()
6019 mcp->mb[9] = MSW(size); in qla8044_md_get_template()
6020 mcp->mb[10] = offset & 0x0000FFFF; in qla8044_md_get_template()
6021 mcp->mb[11] = offset & 0xFFFF0000; in qla8044_md_get_template()
6022 mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; in qla8044_md_get_template()
6023 mcp->tov = MBX_TOV_SECONDS; in qla8044_md_get_template()
6024 mcp->out_mb = MBX_11|MBX_10|MBX_9|MBX_8| in qla8044_md_get_template()
6026 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla8044_md_get_template()
6032 ((mcp->mb[1] << 16) | mcp->mb[0]), in qla8044_md_get_template()
6033 ((mcp->mb[3] << 16) | mcp->mb[2])); in qla8044_md_get_template()
6047 struct qla_hw_data *ha = vha->hw; in qla81xx_set_led_config()
6058 mcp->mb[0] = MBC_SET_LED_CONFIG; in qla81xx_set_led_config()
6059 mcp->mb[1] = led_cfg[0]; in qla81xx_set_led_config()
6060 mcp->mb[2] = led_cfg[1]; in qla81xx_set_led_config()
6062 mcp->mb[3] = led_cfg[2]; in qla81xx_set_led_config()
6063 mcp->mb[4] = led_cfg[3]; in qla81xx_set_led_config()
6064 mcp->mb[5] = led_cfg[4]; in qla81xx_set_led_config()
6065 mcp->mb[6] = led_cfg[5]; in qla81xx_set_led_config()
6068 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla81xx_set_led_config()
6070 mcp->out_mb |= MBX_6|MBX_5|MBX_4|MBX_3; in qla81xx_set_led_config()
6071 mcp->in_mb = MBX_0; in qla81xx_set_led_config()
6072 mcp->tov = MBX_TOV_SECONDS; in qla81xx_set_led_config()
6073 mcp->flags = 0; in qla81xx_set_led_config()
6078 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_set_led_config()
6091 struct qla_hw_data *ha = vha->hw; in qla81xx_get_led_config()
6102 mcp->mb[0] = MBC_GET_LED_CONFIG; in qla81xx_get_led_config()
6104 mcp->out_mb = MBX_0; in qla81xx_get_led_config()
6105 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla81xx_get_led_config()
6107 mcp->in_mb |= MBX_6|MBX_5|MBX_4|MBX_3; in qla81xx_get_led_config()
6108 mcp->tov = MBX_TOV_SECONDS; in qla81xx_get_led_config()
6109 mcp->flags = 0; in qla81xx_get_led_config()
6114 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla81xx_get_led_config()
6116 led_cfg[0] = mcp->mb[1]; in qla81xx_get_led_config()
6117 led_cfg[1] = mcp->mb[2]; in qla81xx_get_led_config()
6119 led_cfg[2] = mcp->mb[3]; in qla81xx_get_led_config()
6120 led_cfg[3] = mcp->mb[4]; in qla81xx_get_led_config()
6121 led_cfg[4] = mcp->mb[5]; in qla81xx_get_led_config()
6122 led_cfg[5] = mcp->mb[6]; in qla81xx_get_led_config()
6135 struct qla_hw_data *ha = vha->hw; in qla82xx_mbx_beacon_ctl()
6146 mcp->mb[0] = MBC_SET_LED_CONFIG; in qla82xx_mbx_beacon_ctl()
6148 mcp->mb[7] = 0xE; in qla82xx_mbx_beacon_ctl()
6150 mcp->mb[7] = 0xD; in qla82xx_mbx_beacon_ctl()
6152 mcp->out_mb = MBX_7|MBX_0; in qla82xx_mbx_beacon_ctl()
6153 mcp->in_mb = MBX_0; in qla82xx_mbx_beacon_ctl()
6154 mcp->tov = MBX_TOV_SECONDS; in qla82xx_mbx_beacon_ctl()
6155 mcp->flags = 0; in qla82xx_mbx_beacon_ctl()
6160 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla82xx_mbx_beacon_ctl()
6173 struct qla_hw_data *ha = vha->hw; in qla83xx_wr_reg()
6183 mcp->mb[0] = MBC_WRITE_REMOTE_REG; in qla83xx_wr_reg()
6184 mcp->mb[1] = LSW(reg); in qla83xx_wr_reg()
6185 mcp->mb[2] = MSW(reg); in qla83xx_wr_reg()
6186 mcp->mb[3] = LSW(data); in qla83xx_wr_reg()
6187 mcp->mb[4] = MSW(data); in qla83xx_wr_reg()
6188 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla83xx_wr_reg()
6190 mcp->in_mb = MBX_1|MBX_0; in qla83xx_wr_reg()
6191 mcp->tov = MBX_TOV_SECONDS; in qla83xx_wr_reg()
6192 mcp->flags = 0; in qla83xx_wr_reg()
6197 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla83xx_wr_reg()
6210 struct qla_hw_data *ha = vha->hw; in qla2x00_port_logout()
6225 mcp->mb[0] = MBC_PORT_LOGOUT; in qla2x00_port_logout()
6226 mcp->mb[1] = fcport->loop_id; in qla2x00_port_logout()
6227 mcp->mb[10] = BIT_15; in qla2x00_port_logout()
6228 mcp->out_mb = MBX_10|MBX_1|MBX_0; in qla2x00_port_logout()
6229 mcp->in_mb = MBX_0; in qla2x00_port_logout()
6230 mcp->tov = MBX_TOV_SECONDS; in qla2x00_port_logout()
6231 mcp->flags = 0; in qla2x00_port_logout()
6235 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_port_logout()
6249 struct qla_hw_data *ha = vha->hw; in qla83xx_rd_reg()
6258 mcp->mb[0] = MBC_READ_REMOTE_REG; in qla83xx_rd_reg()
6259 mcp->mb[1] = LSW(reg); in qla83xx_rd_reg()
6260 mcp->mb[2] = MSW(reg); in qla83xx_rd_reg()
6261 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla83xx_rd_reg()
6262 mcp->in_mb = MBX_4|MBX_3|MBX_1|MBX_0; in qla83xx_rd_reg()
6263 mcp->tov = MBX_TOV_SECONDS; in qla83xx_rd_reg()
6264 mcp->flags = 0; in qla83xx_rd_reg()
6270 rval, mcp->mb[0], mcp->mb[1]); in qla83xx_rd_reg()
6272 *data = (mcp->mb[3] | (mcp->mb[4] << 16)); in qla83xx_rd_reg()
6275 * During soft-reset CAMRAM register reads might in qla83xx_rd_reg()
6300 struct qla_hw_data *ha = vha->hw; in qla83xx_restart_nic_firmware()
6307 mcp->mb[0] = MBC_RESTART_NIC_FIRMWARE; in qla83xx_restart_nic_firmware()
6308 mcp->out_mb = MBX_0; in qla83xx_restart_nic_firmware()
6309 mcp->in_mb = MBX_1|MBX_0; in qla83xx_restart_nic_firmware()
6310 mcp->tov = MBX_TOV_SECONDS; in qla83xx_restart_nic_firmware()
6311 mcp->flags = 0; in qla83xx_restart_nic_firmware()
6317 rval, mcp->mb[0], mcp->mb[1]); in qla83xx_restart_nic_firmware()
6334 struct qla_hw_data *ha = vha->hw; in qla83xx_access_control()
6341 mcp->mb[0] = MBC_SET_ACCESS_CONTROL; in qla83xx_access_control()
6342 mcp->mb[1] = options; in qla83xx_access_control()
6343 mcp->out_mb = MBX_1|MBX_0; in qla83xx_access_control()
6345 mcp->mb[2] = LSW(start_addr); in qla83xx_access_control()
6346 mcp->mb[3] = MSW(start_addr); in qla83xx_access_control()
6347 mcp->mb[4] = LSW(end_addr); in qla83xx_access_control()
6348 mcp->mb[5] = MSW(end_addr); in qla83xx_access_control()
6349 mcp->out_mb |= MBX_5|MBX_4|MBX_3|MBX_2; in qla83xx_access_control()
6351 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla83xx_access_control()
6353 mcp->in_mb |= MBX_4|MBX_3; in qla83xx_access_control()
6354 mcp->tov = MBX_TOV_SECONDS; in qla83xx_access_control()
6355 mcp->flags = 0; in qla83xx_access_control()
6361 rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3], in qla83xx_access_control()
6362 mcp->mb[4]); in qla83xx_access_control()
6366 *sector_size = mcp->mb[1]; in qla83xx_access_control()
6369 "Driver-lock id=%x%x", mcp->mb[4], mcp->mb[3]); in qla83xx_access_control()
6372 "Flash-lock id=%x%x", mcp->mb[4], mcp->mb[3]); in qla83xx_access_control()
6388 if (!IS_MCTP_CAPABLE(vha->hw)) in qla2x00_dump_mctp_data()
6394 mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; in qla2x00_dump_mctp_data()
6395 mcp->mb[1] = LSW(addr); in qla2x00_dump_mctp_data()
6396 mcp->mb[2] = MSW(req_dma); in qla2x00_dump_mctp_data()
6397 mcp->mb[3] = LSW(req_dma); in qla2x00_dump_mctp_data()
6398 mcp->mb[4] = MSW(size); in qla2x00_dump_mctp_data()
6399 mcp->mb[5] = LSW(size); in qla2x00_dump_mctp_data()
6400 mcp->mb[6] = MSW(MSD(req_dma)); in qla2x00_dump_mctp_data()
6401 mcp->mb[7] = LSW(MSD(req_dma)); in qla2x00_dump_mctp_data()
6402 mcp->mb[8] = MSW(addr); in qla2x00_dump_mctp_data()
6404 /* For MCTP RAM ID is 0x40 */ in qla2x00_dump_mctp_data()
6405 mcp->mb[10] = BIT_7 | 0x40; in qla2x00_dump_mctp_data()
6407 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()
6410 mcp->in_mb = MBX_0; in qla2x00_dump_mctp_data()
6411 mcp->tov = MBX_TOV_SECONDS; in qla2x00_dump_mctp_data()
6412 mcp->flags = 0; in qla2x00_dump_mctp_data()
6417 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2x00_dump_mctp_data()
6435 if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw) && in qla26xx_dport_diagnostics()
6436 !IS_QLA28XX(vha->hw)) in qla26xx_dport_diagnostics()
6442 dd_dma = dma_map_single(&vha->hw->pdev->dev, in qla26xx_dport_diagnostics()
6444 if (dma_mapping_error(&vha->hw->pdev->dev, dd_dma)) { in qla26xx_dport_diagnostics()
6451 mcp->mb[0] = MBC_DPORT_DIAGNOSTICS; in qla26xx_dport_diagnostics()
6452 mcp->mb[1] = options; in qla26xx_dport_diagnostics()
6453 mcp->mb[2] = MSW(LSD(dd_dma)); in qla26xx_dport_diagnostics()
6454 mcp->mb[3] = LSW(LSD(dd_dma)); in qla26xx_dport_diagnostics()
6455 mcp->mb[6] = MSW(MSD(dd_dma)); in qla26xx_dport_diagnostics()
6456 mcp->mb[7] = LSW(MSD(dd_dma)); in qla26xx_dport_diagnostics()
6457 mcp->mb[8] = size; in qla26xx_dport_diagnostics()
6458 mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; in qla26xx_dport_diagnostics()
6459 mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; in qla26xx_dport_diagnostics()
6460 mcp->buf_size = size; in qla26xx_dport_diagnostics()
6461 mcp->flags = MBX_DMA_IN; in qla26xx_dport_diagnostics()
6462 mcp->tov = MBX_TOV_SECONDS * 4; in qla26xx_dport_diagnostics()
6472 dma_unmap_single(&vha->hw->pdev->dev, dd_dma, in qla26xx_dport_diagnostics()
6484 uint size = sizeof(dd->buf); in qla26xx_dport_diagnostics_v2()
6485 uint16_t options = dd->options; in qla26xx_dport_diagnostics_v2()
6490 dd_dma = dma_map_single(&vha->hw->pdev->dev, in qla26xx_dport_diagnostics_v2()
6491 dd->buf, size, DMA_FROM_DEVICE); in qla26xx_dport_diagnostics_v2()
6492 if (dma_mapping_error(&vha->hw->pdev->dev, dd_dma)) { in qla26xx_dport_diagnostics_v2()
6498 memset(dd->buf, 0, size); in qla26xx_dport_diagnostics_v2()
6500 mcp->mb[0] = MBC_DPORT_DIAGNOSTICS; in qla26xx_dport_diagnostics_v2()
6501 mcp->mb[1] = options; in qla26xx_dport_diagnostics_v2()
6502 mcp->mb[2] = MSW(LSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6503 mcp->mb[3] = LSW(LSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6504 mcp->mb[6] = MSW(MSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6505 mcp->mb[7] = LSW(MSD(dd_dma)); in qla26xx_dport_diagnostics_v2()
6506 mcp->mb[8] = size; in qla26xx_dport_diagnostics_v2()
6507 mcp->out_mb = MBX_8 | MBX_7 | MBX_6 | MBX_3 | MBX_2 | MBX_1 | MBX_0; in qla26xx_dport_diagnostics_v2()
6508 mcp->in_mb = MBX_3 | MBX_2 | MBX_1 | MBX_0; in qla26xx_dport_diagnostics_v2()
6509 mcp->buf_size = size; in qla26xx_dport_diagnostics_v2()
6510 mcp->flags = MBX_DMA_IN; in qla26xx_dport_diagnostics_v2()
6511 mcp->tov = MBX_TOV_SECONDS * 4; in qla26xx_dport_diagnostics_v2()
6521 dma_unmap_single(&vha->hw->pdev->dev, dd_dma, size, DMA_FROM_DEVICE); in qla26xx_dport_diagnostics_v2()
6528 sp->u.iocb_cmd.u.mbx.rc = res; in qla2x00_async_mb_sp_done()
6530 complete(&sp->u.iocb_cmd.u.mbx.comp); in qla2x00_async_mb_sp_done()
6536 * This allows non-critial (non chip setup) command to go
6545 if (!vha->hw->flags.fw_started) in qla24xx_send_mb_cmd()
6553 c = &sp->u.iocb_cmd; in qla24xx_send_mb_cmd()
6554 init_completion(&c->u.mbx.comp); in qla24xx_send_mb_cmd()
6556 sp->type = SRB_MB_IOCB; in qla24xx_send_mb_cmd()
6557 sp->name = mb_to_str(mcp->mb[0]); in qla24xx_send_mb_cmd()
6561 memcpy(sp->u.iocb_cmd.u.mbx.out_mb, mcp->mb, SIZEOF_IOCB_MB_REG); in qla24xx_send_mb_cmd()
6567 __func__, sp->name, rval); in qla24xx_send_mb_cmd()
6572 sp->name, sp->handle); in qla24xx_send_mb_cmd()
6574 wait_for_completion(&c->u.mbx.comp); in qla24xx_send_mb_cmd()
6575 memcpy(mcp->mb, sp->u.iocb_cmd.u.mbx.in_mb, SIZEOF_IOCB_MB_REG); in qla24xx_send_mb_cmd()
6577 rval = c->u.mbx.rc; in qla24xx_send_mb_cmd()
6581 __func__, sp->name, rval); in qla24xx_send_mb_cmd()
6585 __func__, sp->name); in qla24xx_send_mb_cmd()
6589 __func__, sp->name, rval); in qla24xx_send_mb_cmd()
6595 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_send_mb_cmd()
6609 struct qla_hw_data *ha = vha->hw; in qla24xx_gpdb_wait()
6612 if (!vha->hw->flags.fw_started) in qla24xx_gpdb_wait()
6615 pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); in qla24xx_gpdb_wait()
6624 mc.mb[1] = fcport->loop_id; in qla24xx_gpdb_wait()
6629 mc.mb[9] = vha->vp_idx; in qla24xx_gpdb_wait()
6635 "%s: %8phC fail\n", __func__, fcport->port_name); in qla24xx_gpdb_wait()
6642 __func__, fcport->port_name); in qla24xx_gpdb_wait()
6646 dma_pool_free(ha->s_dma_pool, pd, pd_dma); in qla24xx_gpdb_wait()
6658 if (NVME_TARGET(vha->hw, fcport)) { in __qla24xx_parse_gpdb()
6659 current_login_state = pd->current_login_state >> 4; in __qla24xx_parse_gpdb()
6660 last_login_state = pd->last_login_state >> 4; in __qla24xx_parse_gpdb()
6662 current_login_state = pd->current_login_state & 0xf; in __qla24xx_parse_gpdb()
6663 last_login_state = pd->last_login_state & 0xf; in __qla24xx_parse_gpdb()
6669 "Unable to verify login-state (%x/%x) for loop_id %x.\n", in __qla24xx_parse_gpdb()
6670 current_login_state, last_login_state, fcport->loop_id); in __qla24xx_parse_gpdb()
6675 if (fcport->loop_id == FC_NO_LOOP_ID || in __qla24xx_parse_gpdb()
6676 (memcmp(fcport->port_name, (uint8_t *)&zero, 8) && in __qla24xx_parse_gpdb()
6677 memcmp(fcport->port_name, pd->port_name, 8))) { in __qla24xx_parse_gpdb()
6683 /* Names are little-endian. */ in __qla24xx_parse_gpdb()
6684 memcpy(fcport->node_name, pd->node_name, WWN_SIZE); in __qla24xx_parse_gpdb()
6685 memcpy(fcport->port_name, pd->port_name, WWN_SIZE); in __qla24xx_parse_gpdb()
6688 fcport->d_id.b.domain = pd->port_id[0]; in __qla24xx_parse_gpdb()
6689 fcport->d_id.b.area = pd->port_id[1]; in __qla24xx_parse_gpdb()
6690 fcport->d_id.b.al_pa = pd->port_id[2]; in __qla24xx_parse_gpdb()
6691 fcport->d_id.b.rsvd_1 = 0; in __qla24xx_parse_gpdb()
6695 fcport->port_name, in __qla24xx_parse_gpdb()
6696 pd->prli_svc_param_word_3[1], in __qla24xx_parse_gpdb()
6697 pd->prli_svc_param_word_3[0]); in __qla24xx_parse_gpdb()
6699 if (NVME_TARGET(vha->hw, fcport)) { in __qla24xx_parse_gpdb()
6700 fcport->port_type = FCT_NVME; in __qla24xx_parse_gpdb()
6701 if ((pd->prli_svc_param_word_3[0] & BIT_5) == 0) in __qla24xx_parse_gpdb()
6702 fcport->port_type |= FCT_NVME_INITIATOR; in __qla24xx_parse_gpdb()
6703 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) in __qla24xx_parse_gpdb()
6704 fcport->port_type |= FCT_NVME_TARGET; in __qla24xx_parse_gpdb()
6705 if ((pd->prli_svc_param_word_3[0] & BIT_3) == 0) in __qla24xx_parse_gpdb()
6706 fcport->port_type |= FCT_NVME_DISCOVERY; in __qla24xx_parse_gpdb()
6709 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) in __qla24xx_parse_gpdb()
6710 fcport->port_type = FCT_INITIATOR; in __qla24xx_parse_gpdb()
6712 fcport->port_type = FCT_TARGET; in __qla24xx_parse_gpdb()
6715 fcport->supported_classes = (pd->flags & PDF_CLASS_2) ? in __qla24xx_parse_gpdb()
6718 if (pd->prli_svc_param_word_3[0] & BIT_7) { in __qla24xx_parse_gpdb()
6719 fcport->flags |= FCF_CONF_COMP_SUPPORTED; in __qla24xx_parse_gpdb()
6720 fcport->conf_compl_supported = 1; in __qla24xx_parse_gpdb()
6737 if (!vha->hw->flags.fw_started) in qla24xx_gidlist_wait()
6747 mc.mb[9] = vha->vp_idx; in qla24xx_gidlist_wait()
6771 memset(mcp->mb, 0 , sizeof(mcp->mb)); in qla27xx_set_zio_threshold()
6772 mcp->mb[0] = MBC_GET_SET_ZIO_THRESHOLD; in qla27xx_set_zio_threshold()
6773 mcp->mb[1] = 1; in qla27xx_set_zio_threshold()
6774 mcp->mb[2] = value; in qla27xx_set_zio_threshold()
6775 mcp->out_mb = MBX_2 | MBX_1 | MBX_0; in qla27xx_set_zio_threshold()
6776 mcp->in_mb = MBX_2 | MBX_0; in qla27xx_set_zio_threshold()
6777 mcp->tov = MBX_TOV_SECONDS; in qla27xx_set_zio_threshold()
6778 mcp->flags = 0; in qla27xx_set_zio_threshold()
6797 memset(mcp->mb, 0, sizeof(mcp->mb)); in qla27xx_get_zio_threshold()
6798 mcp->mb[0] = MBC_GET_SET_ZIO_THRESHOLD; in qla27xx_get_zio_threshold()
6799 mcp->mb[1] = 0; in qla27xx_get_zio_threshold()
6800 mcp->out_mb = MBX_1 | MBX_0; in qla27xx_get_zio_threshold()
6801 mcp->in_mb = MBX_2 | MBX_0; in qla27xx_get_zio_threshold()
6802 mcp->tov = MBX_TOV_SECONDS; in qla27xx_get_zio_threshold()
6803 mcp->flags = 0; in qla27xx_get_zio_threshold()
6818 struct qla_hw_data *ha = vha->hw; in qla2x00_read_sfp_dev()
6824 memset(ha->sfp_data, 0, SFP_DEV_SIZE); in qla2x00_read_sfp_dev()
6826 phys_addr = ha->sfp_data_dma; in qla2x00_read_sfp_dev()
6827 sfp_data = ha->sfp_data; in qla2x00_read_sfp_dev()
6850 if ((count - c) >= SFP_BLOCK_SIZE) in qla2x00_read_sfp_dev()
6853 sz = count - c; in qla2x00_read_sfp_dev()
6873 if (!vha->hw->flags.fw_started) in qla24xx_res_count_wait()
6904 mcp->mb[0] = MBC_SECURE_FLASH_UPDATE; in qla28xx_secure_flash_update()
6905 mcp->mb[1] = opts; in qla28xx_secure_flash_update()
6906 mcp->mb[2] = region; in qla28xx_secure_flash_update()
6907 mcp->mb[3] = MSW(len); in qla28xx_secure_flash_update()
6908 mcp->mb[4] = LSW(len); in qla28xx_secure_flash_update()
6909 mcp->mb[5] = MSW(sfub_dma_addr); in qla28xx_secure_flash_update()
6910 mcp->mb[6] = LSW(sfub_dma_addr); in qla28xx_secure_flash_update()
6911 mcp->mb[7] = MSW(MSD(sfub_dma_addr)); in qla28xx_secure_flash_update()
6912 mcp->mb[8] = LSW(MSD(sfub_dma_addr)); in qla28xx_secure_flash_update()
6913 mcp->mb[9] = sfub_len; in qla28xx_secure_flash_update()
6914 mcp->out_mb = in qla28xx_secure_flash_update()
6916 mcp->in_mb = MBX_2|MBX_1|MBX_0; in qla28xx_secure_flash_update()
6917 mcp->tov = MBX_TOV_SECONDS; in qla28xx_secure_flash_update()
6918 mcp->flags = 0; in qla28xx_secure_flash_update()
6923 __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1], in qla28xx_secure_flash_update()
6924 mcp->mb[2]); in qla28xx_secure_flash_update()
6940 mcp->mb[0] = MBC_WRITE_REMOTE_REG; in qla2xxx_write_remote_register()
6941 mcp->mb[1] = LSW(addr); in qla2xxx_write_remote_register()
6942 mcp->mb[2] = MSW(addr); in qla2xxx_write_remote_register()
6943 mcp->mb[3] = LSW(data); in qla2xxx_write_remote_register()
6944 mcp->mb[4] = MSW(data); in qla2xxx_write_remote_register()
6945 mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2xxx_write_remote_register()
6946 mcp->in_mb = MBX_1|MBX_0; in qla2xxx_write_remote_register()
6947 mcp->tov = MBX_TOV_SECONDS; in qla2xxx_write_remote_register()
6948 mcp->flags = 0; in qla2xxx_write_remote_register()
6953 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2xxx_write_remote_register()
6972 mcp->mb[0] = MBC_READ_REMOTE_REG; in qla2xxx_read_remote_register()
6973 mcp->mb[1] = LSW(addr); in qla2xxx_read_remote_register()
6974 mcp->mb[2] = MSW(addr); in qla2xxx_read_remote_register()
6975 mcp->out_mb = MBX_2|MBX_1|MBX_0; in qla2xxx_read_remote_register()
6976 mcp->in_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; in qla2xxx_read_remote_register()
6977 mcp->tov = MBX_TOV_SECONDS; in qla2xxx_read_remote_register()
6978 mcp->flags = 0; in qla2xxx_read_remote_register()
6981 *data = (uint32_t)((((uint32_t)mcp->mb[4]) << 16) | mcp->mb[3]); in qla2xxx_read_remote_register()
6985 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla2xxx_read_remote_register()
6997 struct qla_hw_data *ha = vha->hw; in ql26xx_led_config()
7008 mcp->mb[0] = MBC_SET_GET_FC_LED_CONFIG; in ql26xx_led_config()
7009 mcp->mb[1] = options; in ql26xx_led_config()
7010 mcp->out_mb = MBX_1|MBX_0; in ql26xx_led_config()
7011 mcp->in_mb = MBX_1|MBX_0; in ql26xx_led_config()
7014 mcp->mb[2] = led[2]; in ql26xx_led_config()
7015 mcp->out_mb |= MBX_2; in ql26xx_led_config()
7018 mcp->mb[3] = led[0]; in ql26xx_led_config()
7019 mcp->out_mb |= MBX_3; in ql26xx_led_config()
7022 mcp->mb[4] = led[1]; in ql26xx_led_config()
7023 mcp->out_mb |= MBX_4; in ql26xx_led_config()
7026 mcp->in_mb |= MBX_4|MBX_3|MBX_2; in ql26xx_led_config()
7028 mcp->tov = MBX_TOV_SECONDS; in ql26xx_led_config()
7029 mcp->flags = 0; in ql26xx_led_config()
7033 __func__, rval, mcp->mb[0], mcp->mb[1]); in ql26xx_led_config()
7038 ha->beacon_blink_led = 0; in ql26xx_led_config()
7041 led[2] = mcp->mb[2]; in ql26xx_led_config()
7042 led[0] = mcp->mb[3]; in ql26xx_led_config()
7043 led[1] = mcp->mb[4]; in ql26xx_led_config()
7065 mcp->mb[0] = 0; // noop cmd= 0 in qla_no_op_mb()
7066 mcp->out_mb = MBX_0; in qla_no_op_mb()
7067 mcp->in_mb = MBX_0; in qla_no_op_mb()
7068 mcp->tov = 5; in qla_no_op_mb()
7069 mcp->flags = 0; in qla_no_op_mb()
7083 int rval = -EINVAL; in qla_mailbox_passthru()
7087 memcpy(&mcp->mb, (char *)mbx_in, (32 * sizeof(uint16_t))); in qla_mailbox_passthru()
7089 mcp->out_mb = 0xFFFFFFFF; in qla_mailbox_passthru()
7090 mcp->in_mb = 0xFFFFFFFF; in qla_mailbox_passthru()
7092 mcp->tov = MBX_TOV_SECONDS; in qla_mailbox_passthru()
7093 mcp->flags = 0; in qla_mailbox_passthru()
7094 mcp->bufp = NULL; in qla_mailbox_passthru()
7100 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); in qla_mailbox_passthru()
7105 memcpy(mbx_out, &mcp->mb, 32 * sizeof(uint16_t)); in qla_mailbox_passthru()