summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2010-03-17 02:48:14 +0000
committermjacob <mjacob@FreeBSD.org>2010-03-17 02:48:14 +0000
commitbeacc60317b27a9ab9f12cb5d16b7749a55cebaf (patch)
tree9b59548fccb01867380e2ab45c7c9743eebf5e7f /sys/dev/isp
parenta16f0fefdce804c5d60c0aea44277f2cb95d3751 (diff)
downloadFreeBSD-src-beacc60317b27a9ab9f12cb5d16b7749a55cebaf.zip
FreeBSD-src-beacc60317b27a9ab9f12cb5d16b7749a55cebaf.tar.gz
Put gone device timer into a structure tag that can hold more than 32 seconds. Oops.
Untangle some of the confusion about what role means when it's in the FCPARAM/SDPARAM or isp_fc/isp_spi structures. This fixed a problem about seeing targets appear if you've turned off autologin and find them, or rather don't, via camcontrol rescan. MFC after: 1 month
Diffstat (limited to 'sys/dev/isp')
-rw-r--r--sys/dev/isp/isp_freebsd.c23
-rw-r--r--sys/dev/isp/isp_freebsd.h10
-rw-r--r--sys/dev/isp/isp_pci.c6
-rw-r--r--sys/dev/isp/isp_sbus.c2
4 files changed, 24 insertions, 17 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 902c827..ca459f3 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -3950,11 +3950,15 @@ isp_gdt(void *arg)
if (lp->dev_map_idx == 0 || lp->target_mode) {
continue;
}
- if (lp->new_reserved == 0) {
+ /*
+ * We can use new_portid here because it is untouched
+ * while the state is ZOMBIE
+ */
+ if (lp->new_portid == 0) {
continue;
}
- lp->new_reserved -= 1;
- if (lp->new_reserved != 0) {
+ lp->new_portid -= 1;
+ if (lp->new_portid != 0) {
more_to_do++;
continue;
}
@@ -4064,7 +4068,7 @@ isp_kthread(void *arg)
*
* If not, we simply just wait for loop to come up.
*/
- if (lb && (fc->role & ISP_ROLE_INITIATOR)) {
+ if (lb && (FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR)) {
/*
* Increment loop down time by the last sleep interval
*/
@@ -4932,7 +4936,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
/*
* We don't do any simq freezing if we are only in target mode
*/
- if (fc->role & ISP_ROLE_INITIATOR) {
+ if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
if (fc->path) {
isp_freeze_loopdown(isp, bus, msg);
}
@@ -4968,7 +4972,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
va_end(ap);
fc = ISP_FC_PC(isp, bus);
lp->reserved = 0;
- if ((fc->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
+ if ((FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
int dbidx = lp - FCPARAM(isp, bus)->portdb;
int i;
@@ -5056,10 +5060,13 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
*
* If it isn't marked that isp_gdt is going to get rid of it,
* announce that it's gone.
+ *
+ * We can use new_portid for the gone timer because it's
+ * undefined while the state is ZOMBIE.
*/
if (lp->dev_map_idx && lp->reserved == 0) {
lp->reserved = 1;
- lp->new_reserved = ISP_FC_PC(isp, bus)->gone_device_time;
+ lp->new_portid = ISP_FC_PC(isp, bus)->gone_device_time;
lp->state = FC_PORTDB_STATE_ZOMBIE;
if (fc->ready && !callout_active(&fc->gdt)) {
isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d starting Gone Device Timer", bus);
@@ -5106,7 +5113,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
callout_stop(&fc->ldt);
}
isp_prt(isp, ISP_LOGINFO, msg, bus);
- if (fc->role & ISP_ROLE_INITIATOR) {
+ if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
isp_freeze_loopdown(isp, bus, msg);
}
wakeup(fc);
diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h
index 2942594..dea6266 100644
--- a/sys/dev/isp/isp_freebsd.h
+++ b/sys/dev/isp/isp_freebsd.h
@@ -175,7 +175,7 @@ struct isp_fc {
simqfrozen : 3,
default_id : 8,
hysteresis : 8,
- role : 2,
+ def_role : 2, /* default role */
gdt_running : 1,
loop_dead : 1,
fcbsy : 1,
@@ -203,7 +203,7 @@ struct isp_spi {
tm_enabled : 1,
#endif
simqfrozen : 3,
- role : 3,
+ def_role : 2,
iid : 4;
#ifdef ISP_TARGET_MODE
struct tslist lun_hash[LUN_HASH_SIZE];
@@ -467,12 +467,12 @@ default: \
#define DEFAULT_EXEC_THROTTLE(isp) isp->isp_osinfo.exec_throttle
#define GET_DEFAULT_ROLE(isp, chan) \
- (IS_FC(isp)? ISP_FC_PC(isp, chan)->role : ISP_SPI_PC(isp, chan)->role)
+ (IS_FC(isp)? ISP_FC_PC(isp, chan)->def_role : ISP_SPI_PC(isp, chan)->def_role)
#define SET_DEFAULT_ROLE(isp, chan, val) \
if (IS_FC(isp)) { \
- ISP_FC_PC(isp, chan)->role = val; \
+ ISP_FC_PC(isp, chan)->def_role = val; \
} else { \
- ISP_SPI_PC(isp, chan)->role = val; \
+ ISP_SPI_PC(isp, chan)->def_role = val; \
}
#define DEFAULT_IID(isp, chan) isp->isp_osinfo.pc.spi[chan].iid
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c
index 547f48e..8410ea6 100644
--- a/sys/dev/isp/isp_pci.c
+++ b/sys/dev/isp/isp_pci.c
@@ -547,10 +547,10 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
}
if (IS_SCSI(isp)) {
- ISP_SPI_PC(isp, chan)->role = tval;
+ ISP_SPI_PC(isp, chan)->def_role = tval;
return;
}
- ISP_FC_PC(isp, chan)->role = tval;
+ ISP_FC_PC(isp, chan)->def_role = tval;
tval = 0;
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fullduplex", &tval) == 0 && tval != 0) {
@@ -833,7 +833,7 @@ isp_pci_attach(device_t dev)
* The 'it' suffix really only matters for SCSI cards in target mode.
*/
isp->isp_osinfo.fw = NULL;
- if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->role & ISP_ROLE_TARGET)) {
+ if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->def_role & ISP_ROLE_TARGET)) {
snprintf(fwname, sizeof (fwname), "isp_%04x_it", did);
isp->isp_osinfo.fw = firmware_get(fwname);
} else if (IS_24XX(isp) && (isp->isp_nchan > 1 || isp->isp_osinfo.forcemulti)) {
diff --git a/sys/dev/isp/isp_sbus.c b/sys/dev/isp/isp_sbus.c
index e2dd78f..895645a 100644
--- a/sys/dev/isp/isp_sbus.c
+++ b/sys/dev/isp/isp_sbus.c
@@ -195,7 +195,7 @@ isp_sbus_attach(device_t dev)
isp->isp_revision = 0; /* XXX */
isp->isp_dev = dev;
isp->isp_nchan = 1;
- ISP_SET_PC(isp, 0, role, role);
+ ISP_SET_PC(isp, 0, def_role, role);
/*
* Get the clock frequency and convert it from HZ to MHz,
OpenPOWER on IntegriCloud