diff options
author | gibbs <gibbs@FreeBSD.org> | 2003-12-19 18:34:30 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 2003-12-19 18:34:30 +0000 |
commit | ac5db06d6ae7882465311f097fed80f50844e577 (patch) | |
tree | 76ad50fce9be47add77cdd2180571f91db6e6479 /sys/dev | |
parent | 7827f445334f6261b4772915d4abe39d3c79c014 (diff) | |
download | FreeBSD-src-ac5db06d6ae7882465311f097fed80f50844e577.zip FreeBSD-src-ac5db06d6ae7882465311f097fed80f50844e577.tar.gz |
Move all of the recovery thread routines next
to each other.
Correct the recovery thread's loop so that it
will terminate properly on shutdown. We also
clear the recovery_thread proc pointer so that
any additional calls to aic_terminate_recovery_thread()
will not attempt to kill a thread that doesn't
exist. Lastly, code the loop so that termination
will still be successfull even if the termination
request occurs just prior to us entering the loop
or while the recovery thread is off recovering
commands.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/aic7xxx/aic_osm_lib.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/sys/dev/aic7xxx/aic_osm_lib.c b/sys/dev/aic7xxx/aic_osm_lib.c index 409cfce..295044c 100644 --- a/sys/dev/aic7xxx/aic_osm_lib.c +++ b/sys/dev/aic7xxx/aic_osm_lib.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic_osm_lib.c#4 $ + * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic_osm_lib.c#5 $ */ #include <sys/cdefs.h> @@ -118,29 +118,6 @@ aic_terminate_recovery_thread(struct aic_softc *aic) aic_unlock(aic, &s); } -void -aic_calc_geometry(struct ccb_calc_geometry *ccg, int extended) -{ -#if __FreeBSD_version >= 500000 - cam_calc_geometry(ccg, extended); -#else - uint32_t size_mb; - uint32_t secs_per_cylinder; - - size_mb = ccg->volume_size / ((1024L * 1024L) / ccg->block_size); - if (size_mb > 1024 && extended) { - 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; - ccg->ccb_h.status = CAM_REQ_CMP; -#endif -} - static void aic_recovery_thread(void *arg) { @@ -152,14 +129,20 @@ aic_recovery_thread(void *arg) #endif aic = (struct aic_softc *)arg; aic_lock(aic, &s); - while ((aic->flags & AIC_SHUTDOWN_RECOVERY) == 0) { + for (;;) { - while (LIST_EMPTY(&aic->timedout_scbs) != 0) + if (LIST_EMPTY(&aic->timedout_scbs) != 0 + && (aic->flags & AIC_SHUTDOWN_RECOVERY) == 0) tsleep(aic, PUSER, "idle", 0); + + if ((aic->flags & AIC_SHUTDOWN_RECOVERY) != 0) + break; + aic_unlock(aic, &s); aic_recover_commands(aic); aic_lock(aic, &s); } + aic->platform_data->recovery_thread = NULL; wakeup(aic->platform_data); aic_unlock(aic, &s); #if __FreeBSD_version >= 500000 @@ -167,3 +150,27 @@ aic_recovery_thread(void *arg) #endif kthread_exit(0); } + +void +aic_calc_geometry(struct ccb_calc_geometry *ccg, int extended) +{ +#if __FreeBSD_version >= 500000 + cam_calc_geometry(ccg, extended); +#else + uint32_t size_mb; + uint32_t secs_per_cylinder; + + size_mb = ccg->volume_size / ((1024L * 1024L) / ccg->block_size); + if (size_mb > 1024 && extended) { + 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; + ccg->ccb_h.status = CAM_REQ_CMP; +#endif +} + |