Index: sys/dev/mpr/mpr_sas_lsi.c =================================================================== --- sys/dev/mpr/mpr_sas_lsi.c +++ sys/dev/mpr/mpr_sas_lsi.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -127,7 +128,7 @@ u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD); static int mprsas_volume_add(struct mpr_softc *sc, u16 handle); -static void mprsas_SSU_to_SATA_devices(struct mpr_softc *sc); +static void mprsas_SSU_to_SATA_devices(struct mpr_softc *sc, int howto); static void mprsas_stop_unit_done(struct cam_periph *periph, union ccb *done_ccb); @@ -1469,7 +1470,7 @@ * Return nothing. */ static void -mprsas_SSU_to_SATA_devices(struct mpr_softc *sc) +mprsas_SSU_to_SATA_devices(struct mpr_softc *sc, int howto) { struct mprsas_softc *sassc = sc->sassc; union ccb *ccb; @@ -1477,7 +1478,7 @@ target_id_t targetid; struct mprsas_target *target; char path_str[64]; - struct timeval cur_time, start_time; + int timeout; mpr_lock(sc); @@ -1543,19 +1544,26 @@ mpr_unlock(sc); + + /* + * Timeout after 60 seconds by default or 10 seconds if howto has + * RB_NOSYNC set which indicates we're likely handling a panic. + */ + timeout = 600; + if (howto & RB_NOSYNC) + timeout = 100; + /* - * 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. + * 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. */ - getmicrotime(&start_time); - while (sc->SSU_refcount) { + while (sc->SSU_refcount > 0) { pause("mprwait", hz/10); - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > 60) { - mpr_dprint(sc, MPR_ERROR, "Time has expired waiting " + if (--timeout == 0) { + mpr_dprint(sc, MPR_FAULT, "Time has expired waiting " "for SSU commands to complete.\n"); break; } @@ -1596,7 +1604,7 @@ * Return nothing. */ void -mprsas_ir_shutdown(struct mpr_softc *sc) +mprsas_ir_shutdown(struct mpr_softc *sc, int howto) { u16 volume_mapping_flags; u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags); @@ -1701,5 +1709,5 @@ } } } - mprsas_SSU_to_SATA_devices(sc); + mprsas_SSU_to_SATA_devices(sc, howto); } Index: sys/dev/mpr/mprvar.h =================================================================== --- sys/dev/mpr/mprvar.h +++ sys/dev/mpr/mprvar.h @@ -807,7 +807,7 @@ int mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 page_address); -void mprsas_ir_shutdown(struct mpr_softc *sc); +void mprsas_ir_shutdown(struct mpr_softc *sc, int howto); int mpr_reinit(struct mpr_softc *sc); void mprsas_handle_reinit(struct mpr_softc *sc);