Deleted Added
full compact
isp_freebsd.c (197214) isp_freebsd.c (200089)
1/*-
2 * Copyright (c) 1997-2009 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

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

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

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27/*
28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
29 */
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 197214 2009-09-15 02:25:03Z mjacob $");
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 200089 2009-12-04 03:34:12Z mjacob $");
32#include <dev/isp/isp_freebsd.h>
33#include <sys/unistd.h>
34#include <sys/kthread.h>
35#include <sys/conf.h>
36#include <sys/module.h>
37#include <sys/ioccom.h>
38#include <dev/isp/isp_ioctl.h>
39#include <sys/devicestat.h>

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

128#ifdef ISP_INTERNAL_TARGET
129 ISP_SET_PC(isp, chan, proc_active, 1);
130 if (THREAD_CREATE(isp_target_thread_pi, spi, &spi->target_proc, 0, 0, "%s: isp_test_tgt%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
131 ISP_SET_PC(isp, chan, proc_active, 0);
132 isp_prt(isp, ISP_LOGERR, "cannot create test target thread");
133 }
134#endif
135 } else {
32#include <dev/isp/isp_freebsd.h>
33#include <sys/unistd.h>
34#include <sys/kthread.h>
35#include <sys/conf.h>
36#include <sys/module.h>
37#include <sys/ioccom.h>
38#include <dev/isp/isp_ioctl.h>
39#include <sys/devicestat.h>

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

128#ifdef ISP_INTERNAL_TARGET
129 ISP_SET_PC(isp, chan, proc_active, 1);
130 if (THREAD_CREATE(isp_target_thread_pi, spi, &spi->target_proc, 0, 0, "%s: isp_test_tgt%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
131 ISP_SET_PC(isp, chan, proc_active, 0);
132 isp_prt(isp, ISP_LOGERR, "cannot create test target thread");
133 }
134#endif
135 } else {
136 fcparam *fcp = FCPARAM(isp, chan);
136 struct isp_fc *fc = ISP_FC_PC(isp, chan);
137
137 struct isp_fc *fc = ISP_FC_PC(isp, chan);
138
139 ISP_LOCK(isp);
138 fc->sim = sim;
139 fc->path = path;
140 fc->isp = isp;
140 fc->sim = sim;
141 fc->path = path;
142 fc->isp = isp;
143 fc->ready = 1;
141
142 callout_init_mtx(&fc->ldt, &isp->isp_osinfo.lock, 0);
143 callout_init_mtx(&fc->gdt, &isp->isp_osinfo.lock, 0);
144
145 callout_init_mtx(&fc->ldt, &isp->isp_osinfo.lock, 0);
146 callout_init_mtx(&fc->gdt, &isp->isp_osinfo.lock, 0);
144
145 if (THREAD_CREATE(isp_kthread, fc, &fc->kproc, 0, 0, "%s: fc_thrd%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
146 xpt_free_path(fc->path);
147 ISP_LOCK(isp);
148 xpt_bus_deregister(cam_sim_path(fc->sim));
149 ISP_UNLOCK(isp);
150 cam_sim_free(fc->sim, FALSE);
151 }
152 /*
153 * We start by being "loop down" if we have an initiator role
154 */
147 /*
148 * We start by being "loop down" if we have an initiator role
149 */
155 ISP_LOCK(isp);
156 if ((FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR) && fc->ldt_running == 0) {
150 if (fcp->role & ISP_ROLE_INITIATOR) {
157 isp_freeze_loopdown(isp, chan, "isp_attach");
151 isp_freeze_loopdown(isp, chan, "isp_attach");
158 fc->ldt_running = 1;
159 callout_reset(&fc->ldt, isp_quickboot_time * hz, isp_ldt, fc);
160 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Starting Initial Loop Down Timer @ %lu", (unsigned long) time_uptime);
161 }
162 ISP_UNLOCK(isp);
152 callout_reset(&fc->ldt, isp_quickboot_time * hz, isp_ldt, fc);
153 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Starting Initial Loop Down Timer @ %lu", (unsigned long) time_uptime);
154 }
155 ISP_UNLOCK(isp);
156 if (THREAD_CREATE(isp_kthread, fc, &fc->kproc, 0, 0, "%s: fc_thrd%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
157 xpt_free_path(fc->path);
158 ISP_LOCK(isp);
159 if (callout_active(&fc->ldt)) {
160 callout_stop(&fc->ldt);
161 }
162 xpt_bus_deregister(cam_sim_path(fc->sim));
163 ISP_UNLOCK(isp);
164 cam_sim_free(fc->sim, FALSE);
165 return (ENOMEM);
166 }
163#ifdef ISP_INTERNAL_TARGET
164 ISP_SET_PC(isp, chan, proc_active, 1);
165 if (THREAD_CREATE(isp_target_thread_fc, fc, &fc->target_proc, 0, 0, "%s: isp_test_tgt%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
166 ISP_SET_PC(isp, chan, proc_active, 0);
167 isp_prt(isp, ISP_LOGERR, "cannot create test target thread");
168 }
169#endif
170 }

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

3930 }
3931 tgt = lp->dev_map_idx - 1;
3932 FCPARAM(isp, chan)->isp_dev_map[tgt] = 0;
3933 lp->dev_map_idx = 0;
3934 lp->state = FC_PORTDB_STATE_NIL;
3935 isp_prt(isp, ISP_LOGCONFIG, prom3, chan, lp->portid, tgt, "Gone Device Timeout");
3936 isp_make_gone(isp, chan, tgt);
3937 }
167#ifdef ISP_INTERNAL_TARGET
168 ISP_SET_PC(isp, chan, proc_active, 1);
169 if (THREAD_CREATE(isp_target_thread_fc, fc, &fc->target_proc, 0, 0, "%s: isp_test_tgt%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
170 ISP_SET_PC(isp, chan, proc_active, 0);
171 isp_prt(isp, ISP_LOGERR, "cannot create test target thread");
172 }
173#endif
174 }

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

3934 }
3935 tgt = lp->dev_map_idx - 1;
3936 FCPARAM(isp, chan)->isp_dev_map[tgt] = 0;
3937 lp->dev_map_idx = 0;
3938 lp->state = FC_PORTDB_STATE_NIL;
3939 isp_prt(isp, ISP_LOGCONFIG, prom3, chan, lp->portid, tgt, "Gone Device Timeout");
3940 isp_make_gone(isp, chan, tgt);
3941 }
3938 if (more_to_do) {
3939 fc->gdt_running = 1;
3940 callout_reset(&fc->gdt, hz, isp_gdt, fc);
3941 } else {
3942 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d stopping Gone Device Timer", chan);
3943 fc->gdt_running = 0;
3942 if (fc->ready) {
3943 if (more_to_do) {
3944 callout_reset(&fc->gdt, hz, isp_gdt, fc);
3945 } else {
3946 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d stopping Gone Device Timer", chan);
3947 }
3944 }
3945}
3946
3947/*
3948 * Loop Down Timer Function- when loop goes down, a timer is started and
3949 * and after it expires we come here and take all probational devices that
3950 * the OS knows about and the tell the OS that they've gone away.
3951 *

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

4012
4013static void
4014isp_kthread(void *arg)
4015{
4016 struct isp_fc *fc = arg;
4017 ispsoftc_t *isp = fc->isp;
4018 int chan = fc - isp->isp_osinfo.pc.fc;
4019 int slp = 0;
3948 }
3949}
3950
3951/*
3952 * Loop Down Timer Function- when loop goes down, a timer is started and
3953 * and after it expires we come here and take all probational devices that
3954 * the OS knows about and the tell the OS that they've gone away.
3955 *

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

4016
4017static void
4018isp_kthread(void *arg)
4019{
4020 struct isp_fc *fc = arg;
4021 ispsoftc_t *isp = fc->isp;
4022 int chan = fc - isp->isp_osinfo.pc.fc;
4023 int slp = 0;
4024
4020 mtx_lock(&isp->isp_osinfo.lock);
4021
4022 for (;;) {
4023 int wasfrozen, lb, lim;
4024
4025 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d checking FC state", __func__, chan);
4026 lb = isp_fc_runstate(isp, chan, 250000);
4027

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

4797isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
4798{
4799 int bus;
4800 static const char prom[] = "Chan %d PortID 0x%06x handle 0x%x role %s %s WWPN 0x%08x%08x";
4801 static const char prom2[] = "Chan %d PortID 0x%06x handle 0x%x role %s %s tgt %u WWPN 0x%08x%08x";
4802 char *msg = NULL;
4803 target_id_t tgt;
4804 fcportdb_t *lp;
4025 mtx_lock(&isp->isp_osinfo.lock);
4026
4027 for (;;) {
4028 int wasfrozen, lb, lim;
4029
4030 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d checking FC state", __func__, chan);
4031 lb = isp_fc_runstate(isp, chan, 250000);
4032

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

4802isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
4803{
4804 int bus;
4805 static const char prom[] = "Chan %d PortID 0x%06x handle 0x%x role %s %s WWPN 0x%08x%08x";
4806 static const char prom2[] = "Chan %d PortID 0x%06x handle 0x%x role %s %s tgt %u WWPN 0x%08x%08x";
4807 char *msg = NULL;
4808 target_id_t tgt;
4809 fcportdb_t *lp;
4810 struct isp_fc *fc;
4805 struct cam_path *tmppath;
4806 va_list ap;
4807
4808 switch (cmd) {
4809 case ISPASYNC_NEW_TGT_PARAMS:
4810 {
4811 struct ccb_trans_settings_scsi *scsi;
4812 struct ccb_trans_settings_spi *spi;

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

4881 /* FALLTHROUGH */
4882 case ISPASYNC_LOOP_RESET:
4883 if (msg == NULL) {
4884 msg = "LOOP Reset";
4885 }
4886 /* FALLTHROUGH */
4887 case ISPASYNC_LOOP_DOWN:
4888 {
4811 struct cam_path *tmppath;
4812 va_list ap;
4813
4814 switch (cmd) {
4815 case ISPASYNC_NEW_TGT_PARAMS:
4816 {
4817 struct ccb_trans_settings_scsi *scsi;
4818 struct ccb_trans_settings_spi *spi;

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

4887 /* FALLTHROUGH */
4888 case ISPASYNC_LOOP_RESET:
4889 if (msg == NULL) {
4890 msg = "LOOP Reset";
4891 }
4892 /* FALLTHROUGH */
4893 case ISPASYNC_LOOP_DOWN:
4894 {
4889 struct isp_fc *fc;
4890 if (msg == NULL) {
4891 msg = "LOOP Down";
4892 }
4893 va_start(ap, cmd);
4894 bus = va_arg(ap, int);
4895 va_end(ap);
4896
4895 if (msg == NULL) {
4896 msg = "LOOP Down";
4897 }
4898 va_start(ap, cmd);
4899 bus = va_arg(ap, int);
4900 va_end(ap);
4901
4897 FCPARAM(isp, bus)->link_active = 1;
4902 FCPARAM(isp, bus)->link_active = 0;
4898
4899 fc = ISP_FC_PC(isp, bus);
4903
4904 fc = ISP_FC_PC(isp, bus);
4900 /*
4901 * We don't do any simq freezing if we are only in target mode
4902 */
4903 if (fc->role & ISP_ROLE_INITIATOR) {
4904 if (fc->path) {
4905 isp_freeze_loopdown(isp, bus, msg);
4905 if (cmd == ISPASYNC_LOOP_DOWN && fc->ready) {
4906 /*
4907 * We don't do any simq freezing if we are only in target mode
4908 */
4909 if (fc->role & ISP_ROLE_INITIATOR) {
4910 if (fc->path) {
4911 isp_freeze_loopdown(isp, bus, msg);
4912 }
4913 if (!callout_active(&fc->ldt)) {
4914 callout_reset(&fc->ldt, fc->loop_down_limit * hz, isp_ldt, fc);
4915 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "starting Loop Down Timer @ %lu", (unsigned long) time_uptime);
4916 }
4906 }
4917 }
4907 if (fc->ldt_running == 0) {
4908 fc->ldt_running = 1;
4909 callout_reset(&fc->ldt, fc->loop_down_limit * hz, isp_ldt, fc);
4910 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "starting Loop Down Timer @ %lu", (unsigned long) time_uptime);
4911 }
4912 }
4913 isp_prt(isp, ISP_LOGINFO, "Chan %d: %s", bus, msg);
4914 break;
4915 }
4916 case ISPASYNC_LOOP_UP:
4917 va_start(ap, cmd);
4918 bus = va_arg(ap, int);
4919 va_end(ap);
4918 }
4919 isp_prt(isp, ISP_LOGINFO, "Chan %d: %s", bus, msg);
4920 break;
4921 }
4922 case ISPASYNC_LOOP_UP:
4923 va_start(ap, cmd);
4924 bus = va_arg(ap, int);
4925 va_end(ap);
4926 fc = ISP_FC_PC(isp, bus);
4920 /*
4921 * Now we just note that Loop has come up. We don't
4922 * actually do anything because we're waiting for a
4923 * Change Notify before activating the FC cleanup
4924 * thread to look at the state of the loop again.
4925 */
4926 FCPARAM(isp, bus)->link_active = 1;
4927 /*
4928 * Now we just note that Loop has come up. We don't
4929 * actually do anything because we're waiting for a
4930 * Change Notify before activating the FC cleanup
4931 * thread to look at the state of the loop again.
4932 */
4933 FCPARAM(isp, bus)->link_active = 1;
4927 ISP_FC_PC(isp, bus)->loop_dead = 0;
4928 ISP_FC_PC(isp, bus)->loop_down_time = 0;
4934 fc->loop_dead = 0;
4935 fc->loop_down_time = 0;
4929 isp_prt(isp, ISP_LOGINFO, "Chan %d Loop UP", bus);
4930 break;
4931 case ISPASYNC_DEV_ARRIVED:
4932 va_start(ap, cmd);
4933 bus = va_arg(ap, int);
4934 lp = va_arg(ap, fcportdb_t *);
4935 va_end(ap);
4936 isp_prt(isp, ISP_LOGINFO, "Chan %d Loop UP", bus);
4937 break;
4938 case ISPASYNC_DEV_ARRIVED:
4939 va_start(ap, cmd);
4940 bus = va_arg(ap, int);
4941 lp = va_arg(ap, fcportdb_t *);
4942 va_end(ap);
4943 fc = ISP_FC_PC(isp, bus);
4936 lp->reserved = 0;
4944 lp->reserved = 0;
4937 if ((ISP_FC_PC(isp, bus)->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
4945 if ((fc->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
4938 int dbidx = lp - FCPARAM(isp, bus)->portdb;
4939 int i;
4940
4941 for (i = 0; i < MAX_FC_TARG; i++) {
4942 if (i >= FL_ID && i <= SNS_ID) {
4943 continue;
4944 }
4945 if (FCPARAM(isp, bus)->isp_dev_map[i] == 0) {

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

4962 isp_prt(isp, ISP_LOGCONFIG, prom, bus, lp->portid, lp->handle, roles[lp->roles], "arrived", (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
4963 }
4964 break;
4965 case ISPASYNC_DEV_CHANGED:
4966 va_start(ap, cmd);
4967 bus = va_arg(ap, int);
4968 lp = va_arg(ap, fcportdb_t *);
4969 va_end(ap);
4946 int dbidx = lp - FCPARAM(isp, bus)->portdb;
4947 int i;
4948
4949 for (i = 0; i < MAX_FC_TARG; i++) {
4950 if (i >= FL_ID && i <= SNS_ID) {
4951 continue;
4952 }
4953 if (FCPARAM(isp, bus)->isp_dev_map[i] == 0) {

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

4970 isp_prt(isp, ISP_LOGCONFIG, prom, bus, lp->portid, lp->handle, roles[lp->roles], "arrived", (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
4971 }
4972 break;
4973 case ISPASYNC_DEV_CHANGED:
4974 va_start(ap, cmd);
4975 bus = va_arg(ap, int);
4976 lp = va_arg(ap, fcportdb_t *);
4977 va_end(ap);
4978 fc = ISP_FC_PC(isp, bus);
4970 lp->reserved = 0;
4971 if (isp_change_is_bad) {
4972 lp->state = FC_PORTDB_STATE_NIL;
4973 if (lp->dev_map_idx) {
4974 tgt = lp->dev_map_idx - 1;
4975 FCPARAM(isp, bus)->isp_dev_map[tgt] = 0;
4976 lp->dev_map_idx = 0;
4977 isp_prt(isp, ISP_LOGCONFIG, prom3, bus, lp->portid, tgt, "change is bad");

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

5008 (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
5009 }
5010 break;
5011 case ISPASYNC_DEV_GONE:
5012 va_start(ap, cmd);
5013 bus = va_arg(ap, int);
5014 lp = va_arg(ap, fcportdb_t *);
5015 va_end(ap);
4979 lp->reserved = 0;
4980 if (isp_change_is_bad) {
4981 lp->state = FC_PORTDB_STATE_NIL;
4982 if (lp->dev_map_idx) {
4983 tgt = lp->dev_map_idx - 1;
4984 FCPARAM(isp, bus)->isp_dev_map[tgt] = 0;
4985 lp->dev_map_idx = 0;
4986 isp_prt(isp, ISP_LOGCONFIG, prom3, bus, lp->portid, tgt, "change is bad");

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

5017 (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
5018 }
5019 break;
5020 case ISPASYNC_DEV_GONE:
5021 va_start(ap, cmd);
5022 bus = va_arg(ap, int);
5023 lp = va_arg(ap, fcportdb_t *);
5024 va_end(ap);
5025 fc = ISP_FC_PC(isp, bus);
5016 /*
5017 * If this has a virtual target and we haven't marked it
5018 * that we're going to have isp_gdt tell the OS it's gone,
5019 * set the isp_gdt timer running on it.
5020 *
5021 * If it isn't marked that isp_gdt is going to get rid of it,
5022 * announce that it's gone.
5023 */
5024 if (lp->dev_map_idx && lp->reserved == 0) {
5025 lp->reserved = 1;
5026 lp->new_reserved = ISP_FC_PC(isp, bus)->gone_device_time;
5027 lp->state = FC_PORTDB_STATE_ZOMBIE;
5026 /*
5027 * If this has a virtual target and we haven't marked it
5028 * that we're going to have isp_gdt tell the OS it's gone,
5029 * set the isp_gdt timer running on it.
5030 *
5031 * If it isn't marked that isp_gdt is going to get rid of it,
5032 * announce that it's gone.
5033 */
5034 if (lp->dev_map_idx && lp->reserved == 0) {
5035 lp->reserved = 1;
5036 lp->new_reserved = ISP_FC_PC(isp, bus)->gone_device_time;
5037 lp->state = FC_PORTDB_STATE_ZOMBIE;
5028 if (ISP_FC_PC(isp, bus)->gdt_running == 0) {
5038 if (fc->ready && !callout_active(&fc->gdt)) {
5029 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d starting Gone Device Timer", bus);
5039 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d starting Gone Device Timer", bus);
5030 ISP_FC_PC(isp, bus)->gdt_running = 1;
5031 callout_reset(&ISP_FC_PC(isp, bus)->gdt, hz, isp_gdt, ISP_FC_PC(isp, bus));
5040 callout_reset(&fc->gdt, hz, isp_gdt, fc);
5032 }
5033 tgt = lp->dev_map_idx - 1;
5034 isp_prt(isp, ISP_LOGCONFIG, prom2, bus, lp->portid, lp->handle, roles[lp->roles], "gone zombie at", tgt, (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
5035 } else if (lp->reserved == 0) {
5036 isp_prt(isp, ISP_LOGCONFIG, prom, bus, lp->portid, lp->handle, roles[lp->roles], "departed", (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
5037 }
5038 break;
5039 case ISPASYNC_CHANGE_NOTIFY:

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

5048 nphdl = va_arg(ap, int);
5049 nlstate = va_arg(ap, int);
5050 reason = va_arg(ap, int);
5051 } else {
5052 nphdl = NIL_HANDLE;
5053 nlstate = reason = 0;
5054 }
5055 va_end(ap);
5041 }
5042 tgt = lp->dev_map_idx - 1;
5043 isp_prt(isp, ISP_LOGCONFIG, prom2, bus, lp->portid, lp->handle, roles[lp->roles], "gone zombie at", tgt, (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
5044 } else if (lp->reserved == 0) {
5045 isp_prt(isp, ISP_LOGCONFIG, prom, bus, lp->portid, lp->handle, roles[lp->roles], "departed", (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn);
5046 }
5047 break;
5048 case ISPASYNC_CHANGE_NOTIFY:

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

5057 nphdl = va_arg(ap, int);
5058 nlstate = va_arg(ap, int);
5059 reason = va_arg(ap, int);
5060 } else {
5061 nphdl = NIL_HANDLE;
5062 nlstate = reason = 0;
5063 }
5064 va_end(ap);
5065 fc = ISP_FC_PC(isp, bus);
5056
5057 if (evt == ISPASYNC_CHANGE_PDB) {
5058 msg = "Chan %d Port Database Changed";
5059 } else if (evt == ISPASYNC_CHANGE_SNS) {
5060 msg = "Chan %d Name Server Database Changed";
5061 } else {
5062 msg = "Chan %d Other Change Notify";
5063 }
5064
5065 /*
5066 * If the loop down timer is running, cancel it.
5067 */
5066
5067 if (evt == ISPASYNC_CHANGE_PDB) {
5068 msg = "Chan %d Port Database Changed";
5069 } else if (evt == ISPASYNC_CHANGE_SNS) {
5070 msg = "Chan %d Name Server Database Changed";
5071 } else {
5072 msg = "Chan %d Other Change Notify";
5073 }
5074
5075 /*
5076 * If the loop down timer is running, cancel it.
5077 */
5068 if (ISP_FC_PC(isp, bus)->ldt_running) {
5078 if (fc->ready && callout_active(&fc->ldt)) {
5069 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Stopping Loop Down Timer @ %lu", (unsigned long) time_uptime);
5079 isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Stopping Loop Down Timer @ %lu", (unsigned long) time_uptime);
5070 ISP_FC_PC(isp, bus)->ldt_running = 0;
5071 callout_stop(&ISP_FC_PC(isp, bus)->ldt);
5080 callout_stop(&fc->ldt);
5072 }
5073 isp_prt(isp, ISP_LOGINFO, msg, bus);
5081 }
5082 isp_prt(isp, ISP_LOGINFO, msg, bus);
5074 if (ISP_FC_PC(isp, bus)->role & ISP_ROLE_INITIATOR) {
5083 if (fc->role & ISP_ROLE_INITIATOR) {
5075 isp_freeze_loopdown(isp, bus, msg);
5076 }
5084 isp_freeze_loopdown(isp, bus, msg);
5085 }
5077 wakeup(ISP_FC_PC(isp, bus));
5086 wakeup(fc);
5078 break;
5079 }
5080#ifdef ISP_TARGET_MODE
5081 case ISPASYNC_TARGET_NOTIFY:
5082 {
5083 isp_notify_t *notify;
5084 va_start(ap, cmd);
5085 notify = va_arg(ap, isp_notify_t *);

--- 465 unchanged lines hidden ---
5087 break;
5088 }
5089#ifdef ISP_TARGET_MODE
5090 case ISPASYNC_TARGET_NOTIFY:
5091 {
5092 isp_notify_t *notify;
5093 va_start(ap, cmd);
5094 notify = va_arg(ap, isp_notify_t *);

--- 465 unchanged lines hidden ---