Lines Matching +full:mctp +full:- +full:handling

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
43 /* SRB Extensions ---------------------------------------------------------- */
50 scsi_qla_host_t *vha = sp->vha; in qla2x00_sp_timeout()
53 iocb = &sp->u.iocb_cmd; in qla2x00_sp_timeout()
54 iocb->timeout(sp); in qla2x00_sp_timeout()
57 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_timeout()
59 if (vha && qla2x00_isp_reg_stat(vha->hw)) { in qla2x00_sp_timeout()
68 struct srb_iocb *iocb = &sp->u.iocb_cmd; in qla2x00_sp_free()
70 del_timer(&iocb->timer); in qla2x00_sp_free()
84 /* Asynchronous Login/Logout Routines -------------------------------------- */
90 struct qla_hw_data *ha = vha->hw; in qla2x00_get_async_timeout()
93 tmo = ha->r_a_tov / 10 * 2; in qla2x00_get_async_timeout()
101 tmo = ha->login_timeout; in qla2x00_get_async_timeout()
109 struct srb_iocb *abt = &sp->u.iocb_cmd; in qla24xx_abort_iocb_timeout()
110 struct qla_qpair *qpair = sp->qpair; in qla24xx_abort_iocb_timeout()
115 if (sp->cmd_sp) in qla24xx_abort_iocb_timeout()
116 ql_dbg(ql_dbg_async, sp->vha, 0x507c, in qla24xx_abort_iocb_timeout()
117 "Abort timeout - cmd hdl=%x, cmd type=%x hdl=%x, type=%x\n", in qla24xx_abort_iocb_timeout()
118 sp->cmd_sp->handle, sp->cmd_sp->type, in qla24xx_abort_iocb_timeout()
119 sp->handle, sp->type); in qla24xx_abort_iocb_timeout()
121 ql_dbg(ql_dbg_async, sp->vha, 0x507c, in qla24xx_abort_iocb_timeout()
122 "Abort timeout 2 - hdl=%x, type=%x\n", in qla24xx_abort_iocb_timeout()
123 sp->handle, sp->type); in qla24xx_abort_iocb_timeout()
125 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla24xx_abort_iocb_timeout()
126 for (handle = 1; handle < qpair->req->num_outstanding_cmds; handle++) { in qla24xx_abort_iocb_timeout()
127 if (sp->cmd_sp && (qpair->req->outstanding_cmds[handle] == in qla24xx_abort_iocb_timeout()
128 sp->cmd_sp)) { in qla24xx_abort_iocb_timeout()
129 qpair->req->outstanding_cmds[handle] = NULL; in qla24xx_abort_iocb_timeout()
131 qla_put_fw_resources(qpair, &sp->cmd_sp->iores); in qla24xx_abort_iocb_timeout()
135 if (qpair->req->outstanding_cmds[handle] == sp) { in qla24xx_abort_iocb_timeout()
136 qpair->req->outstanding_cmds[handle] = NULL; in qla24xx_abort_iocb_timeout()
138 qla_put_fw_resources(qpair, &sp->iores); in qla24xx_abort_iocb_timeout()
142 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla24xx_abort_iocb_timeout()
144 if (cmdsp_found && sp->cmd_sp) { in qla24xx_abort_iocb_timeout()
149 sp->cmd_sp->done(sp->cmd_sp, QLA_OS_TIMER_EXPIRED); in qla24xx_abort_iocb_timeout()
153 abt->u.abt.comp_status = cpu_to_le16(CS_TIMEOUT); in qla24xx_abort_iocb_timeout()
154 sp->done(sp, QLA_OS_TIMER_EXPIRED); in qla24xx_abort_iocb_timeout()
160 struct srb_iocb *abt = &sp->u.iocb_cmd; in qla24xx_abort_sp_done()
161 srb_t *orig_sp = sp->cmd_sp; in qla24xx_abort_sp_done()
166 if (sp->flags & SRB_WAKEUP_ON_COMP) in qla24xx_abort_sp_done()
167 complete(&abt->u.abt.comp); in qla24xx_abort_sp_done()
170 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_abort_sp_done()
175 scsi_qla_host_t *vha = cmd_sp->vha; in qla24xx_async_abort_cmd()
181 sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport, in qla24xx_async_abort_cmd()
187 abt_iocb = &sp->u.iocb_cmd; in qla24xx_async_abort_cmd()
188 sp->type = SRB_ABT_CMD; in qla24xx_async_abort_cmd()
189 sp->name = "abort"; in qla24xx_async_abort_cmd()
190 sp->qpair = cmd_sp->qpair; in qla24xx_async_abort_cmd()
191 sp->cmd_sp = cmd_sp; in qla24xx_async_abort_cmd()
193 sp->flags = SRB_WAKEUP_ON_COMP; in qla24xx_async_abort_cmd()
195 init_completion(&abt_iocb->u.abt.comp); in qla24xx_async_abort_cmd()
198 sp->u.iocb_cmd.timeout = qla24xx_abort_iocb_timeout; in qla24xx_async_abort_cmd()
200 abt_iocb->u.abt.cmd_hndl = cmd_sp->handle; in qla24xx_async_abort_cmd()
201 abt_iocb->u.abt.req_que_no = cpu_to_le16(cmd_sp->qpair->req->id); in qla24xx_async_abort_cmd()
204 "Abort command issued - hdl=%x, type=%x\n", cmd_sp->handle, in qla24xx_async_abort_cmd()
205 cmd_sp->type); in qla24xx_async_abort_cmd()
210 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_async_abort_cmd()
215 wait_for_completion(&abt_iocb->u.abt.comp); in qla24xx_async_abort_cmd()
216 rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ? in qla24xx_async_abort_cmd()
219 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_async_abort_cmd()
229 fc_port_t *fcport = sp->fcport; in qla2x00_async_iocb_timeout()
230 struct srb_iocb *lio = &sp->u.iocb_cmd; in qla2x00_async_iocb_timeout()
235 ql_dbg(ql_dbg_disc, fcport->vha, 0x2071, in qla2x00_async_iocb_timeout()
236 "Async-%s timeout - hdl=%x portid=%06x %8phC.\n", in qla2x00_async_iocb_timeout()
237 sp->name, sp->handle, fcport->d_id.b24, fcport->port_name); in qla2x00_async_iocb_timeout()
239 fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla2x00_async_iocb_timeout()
241 pr_info("Async-%s timeout - hdl=%x.\n", in qla2x00_async_iocb_timeout()
242 sp->name, sp->handle); in qla2x00_async_iocb_timeout()
245 switch (sp->type) { in qla2x00_async_iocb_timeout()
250 lio->u.logio.data[0] = MBS_COMMAND_ERROR; in qla2x00_async_iocb_timeout()
251 lio->u.logio.data[1] = in qla2x00_async_iocb_timeout()
252 lio->u.logio.flags & SRB_LOGIN_RETRIED ? in qla2x00_async_iocb_timeout()
254 spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); in qla2x00_async_iocb_timeout()
255 for (h = 1; h < sp->qpair->req->num_outstanding_cmds; in qla2x00_async_iocb_timeout()
257 if (sp->qpair->req->outstanding_cmds[h] == in qla2x00_async_iocb_timeout()
259 sp->qpair->req->outstanding_cmds[h] = in qla2x00_async_iocb_timeout()
264 spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags); in qla2x00_async_iocb_timeout()
265 sp->done(sp, QLA_FUNCTION_TIMEOUT); in qla2x00_async_iocb_timeout()
278 spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); in qla2x00_async_iocb_timeout()
279 for (h = 1; h < sp->qpair->req->num_outstanding_cmds; in qla2x00_async_iocb_timeout()
281 if (sp->qpair->req->outstanding_cmds[h] == in qla2x00_async_iocb_timeout()
283 sp->qpair->req->outstanding_cmds[h] = in qla2x00_async_iocb_timeout()
288 spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags); in qla2x00_async_iocb_timeout()
289 sp->done(sp, QLA_FUNCTION_TIMEOUT); in qla2x00_async_iocb_timeout()
297 struct scsi_qla_host *vha = sp->vha; in qla2x00_async_login_sp_done()
298 struct srb_iocb *lio = &sp->u.iocb_cmd; in qla2x00_async_login_sp_done()
302 "%s %8phC res %d \n", __func__, sp->fcport->port_name, res); in qla2x00_async_login_sp_done()
304 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla2x00_async_login_sp_done()
306 if (!test_bit(UNLOADING, &vha->dpc_flags)) { in qla2x00_async_login_sp_done()
308 ea.fcport = sp->fcport; in qla2x00_async_login_sp_done()
309 ea.data[0] = lio->u.logio.data[0]; in qla2x00_async_login_sp_done()
310 ea.data[1] = lio->u.logio.data[1]; in qla2x00_async_login_sp_done()
311 ea.iop[0] = lio->u.logio.iop[0]; in qla2x00_async_login_sp_done()
312 ea.iop[1] = lio->u.logio.iop[1]; in qla2x00_async_login_sp_done()
320 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_login_sp_done()
331 if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) || in qla2x00_async_login()
332 fcport->loop_id == FC_NO_LOOP_ID) { in qla2x00_async_login()
334 "%s: %8phC - not sending command.\n", in qla2x00_async_login()
335 __func__, fcport->port_name); in qla2x00_async_login()
345 fcport->flags |= FCF_ASYNC_SENT; in qla2x00_async_login()
346 fcport->logout_completed = 0; in qla2x00_async_login()
348 sp->type = SRB_LOGIN_CMD; in qla2x00_async_login()
349 sp->name = "login"; in qla2x00_async_login()
350 sp->gen1 = fcport->rscn_gen; in qla2x00_async_login()
351 sp->gen2 = fcport->login_gen; in qla2x00_async_login()
355 lio = &sp->u.iocb_cmd; in qla2x00_async_login()
356 if (N2N_TOPO(fcport->vha->hw) && fcport_is_bigger(fcport)) { in qla2x00_async_login()
357 lio->u.logio.flags |= SRB_LOGIN_PRLI_ONLY; in qla2x00_async_login()
359 if (vha->hw->flags.edif_enabled && in qla2x00_async_login()
361 lio->u.logio.flags |= in qla2x00_async_login()
364 lio->u.logio.flags |= SRB_LOGIN_COND_PLOGI; in qla2x00_async_login()
368 if (NVME_TARGET(vha->hw, fcport)) in qla2x00_async_login()
369 lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI; in qla2x00_async_login()
374 "Async-login - %8phC hdl=%x, loopid=%x portid=%06x retries=%d %s.\n", in qla2x00_async_login()
375 fcport->port_name, sp->handle, fcport->loop_id, in qla2x00_async_login()
376 fcport->d_id.b24, fcport->login_retry, in qla2x00_async_login()
377 lio->u.logio.flags & SRB_LOGIN_FCSP ? "FCSP" : ""); in qla2x00_async_login()
380 fcport->flags |= FCF_LOGIN_NEEDED; in qla2x00_async_login()
381 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_async_login()
389 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_login()
390 fcport->flags &= ~FCF_ASYNC_SENT; in qla2x00_async_login()
392 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla2x00_async_login()
396 * being low. Set state DELETED for re-login process to start again. in qla2x00_async_login()
404 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla2x00_async_logout_sp_done()
405 sp->fcport->login_gen++; in qla2x00_async_logout_sp_done()
406 qlt_logo_completion_handler(sp->fcport, sp->u.iocb_cmd.u.logio.data[0]); in qla2x00_async_logout_sp_done()
408 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_logout_sp_done()
417 fcport->flags |= FCF_ASYNC_SENT; in qla2x00_async_logout()
423 sp->type = SRB_LOGOUT_CMD; in qla2x00_async_logout()
424 sp->name = "logout"; in qla2x00_async_logout()
429 "Async-logout - hdl=%x loop-id=%x portid=%02x%02x%02x %8phC explicit %d.\n", in qla2x00_async_logout()
430 sp->handle, fcport->loop_id, fcport->d_id.b.domain, in qla2x00_async_logout()
431 fcport->d_id.b.area, fcport->d_id.b.al_pa, in qla2x00_async_logout()
432 fcport->port_name, fcport->explicit_logout); in qla2x00_async_logout()
441 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_logout()
443 fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla2x00_async_logout()
451 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla2x00_async_prlo_done()
452 /* Don't re-login in target mode */ in qla2x00_async_prlo_done()
453 if (!fcport->tgt_session) in qla2x00_async_prlo_done()
460 struct srb_iocb *lio = &sp->u.iocb_cmd; in qla2x00_async_prlo_sp_done()
461 struct scsi_qla_host *vha = sp->vha; in qla2x00_async_prlo_sp_done()
463 sp->fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla2x00_async_prlo_sp_done()
464 if (!test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_async_prlo_sp_done()
465 qla2x00_post_async_prlo_done_work(sp->fcport->vha, sp->fcport, in qla2x00_async_prlo_sp_done()
466 lio->u.logio.data); in qla2x00_async_prlo_sp_done()
468 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_prlo_sp_done()
483 sp->type = SRB_PRLO_CMD; in qla2x00_async_prlo()
484 sp->name = "prlo"; in qla2x00_async_prlo()
489 "Async-prlo - hdl=%x loop-id=%x portid=%02x%02x%02x.\n", in qla2x00_async_prlo()
490 sp->handle, fcport->loop_id, fcport->d_id.b.domain, in qla2x00_async_prlo()
491 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_async_prlo()
501 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_prlo()
503 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla2x00_async_prlo()
510 struct fc_port *fcport = ea->fcport; in qla24xx_handle_adisc_event()
515 __func__, fcport->port_name, fcport->disc_state, in qla24xx_handle_adisc_event()
516 fcport->fw_login_state, ea->rc, fcport->login_gen, ea->sp->gen2, in qla24xx_handle_adisc_event()
517 fcport->rscn_gen, ea->sp->gen1, fcport->loop_id); in qla24xx_handle_adisc_event()
519 WARN_ONCE(!qla2xxx_is_valid_mbs(ea->data[0]), "mbs: %#x\n", in qla24xx_handle_adisc_event()
520 ea->data[0]); in qla24xx_handle_adisc_event()
522 if (ea->data[0] != MBS_COMMAND_COMPLETE) { in qla24xx_handle_adisc_event()
525 __func__, ea->fcport->port_name); in qla24xx_handle_adisc_event()
527 spin_lock_irqsave(&vha->work_lock, flags); in qla24xx_handle_adisc_event()
529 if (fcport->deleted == QLA_SESS_DELETED) in qla24xx_handle_adisc_event()
530 fcport->deleted = 0; in qla24xx_handle_adisc_event()
532 fcport->logout_on_delete = 1; in qla24xx_handle_adisc_event()
533 spin_unlock_irqrestore(&vha->work_lock, flags); in qla24xx_handle_adisc_event()
535 qlt_schedule_sess_for_deletion(ea->fcport); in qla24xx_handle_adisc_event()
539 if (ea->fcport->disc_state == DSC_DELETE_PEND) in qla24xx_handle_adisc_event()
542 if (ea->sp->gen2 != ea->fcport->login_gen) { in qla24xx_handle_adisc_event()
546 __func__, ea->fcport->port_name); in qla24xx_handle_adisc_event()
548 } else if (ea->sp->gen1 != ea->fcport->rscn_gen) { in qla24xx_handle_adisc_event()
565 e->u.fcport.fcport = fcport; in qla_post_els_plogi_work()
566 fcport->flags |= FCF_ASYNC_ACTIVE; in qla_post_els_plogi_work()
573 struct scsi_qla_host *vha = sp->vha; in qla2x00_async_adisc_sp_done()
575 struct srb_iocb *lio = &sp->u.iocb_cmd; in qla2x00_async_adisc_sp_done()
578 "Async done-%s res %x %8phC\n", in qla2x00_async_adisc_sp_done()
579 sp->name, res, sp->fcport->port_name); in qla2x00_async_adisc_sp_done()
581 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla2x00_async_adisc_sp_done()
585 ea.data[0] = lio->u.logio.data[0]; in qla2x00_async_adisc_sp_done()
586 ea.data[1] = lio->u.logio.data[1]; in qla2x00_async_adisc_sp_done()
587 ea.iop[0] = lio->u.logio.iop[0]; in qla2x00_async_adisc_sp_done()
588 ea.iop[1] = lio->u.logio.iop[1]; in qla2x00_async_adisc_sp_done()
589 ea.fcport = sp->fcport; in qla2x00_async_adisc_sp_done()
596 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_adisc_sp_done()
609 "%s: %8phC is being delete - not sending command.\n", in qla2x00_async_adisc()
610 __func__, fcport->port_name); in qla2x00_async_adisc()
611 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla2x00_async_adisc()
615 if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) in qla2x00_async_adisc()
618 fcport->flags |= FCF_ASYNC_SENT; in qla2x00_async_adisc()
624 sp->type = SRB_ADISC_CMD; in qla2x00_async_adisc()
625 sp->name = "adisc"; in qla2x00_async_adisc()
626 sp->gen1 = fcport->rscn_gen; in qla2x00_async_adisc()
627 sp->gen2 = fcport->login_gen; in qla2x00_async_adisc()
632 lio = &sp->u.iocb_cmd; in qla2x00_async_adisc()
633 lio->u.logio.flags |= SRB_LOGIN_RETRIED; in qla2x00_async_adisc()
637 "Async-adisc - hdl=%x loopid=%x portid=%06x %8phC.\n", in qla2x00_async_adisc()
638 sp->handle, fcport->loop_id, fcport->d_id.b24, fcport->port_name); in qla2x00_async_adisc()
648 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_adisc()
650 fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla2x00_async_adisc()
657 struct qla_hw_data *ha = vha->hw; in qla2x00_is_reserved_id()
662 return (loop_id > ha->max_loop_id && loop_id < SNS_FIRST_LOOP_ID) || in qla2x00_is_reserved_id()
667 * qla2x00_find_new_loop_id - scan through our port list and find a new usable loop ID
680 struct qla_hw_data *ha = vha->hw; in qla2x00_find_new_loop_id()
685 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_find_new_loop_id()
687 dev->loop_id = find_first_zero_bit(ha->loop_id_map, LOOPID_MAP_SIZE); in qla2x00_find_new_loop_id()
688 if (dev->loop_id >= LOOPID_MAP_SIZE || in qla2x00_find_new_loop_id()
689 qla2x00_is_reserved_id(vha, dev->loop_id)) { in qla2x00_find_new_loop_id()
690 dev->loop_id = FC_NO_LOOP_ID; in qla2x00_find_new_loop_id()
693 set_bit(dev->loop_id, ha->loop_id_map); in qla2x00_find_new_loop_id()
695 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_find_new_loop_id()
698 ql_dbg(ql_dbg_disc, dev->vha, 0x2086, in qla2x00_find_new_loop_id()
700 dev->loop_id, dev->d_id.b24); in qla2x00_find_new_loop_id()
702 ql_log(ql_log_warn, dev->vha, 0x2087, in qla2x00_find_new_loop_id()
704 dev->d_id.b24); in qla2x00_find_new_loop_id()
711 struct qla_hw_data *ha = fcport->vha->hw; in qla2x00_clear_loop_id()
713 if (fcport->loop_id == FC_NO_LOOP_ID || in qla2x00_clear_loop_id()
714 qla2x00_is_reserved_id(fcport->vha, fcport->loop_id)) in qla2x00_clear_loop_id()
717 clear_bit(fcport->loop_id, ha->loop_id_map); in qla2x00_clear_loop_id()
718 fcport->loop_id = FC_NO_LOOP_ID; in qla2x00_clear_loop_id()
732 fcport = ea->fcport; in qla24xx_handle_gnl_done_event()
735 __func__, fcport->port_name, fcport->disc_state, in qla24xx_handle_gnl_done_event()
736 fcport->fw_login_state, ea->rc, in qla24xx_handle_gnl_done_event()
737 fcport->login_gen, fcport->last_login_gen, in qla24xx_handle_gnl_done_event()
738 fcport->rscn_gen, fcport->last_rscn_gen, vha->loop_id, fcport->edif.enable); in qla24xx_handle_gnl_done_event()
740 if (fcport->disc_state == DSC_DELETE_PEND) in qla24xx_handle_gnl_done_event()
743 if (ea->rc) { /* rval */ in qla24xx_handle_gnl_done_event()
744 if (fcport->login_retry == 0) { in qla24xx_handle_gnl_done_event()
747 fcport->port_name, fcport->login_retry); in qla24xx_handle_gnl_done_event()
752 if (fcport->last_rscn_gen != fcport->rscn_gen) { in qla24xx_handle_gnl_done_event()
756 } else if (fcport->last_login_gen != fcport->login_gen) { in qla24xx_handle_gnl_done_event()
759 __func__, fcport->port_name); in qla24xx_handle_gnl_done_event()
760 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_handle_gnl_done_event()
764 n = ea->data[0] / sizeof(struct get_name_list_extended); in qla24xx_handle_gnl_done_event()
768 __func__, __LINE__, fcport->port_name, n, in qla24xx_handle_gnl_done_event()
769 fcport->d_id.b.domain, fcport->d_id.b.area, in qla24xx_handle_gnl_done_event()
770 fcport->d_id.b.al_pa, fcport->loop_id); in qla24xx_handle_gnl_done_event()
773 e = &vha->gnl.l[i]; in qla24xx_handle_gnl_done_event()
774 wwn = wwn_to_u64(e->port_name); in qla24xx_handle_gnl_done_event()
775 id.b.domain = e->port_id[2]; in qla24xx_handle_gnl_done_event()
776 id.b.area = e->port_id[1]; in qla24xx_handle_gnl_done_event()
777 id.b.al_pa = e->port_id[0]; in qla24xx_handle_gnl_done_event()
780 if (memcmp((u8 *)&wwn, fcport->port_name, WWN_SIZE)) in qla24xx_handle_gnl_done_event()
788 loop_id = le16_to_cpu(e->nport_handle); in qla24xx_handle_gnl_done_event()
790 nvme_cls = e->current_login_state >> 4; in qla24xx_handle_gnl_done_event()
791 current_login_state = e->current_login_state & 0xf; in qla24xx_handle_gnl_done_event()
795 fcport->fc4_type &= ~FS_FC4TYPE_FCP; in qla24xx_handle_gnl_done_event()
796 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_handle_gnl_done_event()
798 fcport->fc4_type |= FS_FC4TYPE_FCP; in qla24xx_handle_gnl_done_event()
799 fcport->fc4_type &= ~FS_FC4TYPE_NVME; in qla24xx_handle_gnl_done_event()
804 __func__, fcport->port_name, in qla24xx_handle_gnl_done_event()
805 e->current_login_state, fcport->fw_login_state, in qla24xx_handle_gnl_done_event()
806 fcport->fc4_type, id.b24, fcport->d_id.b24, in qla24xx_handle_gnl_done_event()
807 loop_id, fcport->loop_id); in qla24xx_handle_gnl_done_event()
809 switch (fcport->disc_state) { in qla24xx_handle_gnl_done_event()
814 if ((id.b24 != fcport->d_id.b24 && in qla24xx_handle_gnl_done_event()
815 fcport->d_id.b24 && in qla24xx_handle_gnl_done_event()
816 fcport->loop_id != FC_NO_LOOP_ID) || in qla24xx_handle_gnl_done_event()
817 (fcport->loop_id != FC_NO_LOOP_ID && in qla24xx_handle_gnl_done_event()
818 fcport->loop_id != loop_id)) { in qla24xx_handle_gnl_done_event()
821 __func__, __LINE__, fcport->port_name); in qla24xx_handle_gnl_done_event()
822 if (fcport->n2n_flag) in qla24xx_handle_gnl_done_event()
823 fcport->d_id.b24 = 0; in qla24xx_handle_gnl_done_event()
830 fcport->loop_id = loop_id; in qla24xx_handle_gnl_done_event()
831 if (fcport->n2n_flag) in qla24xx_handle_gnl_done_event()
832 fcport->d_id.b24 = id.b24; in qla24xx_handle_gnl_done_event()
834 wwn = wwn_to_u64(fcport->port_name); in qla24xx_handle_gnl_done_event()
844 conflict_fcport->conflict = fcport; in qla24xx_handle_gnl_done_event()
845 fcport->login_pause = 1; in qla24xx_handle_gnl_done_event()
848 switch (vha->hw->current_topology) { in qla24xx_handle_gnl_done_event()
854 __func__, __LINE__, fcport->port_name); in qla24xx_handle_gnl_done_event()
856 if ((e->prli_svc_param_word_3[0] & BIT_4) == 0) in qla24xx_handle_gnl_done_event()
857 fcport->port_type = FCT_INITIATOR; in qla24xx_handle_gnl_done_event()
859 fcport->port_type = FCT_TARGET; in qla24xx_handle_gnl_done_event()
865 if (vha->hw->flags.edif_enabled) { in qla24xx_handle_gnl_done_event()
873 if (fcport->loop_id == FC_NO_LOOP_ID) { in qla24xx_handle_gnl_done_event()
875 fcport->fw_login_state = in qla24xx_handle_gnl_done_event()
880 fcport->port_name); in qla24xx_handle_gnl_done_event()
886 fcport->fw_login_state = current_login_state; in qla24xx_handle_gnl_done_event()
887 fcport->d_id = id; in qla24xx_handle_gnl_done_event()
898 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_handle_gnl_done_event()
901 if ((e->prli_svc_param_word_3[0] & BIT_4) == 0) in qla24xx_handle_gnl_done_event()
902 fcport->port_type = FCT_INITIATOR; in qla24xx_handle_gnl_done_event()
904 fcport->port_type = FCT_TARGET; in qla24xx_handle_gnl_done_event()
911 if (vha->hw->flags.edif_enabled && in qla24xx_handle_gnl_done_event()
919 if (fcport->loop_id != FC_NO_LOOP_ID) in qla24xx_handle_gnl_done_event()
922 fcport->loop_id = loop_id; in qla24xx_handle_gnl_done_event()
931 if (fcport->loop_id != FC_NO_LOOP_ID) in qla24xx_handle_gnl_done_event()
934 fcport->loop_id = loop_id; in qla24xx_handle_gnl_done_event()
941 } /* switch (ha->current_topology) */ in qla24xx_handle_gnl_done_event()
945 switch (vha->hw->current_topology) { in qla24xx_handle_gnl_done_event()
949 e = &vha->gnl.l[i]; in qla24xx_handle_gnl_done_event()
950 id.b.domain = e->port_id[0]; in qla24xx_handle_gnl_done_event()
951 id.b.area = e->port_id[1]; in qla24xx_handle_gnl_done_event()
952 id.b.al_pa = e->port_id[2]; in qla24xx_handle_gnl_done_event()
954 loop_id = le16_to_cpu(e->nport_handle); in qla24xx_handle_gnl_done_event()
956 if (fcport->d_id.b24 == id.b24) { in qla24xx_handle_gnl_done_event()
959 e->port_name, 0); in qla24xx_handle_gnl_done_event()
965 conflict_fcport->port_name); in qla24xx_handle_gnl_done_event()
974 if (fcport->loop_id == loop_id) in qla24xx_handle_gnl_done_event()
975 fcport->loop_id = FC_NO_LOOP_ID; in qla24xx_handle_gnl_done_event()
981 if (time_after_eq(jiffies, fcport->dm_login_expire)) { in qla24xx_handle_gnl_done_event()
982 if (fcport->n2n_link_reset_cnt < 2) { in qla24xx_handle_gnl_done_event()
983 fcport->n2n_link_reset_cnt++; in qla24xx_handle_gnl_done_event()
990 &vha->dpc_flags); in qla24xx_handle_gnl_done_event()
992 if (fcport->n2n_chip_reset < 1) { in qla24xx_handle_gnl_done_event()
996 &vha->dpc_flags); in qla24xx_handle_gnl_done_event()
997 fcport->n2n_chip_reset++; in qla24xx_handle_gnl_done_event()
1001 fcport->port_name); in qla24xx_handle_gnl_done_event()
1002 fcport->scan_state = 0; in qla24xx_handle_gnl_done_event()
1011 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_handle_gnl_done_event()
1025 struct scsi_qla_host *vha = sp->vha; in qla24xx_async_gnl_sp_done()
1036 "Async done-%s res %x mb[1]=%x mb[2]=%x \n", in qla24xx_async_gnl_sp_done()
1037 sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1], in qla24xx_async_gnl_sp_done()
1038 sp->u.iocb_cmd.u.mbx.in_mb[2]); in qla24xx_async_gnl_sp_done()
1041 sp->fcport->flags &= ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE); in qla24xx_async_gnl_sp_done()
1046 if (sp->u.iocb_cmd.u.mbx.in_mb[1] >= in qla24xx_async_gnl_sp_done()
1048 n = sp->u.iocb_cmd.u.mbx.in_mb[1] / in qla24xx_async_gnl_sp_done()
1050 ea.data[0] = sp->u.iocb_cmd.u.mbx.in_mb[1]; /* amnt xfered */ in qla24xx_async_gnl_sp_done()
1054 e = &vha->gnl.l[i]; in qla24xx_async_gnl_sp_done()
1055 loop_id = le16_to_cpu(e->nport_handle); in qla24xx_async_gnl_sp_done()
1058 set_bit(loop_id, vha->hw->loop_id_map); in qla24xx_async_gnl_sp_done()
1059 wwn = wwn_to_u64(e->port_name); in qla24xx_async_gnl_sp_done()
1063 __func__, &wwn, e->port_id[2], e->port_id[1], in qla24xx_async_gnl_sp_done()
1064 e->port_id[0], e->current_login_state, e->last_login_state, in qla24xx_async_gnl_sp_done()
1068 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl_sp_done()
1072 if (!list_empty(&vha->gnl.fcports)) in qla24xx_async_gnl_sp_done()
1073 list_splice_init(&vha->gnl.fcports, &h); in qla24xx_async_gnl_sp_done()
1074 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl_sp_done()
1077 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl_sp_done()
1078 list_del_init(&fcport->gnl_entry); in qla24xx_async_gnl_sp_done()
1079 fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla24xx_async_gnl_sp_done()
1080 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl_sp_done()
1091 e = &vha->gnl.l[i]; in qla24xx_async_gnl_sp_done()
1092 wwn = wwn_to_u64(e->port_name); in qla24xx_async_gnl_sp_done()
1095 list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { in qla24xx_async_gnl_sp_done()
1096 if (!memcmp((u8 *)&wwn, fcport->port_name, in qla24xx_async_gnl_sp_done()
1103 id.b.domain = e->port_id[2]; in qla24xx_async_gnl_sp_done()
1104 id.b.area = e->port_id[1]; in qla24xx_async_gnl_sp_done()
1105 id.b.al_pa = e->port_id[0]; in qla24xx_async_gnl_sp_done()
1112 wwnn = wwn_to_u64(e->node_name); in qla24xx_async_gnl_sp_done()
1118 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl_sp_done()
1119 vha->gnl.sent = 0; in qla24xx_async_gnl_sp_done()
1120 if (!list_empty(&vha->gnl.fcports)) { in qla24xx_async_gnl_sp_done()
1122 list_for_each_entry_safe(fcport, tf, &vha->gnl.fcports, in qla24xx_async_gnl_sp_done()
1124 list_del_init(&fcport->gnl_entry); in qla24xx_async_gnl_sp_done()
1125 fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla24xx_async_gnl_sp_done()
1130 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl_sp_done()
1133 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_async_gnl_sp_done()
1143 if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) in qla24xx_async_gnl()
1147 "Async-gnlist WWPN %8phC \n", fcport->port_name); in qla24xx_async_gnl()
1149 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl()
1150 fcport->flags |= FCF_ASYNC_SENT; in qla24xx_async_gnl()
1152 fcport->last_rscn_gen = fcport->rscn_gen; in qla24xx_async_gnl()
1153 fcport->last_login_gen = fcport->login_gen; in qla24xx_async_gnl()
1155 list_add_tail(&fcport->gnl_entry, &vha->gnl.fcports); in qla24xx_async_gnl()
1156 if (vha->gnl.sent) { in qla24xx_async_gnl()
1157 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl()
1160 vha->gnl.sent = 1; in qla24xx_async_gnl()
1161 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_async_gnl()
1168 sp->type = SRB_MB_IOCB; in qla24xx_async_gnl()
1169 sp->name = "gnlist"; in qla24xx_async_gnl()
1170 sp->gen1 = fcport->rscn_gen; in qla24xx_async_gnl()
1171 sp->gen2 = fcport->login_gen; in qla24xx_async_gnl()
1175 mb = sp->u.iocb_cmd.u.mbx.out_mb; in qla24xx_async_gnl()
1178 mb[2] = MSW(vha->gnl.ldma); in qla24xx_async_gnl()
1179 mb[3] = LSW(vha->gnl.ldma); in qla24xx_async_gnl()
1180 mb[6] = MSW(MSD(vha->gnl.ldma)); in qla24xx_async_gnl()
1181 mb[7] = LSW(MSD(vha->gnl.ldma)); in qla24xx_async_gnl()
1182 mb[8] = vha->gnl.size; in qla24xx_async_gnl()
1183 mb[9] = vha->vp_idx; in qla24xx_async_gnl()
1186 "Async-%s - OUT WWPN %8phC hndl %x\n", in qla24xx_async_gnl()
1187 sp->name, fcport->port_name, sp->handle); in qla24xx_async_gnl()
1200 sp->u.iocb_cmd.u.mbx.in_mb[0] = MBS_COMMAND_ERROR; in qla24xx_async_gnl()
1202 fcport->flags &= ~(FCF_ASYNC_SENT); in qla24xx_async_gnl()
1204 fcport->flags &= ~(FCF_ASYNC_ACTIVE); in qla24xx_async_gnl()
1216 e->u.fcport.fcport = fcport; in qla24xx_post_gnl_work()
1217 fcport->flags |= FCF_ASYNC_ACTIVE; in qla24xx_post_gnl_work()
1223 struct scsi_qla_host *vha = sp->vha; in qla24xx_async_gpdb_sp_done()
1224 struct qla_hw_data *ha = vha->hw; in qla24xx_async_gpdb_sp_done()
1225 fc_port_t *fcport = sp->fcport; in qla24xx_async_gpdb_sp_done()
1226 u16 *mb = sp->u.iocb_cmd.u.mbx.in_mb; in qla24xx_async_gpdb_sp_done()
1230 "Async done-%s res %x, WWPN %8phC mb[1]=%x mb[2]=%x \n", in qla24xx_async_gpdb_sp_done()
1231 sp->name, res, fcport->port_name, mb[1], mb[2]); in qla24xx_async_gpdb_sp_done()
1233 fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla24xx_async_gpdb_sp_done()
1245 dma_pool_free(ha->s_dma_pool, sp->u.iocb_cmd.u.mbx.in, in qla24xx_async_gpdb_sp_done()
1246 sp->u.iocb_cmd.u.mbx.in_dma); in qla24xx_async_gpdb_sp_done()
1248 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_async_gpdb_sp_done()
1255 if (vha->host->active_mode == MODE_TARGET) in qla24xx_post_prli_work()
1262 e->u.fcport.fcport = fcport; in qla24xx_post_prli_work()
1269 struct scsi_qla_host *vha = sp->vha; in qla2x00_async_prli_sp_done()
1270 struct srb_iocb *lio = &sp->u.iocb_cmd; in qla2x00_async_prli_sp_done()
1275 sp->fcport->port_name, res); in qla2x00_async_prli_sp_done()
1277 sp->fcport->flags &= ~FCF_ASYNC_SENT; in qla2x00_async_prli_sp_done()
1279 if (!test_bit(UNLOADING, &vha->dpc_flags)) { in qla2x00_async_prli_sp_done()
1281 ea.fcport = sp->fcport; in qla2x00_async_prli_sp_done()
1282 ea.data[0] = lio->u.logio.data[0]; in qla2x00_async_prli_sp_done()
1283 ea.data[1] = lio->u.logio.data[1]; in qla2x00_async_prli_sp_done()
1284 ea.iop[0] = lio->u.logio.iop[0]; in qla2x00_async_prli_sp_done()
1285 ea.iop[1] = lio->u.logio.iop[1]; in qla2x00_async_prli_sp_done()
1295 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_async_prli_sp_done()
1305 if (!vha->flags.online) { in qla24xx_async_prli()
1307 __func__, __LINE__, fcport->port_name); in qla24xx_async_prli()
1311 if ((fcport->fw_login_state == DSC_LS_PLOGI_PEND || in qla24xx_async_prli()
1312 fcport->fw_login_state == DSC_LS_PRLI_PEND) && in qla24xx_async_prli()
1315 __func__, __LINE__, fcport->port_name); in qla24xx_async_prli()
1323 fcport->flags |= FCF_ASYNC_SENT; in qla24xx_async_prli()
1324 fcport->logout_completed = 0; in qla24xx_async_prli()
1326 sp->type = SRB_PRLI_CMD; in qla24xx_async_prli()
1327 sp->name = "prli"; in qla24xx_async_prli()
1331 lio = &sp->u.iocb_cmd; in qla24xx_async_prli()
1332 lio->u.logio.flags = 0; in qla24xx_async_prli()
1334 if (NVME_TARGET(vha->hw, fcport)) in qla24xx_async_prli()
1335 lio->u.logio.flags |= SRB_LOGIN_NVME_PRLI; in qla24xx_async_prli()
1338 "Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d fc4type %x priority %x %s.\n", in qla24xx_async_prli()
1339 fcport->port_name, sp->handle, fcport->loop_id, fcport->d_id.b24, in qla24xx_async_prli()
1340 fcport->login_retry, fcport->fc4_type, vha->hw->fc4_type_priority, in qla24xx_async_prli()
1341 NVME_TARGET(vha->hw, fcport) ? "nvme" : "fcp"); in qla24xx_async_prli()
1345 fcport->flags |= FCF_LOGIN_NEEDED; in qla24xx_async_prli()
1346 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_async_prli()
1354 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_async_prli()
1355 fcport->flags &= ~FCF_ASYNC_SENT; in qla24xx_async_prli()
1367 e->u.fcport.fcport = fcport; in qla24xx_post_gpdb_work()
1368 e->u.fcport.opt = opt; in qla24xx_post_gpdb_work()
1369 fcport->flags |= FCF_ASYNC_ACTIVE; in qla24xx_post_gpdb_work()
1381 struct qla_hw_data *ha = vha->hw; in qla24xx_async_gpdb()
1385 "%s: %8phC is being delete - not sending command.\n", in qla24xx_async_gpdb()
1386 __func__, fcport->port_name); in qla24xx_async_gpdb()
1387 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla24xx_async_gpdb()
1391 if (!vha->flags.online || fcport->flags & FCF_ASYNC_SENT) { in qla24xx_async_gpdb()
1393 "%s: %8phC online %d flags %x - not sending command.\n", in qla24xx_async_gpdb()
1394 __func__, fcport->port_name, vha->flags.online, fcport->flags); in qla24xx_async_gpdb()
1404 fcport->flags |= FCF_ASYNC_SENT; in qla24xx_async_gpdb()
1405 sp->type = SRB_MB_IOCB; in qla24xx_async_gpdb()
1406 sp->name = "gpdb"; in qla24xx_async_gpdb()
1407 sp->gen1 = fcport->rscn_gen; in qla24xx_async_gpdb()
1408 sp->gen2 = fcport->login_gen; in qla24xx_async_gpdb()
1412 pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); in qla24xx_async_gpdb()
1419 mb = sp->u.iocb_cmd.u.mbx.out_mb; in qla24xx_async_gpdb()
1421 mb[1] = fcport->loop_id; in qla24xx_async_gpdb()
1426 mb[9] = vha->vp_idx; in qla24xx_async_gpdb()
1429 mbx = &sp->u.iocb_cmd; in qla24xx_async_gpdb()
1430 mbx->u.mbx.in = (void *)pd; in qla24xx_async_gpdb()
1431 mbx->u.mbx.in_dma = pd_dma; in qla24xx_async_gpdb()
1434 "Async-%s %8phC hndl %x opt %x\n", in qla24xx_async_gpdb()
1435 sp->name, fcport->port_name, sp->handle, opt); in qla24xx_async_gpdb()
1444 dma_pool_free(ha->s_dma_pool, pd, pd_dma); in qla24xx_async_gpdb()
1446 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_async_gpdb()
1447 fcport->flags &= ~FCF_ASYNC_SENT; in qla24xx_async_gpdb()
1449 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla24xx_async_gpdb()
1459 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in __qla24xx_handle_gpdb_event()
1460 ea->fcport->login_gen++; in __qla24xx_handle_gpdb_event()
1461 ea->fcport->logout_on_delete = 1; in __qla24xx_handle_gpdb_event()
1463 if (!ea->fcport->login_succ && !IS_SW_RESV_ADDR(ea->fcport->d_id)) { in __qla24xx_handle_gpdb_event()
1464 vha->fcport_count++; in __qla24xx_handle_gpdb_event()
1465 ea->fcport->login_succ = 1; in __qla24xx_handle_gpdb_event()
1467 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in __qla24xx_handle_gpdb_event()
1468 qla24xx_sched_upd_fcport(ea->fcport); in __qla24xx_handle_gpdb_event()
1469 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in __qla24xx_handle_gpdb_event()
1470 } else if (ea->fcport->login_succ) { in __qla24xx_handle_gpdb_event()
1473 * must have triggered the session to be re-validate. in __qla24xx_handle_gpdb_event()
1478 __func__, __LINE__, ea->fcport->port_name); in __qla24xx_handle_gpdb_event()
1479 qla2x00_set_fcport_disc_state(ea->fcport, DSC_LOGIN_COMPLETE); in __qla24xx_handle_gpdb_event()
1481 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in __qla24xx_handle_gpdb_event()
1489 if (pd->secure_login) { in qla_chk_secure_login()
1492 fcport->port_name); in qla_chk_secure_login()
1493 fcport->flags |= FCF_FCSP_DEVICE; in qla_chk_secure_login()
1496 "non-Secure Login %8phC", in qla_chk_secure_login()
1497 fcport->port_name); in qla_chk_secure_login()
1498 fcport->flags &= ~FCF_FCSP_DEVICE; in qla_chk_secure_login()
1500 if (vha->hw->flags.edif_enabled) { in qla_chk_secure_login()
1501 if (fcport->flags & FCF_FCSP_DEVICE) { in qla_chk_secure_login()
1504 fcport->edif.rx_sa_set = 0; in qla_chk_secure_login()
1505 fcport->edif.tx_sa_set = 0; in qla_chk_secure_login()
1506 fcport->edif.rx_sa_pending = 0; in qla_chk_secure_login()
1507 fcport->edif.tx_sa_pending = 0; in qla_chk_secure_login()
1510 fcport->d_id.b24); in qla_chk_secure_login()
1515 __func__, __LINE__, fcport->port_name); in qla_chk_secure_login()
1516 fcport->edif.app_sess_online = 1; in qla_chk_secure_login()
1519 fcport->d_id.b24, 0, fcport); in qla_chk_secure_login()
1526 __func__, __LINE__, fcport->port_name); in qla_chk_secure_login()
1537 fc_port_t *fcport = ea->fcport; in qla24xx_handle_gpdb_event()
1539 struct srb *sp = ea->sp; in qla24xx_handle_gpdb_event()
1542 pd = (struct port_database_24xx *)sp->u.iocb_cmd.u.mbx.in; in qla24xx_handle_gpdb_event()
1544 fcport->flags &= ~FCF_ASYNC_SENT; in qla24xx_handle_gpdb_event()
1548 fcport->port_name, fcport->disc_state, pd->current_login_state, in qla24xx_handle_gpdb_event()
1549 fcport->fc4_type, ea->rc); in qla24xx_handle_gpdb_event()
1551 if (fcport->disc_state == DSC_DELETE_PEND) { in qla24xx_handle_gpdb_event()
1553 __func__, __LINE__, fcport->port_name); in qla24xx_handle_gpdb_event()
1557 if (NVME_TARGET(vha->hw, fcport)) in qla24xx_handle_gpdb_event()
1558 ls = pd->current_login_state >> 4; in qla24xx_handle_gpdb_event()
1560 ls = pd->current_login_state & 0xf; in qla24xx_handle_gpdb_event()
1562 if (ea->sp->gen2 != fcport->login_gen) { in qla24xx_handle_gpdb_event()
1567 __func__, fcport->port_name); in qla24xx_handle_gpdb_event()
1569 } else if (ea->sp->gen1 != fcport->rscn_gen) { in qla24xx_handle_gpdb_event()
1573 __func__, __LINE__, fcport->port_name, ls); in qla24xx_handle_gpdb_event()
1584 __func__, __LINE__, fcport->port_name, ls); in qla24xx_handle_gpdb_event()
1595 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_handle_gpdb_event()
1598 __func__, __LINE__, fcport->port_name, ls); in qla24xx_handle_gpdb_event()
1604 __func__, __LINE__, fcport->port_name); in qla24xx_handle_gpdb_event()
1618 __func__, fcport->port_name, fcport->disc_state, in qla_chk_n2n_b4_login()
1619 fcport->fw_login_state, fcport->loop_id, fcport->login_retry); in qla_chk_n2n_b4_login()
1625 if (N2N_TOPO(vha->hw)) { in qla_chk_n2n_b4_login()
1628 mywwn = wwn_to_u64(vha->port_name); in qla_chk_n2n_b4_login()
1629 wwn = wwn_to_u64(fcport->port_name); in qla_chk_n2n_b4_login()
1632 else if ((fcport->fw_login_state == DSC_LS_PLOGI_COMP) in qla_chk_n2n_b4_login()
1634 fcport->plogi_nack_done_deadline)) in qla_chk_n2n_b4_login()
1644 if (login && fcport->login_retry) { in qla_chk_n2n_b4_login()
1645 fcport->login_retry--; in qla_chk_n2n_b4_login()
1646 if (fcport->loop_id == FC_NO_LOOP_ID) { in qla_chk_n2n_b4_login()
1647 fcport->fw_login_state = DSC_LS_PORT_UNAVAIL; in qla_chk_n2n_b4_login()
1651 "%s %d %8phC post del sess - out of loopid\n", in qla_chk_n2n_b4_login()
1652 __func__, __LINE__, fcport->port_name); in qla_chk_n2n_b4_login()
1653 fcport->scan_state = 0; in qla_chk_n2n_b4_login()
1660 __func__, __LINE__, fcport->port_name); in qla_chk_n2n_b4_login()
1672 __func__, fcport->port_name, fcport->disc_state, in qla24xx_fcport_handle_login()
1673 fcport->fw_login_state, fcport->login_pause, fcport->flags, in qla24xx_fcport_handle_login()
1674 fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen, in qla24xx_fcport_handle_login()
1675 fcport->login_gen, fcport->loop_id, fcport->scan_state, in qla24xx_fcport_handle_login()
1676 fcport->fc4_type); in qla24xx_fcport_handle_login()
1678 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla24xx_fcport_handle_login()
1679 fcport->disc_state == DSC_DELETE_PEND) in qla24xx_fcport_handle_login()
1682 if ((fcport->loop_id != FC_NO_LOOP_ID) && in qla24xx_fcport_handle_login()
1684 ((fcport->fw_login_state == DSC_LS_PLOGI_PEND) || in qla24xx_fcport_handle_login()
1685 (fcport->fw_login_state == DSC_LS_PRLI_PEND))) in qla24xx_fcport_handle_login()
1688 if (fcport->fw_login_state == DSC_LS_PLOGI_COMP && in qla24xx_fcport_handle_login()
1689 !N2N_TOPO(vha->hw)) { in qla24xx_fcport_handle_login()
1690 if (time_before_eq(jiffies, fcport->plogi_nack_done_deadline)) { in qla24xx_fcport_handle_login()
1691 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_fcport_handle_login()
1697 if (vha->host->active_mode == MODE_TARGET && !N2N_TOPO(vha->hw)) in qla24xx_fcport_handle_login()
1700 if (fcport->flags & (FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE)) { in qla24xx_fcport_handle_login()
1701 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_fcport_handle_login()
1705 switch (fcport->disc_state) { in qla24xx_fcport_handle_login()
1707 switch (vha->hw->current_topology) { in qla24xx_fcport_handle_login()
1711 if (fcport->login_retry) { in qla24xx_fcport_handle_login()
1712 if (fcport->loop_id == FC_NO_LOOP_ID) { in qla24xx_fcport_handle_login()
1715 fcport->fw_login_state = in qla24xx_fcport_handle_login()
1718 fcport->login_retry--; in qla24xx_fcport_handle_login()
1723 fcport->port_name); in qla24xx_fcport_handle_login()
1730 if (fcport->loop_id == FC_NO_LOOP_ID) { in qla24xx_fcport_handle_login()
1733 __func__, __LINE__, fcport->port_name); in qla24xx_fcport_handle_login()
1743 switch (vha->hw->current_topology) { in qla24xx_fcport_handle_login()
1745 if ((fcport->current_login_state & 0xf) == 0x6) { in qla24xx_fcport_handle_login()
1748 __func__, __LINE__, fcport->port_name); in qla24xx_fcport_handle_login()
1749 fcport->chip_reset = in qla24xx_fcport_handle_login()
1750 vha->hw->base_qpair->chip_reset; in qla24xx_fcport_handle_login()
1755 __func__, __LINE__, fcport->port_name, in qla24xx_fcport_handle_login()
1756 NVME_TARGET(vha->hw, fcport) ? "NVME" : in qla24xx_fcport_handle_login()
1762 if (fcport->login_pause) { in qla24xx_fcport_handle_login()
1766 fcport->port_name); in qla24xx_fcport_handle_login()
1767 fcport->last_rscn_gen = fcport->rscn_gen; in qla24xx_fcport_handle_login()
1768 fcport->last_login_gen = fcport->login_gen; in qla24xx_fcport_handle_login()
1769 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_fcport_handle_login()
1778 if (N2N_TOPO(vha->hw)) in qla24xx_fcport_handle_login()
1791 if (vha->hw->flags.edif_enabled) in qla24xx_fcport_handle_login()
1794 if (fcport->fw_login_state == DSC_LS_PLOGI_COMP) { in qla24xx_fcport_handle_login()
1797 __func__, __LINE__, fcport->port_name, in qla24xx_fcport_handle_login()
1798 NVME_TARGET(vha->hw, fcport) ? "NVME" : "FC"); in qla24xx_fcport_handle_login()
1804 sec = jiffies_to_msecs(jiffies - in qla24xx_fcport_handle_login()
1805 fcport->jiffies_at_registration)/1000; in qla24xx_fcport_handle_login()
1806 if (fcport->sec_since_registration < sec && sec && in qla24xx_fcport_handle_login()
1808 fcport->sec_since_registration = sec; in qla24xx_fcport_handle_login()
1809 ql_dbg(ql_dbg_disc, fcport->vha, 0xffff, in qla24xx_fcport_handle_login()
1810 "%s %8phC - Slow Rport registration(%d Sec)\n", in qla24xx_fcport_handle_login()
1811 __func__, fcport->port_name, sec); in qla24xx_fcport_handle_login()
1814 if (fcport->next_disc_state != DSC_DELETE_PEND) in qla24xx_fcport_handle_login()
1815 fcport->next_disc_state = DSC_ADISC; in qla24xx_fcport_handle_login()
1816 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_fcport_handle_login()
1835 e->u.new_sess.id = *id; in qla24xx_post_newsess_work()
1836 e->u.new_sess.pla = pla; in qla24xx_post_newsess_work()
1837 e->u.new_sess.fc4_type = fc4_type; in qla24xx_post_newsess_work()
1838 memcpy(e->u.new_sess.port_name, port_name, WWN_SIZE); in qla24xx_post_newsess_work()
1840 memcpy(e->u.new_sess.node_name, node_name, WWN_SIZE); in qla24xx_post_newsess_work()
1847 *ret_rscn_gen = atomic_inc_return(&vha->rscn_gen); in qla_rscn_gen_tick()
1858 switch (ea->id.b.rsvd_1) { in qla2x00_handle_rscn()
1860 fcport = qla2x00_find_fcport_by_nportid(vha, &ea->id, 1); in qla2x00_handle_rscn()
1863 fcport->flags & FCF_FCP2_DEVICE && in qla2x00_handle_rscn()
1864 atomic_read(&fcport->state) == FCS_ONLINE) { in qla2x00_handle_rscn()
1867 fcport->d_id.b24, fcport->port_name); in qla2x00_handle_rscn()
1871 if (vha->hw->flags.edif_enabled && DBELL_ACTIVE(vha)) { in qla2x00_handle_rscn()
1880 if (atomic_read(&fcport->state) == FCS_ONLINE) { in qla2x00_handle_rscn()
1885 fcport->scan_needed = 1; in qla2x00_handle_rscn()
1886 qla_rscn_gen_tick(vha, &fcport->rscn_gen); in qla2x00_handle_rscn()
1889 fcport->scan_needed = 1; in qla2x00_handle_rscn()
1890 qla_rscn_gen_tick(vha, &fcport->rscn_gen); in qla2x00_handle_rscn()
1896 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_handle_rscn()
1897 if (fcport->flags & FCF_FCP2_DEVICE && in qla2x00_handle_rscn()
1898 atomic_read(&fcport->state) == FCS_ONLINE) in qla2x00_handle_rscn()
1901 if ((ea->id.b24 & 0xffff00) == (fcport->d_id.b24 & 0xffff00)) { in qla2x00_handle_rscn()
1902 fcport->scan_needed = 1; in qla2x00_handle_rscn()
1903 fcport->rscn_gen = rscn_gen; in qla2x00_handle_rscn()
1909 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_handle_rscn()
1910 if (fcport->flags & FCF_FCP2_DEVICE && in qla2x00_handle_rscn()
1911 atomic_read(&fcport->state) == FCS_ONLINE) in qla2x00_handle_rscn()
1914 if ((ea->id.b24 & 0xff0000) == (fcport->d_id.b24 & 0xff0000)) { in qla2x00_handle_rscn()
1915 fcport->scan_needed = 1; in qla2x00_handle_rscn()
1916 fcport->rscn_gen = rscn_gen; in qla2x00_handle_rscn()
1923 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_handle_rscn()
1924 if (fcport->flags & FCF_FCP2_DEVICE && in qla2x00_handle_rscn()
1925 atomic_read(&fcport->state) == FCS_ONLINE) in qla2x00_handle_rscn()
1928 fcport->scan_needed = 1; in qla2x00_handle_rscn()
1929 fcport->rscn_gen = rscn_gen; in qla2x00_handle_rscn()
1934 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_handle_rscn()
1935 if (vha->scan.scan_flags == 0) { in qla2x00_handle_rscn()
1937 vha->scan.scan_flags |= SF_QUEUED; in qla2x00_handle_rscn()
1938 vha->scan.rscn_gen_start = atomic_read(&vha->rscn_gen); in qla2x00_handle_rscn()
1939 schedule_delayed_work(&vha->scan.scan_work, 5); in qla2x00_handle_rscn()
1941 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_handle_rscn()
1947 fc_port_t *fcport = ea->fcport; in qla24xx_handle_relogin_event()
1949 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla24xx_handle_relogin_event()
1954 __func__, fcport->port_name, fcport->disc_state, in qla24xx_handle_relogin_event()
1955 fcport->fw_login_state, fcport->login_pause, in qla24xx_handle_relogin_event()
1956 fcport->deleted, fcport->conflict, in qla24xx_handle_relogin_event()
1957 fcport->last_rscn_gen, fcport->rscn_gen, in qla24xx_handle_relogin_event()
1958 fcport->last_login_gen, fcport->login_gen, in qla24xx_handle_relogin_event()
1959 fcport->flags); in qla24xx_handle_relogin_event()
1961 if (fcport->last_rscn_gen != fcport->rscn_gen) { in qla24xx_handle_relogin_event()
1963 __func__, __LINE__, fcport->port_name); in qla24xx_handle_relogin_event()
1974 if (N2N_TOPO(vha->hw) && fcport_is_smaller(ea->fcport) && in qla_handle_els_plogi_done()
1975 vha->hw->flags.edif_enabled) { in qla_handle_els_plogi_done()
1977 qla24xx_post_gpdb_work(vha, ea->fcport, 0); in qla_handle_els_plogi_done()
1982 if (vha->host->active_mode == MODE_TARGET) in qla_handle_els_plogi_done()
1987 __func__, __LINE__, ea->fcport->port_name); in qla_handle_els_plogi_done()
1988 qla24xx_post_prli_work(vha, ea->fcport); in qla_handle_els_plogi_done()
1999 switch (fcport->disc_state) { in qla_rscn_replay()
2006 if (fcport->scan_needed) { in qla_rscn_replay()
2008 ea.id = fcport->d_id; in qla_rscn_replay()
2010 qla2x00_handle_rscn(fcport->vha, &ea); in qla_rscn_replay()
2018 struct srb_iocb *tmf = &sp->u.iocb_cmd; in qla2x00_tmf_iocb_timeout()
2022 if (sp->type == SRB_MARKER) in qla2x00_tmf_iocb_timeout()
2028 spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); in qla2x00_tmf_iocb_timeout()
2029 for (h = 1; h < sp->qpair->req->num_outstanding_cmds; h++) { in qla2x00_tmf_iocb_timeout()
2030 if (sp->qpair->req->outstanding_cmds[h] == sp) { in qla2x00_tmf_iocb_timeout()
2031 sp->qpair->req->outstanding_cmds[h] = NULL; in qla2x00_tmf_iocb_timeout()
2032 qla_put_fw_resources(sp->qpair, &sp->iores); in qla2x00_tmf_iocb_timeout()
2036 spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags); in qla2x00_tmf_iocb_timeout()
2037 tmf->u.tmf.comp_status = cpu_to_le16(CS_TIMEOUT); in qla2x00_tmf_iocb_timeout()
2038 tmf->u.tmf.data = QLA_FUNCTION_FAILED; in qla2x00_tmf_iocb_timeout()
2039 complete(&tmf->u.tmf.comp); in qla2x00_tmf_iocb_timeout()
2045 struct srb_iocb *tmf = &sp->u.iocb_cmd; in qla_marker_sp_done()
2048 ql_dbg(ql_dbg_taskm, sp->vha, 0x8004, in qla_marker_sp_done()
2049 "Async-marker fail hdl=%x portid=%06x ctrl=%x lun=%lld qp=%d.\n", in qla_marker_sp_done()
2050 sp->handle, sp->fcport->d_id.b24, sp->u.iocb_cmd.u.tmf.flags, in qla_marker_sp_done()
2051 sp->u.iocb_cmd.u.tmf.lun, sp->qpair->id); in qla_marker_sp_done()
2053 sp->u.iocb_cmd.u.tmf.data = res; in qla_marker_sp_done()
2054 complete(&tmf->u.tmf.comp); in qla_marker_sp_done()
2061 if (_chip_gen != sp->vha->hw->chip_reset || _login_gen != sp->fcport->login_gen) {\
2070 cnt--; \
2082 struct scsi_qla_host *vha = arg->vha; in qla26xx_marker()
2086 fc_port_t *fcport = arg->fcport; in qla26xx_marker()
2089 if (TMF_NOT_READY(arg->fcport)) { in qla26xx_marker()
2091 "FC port not ready for marker loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d.\n", in qla26xx_marker()
2092 fcport->loop_id, fcport->d_id.b24, in qla26xx_marker()
2093 arg->modifier, arg->lun, arg->qpair->id); in qla26xx_marker()
2097 chip_gen = vha->hw->chip_reset; in qla26xx_marker()
2098 login_gen = fcport->login_gen; in qla26xx_marker()
2101 sp = qla2xxx_get_qpair_sp(vha, arg->qpair, fcport, GFP_KERNEL); in qla26xx_marker()
2105 sp->type = SRB_MARKER; in qla26xx_marker()
2106 sp->name = "marker"; in qla26xx_marker()
2108 sp->u.iocb_cmd.timeout = qla2x00_tmf_iocb_timeout; in qla26xx_marker()
2110 tm_iocb = &sp->u.iocb_cmd; in qla26xx_marker()
2111 init_completion(&tm_iocb->u.tmf.comp); in qla26xx_marker()
2112 tm_iocb->u.tmf.modifier = arg->modifier; in qla26xx_marker()
2113 tm_iocb->u.tmf.lun = arg->lun; in qla26xx_marker()
2114 tm_iocb->u.tmf.loop_id = fcport->loop_id; in qla26xx_marker()
2115 tm_iocb->u.tmf.vp_index = vha->vp_idx; in qla26xx_marker()
2120 "Async-marker hdl=%x loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d rval %d.\n", in qla26xx_marker()
2121 sp->handle, fcport->loop_id, fcport->d_id.b24, in qla26xx_marker()
2122 arg->modifier, arg->lun, sp->qpair->id, rval); in qla26xx_marker()
2130 wait_for_completion(&tm_iocb->u.tmf.comp); in qla26xx_marker()
2131 rval = tm_iocb->u.tmf.data; in qla26xx_marker()
2135 "Marker failed hdl=%x loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d rval %d.\n", in qla26xx_marker()
2136 sp->handle, fcport->loop_id, fcport->d_id.b24, in qla26xx_marker()
2137 arg->modifier, arg->lun, sp->qpair->id, rval); in qla26xx_marker()
2142 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla26xx_marker()
2149 struct srb_iocb *tmf = &sp->u.iocb_cmd; in qla2x00_tmf_sp_done()
2152 tmf->u.tmf.data = res; in qla2x00_tmf_sp_done()
2153 complete(&tmf->u.tmf.comp); in qla2x00_tmf_sp_done()
2158 /* there are only 2 types of error handling that reaches here, lun or target reset */ in qla_tmf_wait()
2159 if (arg->flags & (TCF_LUN_RESET | TCF_ABORT_TASK_SET | TCF_CLEAR_TASK_SET)) in qla_tmf_wait()
2160 return qla2x00_eh_wait_for_pending_commands(arg->vha, in qla_tmf_wait()
2161 arg->fcport->d_id.b24, arg->lun, WAIT_LUN); in qla_tmf_wait()
2163 return qla2x00_eh_wait_for_pending_commands(arg->vha, in qla_tmf_wait()
2164 arg->fcport->d_id.b24, arg->lun, WAIT_TARGET); in qla_tmf_wait()
2170 struct scsi_qla_host *vha = arg->vha; in __qla2x00_async_tm_cmd()
2174 fc_port_t *fcport = arg->fcport; in __qla2x00_async_tm_cmd()
2178 if (TMF_NOT_READY(arg->fcport)) { in __qla2x00_async_tm_cmd()
2180 "FC port not ready for TM command loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d.\n", in __qla2x00_async_tm_cmd()
2181 fcport->loop_id, fcport->d_id.b24, in __qla2x00_async_tm_cmd()
2182 arg->modifier, arg->lun, arg->qpair->id); in __qla2x00_async_tm_cmd()
2186 chip_gen = vha->hw->chip_reset; in __qla2x00_async_tm_cmd()
2187 login_gen = fcport->login_gen; in __qla2x00_async_tm_cmd()
2190 sp = qla2xxx_get_qpair_sp(vha, arg->qpair, fcport, GFP_KERNEL); in __qla2x00_async_tm_cmd()
2195 sp->type = SRB_TM_CMD; in __qla2x00_async_tm_cmd()
2196 sp->name = "tmf"; in __qla2x00_async_tm_cmd()
2199 sp->u.iocb_cmd.timeout = qla2x00_tmf_iocb_timeout; in __qla2x00_async_tm_cmd()
2201 tm_iocb = &sp->u.iocb_cmd; in __qla2x00_async_tm_cmd()
2202 init_completion(&tm_iocb->u.tmf.comp); in __qla2x00_async_tm_cmd()
2203 tm_iocb->u.tmf.flags = arg->flags; in __qla2x00_async_tm_cmd()
2204 tm_iocb->u.tmf.lun = arg->lun; in __qla2x00_async_tm_cmd()
2209 "Async-tmf hdl=%x loop-id=%x portid=%06x ctrl=%x lun=%lld qp=%d rval=%x.\n", in __qla2x00_async_tm_cmd()
2210 sp->handle, fcport->loop_id, fcport->d_id.b24, in __qla2x00_async_tm_cmd()
2211 arg->flags, arg->lun, sp->qpair->id, rval); in __qla2x00_async_tm_cmd()
2215 wait_for_completion(&tm_iocb->u.tmf.comp); in __qla2x00_async_tm_cmd()
2217 rval = tm_iocb->u.tmf.data; in __qla2x00_async_tm_cmd()
2224 if (!test_bit(UNLOADING, &vha->dpc_flags) && !IS_QLAFX00(vha->hw)) { in __qla2x00_async_tm_cmd()
2229 jiffies_to_msecs(jiffies - jif), vha->host_no, in __qla2x00_async_tm_cmd()
2230 fcport->d_id.b24, arg->lun); in __qla2x00_async_tm_cmd()
2233 if (chip_gen == vha->hw->chip_reset && login_gen == fcport->login_gen) { in __qla2x00_async_tm_cmd()
2238 vha->host_no, fcport->d_id.b24, arg->lun); in __qla2x00_async_tm_cmd()
2242 if (tm_iocb->u.tmf.data) in __qla2x00_async_tm_cmd()
2243 rval = tm_iocb->u.tmf.data; in __qla2x00_async_tm_cmd()
2247 kref_put(&sp->cmd_kref, qla2x00_sp_release); in __qla2x00_async_tm_cmd()
2254 struct scsi_qla_host *vha = arg->vha; in qla_put_tmf()
2255 struct qla_hw_data *ha = vha->hw; in qla_put_tmf()
2258 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qla_put_tmf()
2259 ha->active_tmf--; in qla_put_tmf()
2260 list_del(&arg->tmf_elem); in qla_put_tmf()
2261 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qla_put_tmf()
2267 struct scsi_qla_host *vha = arg->vha; in qla_get_tmf()
2268 struct qla_hw_data *ha = vha->hw; in qla_get_tmf()
2270 fc_port_t *fcport = arg->fcport; in qla_get_tmf()
2274 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qla_get_tmf()
2275 list_for_each_entry(t, &ha->tmf_active, tmf_elem) { in qla_get_tmf()
2276 if (t->fcport == arg->fcport && t->lun == arg->lun) { in qla_get_tmf()
2280 vha->host_no, fcport->d_id.b24, arg->lun); in qla_get_tmf()
2281 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qla_get_tmf()
2282 return -EINVAL; in qla_get_tmf()
2286 list_add_tail(&arg->tmf_elem, &ha->tmf_pending); in qla_get_tmf()
2287 while (ha->active_tmf >= MAX_ACTIVE_TMF) { in qla_get_tmf()
2288 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qla_get_tmf()
2292 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qla_get_tmf()
2299 if (ha->active_tmf < MAX_ACTIVE_TMF && in qla_get_tmf()
2300 list_is_first(&arg->tmf_elem, &ha->tmf_pending)) in qla_get_tmf()
2304 list_del(&arg->tmf_elem); in qla_get_tmf()
2307 ha->active_tmf++; in qla_get_tmf()
2308 list_add_tail(&arg->tmf_elem, &ha->tmf_active); in qla_get_tmf()
2311 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qla_get_tmf()
2320 struct scsi_qla_host *vha = fcport->vha; in qla2x00_async_tm_cmd()
2327 a.vha = fcport->vha; in qla2x00_async_tm_cmd()
2342 a.qpair = vha->hw->base_qpair; in qla2x00_async_tm_cmd()
2355 fc_port_t *fcport = sp->fcport; in qla24xx_async_abort_command()
2356 struct qla_qpair *qpair = sp->qpair; in qla24xx_async_abort_command()
2357 struct scsi_qla_host *vha = fcport->vha; in qla24xx_async_abort_command()
2358 struct req_que *req = qpair->req; in qla24xx_async_abort_command()
2360 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla24xx_async_abort_command()
2361 for (handle = 1; handle < req->num_outstanding_cmds; handle++) { in qla24xx_async_abort_command()
2362 if (req->outstanding_cmds[handle] == sp) in qla24xx_async_abort_command()
2365 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla24xx_async_abort_command()
2367 if (handle == req->num_outstanding_cmds) { in qla24xx_async_abort_command()
2371 if (sp->type == SRB_FXIOCB_DCMD) in qla24xx_async_abort_command()
2372 return qlafx00_fx_disc(vha, &vha->hw->mr.fcport, in qla24xx_async_abort_command()
2382 WARN_ONCE(!qla2xxx_is_valid_mbs(ea->data[0]), "mbs: %#x\n", in qla24xx_handle_prli_done_event()
2383 ea->data[0]); in qla24xx_handle_prli_done_event()
2385 switch (ea->data[0]) { in qla24xx_handle_prli_done_event()
2389 __func__, __LINE__, ea->fcport->port_name); in qla24xx_handle_prli_done_event()
2391 ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_handle_prli_done_event()
2392 ea->fcport->logout_on_delete = 1; in qla24xx_handle_prli_done_event()
2393 ea->fcport->nvme_prli_service_param = ea->iop[0]; in qla24xx_handle_prli_done_event()
2394 if (ea->iop[0] & NVME_PRLI_SP_FIRST_BURST) in qla24xx_handle_prli_done_event()
2395 ea->fcport->nvme_first_burst_size = in qla24xx_handle_prli_done_event()
2396 (ea->iop[1] & 0xffff) * 512; in qla24xx_handle_prli_done_event()
2398 ea->fcport->nvme_first_burst_size = 0; in qla24xx_handle_prli_done_event()
2399 qla24xx_post_gpdb_work(vha, ea->fcport, 0); in qla24xx_handle_prli_done_event()
2402 sp = ea->sp; in qla24xx_handle_prli_done_event()
2405 __func__, __LINE__, ea->fcport->port_name, in qla24xx_handle_prli_done_event()
2406 vha->hw->fc4_type_priority == FC4_PRIORITY_FCP ? in qla24xx_handle_prli_done_event()
2407 "FCP" : "NVMe", ea->fcport->fc4_type, in qla24xx_handle_prli_done_event()
2408 (sp->u.iocb_cmd.u.logio.flags & SRB_LOGIN_NVME_PRLI) ? in qla24xx_handle_prli_done_event()
2411 if (NVME_FCP_TARGET(ea->fcport)) { in qla24xx_handle_prli_done_event()
2412 if (sp->u.iocb_cmd.u.logio.flags & SRB_LOGIN_NVME_PRLI) in qla24xx_handle_prli_done_event()
2413 ea->fcport->do_prli_nvme = 0; in qla24xx_handle_prli_done_event()
2415 ea->fcport->do_prli_nvme = 1; in qla24xx_handle_prli_done_event()
2417 ea->fcport->do_prli_nvme = 0; in qla24xx_handle_prli_done_event()
2420 if (N2N_TOPO(vha->hw)) { in qla24xx_handle_prli_done_event()
2421 if (ea->fcport->n2n_link_reset_cnt == in qla24xx_handle_prli_done_event()
2422 vha->hw->login_retry_count && in qla24xx_handle_prli_done_event()
2423 ea->fcport->flags & FCF_FCSP_DEVICE) { in qla24xx_handle_prli_done_event()
2425 ea->fcport->n2n_link_reset_cnt = 0; in qla24xx_handle_prli_done_event()
2428 if (ea->fcport->n2n_link_reset_cnt < in qla24xx_handle_prli_done_event()
2429 vha->hw->login_retry_count) { in qla24xx_handle_prli_done_event()
2430 ea->fcport->n2n_link_reset_cnt++; in qla24xx_handle_prli_done_event()
2431 vha->relogin_jif = jiffies + 2 * HZ; in qla24xx_handle_prli_done_event()
2436 set_bit(N2N_LINK_RESET, &vha->dpc_flags); in qla24xx_handle_prli_done_event()
2442 ea->fcport->port_name); in qla24xx_handle_prli_done_event()
2449 ea->fcport->flags &= ~FCF_ASYNC_SENT; in qla24xx_handle_prli_done_event()
2450 ea->fcport->keep_nport_handle = 0; in qla24xx_handle_prli_done_event()
2451 ea->fcport->logout_on_delete = 1; in qla24xx_handle_prli_done_event()
2452 qlt_schedule_sess_for_deletion(ea->fcport); in qla24xx_handle_prli_done_event()
2465 struct fc_port *fcport = ea->fcport; in qla24xx_handle_plogi_done_event()
2469 __func__, fcport->port_name, fcport->disc_state, in qla24xx_handle_plogi_done_event()
2470 fcport->fw_login_state, ea->rc, ea->sp->gen2, fcport->login_gen, in qla24xx_handle_plogi_done_event()
2471 ea->sp->gen1, fcport->rscn_gen, in qla24xx_handle_plogi_done_event()
2472 ea->data[0], ea->data[1], ea->iop[0], ea->iop[1]); in qla24xx_handle_plogi_done_event()
2474 if ((fcport->fw_login_state == DSC_LS_PLOGI_PEND) || in qla24xx_handle_plogi_done_event()
2475 (fcport->fw_login_state == DSC_LS_PRLI_PEND)) { in qla24xx_handle_plogi_done_event()
2478 __func__, __LINE__, fcport->port_name); in qla24xx_handle_plogi_done_event()
2482 if ((fcport->disc_state == DSC_DELETE_PEND) || in qla24xx_handle_plogi_done_event()
2483 (fcport->disc_state == DSC_DELETED)) { in qla24xx_handle_plogi_done_event()
2484 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_handle_plogi_done_event()
2488 if (ea->sp->gen2 != fcport->login_gen) { in qla24xx_handle_plogi_done_event()
2492 __func__, fcport->port_name); in qla24xx_handle_plogi_done_event()
2493 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_handle_plogi_done_event()
2495 } else if (ea->sp->gen1 != fcport->rscn_gen) { in qla24xx_handle_plogi_done_event()
2498 __func__, fcport->port_name); in qla24xx_handle_plogi_done_event()
2504 WARN_ONCE(!qla2xxx_is_valid_mbs(ea->data[0]), "mbs: %#x\n", in qla24xx_handle_plogi_done_event()
2505 ea->data[0]); in qla24xx_handle_plogi_done_event()
2507 switch (ea->data[0]) { in qla24xx_handle_plogi_done_event()
2510 * Driver must validate login state - If PRLI not complete, in qla24xx_handle_plogi_done_event()
2514 if (vha->hw->flags.edif_enabled) { in qla24xx_handle_plogi_done_event()
2515 set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); in qla24xx_handle_plogi_done_event()
2516 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_handle_plogi_done_event()
2517 ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_handle_plogi_done_event()
2518 ea->fcport->logout_on_delete = 1; in qla24xx_handle_plogi_done_event()
2519 ea->fcport->send_els_logo = 0; in qla24xx_handle_plogi_done_event()
2520 ea->fcport->fw_login_state = DSC_LS_PLOGI_COMP; in qla24xx_handle_plogi_done_event()
2521 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_handle_plogi_done_event()
2523 qla24xx_post_gpdb_work(vha, ea->fcport, 0); in qla24xx_handle_plogi_done_event()
2525 if (NVME_TARGET(vha->hw, fcport)) { in qla24xx_handle_plogi_done_event()
2528 __func__, __LINE__, fcport->port_name); in qla24xx_handle_plogi_done_event()
2533 __func__, __LINE__, fcport->port_name, in qla24xx_handle_plogi_done_event()
2534 fcport->loop_id, fcport->d_id.b24); in qla24xx_handle_plogi_done_event()
2536 set_bit(fcport->loop_id, vha->hw->loop_id_map); in qla24xx_handle_plogi_done_event()
2537 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_handle_plogi_done_event()
2538 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_handle_plogi_done_event()
2539 fcport->logout_on_delete = 1; in qla24xx_handle_plogi_done_event()
2540 fcport->send_els_logo = 0; in qla24xx_handle_plogi_done_event()
2541 fcport->fw_login_state = DSC_LS_PRLI_COMP; in qla24xx_handle_plogi_done_event()
2542 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_handle_plogi_done_event()
2550 __func__, __LINE__, ea->fcport->port_name, ea->data[1]); in qla24xx_handle_plogi_done_event()
2552 qlt_schedule_sess_for_deletion(ea->fcport); in qla24xx_handle_plogi_done_event()
2556 cid.b.domain = (ea->iop[1] >> 16) & 0xff; in qla24xx_handle_plogi_done_event()
2557 cid.b.area = (ea->iop[1] >> 8) & 0xff; in qla24xx_handle_plogi_done_event()
2558 cid.b.al_pa = ea->iop[1] & 0xff; in qla24xx_handle_plogi_done_event()
2563 __func__, __LINE__, ea->fcport->port_name, in qla24xx_handle_plogi_done_event()
2564 ea->fcport->loop_id, cid.b24); in qla24xx_handle_plogi_done_event()
2566 set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); in qla24xx_handle_plogi_done_event()
2567 ea->fcport->loop_id = FC_NO_LOOP_ID; in qla24xx_handle_plogi_done_event()
2568 qla24xx_post_gnl_work(vha, ea->fcport); in qla24xx_handle_plogi_done_event()
2571 lid = ea->iop[1] & 0xffff; in qla24xx_handle_plogi_done_event()
2573 wwn_to_u64(ea->fcport->port_name), in qla24xx_handle_plogi_done_event()
2574 ea->fcport->d_id, lid, &conflict_fcport); in qla24xx_handle_plogi_done_event()
2582 conflict_fcport->conflict = ea->fcport; in qla24xx_handle_plogi_done_event()
2583 ea->fcport->login_pause = 1; in qla24xx_handle_plogi_done_event()
2587 __func__, __LINE__, ea->fcport->port_name, in qla24xx_handle_plogi_done_event()
2588 ea->fcport->d_id.b24, lid); in qla24xx_handle_plogi_done_event()
2592 __func__, __LINE__, ea->fcport->port_name, in qla24xx_handle_plogi_done_event()
2593 ea->fcport->d_id.b24, lid); in qla24xx_handle_plogi_done_event()
2595 qla2x00_clear_loop_id(ea->fcport); in qla24xx_handle_plogi_done_event()
2596 set_bit(lid, vha->hw->loop_id_map); in qla24xx_handle_plogi_done_event()
2597 ea->fcport->loop_id = lid; in qla24xx_handle_plogi_done_event()
2598 ea->fcport->keep_nport_handle = 0; in qla24xx_handle_plogi_done_event()
2599 ea->fcport->logout_on_delete = 1; in qla24xx_handle_plogi_done_event()
2600 qlt_schedule_sess_for_deletion(ea->fcport); in qla24xx_handle_plogi_done_event()
2615 struct qla_hw_data *ha = vha->hw; in qla83xx_nic_core_fw_load()
2622 * flash-info / other param in qla83xx_nic_core_fw_load()
2624 ha->fcoe_dev_init_timeout = QLA83XX_IDC_INITIALIZATION_TIMEOUT; in qla83xx_nic_core_fw_load()
2625 ha->fcoe_reset_timeout = QLA83XX_IDC_RESET_ACK_TIMEOUT; in qla83xx_nic_core_fw_load()
2630 "Error while setting DRV-Presence.\n"); in qla83xx_nic_core_fw_load()
2640 * Init-Owner: Set IDC-Major-Version and Clear IDC-Lock-Recovery in qla83xx_nic_core_fw_load()
2645 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_fw_load()
2650 /* Clearing IDC-Lock-Recovery register */ in qla83xx_nic_core_fw_load()
2666 idc_minor_ver |= (QLA83XX_SUPP_IDC_MINOR_VERSION << (ha->portnum * 2)); in qla83xx_nic_core_fw_load()
2669 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_fw_load()
2687 struct qla_hw_data *ha = vha->hw; in qla_enable_fce_trace()
2689 if (ha->fce) { in qla_enable_fce_trace()
2690 ha->flags.fce_enabled = 1; in qla_enable_fce_trace()
2691 memset(ha->fce, 0, fce_calc_size(ha->fce_bufs)); in qla_enable_fce_trace()
2693 ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs); in qla_enable_fce_trace()
2698 ha->flags.fce_enabled = 0; in qla_enable_fce_trace()
2706 struct qla_hw_data *ha = vha->hw; in qla_enable_eft_trace()
2708 if (ha->eft) { in qla_enable_eft_trace()
2709 memset(ha->eft, 0, EFT_SIZE); in qla_enable_eft_trace()
2710 rval = qla2x00_enable_eft_trace(vha, ha->eft_dma, EFT_NUM_BUFFERS); in qla_enable_eft_trace()
2732 struct qla_hw_data *ha = vha->hw; in qla2x00_initialize_adapter()
2733 struct req_que *req = ha->req_q_map[0]; in qla2x00_initialize_adapter()
2734 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla2x00_initialize_adapter()
2736 memset(&vha->qla_stats, 0, sizeof(vha->qla_stats)); in qla2x00_initialize_adapter()
2737 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat)); in qla2x00_initialize_adapter()
2740 vha->flags.online = 0; in qla2x00_initialize_adapter()
2741 ha->flags.chip_reset_done = 0; in qla2x00_initialize_adapter()
2742 vha->flags.reset_active = 0; in qla2x00_initialize_adapter()
2743 ha->flags.pci_channel_io_perm_failure = 0; in qla2x00_initialize_adapter()
2744 ha->flags.eeh_busy = 0; in qla2x00_initialize_adapter()
2745 vha->qla_stats.jiffies_at_last_reset = get_jiffies_64(); in qla2x00_initialize_adapter()
2746 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_initialize_adapter()
2747 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_initialize_adapter()
2748 vha->device_flags = DFLG_NO_CABLE; in qla2x00_initialize_adapter()
2749 vha->dpc_flags = 0; in qla2x00_initialize_adapter()
2750 vha->flags.management_server_logged_in = 0; in qla2x00_initialize_adapter()
2751 vha->marker_needed = 0; in qla2x00_initialize_adapter()
2752 ha->isp_abort_cnt = 0; in qla2x00_initialize_adapter()
2753 ha->beacon_blink_led = 0; in qla2x00_initialize_adapter()
2755 set_bit(0, ha->req_qid_map); in qla2x00_initialize_adapter()
2756 set_bit(0, ha->rsp_qid_map); in qla2x00_initialize_adapter()
2760 rval = ha->isp_ops->pci_config(vha); in qla2x00_initialize_adapter()
2767 ha->isp_ops->reset_chip(vha); in qla2x00_initialize_adapter()
2771 if (rd_reg_word(&reg->mailbox12) & BIT_0) in qla2x00_initialize_adapter()
2772 ha->flags.secure_adapter = 1; in qla2x00_initialize_adapter()
2774 (ha->flags.secure_adapter) ? "Yes" : "No"); in qla2x00_initialize_adapter()
2796 ha->isp_ops->get_flash_version(vha, req->ring); in qla2x00_initialize_adapter()
2801 ha->fc4_type_priority = FC4_PRIORITY_FCP; in qla2x00_initialize_adapter()
2803 ha->isp_ops->nvram_config(vha); in qla2x00_initialize_adapter()
2805 if (ha->fc4_type_priority != FC4_PRIORITY_FCP && in qla2x00_initialize_adapter()
2806 ha->fc4_type_priority != FC4_PRIORITY_NVME) in qla2x00_initialize_adapter()
2807 ha->fc4_type_priority = FC4_PRIORITY_FCP; in qla2x00_initialize_adapter()
2810 ha->fc4_type_priority == FC4_PRIORITY_FCP ? "FCP" : "NVMe"); in qla2x00_initialize_adapter()
2812 if (ha->flags.disable_serdes) { in qla2x00_initialize_adapter()
2815 "Masking HBA WWPN %8phN (via NVRAM).\n", vha->port_name); in qla2x00_initialize_adapter()
2829 rval = ha->isp_ops->chip_diag(vha); in qla2x00_initialize_adapter()
2838 ha->cs84xx = qla84xx_get_chip(vha); in qla2x00_initialize_adapter()
2839 if (!ha->cs84xx) { in qla2x00_initialize_adapter()
2853 ha->flags.chip_reset_done = 1; in qla2x00_initialize_adapter()
2885 * qla2100_pci_config() - Setup ISP21xx PCI configuration registers.
2895 struct qla_hw_data *ha = vha->hw; in qla2100_pci_config()
2896 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2100_pci_config()
2898 pci_set_master(ha->pdev); in qla2100_pci_config()
2899 pci_try_set_mwi(ha->pdev); in qla2100_pci_config()
2901 pci_read_config_word(ha->pdev, PCI_COMMAND, &w); in qla2100_pci_config()
2903 pci_write_config_word(ha->pdev, PCI_COMMAND, w); in qla2100_pci_config()
2905 pci_disable_rom(ha->pdev); in qla2100_pci_config()
2908 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2100_pci_config()
2909 ha->pci_attr = rd_reg_word(&reg->ctrl_status); in qla2100_pci_config()
2910 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2100_pci_config()
2916 * qla2300_pci_config() - Setup ISP23xx PCI configuration registers.
2927 struct qla_hw_data *ha = vha->hw; in qla2300_pci_config()
2928 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2300_pci_config()
2930 pci_set_master(ha->pdev); in qla2300_pci_config()
2931 pci_try_set_mwi(ha->pdev); in qla2300_pci_config()
2933 pci_read_config_word(ha->pdev, PCI_COMMAND, &w); in qla2300_pci_config()
2938 pci_write_config_word(ha->pdev, PCI_COMMAND, w); in qla2300_pci_config()
2944 * fb revision level -- a 6 indicates it really is a 2300 and in qla2300_pci_config()
2948 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2300_pci_config()
2951 wrt_reg_word(&reg->hccr, HCCR_PAUSE_RISC); in qla2300_pci_config()
2953 if ((rd_reg_word(&reg->hccr) & HCCR_RISC_PAUSE) != 0) in qla2300_pci_config()
2960 wrt_reg_word(&reg->ctrl_status, 0x20); in qla2300_pci_config()
2961 rd_reg_word(&reg->ctrl_status); in qla2300_pci_config()
2964 ha->fb_rev = RD_FB_CMD_REG(ha, reg); in qla2300_pci_config()
2966 if (ha->fb_rev == FPM_2300) in qla2300_pci_config()
2967 pci_clear_mwi(ha->pdev); in qla2300_pci_config()
2970 wrt_reg_word(&reg->ctrl_status, 0x0); in qla2300_pci_config()
2971 rd_reg_word(&reg->ctrl_status); in qla2300_pci_config()
2974 wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); in qla2300_pci_config()
2976 if ((rd_reg_word(&reg->hccr) & HCCR_RISC_PAUSE) == 0) in qla2300_pci_config()
2982 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2300_pci_config()
2985 pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); in qla2300_pci_config()
2987 pci_disable_rom(ha->pdev); in qla2300_pci_config()
2990 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2300_pci_config()
2991 ha->pci_attr = rd_reg_word(&reg->ctrl_status); in qla2300_pci_config()
2992 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2300_pci_config()
2998 * qla24xx_pci_config() - Setup ISP24xx PCI configuration registers.
3008 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_config()
3009 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_pci_config()
3011 pci_set_master(ha->pdev); in qla24xx_pci_config()
3012 pci_try_set_mwi(ha->pdev); in qla24xx_pci_config()
3014 pci_read_config_word(ha->pdev, PCI_COMMAND, &w); in qla24xx_pci_config()
3017 pci_write_config_word(ha->pdev, PCI_COMMAND, w); in qla24xx_pci_config()
3019 pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); in qla24xx_pci_config()
3021 /* PCI-X -- adjust Maximum Memory Read Byte Count (2048). */ in qla24xx_pci_config()
3022 if (pci_find_capability(ha->pdev, PCI_CAP_ID_PCIX)) in qla24xx_pci_config()
3023 pcix_set_mmrbc(ha->pdev, 2048); in qla24xx_pci_config()
3025 /* PCIe -- adjust Maximum Read Request Size (2048). */ in qla24xx_pci_config()
3026 if (pci_is_pcie(ha->pdev)) in qla24xx_pci_config()
3027 pcie_set_readrq(ha->pdev, 4096); in qla24xx_pci_config()
3029 pci_disable_rom(ha->pdev); in qla24xx_pci_config()
3031 ha->chip_revision = ha->pdev->revision; in qla24xx_pci_config()
3034 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_pci_config()
3035 ha->pci_attr = rd_reg_dword(&reg->ctrl_status); in qla24xx_pci_config()
3036 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_pci_config()
3042 * qla25xx_pci_config() - Setup ISP25xx PCI configuration registers.
3051 struct qla_hw_data *ha = vha->hw; in qla25xx_pci_config()
3053 pci_set_master(ha->pdev); in qla25xx_pci_config()
3054 pci_try_set_mwi(ha->pdev); in qla25xx_pci_config()
3056 pci_read_config_word(ha->pdev, PCI_COMMAND, &w); in qla25xx_pci_config()
3059 pci_write_config_word(ha->pdev, PCI_COMMAND, w); in qla25xx_pci_config()
3061 /* PCIe -- adjust Maximum Read Request Size (2048). */ in qla25xx_pci_config()
3062 if (pci_is_pcie(ha->pdev)) in qla25xx_pci_config()
3063 pcie_set_readrq(ha->pdev, 4096); in qla25xx_pci_config()
3065 pci_disable_rom(ha->pdev); in qla25xx_pci_config()
3067 ha->chip_revision = ha->pdev->revision; in qla25xx_pci_config()
3073 * qla2x00_isp_firmware() - Choose firmware image.
3084 struct qla_hw_data *ha = vha->hw; in qla2x00_isp_firmware()
3089 if (ha->flags.disable_risc_code_load) { in qla2x00_isp_firmware()
3093 rval = qla2x00_verify_checksum(vha, ha->fw_srisc_address); in qla2x00_isp_firmware()
3109 * qla2x00_reset_chip() - Reset ISP chip.
3118 struct qla_hw_data *ha = vha->hw; in qla2x00_reset_chip()
3119 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_reset_chip()
3124 if (unlikely(pci_channel_offline(ha->pdev))) in qla2x00_reset_chip()
3127 ha->isp_ops->disable_intrs(ha); in qla2x00_reset_chip()
3129 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_reset_chip()
3133 pci_read_config_word(ha->pdev, PCI_COMMAND, &cmd); in qla2x00_reset_chip()
3135 pci_write_config_word(ha->pdev, PCI_COMMAND, cmd); in qla2x00_reset_chip()
3139 wrt_reg_word(&reg->hccr, HCCR_PAUSE_RISC); in qla2x00_reset_chip()
3142 if ((rd_reg_word(&reg->hccr) & in qla2x00_reset_chip()
3148 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_chip()
3153 wrt_reg_word(&reg->ctrl_status, 0x20); in qla2x00_reset_chip()
3154 rd_reg_word(&reg->ctrl_status); /* PCI Posting. */ in qla2x00_reset_chip()
3157 wrt_reg_word(&reg->fpm_diag_config, 0x100); in qla2x00_reset_chip()
3158 rd_reg_word(&reg->fpm_diag_config); /* PCI Posting. */ in qla2x00_reset_chip()
3162 wrt_reg_word(&reg->fpm_diag_config, 0x0); in qla2x00_reset_chip()
3163 rd_reg_word(&reg->fpm_diag_config); /* PCI Posting. */ in qla2x00_reset_chip()
3167 wrt_reg_word(&reg->ctrl_status, 0x10); in qla2x00_reset_chip()
3168 rd_reg_word(&reg->ctrl_status); /* PCI Posting. */ in qla2x00_reset_chip()
3186 wrt_reg_word(&reg->ctrl_status, 0); in qla2x00_reset_chip()
3187 rd_reg_word(&reg->ctrl_status); /* PCI Posting. */ in qla2x00_reset_chip()
3190 wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); in qla2x00_reset_chip()
3191 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_chip()
3194 wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); in qla2x00_reset_chip()
3195 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_chip()
3198 wrt_reg_word(&reg->hccr, HCCR_CLR_RISC_INT); in qla2x00_reset_chip()
3199 wrt_reg_word(&reg->hccr, HCCR_CLR_HOST_INT); in qla2x00_reset_chip()
3202 wrt_reg_word(&reg->ctrl_status, CSR_ISP_SOFT_RESET); in qla2x00_reset_chip()
3212 for (cnt = 30000; cnt; cnt--) { in qla2x00_reset_chip()
3213 if ((rd_reg_word(&reg->ctrl_status) & in qla2x00_reset_chip()
3222 wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); in qla2x00_reset_chip()
3224 wrt_reg_word(&reg->semaphore, 0); in qla2x00_reset_chip()
3227 wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); in qla2x00_reset_chip()
3228 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_chip()
3242 pci_write_config_word(ha->pdev, PCI_COMMAND, cmd); in qla2x00_reset_chip()
3246 wrt_reg_word(&reg->hccr, HCCR_DISABLE_PARITY_PAUSE); in qla2x00_reset_chip()
3247 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_chip()
3250 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_reset_chip()
3256 * qla81xx_reset_mpi() - Reset's MPI FW via Write MPI Register MBC.
3266 if (!IS_QLA81XX(vha->hw)) in qla81xx_reset_mpi()
3275 struct qla_hw_data *ha = vha->hw; in qla_chk_risc_recovery()
3276 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla_chk_risc_recovery()
3277 __le16 __iomem *mbptr = &reg->mailbox0; in qla_chk_risc_recovery()
3297 "RISC reset failed. mb[0-7] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", in qla_chk_risc_recovery()
3300 "RISC reset failed. mb[8-15] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", in qla_chk_risc_recovery()
3304 "RISC reset failed. mb[16-23] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", in qla_chk_risc_recovery()
3308 "RISC reset failed. mb[24-31] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", in qla_chk_risc_recovery()
3316 * qla24xx_reset_risc() - Perform full reset of ISP24xx RISC.
3325 struct qla_hw_data *ha = vha->hw; in qla24xx_reset_risc()
3326 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_reset_risc()
3333 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_reset_risc()
3336 wrt_reg_dword(&reg->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); in qla24xx_reset_risc()
3338 if ((rd_reg_dword(&reg->ctrl_status) & CSRX_DMA_ACTIVE) == 0) in qla24xx_reset_risc()
3344 if (!(rd_reg_dword(&reg->ctrl_status) & CSRX_DMA_ACTIVE)) in qla24xx_reset_risc()
3345 set_bit(DMA_SHUTDOWN_CMPL, &ha->fw_dump_cap_flags); in qla24xx_reset_risc()
3349 rd_reg_dword(&reg->hccr), in qla24xx_reset_risc()
3350 rd_reg_dword(&reg->ctrl_status), in qla24xx_reset_risc()
3351 (rd_reg_dword(&reg->ctrl_status) & CSRX_DMA_ACTIVE)); in qla24xx_reset_risc()
3353 wrt_reg_dword(&reg->ctrl_status, in qla24xx_reset_risc()
3355 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd); in qla24xx_reset_risc()
3360 rd_reg_word(&reg->mailbox0); in qla24xx_reset_risc()
3361 for (cnt = 10000; rd_reg_word(&reg->mailbox0) != 0 && in qla24xx_reset_risc()
3362 rval == QLA_SUCCESS; cnt--) { in qla24xx_reset_risc()
3371 set_bit(ISP_MBX_RDY, &ha->fw_dump_cap_flags); in qla24xx_reset_risc()
3375 rd_reg_dword(&reg->hccr), in qla24xx_reset_risc()
3376 rd_reg_word(&reg->mailbox0)); in qla24xx_reset_risc()
3378 /* Wait for soft-reset to complete. */ in qla24xx_reset_risc()
3379 rd_reg_dword(&reg->ctrl_status); in qla24xx_reset_risc()
3382 if ((rd_reg_dword(&reg->ctrl_status) & in qla24xx_reset_risc()
3388 if (!(rd_reg_dword(&reg->ctrl_status) & CSRX_ISP_SOFT_RESET)) in qla24xx_reset_risc()
3389 set_bit(ISP_SOFT_RESET_CMPL, &ha->fw_dump_cap_flags); in qla24xx_reset_risc()
3393 rd_reg_dword(&reg->hccr), in qla24xx_reset_risc()
3394 rd_reg_dword(&reg->ctrl_status)); in qla24xx_reset_risc()
3397 if (test_and_clear_bit(MPI_RESET_NEEDED, &vha->dpc_flags)) { in qla24xx_reset_risc()
3400 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla24xx_reset_risc()
3401 set_bit(MPI_RESET_NEEDED, &vha->dpc_flags); in qla24xx_reset_risc()
3408 vha->flags.online = 0; in qla24xx_reset_risc()
3413 wrt_reg_dword(&reg->hccr, HCCRX_SET_RISC_RESET); in qla24xx_reset_risc()
3414 rd_reg_dword(&reg->hccr); in qla24xx_reset_risc()
3416 wrt_reg_dword(&reg->hccr, HCCRX_REL_RISC_PAUSE); in qla24xx_reset_risc()
3417 rd_reg_dword(&reg->hccr); in qla24xx_reset_risc()
3419 wrt_reg_dword(&reg->hccr, HCCRX_CLR_RISC_RESET); in qla24xx_reset_risc()
3421 rd_reg_dword(&reg->hccr); in qla24xx_reset_risc()
3423 wd = rd_reg_word(&reg->mailbox0); in qla24xx_reset_risc()
3424 for (cnt = 300; wd != 0 && rval == QLA_SUCCESS; cnt--) { in qla24xx_reset_risc()
3431 wd = rd_reg_word(&reg->mailbox0); in qla24xx_reset_risc()
3441 set_bit(RISC_RDY_AFT_RESET, &ha->fw_dump_cap_flags); in qla24xx_reset_risc()
3445 rd_reg_dword(&reg->hccr), in qla24xx_reset_risc()
3446 rd_reg_word(&reg->mailbox0)); in qla24xx_reset_risc()
3448 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_reset_risc()
3455 ha->isp_ops->enable_intrs(ha); in qla24xx_reset_risc()
3463 struct device_reg_24xx __iomem *reg = &vha->hw->iobase->isp24; in qla25xx_read_risc_sema_reg()
3465 wrt_reg_dword(&reg->iobase_addr, RISC_REGISTER_BASE_OFFSET); in qla25xx_read_risc_sema_reg()
3466 *data = rd_reg_dword(&reg->iobase_window + RISC_REGISTER_WINDOW_OFFSET); in qla25xx_read_risc_sema_reg()
3472 struct device_reg_24xx __iomem *reg = &vha->hw->iobase->isp24; in qla25xx_write_risc_sema_reg()
3474 wrt_reg_dword(&reg->iobase_addr, RISC_REGISTER_BASE_OFFSET); in qla25xx_write_risc_sema_reg()
3475 wrt_reg_dword(&reg->iobase_window + RISC_REGISTER_WINDOW_OFFSET, data); in qla25xx_write_risc_sema_reg()
3487 if (vha->hw->pdev->subsystem_device != 0x0175 && in qla25xx_manipulate_risc_semaphore()
3488 vha->hw->pdev->subsystem_device != 0x0240) in qla25xx_manipulate_risc_semaphore()
3491 wrt_reg_dword(&vha->hw->iobase->isp24.hccr, HCCRX_SET_RISC_PAUSE); in qla25xx_manipulate_risc_semaphore()
3497 while (n--) { in qla25xx_manipulate_risc_semaphore()
3517 while (n--) { in qla25xx_manipulate_risc_semaphore()
3540 * qla24xx_reset_chip() - Reset ISP24xx chip.
3548 struct qla_hw_data *ha = vha->hw; in qla24xx_reset_chip()
3551 if (pci_channel_offline(ha->pdev) && in qla24xx_reset_chip()
3552 ha->flags.pci_channel_io_perm_failure) { in qla24xx_reset_chip()
3556 ha->isp_ops->disable_intrs(ha); in qla24xx_reset_chip()
3567 * qla2x00_chip_diag() - Test chip for proper operation.
3576 struct qla_hw_data *ha = vha->hw; in qla2x00_chip_diag()
3577 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_chip_diag()
3582 struct req_que *req = ha->req_q_map[0]; in qla2x00_chip_diag()
3588 &reg->flash_address); in qla2x00_chip_diag()
3590 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_chip_diag()
3593 wrt_reg_word(&reg->ctrl_status, CSR_ISP_SOFT_RESET); in qla2x00_chip_diag()
3600 data = qla2x00_debounce_register(&reg->ctrl_status); in qla2x00_chip_diag()
3601 for (cnt = 6000000 ; cnt && (data & CSR_ISP_SOFT_RESET); cnt--) { in qla2x00_chip_diag()
3603 data = rd_reg_word(&reg->ctrl_status); in qla2x00_chip_diag()
3614 wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); in qla2x00_chip_diag()
3615 wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); in qla2x00_chip_diag()
3620 for (cnt = 6000000; cnt && (data == MBS_BUSY); cnt--) { in qla2x00_chip_diag()
3646 ha->product_id[0] = mb[1]; in qla2x00_chip_diag()
3647 ha->product_id[1] = mb[2]; in qla2x00_chip_diag()
3648 ha->product_id[2] = mb[3]; in qla2x00_chip_diag()
3649 ha->product_id[3] = mb[4]; in qla2x00_chip_diag()
3652 if (req->length > 1024) in qla2x00_chip_diag()
3653 ha->fw_transfer_size = REQUEST_ENTRY_SIZE * 1024; in qla2x00_chip_diag()
3655 ha->fw_transfer_size = REQUEST_ENTRY_SIZE * in qla2x00_chip_diag()
3656 req->length; in qla2x00_chip_diag()
3663 ha->device_type |= DT_ISP2200A; in qla2x00_chip_diag()
3664 ha->fw_transfer_size = 128; in qla2x00_chip_diag()
3668 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_chip_diag()
3678 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_chip_diag()
3685 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_chip_diag()
3691 * qla24xx_chip_diag() - Test ISP24xx for proper operation.
3700 struct qla_hw_data *ha = vha->hw; in qla24xx_chip_diag()
3701 struct req_que *req = ha->req_q_map[0]; in qla24xx_chip_diag()
3706 ha->fw_transfer_size = REQUEST_ENTRY_SIZE * req->length; in qla24xx_chip_diag()
3725 struct qla_hw_data *ha = vha->hw; in qla2x00_alloc_fce_trace()
3734 if (ha->fce) { in qla2x00_alloc_fce_trace()
3742 tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, in qla2x00_alloc_fce_trace()
3754 ha->fce_dma = tc_dma; in qla2x00_alloc_fce_trace()
3755 ha->fce = tc; in qla2x00_alloc_fce_trace()
3756 ha->fce_bufs = FCE_NUM_BUFFERS; in qla2x00_alloc_fce_trace()
3764 struct qla_hw_data *ha = vha->hw; in qla2x00_alloc_eft_trace()
3769 if (ha->eft) { in qla2x00_alloc_eft_trace()
3777 tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma, in qla2x00_alloc_eft_trace()
3789 ha->eft_dma = tc_dma; in qla2x00_alloc_eft_trace()
3790 ha->eft = tc; in qla2x00_alloc_eft_trace()
3798 struct qla_hw_data *ha = vha->hw; in qla2x00_alloc_fw_dump()
3799 struct req_que *req = ha->req_q_map[0]; in qla2x00_alloc_fw_dump()
3800 struct rsp_que *rsp = ha->rsp_q_map[0]; in qla2x00_alloc_fw_dump()
3803 if (ha->fw_dump) { in qla2x00_alloc_fw_dump()
3809 ha->fw_dumped = 0; in qla2x00_alloc_fw_dump()
3810 ha->fw_dump_cap_flags = 0; in qla2x00_alloc_fw_dump()
3818 mem_size = (ha->fw_memory_size - 0x11000 + 1) * in qla2x00_alloc_fw_dump()
3830 mem_size = (ha->fw_memory_size - 0x100000 + 1) * in qla2x00_alloc_fw_dump()
3832 if (ha->mqenable) { in qla2x00_alloc_fw_dump()
3836 * Allocate maximum buffer size for all queues - Q0. in qla2x00_alloc_fw_dump()
3837 * Resizing must be done at end-of-dump processing. in qla2x00_alloc_fw_dump()
3839 mq_size += (ha->max_req_queues - 1) * in qla2x00_alloc_fw_dump()
3840 (req->length * sizeof(request_t)); in qla2x00_alloc_fw_dump()
3841 mq_size += (ha->max_rsp_queues - 1) * in qla2x00_alloc_fw_dump()
3842 (rsp->length * sizeof(response_t)); in qla2x00_alloc_fw_dump()
3844 if (ha->tgt.atio_ring) in qla2x00_alloc_fw_dump()
3845 mq_size += ha->tgt.atio_q_length * sizeof(request_t); in qla2x00_alloc_fw_dump()
3848 if (ha->fce) in qla2x00_alloc_fw_dump()
3851 if (ha->eft) in qla2x00_alloc_fw_dump()
3856 struct fwdt *fwdt = ha->fwdt; in qla2x00_alloc_fw_dump()
3860 if (!fwdt->template) { in qla2x00_alloc_fw_dump()
3862 "-> fwdt%u no template\n", j); in qla2x00_alloc_fw_dump()
3866 "-> fwdt%u calculating fwdump size...\n", j); in qla2x00_alloc_fw_dump()
3867 fwdt->dump_size = qla27xx_fwdt_calculate_dump_size( in qla2x00_alloc_fw_dump()
3868 vha, fwdt->template); in qla2x00_alloc_fw_dump()
3870 "-> fwdt%u calculated fwdump size = %#lx bytes\n", in qla2x00_alloc_fw_dump()
3871 j, fwdt->dump_size); in qla2x00_alloc_fw_dump()
3872 dump_size += fwdt->dump_size; in qla2x00_alloc_fw_dump()
3875 dump_size += ha->fwdt[1].dump_size; in qla2x00_alloc_fw_dump()
3877 req_q_size = req->length * sizeof(request_t); in qla2x00_alloc_fw_dump()
3878 rsp_q_size = rsp->length * sizeof(response_t); in qla2x00_alloc_fw_dump()
3882 ha->chain_offset = dump_size; in qla2x00_alloc_fw_dump()
3884 if (ha->exchoffld_buf) in qla2x00_alloc_fw_dump()
3886 ha->exchoffld_size; in qla2x00_alloc_fw_dump()
3887 if (ha->exlogin_buf) in qla2x00_alloc_fw_dump()
3889 ha->exlogin_size; in qla2x00_alloc_fw_dump()
3892 if (!ha->fw_dump_len || dump_size > ha->fw_dump_alloc_len) { in qla2x00_alloc_fw_dump()
3896 __func__, dump_size, ha->fw_dump_len, in qla2x00_alloc_fw_dump()
3897 ha->fw_dump_alloc_len); in qla2x00_alloc_fw_dump()
3905 mutex_lock(&ha->optrom_mutex); in qla2x00_alloc_fw_dump()
3906 if (ha->fw_dumped) { in qla2x00_alloc_fw_dump()
3907 memcpy(fw_dump, ha->fw_dump, ha->fw_dump_len); in qla2x00_alloc_fw_dump()
3908 vfree(ha->fw_dump); in qla2x00_alloc_fw_dump()
3909 ha->fw_dump = fw_dump; in qla2x00_alloc_fw_dump()
3910 ha->fw_dump_alloc_len = dump_size; in qla2x00_alloc_fw_dump()
3912 "Re-Allocated (%d KB) and save firmware dump.\n", in qla2x00_alloc_fw_dump()
3915 vfree(ha->fw_dump); in qla2x00_alloc_fw_dump()
3916 ha->fw_dump = fw_dump; in qla2x00_alloc_fw_dump()
3918 ha->fw_dump_len = ha->fw_dump_alloc_len = in qla2x00_alloc_fw_dump()
3925 ha->mpi_fw_dump = (char *)fw_dump + in qla2x00_alloc_fw_dump()
3926 ha->fwdt[1].dump_size; in qla2x00_alloc_fw_dump()
3927 mutex_unlock(&ha->optrom_mutex); in qla2x00_alloc_fw_dump()
3931 ha->fw_dump->signature[0] = 'Q'; in qla2x00_alloc_fw_dump()
3932 ha->fw_dump->signature[1] = 'L'; in qla2x00_alloc_fw_dump()
3933 ha->fw_dump->signature[2] = 'G'; in qla2x00_alloc_fw_dump()
3934 ha->fw_dump->signature[3] = 'C'; in qla2x00_alloc_fw_dump()
3935 ha->fw_dump->version = htonl(1); in qla2x00_alloc_fw_dump()
3937 ha->fw_dump->fixed_size = htonl(fixed_size); in qla2x00_alloc_fw_dump()
3938 ha->fw_dump->mem_size = htonl(mem_size); in qla2x00_alloc_fw_dump()
3939 ha->fw_dump->req_q_size = htonl(req_q_size); in qla2x00_alloc_fw_dump()
3940 ha->fw_dump->rsp_q_size = htonl(rsp_q_size); in qla2x00_alloc_fw_dump()
3942 ha->fw_dump->eft_size = htonl(eft_size); in qla2x00_alloc_fw_dump()
3943 ha->fw_dump->eft_addr_l = in qla2x00_alloc_fw_dump()
3944 htonl(LSD(ha->eft_dma)); in qla2x00_alloc_fw_dump()
3945 ha->fw_dump->eft_addr_h = in qla2x00_alloc_fw_dump()
3946 htonl(MSD(ha->eft_dma)); in qla2x00_alloc_fw_dump()
3948 ha->fw_dump->header_size = in qla2x00_alloc_fw_dump()
3952 mutex_unlock(&ha->optrom_mutex); in qla2x00_alloc_fw_dump()
3965 if (!IS_QLA81XX(vha->hw)) in qla81xx_mpi_sync()
3975 pci_read_config_word(vha->hw->pdev, 0x54, &dc); in qla81xx_mpi_sync()
4008 if (req->outstanding_cmds) in qla2x00_alloc_outstanding_cmds()
4012 req->num_outstanding_cmds = DEFAULT_OUTSTANDING_COMMANDS; in qla2x00_alloc_outstanding_cmds()
4014 if (ha->cur_fw_xcb_count <= ha->cur_fw_iocb_count) in qla2x00_alloc_outstanding_cmds()
4015 req->num_outstanding_cmds = ha->cur_fw_xcb_count; in qla2x00_alloc_outstanding_cmds()
4017 req->num_outstanding_cmds = ha->cur_fw_iocb_count; in qla2x00_alloc_outstanding_cmds()
4020 req->outstanding_cmds = kcalloc(req->num_outstanding_cmds, in qla2x00_alloc_outstanding_cmds()
4024 if (!req->outstanding_cmds) { in qla2x00_alloc_outstanding_cmds()
4029 req->num_outstanding_cmds = MIN_OUTSTANDING_COMMANDS; in qla2x00_alloc_outstanding_cmds()
4030 req->outstanding_cmds = kcalloc(req->num_outstanding_cmds, in qla2x00_alloc_outstanding_cmds()
4034 if (!req->outstanding_cmds) { in qla2x00_alloc_outstanding_cmds()
4038 req->num_outstanding_cmds = 0; in qla2x00_alloc_outstanding_cmds()
4047 if (a0->_field & _flag) {\
4051 leftover--;\
4055 leftover -= len;\
4063 struct sff_8247_a0 *a0 = (struct sff_8247_a0 *)vha->hw->sfp_data; in qla2xxx_print_sfp_info()
4068 snprintf(str, SFF_VEN_NAME_LEN+1, a0->vendor_name); in qla2xxx_print_sfp_info()
4073 snprintf(str, SFF_PART_NAME_LEN+1, a0->vendor_pn); in qla2xxx_print_sfp_info()
4117 if (a0->length_km) in qla2xxx_print_sfp_info()
4119 "SFP Distant: %d km\n", a0->length_km); in qla2xxx_print_sfp_info()
4120 if (a0->length_100m) in qla2xxx_print_sfp_info()
4122 "SFP Distant: %d m\n", a0->length_100m*100); in qla2xxx_print_sfp_info()
4123 if (a0->length_50um_10m) in qla2xxx_print_sfp_info()
4125 "SFP Distant (WL=50um): %d m\n", a0->length_50um_10m * 10); in qla2xxx_print_sfp_info()
4126 if (a0->length_62um_10m) in qla2xxx_print_sfp_info()
4128 "SFP Distant (WL=62.5um): %d m\n", a0->length_62um_10m * 10); in qla2xxx_print_sfp_info()
4129 if (a0->length_om4_10m) in qla2xxx_print_sfp_info()
4131 "SFP Distant (OM4): %d m\n", a0->length_om4_10m * 10); in qla2xxx_print_sfp_info()
4132 if (a0->length_om3_10m) in qla2xxx_print_sfp_info()
4134 "SFP Distant (OM3): %d m\n", a0->length_om3_10m * 10); in qla2xxx_print_sfp_info()
4144 * 0 -- Configure firmware to use short-range settings -- normal
4145 * buffer-to-buffer credits.
4147 * 1 -- Configure firmware to use long-range settings -- extra
4148 * buffer-to-buffer credits should be allocated with
4149 * ha->lr_distance containing distance settings from NVRAM or SFP
4157 struct qla_hw_data *ha = vha->hw; in qla24xx_detect_sfp()
4158 struct nvram_81xx *nv = ha->nvram; in qla24xx_detect_sfp()
4166 ha->flags.lr_detected = 0; in qla24xx_detect_sfp()
4168 (nv->enhanced_features & NEF_LR_DIST_ENABLE)) { in qla24xx_detect_sfp()
4170 ha->flags.lr_detected = 1; in qla24xx_detect_sfp()
4171 ha->lr_distance = in qla24xx_detect_sfp()
4172 (nv->enhanced_features >> LR_DIST_NV_POS) in qla24xx_detect_sfp()
4184 a = (struct sff_8247_a0 *)vha->hw->sfp_data; in qla24xx_detect_sfp()
4187 ha->flags.lr_detected = 0; in qla24xx_detect_sfp()
4188 ll = a->fc_ll_cc7; in qla24xx_detect_sfp()
4191 ha->flags.lr_detected = 1; in qla24xx_detect_sfp()
4193 if (a->length_km > 5 || a->length_100m > 50) in qla24xx_detect_sfp()
4194 ha->lr_distance = LR_DISTANCE_10K; in qla24xx_detect_sfp()
4196 ha->lr_distance = LR_DISTANCE_5K; in qla24xx_detect_sfp()
4201 "SFP detect: %s-Range SFP %s (nvr=%x ll=%x lr=%x lrd=%x).\n", in qla24xx_detect_sfp()
4202 types[ha->flags.lr_detected], in qla24xx_detect_sfp()
4203 ha->flags.lr_detected ? lengths[ha->lr_distance] : in qla24xx_detect_sfp()
4205 used_nvram, ll, ha->flags.lr_detected, ha->lr_distance); in qla24xx_detect_sfp()
4206 return ha->flags.lr_detected; in qla24xx_detect_sfp()
4213 struct qla_hw_data *ha = qpair->vha->hw; in __qla_adjust_iocb_limit()
4215 num_qps = ha->num_qpairs + 1; in __qla_adjust_iocb_limit()
4216 limit = (ha->orig_fw_iocb_count * QLA_IOCB_PCT_LIMIT) / 100; in __qla_adjust_iocb_limit()
4218 qpair->fwres.iocbs_total = ha->orig_fw_iocb_count; in __qla_adjust_iocb_limit()
4219 qpair->fwres.iocbs_limit = limit; in __qla_adjust_iocb_limit()
4220 qpair->fwres.iocbs_qp_limit = limit / num_qps; in __qla_adjust_iocb_limit()
4222 qpair->fwres.exch_total = ha->orig_fw_xcb_count; in __qla_adjust_iocb_limit()
4223 qpair->fwres.exch_limit = (ha->orig_fw_xcb_count * in __qla_adjust_iocb_limit()
4230 struct qla_hw_data *ha = vha->hw; in qla_init_iocb_limit()
4232 __qla_adjust_iocb_limit(ha->base_qpair); in qla_init_iocb_limit()
4233 ha->base_qpair->fwres.iocbs_used = 0; in qla_init_iocb_limit()
4234 ha->base_qpair->fwres.exch_used = 0; in qla_init_iocb_limit()
4236 for (i = 0; i < ha->max_qpairs; i++) { in qla_init_iocb_limit()
4237 if (ha->queue_pair_map[i]) { in qla_init_iocb_limit()
4238 __qla_adjust_iocb_limit(ha->queue_pair_map[i]); in qla_init_iocb_limit()
4239 ha->queue_pair_map[i]->fwres.iocbs_used = 0; in qla_init_iocb_limit()
4240 ha->queue_pair_map[i]->fwres.exch_used = 0; in qla_init_iocb_limit()
4244 ha->fwres.iocb_total = ha->orig_fw_iocb_count; in qla_init_iocb_limit()
4245 ha->fwres.iocb_limit = (ha->orig_fw_iocb_count * QLA_IOCB_PCT_LIMIT) / 100; in qla_init_iocb_limit()
4246 ha->fwres.exch_total = ha->orig_fw_xcb_count; in qla_init_iocb_limit()
4247 ha->fwres.exch_limit = (ha->orig_fw_xcb_count * QLA_IOCB_PCT_LIMIT) / 100; in qla_init_iocb_limit()
4249 atomic_set(&ha->fwres.iocb_used, 0); in qla_init_iocb_limit()
4250 atomic_set(&ha->fwres.exch_used, 0); in qla_init_iocb_limit()
4256 struct qla_hw_data *ha = vha->hw; in qla_adjust_iocb_limit()
4258 __qla_adjust_iocb_limit(ha->base_qpair); in qla_adjust_iocb_limit()
4260 for (i = 0; i < ha->max_qpairs; i++) { in qla_adjust_iocb_limit()
4261 if (ha->queue_pair_map[i]) in qla_adjust_iocb_limit()
4262 __qla_adjust_iocb_limit(ha->queue_pair_map[i]); in qla_adjust_iocb_limit()
4267 * qla2x00_setup_chip() - Load and start RISC firmware.
4277 struct qla_hw_data *ha = vha->hw; in qla2x00_setup_chip()
4278 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_setup_chip()
4283 rval = ha->isp_ops->load_risc(vha, &srisc_address); in qla2x00_setup_chip()
4293 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_setup_chip()
4294 wrt_reg_word(&reg->hccr, (HCCR_ENABLE_PARITY + 0x0)); in qla2x00_setup_chip()
4295 rd_reg_word(&reg->hccr); in qla2x00_setup_chip()
4296 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_setup_chip()
4303 rval = ha->isp_ops->load_risc(vha, &srisc_address); in qla2x00_setup_chip()
4315 ha->flags.exlogins_enabled = 1; in qla2x00_setup_chip()
4318 ha->flags.exchoffld_enabled = 1; in qla2x00_setup_chip()
4326 "Re-starting firmware -- BPM.\n"); in qla2x00_setup_chip()
4327 /* Best-effort - re-init. */ in qla2x00_setup_chip()
4328 ha->isp_ops->reset_chip(vha); in qla2x00_setup_chip()
4329 ha->isp_ops->chip_diag(vha); in qla2x00_setup_chip()
4335 ha->last_zio_threshold); in qla2x00_setup_chip()
4352 ha->flags.npiv_supported = 0; in qla2x00_setup_chip()
4354 (ha->fw_attributes & BIT_2)) { in qla2x00_setup_chip()
4355 ha->flags.npiv_supported = 1; in qla2x00_setup_chip()
4356 if ((!ha->max_npiv_vports) || in qla2x00_setup_chip()
4357 ((ha->max_npiv_vports + 1) % in qla2x00_setup_chip()
4359 ha->max_npiv_vports = in qla2x00_setup_chip()
4360 MIN_MULTI_ID_FABRIC - 1; in qla2x00_setup_chip()
4370 vha->req); in qla2x00_setup_chip()
4389 if (ql2xrdpenable || ha->flags.scm_supported_f || in qla2x00_setup_chip()
4390 ha->flags.edif_enabled) in qla2x00_setup_chip()
4397 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_setup_chip()
4400 wrt_reg_word(&reg->hccr, HCCR_ENABLE_PARITY + 0x1); in qla2x00_setup_chip()
4403 wrt_reg_word(&reg->hccr, HCCR_ENABLE_PARITY + 0x7); in qla2x00_setup_chip()
4404 rd_reg_word(&reg->hccr); in qla2x00_setup_chip()
4405 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_setup_chip()
4409 ha->flags.fac_supported = 1; in qla2x00_setup_chip()
4415 ha->flags.fac_supported = 1; in qla2x00_setup_chip()
4416 ha->fdt_block_size = size << 2; in qla2x00_setup_chip()
4420 ha->fw_major_version, ha->fw_minor_version, in qla2x00_setup_chip()
4421 ha->fw_subminor_version); in qla2x00_setup_chip()
4424 ha->flags.fac_supported = 0; in qla2x00_setup_chip()
4439 * qla2x00_init_response_q_entries() - Initializes response queue entries.
4453 rsp->ring_ptr = rsp->ring; in qla2x00_init_response_q_entries()
4454 rsp->ring_index = 0; in qla2x00_init_response_q_entries()
4455 rsp->status_srb = NULL; in qla2x00_init_response_q_entries()
4456 pkt = rsp->ring_ptr; in qla2x00_init_response_q_entries()
4457 for (cnt = 0; cnt < rsp->length; cnt++) { in qla2x00_init_response_q_entries()
4458 pkt->signature = RESPONSE_PROCESSED; in qla2x00_init_response_q_entries()
4464 * qla2x00_update_fw_options() - Read and process firmware options.
4473 struct qla_hw_data *ha = vha->hw; in qla2x00_update_fw_options()
4475 memset(ha->fw_options, 0, sizeof(ha->fw_options)); in qla2x00_update_fw_options()
4476 qla2x00_get_fw_options(vha, ha->fw_options); in qla2x00_update_fw_options()
4485 ha->fw_seriallink_options, sizeof(ha->fw_seriallink_options)); in qla2x00_update_fw_options()
4487 ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING; in qla2x00_update_fw_options()
4488 if (ha->fw_seriallink_options[3] & BIT_2) { in qla2x00_update_fw_options()
4489 ha->fw_options[1] |= FO1_SET_EMPHASIS_SWING; in qla2x00_update_fw_options()
4492 swing = ha->fw_seriallink_options[2] & (BIT_2 | BIT_1 | BIT_0); in qla2x00_update_fw_options()
4493 emphasis = (ha->fw_seriallink_options[2] & in qla2x00_update_fw_options()
4495 tx_sens = ha->fw_seriallink_options[0] & in qla2x00_update_fw_options()
4497 rx_sens = (ha->fw_seriallink_options[0] & in qla2x00_update_fw_options()
4499 ha->fw_options[10] = (emphasis << 14) | (swing << 8); in qla2x00_update_fw_options()
4503 ha->fw_options[10] |= (tx_sens << 4) | rx_sens; in qla2x00_update_fw_options()
4505 ha->fw_options[10] |= BIT_5 | in qla2x00_update_fw_options()
4510 swing = (ha->fw_seriallink_options[2] & in qla2x00_update_fw_options()
4512 emphasis = ha->fw_seriallink_options[3] & (BIT_1 | BIT_0); in qla2x00_update_fw_options()
4513 tx_sens = ha->fw_seriallink_options[1] & in qla2x00_update_fw_options()
4515 rx_sens = (ha->fw_seriallink_options[1] & in qla2x00_update_fw_options()
4517 ha->fw_options[11] = (emphasis << 14) | (swing << 8); in qla2x00_update_fw_options()
4521 ha->fw_options[11] |= (tx_sens << 4) | rx_sens; in qla2x00_update_fw_options()
4523 ha->fw_options[11] |= BIT_5 | in qla2x00_update_fw_options()
4530 ha->fw_options[3] |= BIT_13; in qla2x00_update_fw_options()
4533 if (ha->flags.enable_led_scheme) in qla2x00_update_fw_options()
4534 ha->fw_options[2] |= BIT_12; in qla2x00_update_fw_options()
4538 ha->fw_options[2] |= BIT_13; in qla2x00_update_fw_options()
4541 if (ha->operating_mode == P2P) { in qla2x00_update_fw_options()
4542 ha->fw_options[2] |= BIT_3; in qla2x00_update_fw_options()
4545 __func__, ha->fw_options[2]); in qla2x00_update_fw_options()
4549 qla2x00_set_fw_options(vha, ha->fw_options); in qla2x00_update_fw_options()
4556 struct qla_hw_data *ha = vha->hw; in qla24xx_update_fw_options()
4563 ha->fw_options[3] |= BIT_12; in qla24xx_update_fw_options()
4566 if (ha->operating_mode == P2P) { in qla24xx_update_fw_options()
4567 ha->fw_options[2] |= BIT_3; in qla24xx_update_fw_options()
4570 __func__, ha->fw_options[2]); in qla24xx_update_fw_options()
4574 if (ql2xmvasynctoatio && !ha->flags.edif_enabled && in qla24xx_update_fw_options()
4578 ha->fw_options[2] |= BIT_11; in qla24xx_update_fw_options()
4580 ha->fw_options[2] &= ~BIT_11; in qla24xx_update_fw_options()
4591 ha->fw_options[2] |= BIT_4; in qla24xx_update_fw_options()
4593 ha->fw_options[2] &= ~(BIT_4); in qla24xx_update_fw_options()
4597 ha->fw_options[2] |= BIT_8; in qla24xx_update_fw_options()
4599 ha->fw_options[2] &= ~BIT_8; in qla24xx_update_fw_options()
4605 if (ha->flags.edif_enabled && in qla24xx_update_fw_options()
4607 ha->fw_options[3] |= BIT_15; in qla24xx_update_fw_options()
4608 ha->flags.n2n_fw_acc_sec = 1; in qla24xx_update_fw_options()
4610 ha->fw_options[3] &= ~BIT_15; in qla24xx_update_fw_options()
4611 ha->flags.n2n_fw_acc_sec = 0; in qla24xx_update_fw_options()
4615 if (ql2xrdpenable || ha->flags.scm_supported_f || in qla24xx_update_fw_options()
4616 ha->flags.edif_enabled) in qla24xx_update_fw_options()
4617 ha->fw_options[1] |= ADD_FO1_ENABLE_PUREX_IOCB; in qla24xx_update_fw_options()
4619 /* Enable Async 8130/8131 events -- transceiver insertion/removal */ in qla24xx_update_fw_options()
4621 ha->fw_options[3] |= BIT_10; in qla24xx_update_fw_options()
4624 "%s, add FW options 1-3 = 0x%04x 0x%04x 0x%04x mode %x\n", in qla24xx_update_fw_options()
4625 __func__, ha->fw_options[1], ha->fw_options[2], in qla24xx_update_fw_options()
4626 ha->fw_options[3], vha->host->active_mode); in qla24xx_update_fw_options()
4628 if (ha->fw_options[1] || ha->fw_options[2] || ha->fw_options[3]) in qla24xx_update_fw_options()
4629 qla2x00_set_fw_options(vha, ha->fw_options); in qla24xx_update_fw_options()
4632 if ((le16_to_cpu(ha->fw_seriallink_options24[0]) & BIT_0) == 0) in qla24xx_update_fw_options()
4636 le16_to_cpu(ha->fw_seriallink_options24[1]), in qla24xx_update_fw_options()
4637 le16_to_cpu(ha->fw_seriallink_options24[2]), in qla24xx_update_fw_options()
4638 le16_to_cpu(ha->fw_seriallink_options24[3])); in qla24xx_update_fw_options()
4648 struct qla_hw_data *ha = vha->hw; in qla2x00_config_rings()
4649 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_config_rings()
4650 struct req_que *req = ha->req_q_map[0]; in qla2x00_config_rings()
4651 struct rsp_que *rsp = ha->rsp_q_map[0]; in qla2x00_config_rings()
4654 ha->init_cb->request_q_outpointer = cpu_to_le16(0); in qla2x00_config_rings()
4655 ha->init_cb->response_q_inpointer = cpu_to_le16(0); in qla2x00_config_rings()
4656 ha->init_cb->request_q_length = cpu_to_le16(req->length); in qla2x00_config_rings()
4657 ha->init_cb->response_q_length = cpu_to_le16(rsp->length); in qla2x00_config_rings()
4658 put_unaligned_le64(req->dma, &ha->init_cb->request_q_address); in qla2x00_config_rings()
4659 put_unaligned_le64(rsp->dma, &ha->init_cb->response_q_address); in qla2x00_config_rings()
4671 struct qla_hw_data *ha = vha->hw; in qla24xx_config_rings()
4673 struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp; in qla24xx_config_rings()
4677 struct req_que *req = ha->req_q_map[0]; in qla24xx_config_rings()
4678 struct rsp_que *rsp = ha->rsp_q_map[0]; in qla24xx_config_rings()
4681 icb = (struct init_cb_24xx *)ha->init_cb; in qla24xx_config_rings()
4682 icb->request_q_outpointer = cpu_to_le16(0); in qla24xx_config_rings()
4683 icb->response_q_inpointer = cpu_to_le16(0); in qla24xx_config_rings()
4684 icb->request_q_length = cpu_to_le16(req->length); in qla24xx_config_rings()
4685 icb->response_q_length = cpu_to_le16(rsp->length); in qla24xx_config_rings()
4686 put_unaligned_le64(req->dma, &icb->request_q_address); in qla24xx_config_rings()
4687 put_unaligned_le64(rsp->dma, &icb->response_q_address); in qla24xx_config_rings()
4690 icb->atio_q_inpointer = cpu_to_le16(0); in qla24xx_config_rings()
4691 icb->atio_q_length = cpu_to_le16(ha->tgt.atio_q_length); in qla24xx_config_rings()
4692 put_unaligned_le64(ha->tgt.atio_dma, &icb->atio_q_address); in qla24xx_config_rings()
4695 icb->firmware_options_2 |= cpu_to_le32(BIT_30|BIT_29); in qla24xx_config_rings()
4697 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla24xx_config_rings()
4699 icb->qos = cpu_to_le16(QLA_DEFAULT_QUE_QOS); in qla24xx_config_rings()
4700 icb->rid = cpu_to_le16(rid); in qla24xx_config_rings()
4701 if (ha->flags.msix_enabled) { in qla24xx_config_rings()
4702 msix = &ha->msix_entries[1]; in qla24xx_config_rings()
4705 msix->entry); in qla24xx_config_rings()
4706 icb->msix = cpu_to_le16(msix->entry); in qla24xx_config_rings()
4710 icb->firmware_options_2 |= cpu_to_le32(BIT_19); in qla24xx_config_rings()
4713 icb->firmware_options_2 |= cpu_to_le32(BIT_18); in qla24xx_config_rings()
4716 if ((ha->fw_attributes & BIT_6) && (IS_MSIX_NACK_CAPABLE(ha)) && in qla24xx_config_rings()
4717 (ha->flags.msix_enabled)) { in qla24xx_config_rings()
4718 icb->firmware_options_2 &= cpu_to_le32(~BIT_22); in qla24xx_config_rings()
4719 ha->flags.disable_msix_handshake = 1; in qla24xx_config_rings()
4723 icb->firmware_options_2 |= cpu_to_le32(BIT_22); in qla24xx_config_rings()
4725 icb->firmware_options_2 |= cpu_to_le32(BIT_23); in qla24xx_config_rings()
4727 wrt_reg_dword(&reg->isp25mq.req_q_in, 0); in qla24xx_config_rings()
4728 wrt_reg_dword(&reg->isp25mq.req_q_out, 0); in qla24xx_config_rings()
4729 wrt_reg_dword(&reg->isp25mq.rsp_q_in, 0); in qla24xx_config_rings()
4730 wrt_reg_dword(&reg->isp25mq.rsp_q_out, 0); in qla24xx_config_rings()
4732 wrt_reg_dword(&reg->isp24.req_q_in, 0); in qla24xx_config_rings()
4733 wrt_reg_dword(&reg->isp24.req_q_out, 0); in qla24xx_config_rings()
4734 wrt_reg_dword(&reg->isp24.rsp_q_in, 0); in qla24xx_config_rings()
4735 wrt_reg_dword(&reg->isp24.rsp_q_out, 0); in qla24xx_config_rings()
4741 if (ha->set_data_rate) { in qla24xx_config_rings()
4744 qla2x00_get_link_speed_str(ha, ha->set_data_rate)); in qla24xx_config_rings()
4745 icb->firmware_options_3 = cpu_to_le32(ha->set_data_rate << 13); in qla24xx_config_rings()
4749 rd_reg_word(&ioreg->hccr); in qla24xx_config_rings()
4753 * qla2x00_init_rings() - Initializes firmware.
4767 struct qla_hw_data *ha = vha->hw; in qla2x00_init_rings()
4771 (struct mid_init_cb_24xx *) ha->init_cb; in qla2x00_init_rings()
4773 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_init_rings()
4776 for (que = 0; que < ha->max_req_queues; que++) { in qla2x00_init_rings()
4777 req = ha->req_q_map[que]; in qla2x00_init_rings()
4778 if (!req || !test_bit(que, ha->req_qid_map)) in qla2x00_init_rings()
4780 req->out_ptr = (uint16_t *)(req->ring + req->length); in qla2x00_init_rings()
4781 *req->out_ptr = 0; in qla2x00_init_rings()
4782 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) in qla2x00_init_rings()
4783 req->outstanding_cmds[cnt] = NULL; in qla2x00_init_rings()
4785 req->current_outstanding_cmd = 1; in qla2x00_init_rings()
4788 req->ring_ptr = req->ring; in qla2x00_init_rings()
4789 req->ring_index = 0; in qla2x00_init_rings()
4790 req->cnt = req->length; in qla2x00_init_rings()
4793 for (que = 0; que < ha->max_rsp_queues; que++) { in qla2x00_init_rings()
4794 rsp = ha->rsp_q_map[que]; in qla2x00_init_rings()
4795 if (!rsp || !test_bit(que, ha->rsp_qid_map)) in qla2x00_init_rings()
4797 rsp->in_ptr = (uint16_t *)(rsp->ring + rsp->length); in qla2x00_init_rings()
4798 *rsp->in_ptr = 0; in qla2x00_init_rings()
4806 ha->tgt.atio_ring_ptr = ha->tgt.atio_ring; in qla2x00_init_rings()
4807 ha->tgt.atio_ring_index = 0; in qla2x00_init_rings()
4811 ha->isp_ops->config_rings(vha); in qla2x00_init_rings()
4813 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_init_rings()
4816 rval = qlafx00_init_firmware(vha, ha->init_cb_size); in qla2x00_init_rings()
4821 ha->isp_ops->update_fw_options(vha); in qla2x00_init_rings()
4824 "Issue init firmware FW opt 1-3= %08x %08x %08x.\n", in qla2x00_init_rings()
4825 le32_to_cpu(mid_init_cb->init_cb.firmware_options_1), in qla2x00_init_rings()
4826 le32_to_cpu(mid_init_cb->init_cb.firmware_options_2), in qla2x00_init_rings()
4827 le32_to_cpu(mid_init_cb->init_cb.firmware_options_3)); in qla2x00_init_rings()
4829 if (ha->flags.npiv_supported) { in qla2x00_init_rings()
4830 if (ha->operating_mode == LOOP && !IS_CNA_CAPABLE(ha)) in qla2x00_init_rings()
4831 ha->max_npiv_vports = MIN_MULTI_ID_FABRIC - 1; in qla2x00_init_rings()
4832 mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports); in qla2x00_init_rings()
4836 mid_init_cb->options = cpu_to_le16(BIT_1); in qla2x00_init_rings()
4837 mid_init_cb->init_cb.execution_throttle = in qla2x00_init_rings()
4838 cpu_to_le16(ha->cur_fw_xcb_count); in qla2x00_init_rings()
4839 ha->flags.dport_enabled = in qla2x00_init_rings()
4840 (le32_to_cpu(mid_init_cb->init_cb.firmware_options_1) & in qla2x00_init_rings()
4843 (ha->flags.dport_enabled) ? "enabled" : "disabled"); in qla2x00_init_rings()
4844 /* FA-WWPN Status */ in qla2x00_init_rings()
4845 ha->flags.fawwpn_enabled = in qla2x00_init_rings()
4846 (le32_to_cpu(mid_init_cb->init_cb.firmware_options_1) & in qla2x00_init_rings()
4848 ql_dbg(ql_dbg_init, vha, 0x00bc, "FA-WWPN Support: %s.\n", in qla2x00_init_rings()
4849 (ha->flags.fawwpn_enabled) ? "enabled" : "disabled"); in qla2x00_init_rings()
4851 memcpy(ha->port_name, ha->init_cb->port_name, WWN_SIZE); in qla2x00_init_rings()
4855 if (ha->flags.edif_enabled) in qla2x00_init_rings()
4856 mid_init_cb->init_cb.frame_payload_size = cpu_to_le16(ELS_MAX_PAYLOAD); in qla2x00_init_rings()
4859 rval = qla2x00_init_firmware(vha, ha->init_cb_size); in qla2x00_init_rings()
4867 "Init Firmware -- success.\n"); in qla2x00_init_rings()
4868 vha->u_ql2xexchoffld = vha->u_ql2xiniexchg = 0; in qla2x00_init_rings()
4875 * qla2x00_fw_ready() - Waits for firmware ready.
4888 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_ready()
4890 if (IS_QLAFX00(vha->hw)) in qla2x00_fw_ready()
4903 if ((wait_time = (ha->retry_count*ha->login_timeout) + 5) < min_wait) { in qla2x00_fw_ready()
4914 if (!vha->flags.init_done) in qla2x00_fw_ready()
4919 memset(state, -1, sizeof(state)); in qla2x00_fw_ready()
4923 vha->device_flags &= ~DFLG_NO_CABLE; in qla2x00_fw_ready()
4944 cs84xx_time = jiffies - cs84xx_time; in qla2x00_fw_ready()
4954 "F/W Ready - OK.\n"); in qla2x00_fw_ready()
4956 qla2x00_get_retry_cnt(vha, &ha->retry_count, in qla2x00_fw_ready()
4957 &ha->login_timeout, &ha->r_a_tov); in qla2x00_fw_ready()
4965 if (atomic_read(&vha->loop_down_timer) && in qla2x00_fw_ready()
4974 vha->device_flags |= DFLG_NO_CABLE; in qla2x00_fw_ready()
4981 ha->flags.isp82xx_fw_hung) in qla2x00_fw_ready()
4996 if (rval && !(vha->device_flags & DFLG_NO_CABLE)) { in qla2x00_fw_ready()
5028 struct qla_hw_data *ha = vha->hw; in qla2x00_configure_hba()
5029 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_configure_hba()
5037 if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) || in qla2x00_configure_hba()
5052 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_configure_hba()
5059 "Cannot get topology - retrying.\n"); in qla2x00_configure_hba()
5063 vha->loop_id = loop_id; in qla2x00_configure_hba()
5066 ha->min_external_loopid = SNS_FIRST_LOOP_ID; in qla2x00_configure_hba()
5067 ha->operating_mode = LOOP; in qla2x00_configure_hba()
5072 ha->switch_cap = 0; in qla2x00_configure_hba()
5073 ha->current_topology = ISP_CFG_NL; in qla2x00_configure_hba()
5079 ha->switch_cap = sw_cap; in qla2x00_configure_hba()
5080 ha->current_topology = ISP_CFG_FL; in qla2x00_configure_hba()
5086 ha->switch_cap = 0; in qla2x00_configure_hba()
5087 ha->operating_mode = P2P; in qla2x00_configure_hba()
5088 ha->current_topology = ISP_CFG_N; in qla2x00_configure_hba()
5089 strcpy(connect_type, "(N_Port-to-N_Port)"); in qla2x00_configure_hba()
5094 ha->switch_cap = sw_cap; in qla2x00_configure_hba()
5095 ha->operating_mode = P2P; in qla2x00_configure_hba()
5096 ha->current_topology = ISP_CFG_F; in qla2x00_configure_hba()
5103 ha->switch_cap = 0; in qla2x00_configure_hba()
5104 ha->current_topology = ISP_CFG_NL; in qla2x00_configure_hba()
5110 /* byte order - Big Endian */ in qla2x00_configure_hba()
5115 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_configure_hba()
5116 if (vha->hw->flags.edif_enabled) { in qla2x00_configure_hba()
5119 } else if (!(topo == 2 && ha->flags.n2n_bigger)) in qla2x00_configure_hba()
5121 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_configure_hba()
5123 if (!vha->flags.init_done) in qla2x00_configure_hba()
5125 "Topology - %s, Host Loop address 0x%x.\n", in qla2x00_configure_hba()
5126 connect_type, vha->loop_id); in qla2x00_configure_hba()
5138 struct qla_hw_data *ha = vha->hw; in qla2x00_set_model_info()
5145 memcpy(ha->model_number, model, len); in qla2x00_set_model_info()
5146 st = en = ha->model_number; in qla2x00_set_model_info()
5147 en += len - 1; in qla2x00_set_model_info()
5151 *en-- = '\0'; in qla2x00_set_model_info()
5154 index = (ha->pdev->subsystem_device & 0xff); in qla2x00_set_model_info()
5156 ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && in qla2x00_set_model_info()
5158 strscpy(ha->model_desc, in qla2x00_set_model_info()
5160 sizeof(ha->model_desc)); in qla2x00_set_model_info()
5162 index = (ha->pdev->subsystem_device & 0xff); in qla2x00_set_model_info()
5164 ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && in qla2x00_set_model_info()
5166 strscpy(ha->model_number, in qla2x00_set_model_info()
5168 sizeof(ha->model_number)); in qla2x00_set_model_info()
5169 strscpy(ha->model_desc, in qla2x00_set_model_info()
5171 sizeof(ha->model_desc)); in qla2x00_set_model_info()
5173 strscpy(ha->model_number, def, in qla2x00_set_model_info()
5174 sizeof(ha->model_number)); in qla2x00_set_model_info()
5178 qla2xxx_get_vpd_field(vha, "\x82", ha->model_desc, in qla2x00_set_model_info()
5179 sizeof(ha->model_desc)); in qla2x00_set_model_info()
5188 struct qla_hw_data *ha = vha->hw; in qla2xxx_nvram_wwn_from_ofw()
5189 struct pci_dev *pdev = ha->pdev; in qla2xxx_nvram_wwn_from_ofw()
5194 val = of_get_property(dp, "port-wwn", &len); in qla2xxx_nvram_wwn_from_ofw()
5196 memcpy(nv->port_name, val, WWN_SIZE); in qla2xxx_nvram_wwn_from_ofw()
5198 val = of_get_property(dp, "node-wwn", &len); in qla2xxx_nvram_wwn_from_ofw()
5200 memcpy(nv->node_name, val, WWN_SIZE); in qla2xxx_nvram_wwn_from_ofw()
5224 struct qla_hw_data *ha = vha->hw; in qla2x00_nvram_config()
5225 init_cb_t *icb = ha->init_cb; in qla2x00_nvram_config()
5226 nvram_t *nv = ha->nvram; in qla2x00_nvram_config()
5227 uint8_t *ptr = ha->nvram; in qla2x00_nvram_config()
5228 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_nvram_config()
5233 ha->nvram_size = sizeof(*nv); in qla2x00_nvram_config()
5234 ha->nvram_base = 0; in qla2x00_nvram_config()
5236 if ((rd_reg_word(&reg->ctrl_status) >> 14) == 1) in qla2x00_nvram_config()
5237 ha->nvram_base = 0x80; in qla2x00_nvram_config()
5240 ha->isp_ops->read_nvram(vha, ptr, ha->nvram_base, ha->nvram_size); in qla2x00_nvram_config()
5241 for (cnt = 0, chksum = 0; cnt < ha->nvram_size; cnt++) in qla2x00_nvram_config()
5247 nv, ha->nvram_size); in qla2x00_nvram_config()
5250 if (chksum || memcmp("ISP ", nv->id, sizeof(nv->id)) || in qla2x00_nvram_config()
5251 nv->nvram_version < 1) { in qla2x00_nvram_config()
5255 chksum, nv->id, nv->nvram_version); in qla2x00_nvram_config()
5258 "functioning (yet invalid -- WWPN) defaults.\n"); in qla2x00_nvram_config()
5263 memset(nv, 0, ha->nvram_size); in qla2x00_nvram_config()
5264 nv->parameter_block_version = ICB_VERSION; in qla2x00_nvram_config()
5267 nv->firmware_options[0] = BIT_2 | BIT_1; in qla2x00_nvram_config()
5268 nv->firmware_options[1] = BIT_7 | BIT_5; in qla2x00_nvram_config()
5269 nv->add_firmware_options[0] = BIT_5; in qla2x00_nvram_config()
5270 nv->add_firmware_options[1] = BIT_5 | BIT_4; in qla2x00_nvram_config()
5271 nv->frame_payload_size = cpu_to_le16(2048); in qla2x00_nvram_config()
5272 nv->special_options[1] = BIT_7; in qla2x00_nvram_config()
5274 nv->firmware_options[0] = BIT_2 | BIT_1; in qla2x00_nvram_config()
5275 nv->firmware_options[1] = BIT_7 | BIT_5; in qla2x00_nvram_config()
5276 nv->add_firmware_options[0] = BIT_5; in qla2x00_nvram_config()
5277 nv->add_firmware_options[1] = BIT_5 | BIT_4; in qla2x00_nvram_config()
5278 nv->frame_payload_size = cpu_to_le16(1024); in qla2x00_nvram_config()
5280 nv->firmware_options[0] = BIT_3 | BIT_1; in qla2x00_nvram_config()
5281 nv->firmware_options[1] = BIT_5; in qla2x00_nvram_config()
5282 nv->frame_payload_size = cpu_to_le16(1024); in qla2x00_nvram_config()
5285 nv->max_iocb_allocation = cpu_to_le16(256); in qla2x00_nvram_config()
5286 nv->execution_throttle = cpu_to_le16(16); in qla2x00_nvram_config()
5287 nv->retry_count = 8; in qla2x00_nvram_config()
5288 nv->retry_delay = 1; in qla2x00_nvram_config()
5290 nv->port_name[0] = 33; in qla2x00_nvram_config()
5291 nv->port_name[3] = 224; in qla2x00_nvram_config()
5292 nv->port_name[4] = 139; in qla2x00_nvram_config()
5296 nv->login_timeout = 4; in qla2x00_nvram_config()
5301 nv->host_p[1] = BIT_2; in qla2x00_nvram_config()
5302 nv->reset_delay = 5; in qla2x00_nvram_config()
5303 nv->port_down_retry_count = 8; in qla2x00_nvram_config()
5304 nv->max_luns_per_target = cpu_to_le16(8); in qla2x00_nvram_config()
5305 nv->link_down_timeout = 60; in qla2x00_nvram_config()
5311 memset(icb, 0, ha->init_cb_size); in qla2x00_nvram_config()
5316 nv->firmware_options[0] |= (BIT_6 | BIT_1); in qla2x00_nvram_config()
5317 nv->firmware_options[0] &= ~(BIT_5 | BIT_4); in qla2x00_nvram_config()
5318 nv->firmware_options[1] |= (BIT_5 | BIT_0); in qla2x00_nvram_config()
5319 nv->firmware_options[1] &= ~BIT_4; in qla2x00_nvram_config()
5322 nv->firmware_options[0] |= BIT_2; in qla2x00_nvram_config()
5323 nv->firmware_options[0] &= ~BIT_3; in qla2x00_nvram_config()
5324 nv->special_options[0] &= ~BIT_6; in qla2x00_nvram_config()
5325 nv->add_firmware_options[1] |= BIT_5 | BIT_4; in qla2x00_nvram_config()
5328 if (ha->fb_rev == FPM_2310) { in qla2x00_nvram_config()
5329 strcpy(ha->model_number, "QLA2310"); in qla2x00_nvram_config()
5331 strcpy(ha->model_number, "QLA2300"); in qla2x00_nvram_config()
5334 qla2x00_set_model_info(vha, nv->model_number, in qla2x00_nvram_config()
5335 sizeof(nv->model_number), "QLA23xx"); in qla2x00_nvram_config()
5338 nv->firmware_options[0] |= BIT_2; in qla2x00_nvram_config()
5340 * 'Point-to-point preferred, else loop' is not a safe in qla2x00_nvram_config()
5343 if ((nv->add_firmware_options[0] & (BIT_6 | BIT_5 | BIT_4)) == in qla2x00_nvram_config()
5345 /* Force 'loop preferred, else point-to-point'. */ in qla2x00_nvram_config()
5346 nv->add_firmware_options[0] &= ~(BIT_6 | BIT_5 | BIT_4); in qla2x00_nvram_config()
5347 nv->add_firmware_options[0] |= BIT_5; in qla2x00_nvram_config()
5349 strcpy(ha->model_number, "QLA22xx"); in qla2x00_nvram_config()
5351 strcpy(ha->model_number, "QLA2100"); in qla2x00_nvram_config()
5358 dptr2 = (uint8_t *)&nv->parameter_block_version; in qla2x00_nvram_config()
5359 cnt = (uint8_t *)&icb->request_q_outpointer - (uint8_t *)&icb->version; in qla2x00_nvram_config()
5360 while (cnt--) in qla2x00_nvram_config()
5364 dptr1 = (uint8_t *)icb->add_firmware_options; in qla2x00_nvram_config()
5365 cnt = (uint8_t *)icb->reserved_3 - (uint8_t *)icb->add_firmware_options; in qla2x00_nvram_config()
5366 while (cnt--) in qla2x00_nvram_config()
5368 ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size); in qla2x00_nvram_config()
5370 if (nv->host_p[1] & BIT_7) { in qla2x00_nvram_config()
5371 memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE); in qla2x00_nvram_config()
5372 memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE); in qla2x00_nvram_config()
5376 if ((icb->firmware_options[1] & BIT_6) == 0) { in qla2x00_nvram_config()
5381 memcpy(icb->node_name, icb->port_name, WWN_SIZE); in qla2x00_nvram_config()
5382 icb->node_name[0] &= 0xF0; in qla2x00_nvram_config()
5390 * BIT_7 in the host-parameters section allows for modification to in qla2x00_nvram_config()
5393 if (nv->host_p[0] & BIT_7) in qla2x00_nvram_config()
5395 ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0); in qla2x00_nvram_config()
5398 ha->flags.disable_risc_code_load = 0; in qla2x00_nvram_config()
5399 ha->flags.enable_lip_reset = ((nv->host_p[1] & BIT_1) ? 1 : 0); in qla2x00_nvram_config()
5400 ha->flags.enable_lip_full_login = ((nv->host_p[1] & BIT_2) ? 1 : 0); in qla2x00_nvram_config()
5401 ha->flags.enable_target_reset = ((nv->host_p[1] & BIT_3) ? 1 : 0); in qla2x00_nvram_config()
5402 ha->flags.enable_led_scheme = (nv->special_options[1] & BIT_4) ? 1 : 0; in qla2x00_nvram_config()
5403 ha->flags.disable_serdes = 0; in qla2x00_nvram_config()
5405 ha->operating_mode = in qla2x00_nvram_config()
5406 (icb->add_firmware_options[0] & (BIT_6 | BIT_5 | BIT_4)) >> 4; in qla2x00_nvram_config()
5408 memcpy(ha->fw_seriallink_options, nv->seriallink_options, in qla2x00_nvram_config()
5409 sizeof(ha->fw_seriallink_options)); in qla2x00_nvram_config()
5412 ha->serial0 = icb->port_name[5]; in qla2x00_nvram_config()
5413 ha->serial1 = icb->port_name[6]; in qla2x00_nvram_config()
5414 ha->serial2 = icb->port_name[7]; in qla2x00_nvram_config()
5415 memcpy(vha->node_name, icb->node_name, WWN_SIZE); in qla2x00_nvram_config()
5416 memcpy(vha->port_name, icb->port_name, WWN_SIZE); in qla2x00_nvram_config()
5418 icb->execution_throttle = cpu_to_le16(0xFFFF); in qla2x00_nvram_config()
5420 ha->retry_count = nv->retry_count; in qla2x00_nvram_config()
5423 if (nv->login_timeout != ql2xlogintimeout) in qla2x00_nvram_config()
5424 nv->login_timeout = ql2xlogintimeout; in qla2x00_nvram_config()
5425 if (nv->login_timeout < 4) in qla2x00_nvram_config()
5426 nv->login_timeout = 4; in qla2x00_nvram_config()
5427 ha->login_timeout = nv->login_timeout; in qla2x00_nvram_config()
5430 ha->r_a_tov = 100; in qla2x00_nvram_config()
5432 ha->loop_reset_delay = nv->reset_delay; in qla2x00_nvram_config()
5444 if (nv->link_down_timeout == 0) { in qla2x00_nvram_config()
5445 ha->loop_down_abort_time = in qla2x00_nvram_config()
5446 (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); in qla2x00_nvram_config()
5448 ha->link_down_timeout = nv->link_down_timeout; in qla2x00_nvram_config()
5449 ha->loop_down_abort_time = in qla2x00_nvram_config()
5450 (LOOP_DOWN_TIME - ha->link_down_timeout); in qla2x00_nvram_config()
5456 ha->port_down_retry_count = nv->port_down_retry_count; in qla2x00_nvram_config()
5458 ha->port_down_retry_count = qlport_down_retry; in qla2x00_nvram_config()
5460 ha->login_retry_count = nv->retry_count; in qla2x00_nvram_config()
5461 if (ha->port_down_retry_count == nv->port_down_retry_count && in qla2x00_nvram_config()
5462 ha->port_down_retry_count > 3) in qla2x00_nvram_config()
5463 ha->login_retry_count = ha->port_down_retry_count; in qla2x00_nvram_config()
5464 else if (ha->port_down_retry_count > (int)ha->login_retry_count) in qla2x00_nvram_config()
5465 ha->login_retry_count = ha->port_down_retry_count; in qla2x00_nvram_config()
5467 ha->login_retry_count = ql2xloginretrycount; in qla2x00_nvram_config()
5469 icb->lun_enables = cpu_to_le16(0); in qla2x00_nvram_config()
5470 icb->command_resource_count = 0; in qla2x00_nvram_config()
5471 icb->immediate_notify_resource_count = 0; in qla2x00_nvram_config()
5472 icb->timeout = cpu_to_le16(0); in qla2x00_nvram_config()
5476 icb->firmware_options[0] &= ~BIT_3; in qla2x00_nvram_config()
5477 icb->add_firmware_options[0] &= in qla2x00_nvram_config()
5479 icb->add_firmware_options[0] |= BIT_2; in qla2x00_nvram_config()
5480 icb->response_accumulation_timer = 3; in qla2x00_nvram_config()
5481 icb->interrupt_delay_timer = 5; in qla2x00_nvram_config()
5483 vha->flags.process_response_queue = 1; in qla2x00_nvram_config()
5486 if (!vha->flags.init_done) { in qla2x00_nvram_config()
5487 ha->zio_mode = icb->add_firmware_options[0] & in qla2x00_nvram_config()
5489 ha->zio_timer = icb->interrupt_delay_timer ? in qla2x00_nvram_config()
5490 icb->interrupt_delay_timer : 2; in qla2x00_nvram_config()
5492 icb->add_firmware_options[0] &= in qla2x00_nvram_config()
5494 vha->flags.process_response_queue = 0; in qla2x00_nvram_config()
5495 if (ha->zio_mode != QLA_ZIO_DISABLED) { in qla2x00_nvram_config()
5496 ha->zio_mode = QLA_ZIO_MODE_6; in qla2x00_nvram_config()
5500 ha->zio_mode, ha->zio_timer * 100); in qla2x00_nvram_config()
5502 icb->add_firmware_options[0] |= (uint8_t)ha->zio_mode; in qla2x00_nvram_config()
5503 icb->interrupt_delay_timer = (uint8_t)ha->zio_timer; in qla2x00_nvram_config()
5504 vha->flags.process_response_queue = 1; in qla2x00_nvram_config()
5519 old_state = atomic_read(&fcport->state); in qla2x00_set_fcport_state()
5520 atomic_set(&fcport->state, state); in qla2x00_set_fcport_state()
5524 ql_dbg(ql_dbg_disc, fcport->vha, 0x207d, in qla2x00_set_fcport_state()
5525 "FCPort %8phC state transitioned from %s to %s - portid=%02x%02x%02x.\n", in qla2x00_set_fcport_state()
5526 fcport->port_name, port_state_str[old_state], in qla2x00_set_fcport_state()
5527 port_state_str[state], fcport->d_id.b.domain, in qla2x00_set_fcport_state()
5528 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_set_fcport_state()
5533 * qla2x00_alloc_fcport() - Allocate a generic fcport.
5548 fcport->ct_desc.ct_sns = dma_alloc_coherent(&vha->hw->pdev->dev, in qla2x00_alloc_fcport()
5549 sizeof(struct ct_sns_pkt), &fcport->ct_desc.ct_sns_dma, in qla2x00_alloc_fcport()
5551 if (!fcport->ct_desc.ct_sns) { in qla2x00_alloc_fcport()
5559 fcport->vha = vha; in qla2x00_alloc_fcport()
5560 fcport->port_type = FCT_UNKNOWN; in qla2x00_alloc_fcport()
5561 fcport->loop_id = FC_NO_LOOP_ID; in qla2x00_alloc_fcport()
5563 fcport->supported_classes = FC_COS_UNSPECIFIED; in qla2x00_alloc_fcport()
5564 fcport->fp_speed = PORT_SPEED_UNKNOWN; in qla2x00_alloc_fcport()
5566 fcport->disc_state = DSC_DELETED; in qla2x00_alloc_fcport()
5567 fcport->fw_login_state = DSC_LS_PORT_UNAVAIL; in qla2x00_alloc_fcport()
5568 fcport->deleted = QLA_SESS_DELETED; in qla2x00_alloc_fcport()
5569 fcport->login_retry = vha->hw->login_retry_count; in qla2x00_alloc_fcport()
5570 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla2x00_alloc_fcport()
5571 fcport->logout_on_delete = 1; in qla2x00_alloc_fcport()
5572 fcport->tgt_link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; in qla2x00_alloc_fcport()
5573 fcport->tgt_short_link_down_cnt = 0; in qla2x00_alloc_fcport()
5574 fcport->dev_loss_tmo = 0; in qla2x00_alloc_fcport()
5576 if (!fcport->ct_desc.ct_sns) { in qla2x00_alloc_fcport()
5583 INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn); in qla2x00_alloc_fcport()
5584 INIT_WORK(&fcport->free_work, qlt_free_session_done); in qla2x00_alloc_fcport()
5585 INIT_WORK(&fcport->reg_work, qla_register_fcport_fn); in qla2x00_alloc_fcport()
5586 INIT_LIST_HEAD(&fcport->gnl_entry); in qla2x00_alloc_fcport()
5587 INIT_LIST_HEAD(&fcport->list); in qla2x00_alloc_fcport()
5588 INIT_LIST_HEAD(&fcport->unsol_ctx_head); in qla2x00_alloc_fcport()
5590 INIT_LIST_HEAD(&fcport->sess_cmd_list); in qla2x00_alloc_fcport()
5591 spin_lock_init(&fcport->sess_cmd_lock); in qla2x00_alloc_fcport()
5593 spin_lock_init(&fcport->edif.sa_list_lock); in qla2x00_alloc_fcport()
5594 INIT_LIST_HEAD(&fcport->edif.tx_sa_list); in qla2x00_alloc_fcport()
5595 INIT_LIST_HEAD(&fcport->edif.rx_sa_list); in qla2x00_alloc_fcport()
5597 spin_lock_init(&fcport->edif.indx_list_lock); in qla2x00_alloc_fcport()
5598 INIT_LIST_HEAD(&fcport->edif.edif_indx_list); in qla2x00_alloc_fcport()
5606 if (fcport->ct_desc.ct_sns) { in qla2x00_free_fcport()
5607 dma_free_coherent(&fcport->vha->hw->pdev->dev, in qla2x00_free_fcport()
5608 sizeof(struct ct_sns_pkt), fcport->ct_desc.ct_sns, in qla2x00_free_fcport()
5609 fcport->ct_desc.ct_sns_dma); in qla2x00_free_fcport()
5611 fcport->ct_desc.ct_sns = NULL; in qla2x00_free_fcport()
5615 list_del(&fcport->list); in qla2x00_free_fcport()
5625 struct qla_hw_data *ha = vha->hw; in qla_get_login_template()
5630 memset(ha->init_cb, 0, ha->init_cb_size); in qla_get_login_template()
5631 sz = min_t(int, sizeof(struct fc_els_flogi), ha->init_cb_size); in qla_get_login_template()
5632 rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma, in qla_get_login_template()
5633 ha->init_cb, sz); in qla_get_login_template()
5639 q = (__be32 *)&ha->plogi_els_payld.fl_csp; in qla_get_login_template()
5641 bp = (uint32_t *)ha->init_cb; in qla_get_login_template()
5643 ha->flags.plogi_template_valid = 1; in qla_get_login_template()
5663 struct qla_hw_data *ha = vha->hw; in qla2x00_configure_loop()
5668 if (test_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags)) { in qla2x00_configure_loop()
5677 save_flags = flags = vha->dpc_flags; in qla2x00_configure_loop()
5679 "Configure loop -- dpc flags = 0x%lx.\n", flags); in qla2x00_configure_loop()
5685 clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2x00_configure_loop()
5686 clear_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2x00_configure_loop()
5692 if ((ha->current_topology == ISP_CFG_FL || in qla2x00_configure_loop()
5693 ha->current_topology == ISP_CFG_F) && in qla2x00_configure_loop()
5699 } else if (ha->current_topology == ISP_CFG_NL || in qla2x00_configure_loop()
5700 ha->current_topology == ISP_CFG_N) { in qla2x00_configure_loop()
5703 } else if (!vha->flags.online || in qla2x00_configure_loop()
5710 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { in qla2x00_configure_loop()
5729 if (atomic_read(&vha->loop_down_timer) || in qla2x00_configure_loop()
5730 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { in qla2x00_configure_loop()
5733 atomic_set(&vha->loop_state, LOOP_READY); in qla2x00_configure_loop()
5736 ha->flags.fw_init_done = 1; in qla2x00_configure_loop()
5742 if (ha->flags.edif_enabled && DBELL_INACTIVE(vha)) in qla2x00_configure_loop()
5744 ha->link_data_rate); in qla2x00_configure_loop()
5752 spin_lock_irqsave(&ha->tgt.atio_lock, flags); in qla2x00_configure_loop()
5754 spin_unlock_irqrestore(&ha->tgt.atio_lock, in qla2x00_configure_loop()
5766 __func__, vha->port_name, vha->d_id.b24); in qla2x00_configure_loop()
5770 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { in qla2x00_configure_loop()
5772 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2x00_configure_loop()
5774 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2x00_configure_loop()
5788 if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) in qla2x00_configure_n2n_loop()
5789 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_configure_n2n_loop()
5791 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_configure_n2n_loop()
5792 if (fcport->n2n_flag) { in qla2x00_configure_n2n_loop()
5798 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_configure_n2n_loop()
5799 vha->scan.scan_retry++; in qla2x00_configure_n2n_loop()
5800 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_configure_n2n_loop()
5802 if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { in qla2x00_configure_n2n_loop()
5803 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2x00_configure_n2n_loop()
5804 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_configure_n2n_loop()
5814 atomic_set(&vha->loop_state, LOOP_DOWN); in qla_reinitialize_link()
5815 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla_reinitialize_link()
5846 struct qla_hw_data *ha = vha->hw; in qla2x00_configure_local_loop()
5857 memset(ha->gid_list, 0, qla2x00_gid_list_size(ha)); in qla2x00_configure_local_loop()
5858 rval = qla2x00_get_id_list(vha, ha->gid_list, ha->gid_list_dma, in qla2x00_configure_local_loop()
5866 ha->gid_list, entries * sizeof(*ha->gid_list)); in qla2x00_configure_local_loop()
5869 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_configure_local_loop()
5870 vha->scan.scan_retry++; in qla2x00_configure_local_loop()
5871 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_configure_local_loop()
5873 if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { in qla2x00_configure_local_loop()
5887 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2x00_configure_local_loop()
5888 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_configure_local_loop()
5891 vha->scan.scan_retry = 0; in qla2x00_configure_local_loop()
5894 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_configure_local_loop()
5895 fcport->scan_state = QLA_FCPORT_SCAN; in qla2x00_configure_local_loop()
5906 new_fcport->flags &= ~FCF_FABRIC_DEVICE; in qla2x00_configure_local_loop()
5909 gid = ha->gid_list; in qla2x00_configure_local_loop()
5911 domain = gid->domain; in qla2x00_configure_local_loop()
5912 area = gid->area; in qla2x00_configure_local_loop()
5913 al_pa = gid->al_pa; in qla2x00_configure_local_loop()
5915 loop_id = gid->loop_id_2100; in qla2x00_configure_local_loop()
5917 loop_id = le16_to_cpu(gid->loop_id); in qla2x00_configure_local_loop()
5918 gid = (void *)gid + ha->gid_list_info_size; in qla2x00_configure_local_loop()
5925 if (area && domain && ((area != vha->d_id.b.area) || in qla2x00_configure_local_loop()
5926 (domain != vha->d_id.b.domain)) && in qla2x00_configure_local_loop()
5927 (ha->current_topology == ISP_CFG_NL)) in qla2x00_configure_local_loop()
5935 memset(new_fcport->port_name, 0, WWN_SIZE); in qla2x00_configure_local_loop()
5938 new_fcport->d_id.b.domain = domain; in qla2x00_configure_local_loop()
5939 new_fcport->d_id.b.area = area; in qla2x00_configure_local_loop()
5940 new_fcport->d_id.b.al_pa = al_pa; in qla2x00_configure_local_loop()
5941 new_fcport->loop_id = loop_id; in qla2x00_configure_local_loop()
5942 new_fcport->scan_state = QLA_FCPORT_FOUND; in qla2x00_configure_local_loop()
5948 "-- get_port_database=%x, loop_id=0x%04x.\n", in qla2x00_configure_local_loop()
5949 rval2, new_fcport->loop_id); in qla2x00_configure_local_loop()
5951 if (ha->current_topology != ISP_CFG_N) { in qla2x00_configure_local_loop()
5954 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_configure_local_loop()
5959 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_configure_local_loop()
5963 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_configure_local_loop()
5964 if (memcmp(new_fcport->port_name, fcport->port_name, in qla2x00_configure_local_loop()
5968 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla2x00_configure_local_loop()
5969 fcport->loop_id = new_fcport->loop_id; in qla2x00_configure_local_loop()
5970 fcport->port_type = new_fcport->port_type; in qla2x00_configure_local_loop()
5971 fcport->d_id.b24 = new_fcport->d_id.b24; in qla2x00_configure_local_loop()
5972 memcpy(fcport->node_name, new_fcport->node_name, in qla2x00_configure_local_loop()
5974 fcport->scan_state = QLA_FCPORT_FOUND; in qla2x00_configure_local_loop()
5975 if (fcport->login_retry == 0) { in qla2x00_configure_local_loop()
5976 fcport->login_retry = vha->hw->login_retry_count; in qla2x00_configure_local_loop()
5979 fcport->port_name, fcport->loop_id, in qla2x00_configure_local_loop()
5980 fcport->login_retry); in qla2x00_configure_local_loop()
5988 list_add_tail(&new_fcport->list, &vha->vp_fcports); in qla2x00_configure_local_loop()
5993 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_configure_local_loop()
6003 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_configure_local_loop()
6004 new_fcport->flags &= ~FCF_FABRIC_DEVICE; in qla2x00_configure_local_loop()
6007 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_configure_local_loop()
6010 fcport->fp_speed = ha->link_data_rate; in qla2x00_configure_local_loop()
6013 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_configure_local_loop()
6014 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_configure_local_loop()
6017 if (fcport->scan_state == QLA_FCPORT_SCAN) { in qla2x00_configure_local_loop()
6020 atomic_read(&fcport->state) == FCS_ONLINE) { in qla2x00_configure_local_loop()
6023 if (fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_configure_local_loop()
6024 (fcport->flags & FCF_FCP2_DEVICE) == 0 && in qla2x00_configure_local_loop()
6025 fcport->port_type != FCT_INITIATOR && in qla2x00_configure_local_loop()
6026 fcport->port_type != FCT_BROADCAST) { in qla2x00_configure_local_loop()
6030 fcport->port_name); in qla2x00_configure_local_loop()
6038 if (fcport->scan_state == QLA_FCPORT_FOUND) in qla2x00_configure_local_loop()
6057 struct qla_hw_data *ha = vha->hw; in qla2x00_iidma_fcport()
6062 if (atomic_read(&fcport->state) != FCS_ONLINE) in qla2x00_iidma_fcport()
6065 if (fcport->fp_speed == PORT_SPEED_UNKNOWN || in qla2x00_iidma_fcport()
6066 fcport->fp_speed > ha->link_data_rate || in qla2x00_iidma_fcport()
6067 !ha->flags.gpsc_supported) in qla2x00_iidma_fcport()
6070 rval = qla2x00_set_idma_speed(vha, fcport->loop_id, fcport->fp_speed, in qla2x00_iidma_fcport()
6074 "Unable to adjust iIDMA %8phN -- %04x %x %04x %04x.\n", in qla2x00_iidma_fcport()
6075 fcport->port_name, rval, fcport->fp_speed, mb[0], mb[1]); in qla2x00_iidma_fcport()
6079 qla2x00_get_link_speed_str(ha, fcport->fp_speed), in qla2x00_iidma_fcport()
6080 fcport->fp_speed, fcport->port_name); in qla2x00_iidma_fcport()
6098 e->u.fcport.fcport = fcport; in qla_post_iidma_work()
6110 if (atomic_read(&fcport->state) == FCS_ONLINE) in qla2x00_reg_remote_port()
6113 rport_ids.node_name = wwn_to_u64(fcport->node_name); in qla2x00_reg_remote_port()
6114 rport_ids.port_name = wwn_to_u64(fcport->port_name); in qla2x00_reg_remote_port()
6115 rport_ids.port_id = fcport->d_id.b.domain << 16 | in qla2x00_reg_remote_port()
6116 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; in qla2x00_reg_remote_port()
6118 fcport->rport = rport = fc_remote_port_add(vha->host, 0, &rport_ids); in qla2x00_reg_remote_port()
6125 spin_lock_irqsave(fcport->vha->host->host_lock, flags); in qla2x00_reg_remote_port()
6126 *((fc_port_t **)rport->dd_data) = fcport; in qla2x00_reg_remote_port()
6127 spin_unlock_irqrestore(fcport->vha->host->host_lock, flags); in qla2x00_reg_remote_port()
6128 fcport->dev_loss_tmo = rport->dev_loss_tmo; in qla2x00_reg_remote_port()
6130 rport->supported_classes = fcport->supported_classes; in qla2x00_reg_remote_port()
6133 if (fcport->port_type == FCT_INITIATOR) in qla2x00_reg_remote_port()
6135 if (fcport->port_type == FCT_TARGET) in qla2x00_reg_remote_port()
6137 if (fcport->port_type & FCT_NVME_INITIATOR) in qla2x00_reg_remote_port()
6139 if (fcport->port_type & FCT_NVME_TARGET) in qla2x00_reg_remote_port()
6141 if (fcport->port_type & FCT_NVME_DISCOVERY) in qla2x00_reg_remote_port()
6148 __func__, fcport->port_name, vha->host_no, in qla2x00_reg_remote_port()
6149 rport->scsi_target_id, rport, in qla2x00_reg_remote_port()
6150 (fcport->port_type == FCT_TARGET) ? "tgt" : in qla2x00_reg_remote_port()
6151 ((fcport->port_type & FCT_NVME) ? "nvme" : "ini")); in qla2x00_reg_remote_port()
6163 * 0 - Success
6164 * BIT_0 - error
6174 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla2x00_update_fcport()
6178 __func__, fcport->port_name); in qla2x00_update_fcport()
6181 fcport->login_retry = vha->hw->login_retry_count; in qla2x00_update_fcport()
6182 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla2x00_update_fcport()
6184 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_update_fcport()
6185 fcport->deleted = 0; in qla2x00_update_fcport()
6186 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_update_fcport()
6188 if (vha->hw->current_topology == ISP_CFG_NL) in qla2x00_update_fcport()
6189 fcport->logout_on_delete = 0; in qla2x00_update_fcport()
6191 fcport->logout_on_delete = 1; in qla2x00_update_fcport()
6192 fcport->n2n_chip_reset = fcport->n2n_link_reset_cnt = 0; in qla2x00_update_fcport()
6194 if (fcport->tgt_link_down_time < fcport->dev_loss_tmo) { in qla2x00_update_fcport()
6195 fcport->tgt_short_link_down_cnt++; in qla2x00_update_fcport()
6196 fcport->tgt_link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; in qla2x00_update_fcport()
6199 switch (vha->hw->current_topology) { in qla2x00_update_fcport()
6202 fcport->keep_nport_handle = 1; in qla2x00_update_fcport()
6214 switch (vha->host->active_mode) { in qla2x00_update_fcport()
6219 if (!vha->vha_tgt.qla_tgt->tgt_stop && in qla2x00_update_fcport()
6220 !vha->vha_tgt.qla_tgt->tgt_stopped) in qla2x00_update_fcport()
6225 if (!vha->vha_tgt.qla_tgt->tgt_stop && in qla2x00_update_fcport()
6226 !vha->vha_tgt.qla_tgt->tgt_stopped) in qla2x00_update_fcport()
6233 if (NVME_TARGET(vha->hw, fcport)) in qla2x00_update_fcport()
6238 if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { in qla2x00_update_fcport()
6239 if (fcport->id_changed) { in qla2x00_update_fcport()
6240 fcport->id_changed = 0; in qla2x00_update_fcport()
6243 __func__, __LINE__, fcport->port_name, in qla2x00_update_fcport()
6244 vha->fcport_count); in qla2x00_update_fcport()
6249 __func__, __LINE__, fcport->port_name, in qla2x00_update_fcport()
6250 vha->fcport_count); in qla2x00_update_fcport()
6261 u32 rscn_gen = fcport->rscn_gen; in qla_register_fcport_fn()
6264 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla_register_fcport_fn()
6267 qla2x00_update_fcport(fcport->vha, fcport); in qla_register_fcport_fn()
6269 ql_dbg(ql_dbg_disc, fcport->vha, 0x911e, in qla_register_fcport_fn()
6271 rscn_gen, fcport->rscn_gen, fcport->next_disc_state); in qla_register_fcport_fn()
6273 if (rscn_gen != fcport->rscn_gen) { in qla_register_fcport_fn()
6275 switch (fcport->next_disc_state) { in qla_register_fcport_fn()
6281 qla2x00_post_async_adisc_work(fcport->vha, fcport, in qla_register_fcport_fn()
6308 struct qla_hw_data *ha = vha->hw; in qla2x00_configure_fabric()
6316 rval = qla2x00_get_port_name(vha, loop_id, vha->fabric_node_name, 1); in qla2x00_configure_fabric()
6321 vha->device_flags &= ~SWITCH_FOUND; in qla2x00_configure_fabric()
6324 vha->device_flags |= SWITCH_FOUND; in qla2x00_configure_fabric()
6326 rval = qla2x00_get_port_name(vha, loop_id, vha->fabric_port_name, 0); in qla2x00_configure_fabric()
6344 rval = ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff, in qla2x00_configure_fabric()
6350 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_configure_fabric()
6356 test_and_clear_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags)) in qla2x00_configure_fabric()
6359 if (test_and_clear_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags)) { in qla2x00_configure_fabric()
6363 "Register FC-4 TYPE failed.\n"); in qla2x00_configure_fabric()
6365 &vha->dpc_flags)) in qla2x00_configure_fabric()
6371 "Register FC-4 Features failed.\n"); in qla2x00_configure_fabric()
6373 &vha->dpc_flags)) in qla2x00_configure_fabric()
6376 if (vha->flags.nvme_enabled) { in qla2x00_configure_fabric()
6387 &vha->dpc_flags)) in qla2x00_configure_fabric()
6393 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_configure_fabric()
6402 * disconnected port might have re-connected and a brand new in qla2x00_configure_fabric()
6409 vha->scan.rscn_gen_end = atomic_read(&vha->rscn_gen); in qla2x00_configure_fabric()
6412 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla2x00_configure_fabric()
6413 fcport->scan_state = QLA_FCPORT_SCAN; in qla2x00_configure_fabric()
6421 if (!vha->nvme_local_port && vha->flags.nvme_enabled) in qla2x00_configure_fabric()
6456 struct qla_hw_data *ha = vha->hw; in qla2x00_find_all_fabric_devs()
6457 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_find_all_fabric_devs()
6463 if (!ha->swl) in qla2x00_find_all_fabric_devs()
6464 ha->swl = kcalloc(ha->max_fibre_devices, sizeof(sw_info_t), in qla2x00_find_all_fabric_devs()
6466 swl = ha->swl; in qla2x00_find_all_fabric_devs()
6472 memset(swl, 0, ha->max_fibre_devices * sizeof(sw_info_t)); in qla2x00_find_all_fabric_devs()
6475 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_find_all_fabric_devs()
6479 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_find_all_fabric_devs()
6483 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_find_all_fabric_devs()
6487 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_find_all_fabric_devs()
6491 /* If other queries succeeded probe for FC-4 type */ in qla2x00_find_all_fabric_devs()
6494 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_find_all_fabric_devs()
6507 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); in qla2x00_find_all_fabric_devs()
6513 loop_id = ha->min_external_loopid; in qla2x00_find_all_fabric_devs()
6514 for (; loop_id <= ha->max_loop_id; loop_id++) { in qla2x00_find_all_fabric_devs()
6518 if (ha->current_topology == ISP_CFG_FL && in qla2x00_find_all_fabric_devs()
6519 (atomic_read(&vha->loop_down_timer) || in qla2x00_find_all_fabric_devs()
6521 atomic_set(&vha->loop_down_timer, 0); in qla2x00_find_all_fabric_devs()
6522 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_find_all_fabric_devs()
6523 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2x00_find_all_fabric_devs()
6529 wrap.b24 = new_fcport->d_id.b24; in qla2x00_find_all_fabric_devs()
6531 new_fcport->d_id.b24 = swl[swl_idx].d_id.b24; in qla2x00_find_all_fabric_devs()
6532 memcpy(new_fcport->node_name, in qla2x00_find_all_fabric_devs()
6534 memcpy(new_fcport->port_name, in qla2x00_find_all_fabric_devs()
6536 memcpy(new_fcport->fabric_port_name, in qla2x00_find_all_fabric_devs()
6538 new_fcport->fp_speed = swl[swl_idx].fp_speed; in qla2x00_find_all_fabric_devs()
6539 new_fcport->fc4_type = swl[swl_idx].fc4_type; in qla2x00_find_all_fabric_devs()
6541 new_fcport->nvme_flag = 0; in qla2x00_find_all_fabric_devs()
6542 if (vha->flags.nvme_enabled && in qla2x00_find_all_fabric_devs()
6546 new_fcport->port_name); in qla2x00_find_all_fabric_devs()
6559 "SNS scan failed -- assuming " in qla2x00_find_all_fabric_devs()
6560 "zero-entry result.\n"); in qla2x00_find_all_fabric_devs()
6568 wrap.b24 = new_fcport->d_id.b24; in qla2x00_find_all_fabric_devs()
6570 } else if (new_fcport->d_id.b24 == wrap.b24) { in qla2x00_find_all_fabric_devs()
6573 new_fcport->d_id.b.domain, in qla2x00_find_all_fabric_devs()
6574 new_fcport->d_id.b.area, in qla2x00_find_all_fabric_devs()
6575 new_fcport->d_id.b.al_pa); in qla2x00_find_all_fabric_devs()
6580 if (new_fcport->d_id.b24 == base_vha->d_id.b24) in qla2x00_find_all_fabric_devs()
6584 if (qla2x00_is_a_vp_did(vha, new_fcport->d_id.b24)) in qla2x00_find_all_fabric_devs()
6588 if (((new_fcport->d_id.b24 & 0xffff00) == in qla2x00_find_all_fabric_devs()
6589 (vha->d_id.b24 & 0xffff00)) && ha->current_topology == in qla2x00_find_all_fabric_devs()
6594 if ((new_fcport->d_id.b.domain & 0xf0) == 0xf0) in qla2x00_find_all_fabric_devs()
6597 /* Bypass ports whose FCP-4 type is not FCP_SCSI */ in qla2x00_find_all_fabric_devs()
6599 (!(new_fcport->fc4_type & FS_FC4TYPE_FCP) && in qla2x00_find_all_fabric_devs()
6600 new_fcport->fc4_type != 0)) in qla2x00_find_all_fabric_devs()
6603 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_find_all_fabric_devs()
6607 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_find_all_fabric_devs()
6608 if (memcmp(new_fcport->port_name, fcport->port_name, in qla2x00_find_all_fabric_devs()
6612 fcport->scan_state = QLA_FCPORT_FOUND; in qla2x00_find_all_fabric_devs()
6617 memcpy(fcport->fabric_port_name, in qla2x00_find_all_fabric_devs()
6618 new_fcport->fabric_port_name, WWN_SIZE); in qla2x00_find_all_fabric_devs()
6619 fcport->fp_speed = new_fcport->fp_speed; in qla2x00_find_all_fabric_devs()
6625 if (fcport->d_id.b24 == new_fcport->d_id.b24 && in qla2x00_find_all_fabric_devs()
6626 (atomic_read(&fcport->state) == FCS_ONLINE || in qla2x00_find_all_fabric_devs()
6627 (vha->host->active_mode == MODE_TARGET))) { in qla2x00_find_all_fabric_devs()
6631 if (fcport->login_retry == 0) in qla2x00_find_all_fabric_devs()
6632 fcport->login_retry = in qla2x00_find_all_fabric_devs()
6633 vha->hw->login_retry_count; in qla2x00_find_all_fabric_devs()
6637 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) { in qla2x00_find_all_fabric_devs()
6638 fcport->d_id.b24 = new_fcport->d_id.b24; in qla2x00_find_all_fabric_devs()
6640 fcport->flags |= (FCF_FABRIC_DEVICE | in qla2x00_find_all_fabric_devs()
6653 " old %x:%x:%x (loop_id 0x%04x)-> new %x:%x:%x\n", in qla2x00_find_all_fabric_devs()
6654 fcport->port_name, in qla2x00_find_all_fabric_devs()
6655 fcport->d_id.b.domain, in qla2x00_find_all_fabric_devs()
6656 fcport->d_id.b.area, in qla2x00_find_all_fabric_devs()
6657 fcport->d_id.b.al_pa, in qla2x00_find_all_fabric_devs()
6658 fcport->loop_id, in qla2x00_find_all_fabric_devs()
6659 new_fcport->d_id.b.domain, in qla2x00_find_all_fabric_devs()
6660 new_fcport->d_id.b.area, in qla2x00_find_all_fabric_devs()
6661 new_fcport->d_id.b.al_pa); in qla2x00_find_all_fabric_devs()
6662 fcport->d_id.b24 = new_fcport->d_id.b24; in qla2x00_find_all_fabric_devs()
6666 fcport->d_id.b24 = new_fcport->d_id.b24; in qla2x00_find_all_fabric_devs()
6667 fcport->flags |= FCF_LOGIN_NEEDED; in qla2x00_find_all_fabric_devs()
6671 if (found && NVME_TARGET(vha->hw, fcport)) { in qla2x00_find_all_fabric_devs()
6672 if (fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_find_all_fabric_devs()
6674 vha->fcport_count--; in qla2x00_find_all_fabric_devs()
6675 fcport->login_succ = 0; in qla2x00_find_all_fabric_devs()
6680 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_find_all_fabric_devs()
6684 new_fcport->scan_state = QLA_FCPORT_FOUND; in qla2x00_find_all_fabric_devs()
6685 list_add_tail(&new_fcport->list, &vha->vp_fcports); in qla2x00_find_all_fabric_devs()
6687 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_find_all_fabric_devs()
6691 nxt_d_id.b24 = new_fcport->d_id.b24; in qla2x00_find_all_fabric_devs()
6698 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); in qla2x00_find_all_fabric_devs()
6699 new_fcport->d_id.b24 = nxt_d_id.b24; in qla2x00_find_all_fabric_devs()
6707 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_find_all_fabric_devs()
6708 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_find_all_fabric_devs()
6711 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) in qla2x00_find_all_fabric_devs()
6714 if (fcport->scan_state == QLA_FCPORT_SCAN) { in qla2x00_find_all_fabric_devs()
6717 atomic_read(&fcport->state) == FCS_ONLINE) { in qla2x00_find_all_fabric_devs()
6720 if (fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_find_all_fabric_devs()
6721 (fcport->flags & FCF_FCP2_DEVICE) == 0 && in qla2x00_find_all_fabric_devs()
6722 fcport->port_type != FCT_INITIATOR && in qla2x00_find_all_fabric_devs()
6723 fcport->port_type != FCT_BROADCAST) { in qla2x00_find_all_fabric_devs()
6727 fcport->port_name); in qla2x00_find_all_fabric_devs()
6734 if (fcport->scan_state == QLA_FCPORT_FOUND && in qla2x00_find_all_fabric_devs()
6735 (fcport->flags & FCF_LOGIN_NEEDED) != 0) in qla2x00_find_all_fabric_devs()
6746 int lid = NPH_MGMT_SERVER - vha->vp_idx; in qla2x00_reserve_mgmt_server_loop_id()
6748 struct qla_hw_data *ha = vha->hw; in qla2x00_reserve_mgmt_server_loop_id()
6750 if (vha->vp_idx == 0) { in qla2x00_reserve_mgmt_server_loop_id()
6751 set_bit(NPH_MGMT_SERVER, ha->loop_id_map); in qla2x00_reserve_mgmt_server_loop_id()
6756 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_reserve_mgmt_server_loop_id()
6757 for (; lid > 0; lid--) { in qla2x00_reserve_mgmt_server_loop_id()
6758 if (!test_bit(lid, vha->hw->loop_id_map)) { in qla2x00_reserve_mgmt_server_loop_id()
6759 set_bit(lid, vha->hw->loop_id_map); in qla2x00_reserve_mgmt_server_loop_id()
6764 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_reserve_mgmt_server_loop_id()
6778 * 0 - Login successfully
6779 * 1 - Login failed
6780 * 2 - Initiator device
6781 * 3 - Fatal error
6791 struct qla_hw_data *ha = vha->hw; in qla2x00_fabric_login()
6800 fcport->loop_id, fcport->d_id.b.domain, in qla2x00_fabric_login()
6801 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_fabric_login()
6804 rval = ha->isp_ops->fabric_login(vha, fcport->loop_id, in qla2x00_fabric_login()
6805 fcport->d_id.b.domain, fcport->d_id.b.area, in qla2x00_fabric_login()
6806 fcport->d_id.b.al_pa, mb, BIT_0); in qla2x00_fabric_login()
6819 tmp_loopid = fcport->loop_id; in qla2x00_fabric_login()
6820 fcport->loop_id = mb[1]; in qla2x00_fabric_login()
6823 "Fabric Login: port in use - next loop " in qla2x00_fabric_login()
6825 fcport->loop_id, fcport->d_id.b.domain, in qla2x00_fabric_login()
6826 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla2x00_fabric_login()
6840 *next_loopid = (fcport->loop_id + 1); in qla2x00_fabric_login()
6844 fcport->port_type = FCT_INITIATOR; in qla2x00_fabric_login()
6846 fcport->port_type = FCT_TARGET; in qla2x00_fabric_login()
6848 fcport->flags |= FCF_FCP2_DEVICE; in qla2x00_fabric_login()
6853 fcport->supported_classes |= FC_COS_CLASS2; in qla2x00_fabric_login()
6855 fcport->supported_classes |= FC_COS_CLASS3; in qla2x00_fabric_login()
6859 fcport->flags |= in qla2x00_fabric_login()
6869 fcport->loop_id++; in qla2x00_fabric_login()
6881 *next_loopid = fcport->loop_id; in qla2x00_fabric_login()
6882 ha->isp_ops->fabric_logout(vha, fcport->loop_id, in qla2x00_fabric_login()
6883 fcport->d_id.b.domain, fcport->d_id.b.area, in qla2x00_fabric_login()
6884 fcport->d_id.b.al_pa); in qla2x00_fabric_login()
6895 "jiffies=%lx.\n", mb[0], fcport->d_id.b.domain, in qla2x00_fabric_login()
6896 fcport->d_id.b.area, fcport->d_id.b.al_pa, in qla2x00_fabric_login()
6897 fcport->loop_id, jiffies); in qla2x00_fabric_login()
6899 *next_loopid = fcport->loop_id; in qla2x00_fabric_login()
6900 ha->isp_ops->fabric_logout(vha, fcport->loop_id, in qla2x00_fabric_login()
6901 fcport->d_id.b.domain, fcport->d_id.b.area, in qla2x00_fabric_login()
6902 fcport->d_id.b.al_pa); in qla2x00_fabric_login()
6904 fcport->login_retry = 0; in qla2x00_fabric_login()
6923 * 0 - Login successfully
6924 * 1 - Login failed
6925 * 3 - Fatal error
6963 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); in qla2x00_loop_resync()
6964 if (vha->flags.online) { in qla2x00_loop_resync()
6969 if (!IS_QLAFX00(vha->hw)) { in qla2x00_loop_resync()
6974 qla2x00_marker(vha, vha->hw->base_qpair, in qla2x00_loop_resync()
6976 vha->marker_needed = 0; in qla2x00_loop_resync()
6980 clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_loop_resync()
6982 if (IS_QLAFX00(vha->hw)) in qla2x00_loop_resync()
6987 wait_time--; in qla2x00_loop_resync()
6988 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_loop_resync()
6989 !(test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) in qla2x00_loop_resync()
6991 &vha->dpc_flags))); in qla2x00_loop_resync()
6995 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) in qla2x00_loop_resync()
7017 if (!test_and_set_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) { in qla2x00_perform_loop_resync()
7019 atomic_set(&ha->loop_down_timer, 0); in qla2x00_perform_loop_resync()
7020 if (!(ha->device_flags & DFLG_NO_CABLE)) { in qla2x00_perform_loop_resync()
7021 atomic_set(&ha->loop_state, LOOP_UP); in qla2x00_perform_loop_resync()
7022 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); in qla2x00_perform_loop_resync()
7023 set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags); in qla2x00_perform_loop_resync()
7024 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); in qla2x00_perform_loop_resync()
7028 atomic_set(&ha->loop_state, LOOP_DEAD); in qla2x00_perform_loop_resync()
7030 clear_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags); in qla2x00_perform_loop_resync()
7040 struct qla_hw_data *ha = vha->hw; in qla83xx_reset_ownership()
7061 (i != ha->portnum)) { in qla83xx_reset_ownership()
7071 ((i + 8) != ha->portnum)) { in qla83xx_reset_ownership()
7078 * Prepare drv-presence mask based on fcoe functions present. in qla83xx_reset_ownership()
7079 * However consider only valid physical fcoe function numbers (0-15). in qla83xx_reset_ownership()
7081 drv_presence_mask = ~((1 << (ha->portnum)) | in qla83xx_reset_ownership()
7086 * - No other protocol drivers present. in qla83xx_reset_ownership()
7087 * - This is the lowest among fcoe functions. */ in qla83xx_reset_ownership()
7089 (ha->portnum < fcoe_other_function)) { in qla83xx_reset_ownership()
7092 ha->flags.nic_core_reset_owner = 1; in qla83xx_reset_ownership()
7100 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_ack()
7105 drv_ack |= (1 << ha->portnum); in __qla83xx_set_drv_ack()
7116 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_ack()
7121 drv_ack &= ~(1 << ha->portnum); in __qla83xx_clear_drv_ack()
7128 /* Assumes idc-lock always held on entry */
7132 struct qla_hw_data *ha = vha->hw; in qla83xx_idc_audit()
7137 ha->idc_audit_ts = (jiffies_to_msecs(jiffies) / 1000); in qla83xx_idc_audit()
7138 idc_audit_reg = (ha->portnum) | in qla83xx_idc_audit()
7139 (IDC_AUDIT_TIMESTAMP << 7) | (ha->idc_audit_ts << 8); in qla83xx_idc_audit()
7144 duration_secs = ((jiffies_to_msecs(jiffies) - in qla83xx_idc_audit()
7145 jiffies_to_msecs(ha->idc_audit_ts)) / 1000); in qla83xx_idc_audit()
7146 idc_audit_reg = (ha->portnum) | in qla83xx_idc_audit()
7162 struct qla_hw_data *ha = vha->hw; in qla83xx_initiating_reset()
7168 "NIC Core reset has been disabled. idc-control=0x%x\n", in qla83xx_initiating_reset()
7173 /* Set NEED-RESET iff in READY state and we are the reset-owner */ in qla83xx_initiating_reset()
7175 if (ha->flags.nic_core_reset_owner && dev_state == QLA8XXX_DEV_READY) { in qla83xx_initiating_reset()
7185 /* Wait for IDC state change READY -> NEED_RESET */ in qla83xx_initiating_reset()
7194 /* Send IDC ack by writing to drv-ack register */ in qla83xx_initiating_reset()
7216 struct qla_hw_data *ha = vha->hw; in qla83xx_check_driver_presence()
7219 if (drv_presence & (1 << ha->portnum)) in qla83xx_check_driver_presence()
7229 struct qla_hw_data *ha = vha->hw; in qla83xx_nic_core_reset()
7234 if (vha->device_flags & DFLG_DEV_FAILED) { in qla83xx_nic_core_reset()
7245 ha->portnum); in qla83xx_nic_core_reset()
7255 * Perform reset if we are the reset-owner, in qla83xx_nic_core_reset()
7262 ha->flags.nic_core_hung = 0; in qla83xx_nic_core_reset()
7277 struct qla_hw_data *ha = vha->hw; in qla2xxx_mctp_dump()
7283 "This board is not MCTP capable\n"); in qla2xxx_mctp_dump()
7287 if (!ha->mctp_dump) { in qla2xxx_mctp_dump()
7288 ha->mctp_dump = dma_alloc_coherent(&ha->pdev->dev, in qla2xxx_mctp_dump()
7289 MCTP_DUMP_SIZE, &ha->mctp_dump_dma, GFP_KERNEL); in qla2xxx_mctp_dump()
7291 if (!ha->mctp_dump) { in qla2xxx_mctp_dump()
7293 "Failed to allocate memory for mctp dump\n"); in qla2xxx_mctp_dump()
7299 rval = qla2x00_dump_mctp_data(vha, ha->mctp_dump_dma, in qla2xxx_mctp_dump()
7303 "Failed to capture mctp dump\n"); in qla2xxx_mctp_dump()
7306 "Mctp dump capture for host (%ld/%p).\n", in qla2xxx_mctp_dump()
7307 vha->host_no, ha->mctp_dump); in qla2xxx_mctp_dump()
7308 ha->mctp_dumped = 1; in qla2xxx_mctp_dump()
7311 if (!ha->flags.nic_core_reset_hdlr_active && !ha->portnum) { in qla2xxx_mctp_dump()
7312 ha->flags.nic_core_reset_hdlr_active = 1; in qla2xxx_mctp_dump()
7321 ha->flags.nic_core_reset_hdlr_active = 0; in qla2xxx_mctp_dump()
7339 struct qla_hw_data *ha = vha->hw; in qla2x00_quiesce_io()
7344 "Quiescing I/O - ha=%p.\n", ha); in qla2x00_quiesce_io()
7346 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_quiesce_io()
7347 if (atomic_read(&vha->loop_state) != LOOP_DOWN) { in qla2x00_quiesce_io()
7348 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_quiesce_io()
7351 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_quiesce_io()
7352 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla2x00_quiesce_io()
7353 atomic_inc(&vp->vref_count); in qla2x00_quiesce_io()
7354 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_quiesce_io()
7358 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_quiesce_io()
7359 atomic_dec(&vp->vref_count); in qla2x00_quiesce_io()
7361 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_quiesce_io()
7363 if (!atomic_read(&vha->loop_down_timer)) in qla2x00_quiesce_io()
7364 atomic_set(&vha->loop_down_timer, in qla2x00_quiesce_io()
7375 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_isp_cleanup()
7385 vha->flags.online = 0; in qla2x00_abort_isp_cleanup()
7386 ha->flags.chip_reset_done = 0; in qla2x00_abort_isp_cleanup()
7387 clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2x00_abort_isp_cleanup()
7388 vha->qla_stats.total_isp_aborts++; in qla2x00_abort_isp_cleanup()
7391 "Performing ISP error recovery - ha=%p.\n", ha); in qla2x00_abort_isp_cleanup()
7393 ha->flags.purge_mbox = 1; in qla2x00_abort_isp_cleanup()
7399 ha->isp_ops->reset_chip(vha); in qla2x00_abort_isp_cleanup()
7401 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_abort_isp_cleanup()
7403 ha->flags.rida_fmt2 = 0; in qla2x00_abort_isp_cleanup()
7404 ha->flags.n2n_ae = 0; in qla2x00_abort_isp_cleanup()
7405 ha->flags.lip_ae = 0; in qla2x00_abort_isp_cleanup()
7406 ha->current_topology = 0; in qla2x00_abort_isp_cleanup()
7408 ha->flags.fw_init_done = 0; in qla2x00_abort_isp_cleanup()
7409 ha->chip_reset++; in qla2x00_abort_isp_cleanup()
7410 ha->base_qpair->chip_reset = ha->chip_reset; in qla2x00_abort_isp_cleanup()
7411 ha->base_qpair->cmd_cnt = ha->base_qpair->cmd_completion_cnt = 0; in qla2x00_abort_isp_cleanup()
7412 ha->base_qpair->prev_completion_cnt = 0; in qla2x00_abort_isp_cleanup()
7413 for (i = 0; i < ha->max_qpairs; i++) { in qla2x00_abort_isp_cleanup()
7414 if (ha->queue_pair_map[i]) { in qla2x00_abort_isp_cleanup()
7415 ha->queue_pair_map[i]->chip_reset = in qla2x00_abort_isp_cleanup()
7416 ha->base_qpair->chip_reset; in qla2x00_abort_isp_cleanup()
7417 ha->queue_pair_map[i]->cmd_cnt = in qla2x00_abort_isp_cleanup()
7418 ha->queue_pair_map[i]->cmd_completion_cnt = 0; in qla2x00_abort_isp_cleanup()
7419 ha->base_qpair->prev_completion_cnt = 0; in qla2x00_abort_isp_cleanup()
7424 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_abort_isp_cleanup()
7425 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags)) { in qla2x00_abort_isp_cleanup()
7426 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); in qla2x00_abort_isp_cleanup()
7427 complete(&ha->mbx_intr_comp); in qla2x00_abort_isp_cleanup()
7429 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_abort_isp_cleanup()
7432 while (atomic_read(&ha->num_pend_mbx_stage2) || in qla2x00_abort_isp_cleanup()
7433 atomic_read(&ha->num_pend_mbx_stage1)) { in qla2x00_abort_isp_cleanup()
7439 ha->flags.purge_mbox = 0; in qla2x00_abort_isp_cleanup()
7441 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_abort_isp_cleanup()
7442 if (atomic_read(&vha->loop_state) != LOOP_DOWN) { in qla2x00_abort_isp_cleanup()
7443 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_abort_isp_cleanup()
7446 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7447 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla2x00_abort_isp_cleanup()
7448 atomic_inc(&vp->vref_count); in qla2x00_abort_isp_cleanup()
7449 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7453 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7454 atomic_dec(&vp->vref_count); in qla2x00_abort_isp_cleanup()
7456 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7458 if (!atomic_read(&vha->loop_down_timer)) in qla2x00_abort_isp_cleanup()
7459 atomic_set(&vha->loop_down_timer, in qla2x00_abort_isp_cleanup()
7464 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_abort_isp_cleanup()
7465 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla2x00_abort_isp_cleanup()
7466 fcport->scan_state = 0; in qla2x00_abort_isp_cleanup()
7468 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7469 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla2x00_abort_isp_cleanup()
7470 atomic_inc(&vp->vref_count); in qla2x00_abort_isp_cleanup()
7471 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7473 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla2x00_abort_isp_cleanup()
7474 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla2x00_abort_isp_cleanup()
7476 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7477 atomic_dec(&vp->vref_count); in qla2x00_abort_isp_cleanup()
7479 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_abort_isp_cleanup()
7488 vha->flags.online = 0; in qla2x00_abort_isp_cleanup()
7511 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_isp()
7513 struct req_que *req = ha->req_q_map[0]; in qla2x00_abort_isp()
7517 if (vha->flags.online) { in qla2x00_abort_isp()
7520 vha->dport_status |= DPORT_DIAG_CHIP_RESET_IN_PROGRESS; in qla2x00_abort_isp()
7521 vha->dport_status &= ~DPORT_DIAG_IN_PROGRESS; in qla2x00_abort_isp()
7523 if (vha->hw->flags.port_isolated) in qla2x00_abort_isp()
7528 "ISP Abort - ISP reg disconnect, exiting.\n"); in qla2x00_abort_isp()
7532 if (test_and_clear_bit(ISP_ABORT_TO_ROM, &vha->dpc_flags)) { in qla2x00_abort_isp()
7533 ha->flags.chip_reset_done = 1; in qla2x00_abort_isp()
7534 vha->flags.online = 1; in qla2x00_abort_isp()
7536 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); in qla2x00_abort_isp()
7545 "Error while clearing DRV-Presence.\n"); in qla2x00_abort_isp()
7548 if (unlikely(pci_channel_offline(ha->pdev) && in qla2x00_abort_isp()
7549 ha->flags.pci_channel_io_perm_failure)) { in qla2x00_abort_isp()
7550 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); in qla2x00_abort_isp()
7555 switch (vha->qlini_mode) { in qla2x00_abort_isp()
7570 ha->isp_ops->get_flash_version(vha, req->ring); in qla2x00_abort_isp()
7574 "ISP Abort - ISP reg disconnect pre nvram config, exiting.\n"); in qla2x00_abort_isp()
7577 ha->isp_ops->nvram_config(vha); in qla2x00_abort_isp()
7581 "ISP Abort - ISP reg disconnect post nvmram config, exiting.\n"); in qla2x00_abort_isp()
7586 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_abort_isp()
7588 fcport->do_prli_nvme = 1; in qla2x00_abort_isp()
7590 fcport->do_prli_nvme = 0; in qla2x00_abort_isp()
7594 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_abort_isp()
7596 if (!atomic_read(&vha->loop_down_timer)) { in qla2x00_abort_isp()
7601 vha->marker_needed = 1; in qla2x00_abort_isp()
7604 vha->flags.online = 1; in qla2x00_abort_isp()
7606 ha->isp_ops->enable_intrs(ha); in qla2x00_abort_isp()
7608 ha->isp_abort_cnt = 0; in qla2x00_abort_isp()
7609 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); in qla2x00_abort_isp()
7615 vha->flags.online = 1; in qla2x00_abort_isp()
7616 if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { in qla2x00_abort_isp()
7617 if (ha->isp_abort_cnt == 0) { in qla2x00_abort_isp()
7619 "ISP error recover failed - " in qla2x00_abort_isp()
7626 vha->flags.online = 0; in qla2x00_abort_isp()
7628 &vha->dpc_flags); in qla2x00_abort_isp()
7631 ha->isp_abort_cnt--; in qla2x00_abort_isp()
7633 "ISP abort - retry remaining %d.\n", in qla2x00_abort_isp()
7634 ha->isp_abort_cnt); in qla2x00_abort_isp()
7638 ha->isp_abort_cnt = MAX_RETRIES_OF_ISP_ABORT; in qla2x00_abort_isp()
7640 "ISP error recovery - retrying (%d) " in qla2x00_abort_isp()
7641 "more times.\n", ha->isp_abort_cnt); in qla2x00_abort_isp()
7642 set_bit(ISP_ABORT_RETRY, &vha->dpc_flags); in qla2x00_abort_isp()
7649 if (vha->hw->flags.port_isolated) { in qla2x00_abort_isp()
7657 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_abort_isp()
7658 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla2x00_abort_isp()
7659 if (vp->vp_idx) { in qla2x00_abort_isp()
7660 atomic_inc(&vp->vref_count); in qla2x00_abort_isp()
7661 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_abort_isp()
7664 list_for_each_entry(fcport, &vp->vp_fcports, list) { in qla2x00_abort_isp()
7666 fcport->do_prli_nvme = 1; in qla2x00_abort_isp()
7668 fcport->do_prli_nvme = 0; in qla2x00_abort_isp()
7673 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_abort_isp()
7674 atomic_dec(&vp->vref_count); in qla2x00_abort_isp()
7677 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_abort_isp()
7684 "Error while setting DRV-Presence.\n"); in qla2x00_abort_isp()
7708 struct qla_hw_data *ha = vha->hw; in qla2x00_restart_isp()
7712 vha->flags.online = 0; in qla2x00_restart_isp()
7713 status = ha->isp_ops->chip_diag(vha); in qla2x00_restart_isp()
7725 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_restart_isp()
7726 ha->flags.chip_reset_done = 1; in qla2x00_restart_isp()
7734 return vha->device_flags & DFLG_NO_CABLE ? 0 : status; in qla2x00_restart_isp()
7738 qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL); in qla2x00_restart_isp()
7739 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2x00_restart_isp()
7749 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_init_queues()
7750 int ret = -1; in qla25xx_init_queues()
7753 for (i = 1; i < ha->max_rsp_queues; i++) { in qla25xx_init_queues()
7754 rsp = ha->rsp_q_map[i]; in qla25xx_init_queues()
7755 if (rsp && test_bit(i, ha->rsp_qid_map)) { in qla25xx_init_queues()
7756 rsp->options &= ~BIT_0; in qla25xx_init_queues()
7761 __func__, rsp->id); in qla25xx_init_queues()
7765 __func__, rsp->id); in qla25xx_init_queues()
7768 for (i = 1; i < ha->max_req_queues; i++) { in qla25xx_init_queues()
7769 req = ha->req_q_map[i]; in qla25xx_init_queues()
7770 if (req && test_bit(i, ha->req_qid_map)) { in qla25xx_init_queues()
7772 req->options &= ~BIT_0; in qla25xx_init_queues()
7777 __func__, req->id); in qla25xx_init_queues()
7781 __func__, req->id); in qla25xx_init_queues()
7798 struct qla_hw_data *ha = vha->hw; in qla2x00_reset_adapter()
7799 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_reset_adapter()
7801 vha->flags.online = 0; in qla2x00_reset_adapter()
7802 ha->isp_ops->disable_intrs(ha); in qla2x00_reset_adapter()
7804 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_reset_adapter()
7805 wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); in qla2x00_reset_adapter()
7806 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_adapter()
7807 wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); in qla2x00_reset_adapter()
7808 rd_reg_word(&reg->hccr); /* PCI Posting. */ in qla2x00_reset_adapter()
7809 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_reset_adapter()
7818 struct qla_hw_data *ha = vha->hw; in qla24xx_reset_adapter()
7819 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_reset_adapter()
7824 vha->flags.online = 0; in qla24xx_reset_adapter()
7825 ha->isp_ops->disable_intrs(ha); in qla24xx_reset_adapter()
7827 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_reset_adapter()
7828 wrt_reg_dword(&reg->hccr, HCCRX_SET_RISC_RESET); in qla24xx_reset_adapter()
7829 rd_reg_dword(&reg->hccr); in qla24xx_reset_adapter()
7830 wrt_reg_dword(&reg->hccr, HCCRX_REL_RISC_PAUSE); in qla24xx_reset_adapter()
7831 rd_reg_dword(&reg->hccr); in qla24xx_reset_adapter()
7832 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_reset_adapter()
7835 ha->isp_ops->enable_intrs(ha); in qla24xx_reset_adapter()
7847 struct qla_hw_data *ha = vha->hw; in qla24xx_nvram_wwn_from_ofw()
7848 struct pci_dev *pdev = ha->pdev; in qla24xx_nvram_wwn_from_ofw()
7853 val = of_get_property(dp, "port-wwn", &len); in qla24xx_nvram_wwn_from_ofw()
7855 memcpy(nv->port_name, val, WWN_SIZE); in qla24xx_nvram_wwn_from_ofw()
7857 val = of_get_property(dp, "node-wwn", &len); in qla24xx_nvram_wwn_from_ofw()
7859 memcpy(nv->node_name, val, WWN_SIZE); in qla24xx_nvram_wwn_from_ofw()
7873 struct qla_hw_data *ha = vha->hw; in qla24xx_nvram_config()
7876 icb = (struct init_cb_24xx *)ha->init_cb; in qla24xx_nvram_config()
7877 nv = ha->nvram; in qla24xx_nvram_config()
7880 if (ha->port_no == 0) { in qla24xx_nvram_config()
7881 ha->nvram_base = FA_NVRAM_FUNC0_ADDR; in qla24xx_nvram_config()
7882 ha->vpd_base = FA_NVRAM_VPD0_ADDR; in qla24xx_nvram_config()
7884 ha->nvram_base = FA_NVRAM_FUNC1_ADDR; in qla24xx_nvram_config()
7885 ha->vpd_base = FA_NVRAM_VPD1_ADDR; in qla24xx_nvram_config()
7888 ha->nvram_size = sizeof(*nv); in qla24xx_nvram_config()
7889 ha->vpd_size = FA_NVRAM_VPD_SIZE; in qla24xx_nvram_config()
7892 ha->vpd = ha->nvram + VPD_OFFSET; in qla24xx_nvram_config()
7893 ha->isp_ops->read_nvram(vha, ha->vpd, in qla24xx_nvram_config()
7894 ha->nvram_base - FA_NVRAM_FUNC0_ADDR, FA_NVRAM_VPD_SIZE * 4); in qla24xx_nvram_config()
7898 ha->isp_ops->read_nvram(vha, dptr, ha->nvram_base, ha->nvram_size); in qla24xx_nvram_config()
7899 for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++) in qla24xx_nvram_config()
7905 nv, ha->nvram_size); in qla24xx_nvram_config()
7908 if (chksum || memcmp("ISP ", nv->id, sizeof(nv->id)) || in qla24xx_nvram_config()
7909 le16_to_cpu(nv->nvram_version) < ICB_VERSION) { in qla24xx_nvram_config()
7913 chksum, nv->id, nv->nvram_version); in qla24xx_nvram_config()
7916 "Falling back to functioning (yet invalid -- WWPN) " in qla24xx_nvram_config()
7922 memset(nv, 0, ha->nvram_size); in qla24xx_nvram_config()
7923 nv->nvram_version = cpu_to_le16(ICB_VERSION); in qla24xx_nvram_config()
7924 nv->version = cpu_to_le16(ICB_VERSION); in qla24xx_nvram_config()
7925 nv->frame_payload_size = cpu_to_le16(2048); in qla24xx_nvram_config()
7926 nv->execution_throttle = cpu_to_le16(0xFFFF); in qla24xx_nvram_config()
7927 nv->exchange_count = cpu_to_le16(0); in qla24xx_nvram_config()
7928 nv->hard_address = cpu_to_le16(124); in qla24xx_nvram_config()
7929 nv->port_name[0] = 0x21; in qla24xx_nvram_config()
7930 nv->port_name[1] = 0x00 + ha->port_no + 1; in qla24xx_nvram_config()
7931 nv->port_name[2] = 0x00; in qla24xx_nvram_config()
7932 nv->port_name[3] = 0xe0; in qla24xx_nvram_config()
7933 nv->port_name[4] = 0x8b; in qla24xx_nvram_config()
7934 nv->port_name[5] = 0x1c; in qla24xx_nvram_config()
7935 nv->port_name[6] = 0x55; in qla24xx_nvram_config()
7936 nv->port_name[7] = 0x86; in qla24xx_nvram_config()
7937 nv->node_name[0] = 0x20; in qla24xx_nvram_config()
7938 nv->node_name[1] = 0x00; in qla24xx_nvram_config()
7939 nv->node_name[2] = 0x00; in qla24xx_nvram_config()
7940 nv->node_name[3] = 0xe0; in qla24xx_nvram_config()
7941 nv->node_name[4] = 0x8b; in qla24xx_nvram_config()
7942 nv->node_name[5] = 0x1c; in qla24xx_nvram_config()
7943 nv->node_name[6] = 0x55; in qla24xx_nvram_config()
7944 nv->node_name[7] = 0x86; in qla24xx_nvram_config()
7946 nv->login_retry_count = cpu_to_le16(8); in qla24xx_nvram_config()
7947 nv->interrupt_delay_timer = cpu_to_le16(0); in qla24xx_nvram_config()
7948 nv->login_timeout = cpu_to_le16(0); in qla24xx_nvram_config()
7949 nv->firmware_options_1 = in qla24xx_nvram_config()
7951 nv->firmware_options_2 = cpu_to_le32(2 << 4); in qla24xx_nvram_config()
7952 nv->firmware_options_2 |= cpu_to_le32(BIT_12); in qla24xx_nvram_config()
7953 nv->firmware_options_3 = cpu_to_le32(2 << 13); in qla24xx_nvram_config()
7954 nv->host_p = cpu_to_le32(BIT_11|BIT_10); in qla24xx_nvram_config()
7955 nv->efi_parameters = cpu_to_le32(0); in qla24xx_nvram_config()
7956 nv->reset_delay = 5; in qla24xx_nvram_config()
7957 nv->max_luns_per_target = cpu_to_le16(128); in qla24xx_nvram_config()
7958 nv->port_down_retry_count = cpu_to_le16(30); in qla24xx_nvram_config()
7959 nv->link_down_timeout = cpu_to_le16(30); in qla24xx_nvram_config()
7966 nv->firmware_options_1 &= cpu_to_le32(~BIT_13); in qla24xx_nvram_config()
7968 nv->host_p &= cpu_to_le32(~BIT_10); in qla24xx_nvram_config()
7974 memset(icb, 0, ha->init_cb_size); in qla24xx_nvram_config()
7978 dptr2 = (uint8_t *)&nv->version; in qla24xx_nvram_config()
7979 cnt = (uint8_t *)&icb->response_q_inpointer - (uint8_t *)&icb->version; in qla24xx_nvram_config()
7980 while (cnt--) in qla24xx_nvram_config()
7983 icb->login_retry_count = nv->login_retry_count; in qla24xx_nvram_config()
7984 icb->link_down_on_nos = nv->link_down_on_nos; in qla24xx_nvram_config()
7987 dptr1 = (uint8_t *)&icb->interrupt_delay_timer; in qla24xx_nvram_config()
7988 dptr2 = (uint8_t *)&nv->interrupt_delay_timer; in qla24xx_nvram_config()
7989 cnt = (uint8_t *)&icb->reserved_3 - in qla24xx_nvram_config()
7990 (uint8_t *)&icb->interrupt_delay_timer; in qla24xx_nvram_config()
7991 while (cnt--) in qla24xx_nvram_config()
7993 ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size); in qla24xx_nvram_config()
7997 qla2x00_set_model_info(vha, nv->model_name, sizeof(nv->model_name), in qla24xx_nvram_config()
8002 if (nv->host_p & cpu_to_le32(BIT_15)) { in qla24xx_nvram_config()
8004 memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE); in qla24xx_nvram_config()
8005 memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE); in qla24xx_nvram_config()
8009 if ((icb->firmware_options_1 & cpu_to_le32(BIT_14)) == 0) { in qla24xx_nvram_config()
8014 memcpy(icb->node_name, icb->port_name, WWN_SIZE); in qla24xx_nvram_config()
8015 icb->node_name[0] &= 0xF0; in qla24xx_nvram_config()
8019 ha->flags.disable_risc_code_load = 0; in qla24xx_nvram_config()
8020 ha->flags.enable_lip_reset = 0; in qla24xx_nvram_config()
8021 ha->flags.enable_lip_full_login = in qla24xx_nvram_config()
8022 le32_to_cpu(nv->host_p) & BIT_10 ? 1 : 0; in qla24xx_nvram_config()
8023 ha->flags.enable_target_reset = in qla24xx_nvram_config()
8024 le32_to_cpu(nv->host_p) & BIT_11 ? 1 : 0; in qla24xx_nvram_config()
8025 ha->flags.enable_led_scheme = 0; in qla24xx_nvram_config()
8026 ha->flags.disable_serdes = le32_to_cpu(nv->host_p) & BIT_5 ? 1 : 0; in qla24xx_nvram_config()
8028 ha->operating_mode = (le32_to_cpu(icb->firmware_options_2) & in qla24xx_nvram_config()
8031 memcpy(ha->fw_seriallink_options24, nv->seriallink_options, in qla24xx_nvram_config()
8032 sizeof(ha->fw_seriallink_options24)); in qla24xx_nvram_config()
8035 ha->serial0 = icb->port_name[5]; in qla24xx_nvram_config()
8036 ha->serial1 = icb->port_name[6]; in qla24xx_nvram_config()
8037 ha->serial2 = icb->port_name[7]; in qla24xx_nvram_config()
8038 memcpy(vha->node_name, icb->node_name, WWN_SIZE); in qla24xx_nvram_config()
8039 memcpy(vha->port_name, icb->port_name, WWN_SIZE); in qla24xx_nvram_config()
8041 icb->execution_throttle = cpu_to_le16(0xFFFF); in qla24xx_nvram_config()
8043 ha->retry_count = le16_to_cpu(nv->login_retry_count); in qla24xx_nvram_config()
8046 if (le16_to_cpu(nv->login_timeout) < ql2xlogintimeout) in qla24xx_nvram_config()
8047 nv->login_timeout = cpu_to_le16(ql2xlogintimeout); in qla24xx_nvram_config()
8048 if (le16_to_cpu(nv->login_timeout) < 4) in qla24xx_nvram_config()
8049 nv->login_timeout = cpu_to_le16(4); in qla24xx_nvram_config()
8050 ha->login_timeout = le16_to_cpu(nv->login_timeout); in qla24xx_nvram_config()
8053 ha->r_a_tov = 100; in qla24xx_nvram_config()
8055 ha->loop_reset_delay = nv->reset_delay; in qla24xx_nvram_config()
8067 if (le16_to_cpu(nv->link_down_timeout) == 0) { in qla24xx_nvram_config()
8068 ha->loop_down_abort_time = in qla24xx_nvram_config()
8069 (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); in qla24xx_nvram_config()
8071 ha->link_down_timeout = le16_to_cpu(nv->link_down_timeout); in qla24xx_nvram_config()
8072 ha->loop_down_abort_time = in qla24xx_nvram_config()
8073 (LOOP_DOWN_TIME - ha->link_down_timeout); in qla24xx_nvram_config()
8077 ha->port_down_retry_count = le16_to_cpu(nv->port_down_retry_count); in qla24xx_nvram_config()
8079 ha->port_down_retry_count = qlport_down_retry; in qla24xx_nvram_config()
8082 ha->login_retry_count = le16_to_cpu(nv->login_retry_count); in qla24xx_nvram_config()
8083 if (ha->port_down_retry_count == in qla24xx_nvram_config()
8084 le16_to_cpu(nv->port_down_retry_count) && in qla24xx_nvram_config()
8085 ha->port_down_retry_count > 3) in qla24xx_nvram_config()
8086 ha->login_retry_count = ha->port_down_retry_count; in qla24xx_nvram_config()
8087 else if (ha->port_down_retry_count > (int)ha->login_retry_count) in qla24xx_nvram_config()
8088 ha->login_retry_count = ha->port_down_retry_count; in qla24xx_nvram_config()
8090 ha->login_retry_count = ql2xloginretrycount; in qla24xx_nvram_config()
8093 icb->firmware_options_3 |= cpu_to_le32(BIT_8); in qla24xx_nvram_config()
8096 if (!vha->flags.init_done) { in qla24xx_nvram_config()
8097 ha->zio_mode = le32_to_cpu(icb->firmware_options_2) & in qla24xx_nvram_config()
8099 ha->zio_timer = le16_to_cpu(icb->interrupt_delay_timer) ? in qla24xx_nvram_config()
8100 le16_to_cpu(icb->interrupt_delay_timer) : 2; in qla24xx_nvram_config()
8102 icb->firmware_options_2 &= cpu_to_le32( in qla24xx_nvram_config()
8104 if (ha->zio_mode != QLA_ZIO_DISABLED) { in qla24xx_nvram_config()
8105 ha->zio_mode = QLA_ZIO_MODE_6; in qla24xx_nvram_config()
8109 ha->zio_mode, ha->zio_timer * 100); in qla24xx_nvram_config()
8111 icb->firmware_options_2 |= cpu_to_le32( in qla24xx_nvram_config()
8112 (uint32_t)ha->zio_mode); in qla24xx_nvram_config()
8113 icb->interrupt_delay_timer = cpu_to_le16(ha->zio_timer); in qla24xx_nvram_config()
8130 image_status->image_status_mask, in qla27xx_print_image()
8131 le16_to_cpu(image_status->generation), in qla27xx_print_image()
8132 image_status->ver_major, in qla27xx_print_image()
8133 image_status->ver_minor, in qla27xx_print_image()
8134 image_status->bitmap, in qla27xx_print_image()
8135 le32_to_cpu(image_status->checksum), in qla27xx_print_image()
8136 le32_to_cpu(image_status->signature)); in qla27xx_print_image()
8143 ulong signature = le32_to_cpu(image_status->signature); in qla28xx_check_aux_image_status_signature()
8151 ulong signature = le32_to_cpu(image_status->signature); in qla27xx_check_image_status_signature()
8165 for ( ; n--; p++) in qla27xx_image_status_checksum()
8174 return aux->bitmap & bitmask ? in qla28xx_component_bitmask()
8182 active_regions->aux.board_config = in qla28xx_component_status()
8185 active_regions->aux.vpd_nvram = in qla28xx_component_status()
8188 active_regions->aux.npiv_config_0_1 = in qla28xx_component_status()
8191 active_regions->aux.npiv_config_2_3 = in qla28xx_component_status()
8194 active_regions->aux.nvme_params = in qla28xx_component_status()
8205 le16_to_cpu(pri_image_status->generation) - in qla27xx_compare_image_generation()
8206 le16_to_cpu(sec_image_status->generation); in qla27xx_compare_image_generation()
8217 struct qla_hw_data *ha = vha->hw; in qla28xx_get_aux_images()
8223 if (!ha->flt_region_aux_img_status_pri) { in qla28xx_get_aux_images()
8229 ha->flt_region_aux_img_status_pri, in qla28xx_get_aux_images()
8260 if (!ha->flt_region_aux_img_status_sec) { in qla28xx_get_aux_images()
8267 ha->flt_region_aux_img_status_sec, in qla28xx_get_aux_images()
8317 active_regions->aux.board_config, in qla28xx_get_aux_images()
8318 active_regions->aux.vpd_nvram, in qla28xx_get_aux_images()
8319 active_regions->aux.npiv_config_0_1, in qla28xx_get_aux_images()
8320 active_regions->aux.npiv_config_2_3, in qla28xx_get_aux_images()
8321 active_regions->aux.nvme_params); in qla28xx_get_aux_images()
8328 struct qla_hw_data *ha = vha->hw; in qla27xx_get_active_image()
8334 if (!ha->flt_region_img_status_pri) { in qla27xx_get_active_image()
8340 ha->flt_region_img_status_pri, sizeof(pri_image_status) >> 2) != in qla27xx_get_active_image()
8369 if (!ha->flt_region_img_status_sec) { in qla27xx_get_active_image()
8375 ha->flt_region_img_status_sec, sizeof(sec_image_status) >> 2); in qla27xx_get_active_image()
8407 active_regions->global = QLA27XX_PRIMARY_IMAGE; in qla27xx_get_active_image()
8410 if (!active_regions->global || in qla27xx_get_active_image()
8413 active_regions->global = QLA27XX_SECONDARY_IMAGE; in qla27xx_get_active_image()
8418 active_regions->global == QLA27XX_DEFAULT_IMAGE ? in qla27xx_get_active_image()
8420 active_regions->global == QLA27XX_PRIMARY_IMAGE ? in qla27xx_get_active_image()
8422 active_regions->global == QLA27XX_SECONDARY_IMAGE ? in qla27xx_get_active_image()
8424 active_regions->global); in qla27xx_get_active_image()
8445 struct qla_hw_data *ha = vha->hw; in qla24xx_load_risc_flash()
8446 struct req_que *req = ha->req_q_map[0]; in qla24xx_load_risc_flash()
8447 struct fwdt *fwdt = ha->fwdt; in qla24xx_load_risc_flash()
8452 dcode = (uint32_t *)req->ring; in qla24xx_load_risc_flash()
8464 dcode = (uint32_t *)req->ring; in qla24xx_load_risc_flash()
8469 "-> Loading segment %u...\n", j); in qla24xx_load_risc_flash()
8473 "-> Unable to read segment addr + size .\n"); in qla24xx_load_risc_flash()
8483 dlen = ha->fw_transfer_size >> 2; in qla24xx_load_risc_flash()
8489 "-> Loading fragment %u: %#x <- %#x (%#lx dwords)...\n", in qla24xx_load_risc_flash()
8494 "-> Unable to read fragment(faddr %#x dlen %#lx).\n", in qla24xx_load_risc_flash()
8501 rval = qla2x00_load_ram(vha, req->dma, risc_addr, dlen); in qla24xx_load_risc_flash()
8504 "-> Failed load firmware fragment %u.\n", in qla24xx_load_risc_flash()
8511 risc_size -= dlen; in qla24xx_load_risc_flash()
8519 ql_dbg(ql_dbg_init, vha, 0x0160, "-> templates = %u\n", templates); in qla24xx_load_risc_flash()
8521 vfree(fwdt->template); in qla24xx_load_risc_flash()
8522 fwdt->template = NULL; in qla24xx_load_risc_flash()
8523 fwdt->length = 0; in qla24xx_load_risc_flash()
8525 dcode = (uint32_t *)req->ring; in qla24xx_load_risc_flash()
8530 "-> Unable to read template size.\n"); in qla24xx_load_risc_flash()
8536 "-> fwdt%u template array at %#x (%#x dwords)\n", in qla24xx_load_risc_flash()
8540 "-> fwdt%u failed to read array\n", j); in qla24xx_load_risc_flash()
8546 risc_size -= 8; in qla24xx_load_risc_flash()
8549 "-> fwdt%u template allocate template %#x words...\n", in qla24xx_load_risc_flash()
8551 fwdt->template = vmalloc_array(risc_size, sizeof(*dcode)); in qla24xx_load_risc_flash()
8552 if (!fwdt->template) { in qla24xx_load_risc_flash()
8554 "-> fwdt%u failed allocate template.\n", j); in qla24xx_load_risc_flash()
8558 dcode = fwdt->template; in qla24xx_load_risc_flash()
8563 "-> fwdt%u failed template validate (rval %x)\n", in qla24xx_load_risc_flash()
8570 "-> fwdt%u template size %#lx bytes (%#lx words)\n", in qla24xx_load_risc_flash()
8574 "-> fwdt%u template exceeds array (%-lu bytes)\n", in qla24xx_load_risc_flash()
8575 j, dlen - risc_size * sizeof(*dcode)); in qla24xx_load_risc_flash()
8579 fwdt->length = dlen; in qla24xx_load_risc_flash()
8581 "-> fwdt%u loaded template ok\n", j); in qla24xx_load_risc_flash()
8589 vfree(fwdt->template); in qla24xx_load_risc_flash()
8590 fwdt->template = NULL; in qla24xx_load_risc_flash()
8591 fwdt->length = 0; in qla24xx_load_risc_flash()
8607 struct qla_hw_data *ha = vha->hw; in qla2x00_load_risc()
8608 struct req_que *req = ha->req_q_map[0]; in qla2x00_load_risc()
8622 wcode = (uint16_t *)req->ring; in qla2x00_load_risc()
8624 fwcode = (__force __be16 *)blob->fw->data; in qla2x00_load_risc()
8628 if (blob->fw->size < 8 * sizeof(uint16_t)) { in qla2x00_load_risc()
8631 blob->fw->size); in qla2x00_load_risc()
8647 seg = blob->segs; in qla2x00_load_risc()
8655 if (blob->fw->size < fwclen) { in qla2x00_load_risc()
8658 "(%zd).\n", blob->fw->size); in qla2x00_load_risc()
8664 wlen = (uint16_t)(ha->fw_transfer_size >> 1); in qla2x00_load_risc()
8674 rval = qla2x00_load_ram(vha, req->dma, risc_addr, in qla2x00_load_risc()
8685 risc_size -= wlen; in qla2x00_load_risc()
8710 struct qla_hw_data *ha = vha->hw; in qla24xx_load_risc_blob()
8711 struct req_que *req = ha->req_q_map[0]; in qla24xx_load_risc_blob()
8712 struct fwdt *fwdt = ha->fwdt; in qla24xx_load_risc_blob()
8715 "-> FW: Loading via request-firmware.\n"); in qla24xx_load_risc_blob()
8720 "-> Firmware file not found.\n"); in qla24xx_load_risc_blob()
8725 fwcode = (__force __be32 *)blob->fw->data; in qla24xx_load_risc_blob()
8730 blob->fw->size); in qla24xx_load_risc_blob()
8737 dcode = (uint32_t *)req->ring; in qla24xx_load_risc_blob()
8742 "-> Loading segment %u...\n", j); in qla24xx_load_risc_blob()
8751 dlen = ha->fw_transfer_size >> 2; in qla24xx_load_risc_blob()
8757 "-> Loading fragment %u: %#x <- %#x (%#lx words)...\n", in qla24xx_load_risc_blob()
8759 (uint32_t)(fwcode - (typeof(fwcode))blob->fw->data), in qla24xx_load_risc_blob()
8765 rval = qla2x00_load_ram(vha, req->dma, risc_addr, dlen); in qla24xx_load_risc_blob()
8768 "-> Failed load firmware fragment %u.\n", in qla24xx_load_risc_blob()
8775 risc_size -= dlen; in qla24xx_load_risc_blob()
8783 ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates); in qla24xx_load_risc_blob()
8785 vfree(fwdt->template); in qla24xx_load_risc_blob()
8786 fwdt->template = NULL; in qla24xx_load_risc_blob()
8787 fwdt->length = 0; in qla24xx_load_risc_blob()
8791 "-> fwdt%u template array at %#x (%#x dwords)\n", in qla24xx_load_risc_blob()
8792 j, (uint32_t)((void *)fwcode - (void *)blob->fw->data), in qla24xx_load_risc_blob()
8796 "-> fwdt%u failed to read array\n", j); in qla24xx_load_risc_blob()
8802 risc_size -= 8; in qla24xx_load_risc_blob()
8805 "-> fwdt%u template allocate template %#x words...\n", in qla24xx_load_risc_blob()
8807 fwdt->template = vmalloc_array(risc_size, sizeof(*dcode)); in qla24xx_load_risc_blob()
8808 if (!fwdt->template) { in qla24xx_load_risc_blob()
8810 "-> fwdt%u failed allocate template.\n", j); in qla24xx_load_risc_blob()
8814 dcode = fwdt->template; in qla24xx_load_risc_blob()
8820 "-> fwdt%u failed template validate\n", j); in qla24xx_load_risc_blob()
8826 "-> fwdt%u template size %#lx bytes (%#lx words)\n", in qla24xx_load_risc_blob()
8830 "-> fwdt%u template exceeds array (%-lu bytes)\n", in qla24xx_load_risc_blob()
8831 j, dlen - risc_size * sizeof(*dcode)); in qla24xx_load_risc_blob()
8835 fwdt->length = dlen; in qla24xx_load_risc_blob()
8837 "-> fwdt%u loaded template ok\n", j); in qla24xx_load_risc_blob()
8845 vfree(fwdt->template); in qla24xx_load_risc_blob()
8846 fwdt->template = NULL; in qla24xx_load_risc_blob()
8847 fwdt->length = 0; in qla24xx_load_risc_blob()
8862 * 1) Firmware via request-firmware interface (.bin file). in qla24xx_load_risc()
8870 vha->hw->flt_region_fw); in qla24xx_load_risc()
8877 struct qla_hw_data *ha = vha->hw; in qla81xx_load_risc()
8885 * 2) Firmware via request-firmware interface (.bin file). in qla81xx_load_risc()
8886 * 3) Golden-Firmware residing in flash -- (limited operation). in qla81xx_load_risc()
8899 rval = qla24xx_load_risc_flash(vha, srisc_addr, ha->flt_region_fw_sec); in qla81xx_load_risc()
8906 rval = qla24xx_load_risc_flash(vha, srisc_addr, ha->flt_region_fw); in qla81xx_load_risc()
8912 if (!rval || !ha->flt_region_gold_fw) in qla81xx_load_risc()
8917 rval = qla24xx_load_risc_flash(vha, srisc_addr, ha->flt_region_gold_fw); in qla81xx_load_risc()
8922 ha->flags.running_gold_fw = 1; in qla81xx_load_risc()
8930 struct qla_hw_data *ha = vha->hw; in qla2x00_try_to_stop_firmware()
8932 if (ha->flags.pci_channel_io_perm_failure) in qla2x00_try_to_stop_firmware()
8936 if (!ha->fw_major_version) in qla2x00_try_to_stop_firmware()
8938 if (!ha->flags.fw_started) in qla2x00_try_to_stop_firmware()
8943 ret != QLA_INVALID_COMMAND && retries ; retries--) { in qla2x00_try_to_stop_firmware()
8944 ha->isp_ops->reset_chip(vha); in qla2x00_try_to_stop_firmware()
8945 if (ha->isp_ops->chip_diag(vha) != QLA_SUCCESS) in qla2x00_try_to_stop_firmware()
8950 "Attempting retry of stop-firmware command.\n"); in qla2x00_try_to_stop_firmware()
8955 ha->flags.fw_init_done = 0; in qla2x00_try_to_stop_firmware()
8964 struct qla_hw_data *ha = vha->hw; in qla24xx_configure_vhba()
8965 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla24xx_configure_vhba()
8967 if (!vha->vp_idx) in qla24xx_configure_vhba()
8968 return -EINVAL; in qla24xx_configure_vhba()
8973 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla24xx_configure_vhba()
8974 qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL); in qla24xx_configure_vhba()
8977 vha->flags.management_server_logged_in = 0; in qla24xx_configure_vhba()
8980 rval2 = ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb, in qla24xx_configure_vhba()
8995 atomic_set(&vha->loop_down_timer, 0); in qla24xx_configure_vhba()
8996 atomic_set(&vha->loop_state, LOOP_UP); in qla24xx_configure_vhba()
8997 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla24xx_configure_vhba()
8998 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla24xx_configure_vhba()
9013 struct qla_hw_data *ha = vha->hw; in qla84xx_get_chip()
9019 if (cs84xx->bus == ha->pdev->bus) { in qla84xx_get_chip()
9020 kref_get(&cs84xx->kref); in qla84xx_get_chip()
9029 kref_init(&cs84xx->kref); in qla84xx_get_chip()
9030 spin_lock_init(&cs84xx->access_lock); in qla84xx_get_chip()
9031 mutex_init(&cs84xx->fw_update_mutex); in qla84xx_get_chip()
9032 cs84xx->bus = ha->pdev->bus; in qla84xx_get_chip()
9034 list_add_tail(&cs84xx->list, &qla_cs84xx_list); in qla84xx_get_chip()
9047 list_del(&cs84xx->list); in __qla84xx_chip_release()
9055 struct qla_hw_data *ha = vha->hw; in qla84xx_put_chip()
9057 if (ha->cs84xx) in qla84xx_put_chip()
9058 kref_put(&ha->cs84xx->kref, __qla84xx_chip_release); in qla84xx_put_chip()
9066 struct qla_hw_data *ha = vha->hw; in qla84xx_init_chip()
9068 mutex_lock(&ha->cs84xx->fw_update_mutex); in qla84xx_init_chip()
9072 mutex_unlock(&ha->cs84xx->fw_update_mutex); in qla84xx_init_chip()
9090 struct qla_hw_data *ha = vha->hw; in qla81xx_nvram_config()
9095 icb = (struct init_cb_81xx *)ha->init_cb; in qla81xx_nvram_config()
9096 nv = ha->nvram; in qla81xx_nvram_config()
9099 ha->nvram_size = sizeof(*nv); in qla81xx_nvram_config()
9100 ha->vpd_size = FA_NVRAM_VPD_SIZE; in qla81xx_nvram_config()
9102 ha->vpd_size = FA_VPD_SIZE_82XX; in qla81xx_nvram_config()
9108 ha->vpd = ha->nvram + VPD_OFFSET; in qla81xx_nvram_config()
9110 faddr = ha->flt_region_vpd; in qla81xx_nvram_config()
9113 faddr = ha->flt_region_vpd_sec; in qla81xx_nvram_config()
9119 ha->isp_ops->read_optrom(vha, ha->vpd, faddr << 2, ha->vpd_size); in qla81xx_nvram_config()
9122 faddr = ha->flt_region_nvram; in qla81xx_nvram_config()
9125 faddr = ha->flt_region_nvram_sec; in qla81xx_nvram_config()
9131 ha->isp_ops->read_optrom(vha, ha->nvram, faddr << 2, ha->nvram_size); in qla81xx_nvram_config()
9134 for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++) in qla81xx_nvram_config()
9140 nv, ha->nvram_size); in qla81xx_nvram_config()
9143 if (chksum || memcmp("ISP ", nv->id, sizeof(nv->id)) || in qla81xx_nvram_config()
9144 le16_to_cpu(nv->nvram_version) < ICB_VERSION) { in qla81xx_nvram_config()
9148 chksum, nv->id, le16_to_cpu(nv->nvram_version)); in qla81xx_nvram_config()
9151 "Falling back to functioning (yet invalid -- WWPN) " in qla81xx_nvram_config()
9157 memset(nv, 0, ha->nvram_size); in qla81xx_nvram_config()
9158 nv->nvram_version = cpu_to_le16(ICB_VERSION); in qla81xx_nvram_config()
9159 nv->version = cpu_to_le16(ICB_VERSION); in qla81xx_nvram_config()
9160 nv->frame_payload_size = cpu_to_le16(2048); in qla81xx_nvram_config()
9161 nv->execution_throttle = cpu_to_le16(0xFFFF); in qla81xx_nvram_config()
9162 nv->exchange_count = cpu_to_le16(0); in qla81xx_nvram_config()
9163 nv->port_name[0] = 0x21; in qla81xx_nvram_config()
9164 nv->port_name[1] = 0x00 + ha->port_no + 1; in qla81xx_nvram_config()
9165 nv->port_name[2] = 0x00; in qla81xx_nvram_config()
9166 nv->port_name[3] = 0xe0; in qla81xx_nvram_config()
9167 nv->port_name[4] = 0x8b; in qla81xx_nvram_config()
9168 nv->port_name[5] = 0x1c; in qla81xx_nvram_config()
9169 nv->port_name[6] = 0x55; in qla81xx_nvram_config()
9170 nv->port_name[7] = 0x86; in qla81xx_nvram_config()
9171 nv->node_name[0] = 0x20; in qla81xx_nvram_config()
9172 nv->node_name[1] = 0x00; in qla81xx_nvram_config()
9173 nv->node_name[2] = 0x00; in qla81xx_nvram_config()
9174 nv->node_name[3] = 0xe0; in qla81xx_nvram_config()
9175 nv->node_name[4] = 0x8b; in qla81xx_nvram_config()
9176 nv->node_name[5] = 0x1c; in qla81xx_nvram_config()
9177 nv->node_name[6] = 0x55; in qla81xx_nvram_config()
9178 nv->node_name[7] = 0x86; in qla81xx_nvram_config()
9179 nv->login_retry_count = cpu_to_le16(8); in qla81xx_nvram_config()
9180 nv->interrupt_delay_timer = cpu_to_le16(0); in qla81xx_nvram_config()
9181 nv->login_timeout = cpu_to_le16(0); in qla81xx_nvram_config()
9182 nv->firmware_options_1 = in qla81xx_nvram_config()
9184 nv->firmware_options_2 = cpu_to_le32(2 << 4); in qla81xx_nvram_config()
9185 nv->firmware_options_2 |= cpu_to_le32(BIT_12); in qla81xx_nvram_config()
9186 nv->firmware_options_3 = cpu_to_le32(2 << 13); in qla81xx_nvram_config()
9187 nv->host_p = cpu_to_le32(BIT_11|BIT_10); in qla81xx_nvram_config()
9188 nv->efi_parameters = cpu_to_le32(0); in qla81xx_nvram_config()
9189 nv->reset_delay = 5; in qla81xx_nvram_config()
9190 nv->max_luns_per_target = cpu_to_le16(128); in qla81xx_nvram_config()
9191 nv->port_down_retry_count = cpu_to_le16(30); in qla81xx_nvram_config()
9192 nv->link_down_timeout = cpu_to_le16(180); in qla81xx_nvram_config()
9193 nv->enode_mac[0] = 0x00; in qla81xx_nvram_config()
9194 nv->enode_mac[1] = 0xC0; in qla81xx_nvram_config()
9195 nv->enode_mac[2] = 0xDD; in qla81xx_nvram_config()
9196 nv->enode_mac[3] = 0x04; in qla81xx_nvram_config()
9197 nv->enode_mac[4] = 0x05; in qla81xx_nvram_config()
9198 nv->enode_mac[5] = 0x06 + ha->port_no + 1; in qla81xx_nvram_config()
9204 nv->frame_payload_size &= cpu_to_le16(~7); in qla81xx_nvram_config()
9209 memset(icb, 0, ha->init_cb_size); in qla81xx_nvram_config()
9213 dptr2 = (uint8_t *)&nv->version; in qla81xx_nvram_config()
9214 cnt = (uint8_t *)&icb->response_q_inpointer - (uint8_t *)&icb->version; in qla81xx_nvram_config()
9215 while (cnt--) in qla81xx_nvram_config()
9218 icb->login_retry_count = nv->login_retry_count; in qla81xx_nvram_config()
9221 dptr1 = (uint8_t *)&icb->interrupt_delay_timer; in qla81xx_nvram_config()
9222 dptr2 = (uint8_t *)&nv->interrupt_delay_timer; in qla81xx_nvram_config()
9223 cnt = (uint8_t *)&icb->reserved_5 - in qla81xx_nvram_config()
9224 (uint8_t *)&icb->interrupt_delay_timer; in qla81xx_nvram_config()
9225 while (cnt--) in qla81xx_nvram_config()
9228 memcpy(icb->enode_mac, nv->enode_mac, sizeof(icb->enode_mac)); in qla81xx_nvram_config()
9230 if (!memcmp(icb->enode_mac, "\0\0\0\0\0\0", sizeof(icb->enode_mac))) { in qla81xx_nvram_config()
9231 icb->enode_mac[0] = 0x00; in qla81xx_nvram_config()
9232 icb->enode_mac[1] = 0xC0; in qla81xx_nvram_config()
9233 icb->enode_mac[2] = 0xDD; in qla81xx_nvram_config()
9234 icb->enode_mac[3] = 0x04; in qla81xx_nvram_config()
9235 icb->enode_mac[4] = 0x05; in qla81xx_nvram_config()
9236 icb->enode_mac[5] = 0x06 + ha->port_no + 1; in qla81xx_nvram_config()
9239 /* Use extended-initialization control block. */ in qla81xx_nvram_config()
9240 memcpy(ha->ex_init_cb, &nv->ex_version, sizeof(*ha->ex_init_cb)); in qla81xx_nvram_config()
9241 ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size); in qla81xx_nvram_config()
9245 qla2x00_set_model_info(vha, nv->model_name, sizeof(nv->model_name), in qla81xx_nvram_config()
9251 if (nv->host_p & cpu_to_le32(BIT_15)) { in qla81xx_nvram_config()
9252 memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE); in qla81xx_nvram_config()
9253 memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE); in qla81xx_nvram_config()
9257 if ((icb->firmware_options_1 & cpu_to_le32(BIT_14)) == 0) { in qla81xx_nvram_config()
9262 memcpy(icb->node_name, icb->port_name, WWN_SIZE); in qla81xx_nvram_config()
9263 icb->node_name[0] &= 0xF0; in qla81xx_nvram_config()
9267 if ((nv->enhanced_features & BIT_7) == 0) in qla81xx_nvram_config()
9268 ha->flags.scm_supported_a = 1; in qla81xx_nvram_config()
9272 ha->flags.disable_risc_code_load = 0; in qla81xx_nvram_config()
9273 ha->flags.enable_lip_reset = 0; in qla81xx_nvram_config()
9274 ha->flags.enable_lip_full_login = in qla81xx_nvram_config()
9275 le32_to_cpu(nv->host_p) & BIT_10 ? 1 : 0; in qla81xx_nvram_config()
9276 ha->flags.enable_target_reset = in qla81xx_nvram_config()
9277 le32_to_cpu(nv->host_p) & BIT_11 ? 1 : 0; in qla81xx_nvram_config()
9278 ha->flags.enable_led_scheme = 0; in qla81xx_nvram_config()
9279 ha->flags.disable_serdes = le32_to_cpu(nv->host_p) & BIT_5 ? 1 : 0; in qla81xx_nvram_config()
9281 ha->operating_mode = (le32_to_cpu(icb->firmware_options_2) & in qla81xx_nvram_config()
9285 ha->serial0 = icb->port_name[5]; in qla81xx_nvram_config()
9286 ha->serial1 = icb->port_name[6]; in qla81xx_nvram_config()
9287 ha->serial2 = icb->port_name[7]; in qla81xx_nvram_config()
9288 memcpy(vha->node_name, icb->node_name, WWN_SIZE); in qla81xx_nvram_config()
9289 memcpy(vha->port_name, icb->port_name, WWN_SIZE); in qla81xx_nvram_config()
9291 icb->execution_throttle = cpu_to_le16(0xFFFF); in qla81xx_nvram_config()
9293 ha->retry_count = le16_to_cpu(nv->login_retry_count); in qla81xx_nvram_config()
9296 if (le16_to_cpu(nv->login_timeout) < ql2xlogintimeout) in qla81xx_nvram_config()
9297 nv->login_timeout = cpu_to_le16(ql2xlogintimeout); in qla81xx_nvram_config()
9298 if (le16_to_cpu(nv->login_timeout) < 4) in qla81xx_nvram_config()
9299 nv->login_timeout = cpu_to_le16(4); in qla81xx_nvram_config()
9300 ha->login_timeout = le16_to_cpu(nv->login_timeout); in qla81xx_nvram_config()
9303 ha->r_a_tov = 100; in qla81xx_nvram_config()
9305 ha->loop_reset_delay = nv->reset_delay; in qla81xx_nvram_config()
9317 if (le16_to_cpu(nv->link_down_timeout) == 0) { in qla81xx_nvram_config()
9318 ha->loop_down_abort_time = in qla81xx_nvram_config()
9319 (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); in qla81xx_nvram_config()
9321 ha->link_down_timeout = le16_to_cpu(nv->link_down_timeout); in qla81xx_nvram_config()
9322 ha->loop_down_abort_time = in qla81xx_nvram_config()
9323 (LOOP_DOWN_TIME - ha->link_down_timeout); in qla81xx_nvram_config()
9327 ha->port_down_retry_count = le16_to_cpu(nv->port_down_retry_count); in qla81xx_nvram_config()
9329 ha->port_down_retry_count = qlport_down_retry; in qla81xx_nvram_config()
9332 ha->login_retry_count = le16_to_cpu(nv->login_retry_count); in qla81xx_nvram_config()
9333 if (ha->port_down_retry_count == in qla81xx_nvram_config()
9334 le16_to_cpu(nv->port_down_retry_count) && in qla81xx_nvram_config()
9335 ha->port_down_retry_count > 3) in qla81xx_nvram_config()
9336 ha->login_retry_count = ha->port_down_retry_count; in qla81xx_nvram_config()
9337 else if (ha->port_down_retry_count > (int)ha->login_retry_count) in qla81xx_nvram_config()
9338 ha->login_retry_count = ha->port_down_retry_count; in qla81xx_nvram_config()
9340 ha->login_retry_count = ql2xloginretrycount; in qla81xx_nvram_config()
9342 /* if not running MSI-X we need handshaking on interrupts */ in qla81xx_nvram_config()
9343 if (!vha->hw->flags.msix_enabled && in qla81xx_nvram_config()
9345 icb->firmware_options_2 |= cpu_to_le32(BIT_22); in qla81xx_nvram_config()
9348 if (!vha->flags.init_done) { in qla81xx_nvram_config()
9349 ha->zio_mode = le32_to_cpu(icb->firmware_options_2) & in qla81xx_nvram_config()
9351 ha->zio_timer = le16_to_cpu(icb->interrupt_delay_timer) ? in qla81xx_nvram_config()
9352 le16_to_cpu(icb->interrupt_delay_timer) : 2; in qla81xx_nvram_config()
9354 icb->firmware_options_2 &= cpu_to_le32( in qla81xx_nvram_config()
9356 vha->flags.process_response_queue = 0; in qla81xx_nvram_config()
9357 if (ha->zio_mode != QLA_ZIO_DISABLED) { in qla81xx_nvram_config()
9358 ha->zio_mode = QLA_ZIO_MODE_6; in qla81xx_nvram_config()
9362 ha->zio_mode, in qla81xx_nvram_config()
9363 ha->zio_timer * 100); in qla81xx_nvram_config()
9365 icb->firmware_options_2 |= cpu_to_le32( in qla81xx_nvram_config()
9366 (uint32_t)ha->zio_mode); in qla81xx_nvram_config()
9367 icb->interrupt_delay_timer = cpu_to_le16(ha->zio_timer); in qla81xx_nvram_config()
9368 vha->flags.process_response_queue = 1; in qla81xx_nvram_config()
9372 icb->firmware_options_3 |= cpu_to_le32(BIT_0); in qla81xx_nvram_config()
9375 icb->firmware_options_3 |= cpu_to_le32(BIT_8); in qla81xx_nvram_config()
9378 ha->fc4_type_priority = qla2xxx_get_fc4_priority(vha); in qla81xx_nvram_config()
9391 struct qla_hw_data *ha = vha->hw; in qla82xx_restart_isp()
9397 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla82xx_restart_isp()
9398 ha->flags.chip_reset_done = 1; in qla82xx_restart_isp()
9403 qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL); in qla82xx_restart_isp()
9404 vha->flags.online = 1; in qla82xx_restart_isp()
9405 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla82xx_restart_isp()
9409 if ((vha->device_flags & DFLG_NO_CABLE)) in qla82xx_restart_isp()
9414 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla82xx_restart_isp()
9416 if (!atomic_read(&vha->loop_down_timer)) { in qla82xx_restart_isp()
9421 vha->marker_needed = 1; in qla82xx_restart_isp()
9424 ha->isp_ops->enable_intrs(ha); in qla82xx_restart_isp()
9426 ha->isp_abort_cnt = 0; in qla82xx_restart_isp()
9427 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); in qla82xx_restart_isp()
9432 if (ha->fce) { in qla82xx_restart_isp()
9433 ha->flags.fce_enabled = 1; in qla82xx_restart_isp()
9434 memset(ha->fce, 0, in qla82xx_restart_isp()
9435 fce_calc_size(ha->fce_bufs)); in qla82xx_restart_isp()
9437 ha->fce_dma, ha->fce_bufs, ha->fce_mb, in qla82xx_restart_isp()
9438 &ha->fce_bufs); in qla82xx_restart_isp()
9443 ha->flags.fce_enabled = 0; in qla82xx_restart_isp()
9447 if (ha->eft) { in qla82xx_restart_isp()
9448 memset(ha->eft, 0, EFT_SIZE); in qla82xx_restart_isp()
9450 ha->eft_dma, EFT_NUM_BUFFERS); in qla82xx_restart_isp()
9463 spin_lock_irqsave(&ha->vport_slock, flags); in qla82xx_restart_isp()
9464 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla82xx_restart_isp()
9465 if (vp->vp_idx) { in qla82xx_restart_isp()
9466 atomic_inc(&vp->vref_count); in qla82xx_restart_isp()
9467 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla82xx_restart_isp()
9471 spin_lock_irqsave(&ha->vport_slock, flags); in qla82xx_restart_isp()
9472 atomic_dec(&vp->vref_count); in qla82xx_restart_isp()
9475 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla82xx_restart_isp()
9497 * non-zero (if found)
9498 * -1 (if not found)
9512 struct qla_hw_data *ha = vha->hw; in qla24xx_get_fcp_prio()
9514 if (!ha->fcp_prio_cfg || !ha->flags.fcp_prio_enabled) in qla24xx_get_fcp_prio()
9515 return -1; in qla24xx_get_fcp_prio()
9517 priority = -1; in qla24xx_get_fcp_prio()
9518 entries = ha->fcp_prio_cfg->num_entries; in qla24xx_get_fcp_prio()
9519 pri_entry = &ha->fcp_prio_cfg->entry[0]; in qla24xx_get_fcp_prio()
9524 if (!(pri_entry->flags & FCP_PRIO_ENTRY_VALID)) { in qla24xx_get_fcp_prio()
9530 if (pri_entry->flags & FCP_PRIO_ENTRY_SPID_VALID) { in qla24xx_get_fcp_prio()
9531 pid1 = pri_entry->src_pid & INVALID_PORT_ID; in qla24xx_get_fcp_prio()
9532 pid2 = vha->d_id.b24 & INVALID_PORT_ID; in qla24xx_get_fcp_prio()
9540 if (pri_entry->flags & FCP_PRIO_ENTRY_DPID_VALID) { in qla24xx_get_fcp_prio()
9541 pid1 = pri_entry->dst_pid & INVALID_PORT_ID; in qla24xx_get_fcp_prio()
9542 pid2 = fcport->d_id.b24 & INVALID_PORT_ID; in qla24xx_get_fcp_prio()
9550 if (pri_entry->flags & FCP_PRIO_ENTRY_SWWN_VALID) { in qla24xx_get_fcp_prio()
9551 wwn1 = wwn_to_u64(vha->port_name); in qla24xx_get_fcp_prio()
9552 wwn2 = wwn_to_u64(pri_entry->src_wwpn); in qla24xx_get_fcp_prio()
9553 if (wwn2 == (uint64_t)-1) in qla24xx_get_fcp_prio()
9560 if (pri_entry->flags & FCP_PRIO_ENTRY_DWWN_VALID) { in qla24xx_get_fcp_prio()
9561 wwn1 = wwn_to_u64(fcport->port_name); in qla24xx_get_fcp_prio()
9562 wwn2 = wwn_to_u64(pri_entry->dst_wwpn); in qla24xx_get_fcp_prio()
9563 if (wwn2 == (uint64_t)-1) in qla24xx_get_fcp_prio()
9571 if (pri_entry->flags & FCP_PRIO_ENTRY_TAG_VALID) in qla24xx_get_fcp_prio()
9572 priority = pri_entry->tag; in qla24xx_get_fcp_prio()
9603 if (fcport->port_type != FCT_TARGET || in qla24xx_update_fcport_fcp_prio()
9604 fcport->loop_id == FC_NO_LOOP_ID) in qla24xx_update_fcport_fcp_prio()
9611 if (IS_P3P_TYPE(vha->hw)) { in qla24xx_update_fcport_fcp_prio()
9612 fcport->fcp_prio = priority & 0xf; in qla24xx_update_fcport_fcp_prio()
9616 ret = qla24xx_set_fcp_prio(vha, fcport->loop_id, priority, mb); in qla24xx_update_fcport_fcp_prio()
9618 if (fcport->fcp_prio != priority) in qla24xx_update_fcport_fcp_prio()
9620 "Updated FCP_CMND priority - value=%d loop_id=%d " in qla24xx_update_fcport_fcp_prio()
9622 fcport->loop_id, fcport->d_id.b.domain, in qla24xx_update_fcport_fcp_prio()
9623 fcport->d_id.b.area, fcport->d_id.b.al_pa); in qla24xx_update_fcport_fcp_prio()
9624 fcport->fcp_prio = priority & 0xf; in qla24xx_update_fcport_fcp_prio()
9627 "Unable to update FCP_CMND priority - ret=0x%x for " in qla24xx_update_fcport_fcp_prio()
9628 "loop_id=%d port_id=%02x%02x%02x.\n", ret, fcport->loop_id, in qla24xx_update_fcport_fcp_prio()
9629 fcport->d_id.b.domain, fcport->d_id.b.area, in qla24xx_update_fcport_fcp_prio()
9630 fcport->d_id.b.al_pa); in qla24xx_update_fcport_fcp_prio()
9655 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla24xx_update_all_fcp_prio()
9667 struct qla_hw_data *ha = vha->hw; in qla2xxx_create_qpair()
9672 if (!(ha->fw_attributes & BIT_6) || !ha->flags.msix_enabled) { in qla2xxx_create_qpair()
9674 "FW/Driver is not multi-queue capable.\n"); in qla2xxx_create_qpair()
9686 qpair->hw = vha->hw; in qla2xxx_create_qpair()
9687 qpair->vha = vha; in qla2xxx_create_qpair()
9688 qpair->qp_lock_ptr = &qpair->qp_lock; in qla2xxx_create_qpair()
9689 spin_lock_init(&qpair->qp_lock); in qla2xxx_create_qpair()
9690 qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla2xxx_create_qpair()
9693 mutex_lock(&ha->mq_lock); in qla2xxx_create_qpair()
9694 qpair_id = find_first_zero_bit(ha->qpair_qid_map, ha->max_qpairs); in qla2xxx_create_qpair()
9695 if (ha->num_qpairs >= ha->max_qpairs) { in qla2xxx_create_qpair()
9696 mutex_unlock(&ha->mq_lock); in qla2xxx_create_qpair()
9701 ha->num_qpairs++; in qla2xxx_create_qpair()
9702 set_bit(qpair_id, ha->qpair_qid_map); in qla2xxx_create_qpair()
9703 ha->queue_pair_map[qpair_id] = qpair; in qla2xxx_create_qpair()
9704 qpair->id = qpair_id; in qla2xxx_create_qpair()
9705 qpair->vp_idx = vp_idx; in qla2xxx_create_qpair()
9706 qpair->fw_started = ha->flags.fw_started; in qla2xxx_create_qpair()
9707 INIT_LIST_HEAD(&qpair->hints_list); in qla2xxx_create_qpair()
9708 INIT_LIST_HEAD(&qpair->dsd_list); in qla2xxx_create_qpair()
9709 qpair->chip_reset = ha->base_qpair->chip_reset; in qla2xxx_create_qpair()
9710 qpair->enable_class_2 = ha->base_qpair->enable_class_2; in qla2xxx_create_qpair()
9711 qpair->enable_explicit_conf = in qla2xxx_create_qpair()
9712 ha->base_qpair->enable_explicit_conf; in qla2xxx_create_qpair()
9714 for (i = 0; i < ha->msix_count; i++) { in qla2xxx_create_qpair()
9715 msix = &ha->msix_entries[i]; in qla2xxx_create_qpair()
9716 if (msix->in_use) in qla2xxx_create_qpair()
9718 qpair->msix = msix; in qla2xxx_create_qpair()
9720 "Vector %x selected for qpair\n", msix->vector); in qla2xxx_create_qpair()
9723 if (!qpair->msix) { in qla2xxx_create_qpair()
9725 "Out of MSI-X vectors!.\n"); in qla2xxx_create_qpair()
9729 qpair->msix->in_use = 1; in qla2xxx_create_qpair()
9730 list_add_tail(&qpair->qp_list_elem, &vha->qp_list); in qla2xxx_create_qpair()
9731 qpair->pdev = ha->pdev; in qla2xxx_create_qpair()
9733 qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla2xxx_create_qpair()
9735 mutex_unlock(&ha->mq_lock); in qla2xxx_create_qpair()
9745 qpair->rsp = ha->rsp_q_map[rsp_id]; in qla2xxx_create_qpair()
9756 qpair->req = ha->req_q_map[req_id]; in qla2xxx_create_qpair()
9757 qpair->rsp->req = qpair->req; in qla2xxx_create_qpair()
9758 qpair->rsp->qpair = qpair; in qla2xxx_create_qpair()
9760 if (!qpair->cpu_mapped) in qla2xxx_create_qpair()
9764 if (ha->fw_attributes & BIT_4) in qla2xxx_create_qpair()
9765 qpair->difdix_supported = 1; in qla2xxx_create_qpair()
9768 qpair->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2xxx_create_qpair()
9769 if (!qpair->srb_mempool) { in qla2xxx_create_qpair()
9772 qpair->id); in qla2xxx_create_qpair()
9779 qpair->id); in qla2xxx_create_qpair()
9784 qpair->online = 1; in qla2xxx_create_qpair()
9786 if (!vha->flags.qpairs_available) in qla2xxx_create_qpair()
9787 vha->flags.qpairs_available = 1; in qla2xxx_create_qpair()
9791 qpair->id); in qla2xxx_create_qpair()
9794 qpair->id); in qla2xxx_create_qpair()
9799 mempool_destroy(qpair->srb_mempool); in qla2xxx_create_qpair()
9801 qla25xx_delete_req_que(vha, qpair->req); in qla2xxx_create_qpair()
9803 qla25xx_delete_rsp_que(vha, qpair->rsp); in qla2xxx_create_qpair()
9805 mutex_lock(&ha->mq_lock); in qla2xxx_create_qpair()
9806 qpair->msix->in_use = 0; in qla2xxx_create_qpair()
9807 list_del(&qpair->qp_list_elem); in qla2xxx_create_qpair()
9808 if (list_empty(&vha->qp_list)) in qla2xxx_create_qpair()
9809 vha->flags.qpairs_available = 0; in qla2xxx_create_qpair()
9811 ha->queue_pair_map[qpair_id] = NULL; in qla2xxx_create_qpair()
9812 clear_bit(qpair_id, ha->qpair_qid_map); in qla2xxx_create_qpair()
9813 ha->num_qpairs--; in qla2xxx_create_qpair()
9814 mutex_unlock(&ha->mq_lock); in qla2xxx_create_qpair()
9823 struct qla_hw_data *ha = qpair->hw; in qla2xxx_delete_qpair()
9825 qpair->delete_in_progress = 1; in qla2xxx_delete_qpair()
9829 ret = qla25xx_delete_req_que(vha, qpair->req); in qla2xxx_delete_qpair()
9833 ret = qla25xx_delete_rsp_que(vha, qpair->rsp); in qla2xxx_delete_qpair()
9837 if (!list_empty(&qpair->dsd_list)) { in qla2xxx_delete_qpair()
9842 &qpair->dsd_list, list) { in qla2xxx_delete_qpair()
9843 dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, in qla2xxx_delete_qpair()
9844 dsd_ptr->dsd_list_dma); in qla2xxx_delete_qpair()
9845 list_del(&dsd_ptr->list); in qla2xxx_delete_qpair()
9850 mutex_lock(&ha->mq_lock); in qla2xxx_delete_qpair()
9851 ha->queue_pair_map[qpair->id] = NULL; in qla2xxx_delete_qpair()
9852 clear_bit(qpair->id, ha->qpair_qid_map); in qla2xxx_delete_qpair()
9853 ha->num_qpairs--; in qla2xxx_delete_qpair()
9854 list_del(&qpair->qp_list_elem); in qla2xxx_delete_qpair()
9855 if (list_empty(&vha->qp_list)) { in qla2xxx_delete_qpair()
9856 vha->flags.qpairs_available = 0; in qla2xxx_delete_qpair()
9857 vha->flags.qpairs_req_created = 0; in qla2xxx_delete_qpair()
9858 vha->flags.qpairs_rsp_created = 0; in qla2xxx_delete_qpair()
9860 mempool_destroy(qpair->srb_mempool); in qla2xxx_delete_qpair()
9862 mutex_unlock(&ha->mq_lock); in qla2xxx_delete_qpair()
9876 num &= (num - 1); in qla2x00_count_set_bits()
9891 list_for_each_entry_safe(f, tf, &vha->vp_fcports, list) { in qla2x00_get_num_tgts()
9892 if (f->port_type != FCT_TARGET) in qla2x00_get_num_tgts()
9906 vha->hw_err_cnt = 0; in qla2xxx_reset_stats()
9908 vha->short_link_down_cnt = 0; in qla2xxx_reset_stats()
9910 vha->interface_err_cnt = 0; in qla2xxx_reset_stats()
9912 vha->cmd_timeout_cnt = 0; in qla2xxx_reset_stats()
9914 vha->reset_cmd_err_cnt = 0; in qla2xxx_reset_stats()
9916 spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); in qla2xxx_reset_stats()
9917 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2xxx_reset_stats()
9918 fcport->tgt_short_link_down_cnt = 0; in qla2xxx_reset_stats()
9919 fcport->tgt_link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; in qla2xxx_reset_stats()
9921 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, int_flags); in qla2xxx_reset_stats()
9923 vha->link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; in qla2xxx_reset_stats()
9942 struct ql_vnd_stats *rsp_data = &resp->stats; in qla2xxx_get_ini_stats()
9963 rsp_data->entry_count = entry_count; in qla2xxx_get_ini_stats()
9967 rsp_data->entry[i].stat_type = QLA2XX_HW_ERROR; in qla2xxx_get_ini_stats()
9968 rsp_data->entry[i].tgt_num = 0x0; in qla2xxx_get_ini_stats()
9969 rsp_data->entry[i].cnt = vha->hw_err_cnt; in qla2xxx_get_ini_stats()
9974 rsp_data->entry[i].stat_type = QLA2XX_SHT_LNK_DWN; in qla2xxx_get_ini_stats()
9975 rsp_data->entry[i].tgt_num = 0x0; in qla2xxx_get_ini_stats()
9976 rsp_data->entry[i].cnt = vha->short_link_down_cnt; in qla2xxx_get_ini_stats()
9981 rsp_data->entry[i].stat_type = QLA2XX_INT_ERR; in qla2xxx_get_ini_stats()
9982 rsp_data->entry[i].tgt_num = 0x0; in qla2xxx_get_ini_stats()
9983 rsp_data->entry[i].cnt = vha->interface_err_cnt; in qla2xxx_get_ini_stats()
9988 rsp_data->entry[i].stat_type = QLA2XX_CMD_TIMEOUT; in qla2xxx_get_ini_stats()
9989 rsp_data->entry[i].tgt_num = 0x0; in qla2xxx_get_ini_stats()
9990 rsp_data->entry[i].cnt = vha->cmd_timeout_cnt; in qla2xxx_get_ini_stats()
9995 rsp_data->entry[i].stat_type = QLA2XX_RESET_CMD_ERR; in qla2xxx_get_ini_stats()
9996 rsp_data->entry[i].tgt_num = 0x0; in qla2xxx_get_ini_stats()
9997 rsp_data->entry[i].cnt = vha->reset_cmd_err_cnt; in qla2xxx_get_ini_stats()
10005 spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); in qla2xxx_get_ini_stats()
10006 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2xxx_get_ini_stats()
10007 if (fcport->port_type != FCT_TARGET) in qla2xxx_get_ini_stats()
10009 if (!fcport->rport) in qla2xxx_get_ini_stats()
10011 rsp_data->entry[i].stat_type = QLA2XX_TGT_SHT_LNK_DOWN; in qla2xxx_get_ini_stats()
10012 rsp_data->entry[i].tgt_num = fcport->rport->number; in qla2xxx_get_ini_stats()
10013 rsp_data->entry[i].cnt = fcport->tgt_short_link_down_cnt; in qla2xxx_get_ini_stats()
10016 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, int_flags); in qla2xxx_get_ini_stats()
10018 resp->status = EXT_STATUS_OK; in qla2xxx_get_ini_stats()
10027 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_get_tgt_stats()
10029 tgt_data->status = 0; in qla2xxx_get_tgt_stats()
10030 tgt_data->stats.entry_count = 1; in qla2xxx_get_tgt_stats()
10031 tgt_data->stats.entry[0].stat_type = flags; in qla2xxx_get_tgt_stats()
10032 tgt_data->stats.entry[0].tgt_num = rport->number; in qla2xxx_get_tgt_stats()
10033 tgt_data->stats.entry[0].cnt = fcport->tgt_short_link_down_cnt; in qla2xxx_get_tgt_stats()
10042 vha->hw->flags.port_isolated = 1; in qla2xxx_disable_port()
10044 if (qla2x00_isp_reg_stat(vha->hw)) { in qla2xxx_disable_port()
10053 if (vha->flags.online) { in qla2xxx_disable_port()
10065 if (qla2x00_isp_reg_stat(vha->hw)) { in qla2xxx_enable_port()
10072 vha->hw->flags.port_isolated = 0; in qla2xxx_enable_port()
10074 vha->flags.online = 1; in qla2xxx_enable_port()
10075 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla2xxx_enable_port()