svn commit: r290794 - stable/10/sys/dev/isp
Alexander Motin
mav at FreeBSD.org
Fri Nov 13 19:53:32 UTC 2015
Author: mav
Date: Fri Nov 13 19:53:31 2015
New Revision: 290794
URL: https://svnweb.freebsd.org/changeset/base/290794
Log:
MFC r289930: Formalize/unify chip (re-)inits.
Modified:
stable/10/sys/dev/isp/isp.c
stable/10/sys/dev/isp/isp_freebsd.c
stable/10/sys/dev/isp/isp_pci.c
stable/10/sys/dev/isp/isp_sbus.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/isp/isp.c
==============================================================================
--- stable/10/sys/dev/isp/isp.c Fri Nov 13 19:51:55 2015 (r290793)
+++ stable/10/sys/dev/isp/isp.c Fri Nov 13 19:53:31 2015 (r290794)
@@ -1368,6 +1368,8 @@ isp_scsi_init(ispsoftc_t *isp)
sdparam *sdp_chan0, *sdp_chan1;
mbreg_t mbs;
+ isp->isp_state = ISP_INITSTATE;
+
sdp_chan0 = SDPARAM(isp, 0);
sdp_chan1 = sdp_chan0;
if (IS_DUALBUS(isp)) {
@@ -1543,7 +1545,7 @@ isp_scsi_init(ispsoftc_t *isp)
}
}
- isp->isp_state = ISP_INITSTATE;
+ isp->isp_state = ISP_RUNSTATE;
}
static void
@@ -1673,11 +1675,10 @@ isp_fibre_init(ispsoftc_t *isp)
* We only support one channel on non-24XX cards
*/
fcp = FCPARAM(isp, 0);
- if (fcp->role == ISP_ROLE_NONE) {
- isp->isp_state = ISP_INITSTATE;
+ if (fcp->role == ISP_ROLE_NONE)
return;
- }
+ isp->isp_state = ISP_INITSTATE;
ISP_MEMZERO(icbp, sizeof (*icbp));
icbp->icb_version = ICB_VERSION1;
icbp->icb_fwoptions = fcp->isp_fwoptions;
@@ -1978,7 +1979,7 @@ isp_fibre_init(ispsoftc_t *isp)
/*
* Whatever happens, we're now committed to being here.
*/
- isp->isp_state = ISP_INITSTATE;
+ isp->isp_state = ISP_RUNSTATE;
}
static void
@@ -2001,10 +2002,11 @@ isp_fibre_init_2400(ispsoftc_t *isp)
}
if (chan == isp->isp_nchan) {
isp_prt(isp, ISP_LOG_WARN1, "all %d channels with role 'none'", chan);
- isp->isp_state = ISP_INITSTATE;
return;
}
+ isp->isp_state = ISP_INITSTATE;
+
/*
* Start with channel 0.
*/
@@ -2285,7 +2287,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
/*
* Whatever happens, we're now committed to being here.
*/
- isp->isp_state = ISP_INITSTATE;
+ isp->isp_state = ISP_RUNSTATE;
}
static void
@@ -4349,16 +4351,6 @@ isp_start(XS_T *xs)
isp = XS_ISP(xs);
/*
- * Now make sure we're running.
- */
-
- if (isp->isp_state != ISP_RUNSTATE) {
- isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
- XS_SETERR(xs, HBA_BOTCH);
- return (CMD_COMPLETE);
- }
-
- /*
* Check command CDB length, etc.. We really are limited to 16 bytes
* for Fibre Channel, but can do up to 44 bytes in parallel SCSI,
* but probably only if we're running fairly new firmware (we'll
@@ -4387,6 +4379,12 @@ isp_start(XS_T *xs)
return (CMD_COMPLETE);
}
+ if (isp->isp_state != ISP_RUNSTATE) {
+ isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
+ XS_SETERR(xs, HBA_BOTCH);
+ return (CMD_COMPLETE);
+ }
+
/*
* Try again later.
*/
@@ -4423,6 +4421,13 @@ isp_start(XS_T *xs)
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
+
+ if (isp->isp_state != ISP_RUNSTATE) {
+ isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
+ XS_SETERR(xs, HBA_BOTCH);
+ return (CMD_COMPLETE);
+ }
+
if (sdp->update) {
isp_spi_update(isp, XS_CHANNEL(xs));
}
@@ -7915,7 +7920,8 @@ isp_reinit(ispsoftc_t *isp, int do_load_
{
int i, res = 0;
- isp_reset(isp, do_load_defaults);
+ if (isp->isp_state != ISP_RESETSTATE)
+ isp_reset(isp, do_load_defaults);
if (isp->isp_state != ISP_RESETSTATE) {
res = EIO;
isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__);
@@ -7924,15 +7930,10 @@ isp_reinit(ispsoftc_t *isp, int do_load_
}
isp_init(isp);
- if (isp->isp_state == ISP_INITSTATE) {
- isp->isp_state = ISP_RUNSTATE;
- }
-
- if (isp->isp_state != ISP_RUNSTATE) {
+ if (isp->isp_state > ISP_RESETSTATE &&
+ isp->isp_state != ISP_RUNSTATE) {
res = EIO;
-#ifndef ISP_TARGET_MODE
- isp_prt(isp, ISP_LOGWARN, "%s: not at runstate", __func__);
-#endif
+ isp_prt(isp, ISP_LOGERR, "%s: cannot init card", __func__);
ISP_DISABLE_INTS(isp);
if (IS_FC(isp)) {
/*
Modified: stable/10/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/10/sys/dev/isp/isp_freebsd.c Fri Nov 13 19:51:55 2015 (r290793)
+++ stable/10/sys/dev/isp/isp_freebsd.c Fri Nov 13 19:53:31 2015 (r290794)
@@ -4029,19 +4029,6 @@ isp_action(struct cam_sim *sim, union cc
isp_prt(isp, ISP_LOGDEBUG2, "isp_action code %x", ccb->ccb_h.func_code);
ISP_PCMD(ccb) = NULL;
- if (isp->isp_state != ISP_RUNSTATE && ccb->ccb_h.func_code == XPT_SCSI_IO) {
- isp_init(isp);
- if (isp->isp_state != ISP_INITSTATE) {
- /*
- * Lie. Say it was a selection timeout.
- */
- ccb->ccb_h.status = CAM_SEL_TIMEOUT;
- isp_done((struct ccb_scsiio *) ccb);
- return;
- }
- isp->isp_state = ISP_RUNSTATE;
- }
-
switch (ccb->ccb_h.func_code) {
case XPT_SCSI_IO: /* Execute the requested I/O operation */
bus = XS_CHANNEL(ccb);
Modified: stable/10/sys/dev/isp/isp_pci.c
==============================================================================
--- stable/10/sys/dev/isp/isp_pci.c Fri Nov 13 19:51:55 2015 (r290793)
+++ stable/10/sys/dev/isp/isp_pci.c Fri Nov 13 19:53:31 2015 (r290794)
@@ -991,15 +991,10 @@ isp_pci_attach(device_t dev)
* Make sure we're in reset state.
*/
ISP_LOCK(isp);
- isp_reset(isp, 1);
- if (isp->isp_state != ISP_RESETSTATE) {
+ if (isp_reinit(isp, 1) != 0) {
ISP_UNLOCK(isp);
goto bad;
}
- isp_init(isp);
- if (isp->isp_state == ISP_INITSTATE) {
- isp->isp_state = ISP_RUNSTATE;
- }
ISP_UNLOCK(isp);
if (isp_attach(isp)) {
ISP_LOCK(isp);
Modified: stable/10/sys/dev/isp/isp_sbus.c
==============================================================================
--- stable/10/sys/dev/isp/isp_sbus.c Fri Nov 13 19:51:55 2015 (r290793)
+++ stable/10/sys/dev/isp/isp_sbus.c Fri Nov 13 19:53:31 2015 (r290794)
@@ -313,16 +313,11 @@ isp_sbus_attach(device_t dev)
* Make sure we're in reset state.
*/
ISP_LOCK(isp);
- isp_reset(isp, 1);
- if (isp->isp_state != ISP_RESETSTATE) {
+ if (isp_reinit(isp, 1) != 0) {
isp_uninit(isp);
ISP_UNLOCK(isp);
goto bad;
}
- isp_init(isp);
- if (isp->isp_state == ISP_INITSTATE) {
- isp->isp_state = ISP_RUNSTATE;
- }
ISP_UNLOCK(isp);
if (isp_attach(isp)) {
ISP_LOCK(isp);
More information about the svn-src-stable-10
mailing list