1999-08-28 01:08:13 +00:00
|
|
|
/* $FreeBSD$ */
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
|
|
|
* Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
|
|
|
|
*
|
2001-03-02 06:28:55 +00:00
|
|
|
* Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob
|
1998-04-22 17:54:58 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice immediately at the beginning of the file, without modification,
|
|
|
|
* this list of conditions, and the following disclaimer.
|
2000-09-21 20:16:04 +00:00
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
1998-04-22 17:54:58 +00:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#include <dev/isp/isp_freebsd.h>
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#include <sys/unistd.h>
|
|
|
|
#include <sys/kthread.h>
|
2000-08-03 03:05:50 +00:00
|
|
|
#include <machine/stdarg.h> /* for use by isp_prt below */
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/ioccom.h>
|
|
|
|
#include <dev/isp/isp_ioctl.h>
|
1998-04-22 17:54:58 +00:00
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
static d_ioctl_t ispioctl;
|
2000-07-04 01:05:43 +00:00
|
|
|
static void isp_intr_enable(void *);
|
1999-08-16 20:11:45 +00:00
|
|
|
static void isp_cam_async(void *, u_int32_t, struct cam_path *, void *);
|
|
|
|
static void isp_poll(struct cam_sim *);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#if 0
|
1999-08-16 20:11:45 +00:00
|
|
|
static void isp_relsim(void *);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#endif
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
static timeout_t isp_watchdog;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
static void isp_kthread(void *);
|
2000-01-03 23:55:30 +00:00
|
|
|
static void isp_action(struct cam_sim *, union ccb *);
|
1999-08-16 20:11:45 +00:00
|
|
|
|
2000-05-09 01:08:21 +00:00
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#define ISP_CDEV_MAJOR 248
|
|
|
|
static struct cdevsw isp_cdevsw = {
|
|
|
|
/* open */ nullopen,
|
|
|
|
/* close */ nullclose,
|
|
|
|
/* read */ noread,
|
|
|
|
/* write */ nowrite,
|
|
|
|
/* ioctl */ ispioctl,
|
|
|
|
/* poll */ nopoll,
|
|
|
|
/* mmap */ nommap,
|
|
|
|
/* strategy */ nostrategy,
|
|
|
|
/* name */ "isp",
|
|
|
|
/* maj */ ISP_CDEV_MAJOR,
|
|
|
|
/* dump */ nodump,
|
|
|
|
/* psize */ nopsize,
|
|
|
|
/* flags */ D_TAPE,
|
|
|
|
};
|
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
static struct ispsoftc *isplist = NULL;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
void
|
1998-12-28 19:22:27 +00:00
|
|
|
isp_attach(struct ispsoftc *isp)
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
1999-05-11 05:10:06 +00:00
|
|
|
int primary, secondary;
|
1998-09-15 08:42:56 +00:00
|
|
|
struct ccb_setasync csa;
|
|
|
|
struct cam_devq *devq;
|
1999-05-11 05:10:06 +00:00
|
|
|
struct cam_sim *sim;
|
|
|
|
struct cam_path *path;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Establish (in case of 12X0) which bus is the primary.
|
|
|
|
*/
|
|
|
|
|
|
|
|
primary = 0;
|
|
|
|
secondary = 1;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
/*
|
1999-05-11 05:10:06 +00:00
|
|
|
* Create the device queue for our SIM(s).
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-10-17 18:50:47 +00:00
|
|
|
devq = cam_simq_alloc(isp->isp_maxcmds);
|
1998-09-15 08:42:56 +00:00
|
|
|
if (devq == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-05-11 05:10:06 +00:00
|
|
|
* Construct our SIM entry.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
2001-07-05 17:14:57 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
sim = cam_sim_alloc(isp_action, isp_poll, "isp", isp,
|
2001-03-01 02:14:54 +00:00
|
|
|
device_get_unit(isp->isp_dev), 1, isp->isp_maxcmds, devq);
|
1999-05-11 05:10:06 +00:00
|
|
|
if (sim == NULL) {
|
1998-09-15 08:42:56 +00:00
|
|
|
cam_simq_free(devq);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-07-04 01:05:43 +00:00
|
|
|
|
|
|
|
isp->isp_osinfo.ehook.ich_func = isp_intr_enable;
|
|
|
|
isp->isp_osinfo.ehook.ich_arg = isp;
|
2001-07-05 17:14:57 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-07-04 01:05:43 +00:00
|
|
|
if (config_intrhook_establish(&isp->isp_osinfo.ehook) != 0) {
|
2001-07-05 17:14:57 +00:00
|
|
|
cam_sim_free(sim, TRUE);
|
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"could not establish interrupt enable hook");
|
2000-07-04 01:05:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-05-11 05:10:06 +00:00
|
|
|
if (xpt_bus_register(sim, primary) != CAM_SUCCESS) {
|
|
|
|
cam_sim_free(sim, TRUE);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-05-11 05:10:06 +00:00
|
|
|
if (xpt_create_path(&path, NULL, cam_sim_path(sim),
|
1998-09-15 08:42:56 +00:00
|
|
|
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
1999-05-11 05:10:06 +00:00
|
|
|
xpt_bus_deregister(cam_sim_path(sim));
|
|
|
|
cam_sim_free(sim, TRUE);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
config_intrhook_disestablish(&isp->isp_osinfo.ehook);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-05-11 05:10:06 +00:00
|
|
|
xpt_setup_ccb(&csa.ccb_h, path, 5);
|
1998-09-15 08:42:56 +00:00
|
|
|
csa.ccb_h.func_code = XPT_SASYNC_CB;
|
|
|
|
csa.event_enable = AC_LOST_DEVICE;
|
1999-01-30 07:29:00 +00:00
|
|
|
csa.callback = isp_cam_async;
|
1999-05-11 05:10:06 +00:00
|
|
|
csa.callback_arg = sim;
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_action((union ccb *)&csa);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
isp->isp_sim = sim;
|
|
|
|
isp->isp_path = path;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
/*
|
|
|
|
* Create a kernel thread for fibre channel instances. We
|
|
|
|
* don't have dual channel FC cards.
|
|
|
|
*/
|
|
|
|
if (IS_FC(isp)) {
|
2001-07-05 17:14:57 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
|
|
|
/* XXX: LOCK VIOLATION */
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
cv_init(&isp->isp_osinfo.kthread_cv, "isp_kthread_cv");
|
|
|
|
if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc,
|
|
|
|
RFHIGHPID, "%s: fc_thrd",
|
|
|
|
device_get_nameunit(isp->isp_dev))) {
|
|
|
|
xpt_bus_deregister(cam_sim_path(sim));
|
|
|
|
cam_sim_free(sim, TRUE);
|
|
|
|
config_intrhook_disestablish(&isp->isp_osinfo.ehook);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
isp_prt(isp, ISP_LOGERR, "could not create kthread");
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-07-05 19:34:06 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-05-11 05:10:06 +00:00
|
|
|
/*
|
|
|
|
* If we have a second channel, construct SIM entry for that.
|
|
|
|
*/
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp)) {
|
2001-07-05 17:14:57 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
sim = cam_sim_alloc(isp_action, isp_poll, "isp", isp,
|
2001-03-01 02:14:54 +00:00
|
|
|
device_get_unit(isp->isp_dev), 1, isp->isp_maxcmds, devq);
|
1999-05-11 05:10:06 +00:00
|
|
|
if (sim == NULL) {
|
|
|
|
xpt_bus_deregister(cam_sim_path(isp->isp_sim));
|
|
|
|
xpt_free_path(isp->isp_path);
|
|
|
|
cam_simq_free(devq);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
config_intrhook_disestablish(&isp->isp_osinfo.ehook);
|
1999-05-11 05:10:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (xpt_bus_register(sim, secondary) != CAM_SUCCESS) {
|
|
|
|
xpt_bus_deregister(cam_sim_path(isp->isp_sim));
|
|
|
|
xpt_free_path(isp->isp_path);
|
|
|
|
cam_sim_free(sim, TRUE);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
config_intrhook_disestablish(&isp->isp_osinfo.ehook);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xpt_create_path(&path, NULL, cam_sim_path(sim),
|
|
|
|
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
|
|
|
xpt_bus_deregister(cam_sim_path(isp->isp_sim));
|
|
|
|
xpt_free_path(isp->isp_path);
|
|
|
|
xpt_bus_deregister(cam_sim_path(sim));
|
|
|
|
cam_sim_free(sim, TRUE);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
config_intrhook_disestablish(&isp->isp_osinfo.ehook);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
xpt_setup_ccb(&csa.ccb_h, path, 5);
|
|
|
|
csa.ccb_h.func_code = XPT_SASYNC_CB;
|
|
|
|
csa.event_enable = AC_LOST_DEVICE;
|
|
|
|
csa.callback = isp_cam_async;
|
|
|
|
csa.callback_arg = sim;
|
|
|
|
xpt_action((union ccb *)&csa);
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
isp->isp_sim2 = sim;
|
|
|
|
isp->isp_path2 = path;
|
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create device nodes
|
|
|
|
*/
|
|
|
|
(void) make_dev(&isp_cdevsw, device_get_unit(isp->isp_dev), UID_ROOT,
|
|
|
|
GID_OPERATOR, 0600, "%s", device_get_nameunit(isp->isp_dev));
|
|
|
|
|
2001-02-11 03:47:39 +00:00
|
|
|
if (isp->isp_role != ISP_ROLE_NONE) {
|
|
|
|
isp->isp_state = ISP_RUNSTATE;
|
|
|
|
ENABLE_INTS(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
if (isplist == NULL) {
|
|
|
|
isplist = isp;
|
|
|
|
} else {
|
|
|
|
struct ispsoftc *tmp = isplist;
|
|
|
|
while (tmp->isp_osinfo.next) {
|
|
|
|
tmp = tmp->isp_osinfo.next;
|
|
|
|
}
|
|
|
|
tmp->isp_osinfo.next = isp;
|
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ispioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
|
|
|
{
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int retval = ENOTTY;
|
|
|
|
|
|
|
|
isp = isplist;
|
|
|
|
while (isp) {
|
|
|
|
if (minor(dev) == device_get_unit(isp->isp_dev)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
isp = isp->isp_osinfo.next;
|
|
|
|
}
|
|
|
|
if (isp == NULL)
|
|
|
|
return (ENXIO);
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case ISP_SDBLEV:
|
|
|
|
{
|
|
|
|
int olddblev = isp->isp_dblev;
|
|
|
|
isp->isp_dblev = *(int *)addr;
|
|
|
|
*(int *)addr = olddblev;
|
|
|
|
retval = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ISP_RESETHBA:
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
isp_reinit(isp);
|
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
retval = 0;
|
|
|
|
break;
|
|
|
|
case ISP_FC_RESCAN:
|
|
|
|
if (IS_FC(isp)) {
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
if (isp_fc_runstate(isp, 5 * 1000000)) {
|
|
|
|
retval = EIO;
|
|
|
|
} else {
|
|
|
|
retval = 0;
|
|
|
|
}
|
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ISP_FC_LIP:
|
|
|
|
if (IS_FC(isp)) {
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
if (isp_control(isp, ISPCTL_SEND_LIP, 0)) {
|
|
|
|
retval = EIO;
|
|
|
|
} else {
|
|
|
|
retval = 0;
|
|
|
|
}
|
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ISP_FC_GETDINFO:
|
|
|
|
{
|
|
|
|
struct isp_fc_device *ifc = (struct isp_fc_device *) addr;
|
|
|
|
struct lportdb *lp;
|
|
|
|
|
|
|
|
if (ifc->loopid < 0 || ifc->loopid >= MAX_FC_TARG) {
|
|
|
|
retval = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
lp = &FCPARAM(isp)->portdb[ifc->loopid];
|
|
|
|
if (lp->valid) {
|
|
|
|
ifc->loopid = lp->loopid;
|
|
|
|
ifc->portid = lp->portid;
|
|
|
|
ifc->node_wwn = lp->node_wwn;
|
|
|
|
ifc->port_wwn = lp->port_wwn;
|
|
|
|
retval = 0;
|
|
|
|
} else {
|
|
|
|
retval = ENODEV;
|
|
|
|
}
|
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (retval);
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
|
2000-07-04 01:05:43 +00:00
|
|
|
static void
|
|
|
|
isp_intr_enable(void *arg)
|
|
|
|
{
|
|
|
|
struct ispsoftc *isp = arg;
|
2001-02-11 03:47:39 +00:00
|
|
|
if (isp->isp_role != ISP_ROLE_NONE) {
|
|
|
|
ENABLE_INTS(isp);
|
|
|
|
isp->isp_osinfo.intsok = 1;
|
|
|
|
}
|
2000-07-04 01:05:43 +00:00
|
|
|
/* Release our hook so that the boot can continue. */
|
|
|
|
config_intrhook_disestablish(&isp->isp_osinfo.ehook);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Put the target mode functions here, because some are inlines
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
static __inline int is_lun_enabled(struct ispsoftc *, int, lun_id_t);
|
|
|
|
static __inline int are_any_luns_enabled(struct ispsoftc *, int);
|
|
|
|
static __inline tstate_t *get_lun_statep(struct ispsoftc *, int, lun_id_t);
|
2000-01-03 23:55:30 +00:00
|
|
|
static __inline void rls_lun_statep(struct ispsoftc *, tstate_t *);
|
|
|
|
static __inline int isp_psema_sig_rqe(struct ispsoftc *);
|
|
|
|
static __inline int isp_cv_wait_timed_rqe(struct ispsoftc *, int);
|
|
|
|
static __inline void isp_cv_signal_rqe(struct ispsoftc *, int);
|
|
|
|
static __inline void isp_vsema_rqe(struct ispsoftc *);
|
|
|
|
static cam_status
|
2001-04-04 21:58:29 +00:00
|
|
|
create_lun_state(struct ispsoftc *, int, struct cam_path *, tstate_t **);
|
2000-01-03 23:55:30 +00:00
|
|
|
static void destroy_lun_state(struct ispsoftc *, tstate_t *);
|
|
|
|
static void isp_en_lun(struct ispsoftc *, union ccb *);
|
|
|
|
static cam_status isp_abort_tgt_ccb(struct ispsoftc *, union ccb *);
|
2000-07-18 06:58:28 +00:00
|
|
|
static timeout_t isp_refire_putback_atio;
|
2001-04-04 21:58:29 +00:00
|
|
|
static void isp_complete_ctio(union ccb *);
|
|
|
|
static void isp_target_putback_atio(union ccb *);
|
|
|
|
static cam_status isp_target_start_ctio(struct ispsoftc *, union ccb *);
|
2000-01-03 23:55:30 +00:00
|
|
|
static int isp_handle_platform_atio(struct ispsoftc *, at_entry_t *);
|
|
|
|
static int isp_handle_platform_atio2(struct ispsoftc *, at2_entry_t *);
|
|
|
|
static int isp_handle_platform_ctio(struct ispsoftc *, void *);
|
|
|
|
|
|
|
|
static __inline int
|
2001-04-04 21:58:29 +00:00
|
|
|
is_lun_enabled(struct ispsoftc *isp, int bus, lun_id_t lun)
|
2000-01-03 23:55:30 +00:00
|
|
|
{
|
|
|
|
tstate_t *tptr;
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = isp->isp_osinfo.lun_hash[LUN_HASH_FUNC(isp, bus, lun)];
|
|
|
|
if (tptr == NULL) {
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
do {
|
2001-04-04 21:58:29 +00:00
|
|
|
if (tptr->lun == (lun_id_t) lun && tptr->bus == bus) {
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
} while ((tptr = tptr->next) != NULL);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
2001-04-04 21:58:29 +00:00
|
|
|
are_any_luns_enabled(struct ispsoftc *isp, int port)
|
2000-01-03 23:55:30 +00:00
|
|
|
{
|
2001-04-04 21:58:29 +00:00
|
|
|
int lo, hi;
|
|
|
|
if (IS_DUALBUS(isp)) {
|
|
|
|
lo = (port * (LUN_HASH_SIZE >> 1));
|
|
|
|
hi = lo + (LUN_HASH_SIZE >> 1);
|
|
|
|
} else {
|
|
|
|
lo = 0;
|
|
|
|
hi = LUN_HASH_SIZE;
|
|
|
|
}
|
|
|
|
for (lo = 0; lo < hi; lo++) {
|
|
|
|
if (isp->isp_osinfo.lun_hash[lo]) {
|
2000-01-03 23:55:30 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline tstate_t *
|
2001-04-04 21:58:29 +00:00
|
|
|
get_lun_statep(struct ispsoftc *isp, int bus, lun_id_t lun)
|
2000-01-03 23:55:30 +00:00
|
|
|
{
|
|
|
|
tstate_t *tptr;
|
|
|
|
|
|
|
|
if (lun == CAM_LUN_WILDCARD) {
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = &isp->isp_osinfo.tsdflt[bus];
|
2000-01-03 23:55:30 +00:00
|
|
|
tptr->hold++;
|
|
|
|
return (tptr);
|
|
|
|
} else {
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = isp->isp_osinfo.lun_hash[LUN_HASH_FUNC(isp, bus, lun)];
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
if (tptr == NULL) {
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
2001-04-04 21:58:29 +00:00
|
|
|
if (tptr->lun == lun && tptr->bus == bus) {
|
2000-01-03 23:55:30 +00:00
|
|
|
tptr->hold++;
|
|
|
|
return (tptr);
|
|
|
|
}
|
|
|
|
} while ((tptr = tptr->next) != NULL);
|
|
|
|
return (tptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline void
|
|
|
|
rls_lun_statep(struct ispsoftc *isp, tstate_t *tptr)
|
|
|
|
{
|
|
|
|
if (tptr->hold)
|
|
|
|
tptr->hold--;
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
|
|
|
isp_psema_sig_rqe(struct ispsoftc *isp)
|
|
|
|
{
|
|
|
|
while (isp->isp_osinfo.tmflags & TM_BUSY) {
|
|
|
|
isp->isp_osinfo.tmflags |= TM_WANTED;
|
|
|
|
if (tsleep(&isp->isp_osinfo.tmflags, PRIBIO|PCATCH, "i0", 0)) {
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
isp->isp_osinfo.tmflags |= TM_BUSY;
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
|
|
|
isp_cv_wait_timed_rqe(struct ispsoftc *isp, int timo)
|
|
|
|
{
|
|
|
|
if (tsleep(&isp->isp_osinfo.rstatus, PRIBIO, "qt1", timo)) {
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
return (-1);
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline void
|
|
|
|
isp_cv_signal_rqe(struct ispsoftc *isp, int status)
|
|
|
|
{
|
|
|
|
isp->isp_osinfo.rstatus = status;
|
|
|
|
wakeup(&isp->isp_osinfo.rstatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline void
|
|
|
|
isp_vsema_rqe(struct ispsoftc *isp)
|
|
|
|
{
|
|
|
|
if (isp->isp_osinfo.tmflags & TM_WANTED) {
|
|
|
|
isp->isp_osinfo.tmflags &= ~TM_WANTED;
|
|
|
|
wakeup(&isp->isp_osinfo.tmflags);
|
|
|
|
}
|
|
|
|
isp->isp_osinfo.tmflags &= ~TM_BUSY;
|
|
|
|
}
|
|
|
|
|
|
|
|
static cam_status
|
2001-04-04 21:58:29 +00:00
|
|
|
create_lun_state(struct ispsoftc *isp, int bus,
|
|
|
|
struct cam_path *path, tstate_t **rslt)
|
2000-01-03 23:55:30 +00:00
|
|
|
{
|
|
|
|
cam_status status;
|
|
|
|
lun_id_t lun;
|
2001-04-04 21:58:29 +00:00
|
|
|
int hfx;
|
2000-01-03 23:55:30 +00:00
|
|
|
tstate_t *tptr, *new;
|
|
|
|
|
|
|
|
lun = xpt_path_lun_id(path);
|
|
|
|
if (lun < 0) {
|
|
|
|
return (CAM_LUN_INVALID);
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
if (is_lun_enabled(isp, bus, lun)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
return (CAM_LUN_ALRDY_ENA);
|
|
|
|
}
|
2000-12-03 20:46:54 +00:00
|
|
|
new = (tstate_t *) malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT|M_ZERO);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (new == NULL) {
|
|
|
|
return (CAM_RESRC_UNAVAIL);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = xpt_create_path(&new->owner, NULL, xpt_path_path_id(path),
|
|
|
|
xpt_path_target_id(path), xpt_path_lun_id(path));
|
|
|
|
if (status != CAM_REQ_CMP) {
|
|
|
|
free(new, M_DEVBUF);
|
|
|
|
return (status);
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
new->bus = bus;
|
2000-01-03 23:55:30 +00:00
|
|
|
new->lun = lun;
|
|
|
|
SLIST_INIT(&new->atios);
|
|
|
|
SLIST_INIT(&new->inots);
|
|
|
|
new->hold = 1;
|
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
hfx = LUN_HASH_FUNC(isp, new->bus, new->lun);
|
|
|
|
tptr = isp->isp_osinfo.lun_hash[hfx];
|
|
|
|
if (tptr == NULL) {
|
|
|
|
isp->isp_osinfo.lun_hash[hfx] = new;
|
2000-01-03 23:55:30 +00:00
|
|
|
} else {
|
|
|
|
while (tptr->next)
|
|
|
|
tptr = tptr->next;
|
|
|
|
tptr->next = new;
|
|
|
|
}
|
|
|
|
*rslt = new;
|
|
|
|
return (CAM_REQ_CMP);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline void
|
|
|
|
destroy_lun_state(struct ispsoftc *isp, tstate_t *tptr)
|
|
|
|
{
|
2001-04-04 21:58:29 +00:00
|
|
|
int hfx;
|
2000-01-03 23:55:30 +00:00
|
|
|
tstate_t *lw, *pw;
|
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
hfx = LUN_HASH_FUNC(isp, tptr->bus, tptr->lun);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (tptr->hold) {
|
|
|
|
return;
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
pw = isp->isp_osinfo.lun_hash[hfx];
|
2000-01-03 23:55:30 +00:00
|
|
|
if (pw == NULL) {
|
|
|
|
return;
|
2001-04-04 21:58:29 +00:00
|
|
|
} else if (pw->lun == tptr->lun && pw->bus == tptr->bus) {
|
|
|
|
isp->isp_osinfo.lun_hash[hfx] = pw->next;
|
2000-01-03 23:55:30 +00:00
|
|
|
} else {
|
|
|
|
lw = pw;
|
|
|
|
pw = lw->next;
|
|
|
|
while (pw) {
|
2001-04-04 21:58:29 +00:00
|
|
|
if (pw->lun == tptr->lun && pw->bus == tptr->bus) {
|
2000-01-03 23:55:30 +00:00
|
|
|
lw->next = pw->next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lw = pw;
|
|
|
|
pw = pw->next;
|
|
|
|
}
|
|
|
|
if (pw == NULL) {
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(tptr, M_DEVBUF);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
/*
|
|
|
|
* we enter with our locks held.
|
|
|
|
*/
|
2000-01-03 23:55:30 +00:00
|
|
|
static void
|
|
|
|
isp_en_lun(struct ispsoftc *isp, union ccb *ccb)
|
|
|
|
{
|
2001-04-04 21:58:29 +00:00
|
|
|
const char lfmt[] = "Lun now %sabled for target mode on channel %d";
|
2000-01-03 23:55:30 +00:00
|
|
|
struct ccb_en_lun *cel = &ccb->cel;
|
|
|
|
tstate_t *tptr;
|
|
|
|
u_int16_t rstat;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
int bus, cmd, frozen = 0;
|
2000-01-03 23:55:30 +00:00
|
|
|
lun_id_t lun;
|
|
|
|
target_id_t tgt;
|
|
|
|
|
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
bus = XS_CHANNEL(ccb) & 0x1;
|
2000-01-03 23:55:30 +00:00
|
|
|
tgt = ccb->ccb_h.target_id;
|
|
|
|
lun = ccb->ccb_h.target_lun;
|
|
|
|
|
|
|
|
/*
|
2000-08-27 23:38:44 +00:00
|
|
|
* Do some sanity checking first.
|
|
|
|
*/
|
|
|
|
|
2001-02-11 03:47:39 +00:00
|
|
|
if ((lun != CAM_LUN_WILDCARD) &&
|
|
|
|
(lun < 0 || lun >= (lun_id_t) isp->isp_maxluns)) {
|
2000-08-27 23:38:44 +00:00
|
|
|
ccb->ccb_h.status = CAM_LUN_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (IS_SCSI(isp)) {
|
2001-04-04 21:58:29 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
|
|
|
sdp += bus;
|
2000-08-27 23:38:44 +00:00
|
|
|
if (tgt != CAM_TARGET_WILDCARD &&
|
2001-04-04 21:58:29 +00:00
|
|
|
tgt != sdp->isp_initiator_id) {
|
2000-08-27 23:38:44 +00:00
|
|
|
ccb->ccb_h.status = CAM_TID_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (tgt != CAM_TARGET_WILDCARD &&
|
2001-02-11 03:47:39 +00:00
|
|
|
tgt != FCPARAM(isp)->isp_iid) {
|
2000-08-27 23:38:44 +00:00
|
|
|
ccb->ccb_h.status = CAM_TID_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-11 03:47:39 +00:00
|
|
|
if (tgt == CAM_TARGET_WILDCARD) {
|
|
|
|
if (lun != CAM_LUN_WILDCARD) {
|
|
|
|
ccb->ccb_h.status = CAM_LUN_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-27 23:38:44 +00:00
|
|
|
/*
|
|
|
|
* If Fibre Channel, stop and drain all activity to this bus.
|
|
|
|
*/
|
2001-02-11 03:47:39 +00:00
|
|
|
#if 0
|
2000-08-27 23:38:44 +00:00
|
|
|
if (IS_FC(isp)) {
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
frozen = 1;
|
|
|
|
xpt_freeze_simq(isp->isp_sim, 1);
|
|
|
|
isp->isp_osinfo.drain = 1;
|
|
|
|
while (isp->isp_osinfo.drain) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
(void) msleep(&isp->isp_osinfo.drain, &isp->isp_lock,
|
|
|
|
PRIBIO, "ispdrain", 10 * hz);
|
2000-08-27 23:38:44 +00:00
|
|
|
}
|
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
}
|
2001-02-11 03:47:39 +00:00
|
|
|
#endif
|
2000-08-27 23:38:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if we're enabling on fibre channel and
|
|
|
|
* don't yet have a notion of who the heck we are (no
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
* loop yet).
|
2000-01-03 23:55:30 +00:00
|
|
|
*/
|
|
|
|
if (IS_FC(isp) && cel->enable &&
|
|
|
|
(isp->isp_osinfo.tmflags & TM_TMODE_ENABLED) == 0) {
|
|
|
|
fcparam *fcp = isp->isp_param;
|
2001-02-11 03:47:39 +00:00
|
|
|
int rv;
|
2000-01-03 23:55:30 +00:00
|
|
|
|
2001-02-11 03:47:39 +00:00
|
|
|
rv = isp_fc_runstate(isp, 2 * 1000000);
|
|
|
|
if (fcp->isp_fwstate != FW_READY ||
|
|
|
|
fcp->isp_loopstate != LOOP_READY) {
|
2000-01-03 23:55:30 +00:00
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"could not get a good port database read");
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Next check to see whether this is a target/lun wildcard action.
|
|
|
|
*
|
|
|
|
* If so, we enable/disable target mode but don't do any lun enabling.
|
|
|
|
*/
|
|
|
|
if (lun == CAM_LUN_WILDCARD && tgt == CAM_TARGET_WILDCARD) {
|
2001-04-04 21:58:29 +00:00
|
|
|
int av = bus << 31;
|
|
|
|
tptr = &isp->isp_osinfo.tsdflt[bus];
|
2000-01-03 23:55:30 +00:00
|
|
|
if (cel->enable) {
|
2001-04-04 21:58:29 +00:00
|
|
|
if (isp->isp_osinfo.tmflags & (1 << bus)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_LUN_ALRDY_ENA;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ccb->ccb_h.status =
|
|
|
|
xpt_create_path(&tptr->owner, NULL,
|
|
|
|
xpt_path_path_id(ccb->ccb_h.path),
|
|
|
|
xpt_path_target_id(ccb->ccb_h.path),
|
|
|
|
xpt_path_lun_id(ccb->ccb_h.path));
|
|
|
|
if (ccb->ccb_h.status != CAM_REQ_CMP) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
SLIST_INIT(&tptr->atios);
|
|
|
|
SLIST_INIT(&tptr->inots);
|
2001-04-04 21:58:29 +00:00
|
|
|
av |= ENABLE_TARGET_FLAG;
|
2000-01-03 23:55:30 +00:00
|
|
|
av = isp_control(isp, ISPCTL_TOGGLE_TMODE, &av);
|
|
|
|
if (av) {
|
|
|
|
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
|
|
|
xpt_free_path(tptr->owner);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
isp->isp_osinfo.tmflags |= (1 << bus);
|
2000-01-03 23:55:30 +00:00
|
|
|
} else {
|
2001-04-04 21:58:29 +00:00
|
|
|
if ((isp->isp_osinfo.tmflags & (1 << bus)) == 0) {
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_LUN_INVALID;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
if (are_any_luns_enabled(isp, bus)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_SCSI_BUSY;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
av = isp_control(isp, ISPCTL_TOGGLE_TMODE, &av);
|
|
|
|
if (av) {
|
|
|
|
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
isp->isp_osinfo.tmflags &= ~(1 << bus);
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
}
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO, "Target Mode %sabled on channel %d",
|
|
|
|
(cel->enable) ? "en" : "dis", bus);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2000-08-27 23:38:44 +00:00
|
|
|
* We can move along now...
|
2000-01-03 23:55:30 +00:00
|
|
|
*/
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (frozen) {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-08-27 23:38:44 +00:00
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (cel->enable) {
|
|
|
|
ccb->ccb_h.status =
|
2001-04-04 21:58:29 +00:00
|
|
|
create_lun_state(isp, bus, ccb->ccb_h.path, &tptr);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (ccb->ccb_h.status != CAM_REQ_CMP) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = get_lun_statep(isp, bus, lun);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (tptr == NULL) {
|
|
|
|
ccb->ccb_h.status = CAM_LUN_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isp_psema_sig_rqe(isp)) {
|
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
if (cel->enable)
|
|
|
|
destroy_lun_state(isp, tptr);
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cel->enable) {
|
|
|
|
u_int32_t seq = isp->isp_osinfo.rollinfo++;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
int c, n, ulun = lun;
|
|
|
|
|
|
|
|
cmd = RQSTYPE_ENABLE_LUN;
|
|
|
|
c = DFLT_CMND_CNT;
|
|
|
|
n = DFLT_INOT_CNT;
|
|
|
|
if (IS_FC(isp) && lun != 0) {
|
|
|
|
cmd = RQSTYPE_MODIFY_LUN;
|
|
|
|
n = 0;
|
|
|
|
/*
|
|
|
|
* For SCC firmware, we only deal with setting
|
|
|
|
* (enabling or modifying) lun 0.
|
|
|
|
*/
|
|
|
|
ulun = 0;
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
rstat = LUN_ERR;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (isp_lun_cmd(isp, cmd, bus, tgt, ulun, c, n, seq)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN, "isp_lun_cmd failed");
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (isp_cv_wait_timed_rqe(isp, 30 * hz)) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
"wait for ENABLE/MODIFY LUN timed out");
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
rstat = isp->isp_osinfo.rstatus;
|
|
|
|
if (rstat != LUN_OK) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
"ENABLE/MODIFY LUN returned 0x%x", rstat);
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
} else {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
int c, n, ulun = lun;
|
2000-01-03 23:55:30 +00:00
|
|
|
u_int32_t seq;
|
|
|
|
|
|
|
|
rstat = LUN_ERR;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
seq = isp->isp_osinfo.rollinfo++;
|
|
|
|
cmd = -RQSTYPE_MODIFY_LUN;
|
2000-01-03 23:55:30 +00:00
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
c = DFLT_CMND_CNT;
|
|
|
|
n = DFLT_INOT_CNT;
|
|
|
|
if (IS_FC(isp) && lun != 0) {
|
|
|
|
n = 0;
|
|
|
|
/*
|
|
|
|
* For SCC firmware, we only deal with setting
|
|
|
|
* (enabling or modifying) lun 0.
|
|
|
|
*/
|
|
|
|
ulun = 0;
|
|
|
|
}
|
|
|
|
if (isp_lun_cmd(isp, cmd, bus, tgt, ulun, c, n, seq)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "isp_lun_cmd failed");
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (isp_cv_wait_timed_rqe(isp, 30 * hz)) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"wait for MODIFY LUN timed out");
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
rstat = isp->isp_osinfo.rstatus;
|
|
|
|
if (rstat != LUN_OK) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"MODIFY LUN returned 0x%x", rstat);
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (IS_FC(isp) && lun) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
seq = isp->isp_osinfo.rollinfo++;
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
rstat = LUN_ERR;
|
|
|
|
cmd = -RQSTYPE_ENABLE_LUN;
|
|
|
|
if (isp_lun_cmd(isp, cmd, bus, tgt, lun, 0, 0, seq)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "isp_lun_cmd failed");
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (isp_cv_wait_timed_rqe(isp, 30 * hz)) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
"wait for DISABLE LUN timed out");
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
rstat = isp->isp_osinfo.rstatus;
|
|
|
|
if (rstat != LUN_OK) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
"DISABLE LUN returned 0x%x", rstat);
|
2000-01-03 23:55:30 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
isp_vsema_rqe(isp);
|
|
|
|
|
|
|
|
if (rstat != LUN_OK) {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"lun %sable failed", (cel->enable) ? "en" : "dis");
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
if (cel->enable)
|
|
|
|
destroy_lun_state(isp, tptr);
|
|
|
|
} else {
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO, lfmt,
|
|
|
|
(cel->enable) ? "en" : "dis", bus);
|
2000-01-03 23:55:30 +00:00
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
if (cel->enable == 0) {
|
|
|
|
destroy_lun_state(isp, tptr);
|
|
|
|
}
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static cam_status
|
|
|
|
isp_abort_tgt_ccb(struct ispsoftc *isp, union ccb *ccb)
|
|
|
|
{
|
|
|
|
tstate_t *tptr;
|
|
|
|
struct ccb_hdr_slist *lp;
|
|
|
|
struct ccb_hdr *curelm;
|
|
|
|
int found;
|
|
|
|
union ccb *accb = ccb->cab.abort_ccb;
|
|
|
|
|
|
|
|
if (accb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
|
|
|
|
if (IS_FC(isp) && (accb->ccb_h.target_id !=
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopid)) {
|
|
|
|
return (CAM_PATH_INVALID);
|
|
|
|
} else if (IS_SCSI(isp) && (accb->ccb_h.target_id !=
|
|
|
|
((sdparam *) isp->isp_param)->isp_initiator_id)) {
|
|
|
|
return (CAM_PATH_INVALID);
|
|
|
|
}
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = get_lun_statep(isp, XS_CHANNEL(ccb), accb->ccb_h.target_lun);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (tptr == NULL) {
|
|
|
|
return (CAM_PATH_INVALID);
|
|
|
|
}
|
|
|
|
if (accb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) {
|
|
|
|
lp = &tptr->atios;
|
|
|
|
} else if (accb->ccb_h.func_code == XPT_IMMED_NOTIFY) {
|
|
|
|
lp = &tptr->inots;
|
|
|
|
} else {
|
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
return (CAM_UA_ABORT);
|
|
|
|
}
|
|
|
|
curelm = SLIST_FIRST(lp);
|
|
|
|
found = 0;
|
|
|
|
if (curelm == &accb->ccb_h) {
|
|
|
|
found = 1;
|
|
|
|
SLIST_REMOVE_HEAD(lp, sim_links.sle);
|
|
|
|
} else {
|
|
|
|
while(curelm != NULL) {
|
|
|
|
struct ccb_hdr *nextelm;
|
|
|
|
|
|
|
|
nextelm = SLIST_NEXT(curelm, sim_links.sle);
|
|
|
|
if (nextelm == &accb->ccb_h) {
|
|
|
|
found = 1;
|
|
|
|
SLIST_NEXT(curelm, sim_links.sle) =
|
|
|
|
SLIST_NEXT(nextelm, sim_links.sle);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
curelm = nextelm;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
if (found) {
|
|
|
|
accb->ccb_h.status = CAM_REQ_ABORTED;
|
|
|
|
return (CAM_REQ_CMP);
|
|
|
|
}
|
|
|
|
return(CAM_PATH_INVALID);
|
|
|
|
}
|
|
|
|
|
|
|
|
static cam_status
|
|
|
|
isp_target_start_ctio(struct ispsoftc *isp, union ccb *ccb)
|
|
|
|
{
|
|
|
|
void *qe;
|
2000-01-15 01:50:48 +00:00
|
|
|
struct ccb_scsiio *cso = &ccb->csio;
|
2001-03-02 06:28:55 +00:00
|
|
|
u_int16_t *hp, save_handle;
|
2000-01-03 23:55:30 +00:00
|
|
|
u_int16_t iptr, optr;
|
|
|
|
|
2000-07-18 06:58:28 +00:00
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
if (isp_getrqentry(isp, &iptr, &optr, &qe)) {
|
2000-01-04 03:45:49 +00:00
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
|
|
|
printf("Request Queue Overflow in isp_target_start_ctio\n");
|
2000-01-03 23:55:30 +00:00
|
|
|
return (CAM_RESRC_UNAVAIL);
|
|
|
|
}
|
2000-01-04 03:45:49 +00:00
|
|
|
bzero(qe, QENTRY_LEN);
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We're either moving data or completing a command here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (IS_FC(isp)) {
|
2000-07-18 06:58:28 +00:00
|
|
|
struct ccb_accept_tio *atiop;
|
2000-01-03 23:55:30 +00:00
|
|
|
ct2_entry_t *cto = qe;
|
2000-01-15 01:50:48 +00:00
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
|
|
|
|
cto->ct_header.rqs_entry_count = 1;
|
2000-01-15 01:50:48 +00:00
|
|
|
cto->ct_iid = cso->init_id;
|
2000-06-18 04:50:26 +00:00
|
|
|
if (isp->isp_maxluns <= 16) {
|
|
|
|
cto->ct_lun = ccb->ccb_h.target_lun;
|
|
|
|
}
|
2000-07-18 06:58:28 +00:00
|
|
|
/*
|
|
|
|
* Start with a residual based on what the original datalength
|
|
|
|
* was supposed to be. Basically, we ignore what CAM has set
|
|
|
|
* for residuals. The data transfer routines will knock off
|
|
|
|
* the residual for each byte actually moved- and also will
|
|
|
|
* be responsible for setting the underrun flag.
|
|
|
|
*/
|
|
|
|
/* HACK! HACK! */
|
|
|
|
if ((atiop = ccb->ccb_h.periph_priv.entries[1].ptr) != NULL) {
|
|
|
|
cto->ct_resid = atiop->ccb_h.spriv_field0;
|
|
|
|
}
|
|
|
|
|
2000-01-15 01:50:48 +00:00
|
|
|
cto->ct_rxid = cso->tag_id;
|
|
|
|
if (cso->dxfer_len == 0) {
|
|
|
|
cto->ct_flags |= CT2_FLAG_MODE1 | CT2_NO_DATA;
|
2000-07-18 06:58:28 +00:00
|
|
|
if (ccb->ccb_h.flags & CAM_SEND_STATUS) {
|
|
|
|
cto->ct_flags |= CT2_SENDSTATUS;
|
|
|
|
cto->rsp.m1.ct_scsi_status = cso->scsi_status;
|
|
|
|
}
|
2000-01-15 01:50:48 +00:00
|
|
|
if ((ccb->ccb_h.flags & CAM_SEND_SENSE) != 0) {
|
|
|
|
int m = min(cso->sense_len, MAXRESPLEN);
|
|
|
|
bcopy(&cso->sense_data, cto->rsp.m1.ct_resp, m);
|
|
|
|
cto->rsp.m1.ct_senselen = m;
|
|
|
|
cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cto->ct_flags |= CT2_FLAG_MODE0;
|
|
|
|
if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
|
|
|
cto->ct_flags |= CT2_DATA_IN;
|
|
|
|
} else {
|
|
|
|
cto->ct_flags |= CT2_DATA_OUT;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2000-01-15 01:50:48 +00:00
|
|
|
if ((ccb->ccb_h.flags & CAM_SEND_STATUS) != 0) {
|
|
|
|
cto->ct_flags |= CT2_SENDSTATUS;
|
|
|
|
cto->rsp.m0.ct_scsi_status = cso->scsi_status;
|
2000-01-04 03:45:49 +00:00
|
|
|
}
|
2000-07-18 06:58:28 +00:00
|
|
|
/*
|
|
|
|
* If we're sending data and status back together,
|
|
|
|
* we can't also send back sense data as well.
|
|
|
|
*/
|
2000-01-15 01:50:48 +00:00
|
|
|
ccb->ccb_h.flags &= ~CAM_SEND_SENSE;
|
|
|
|
}
|
2001-03-21 00:46:44 +00:00
|
|
|
if (cto->ct_flags & CT2_SENDSTATUS) {
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG1,
|
2001-03-02 06:28:55 +00:00
|
|
|
"CTIO2[%x] SCSI STATUS 0x%x datalength %u",
|
2000-08-01 06:31:44 +00:00
|
|
|
cto->ct_rxid, cso->scsi_status, cto->ct_resid);
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
if (cto->ct_flags & CT2_SENDSTATUS)
|
|
|
|
cto->ct_flags |= CT2_CCINCR;
|
|
|
|
cto->ct_timeout = 10;
|
2001-03-02 06:28:55 +00:00
|
|
|
hp = &cto->ct_syshandle;
|
2000-01-03 23:55:30 +00:00
|
|
|
} else {
|
|
|
|
ct_entry_t *cto = qe;
|
2000-01-15 01:50:48 +00:00
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO;
|
|
|
|
cto->ct_header.rqs_entry_count = 1;
|
2000-01-15 01:50:48 +00:00
|
|
|
cto->ct_iid = cso->init_id;
|
2001-04-04 21:58:29 +00:00
|
|
|
cto->ct_iid |= XS_CHANNEL(ccb) << 7;
|
2000-01-03 23:55:30 +00:00
|
|
|
cto->ct_tgt = ccb->ccb_h.target_id;
|
|
|
|
cto->ct_lun = ccb->ccb_h.target_lun;
|
2001-04-04 21:58:29 +00:00
|
|
|
cto->ct_fwhandle = AT_GET_HANDLE(cso->tag_id);
|
|
|
|
if (AT_HAS_TAG(cso->tag_id)) {
|
|
|
|
cto->ct_tag_val = (u_int8_t) AT_GET_TAG(cso->tag_id);
|
2000-07-18 06:58:28 +00:00
|
|
|
cto->ct_flags |= CT_TQAE;
|
|
|
|
}
|
|
|
|
if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) {
|
|
|
|
cto->ct_flags |= CT_NODISC;
|
|
|
|
}
|
|
|
|
if (cso->dxfer_len == 0) {
|
2000-01-03 23:55:30 +00:00
|
|
|
cto->ct_flags |= CT_NO_DATA;
|
2000-01-15 01:50:48 +00:00
|
|
|
} else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
|
|
|
cto->ct_flags |= CT_DATA_IN;
|
|
|
|
} else {
|
|
|
|
cto->ct_flags |= CT_DATA_OUT;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2000-07-18 06:58:28 +00:00
|
|
|
if (ccb->ccb_h.flags & CAM_SEND_STATUS) {
|
2000-01-03 23:55:30 +00:00
|
|
|
cto->ct_flags |= CT_SENDSTATUS;
|
2000-01-15 01:50:48 +00:00
|
|
|
cto->ct_scsi_status = cso->scsi_status;
|
|
|
|
cto->ct_resid = cso->resid;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2001-03-21 00:46:44 +00:00
|
|
|
if (cto->ct_flags & CT_SENDSTATUS) {
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG1,
|
|
|
|
"CTIO[%x] SCSI STATUS 0x%x resid %d tag_id %x",
|
|
|
|
cto->ct_fwhandle, cso->scsi_status, cso->resid,
|
|
|
|
cso->tag_id);
|
2000-01-04 03:45:49 +00:00
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
cto->ct_timeout = 10;
|
2001-03-02 06:28:55 +00:00
|
|
|
hp = &cto->ct_syshandle;
|
2000-01-15 01:50:48 +00:00
|
|
|
ccb->ccb_h.flags &= ~CAM_SEND_SENSE;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (cto->ct_flags & CT_SENDSTATUS)
|
2001-04-04 21:58:29 +00:00
|
|
|
cto->ct_flags |= CT_CCINCR;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
|
2000-08-01 06:31:44 +00:00
|
|
|
if (isp_save_xs(isp, (XS_T *)ccb, hp)) {
|
2000-01-04 03:45:49 +00:00
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
|
|
|
printf("No XFLIST pointers for isp_target_start_ctio\n");
|
2000-01-03 23:55:30 +00:00
|
|
|
return (CAM_RESRC_UNAVAIL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call the dma setup routines for this entry (and any subsequent
|
|
|
|
* CTIOs) if there's data to move, and then tell the f/w it's got
|
2000-08-01 06:31:44 +00:00
|
|
|
* new things to play with. As with isp_start's usage of DMA setup,
|
2000-01-03 23:55:30 +00:00
|
|
|
* any swizzling is done in the machine dependent layer. Because
|
|
|
|
* of this, we put the request onto the queue area first in native
|
|
|
|
* format.
|
|
|
|
*/
|
|
|
|
|
|
|
|
save_handle = *hp;
|
2001-04-04 21:58:29 +00:00
|
|
|
|
2000-01-15 01:50:48 +00:00
|
|
|
switch (ISP_DMASETUP(isp, cso, qe, &iptr, optr)) {
|
2000-01-03 23:55:30 +00:00
|
|
|
case CMD_QUEUED:
|
|
|
|
ISP_ADD_REQUEST(isp, iptr);
|
|
|
|
return (CAM_REQ_INPROG);
|
|
|
|
|
|
|
|
case CMD_EAGAIN:
|
|
|
|
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
|
|
|
isp_destroy_handle(isp, save_handle);
|
|
|
|
return (CAM_RESRC_UNAVAIL);
|
|
|
|
|
|
|
|
default:
|
|
|
|
isp_destroy_handle(isp, save_handle);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
return (XS_ERR(ccb));
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
static void
|
|
|
|
isp_refire_putback_atio(void *arg)
|
2000-07-18 06:58:28 +00:00
|
|
|
{
|
2001-04-04 21:58:29 +00:00
|
|
|
int s = splcam();
|
|
|
|
isp_target_putback_atio(arg);
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_target_putback_atio(union ccb *ccb)
|
|
|
|
{
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
struct ccb_scsiio *cso;
|
2000-07-18 06:58:28 +00:00
|
|
|
u_int16_t iptr, optr;
|
2001-04-04 21:58:29 +00:00
|
|
|
void *qe;
|
|
|
|
|
|
|
|
isp = XS_ISP(ccb);
|
2000-07-18 06:58:28 +00:00
|
|
|
|
|
|
|
if (isp_getrqentry(isp, &iptr, &optr, &qe)) {
|
2001-04-04 21:58:29 +00:00
|
|
|
(void) timeout(isp_refire_putback_atio, ccb, 10);
|
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"isp_target_putback_atio: Request Queue Overflow");
|
|
|
|
return;
|
2000-07-18 06:58:28 +00:00
|
|
|
}
|
|
|
|
bzero(qe, QENTRY_LEN);
|
2001-04-04 21:58:29 +00:00
|
|
|
cso = &ccb->csio;
|
2000-07-18 06:58:28 +00:00
|
|
|
if (IS_FC(isp)) {
|
|
|
|
at2_entry_t *at = qe;
|
|
|
|
at->at_header.rqs_entry_type = RQSTYPE_ATIO2;
|
|
|
|
at->at_header.rqs_entry_count = 1;
|
|
|
|
if (isp->isp_maxluns > 16) {
|
2001-04-04 21:58:29 +00:00
|
|
|
at->at_scclun = (uint16_t) ccb->ccb_h.target_lun;
|
2000-07-18 06:58:28 +00:00
|
|
|
} else {
|
2001-04-04 21:58:29 +00:00
|
|
|
at->at_lun = (uint8_t) ccb->ccb_h.target_lun;
|
2000-07-18 06:58:28 +00:00
|
|
|
}
|
|
|
|
at->at_status = CT_OK;
|
2001-04-04 21:58:29 +00:00
|
|
|
at->at_rxid = cso->tag_id;
|
2000-07-18 06:58:28 +00:00
|
|
|
ISP_SWIZ_ATIO2(isp, qe, qe);
|
|
|
|
} else {
|
|
|
|
at_entry_t *at = qe;
|
|
|
|
at->at_header.rqs_entry_type = RQSTYPE_ATIO;
|
|
|
|
at->at_header.rqs_entry_count = 1;
|
2001-04-04 21:58:29 +00:00
|
|
|
at->at_iid = cso->init_id;
|
|
|
|
at->at_iid |= XS_CHANNEL(ccb) << 7;
|
|
|
|
at->at_tgt = cso->ccb_h.target_id;
|
|
|
|
at->at_lun = cso->ccb_h.target_lun;
|
2000-07-18 06:58:28 +00:00
|
|
|
at->at_status = CT_OK;
|
2001-04-04 21:58:29 +00:00
|
|
|
at->at_tag_val = AT_GET_TAG(cso->tag_id);
|
|
|
|
at->at_handle = AT_GET_HANDLE(cso->tag_id);
|
2000-07-18 06:58:28 +00:00
|
|
|
ISP_SWIZ_ATIO(isp, qe, qe);
|
|
|
|
}
|
|
|
|
ISP_TDQE(isp, "isp_target_putback_atio", (int) optr, qe);
|
|
|
|
ISP_ADD_REQUEST(isp, iptr);
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_complete_ctio(ccb);
|
2000-07-18 06:58:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_complete_ctio(union ccb *ccb)
|
2000-07-18 06:58:28 +00:00
|
|
|
{
|
2001-04-04 21:58:29 +00:00
|
|
|
struct ispsoftc *isp = XS_ISP(ccb);
|
|
|
|
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) {
|
|
|
|
ccb->ccb_h.status |= CAM_REQ_CMP;
|
2000-07-18 06:58:28 +00:00
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
|
|
|
|
if (isp->isp_osinfo.simqfrozen & SIMQFRZ_RESOURCE) {
|
|
|
|
isp->isp_osinfo.simqfrozen &= ~SIMQFRZ_RESOURCE;
|
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG2, "ctio->relsimq");
|
|
|
|
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
|
|
|
|
} else {
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "ctio->devqfrozen");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"ctio->simqfrozen(%x)", isp->isp_osinfo.simqfrozen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xpt_done(ccb);
|
2000-07-18 06:58:28 +00:00
|
|
|
}
|
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
/*
|
|
|
|
* Handle ATIO stuff that the generic code can't.
|
|
|
|
* This means handling CDBs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_handle_platform_atio(struct ispsoftc *isp, at_entry_t *aep)
|
|
|
|
{
|
|
|
|
tstate_t *tptr;
|
2001-04-04 21:58:29 +00:00
|
|
|
int status, bus;
|
2000-01-03 23:55:30 +00:00
|
|
|
struct ccb_accept_tio *atiop;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The firmware status (except for the QLTM_SVALID bit)
|
|
|
|
* indicates why this ATIO was sent to us.
|
|
|
|
*
|
|
|
|
* If QLTM_SVALID is set, the firware has recommended Sense Data.
|
|
|
|
*
|
|
|
|
* If the DISCONNECTS DISABLED bit is set in the flags field,
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
* we're still connected on the SCSI bus.
|
2000-01-03 23:55:30 +00:00
|
|
|
*/
|
|
|
|
status = aep->at_status;
|
|
|
|
if ((status & ~QLTM_SVALID) == AT_PHASE_ERROR) {
|
|
|
|
/*
|
|
|
|
* Bus Phase Sequence error. We should have sense data
|
|
|
|
* suggested by the f/w. I'm not sure quite yet what
|
|
|
|
* to do about this for CAM.
|
|
|
|
*/
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN, "PHASE ERROR");
|
2000-01-03 23:55:30 +00:00
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
if ((status & ~QLTM_SVALID) != AT_CDB) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN, "bad atio (0x%x) leaked to platform",
|
2001-03-01 02:14:54 +00:00
|
|
|
status);
|
2000-01-03 23:55:30 +00:00
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
bus = GET_BUS_VAL(aep->at_iid);
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = get_lun_statep(isp, bus, aep->at_lun);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (tptr == NULL) {
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = get_lun_statep(isp, bus, CAM_LUN_WILDCARD);
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tptr == NULL) {
|
|
|
|
/*
|
|
|
|
* Because we can't autofeed sense data back with
|
|
|
|
* a command for parallel SCSI, we can't give back
|
|
|
|
* a CHECK CONDITION. We'll give back a BUSY status
|
|
|
|
* instead. This works out okay because the only
|
|
|
|
* time we should, in fact, get this, is in the
|
|
|
|
* case that somebody configured us without the
|
|
|
|
* blackhole driver, so they get what they deserve.
|
|
|
|
*/
|
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios);
|
|
|
|
if (atiop == NULL) {
|
|
|
|
/*
|
|
|
|
* Because we can't autofeed sense data back with
|
|
|
|
* a command for parallel SCSI, we can't give back
|
|
|
|
* a CHECK CONDITION. We'll give back a QUEUE FULL status
|
|
|
|
* instead. This works out okay because the only time we
|
|
|
|
* should, in fact, get this, is in the case that we've
|
|
|
|
* run out of ATIOS.
|
|
|
|
*/
|
|
|
|
xpt_print_path(tptr->owner);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
2001-04-04 21:58:29 +00:00
|
|
|
"no ATIOS for lun %d from initiator %d on channel %d",
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
aep->at_lun, GET_IID_VAL(aep->at_iid), bus);
|
2000-01-03 23:55:30 +00:00
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
if (aep->at_flags & AT_TQAE)
|
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_QUEUE_FULL, 0);
|
|
|
|
else
|
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
|
2001-04-04 21:58:29 +00:00
|
|
|
if (tptr == &isp->isp_osinfo.tsdflt[bus]) {
|
2000-01-03 23:55:30 +00:00
|
|
|
atiop->ccb_h.target_id = aep->at_tgt;
|
|
|
|
atiop->ccb_h.target_lun = aep->at_lun;
|
|
|
|
}
|
|
|
|
if (aep->at_flags & AT_NODISC) {
|
2000-07-18 06:58:28 +00:00
|
|
|
atiop->ccb_h.flags = CAM_DIS_DISCONNECT;
|
|
|
|
} else {
|
|
|
|
atiop->ccb_h.flags = 0;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
|
2000-07-18 06:58:28 +00:00
|
|
|
if (status & QLTM_SVALID) {
|
|
|
|
size_t amt = imin(QLTM_SENSELEN, sizeof (atiop->sense_data));
|
|
|
|
atiop->sense_len = amt;
|
|
|
|
MEMCPY(&atiop->sense_data, aep->at_sense, amt);
|
|
|
|
} else {
|
|
|
|
atiop->sense_len = 0;
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
atiop->init_id = GET_IID_VAL(aep->at_iid);
|
2000-01-03 23:55:30 +00:00
|
|
|
atiop->cdb_len = aep->at_cdblen;
|
|
|
|
MEMCPY(atiop->cdb_io.cdb_bytes, aep->at_cdb, aep->at_cdblen);
|
|
|
|
atiop->ccb_h.status = CAM_CDB_RECVD;
|
2001-04-04 21:58:29 +00:00
|
|
|
/*
|
|
|
|
* Construct a tag 'id' based upon tag value (which may be 0..255)
|
|
|
|
* and the handle (which we have to preserve).
|
|
|
|
*/
|
|
|
|
AT_MAKE_TAGID(atiop->tag_id, aep);
|
|
|
|
if (aep->at_flags & AT_TQAE) {
|
|
|
|
atiop->tag_action = aep->at_tag_type;
|
2000-01-03 23:55:30 +00:00
|
|
|
atiop->ccb_h.status |= CAM_TAG_ACTION_VALID;
|
|
|
|
}
|
|
|
|
xpt_done((union ccb*)atiop);
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG1,
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
"ATIO[%x] CDB=0x%x bus %d iid%d->lun%d tag 0x%x ttype 0x%x %s",
|
|
|
|
aep->at_handle, aep->at_cdb[0] & 0xff, GET_BUS_VAL(aep->at_iid),
|
|
|
|
GET_IID_VAL(aep->at_iid), aep->at_lun, aep->at_tag_val & 0xff,
|
|
|
|
aep->at_tag_type, (aep->at_flags & AT_NODISC)?
|
|
|
|
"nondisc" : "disconnecting");
|
2000-01-03 23:55:30 +00:00
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_handle_platform_atio2(struct ispsoftc *isp, at2_entry_t *aep)
|
|
|
|
{
|
2000-01-04 03:45:49 +00:00
|
|
|
lun_id_t lun;
|
2000-01-03 23:55:30 +00:00
|
|
|
tstate_t *tptr;
|
|
|
|
struct ccb_accept_tio *atiop;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The firmware status (except for the QLTM_SVALID bit)
|
|
|
|
* indicates why this ATIO was sent to us.
|
|
|
|
*
|
|
|
|
* If QLTM_SVALID is set, the firware has recommended Sense Data.
|
|
|
|
*/
|
|
|
|
if ((aep->at_status & ~QLTM_SVALID) != AT_CDB) {
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"bogus atio (0x%x) leaked to platform", aep->at_status);
|
2000-01-03 23:55:30 +00:00
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-06-18 04:50:26 +00:00
|
|
|
if (isp->isp_maxluns > 16) {
|
|
|
|
lun = aep->at_scclun;
|
|
|
|
} else {
|
|
|
|
lun = aep->at_lun;
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = get_lun_statep(isp, 0, lun);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (tptr == NULL) {
|
2001-04-04 21:58:29 +00:00
|
|
|
tptr = get_lun_statep(isp, 0, CAM_LUN_WILDCARD);
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tptr == NULL) {
|
Fix breakage to target mode support.
What we'd like to know is whether or not we have a listener
upstream that really hasn't configured yet. If we do, then
we can give a more sensible reply here. If not, then we can
reject this out of hand.
Choices for what to send were
Not Ready, Unit Not Self-Configured Yet
(0x2,0x3e,0x00)
for the former and
Illegal Request, Logical Unit Not Supported
(0x5,0x25,0x00)
for the latter.
We used to decide whether there was at least one listener
based upon whether the black hole driver was configured.
However, recent config(8) changes have made this hard to do
at this time.
Actually, we didn't use the above quite yet, but were sure considering it.
2000-06-12 23:08:31 +00:00
|
|
|
/*
|
|
|
|
* What we'd like to know is whether or not we have a listener
|
|
|
|
* upstream that really hasn't configured yet. If we do, then
|
|
|
|
* we can give a more sensible reply here. If not, then we can
|
|
|
|
* reject this out of hand.
|
|
|
|
*
|
|
|
|
* Choices for what to send were
|
|
|
|
*
|
|
|
|
* Not Ready, Unit Not Self-Configured Yet
|
|
|
|
* (0x2,0x3e,0x00)
|
|
|
|
*
|
|
|
|
* for the former and
|
|
|
|
*
|
|
|
|
* Illegal Request, Logical Unit Not Supported
|
|
|
|
* (0x5,0x25,0x00)
|
|
|
|
*
|
|
|
|
* for the latter.
|
|
|
|
*
|
|
|
|
* We used to decide whether there was at least one listener
|
|
|
|
* based upon whether the black hole driver was configured.
|
|
|
|
* However, recent config(8) changes have made this hard to do
|
|
|
|
* at this time.
|
|
|
|
*
|
|
|
|
*/
|
2000-01-03 23:55:30 +00:00
|
|
|
u_int32_t ccode = SCSI_STATUS_BUSY;
|
Fix breakage to target mode support.
What we'd like to know is whether or not we have a listener
upstream that really hasn't configured yet. If we do, then
we can give a more sensible reply here. If not, then we can
reject this out of hand.
Choices for what to send were
Not Ready, Unit Not Self-Configured Yet
(0x2,0x3e,0x00)
for the former and
Illegal Request, Logical Unit Not Supported
(0x5,0x25,0x00)
for the latter.
We used to decide whether there was at least one listener
based upon whether the black hole driver was configured.
However, recent config(8) changes have made this hard to do
at this time.
Actually, we didn't use the above quite yet, but were sure considering it.
2000-06-12 23:08:31 +00:00
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
/*
|
|
|
|
* Because we can't autofeed sense data back with
|
|
|
|
* a command for parallel SCSI, we can't give back
|
|
|
|
* a CHECK CONDITION. We'll give back a BUSY status
|
|
|
|
* instead. This works out okay because the only
|
|
|
|
* time we should, in fact, get this, is in the
|
|
|
|
* case that somebody configured us without the
|
|
|
|
* blackhole driver, so they get what they deserve.
|
|
|
|
*/
|
|
|
|
isp_endcmd(isp, aep, ccode, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios);
|
|
|
|
if (atiop == NULL) {
|
|
|
|
/*
|
|
|
|
* Because we can't autofeed sense data back with
|
|
|
|
* a command for parallel SCSI, we can't give back
|
|
|
|
* a CHECK CONDITION. We'll give back a QUEUE FULL status
|
|
|
|
* instead. This works out okay because the only time we
|
|
|
|
* should, in fact, get this, is in the case that we've
|
|
|
|
* run out of ATIOS.
|
|
|
|
*/
|
|
|
|
xpt_print_path(tptr->owner);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"no ATIOS for lun %d from initiator %d", lun, aep->at_iid);
|
2000-01-03 23:55:30 +00:00
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
if (aep->at_flags & AT_TQAE)
|
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_QUEUE_FULL, 0);
|
|
|
|
else
|
|
|
|
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
|
2000-07-18 06:58:28 +00:00
|
|
|
|
2001-04-04 21:58:29 +00:00
|
|
|
if (tptr == &isp->isp_osinfo.tsdflt[0]) {
|
2000-01-03 23:55:30 +00:00
|
|
|
atiop->ccb_h.target_id =
|
|
|
|
((fcparam *)isp->isp_param)->isp_loopid;
|
2000-01-04 03:45:49 +00:00
|
|
|
atiop->ccb_h.target_lun = lun;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2001-02-27 00:14:39 +00:00
|
|
|
/*
|
|
|
|
* We don't get 'suggested' sense data as we do with SCSI cards.
|
|
|
|
*/
|
|
|
|
atiop->sense_len = 0;
|
2000-07-18 06:58:28 +00:00
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
atiop->init_id = aep->at_iid;
|
|
|
|
atiop->cdb_len = ATIO2_CDBLEN;
|
|
|
|
MEMCPY(atiop->cdb_io.cdb_bytes, aep->at_cdb, ATIO2_CDBLEN);
|
|
|
|
atiop->ccb_h.status = CAM_CDB_RECVD;
|
|
|
|
atiop->tag_id = aep->at_rxid;
|
|
|
|
switch (aep->at_taskflags & ATIO2_TC_ATTR_MASK) {
|
|
|
|
case ATIO2_TC_ATTR_SIMPLEQ:
|
|
|
|
atiop->tag_action = MSG_SIMPLE_Q_TAG;
|
|
|
|
break;
|
|
|
|
case ATIO2_TC_ATTR_HEADOFQ:
|
|
|
|
atiop->tag_action = MSG_HEAD_OF_Q_TAG;
|
|
|
|
break;
|
|
|
|
case ATIO2_TC_ATTR_ORDERED:
|
|
|
|
atiop->tag_action = MSG_ORDERED_Q_TAG;
|
|
|
|
break;
|
|
|
|
case ATIO2_TC_ATTR_ACAQ: /* ?? */
|
|
|
|
case ATIO2_TC_ATTR_UNTAGGED:
|
|
|
|
default:
|
|
|
|
atiop->tag_action = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (atiop->tag_action != 0) {
|
|
|
|
atiop->ccb_h.status |= CAM_TAG_ACTION_VALID;
|
|
|
|
}
|
2000-07-18 06:58:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Preserve overall command datalength in private field.
|
|
|
|
*/
|
|
|
|
atiop->ccb_h.spriv_field0 = aep->at_datalen;
|
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
xpt_done((union ccb*)atiop);
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG1,
|
2001-03-02 06:28:55 +00:00
|
|
|
"ATIO2[%x] CDB=0x%x iid%d->lun%d tattr 0x%x datalen %u",
|
|
|
|
aep->at_rxid, aep->at_cdb[0] & 0xff, aep->at_iid,
|
2000-08-01 06:31:44 +00:00
|
|
|
lun, aep->at_taskflags, aep->at_datalen);
|
2000-01-03 23:55:30 +00:00
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2000-07-18 06:58:28 +00:00
|
|
|
isp_handle_platform_ctio(struct ispsoftc *isp, void *arg)
|
2000-01-03 23:55:30 +00:00
|
|
|
{
|
|
|
|
union ccb *ccb;
|
2001-04-04 21:58:29 +00:00
|
|
|
int sentstatus, ok, notify_cam, resid = 0;
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CTIO and CTIO2 are close enough....
|
|
|
|
*/
|
|
|
|
|
2001-03-02 06:28:55 +00:00
|
|
|
ccb = (union ccb *) isp_find_xs(isp, ((ct_entry_t *)arg)->ct_syshandle);
|
2000-01-03 23:55:30 +00:00
|
|
|
KASSERT((ccb != NULL), ("null ccb in isp_handle_platform_ctio"));
|
2001-03-02 06:28:55 +00:00
|
|
|
isp_destroy_handle(isp, ((ct_entry_t *)arg)->ct_syshandle);
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
if (IS_FC(isp)) {
|
|
|
|
ct2_entry_t *ct = arg;
|
|
|
|
sentstatus = ct->ct_flags & CT2_SENDSTATUS;
|
|
|
|
ok = (ct->ct_status & ~QLTM_SVALID) == CT_OK;
|
2001-04-04 21:58:29 +00:00
|
|
|
if (ok && sentstatus && (ccb->ccb_h.flags & CAM_SEND_SENSE)) {
|
2000-01-15 01:50:48 +00:00
|
|
|
ccb->ccb_h.status |= CAM_SENT_SENSE;
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG1,
|
|
|
|
"CTIO2[%x] sts 0x%x flg 0x%x sns %d %s",
|
2000-08-01 06:31:44 +00:00
|
|
|
ct->ct_rxid, ct->ct_status, ct->ct_flags,
|
2001-04-04 21:58:29 +00:00
|
|
|
(ccb->ccb_h.status & CAM_SENT_SENSE) != 0,
|
|
|
|
sentstatus? "FIN" : "MID");
|
|
|
|
notify_cam = ct->ct_header.rqs_seqno & 0x1;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) {
|
2001-04-04 21:58:29 +00:00
|
|
|
resid = ct->ct_resid;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
} else {
|
|
|
|
ct_entry_t *ct = arg;
|
|
|
|
sentstatus = ct->ct_flags & CT_SENDSTATUS;
|
|
|
|
ok = (ct->ct_status & ~QLTM_SVALID) == CT_OK;
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG1,
|
|
|
|
"CTIO[%x] tag %x iid %x tgt %d lun %d sts 0x%x flg %x %s",
|
|
|
|
ct->ct_fwhandle, ct->ct_tag_val, ct->ct_iid, ct->ct_tgt,
|
|
|
|
ct->ct_lun, ct->ct_status, ct->ct_flags,
|
|
|
|
sentstatus? "FIN" : "MID");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We *ought* to be able to get back to the original ATIO
|
|
|
|
* here, but for some reason this gets lost. It's just as
|
|
|
|
* well because it's squirrelled away as part of periph
|
|
|
|
* private data.
|
|
|
|
*
|
|
|
|
* We can live without it as long as we continue to use
|
|
|
|
* the auto-replenish feature for CTIOs.
|
|
|
|
*/
|
|
|
|
notify_cam = ct->ct_header.rqs_seqno & 0x1;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if (ct->ct_status & QLTM_SVALID) {
|
2001-04-04 21:58:29 +00:00
|
|
|
char *sp = (char *)ct;
|
|
|
|
sp += CTIO_SENSE_OFFSET;
|
|
|
|
ccb->csio.sense_len =
|
|
|
|
min(sizeof (ccb->csio.sense_data), QLTM_SENSELEN);
|
|
|
|
MEMCPY(&ccb->csio.sense_data, sp, ccb->csio.sense_len);
|
|
|
|
ccb->ccb_h.status |= CAM_AUTOSNS_VALID;
|
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
if ((ct->ct_flags & CT_DATAMASK) != CT_NO_DATA) {
|
2001-04-04 21:58:29 +00:00
|
|
|
resid = ct->ct_resid;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
ccb->csio.resid += resid;
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
/*
|
2001-04-04 21:58:29 +00:00
|
|
|
* We're here either because intermediate data transfers are done
|
|
|
|
* and/or the final status CTIO (which may have joined with a
|
|
|
|
* Data Transfer) is done.
|
2000-01-03 23:55:30 +00:00
|
|
|
*
|
|
|
|
* In any case, for this platform, the upper layers figure out
|
|
|
|
* what to do next, so all we do here is collect status and
|
2001-04-04 21:58:29 +00:00
|
|
|
* pass information along. Any DMA handles have already been
|
|
|
|
* freed.
|
2000-01-03 23:55:30 +00:00
|
|
|
*/
|
2000-07-18 06:58:28 +00:00
|
|
|
if (notify_cam == 0) {
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_prt(isp, ISP_LOGTDEBUG0, " INTER CTIO done");
|
2000-07-18 06:58:28 +00:00
|
|
|
return (0);
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
|
|
|
|
isp_prt(isp, ISP_LOGTDEBUG0, "%s CTIO done (resid %d)",
|
|
|
|
(sentstatus)? " FINAL " : "MIDTERM ", ccb->csio.resid);
|
|
|
|
|
|
|
|
if (!ok) {
|
|
|
|
isp_target_putback_atio(ccb);
|
2000-07-18 06:58:28 +00:00
|
|
|
} else {
|
2001-04-04 21:58:29 +00:00
|
|
|
isp_complete_ctio(ccb);
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
return (0);
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
static void
|
1999-01-30 07:29:00 +00:00
|
|
|
isp_cam_async(void *cbarg, u_int32_t code, struct cam_path *path, void *arg)
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
|
|
|
struct cam_sim *sim;
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
|
|
|
|
sim = (struct cam_sim *)cbarg;
|
|
|
|
isp = (struct ispsoftc *) cam_sim_softc(sim);
|
|
|
|
switch (code) {
|
|
|
|
case AC_LOST_DEVICE:
|
1999-10-17 18:50:47 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
u_int16_t oflags, nflags;
|
|
|
|
sdparam *sdp = isp->isp_param;
|
2001-04-04 21:58:29 +00:00
|
|
|
int tgt;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-12-20 01:35:04 +00:00
|
|
|
tgt = xpt_path_target_id(path);
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_LOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
sdp += cam_sim_bus(sim);
|
2001-04-04 21:58:29 +00:00
|
|
|
#ifndef ISP_TARGET_MODE
|
|
|
|
if (tgt == sdp->isp_initiator_id) {
|
|
|
|
nflags = DPARM_DEFAULT;
|
|
|
|
} else {
|
|
|
|
nflags = DPARM_SAFE_DFLT;
|
|
|
|
if (isp->isp_loaded_fw) {
|
|
|
|
nflags |= DPARM_NARROW | DPARM_ASYNC;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
2001-04-04 21:58:29 +00:00
|
|
|
#else
|
|
|
|
nflags = DPARM_DEFAULT;
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
oflags = sdp->isp_devparam[tgt].dev_flags;
|
|
|
|
sdp->isp_devparam[tgt].dev_flags = nflags;
|
|
|
|
sdp->isp_devparam[tgt].dev_update = 1;
|
2001-04-04 21:58:29 +00:00
|
|
|
isp->isp_update |= (1 << cam_sim_bus(sim));
|
1998-09-15 08:42:56 +00:00
|
|
|
(void) isp_control(isp, ISPCTL_UPDATE_PARAMS, NULL);
|
|
|
|
sdp->isp_devparam[tgt].dev_flags = oflags;
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN, "isp_cam_async: Code 0x%x", code);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-12-28 19:22:27 +00:00
|
|
|
isp_poll(struct cam_sim *sim)
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
2000-12-29 19:06:32 +00:00
|
|
|
struct ispsoftc *isp = cam_sim_softc(sim);
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
(void) isp_intr(isp);
|
|
|
|
ISP_UNLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#if 0
|
1999-08-16 20:11:45 +00:00
|
|
|
static void
|
|
|
|
isp_relsim(void *arg)
|
|
|
|
{
|
|
|
|
struct ispsoftc *isp = arg;
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_LOCK(isp);
|
1999-08-16 20:11:45 +00:00
|
|
|
if (isp->isp_osinfo.simqfrozen & SIMQFRZ_TIMED) {
|
|
|
|
int wasfrozen = isp->isp_osinfo.simqfrozen & SIMQFRZ_TIMED;
|
|
|
|
isp->isp_osinfo.simqfrozen &= ~SIMQFRZ_TIMED;
|
|
|
|
if (wasfrozen && isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2, "timed relsimq");
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
|
|
|
}
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#endif
|
1999-10-17 18:50:47 +00:00
|
|
|
|
2000-05-09 01:08:21 +00:00
|
|
|
static void
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
isp_watchdog(void *arg)
|
2000-05-09 01:08:21 +00:00
|
|
|
{
|
2000-08-01 06:31:44 +00:00
|
|
|
XS_T *xs = arg;
|
2000-05-09 01:08:21 +00:00
|
|
|
struct ispsoftc *isp = XS_ISP(xs);
|
|
|
|
u_int32_t handle;
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
|
2000-05-09 01:08:21 +00:00
|
|
|
/*
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
* We've decided this command is dead. Make sure we're not trying
|
|
|
|
* to kill a command that's already dead by getting it's handle and
|
|
|
|
* and seeing whether it's still alive.
|
2000-05-09 01:08:21 +00:00
|
|
|
*/
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_LOCK(isp);
|
2000-05-09 01:08:21 +00:00
|
|
|
handle = isp_find_handle(isp, xs);
|
|
|
|
if (handle) {
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
u_int16_t r;
|
|
|
|
|
|
|
|
if (XS_CMD_DONE_P(xs)) {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG1,
|
|
|
|
"watchdog found done cmd (handle 0x%x)", handle);
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (XS_CMD_WDOG_P(xs)) {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"recursive watchdog (handle 0x%x)", handle);
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
XS_CMD_S_WDOG(xs);
|
|
|
|
|
|
|
|
r = ISP_READ(isp, BIU_ISR);
|
|
|
|
|
|
|
|
if (INT_PENDING(isp, r) && isp_intr(isp) && XS_CMD_DONE_P(xs)) {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"watchdog cleanup (%x, %x)", handle, r);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
xpt_done((union ccb *) xs);
|
|
|
|
} else if (XS_CMD_GRACE_P(xs)) {
|
2000-07-05 06:44:17 +00:00
|
|
|
/*
|
|
|
|
* Make sure the command is *really* dead before we
|
|
|
|
* release the handle (and DMA resources) for reuse.
|
|
|
|
*/
|
|
|
|
(void) isp_control(isp, ISPCTL_ABORT_CMD, arg);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* After this point, the comamnd is really dead.
|
|
|
|
*/
|
2000-07-04 01:05:43 +00:00
|
|
|
if (XS_XFRLEN(xs)) {
|
|
|
|
ISP_DMAFREE(isp, xs, handle);
|
|
|
|
}
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
isp_destroy_handle(isp, handle);
|
|
|
|
xpt_print_path(xs->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"watchdog timeout (%x, %x)", handle, r);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
XS_SETERR(xs, CAM_CMD_TIMEOUT);
|
|
|
|
XS_CMD_C_WDOG(xs);
|
|
|
|
isp_done(xs);
|
|
|
|
} else {
|
|
|
|
u_int16_t iptr, optr;
|
|
|
|
ispreq_t *mp;
|
|
|
|
|
|
|
|
XS_CMD_C_WDOG(xs);
|
|
|
|
xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz);
|
|
|
|
if (isp_getrqentry(isp, &iptr, &optr, (void **) &mp)) {
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
XS_CMD_S_GRACE(xs);
|
|
|
|
MEMZERO((void *) mp, sizeof (*mp));
|
|
|
|
mp->req_header.rqs_entry_count = 1;
|
|
|
|
mp->req_header.rqs_entry_type = RQSTYPE_MARKER;
|
|
|
|
mp->req_modifier = SYNC_ALL;
|
|
|
|
mp->req_target = XS_CHANNEL(xs) << 7;
|
|
|
|
ISP_SWIZZLE_REQUEST(isp, mp);
|
|
|
|
ISP_ADD_REQUEST(isp, iptr);
|
|
|
|
}
|
|
|
|
} else {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2, "watchdog with no command");
|
2000-05-09 01:08:21 +00:00
|
|
|
}
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
2000-05-09 01:08:21 +00:00
|
|
|
}
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#ifdef ISP_SMPLOCK
|
|
|
|
static void
|
|
|
|
isp_kthread(void *arg)
|
|
|
|
{
|
|
|
|
int wasfrozen;
|
|
|
|
struct ispsoftc *isp = arg;
|
|
|
|
|
|
|
|
mtx_lock(&isp->isp_lock);
|
|
|
|
for (;;) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0, "kthread checking FC state");
|
|
|
|
while (isp_fc_runstate(isp, 2 * 1000000) != 0) {
|
|
|
|
#if 0
|
|
|
|
msleep(&lbolt, &isp->isp_lock,
|
|
|
|
PRIBIO, "isp_fcthrd", 0);
|
|
|
|
#else
|
|
|
|
msleep(isp_kthread, &isp->isp_lock,
|
|
|
|
PRIBIO, "isp_fcthrd", hz);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
wasfrozen = isp->isp_osinfo.simqfrozen & SIMQFRZ_LOOPDOWN;
|
|
|
|
isp->isp_osinfo.simqfrozen &= ~SIMQFRZ_LOOPDOWN;
|
|
|
|
if (wasfrozen && isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0, "kthread up release simq");
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
|
|
|
cv_wait(&isp->isp_osinfo.kthread_cv, &isp->isp_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static void
|
|
|
|
isp_kthread(void *arg)
|
|
|
|
{
|
|
|
|
int wasfrozen;
|
|
|
|
struct ispsoftc *isp = arg;
|
|
|
|
|
|
|
|
mtx_lock(&Giant);
|
|
|
|
for (;;) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0, "kthread checking FC state");
|
|
|
|
while (isp_fc_runstate(isp, 2 * 1000000) != 0) {
|
|
|
|
tsleep(isp_kthread, PRIBIO, "isp_fcthrd", hz);
|
|
|
|
}
|
|
|
|
wasfrozen = isp->isp_osinfo.simqfrozen & SIMQFRZ_LOOPDOWN;
|
|
|
|
isp->isp_osinfo.simqfrozen &= ~SIMQFRZ_LOOPDOWN;
|
|
|
|
if (wasfrozen && isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0, "kthread up release simq");
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
|
|
|
xpt_release_simq(isp->isp_sim, 1);
|
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
|
|
|
tsleep(&isp->isp_osinfo.kthread_cv, PRIBIO, "isp_fc_worker", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
static void
|
1998-12-28 19:22:27 +00:00
|
|
|
isp_action(struct cam_sim *sim, union ccb *ccb)
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
2000-07-04 01:05:43 +00:00
|
|
|
int bus, tgt, error;
|
1998-09-15 08:42:56 +00:00
|
|
|
struct ispsoftc *isp;
|
1998-10-15 23:46:33 +00:00
|
|
|
struct ccb_trans_settings *cts;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("isp_action\n"));
|
|
|
|
|
|
|
|
isp = (struct ispsoftc *)cam_sim_softc(sim);
|
|
|
|
ccb->ccb_h.sim_priv.entries[0].field = 0;
|
|
|
|
ccb->ccb_h.sim_priv.entries[1].ptr = isp;
|
1999-08-16 20:11:45 +00:00
|
|
|
if (isp->isp_state != ISP_RUNSTATE &&
|
|
|
|
ccb->ccb_h.func_code == XPT_SCSI_IO) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
isp_init(isp);
|
|
|
|
if (isp->isp_state != ISP_INITSTATE) {
|
2000-07-04 01:05:43 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Lie. Say it was a selection timeout.
|
|
|
|
*/
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
ccb->ccb_h.status = CAM_SEL_TIMEOUT | CAM_DEV_QFRZN;
|
1999-08-16 20:11:45 +00:00
|
|
|
xpt_freeze_devq(ccb->ccb_h.path, 1);
|
1999-03-17 05:04:39 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
isp->isp_state = ISP_RUNSTATE;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2, "isp_action code %x", ccb->ccb_h.func_code);
|
1998-09-15 08:42:56 +00:00
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
switch (ccb->ccb_h.func_code) {
|
|
|
|
case XPT_SCSI_IO: /* Execute the requested I/O operation */
|
|
|
|
/*
|
|
|
|
* Do a couple of preliminary checks...
|
|
|
|
*/
|
|
|
|
if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) {
|
|
|
|
if ((ccb->ccb_h.flags & CAM_CDB_PHYS) != 0) {
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-08-16 20:11:45 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (ccb->ccb_h.target_id > (ISP_MAX_TARGETS(isp) - 1)) {
|
|
|
|
ccb->ccb_h.status = CAM_PATH_INVALID;
|
|
|
|
} else if (ccb->ccb_h.target_lun > (ISP_MAX_LUNS(isp) - 1)) {
|
|
|
|
ccb->ccb_h.status = CAM_PATH_INVALID;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
if (ccb->ccb_h.status == CAM_PATH_INVALID) {
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"invalid tgt/lun (%d.%d) in XPT_SCSI_IO",
|
|
|
|
ccb->ccb_h.target_id, ccb->ccb_h.target_lun);
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
1999-08-16 20:11:45 +00:00
|
|
|
#endif
|
|
|
|
((struct ccb_scsiio *) ccb)->scsi_status = SCSI_STATUS_OK;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-08-01 06:31:44 +00:00
|
|
|
error = isp_start((XS_T *) ccb);
|
1999-08-16 20:11:45 +00:00
|
|
|
switch (error) {
|
1998-09-15 08:42:56 +00:00
|
|
|
case CMD_QUEUED:
|
|
|
|
ccb->ccb_h.status |= CAM_SIM_QUEUED;
|
2000-05-09 01:08:21 +00:00
|
|
|
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
|
2001-01-16 07:15:36 +00:00
|
|
|
u_int64_t ticks = (u_int64_t) hz;
|
2000-05-09 01:08:21 +00:00
|
|
|
if (ccb->ccb_h.timeout == CAM_TIME_DEFAULT)
|
2001-01-16 07:15:36 +00:00
|
|
|
ticks = 60 * 1000 * ticks;
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
else
|
|
|
|
ticks = ccb->ccb_h.timeout * hz;
|
|
|
|
ticks = ((ticks + 999) / 1000) + hz + hz;
|
2001-01-16 07:15:36 +00:00
|
|
|
if (ticks >= 0x80000000) {
|
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"timeout overflow");
|
|
|
|
ticks = 0x80000000;
|
|
|
|
}
|
|
|
|
ccb->ccb_h.timeout_ch = timeout(isp_watchdog,
|
|
|
|
(caddr_t)ccb, (int)ticks);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
} else {
|
|
|
|
callout_handle_init(&ccb->ccb_h.timeout_ch);
|
2000-05-09 01:08:21 +00:00
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
1999-08-16 20:11:45 +00:00
|
|
|
case CMD_RQLATER:
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#ifdef ISP_SMPLOCK
|
|
|
|
cv_signal(&isp->isp_osinfo.kthread_cv);
|
|
|
|
#else
|
|
|
|
wakeup(&isp->isp_osinfo.kthread_cv);
|
|
|
|
#endif
|
1999-08-16 20:11:45 +00:00
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"RQLATER freeze simq");
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#if 0
|
1999-08-16 20:11:45 +00:00
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_TIMED;
|
|
|
|
timeout(isp_relsim, isp, 500);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#else
|
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN;
|
|
|
|
#endif
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-16 19:52:22 +00:00
|
|
|
xpt_freeze_simq(sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
} else {
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-16 19:52:22 +00:00
|
|
|
}
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
XS_SETERR(ccb, CAM_REQUEUE_REQ);
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
1999-08-16 20:11:45 +00:00
|
|
|
case CMD_EAGAIN:
|
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
xpt_freeze_simq(sim, 1);
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"EAGAIN freeze simq");
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
1999-08-16 20:11:45 +00:00
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_RESOURCE;
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
XS_SETERR(ccb, CAM_REQUEUE_REQ);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
1999-08-16 20:11:45 +00:00
|
|
|
case CMD_COMPLETE:
|
|
|
|
isp_done((struct ccb_scsiio *) ccb);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-08-16 20:11:45 +00:00
|
|
|
break;
|
|
|
|
default:
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"What's this? 0x%x at %d in file %s",
|
2000-12-31 20:50:56 +00:00
|
|
|
error, __LINE__, __FILE__);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
XS_SETERR(ccb, CAM_REQ_CMP_ERR);
|
1999-08-16 20:11:45 +00:00
|
|
|
xpt_done(ccb);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
1998-09-15 08:42:56 +00:00
|
|
|
case XPT_EN_LUN: /* Enable LUN as a target */
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
isp_en_lun(isp, ccb);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
|
2000-01-03 23:55:30 +00:00
|
|
|
case XPT_NOTIFY_ACK: /* recycle notify ack */
|
|
|
|
case XPT_IMMED_NOTIFY: /* Add Immediate Notify Resource */
|
|
|
|
case XPT_ACCEPT_TARGET_IO: /* Add Accept Target IO Resource */
|
|
|
|
{
|
2001-04-04 21:58:29 +00:00
|
|
|
tstate_t *tptr =
|
|
|
|
get_lun_statep(isp, XS_CHANNEL(ccb), ccb->ccb_h.target_lun);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (tptr == NULL) {
|
|
|
|
ccb->ccb_h.status = CAM_LUN_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
2000-07-18 06:58:28 +00:00
|
|
|
ccb->ccb_h.sim_priv.entries[0].field = 0;
|
|
|
|
ccb->ccb_h.sim_priv.entries[1].ptr = isp;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
if (ccb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) {
|
|
|
|
SLIST_INSERT_HEAD(&tptr->atios,
|
|
|
|
&ccb->ccb_h, sim_links.sle);
|
|
|
|
} else {
|
|
|
|
SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h,
|
|
|
|
sim_links.sle);
|
|
|
|
}
|
|
|
|
rls_lun_statep(isp, tptr);
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INPROG;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XPT_CONT_TARGET_IO:
|
|
|
|
{
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = isp_target_start_ctio(isp, ccb);
|
|
|
|
if (ccb->ccb_h.status != CAM_REQ_INPROG) {
|
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
xpt_freeze_simq(sim, 1);
|
|
|
|
xpt_print_path(ccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO,
|
|
|
|
"XPT_CONT_TARGET_IO freeze simq");
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_RESOURCE;
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
XS_SETERR(ccb, CAM_REQUEUE_REQ);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
} else {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status |= CAM_SIM_QUEUED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
case XPT_RESET_DEV: /* BDR the specified SCSI device */
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
bus = cam_sim_bus(xpt_path_sim(ccb->ccb_h.path));
|
|
|
|
tgt = ccb->ccb_h.target_id;
|
|
|
|
tgt |= (bus << 16);
|
|
|
|
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
error = isp_control(isp, ISPCTL_RESET_DEV, &tgt);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
if (error) {
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
|
|
|
} else {
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
}
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
case XPT_ABORT: /* Abort the specified CCB */
|
2000-01-03 23:55:30 +00:00
|
|
|
{
|
|
|
|
union ccb *accb = ccb->cab.abort_ccb;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-01-03 23:55:30 +00:00
|
|
|
switch (accb->ccb_h.func_code) {
|
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
case XPT_ACCEPT_TARGET_IO:
|
|
|
|
case XPT_IMMED_NOTIFY:
|
|
|
|
ccb->ccb_h.status = isp_abort_tgt_ccb(isp, ccb);
|
|
|
|
break;
|
|
|
|
case XPT_CONT_TARGET_IO:
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "cannot abort CTIOs yet");
|
2000-01-03 23:55:30 +00:00
|
|
|
ccb->ccb_h.status = CAM_UA_ABORT;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case XPT_SCSI_IO:
|
|
|
|
error = isp_control(isp, ISPCTL_ABORT_CMD, ccb);
|
|
|
|
if (error) {
|
|
|
|
ccb->ccb_h.status = CAM_UA_ABORT;
|
|
|
|
} else {
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
break;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
2000-01-03 23:55:30 +00:00
|
|
|
}
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
#define IS_CURRENT_SETTINGS(c) (c->type == CTS_TYPE_CURRENT_SETTINGS)
|
|
|
|
#else
|
|
|
|
#define IS_CURRENT_SETTINGS(c) (c->flags & CCB_TRANS_CURRENT_SETTINGS)
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
case XPT_SET_TRAN_SETTINGS: /* Nexus Settings */
|
|
|
|
cts = &ccb->cts;
|
|
|
|
tgt = cts->ccb_h.target_id;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-10-17 18:50:47 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifndef CAM_NEW_TRAN_CODE
|
1998-09-15 08:42:56 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
|
|
|
u_int16_t *dptr;
|
2000-01-03 23:55:30 +00:00
|
|
|
|
|
|
|
bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path));
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-05-11 05:10:06 +00:00
|
|
|
sdp += bus;
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* We always update (internally) from dev_flags
|
|
|
|
* so any request to change settings just gets
|
|
|
|
* vectored to that location.
|
|
|
|
*/
|
|
|
|
dptr = &sdp->isp_devparam[tgt].dev_flags;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Note that these operations affect the
|
1999-03-25 22:52:45 +00:00
|
|
|
* the goal flags (dev_flags)- not
|
1998-09-15 08:42:56 +00:00
|
|
|
* the current state flags. Then we mark
|
|
|
|
* things so that the next operation to
|
|
|
|
* this HBA will cause the update to occur.
|
|
|
|
*/
|
|
|
|
if (cts->valid & CCB_TRANS_DISC_VALID) {
|
|
|
|
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0) {
|
|
|
|
*dptr |= DPARM_DISC;
|
|
|
|
} else {
|
|
|
|
*dptr &= ~DPARM_DISC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cts->valid & CCB_TRANS_TQ_VALID) {
|
|
|
|
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0) {
|
|
|
|
*dptr |= DPARM_TQING;
|
|
|
|
} else {
|
|
|
|
*dptr &= ~DPARM_TQING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cts->valid & CCB_TRANS_BUS_WIDTH_VALID) {
|
|
|
|
switch (cts->bus_width) {
|
|
|
|
case MSG_EXT_WDTR_BUS_16_BIT:
|
|
|
|
*dptr |= DPARM_WIDE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*dptr &= ~DPARM_WIDE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Any SYNC RATE of nonzero and SYNC_OFFSET
|
|
|
|
* of nonzero will cause us to go to the
|
|
|
|
* selected (from NVRAM) maximum value for
|
|
|
|
* this device. At a later point, we'll
|
|
|
|
* allow finer control.
|
|
|
|
*/
|
|
|
|
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) &&
|
|
|
|
(cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) &&
|
|
|
|
(cts->sync_offset > 0)) {
|
|
|
|
*dptr |= DPARM_SYNC;
|
|
|
|
} else {
|
|
|
|
*dptr &= ~DPARM_SYNC;
|
|
|
|
}
|
2000-02-15 00:52:52 +00:00
|
|
|
*dptr |= DPARM_SAFE_DFLT;
|
2001-07-04 18:54:29 +00:00
|
|
|
#else
|
|
|
|
struct ccb_trans_settings_scsi *scsi =
|
|
|
|
&cts->proto_specific.scsi;
|
|
|
|
struct ccb_trans_settings_spi *spi =
|
|
|
|
&cts->xport_specific.spi;
|
|
|
|
sdparam *sdp = isp->isp_param;
|
|
|
|
u_int16_t *dptr;
|
|
|
|
|
|
|
|
bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path));
|
|
|
|
sdp += bus;
|
|
|
|
/*
|
|
|
|
* We always update (internally) from dev_flags
|
|
|
|
* so any request to change settings just gets
|
|
|
|
* vectored to that location.
|
|
|
|
*/
|
|
|
|
dptr = &sdp->isp_devparam[tgt].dev_flags;
|
|
|
|
|
|
|
|
if ((spi->valid & CTS_SPI_VALID_DISC) != 0) {
|
|
|
|
if ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) != 0)
|
|
|
|
*dptr |= DPARM_DISC;
|
|
|
|
else
|
|
|
|
*dptr &= ~DPARM_DISC;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((scsi->valid & CTS_SCSI_VALID_TQ) != 0) {
|
|
|
|
if ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0)
|
|
|
|
*dptr |= DPARM_TQING;
|
|
|
|
else
|
|
|
|
*dptr &= ~DPARM_TQING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) {
|
|
|
|
if (spi->bus_width == MSG_EXT_WDTR_BUS_16_BIT)
|
|
|
|
*dptr |= DPARM_WIDE;
|
|
|
|
else
|
|
|
|
*dptr &= ~DPARM_WIDE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX: FIX ME
|
|
|
|
*/
|
|
|
|
if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) &&
|
|
|
|
(spi->valid & CTS_SPI_VALID_SYNC_RATE)) {
|
|
|
|
*dptr |= DPARM_SYNC;
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0,
|
|
|
|
"enabling synchronous mode, but ignoring "
|
|
|
|
"setting to period 0x%x offset 0x%x",
|
|
|
|
spi->sync_period, spi->sync_offset);
|
|
|
|
} else if (spi->sync_period && spi->sync_offset) {
|
|
|
|
*dptr |= DPARM_SYNC;
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0,
|
|
|
|
"enabling synchronous mode (1), but ignoring"
|
|
|
|
" setting to period 0x%x offset 0x%x",
|
|
|
|
spi->sync_period, spi->sync_offset);
|
|
|
|
} else {
|
|
|
|
*dptr &= ~DPARM_SYNC;
|
|
|
|
}
|
|
|
|
#endif
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG0,
|
|
|
|
"%d.%d set %s period 0x%x offset 0x%x flags 0x%x",
|
2001-07-04 18:54:29 +00:00
|
|
|
bus, tgt, IS_CURRENT_SETTINGS(cts)? "current" :
|
|
|
|
"user", sdp->isp_devparam[tgt].sync_period,
|
2000-12-05 07:39:54 +00:00
|
|
|
sdp->isp_devparam[tgt].sync_offset,
|
|
|
|
sdp->isp_devparam[tgt].dev_flags);
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp->isp_devparam[tgt].dev_update = 1;
|
1999-05-11 05:10:06 +00:00
|
|
|
isp->isp_update |= (1 << bus);
|
2001-07-04 18:54:29 +00:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* What, if anything, are we supposed to do?
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
case XPT_GET_TRAN_SETTINGS:
|
|
|
|
cts = &ccb->cts;
|
|
|
|
tgt = cts->ccb_h.target_id;
|
2001-07-04 18:54:29 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-10-17 18:50:47 +00:00
|
|
|
if (IS_FC(isp)) {
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifndef CAM_NEW_TRAN_CODE
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* a lot of normal SCSI things don't make sense.
|
|
|
|
*/
|
|
|
|
cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB;
|
|
|
|
cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
|
|
|
/*
|
|
|
|
* How do you measure the width of a high
|
|
|
|
* speed serial bus? Well, in bytes.
|
|
|
|
*
|
|
|
|
* Offset and period make no sense, though, so we set
|
|
|
|
* (above) a 'base' transfer speed to be gigabit.
|
|
|
|
*/
|
|
|
|
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
2001-07-04 18:54:29 +00:00
|
|
|
#else
|
|
|
|
fcparam *fcp = isp->isp_param;
|
|
|
|
struct ccb_trans_settings_fc *fc =
|
|
|
|
&cts->xport_specific.fc;
|
|
|
|
|
|
|
|
cts->protocol = PROTO_SCSI;
|
|
|
|
cts->protocol_version = SCSI_REV_2;
|
|
|
|
cts->transport = XPORT_FC;
|
|
|
|
cts->transport_version = 0;
|
|
|
|
|
|
|
|
fc->valid = CTS_FC_VALID_SPEED;
|
|
|
|
fc->bitrate = 100000;
|
|
|
|
if (tgt > 0 && tgt < MAX_FC_TARG) {
|
|
|
|
struct lportdb *lp = &fcp->portdb[tgt];
|
|
|
|
fc->wwnn = lp->node_wwn;
|
|
|
|
fc->wwpn = lp->port_wwn;
|
|
|
|
fc->port = lp->portid;
|
|
|
|
fc->valid |= CTS_FC_VALID_WWNN |
|
|
|
|
CTS_FC_VALID_WWPN | CTS_FC_VALID_PORT;
|
|
|
|
}
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
} else {
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
struct ccb_trans_settings_scsi *scsi =
|
|
|
|
&cts->proto_specific.scsi;
|
|
|
|
struct ccb_trans_settings_spi *spi =
|
|
|
|
&cts->xport_specific.spi;
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
1999-05-11 05:10:06 +00:00
|
|
|
int bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path));
|
2001-07-04 18:54:29 +00:00
|
|
|
u_int16_t dval, pval, oval;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-05-11 05:10:06 +00:00
|
|
|
sdp += bus;
|
2001-07-04 18:54:29 +00:00
|
|
|
|
|
|
|
if (IS_CURRENT_SETTINGS(cts)) {
|
1999-05-12 19:00:16 +00:00
|
|
|
sdp->isp_devparam[tgt].dev_refresh = 1;
|
|
|
|
isp->isp_update |= (1 << bus);
|
|
|
|
(void) isp_control(isp, ISPCTL_UPDATE_PARAMS,
|
|
|
|
NULL);
|
1998-09-15 08:42:56 +00:00
|
|
|
dval = sdp->isp_devparam[tgt].cur_dflags;
|
1999-03-25 22:52:45 +00:00
|
|
|
oval = sdp->isp_devparam[tgt].cur_offset;
|
|
|
|
pval = sdp->isp_devparam[tgt].cur_period;
|
|
|
|
} else {
|
1998-09-15 08:42:56 +00:00
|
|
|
dval = sdp->isp_devparam[tgt].dev_flags;
|
1999-03-25 22:52:45 +00:00
|
|
|
oval = sdp->isp_devparam[tgt].sync_offset;
|
|
|
|
pval = sdp->isp_devparam[tgt].sync_period;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifndef CAM_NEW_TRAN_CODE
|
1998-09-15 08:42:56 +00:00
|
|
|
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
|
|
|
|
|
|
|
if (dval & DPARM_DISC) {
|
|
|
|
cts->flags |= CCB_TRANS_DISC_ENB;
|
|
|
|
}
|
|
|
|
if (dval & DPARM_TQING) {
|
|
|
|
cts->flags |= CCB_TRANS_TAG_ENB;
|
|
|
|
}
|
|
|
|
if (dval & DPARM_WIDE) {
|
|
|
|
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
|
|
|
} else {
|
|
|
|
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
|
|
|
}
|
|
|
|
cts->valid = CCB_TRANS_BUS_WIDTH_VALID |
|
|
|
|
CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
if ((dval & DPARM_SYNC) && oval != 0) {
|
|
|
|
cts->sync_period = pval;
|
|
|
|
cts->sync_offset = oval;
|
1998-09-15 08:42:56 +00:00
|
|
|
cts->valid |=
|
|
|
|
CCB_TRANS_SYNC_RATE_VALID |
|
|
|
|
CCB_TRANS_SYNC_OFFSET_VALID;
|
|
|
|
}
|
2001-07-04 18:54:29 +00:00
|
|
|
#else
|
|
|
|
cts->protocol = PROTO_SCSI;
|
|
|
|
cts->protocol_version = SCSI_REV_2;
|
|
|
|
cts->transport = XPORT_SPI;
|
|
|
|
cts->transport_version = 2;
|
|
|
|
|
|
|
|
scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB;
|
|
|
|
spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB;
|
|
|
|
if (dval & DPARM_DISC) {
|
|
|
|
spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
|
|
|
|
}
|
|
|
|
if (dval & DPARM_TQING) {
|
|
|
|
scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
|
|
|
|
}
|
|
|
|
if ((dval & DPARM_SYNC) && oval != 0) {
|
|
|
|
spi->sync_offset = oval;
|
|
|
|
spi->sync_period = pval;
|
|
|
|
spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
|
|
|
|
spi->valid |= CTS_SPI_VALID_SYNC_RATE;
|
|
|
|
}
|
|
|
|
spi->valid |= CTS_SPI_VALID_BUS_WIDTH;
|
|
|
|
if (dval & DPARM_WIDE) {
|
|
|
|
spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
|
|
|
} else {
|
|
|
|
spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
|
|
|
}
|
|
|
|
if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) {
|
|
|
|
scsi->valid = CTS_SCSI_VALID_TQ;
|
|
|
|
spi->valid |= CTS_SPI_VALID_DISC;
|
|
|
|
} else {
|
|
|
|
scsi->valid = 0;
|
|
|
|
}
|
|
|
|
#endif
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG0,
|
|
|
|
"%d.%d get %s period 0x%x offset 0x%x flags 0x%x",
|
2001-07-04 18:54:29 +00:00
|
|
|
bus, tgt, IS_CURRENT_SETTINGS(cts)? "current" :
|
|
|
|
"user", pval, oval, dval);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
2001-07-04 18:54:29 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XPT_CALC_GEOMETRY:
|
|
|
|
{
|
|
|
|
struct ccb_calc_geometry *ccg;
|
|
|
|
u_int32_t secs_per_cylinder;
|
|
|
|
u_int32_t size_mb;
|
|
|
|
|
|
|
|
ccg = &ccb->ccg;
|
|
|
|
if (ccg->block_size == 0) {
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"%d.%d XPT_CALC_GEOMETRY block size 0?",
|
|
|
|
ccg->ccb_h.target_id, ccg->ccb_h.target_lun);
|
1998-09-15 08:42:56 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
size_mb = ccg->volume_size /((1024L * 1024L) / ccg->block_size);
|
|
|
|
if (size_mb > 1024) {
|
|
|
|
ccg->heads = 255;
|
|
|
|
ccg->secs_per_track = 63;
|
|
|
|
} else {
|
|
|
|
ccg->heads = 64;
|
|
|
|
ccg->secs_per_track = 32;
|
|
|
|
}
|
|
|
|
secs_per_cylinder = ccg->heads * ccg->secs_per_track;
|
|
|
|
ccg->cylinders = ccg->volume_size / secs_per_cylinder;
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XPT_RESET_BUS: /* Reset the specified bus */
|
1999-10-17 18:50:47 +00:00
|
|
|
bus = cam_sim_bus(sim);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-10-17 18:50:47 +00:00
|
|
|
error = isp_control(isp, ISPCTL_RESET_BUS, &bus);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
if (error)
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
1999-02-09 01:08:38 +00:00
|
|
|
else {
|
1999-05-11 05:10:06 +00:00
|
|
|
if (cam_sim_bus(sim) && isp->isp_path2 != NULL)
|
|
|
|
xpt_async(AC_BUS_RESET, isp->isp_path2, NULL);
|
|
|
|
else if (isp->isp_path != NULL)
|
1999-02-09 01:08:38 +00:00
|
|
|
xpt_async(AC_BUS_RESET, isp->isp_path, NULL);
|
1998-09-15 08:42:56 +00:00
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
1999-02-09 01:08:38 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XPT_TERM_IO: /* Terminate the I/O process */
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XPT_PATH_INQ: /* Path routing inquiry */
|
|
|
|
{
|
|
|
|
struct ccb_pathinq *cpi = &ccb->cpi;
|
|
|
|
|
|
|
|
cpi->version_num = 1;
|
2000-01-03 23:55:30 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2001-04-04 21:58:29 +00:00
|
|
|
cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO;
|
2000-01-03 23:55:30 +00:00
|
|
|
#else
|
1998-09-15 08:42:56 +00:00
|
|
|
cpi->target_sprt = 0;
|
2000-01-03 23:55:30 +00:00
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
cpi->hba_eng_cnt = 0;
|
1999-08-16 20:11:45 +00:00
|
|
|
cpi->max_target = ISP_MAX_TARGETS(isp) - 1;
|
|
|
|
cpi->max_lun = ISP_MAX_LUNS(isp) - 1;
|
|
|
|
cpi->bus_id = cam_sim_bus(sim);
|
1999-03-25 22:52:45 +00:00
|
|
|
if (IS_FC(isp)) {
|
|
|
|
cpi->hba_misc = PIM_NOBUSRESET;
|
1999-08-16 20:11:45 +00:00
|
|
|
/*
|
|
|
|
* Because our loop ID can shift from time to time,
|
|
|
|
* make our initiator ID out of range of our bus.
|
|
|
|
*/
|
|
|
|
cpi->initiator_id = cpi->max_target + 1;
|
|
|
|
|
Add a number of interrelated CAM feature enhancements and bug fixes.
NOTE: These changes will require recompilation of any userland
applications, like cdrecord, xmcd, etc., that use the CAM passthrough
interface. A make world is recommended.
camcontrol.[c8]:
- We now support two new commands, "tags" and "negotiate".
- The tags commands allows users to view the number of tagged
openings for a device as well as a number of other related
parameters, and it allows users to set tagged openings for
a device.
- The negotiate command allows users to enable and disable
disconnection and tagged queueing, set sync rates, offsets
and bus width. Note that not all of those features are
available for all controllers. Only the adv, ahc, and ncr
drivers fully support all of the features at this point.
Some cards do not allow the setting of sync rates, offsets and
the like, and some of the drivers don't have any facilities to
do so. Some drivers, like the adw driver, only support enabling
or disabling sync negotiation, but do not support setting sync
rates.
- new description in the camcontrol man page of how to format a disk
- cleanup of the camcontrol inquiry command
- add support in the 'devlist' command for skipping unconfigured devices if
-v was not specified on the command line.
- make use of the new base_transfer_speed in the path inquiry CCB.
- fix CCB bzero cases
cam_xpt.c, cam_sim.[ch], cam_ccb.h:
- new flags on many CCB function codes to designate whether they're
non-immediate, use a user-supplied CCB, and can only be passed from
userland programs via the xpt device. Use these flags in the transport
layer and pass driver to categorize CCBs.
- new flag in the transport layer device matching code for device nodes
that indicates whether a device is unconfigured
- bump the CAM version from 0x10 to 0x11
- Change the CAM ioctls to use the version as their group code, so we can
force users to recompile code even when the CCB size doesn't change.
- add + fill in a new value in the path inquiry CCB, base_transfer_speed.
Remove a corresponding field from the cam_sim structure, and add code to
every SIM to set this field to the proper value.
- Fix the set transfer settings code in the transport layer.
scsi_cd.c:
- make some variables volatile instead of just casting them in various
places
- fix a race condition in the changer code
- attach unless we get a "logical unit not supported" error. This should
fix all of the cases where people have devices that return weird errors
when they don't have media in the drive.
scsi_da.c:
- attach unless we get a "logical unit not supported" error
scsi_pass.c:
- for immediate CCBs, just malloc a CCB to send the user request in. This
gets rid of the 'held' count problem in camcontrol tags.
scsi_pass.h:
- change the CAM ioctls to use the CAM version as their group code.
adv driver:
- Allow changing the sync rate and offset separately.
adw driver
- Allow changing the sync rate and offset separately.
aha driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
ahc driver:
- Allow setting offset and sync rate separately
bt driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
NCR driver:
- Fix the ultra/ultra 2 negotiation bug
- allow setting both the sync rate and offset separately
Other HBA drivers:
- Put code in to set the base_transfer_speed field for
XPT_GET_TRAN_SETTINGS CCBs.
Reviewed by: gibbs, mjacob (isp), imp (aha)
1999-05-06 20:16:39 +00:00
|
|
|
/*
|
|
|
|
* Set base transfer capabilities for Fibre Channel.
|
|
|
|
* Technically not correct because we don't know
|
|
|
|
* what media we're running on top of- but we'll
|
|
|
|
* look good if we always say 100MB/s.
|
|
|
|
*/
|
|
|
|
cpi->base_transfer_speed = 100000;
|
1999-08-16 20:11:45 +00:00
|
|
|
cpi->hba_inquiry = PI_TAG_ABLE;
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
cpi->transport = XPORT_FC;
|
|
|
|
cpi->transport_version = 0; /* WHAT'S THIS FOR? */
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
} else {
|
1999-05-11 05:10:06 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
|
|
|
sdp += cam_sim_bus(xpt_path_sim(cpi->ccb_h.path));
|
1999-08-16 20:11:45 +00:00
|
|
|
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
|
2000-04-21 19:18:06 +00:00
|
|
|
cpi->hba_misc = 0;
|
1999-05-11 05:10:06 +00:00
|
|
|
cpi->initiator_id = sdp->isp_initiator_id;
|
Add a number of interrelated CAM feature enhancements and bug fixes.
NOTE: These changes will require recompilation of any userland
applications, like cdrecord, xmcd, etc., that use the CAM passthrough
interface. A make world is recommended.
camcontrol.[c8]:
- We now support two new commands, "tags" and "negotiate".
- The tags commands allows users to view the number of tagged
openings for a device as well as a number of other related
parameters, and it allows users to set tagged openings for
a device.
- The negotiate command allows users to enable and disable
disconnection and tagged queueing, set sync rates, offsets
and bus width. Note that not all of those features are
available for all controllers. Only the adv, ahc, and ncr
drivers fully support all of the features at this point.
Some cards do not allow the setting of sync rates, offsets and
the like, and some of the drivers don't have any facilities to
do so. Some drivers, like the adw driver, only support enabling
or disabling sync negotiation, but do not support setting sync
rates.
- new description in the camcontrol man page of how to format a disk
- cleanup of the camcontrol inquiry command
- add support in the 'devlist' command for skipping unconfigured devices if
-v was not specified on the command line.
- make use of the new base_transfer_speed in the path inquiry CCB.
- fix CCB bzero cases
cam_xpt.c, cam_sim.[ch], cam_ccb.h:
- new flags on many CCB function codes to designate whether they're
non-immediate, use a user-supplied CCB, and can only be passed from
userland programs via the xpt device. Use these flags in the transport
layer and pass driver to categorize CCBs.
- new flag in the transport layer device matching code for device nodes
that indicates whether a device is unconfigured
- bump the CAM version from 0x10 to 0x11
- Change the CAM ioctls to use the version as their group code, so we can
force users to recompile code even when the CCB size doesn't change.
- add + fill in a new value in the path inquiry CCB, base_transfer_speed.
Remove a corresponding field from the cam_sim structure, and add code to
every SIM to set this field to the proper value.
- Fix the set transfer settings code in the transport layer.
scsi_cd.c:
- make some variables volatile instead of just casting them in various
places
- fix a race condition in the changer code
- attach unless we get a "logical unit not supported" error. This should
fix all of the cases where people have devices that return weird errors
when they don't have media in the drive.
scsi_da.c:
- attach unless we get a "logical unit not supported" error
scsi_pass.c:
- for immediate CCBs, just malloc a CCB to send the user request in. This
gets rid of the 'held' count problem in camcontrol tags.
scsi_pass.h:
- change the CAM ioctls to use the CAM version as their group code.
adv driver:
- Allow changing the sync rate and offset separately.
adw driver
- Allow changing the sync rate and offset separately.
aha driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
ahc driver:
- Allow setting offset and sync rate separately
bt driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
NCR driver:
- Fix the ultra/ultra 2 negotiation bug
- allow setting both the sync rate and offset separately
Other HBA drivers:
- Put code in to set the base_transfer_speed field for
XPT_GET_TRAN_SETTINGS CCBs.
Reviewed by: gibbs, mjacob (isp), imp (aha)
1999-05-06 20:16:39 +00:00
|
|
|
cpi->base_transfer_speed = 3300;
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
cpi->transport = XPORT_SPI;
|
|
|
|
cpi->transport_version = 2; /* WHAT'S THIS FOR? */
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
cpi->protocol = PROTO_SCSI;
|
|
|
|
cpi->protocol_version = SCSI_REV_2;
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
|
|
|
|
strncpy(cpi->hba_vid, "Qlogic", HBA_IDLEN);
|
|
|
|
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
|
|
|
cpi->unit_number = cam_sim_unit(sim);
|
|
|
|
cpi->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-12-05 01:31:21 +00:00
|
|
|
|
|
|
|
#define ISPDDB (CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB)
|
|
|
|
void
|
1998-12-28 19:22:27 +00:00
|
|
|
isp_done(struct ccb_scsiio *sccb)
|
1998-12-05 01:31:21 +00:00
|
|
|
{
|
|
|
|
struct ispsoftc *isp = XS_ISP(sccb);
|
|
|
|
|
|
|
|
if (XS_NOERR(sccb))
|
|
|
|
XS_SETERR(sccb, CAM_REQ_CMP);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
|
1998-12-05 01:31:21 +00:00
|
|
|
if ((sccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP &&
|
|
|
|
(sccb->scsi_status != SCSI_STATUS_OK)) {
|
|
|
|
sccb->ccb_h.status &= ~CAM_STATUS_MASK;
|
2000-01-04 03:45:49 +00:00
|
|
|
if ((sccb->scsi_status == SCSI_STATUS_CHECK_COND) &&
|
|
|
|
(sccb->ccb_h.status & CAM_AUTOSNS_VALID) == 0) {
|
|
|
|
sccb->ccb_h.status |= CAM_AUTOSENSE_FAIL;
|
|
|
|
} else {
|
|
|
|
sccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR;
|
|
|
|
}
|
1998-12-05 01:31:21 +00:00
|
|
|
}
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
|
1999-08-16 20:11:45 +00:00
|
|
|
sccb->ccb_h.status &= ~CAM_SIM_QUEUED;
|
1998-12-05 01:31:21 +00:00
|
|
|
if ((sccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
|
|
|
|
if ((sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
|
|
|
|
sccb->ccb_h.status |= CAM_DEV_QFRZN;
|
1999-08-16 20:11:45 +00:00
|
|
|
xpt_freeze_devq(sccb->ccb_h.path, 1);
|
|
|
|
if (sccb->scsi_status != SCSI_STATUS_OK)
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"freeze devq %d.%d %x %x",
|
|
|
|
sccb->ccb_h.target_id,
|
1999-08-16 20:11:45 +00:00
|
|
|
sccb->ccb_h.target_lun, sccb->ccb_h.status,
|
2000-08-01 06:31:44 +00:00
|
|
|
sccb->scsi_status);
|
1998-12-05 01:31:21 +00:00
|
|
|
}
|
|
|
|
}
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
|
1999-08-16 20:11:45 +00:00
|
|
|
/*
|
|
|
|
* If we were frozen waiting resources, clear that we were frozen
|
|
|
|
* waiting for resources. If we are no longer frozen, and the devq
|
|
|
|
* isn't frozen, mark the completing CCB to have the XPT layer
|
|
|
|
* release the simq.
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
if (isp->isp_osinfo.simqfrozen & SIMQFRZ_RESOURCE) {
|
|
|
|
isp->isp_osinfo.simqfrozen &= ~SIMQFRZ_RESOURCE;
|
1999-08-16 20:11:45 +00:00
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
if ((sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"isp_done->relsimq");
|
1999-08-16 20:11:45 +00:00
|
|
|
sccb->ccb_h.status |= CAM_RELEASE_SIMQ;
|
|
|
|
} else {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"isp_done->devq frozen");
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
|
|
|
} else {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"isp_done -> simqfrozen = %x",
|
|
|
|
isp->isp_osinfo.simqfrozen);
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
1998-12-05 01:31:21 +00:00
|
|
|
}
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
if ((CAM_DEBUGGED(sccb->ccb_h.path, ISPDDB)) &&
|
1998-12-05 01:31:21 +00:00
|
|
|
(sccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
|
|
|
|
xpt_print_path(sccb->ccb_h.path);
|
2001-03-01 02:14:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO,
|
|
|
|
"cam completion status 0x%x", sccb->ccb_h.status);
|
1998-12-05 01:31:21 +00:00
|
|
|
}
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
|
|
|
|
XS_CMD_S_DONE(sccb);
|
|
|
|
if (XS_CMD_WDOG_P(sccb) == 0) {
|
|
|
|
untimeout(isp_watchdog, (caddr_t)sccb, sccb->ccb_h.timeout_ch);
|
|
|
|
if (XS_CMD_GRACE_P(sccb)) {
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"finished command on borrowed time");
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
}
|
|
|
|
XS_CMD_S_CLEAR(sccb);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2000-12-29 19:06:32 +00:00
|
|
|
xpt_done((union ccb *) sccb);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.
Rearchitect command watchdog timeouts-
First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).
Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).
If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.
If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +00:00
|
|
|
}
|
1998-12-05 01:31:21 +00:00
|
|
|
}
|
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
int
|
1999-08-16 20:11:45 +00:00
|
|
|
isp_async(struct ispsoftc *isp, ispasync_t cmd, void *arg)
|
1999-01-30 07:29:00 +00:00
|
|
|
{
|
1999-05-11 05:10:06 +00:00
|
|
|
int bus, rv = 0;
|
1999-01-30 07:29:00 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case ISPASYNC_NEW_TGT_PARAMS:
|
1999-08-16 20:11:45 +00:00
|
|
|
{
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
struct ccb_trans_settings_scsi *scsi;
|
|
|
|
struct ccb_trans_settings_spi *spi;
|
|
|
|
#endif
|
1999-08-16 20:11:45 +00:00
|
|
|
int flags, tgt;
|
|
|
|
sdparam *sdp = isp->isp_param;
|
2001-07-04 18:54:29 +00:00
|
|
|
struct ccb_trans_settings cts;
|
1999-08-16 20:11:45 +00:00
|
|
|
struct cam_path *tmppath;
|
|
|
|
|
2001-07-04 18:54:29 +00:00
|
|
|
bzero(&cts, sizeof (struct ccb_trans_settings));
|
|
|
|
|
1999-08-16 20:11:45 +00:00
|
|
|
tgt = *((int *)arg);
|
|
|
|
bus = (tgt >> 16) & 0xffff;
|
|
|
|
tgt &= 0xffff;
|
|
|
|
sdp += bus;
|
2001-07-05 17:14:57 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-08-16 20:11:45 +00:00
|
|
|
if (xpt_create_path(&tmppath, NULL,
|
|
|
|
cam_sim_path(bus? isp->isp_sim2 : isp->isp_sim),
|
|
|
|
tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"isp_async cannot make temp path for %d.%d",
|
|
|
|
tgt, bus);
|
1999-08-16 20:11:45 +00:00
|
|
|
rv = -1;
|
|
|
|
break;
|
|
|
|
}
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-08-16 20:11:45 +00:00
|
|
|
flags = sdp->isp_devparam[tgt].cur_dflags;
|
2001-07-04 18:54:29 +00:00
|
|
|
#ifdef CAM_NEW_TRAN_CODE
|
|
|
|
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
|
|
|
cts.protocol = PROTO_SCSI;
|
|
|
|
cts.transport = XPORT_SPI;
|
|
|
|
|
|
|
|
scsi = &cts.proto_specific.scsi;
|
|
|
|
spi = &cts.xport_specific.spi;
|
|
|
|
|
|
|
|
if (flags & DPARM_TQING) {
|
|
|
|
scsi->valid |= CTS_SCSI_VALID_TQ;
|
|
|
|
scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
|
|
|
|
spi->flags |= CTS_SPI_FLAGS_TAG_ENB;
|
|
|
|
}
|
|
|
|
|
1999-08-16 20:11:45 +00:00
|
|
|
if (flags & DPARM_DISC) {
|
2001-07-04 18:54:29 +00:00
|
|
|
spi->valid |= CTS_SPI_VALID_DISC;
|
|
|
|
spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
|
|
|
|
}
|
|
|
|
spi->flags |= CTS_SPI_VALID_BUS_WIDTH;
|
|
|
|
if (flags & DPARM_WIDE) {
|
|
|
|
spi->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
|
|
|
} else {
|
|
|
|
spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
|
|
|
}
|
|
|
|
if (flags & DPARM_SYNC) {
|
|
|
|
spi->valid |= CTS_SPI_VALID_SYNC_RATE;
|
|
|
|
spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
|
|
|
|
spi->sync_period = sdp->isp_devparam[tgt].cur_period;
|
|
|
|
spi->sync_offset = sdp->isp_devparam[tgt].cur_offset;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
|
|
|
cts.valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
|
|
|
if (flags & DPARM_DISC) {
|
|
|
|
cts.flags |= CCB_TRANS_DISC_ENB;
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
|
|
|
if (flags & DPARM_TQING) {
|
2001-07-04 18:54:29 +00:00
|
|
|
cts.flags |= CCB_TRANS_TAG_ENB;
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
2001-07-04 18:54:29 +00:00
|
|
|
cts.valid |= CCB_TRANS_BUS_WIDTH_VALID;
|
|
|
|
cts.bus_width = (flags & DPARM_WIDE)?
|
1999-08-16 20:11:45 +00:00
|
|
|
MSG_EXT_WDTR_BUS_8_BIT : MSG_EXT_WDTR_BUS_16_BIT;
|
2001-07-04 18:54:29 +00:00
|
|
|
cts.sync_period = sdp->isp_devparam[tgt].cur_period;
|
|
|
|
cts.sync_offset = sdp->isp_devparam[tgt].cur_offset;
|
1999-08-16 20:11:45 +00:00
|
|
|
if (flags & DPARM_SYNC) {
|
2001-07-04 18:54:29 +00:00
|
|
|
cts.valid |=
|
1999-08-16 20:11:45 +00:00
|
|
|
CCB_TRANS_SYNC_RATE_VALID |
|
|
|
|
CCB_TRANS_SYNC_OFFSET_VALID;
|
1999-01-30 07:29:00 +00:00
|
|
|
}
|
2001-07-04 18:54:29 +00:00
|
|
|
#endif
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"NEW_TGT_PARAMS bus %d tgt %d period %x offset %x flags %x",
|
2001-07-04 18:54:29 +00:00
|
|
|
bus, tgt, sdp->isp_devparam[tgt].cur_period,
|
|
|
|
sdp->isp_devparam[tgt].cur_offset, flags);
|
|
|
|
xpt_setup_ccb(&cts.ccb_h, tmppath, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2001-07-04 18:54:29 +00:00
|
|
|
xpt_async(AC_TRANSFER_NEG, tmppath, &cts);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-08-16 20:11:45 +00:00
|
|
|
xpt_free_path(tmppath);
|
1999-01-30 07:29:00 +00:00
|
|
|
break;
|
1999-08-16 20:11:45 +00:00
|
|
|
}
|
1999-03-17 05:04:39 +00:00
|
|
|
case ISPASYNC_BUS_RESET:
|
1999-05-11 05:10:06 +00:00
|
|
|
bus = *((int *)arg);
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO, "SCSI bus reset on bus %d detected",
|
|
|
|
bus);
|
1999-05-11 05:10:06 +00:00
|
|
|
if (bus > 0 && isp->isp_path2) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
xpt_async(AC_BUS_RESET, isp->isp_path2, NULL);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-05-11 05:10:06 +00:00
|
|
|
} else if (isp->isp_path) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
xpt_async(AC_BUS_RESET, isp->isp_path, NULL);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
break;
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
case ISPASYNC_LIP:
|
|
|
|
if (isp->isp_path) {
|
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0, "LIP freeze simq");
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
|
|
|
xpt_freeze_simq(isp->isp_sim, 1);
|
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN;
|
|
|
|
}
|
|
|
|
isp_prt(isp, ISP_LOGINFO, "LIP Received");
|
|
|
|
break;
|
|
|
|
case ISPASYNC_LOOP_RESET:
|
|
|
|
if (isp->isp_path) {
|
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG0,
|
|
|
|
"Loop Reset freeze simq");
|
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
|
|
|
xpt_freeze_simq(isp->isp_sim, 1);
|
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
}
|
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN;
|
|
|
|
}
|
|
|
|
isp_prt(isp, ISP_LOGINFO, "Loop Reset Received");
|
|
|
|
break;
|
1999-03-17 05:04:39 +00:00
|
|
|
case ISPASYNC_LOOP_DOWN:
|
|
|
|
if (isp->isp_path) {
|
1999-08-16 20:11:45 +00:00
|
|
|
if (isp->isp_osinfo.simqfrozen == 0) {
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG0,
|
2000-08-01 06:31:44 +00:00
|
|
|
"loop down freeze simq");
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
xpt_freeze_simq(isp->isp_sim, 1);
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
1999-08-16 20:11:45 +00:00
|
|
|
isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN;
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO, "Loop DOWN");
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
|
|
|
case ISPASYNC_LOOP_UP:
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
/*
|
|
|
|
* Now we just note that Loop has come up. We don't
|
|
|
|
* actually do anything because we're waiting for a
|
|
|
|
* Change Notify before activating the FC cleanup
|
|
|
|
* thread to look at the state of the loop again.
|
|
|
|
*/
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO, "Loop UP");
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
2001-02-11 03:47:39 +00:00
|
|
|
case ISPASYNC_PROMENADE:
|
1999-08-16 20:11:45 +00:00
|
|
|
{
|
2001-07-04 18:54:29 +00:00
|
|
|
struct cam_path *tmppath;
|
2000-08-01 06:31:44 +00:00
|
|
|
const char *fmt = "Target %d (Loop 0x%x) Port ID 0x%x "
|
2001-02-11 03:47:39 +00:00
|
|
|
"(role %s) %s\n Port WWN 0x%08x%08x\n Node WWN 0x%08x%08x";
|
|
|
|
static const char *roles[4] = {
|
1999-08-16 20:11:45 +00:00
|
|
|
"(none)", "Target", "Initiator", "Target/Initiator"
|
1999-03-17 05:04:39 +00:00
|
|
|
};
|
1999-07-02 23:12:58 +00:00
|
|
|
fcparam *fcp = isp->isp_param;
|
|
|
|
int tgt = *((int *) arg);
|
|
|
|
struct lportdb *lp = &fcp->portdb[tgt];
|
|
|
|
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO, fmt, tgt, lp->loopid, lp->portid,
|
2001-02-11 03:47:39 +00:00
|
|
|
roles[lp->roles & 0x3],
|
|
|
|
(lp->valid)? "Arrived" : "Departed",
|
1999-07-02 23:12:58 +00:00
|
|
|
(u_int32_t) (lp->port_wwn >> 32),
|
|
|
|
(u_int32_t) (lp->port_wwn & 0xffffffffLL),
|
|
|
|
(u_int32_t) (lp->node_wwn >> 32),
|
|
|
|
(u_int32_t) (lp->node_wwn & 0xffffffffLL));
|
2001-07-04 18:54:29 +00:00
|
|
|
|
2001-07-05 17:14:57 +00:00
|
|
|
ISPLOCK_2_CAMLOCK(isp);
|
2001-07-04 18:54:29 +00:00
|
|
|
if (xpt_create_path(&tmppath, NULL, cam_sim_path(isp->isp_sim),
|
|
|
|
(target_id_t)tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
2001-07-05 17:14:57 +00:00
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
2001-07-04 18:54:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (lp->valid && (lp->roles &
|
|
|
|
(SVC3_INI_ROLE >> SVC3_ROLE_SHIFT))) {
|
|
|
|
xpt_async(AC_FOUND_DEVICE, tmppath, NULL);
|
|
|
|
} else {
|
|
|
|
xpt_async(AC_LOST_DEVICE, tmppath, NULL);
|
|
|
|
}
|
|
|
|
CAMLOCK_2_ISPLOCK(isp);
|
|
|
|
xpt_free_path(tmppath);
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ISPASYNC_CHANGE_NOTIFY:
|
2001-01-09 02:47:15 +00:00
|
|
|
if (arg == (void *) 1) {
|
|
|
|
isp_prt(isp, ISP_LOGINFO,
|
|
|
|
"Name Server Database Changed");
|
|
|
|
} else {
|
|
|
|
isp_prt(isp, ISP_LOGINFO,
|
|
|
|
"Name Server Database Changed");
|
|
|
|
}
|
Spring MegaChange #1.
----
Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).
----
Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things. Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.
The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.
These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.
---
Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.
--
Start putting in prototype 2300 support. Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.
Do some more substantial target mode cleanups.
MFC after: 8 weeks
2001-05-28 21:20:43 +00:00
|
|
|
#ifdef ISP_SMPLOCK
|
|
|
|
cv_signal(&isp->isp_osinfo.kthread_cv);
|
|
|
|
#else
|
|
|
|
wakeup(&isp->isp_osinfo.kthread_cv);
|
|
|
|
#endif
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
1999-07-02 23:12:58 +00:00
|
|
|
case ISPASYNC_FABRIC_DEV:
|
|
|
|
{
|
2001-01-15 18:34:49 +00:00
|
|
|
int target, lrange;
|
|
|
|
struct lportdb *lp = NULL;
|
2000-02-29 05:53:10 +00:00
|
|
|
char *pt;
|
|
|
|
sns_ganrsp_t *resp = (sns_ganrsp_t *) arg;
|
1999-07-02 23:12:58 +00:00
|
|
|
u_int32_t portid;
|
2000-02-29 05:53:10 +00:00
|
|
|
u_int64_t wwpn, wwnn;
|
1999-07-02 23:12:58 +00:00
|
|
|
fcparam *fcp = isp->isp_param;
|
|
|
|
|
|
|
|
portid =
|
|
|
|
(((u_int32_t) resp->snscb_port_id[0]) << 16) |
|
|
|
|
(((u_int32_t) resp->snscb_port_id[1]) << 8) |
|
|
|
|
(((u_int32_t) resp->snscb_port_id[2]));
|
2000-02-29 05:53:10 +00:00
|
|
|
|
|
|
|
wwpn =
|
1999-07-02 23:12:58 +00:00
|
|
|
(((u_int64_t)resp->snscb_portname[0]) << 56) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[1]) << 48) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[2]) << 40) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[3]) << 32) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[4]) << 24) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[5]) << 16) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[6]) << 8) |
|
|
|
|
(((u_int64_t)resp->snscb_portname[7]));
|
2000-02-29 05:53:10 +00:00
|
|
|
|
|
|
|
wwnn =
|
|
|
|
(((u_int64_t)resp->snscb_nodename[0]) << 56) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[1]) << 48) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[2]) << 40) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[3]) << 32) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[4]) << 24) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[5]) << 16) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[6]) << 8) |
|
|
|
|
(((u_int64_t)resp->snscb_nodename[7]));
|
|
|
|
if (portid == 0 || wwpn == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (resp->snscb_port_type) {
|
|
|
|
case 1:
|
|
|
|
pt = " N_Port";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pt = " NL_Port";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pt = "F/NL_Port";
|
|
|
|
break;
|
|
|
|
case 0x7f:
|
|
|
|
pt = " Nx_Port";
|
|
|
|
break;
|
|
|
|
case 0x81:
|
|
|
|
pt = " F_port";
|
|
|
|
break;
|
|
|
|
case 0x82:
|
|
|
|
pt = " FL_Port";
|
|
|
|
break;
|
|
|
|
case 0x84:
|
|
|
|
pt = " E_port";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
pt = "?";
|
|
|
|
break;
|
|
|
|
}
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGINFO,
|
|
|
|
"%s @ 0x%x, Node 0x%08x%08x Port %08x%08x",
|
|
|
|
pt, portid, ((u_int32_t) (wwnn >> 32)), ((u_int32_t) wwnn),
|
2000-02-29 05:53:10 +00:00
|
|
|
((u_int32_t) (wwpn >> 32)), ((u_int32_t) wwpn));
|
2001-01-15 18:34:49 +00:00
|
|
|
/*
|
|
|
|
* We're only interested in SCSI_FCP types (for now)
|
|
|
|
*/
|
|
|
|
if ((resp->snscb_fc4_types[2] & 1) == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (fcp->isp_topo != TOPO_F_PORT)
|
|
|
|
lrange = FC_SNS_ID+1;
|
|
|
|
else
|
|
|
|
lrange = 0;
|
|
|
|
/*
|
|
|
|
* Is it already in our list?
|
|
|
|
*/
|
|
|
|
for (target = lrange; target < MAX_FC_TARG; target++) {
|
|
|
|
if (target >= FL_PORT_ID && target <= FC_SNS_ID) {
|
|
|
|
continue;
|
|
|
|
}
|
1999-07-02 23:12:58 +00:00
|
|
|
lp = &fcp->portdb[target];
|
2001-01-15 18:34:49 +00:00
|
|
|
if (lp->port_wwn == wwpn && lp->node_wwn == wwnn) {
|
|
|
|
lp->fabric_dev = 1;
|
1999-07-02 23:12:58 +00:00
|
|
|
break;
|
2001-01-15 18:34:49 +00:00
|
|
|
}
|
1999-04-04 01:35:03 +00:00
|
|
|
}
|
1999-07-02 23:12:58 +00:00
|
|
|
if (target < MAX_FC_TARG) {
|
1998-12-28 19:22:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-01-15 18:34:49 +00:00
|
|
|
for (target = lrange; target < MAX_FC_TARG; target++) {
|
|
|
|
if (target >= FL_PORT_ID && target <= FC_SNS_ID) {
|
|
|
|
continue;
|
|
|
|
}
|
1999-07-02 23:12:58 +00:00
|
|
|
lp = &fcp->portdb[target];
|
2001-01-15 18:34:49 +00:00
|
|
|
if (lp->port_wwn == 0) {
|
1999-01-30 07:29:00 +00:00
|
|
|
break;
|
2001-01-15 18:34:49 +00:00
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
}
|
1999-07-02 23:12:58 +00:00
|
|
|
if (target == MAX_FC_TARG) {
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"no more space for fabric devices");
|
1999-07-02 23:12:58 +00:00
|
|
|
break;
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
2000-02-29 05:53:10 +00:00
|
|
|
lp->node_wwn = wwnn;
|
|
|
|
lp->port_wwn = wwpn;
|
1999-07-02 23:12:58 +00:00
|
|
|
lp->portid = portid;
|
2001-01-15 18:34:49 +00:00
|
|
|
lp->fabric_dev = 1;
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-01-03 23:55:30 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
case ISPASYNC_TARGET_MESSAGE:
|
|
|
|
{
|
|
|
|
tmd_msg_t *mp = arg;
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"bus %d iid %d tgt %d lun %d ttype %x tval %x msg[0]=%x",
|
|
|
|
mp->nt_bus, (int) mp->nt_iid, (int) mp->nt_tgt,
|
|
|
|
(int) mp->nt_lun, mp->nt_tagtype, mp->nt_tagval,
|
|
|
|
mp->nt_msg[0]);
|
2000-01-03 23:55:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ISPASYNC_TARGET_EVENT:
|
|
|
|
{
|
|
|
|
tmd_event_t *ep = arg;
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG2,
|
|
|
|
"bus %d event code 0x%x", ep->ev_bus, ep->ev_event);
|
2000-01-03 23:55:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ISPASYNC_TARGET_ACTION:
|
|
|
|
switch (((isphdr_t *)arg)->rqs_entry_type) {
|
|
|
|
default:
|
2000-12-05 07:39:54 +00:00
|
|
|
isp_prt(isp, ISP_LOGWARN,
|
|
|
|
"event 0x%x for unhandled target action",
|
|
|
|
((isphdr_t *)arg)->rqs_entry_type);
|
2000-01-03 23:55:30 +00:00
|
|
|
break;
|
|
|
|
case RQSTYPE_ATIO:
|
|
|
|
rv = isp_handle_platform_atio(isp, (at_entry_t *) arg);
|
|
|
|
break;
|
|
|
|
case RQSTYPE_ATIO2:
|
|
|
|
rv = isp_handle_platform_atio2(isp, (at2_entry_t *)arg);
|
|
|
|
break;
|
|
|
|
case RQSTYPE_CTIO2:
|
|
|
|
case RQSTYPE_CTIO:
|
|
|
|
rv = isp_handle_platform_ctio(isp, arg);
|
|
|
|
break;
|
|
|
|
case RQSTYPE_ENABLE_LUN:
|
|
|
|
case RQSTYPE_MODIFY_LUN:
|
|
|
|
isp_cv_signal_rqe(isp, ((lun_entry_t *)arg)->le_status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
1999-07-02 23:12:58 +00:00
|
|
|
#endif
|
2001-07-04 18:54:29 +00:00
|
|
|
case ISPASYNC_FW_CRASH:
|
|
|
|
{
|
|
|
|
u_int16_t mbox1, mbox6;
|
|
|
|
mbox1 = ISP_READ(isp, OUTMAILBOX1);
|
|
|
|
if (IS_DUALBUS(isp)) {
|
|
|
|
mbox6 = ISP_READ(isp, OUTMAILBOX6);
|
|
|
|
} else {
|
|
|
|
mbox6 = 0;
|
|
|
|
}
|
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"Internal Firmware on bus %d Error @ RISC Address 0x%x",
|
|
|
|
mbox6, mbox1);
|
|
|
|
isp_reinit(isp);
|
|
|
|
break;
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
default:
|
2000-08-01 06:31:44 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "unknown isp_async event %d", cmd);
|
1999-07-02 23:12:58 +00:00
|
|
|
rv = -1;
|
1999-01-30 07:29:00 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-07-02 23:12:58 +00:00
|
|
|
return (rv);
|
1999-01-30 07:29:00 +00:00
|
|
|
}
|
1998-12-28 19:22:27 +00:00
|
|
|
|
1999-07-02 23:12:58 +00:00
|
|
|
|
1998-12-28 19:22:27 +00:00
|
|
|
/*
|
|
|
|
* Locks are held before coming here.
|
|
|
|
*/
|
|
|
|
void
|
1999-07-02 23:12:58 +00:00
|
|
|
isp_uninit(struct ispsoftc *isp)
|
1998-12-28 19:22:27 +00:00
|
|
|
{
|
1999-05-11 05:10:06 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_RESET);
|
1998-12-28 19:22:27 +00:00
|
|
|
DISABLE_INTS(isp);
|
|
|
|
}
|
2000-08-01 06:31:44 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
isp_prt(struct ispsoftc *isp, int level, const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
if (level != ISP_LOGALL && (level & isp->isp_dblev) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2001-03-01 02:14:54 +00:00
|
|
|
printf("%s: ", device_get_nameunit(isp->isp_dev));
|
2000-08-01 06:31:44 +00:00
|
|
|
va_start(ap, fmt);
|
|
|
|
vprintf(fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
printf("\n");
|
|
|
|
}
|