From ea49c35c1a01b3b284c951d90c28aa0cadc66b81 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Sun, 22 Aug 2021 16:06:29 +0200 Subject: [PATCH] Split scsi_command enums into separate enums for SASI and for SCSI --- src/raspberrypi/controllers/sasidev_ctrl.cpp | 10 ++--- src/raspberrypi/controllers/sasidev_ctrl.h | 29 ++---------- src/raspberrypi/controllers/scsidev_ctrl.h | 47 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 31 deletions(-) diff --git a/src/raspberrypi/controllers/sasidev_ctrl.cpp b/src/raspberrypi/controllers/sasidev_ctrl.cpp index 8d426a15..44cafe93 100644 --- a/src/raspberrypi/controllers/sasidev_ctrl.cpp +++ b/src/raspberrypi/controllers/sasidev_ctrl.cpp @@ -391,7 +391,7 @@ void SASIDEV::Execute() // Process by command // TODO This code does not belong here. Each device type needs such a dispatcher, which the controller has to call. - switch ((SASIDEV::scsi_command)ctrl.cmd[0]) { + switch ((SASIDEV::sasi_command)ctrl.cmd[0]) { // TEST UNIT READY case SASIDEV::eCmdTestUnitReady: CmdTestUnitReady(); @@ -449,9 +449,7 @@ void SASIDEV::Execute() CmdReleaseUnit(); return; - // SPECIFY (SASI only) - // This doesn't exist in the SCSI Spec, but was in the original RaSCSI code. - // leaving it here for now.... + // SPECIFY case SASIDEV::eCmdInvalid: CmdSpecify(); return; @@ -1281,7 +1279,7 @@ BOOL SASIDEV::XferOut(BOOL cont) } Disk *device = ctrl.unit[lun]; - switch ((SASIDEV::scsi_command) ctrl.cmd[0]) { + switch ((SASIDEV::sasi_command) ctrl.cmd[0]) { case SASIDEV::eCmdModeSelect: case SASIDEV::eCmdModeSelect10: if (!device->ModeSelect( @@ -1383,7 +1381,7 @@ void SASIDEV::FlushUnit() Disk *device = ctrl.unit[lun]; // WRITE system only - switch ((SASIDEV::scsi_command)ctrl.cmd[0]) { + switch ((SASIDEV::sasi_command)ctrl.cmd[0]) { case SASIDEV::eCmdWrite6: case SASIDEV::eCmdWrite10: case SASIDEV::eCmdWrite16: diff --git a/src/raspberrypi/controllers/sasidev_ctrl.h b/src/raspberrypi/controllers/sasidev_ctrl.h index 718d7273..e23e0917 100644 --- a/src/raspberrypi/controllers/sasidev_ctrl.h +++ b/src/raspberrypi/controllers/sasidev_ctrl.h @@ -55,52 +55,31 @@ protected: eMsgCodeTerminateIOProcess = 0x11, }; -protected: - enum scsi_command : int { +private: + enum sasi_command : int { eCmdTestUnitReady = 0x00, eCmdRezero = 0x01, eCmdRequestSense = 0x03, eCmdFormat = 0x04, eCmdReassign = 0x07, eCmdRead6 = 0x08, - eCmdRetrieveStats = 0x09, // DaynaPort specific command eCmdWrite6 = 0x0A, eCmdSeek6 = 0x0B, eCmdSetIfaceMode = 0x0C, // DaynaPort specific command eCmdSetMcastAddr = 0x0D, // DaynaPort specific command - eCmdEnableInterface = 0x0E, // DaynaPort specific command - eCmdInquiry = 0x12, eCmdModeSelect = 0x15, eCmdReserve6 = 0x16, eCmdRelease6 = 0x17, - eCmdModeSense = 0x1A, - eCmdStartStop = 0x1B, - eCmdSendDiag = 0x1D, - eCmdRemoval = 0x1E, - eCmdReadCapacity10 = 0x25, eCmdRead10 = 0x28, eCmdWrite10 = 0x2A, - eCmdSeek10 = 0x2B, eCmdVerify10 = 0x2E, eCmdVerify = 0x2F, - eCmdSynchronizeCache = 0x35, - eCmdReadDefectData10 = 0x37, - eCmdReadToc = 0x43, - eCmdPlayAudio10 = 0x45, - eCmdPlayAudioMSF = 0x47, - eCmdPlayAudioTrack = 0x48, - eCmdGetEventStatusNotification = 0x4a, eCmdModeSelect10 = 0x55, - eCmdReserve10 = 0x56, - eCmdRelease10 = 0x57, - eCmdModeSense10 = 0x5A, eCmdRead16 = 0x88, eCmdWrite16 = 0x8A, eCmdVerify16 = 0x8F, - eCmdReadCapacity16 = 0x9E, - eCmdReportLuns = 0xA0, - eCmdInvalid = 0xC2, // (SASI only/Suppress warning when using SxSI) - eCmdSasiCmdAssign = 0x0E, // This isn't used by SCSI, and can probably be removed. + eCmdInvalid = 0xC2, + eCmdSasiCmdAssign = 0x0E }; public: diff --git a/src/raspberrypi/controllers/scsidev_ctrl.h b/src/raspberrypi/controllers/scsidev_ctrl.h index 0cff80e7..9ee4fa00 100644 --- a/src/raspberrypi/controllers/scsidev_ctrl.h +++ b/src/raspberrypi/controllers/scsidev_ctrl.h @@ -24,6 +24,53 @@ //=========================================================================== class SCSIDEV : public SASIDEV { + +private: + enum scsi_command : int { + eCmdTestUnitReady = 0x00, + eCmdRezero = 0x01, + eCmdRequestSense = 0x03, + eCmdFormat = 0x04, + eCmdReassign = 0x07, + eCmdRead6 = 0x08, + eCmdRetrieveStats = 0x09, // DaynaPort specific command + eCmdWrite6 = 0x0A, + eCmdSeek6 = 0x0B, + eCmdSetIfaceMode = 0x0C, // DaynaPort specific command + eCmdSetMcastAddr = 0x0D, // DaynaPort specific command + eCmdEnableInterface = 0x0E, // DaynaPort specific command + eCmdInquiry = 0x12, + eCmdModeSelect = 0x15, + eCmdReserve6 = 0x16, + eCmdRelease6 = 0x17, + eCmdModeSense = 0x1A, + eCmdStartStop = 0x1B, + eCmdSendDiag = 0x1D, + eCmdRemoval = 0x1E, + eCmdReadCapacity10 = 0x25, + eCmdRead10 = 0x28, + eCmdWrite10 = 0x2A, + eCmdSeek10 = 0x2B, + eCmdVerify10 = 0x2E, + eCmdVerify = 0x2F, + eCmdSynchronizeCache = 0x35, + eCmdReadDefectData10 = 0x37, + eCmdReadToc = 0x43, + eCmdPlayAudio10 = 0x45, + eCmdPlayAudioMSF = 0x47, + eCmdPlayAudioTrack = 0x48, + eCmdGetEventStatusNotification = 0x4a, + eCmdModeSelect10 = 0x55, + eCmdReserve10 = 0x56, + eCmdRelease10 = 0x57, + eCmdModeSense10 = 0x5A, + eCmdRead16 = 0x88, + eCmdWrite16 = 0x8A, + eCmdVerify16 = 0x8F, + eCmdReadCapacity16 = 0x9E, + eCmdReportLuns = 0xA0 + }; + public: // Internal data definition typedef struct {