From dede2a6f350917913f4ea37d970e7e83a3cdc1f5 Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Tue, 11 Oct 2022 17:04:17 +0200 Subject: [PATCH] Fix logging for Data Out phase, fixed offset (#907) Fixed issues found while testing for release 22.10 --- src/raspberrypi/controllers/scsi_controller.cpp | 10 ++++++++++ src/raspberrypi/devices/host_services.cpp | 3 +++ src/raspberrypi/devices/scsi_daynaport.cpp | 4 ++-- src/raspberrypi/devices/scsi_printer.cpp | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/raspberrypi/controllers/scsi_controller.cpp b/src/raspberrypi/controllers/scsi_controller.cpp index 783054cf..c5aa7cf8 100644 --- a/src/raspberrypi/controllers/scsi_controller.cpp +++ b/src/raspberrypi/controllers/scsi_controller.cpp @@ -776,6 +776,16 @@ void ScsiController::DataOutNonBlockOriented() assert(IsDataOut()); switch (GetOpcode()) { + // TODO Check why these cases are needed + case scsi_command::eCmdWrite6: + case scsi_command::eCmdWrite10: + case scsi_command::eCmdWrite16: + case scsi_command::eCmdWriteLong10: + case scsi_command::eCmdWriteLong16: + case scsi_command::eCmdVerify10: + case scsi_command::eCmdVerify16: + break; + case scsi_command::eCmdModeSelect6: case scsi_command::eCmdModeSelect10: { // TODO Try to get rid of this cast diff --git a/src/raspberrypi/devices/host_services.cpp b/src/raspberrypi/devices/host_services.cpp index aed2079e..95f12a41 100644 --- a/src/raspberrypi/devices/host_services.cpp +++ b/src/raspberrypi/devices/host_services.cpp @@ -36,6 +36,9 @@ HostServices::HostServices(int lun, const ControllerManager& manager) { dispatcher.Add(scsi_command::eCmdTestUnitReady, "TestUnitReady", &HostServices::TestUnitReady); dispatcher.Add(scsi_command::eCmdStartStop, "StartStopUnit", &HostServices::StartStopUnit); + + SetReady(true); + SetReset(false); } bool HostServices::Dispatch(scsi_command cmd) diff --git a/src/raspberrypi/devices/scsi_daynaport.cpp b/src/raspberrypi/devices/scsi_daynaport.cpp index b5b8ce9a..8b3eed54 100644 --- a/src/raspberrypi/devices/scsi_daynaport.cpp +++ b/src/raspberrypi/devices/scsi_daynaport.cpp @@ -358,7 +358,7 @@ void SCSIDaynaPort::Write6() ctrl->length = GetInt16(ctrl->cmd, 3); } else if (data_format == 0x80) { - ctrl->length = GetInt16(ctrl->cmd, 3 + 8); + ctrl->length = GetInt16(ctrl->cmd, 3) + 8; } else { LOGWARN("%s Unknown data format $%02X", __PRETTY_FUNCTION__, data_format) @@ -366,7 +366,7 @@ void SCSIDaynaPort::Write6() LOGTRACE("%s length: $%04X (%d) format: $%02X", __PRETTY_FUNCTION__, ctrl->length, ctrl->length, data_format) if (ctrl->length <= 0) { - throw scsi_exception(); + throw scsi_exception(sense_key::ILLEGAL_REQUEST, asc::INVALID_FIELD_IN_CDB); } // Set next block diff --git a/src/raspberrypi/devices/scsi_printer.cpp b/src/raspberrypi/devices/scsi_printer.cpp index 8356a2d4..a16820bd 100644 --- a/src/raspberrypi/devices/scsi_printer.cpp +++ b/src/raspberrypi/devices/scsi_printer.cpp @@ -60,6 +60,9 @@ SCSIPrinter::SCSIPrinter(int lun) : PrimaryDevice("SCLP", lun) dispatcher.Add(scsi_command::eCmdSynchronizeBuffer, "SynchronizeBuffer", &SCSIPrinter::SynchronizeBuffer); dispatcher.Add(scsi_command::eCmdSendDiag, "SendDiagnostic", &SCSIPrinter::SendDiagnostic); dispatcher.Add(scsi_command::eCmdStartStop, "StopPrint", &SCSIPrinter::StopPrint); + + SetReady(true); + SetReset(false); } SCSIPrinter::~SCSIPrinter()