Index: sys/dev/mps/mps_sas.c =================================================================== --- sys/dev/mps/mps_sas.c +++ sys/dev/mps/mps_sas.c @@ -2220,18 +2220,6 @@ } } - /* - * If this is a Start Stop Unit command and it was issued by the driver - * during shutdown, decrement the refcount to account for all of the - * commands that were sent. All SSU commands should be completed before - * shutdown completes, meaning SSU_refcount will be 0 after SSU_started - * is TRUE. - */ - if (sc->SSU_started && (csio->cdb_io.cdb_bytes[0] == START_STOP_UNIT)) { - mps_dprint(sc, MPS_INFO, "Decrementing SSU count.\n"); - sc->SSU_refcount--; - } - /* Take the fast path to completion */ if (cm->cm_reply == NULL) { if (mpssas_get_ccbstatus(ccb) == CAM_REQ_INPROG) { Index: sys/dev/mps/mps_sas_lsi.c =================================================================== --- sys/dev/mps/mps_sas_lsi.c +++ sys/dev/mps/mps_sas_lsi.c @@ -1117,13 +1117,13 @@ target_id_t targetid; struct mpssas_target *target; char path_str[64]; - struct timeval cur_time, start_time; /* - * For each target, issue a StartStopUnit command to stop the device. + * Disable interrupts now because shutdown is in progress and don't want + * to rely on ISR to complete these. So polling must be done here as + * well. */ - sc->SSU_started = TRUE; - sc->SSU_refcount = 0; + mps_mask_intr(sc); for (targetid = 0; targetid < sc->max_devices; targetid++) { target = &sassc->targets[targetid]; if (target->handle == 0x0) { @@ -1157,12 +1157,9 @@ "handle %d\n", path_str, target->handle); /* - * Issue a START STOP UNIT command for the target. - * Increment the SSU counter to be used to count the - * number of required replies. + * Issue a START STOP UNIT command for the target and + * poll for completion. */ - mps_dprint(sc, MPS_INFO, "Incrementing SSU count\n"); - sc->SSU_refcount++; ccb->ccb_h.target_id = xpt_path_target_id(ccb->ccb_h.path); ccb->ccb_h.ppriv_ptr1 = sassc; @@ -1175,27 +1172,9 @@ /*immediate*/FALSE, MPS_SENSE_LEN, /*timeout*/10000); - xpt_action(ccb); + xpt_polled_action(ccb); } } - - /* - * 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. - */ - getmicrotime(&start_time); - while (sc->SSU_refcount) { - pause("mpswait", hz/10); - - getmicrotime(&cur_time); - if ((cur_time.tv_sec - start_time.tv_sec) > 60) { - mps_dprint(sc, MPS_FAULT, "Time has expired waiting " - "for SSU commands to complete.\n"); - break; - } - } } static void @@ -1214,9 +1193,7 @@ path_str); /* - * Nothing more to do except free the CCB and path. If the command - * timed out, an abort reset, then target reset will be issued during - * the SCSI Command process. + * Nothing more to do except free the CCB and path. */ xpt_free_path(done_ccb->ccb_h.path); xpt_free_ccb(done_ccb); Index: sys/dev/mps/mpsvar.h =================================================================== --- sys/dev/mps/mpsvar.h +++ sys/dev/mps/mpsvar.h @@ -421,10 +421,6 @@ char exclude_ids[80]; struct timeval lastfail; - - /* StartStopUnit command handling at shutdown */ - uint32_t SSU_refcount; - uint8_t SSU_started; }; struct mps_config_params {