--- mfi_tbolt.c.orig 2013-06-06 20:48:21.000000000 -0400 +++ mfi_tbolt.c 2013-06-06 20:51:57.000000000 -0400 @@ -58,7 +58,7 @@ struct mfi_cmd_tbolt *mfi_tbolt_get_cmd(struct mfi_softc *sc, struct mfi_command *); union mfi_mpi2_request_descriptor * mfi_tbolt_get_request_descriptor(struct mfi_softc *sc, uint16_t index); -void mfi_tbolt_complete_cmd(struct mfi_softc *sc); +int mfi_tbolt_complete_cmd(struct mfi_softc *sc); int mfi_tbolt_build_io(struct mfi_softc *sc, struct mfi_command *mfi_cmd, struct mfi_cmd_tbolt *cmd); union mfi_mpi2_request_descriptor *mfi_tbolt_build_mpt_cmd(struct mfi_softc @@ -587,7 +587,9 @@ (void)sc->mfi_read_fw_status(sc); mtx_lock(&sc->mfi_io_lock); - mfi_tbolt_complete_cmd(sc); + while (mfi_tbolt_complete_cmd(sc) != 0) { + (void)sc->mfi_read_fw_status(sc); + } sc->mfi_flags &= ~MFI_FLAGS_QFRZN; mfi_startio(sc); mtx_unlock(&sc->mfi_io_lock); @@ -658,7 +660,7 @@ TAILQ_INSERT_TAIL(&sc->mfi_cmd_tbolt_tqh, tbolt_cmd, next); } -void +int mfi_tbolt_complete_cmd(struct mfi_softc *sc) { struct mfi_mpi2_reply_header *desc, *reply_desc; @@ -679,13 +681,13 @@ if (reply_desc == NULL) { device_printf(sc->mfi_dev, "reply desc is NULL!!\n"); - return; + return 0; } reply_descript_type = reply_desc->ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK; if (reply_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) - return; + return 0; num_completed = 0; val.word = ((union mfi_mpi2_reply_descriptor *)desc)->words; @@ -754,13 +756,13 @@ } if (!num_completed) - return; + return 0; /* update replyIndex to FW */ //if (sc->last_reply_idx) MFI_WRITE4(sc, MFI_RPI, sc->last_reply_idx); - return; + return num_completed; } /*