Deleted Added
full compact
isp_freebsd.c (331722) isp_freebsd.c (347894)
1/*-
2 * Copyright (c) 2009-2017 Alexander Motin <mav@FreeBSD.org>
3 * Copyright (c) 1997-2009 by Matthew Jacob
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28/*
29 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
30 */
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009-2017 Alexander Motin <mav@FreeBSD.org>
3 * Copyright (c) 1997-2009 by Matthew Jacob
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28/*
29 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
30 */
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_freebsd.c 331722 2018-03-29 02:50:57Z eadler $");
32__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_freebsd.c 347894 2019-05-16 22:03:25Z ken $");
33
34#include <dev/isp/isp_freebsd.h>
35#include <sys/unistd.h>
36#include <sys/kthread.h>
37#include <sys/conf.h>
38#include <sys/module.h>
39#include <sys/ioccom.h>
40#include <dev/isp/isp_ioctl.h>

--- 3694 unchanged lines hidden (view full) ---

3735 adc->port = lp->portid;
3736 adc->target = tgt;
3737 adc->arrived = 1;
3738 xpt_async(AC_CONTRACT, fc->path, &ac);
3739 }
3740 break;
3741 case ISPASYNC_DEV_CHANGED:
3742 case ISPASYNC_DEV_STAYED:
33
34#include <dev/isp/isp_freebsd.h>
35#include <sys/unistd.h>
36#include <sys/kthread.h>
37#include <sys/conf.h>
38#include <sys/module.h>
39#include <sys/ioccom.h>
40#include <dev/isp/isp_ioctl.h>

--- 3694 unchanged lines hidden (view full) ---

3735 adc->port = lp->portid;
3736 adc->target = tgt;
3737 adc->arrived = 1;
3738 xpt_async(AC_CONTRACT, fc->path, &ac);
3739 }
3740 break;
3741 case ISPASYNC_DEV_CHANGED:
3742 case ISPASYNC_DEV_STAYED:
3743 {
3744 int crn_reset_done;
3745
3746 crn_reset_done = 0;
3743 va_start(ap, cmd);
3744 bus = va_arg(ap, int);
3745 lp = va_arg(ap, fcportdb_t *);
3746 va_end(ap);
3747 fc = ISP_FC_PC(isp, bus);
3748 tgt = FC_PORTDB_TGT(isp, bus, lp);
3749 isp_gen_role_str(buf, sizeof (buf), lp->new_prli_word3);
3750 if (cmd == ISPASYNC_DEV_CHANGED)
3751 isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->new_portid, lp->handle, buf, "changed");
3752 else
3753 isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->portid, lp->handle, buf, "stayed");
3754
3755 if (lp->is_target !=
3756 ((FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) &&
3757 (lp->new_prli_word3 & PRLI_WD3_TARGET_FUNCTION))) {
3758 lp->is_target = !lp->is_target;
3759 if (lp->is_target) {
3747 va_start(ap, cmd);
3748 bus = va_arg(ap, int);
3749 lp = va_arg(ap, fcportdb_t *);
3750 va_end(ap);
3751 fc = ISP_FC_PC(isp, bus);
3752 tgt = FC_PORTDB_TGT(isp, bus, lp);
3753 isp_gen_role_str(buf, sizeof (buf), lp->new_prli_word3);
3754 if (cmd == ISPASYNC_DEV_CHANGED)
3755 isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->new_portid, lp->handle, buf, "changed");
3756 else
3757 isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->portid, lp->handle, buf, "stayed");
3758
3759 if (lp->is_target !=
3760 ((FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) &&
3761 (lp->new_prli_word3 & PRLI_WD3_TARGET_FUNCTION))) {
3762 lp->is_target = !lp->is_target;
3763 if (lp->is_target) {
3760 if (cmd == ISPASYNC_DEV_CHANGED)
3764 if (cmd == ISPASYNC_DEV_CHANGED) {
3761 isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
3765 isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
3766 crn_reset_done = 1;
3767 }
3762 isp_make_here(isp, lp, bus, tgt);
3763 } else {
3764 isp_make_gone(isp, lp, bus, tgt);
3768 isp_make_here(isp, lp, bus, tgt);
3769 } else {
3770 isp_make_gone(isp, lp, bus, tgt);
3765 if (cmd == ISPASYNC_DEV_CHANGED)
3771 if (cmd == ISPASYNC_DEV_CHANGED) {
3766 isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
3772 isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
3773 crn_reset_done = 1;
3774 }
3767 }
3768 }
3769 if (lp->is_initiator !=
3770 ((FCPARAM(isp, bus)->role & ISP_ROLE_TARGET) &&
3771 (lp->new_prli_word3 & PRLI_WD3_INITIATOR_FUNCTION))) {
3772 lp->is_initiator = !lp->is_initiator;
3773 ac.contract_number = AC_CONTRACT_DEV_CHG;
3774 adc = (struct ac_device_changed *) ac.contract_data;
3775 adc->wwpn = lp->port_wwn;
3776 adc->port = lp->portid;
3777 adc->target = tgt;
3778 adc->arrived = lp->is_initiator;
3779 xpt_async(AC_CONTRACT, fc->path, &ac);
3780 }
3775 }
3776 }
3777 if (lp->is_initiator !=
3778 ((FCPARAM(isp, bus)->role & ISP_ROLE_TARGET) &&
3779 (lp->new_prli_word3 & PRLI_WD3_INITIATOR_FUNCTION))) {
3780 lp->is_initiator = !lp->is_initiator;
3781 ac.contract_number = AC_CONTRACT_DEV_CHG;
3782 adc = (struct ac_device_changed *) ac.contract_data;
3783 adc->wwpn = lp->port_wwn;
3784 adc->port = lp->portid;
3785 adc->target = tgt;
3786 adc->arrived = lp->is_initiator;
3787 xpt_async(AC_CONTRACT, fc->path, &ac);
3788 }
3789
3790 if ((lp->new_prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) &&
3791 (crn_reset_done == 0))
3792 isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
3793
3781 break;
3794 break;
3795 }
3782 case ISPASYNC_DEV_GONE:
3783 va_start(ap, cmd);
3784 bus = va_arg(ap, int);
3785 lp = va_arg(ap, fcportdb_t *);
3786 va_end(ap);
3787 fc = ISP_FC_PC(isp, bus);
3788 tgt = FC_PORTDB_TGT(isp, bus, lp);
3789 /*

--- 522 unchanged lines hidden ---
3796 case ISPASYNC_DEV_GONE:
3797 va_start(ap, cmd);
3798 bus = va_arg(ap, int);
3799 lp = va_arg(ap, fcportdb_t *);
3800 va_end(ap);
3801 fc = ISP_FC_PC(isp, bus);
3802 tgt = FC_PORTDB_TGT(isp, bus, lp);
3803 /*

--- 522 unchanged lines hidden ---