From a79fdc0f67d898b2bf074aa423c589de5bb06903 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Mon, 23 Aug 2021 12:36:35 +0200 Subject: [PATCH] Updated delegation for TEST UNIT READY and REZERO --- src/raspberrypi/controllers/sasidev_ctrl.cpp | 20 ++------------------ src/raspberrypi/devices/disk.cpp | 15 ++------------- src/raspberrypi/devices/disk.h | 3 +-- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/raspberrypi/controllers/sasidev_ctrl.cpp b/src/raspberrypi/controllers/sasidev_ctrl.cpp index fb2e9a6c..aaacf308 100644 --- a/src/raspberrypi/controllers/sasidev_ctrl.cpp +++ b/src/raspberrypi/controllers/sasidev_ctrl.cpp @@ -668,15 +668,7 @@ void SASIDEV::CmdTestUnitReady() LOGTRACE("%s TEST UNIT READY Command ", __PRETTY_FUNCTION__); // Command processing on drive - bool status = ((Disk *)ctrl.device)->TestUnitReady(ctrl.cmd); - if (!status) { - // Failure (Error) - Error(); - return; - } - - // status phase - Status(); + ctrl.device->TestUnitReady(this); } //--------------------------------------------------------------------------- @@ -689,15 +681,7 @@ void SASIDEV::CmdRezero() LOGTRACE( "%s REZERO UNIT Command ", __PRETTY_FUNCTION__); // Command processing on drive - bool status = ctrl.device->Rezero(ctrl.cmd); - if (!status) { - // Failure (Error) - Error(); - return; - } - - // status phase - Status(); + ctrl.device->Rezero(this); } //--------------------------------------------------------------------------- diff --git a/src/raspberrypi/devices/disk.cpp b/src/raspberrypi/devices/disk.cpp index 7536d87e..85c1461b 100644 --- a/src/raspberrypi/devices/disk.cpp +++ b/src/raspberrypi/devices/disk.cpp @@ -355,7 +355,7 @@ BOOL DiskTrack::Read(BYTE *buf, int sec) const void Disk::TestUnitReady(SASIDEV *controller) { - bool status = TestUnitReady(ctrl->cmd); + bool status = CheckReady(); if (!status) { // Failure (Error) controller->Error(); @@ -368,7 +368,7 @@ void Disk::TestUnitReady(SASIDEV *controller) void Disk::Rezero(SASIDEV *controller) { - bool status = Rezero(ctrl->cmd); + bool status = CheckReady(); if (!status) { // Failure (Error) controller->Error(); @@ -1974,17 +1974,6 @@ bool Disk::TestUnitReady(const DWORD* /*cdb*/) return CheckReady(); } -//--------------------------------------------------------------------------- -// -// REZERO UNIT -// -//--------------------------------------------------------------------------- -bool Disk::Rezero(const DWORD* /*cdb*/) -{ - // Status check - return CheckReady(); -} - //--------------------------------------------------------------------------- // // FORMAT UNIT diff --git a/src/raspberrypi/devices/disk.h b/src/raspberrypi/devices/disk.h index b7bf6b57..6b1012e3 100644 --- a/src/raspberrypi/devices/disk.h +++ b/src/raspberrypi/devices/disk.h @@ -227,9 +227,8 @@ public: void SetBlockCount(DWORD); bool GetStartAndCount(SASIDEV *, uint64_t&, uint32_t&, bool); - // TODO Try to get rid of these methods, which are currently used by SASIDEV + // TODO Try to get rid of these methods virtual bool TestUnitReady(const DWORD *cdb); // TEST UNIT READY command - bool Rezero(const DWORD *cdb); // REZERO command virtual int RequestSense(const DWORD *cdb, BYTE *buf); // REQUEST SENSE command virtual bool ModeSelect(const DWORD *cdb, const BYTE *buf, int length);// MODE SELECT command virtual int ModeSense(const DWORD *cdb, BYTE *buf); // MODE SENSE command