From add834cc61cc4fe8e35b5b0322d0a55cec6b5e3b Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Tue, 23 Jan 2024 20:50:50 +0100 Subject: [PATCH] Update phase dispatcher --- cpp/shared_initiator/phase_executor.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cpp/shared_initiator/phase_executor.cpp b/cpp/shared_initiator/phase_executor.cpp index 222b023f..d1f8e224 100644 --- a/cpp/shared_initiator/phase_executor.cpp +++ b/cpp/shared_initiator/phase_executor.cpp @@ -107,7 +107,8 @@ bool PhaseExecutor::Dispatch(scsi_command cmd, span cdb, span break; default: - throw phase_exception(string("Ignoring ") + Bus::GetPhaseName(phase) + " phase"); + spdlog::error(string("Ignoring ") + Bus::GetPhaseName(phase) + " phase"); + return false; } return true; @@ -198,24 +199,25 @@ void PhaseExecutor::Status() array buf; if (bus.ReceiveHandShake(buf.data(), 1) != static_cast(buf.size())) { - throw phase_exception("STATUS phase failed"); + spdlog::error("STATUS phase failed"); + } + else { + status = buf[0]; } - - status = buf[0]; } void PhaseExecutor::DataIn(span buffer, int length) { byte_count = bus.ReceiveHandShake(buffer.data(), length); if (!byte_count) { - throw phase_exception("DATA IN phase failed"); + spdlog::error("DATA IN phase failed"); } } void PhaseExecutor::DataOut(span buffer, int length) { if (bus.SendHandShake(buffer.data(), length) != length) { - throw phase_exception("DATA OUT phase failed"); + spdlog::error("DATA OUT phase failed"); } } @@ -224,10 +226,9 @@ void PhaseExecutor::MsgIn() array buf = { }; if (bus.ReceiveHandShake(buf.data(), buf.size()) != buf.size()) { - throw phase_exception("MESSAGE IN phase failed"); + spdlog::error("MESSAGE IN phase failed"); } - - if (buf[0]) { + else if (buf[0]) { spdlog::warn( fmt::format("MESSAGE IN did not report COMMAND COMPLETE, rejecting unsupported message ${:02x}", buf[0])); @@ -249,7 +250,7 @@ void PhaseExecutor::MsgOut() reject = false; if (bus.SendHandShake(buf.data(), buf.size()) != buf.size()) { - throw phase_exception("MESSAGE OUT phase for IDENTIFY failed"); + spdlog::error("MESSAGE OUT phase for IDENTIFY failed"); } }