diff options
| author | Steven Hartland <smh@FreeBSD.org> | 2018-03-31 19:18:07 +0000 |
|---|---|---|
| committer | Steven Hartland <smh@FreeBSD.org> | 2018-03-31 19:18:07 +0000 |
| commit | 7f8aeb21e124a522ae3f9457e8deef826ed70482 (patch) | |
| tree | be52abf3d3c3c53a81b7186860be53e8c9bb4010 /sys/dev/mps | |
| parent | 64d11c3b62eb31b4150a68c874a47078f12227f8 (diff) | |
Notes
Diffstat (limited to 'sys/dev/mps')
| -rw-r--r-- | sys/dev/mps/mps_sas_lsi.c | 33 | ||||
| -rw-r--r-- | sys/dev/mps/mpsvar.h | 2 |
2 files changed, 21 insertions, 14 deletions
diff --git a/sys/dev/mps/mps_sas_lsi.c b/sys/dev/mps/mps_sas_lsi.c index 3d62a9a4bff5..bd7fd9fe2b36 100644 --- a/sys/dev/mps/mps_sas_lsi.c +++ b/sys/dev/mps/mps_sas_lsi.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kthread.h> #include <sys/taskqueue.h> #include <sys/sbuf.h> +#include <sys/reboot.h> #include <machine/bus.h> #include <machine/resource.h> @@ -124,7 +125,7 @@ int mpssas_get_sas_address_for_sata_disk(struct mps_softc *sc, u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD); static int mpssas_volume_add(struct mps_softc *sc, u16 handle); -static void mpssas_SSU_to_SATA_devices(struct mps_softc *sc); +static void mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto); static void mpssas_stop_unit_done(struct cam_periph *periph, union ccb *done_ccb); @@ -1112,7 +1113,7 @@ out: * Return nothing. */ static void -mpssas_SSU_to_SATA_devices(struct mps_softc *sc) +mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto) { struct mpssas_softc *sassc = sc->sassc; union ccb *ccb; @@ -1120,7 +1121,7 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc) target_id_t targetid; struct mpssas_target *target; char path_str[64]; - struct timeval cur_time, start_time; + int timeout; /* * For each target, issue a StartStopUnit command to stop the device. @@ -1183,17 +1184,23 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc) } /* - * Wait until all of the SSU commands have completed or time has - * expired (60 seconds). Pause for 100ms each time through. If any - * command times out, the target will be reset in the SCSI command - * timeout routine. + * Timeout after 60 seconds by default or 10 seconds if howto has + * RB_NOSYNC set which indicates we're likely handling a panic. */ - getmicrotime(&start_time); - while (sc->SSU_refcount) { + timeout = 600; + if (howto & RB_NOSYNC) + timeout = 100; + + /* + * Wait until all of the SSU commands have completed or timeout has + * expired. Pause for 100ms each time through. If any command + * times out, the target will be reset in the SCSI command timeout + * routine. + */ + while (sc->SSU_refcount > 0) { pause("mpswait", hz/10); - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > 60) { + if (--timeout == 0) { mps_dprint(sc, MPS_FAULT, "Time has expired waiting " "for SSU commands to complete.\n"); break; @@ -1235,7 +1242,7 @@ mpssas_stop_unit_done(struct cam_periph *periph, union ccb *done_ccb) * Return nothing. */ void -mpssas_ir_shutdown(struct mps_softc *sc) +mpssas_ir_shutdown(struct mps_softc *sc, int howto) { u16 volume_mapping_flags; u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags); @@ -1340,5 +1347,5 @@ out: } } } - mpssas_SSU_to_SATA_devices(sc); + mpssas_SSU_to_SATA_devices(sc, howto); } diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h index 61806d286f90..ed3e42e35ee7 100644 --- a/sys/dev/mps/mpsvar.h +++ b/sys/dev/mps/mpsvar.h @@ -722,7 +722,7 @@ int mps_config_get_volume_wwid(struct mps_softc *sc, u16 volume_handle, int mps_config_get_raid_pd_pg0(struct mps_softc *sc, Mpi2ConfigReply_t *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 page_address); -void mpssas_ir_shutdown(struct mps_softc *sc); +void mpssas_ir_shutdown(struct mps_softc *sc, int howto); int mps_reinit(struct mps_softc *sc); void mpssas_handle_reinit(struct mps_softc *sc); |
