mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-10 17:29:35 +00:00
Moved enums to base class to reduce circular dependencies
This commit is contained in:
parent
913e9e9e61
commit
d4a5c6e2e1
|
@ -17,7 +17,6 @@
|
|||
#include "filepath.h"
|
||||
#include "gpiobus.h"
|
||||
#include "devices/scsi_host_bridge.h"
|
||||
#include "controllers/scsidev_ctrl.h"
|
||||
#include "devices/scsi_daynaport.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
|
@ -550,53 +549,53 @@ void FASTCALL SASIDEV::Execute()
|
|||
#endif // RASCSI
|
||||
|
||||
// Process by command
|
||||
switch ((SCSIDEV::scsi_command)ctrl.cmd[0]) {
|
||||
switch ((SASIDEV::scsi_command)ctrl.cmd[0]) {
|
||||
// TEST UNIT READY
|
||||
case SCSIDEV::eCmdTestUnitReady:
|
||||
case SASIDEV::eCmdTestUnitReady:
|
||||
CmdTestUnitReady();
|
||||
return;
|
||||
|
||||
// REZERO UNIT
|
||||
case SCSIDEV::eCmdRezero:
|
||||
case SASIDEV::eCmdRezero:
|
||||
CmdRezero();
|
||||
return;
|
||||
|
||||
// REQUEST SENSE
|
||||
case SCSIDEV::eCmdRequestSense:
|
||||
case SASIDEV::eCmdRequestSense:
|
||||
CmdRequestSense();
|
||||
return;
|
||||
|
||||
// FORMAT UNIT
|
||||
// This doesn't exist in the SCSI Spec, but was in the original RaSCSI code.
|
||||
// leaving it here for now....
|
||||
case SCSIDEV::eCmdFormat:
|
||||
case SASIDEV::eCmdFormat:
|
||||
CmdFormat();
|
||||
return;
|
||||
|
||||
// REASSIGN BLOCKS
|
||||
case SCSIDEV::eCmdReassign:
|
||||
case SASIDEV::eCmdReassign:
|
||||
CmdReassign();
|
||||
return;
|
||||
|
||||
// READ(6)
|
||||
case SCSIDEV::eCmdRead6:
|
||||
case SASIDEV::eCmdRead6:
|
||||
CmdRead6();
|
||||
return;
|
||||
|
||||
// WRITE(6)
|
||||
case SCSIDEV::eCmdWrite6:
|
||||
case SASIDEV::eCmdWrite6:
|
||||
CmdWrite6();
|
||||
return;
|
||||
|
||||
// SEEK(6)
|
||||
case SCSIDEV::eCmdSeek6:
|
||||
case SASIDEV::eCmdSeek6:
|
||||
CmdSeek6();
|
||||
return;
|
||||
|
||||
// ASSIGN(SASIのみ)
|
||||
// This doesn't exist in the SCSI Spec, but was in the original RaSCSI code.
|
||||
// leaving it here for now....
|
||||
case SCSIDEV::eCmdSasiCmdAssign:
|
||||
case SASIDEV::eCmdSasiCmdAssign:
|
||||
CmdAssign();
|
||||
return;
|
||||
|
||||
|
@ -613,7 +612,7 @@ void FASTCALL SASIDEV::Execute()
|
|||
// SPECIFY(SASIのみ)
|
||||
// This doesn't exist in the SCSI Spec, but was in the original RaSCSI code.
|
||||
// leaving it here for now....
|
||||
case SCSIDEV::eCmdInvalid:
|
||||
case SASIDEV::eCmdInvalid:
|
||||
CmdSpecify();
|
||||
return;
|
||||
default:
|
||||
|
@ -1713,9 +1712,9 @@ BOOL FASTCALL SASIDEV::XferOut(BOOL cont)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
switch ((SCSIDEV::scsi_command) ctrl.cmd[0]) {
|
||||
case SCSIDEV::eCmdModeSelect:
|
||||
case SCSIDEV::eCmdModeSelect10:
|
||||
switch ((SASIDEV::scsi_command) ctrl.cmd[0]) {
|
||||
case SASIDEV::eCmdModeSelect:
|
||||
case SASIDEV::eCmdModeSelect10:
|
||||
if (!ctrl.unit[lun]->ModeSelect(
|
||||
ctrl.cmd, ctrl.buffer, ctrl.offset)) {
|
||||
// MODE SELECT failed
|
||||
|
@ -1723,9 +1722,9 @@ BOOL FASTCALL SASIDEV::XferOut(BOOL cont)
|
|||
}
|
||||
break;
|
||||
|
||||
case SCSIDEV::eCmdWrite6:
|
||||
case SCSIDEV::eCmdWrite10:
|
||||
case SCSIDEV::eCmdWriteAndVerify10:
|
||||
case SASIDEV::eCmdWrite6:
|
||||
case SASIDEV::eCmdWrite10:
|
||||
case SASIDEV::eCmdWriteAndVerify10:
|
||||
// If we're a host bridge, use the host bridge's SendMessage10
|
||||
// function
|
||||
if (ctrl.unit[lun]->GetID() == MAKEID('S', 'C', 'B', 'R')) {
|
||||
|
@ -1779,10 +1778,10 @@ BOOL FASTCALL SASIDEV::XferOut(BOOL cont)
|
|||
break;
|
||||
|
||||
// SPECIFY(SASI only)
|
||||
case SCSIDEV::eCmdInvalid:
|
||||
case SASIDEV::eCmdInvalid:
|
||||
break;
|
||||
|
||||
case SCSIDEV::eCmdSetMcastAddr:
|
||||
case SASIDEV::eCmdSetMcastAddr:
|
||||
LOGTRACE("%s Done with DaynaPort Set Multicast Address", __PRETTY_FUNCTION__);
|
||||
break;
|
||||
default:
|
||||
|
@ -1814,17 +1813,17 @@ void FASTCALL SASIDEV::FlushUnit()
|
|||
}
|
||||
|
||||
// WRITE system only
|
||||
switch ((SCSIDEV::scsi_command)ctrl.cmd[0]) {
|
||||
case SCSIDEV::eCmdWrite6:
|
||||
case SCSIDEV::eCmdWrite10:
|
||||
case SCSIDEV::eCmdWriteAndVerify10:
|
||||
switch ((SASIDEV::scsi_command)ctrl.cmd[0]) {
|
||||
case SASIDEV::eCmdWrite6:
|
||||
case SASIDEV::eCmdWrite10:
|
||||
case SASIDEV::eCmdWriteAndVerify10:
|
||||
// Flush
|
||||
if (!ctrl.unit[lun]->IsCacheWB()) {
|
||||
ctrl.unit[lun]->Flush();
|
||||
}
|
||||
break;
|
||||
case SCSIDEV::eCmdModeSelect:
|
||||
case SCSIDEV::eCmdModeSelect10:
|
||||
case SASIDEV::eCmdModeSelect:
|
||||
case SASIDEV::eCmdModeSelect10:
|
||||
// Debug code related to Issue #2 on github, where we get an unhandled Model select when
|
||||
// the mac is rebooted
|
||||
// https://github.com/akuker/RASCSI/issues/2
|
||||
|
@ -1846,10 +1845,10 @@ void FASTCALL SASIDEV::FlushUnit()
|
|||
return;
|
||||
}
|
||||
break;
|
||||
case SCSIDEV::eCmdSetIfaceMode:
|
||||
case SASIDEV::eCmdSetIfaceMode:
|
||||
LOGWARN("%s Trying to flush a command set interface mode. This should be a daynaport?", __PRETTY_FUNCTION__);
|
||||
break;
|
||||
case SCSIDEV::eCmdSetMcastAddr:
|
||||
case SASIDEV::eCmdSetMcastAddr:
|
||||
// TODO: Eventually, we should store off the multicast address configuration data here...
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -30,6 +30,74 @@
|
|||
//===========================================================================
|
||||
class SASIDEV
|
||||
{
|
||||
protected:
|
||||
enum scsi_message_code : BYTE {
|
||||
eMsgCodeAbort = 0x06,
|
||||
eMsgCodeAbortTag = 0x0D,
|
||||
eMsgCodeBusDeviceReset = 0x0C,
|
||||
eMsgCodeClearQueue = 0x0E,
|
||||
eMsgCodeCommandComplete = 0x00,
|
||||
eMsgCodeDisconnect = 0x04,
|
||||
eMsgCodeIdentify = 0x80,
|
||||
eMsgCodeIgnoreWideResidue = 0x23, // (Two Bytes)
|
||||
eMsgCodeInitiateRecovery = 0x0F,
|
||||
eMsgCodeInitiatorDetectedError = 0x05,
|
||||
eMsgCodeLinkedCommandComplete = 0x0A,
|
||||
eMsgCodeLinkedCommandCompleteWithFlag = 0x0B,
|
||||
eMsgCodeMessageParityError = 0x09,
|
||||
eMsgCodeMessageReject = 0x07,
|
||||
eMsgCodeNoOperation = 0x08,
|
||||
eMsgCodeHeadOfQueueTag = 0x21,
|
||||
eMsgCodeOrderedQueueTag = 0x22,
|
||||
eMsgCodeSimpleQueueTag = 0x20,
|
||||
eMsgCodeReleaseRecovery = 0x10,
|
||||
eMsgCodeRestorePointers = 0x03,
|
||||
eMsgCodeSaveDataPointer = 0x02,
|
||||
eMsgCodeTerminateIOProcess = 0x11,
|
||||
};
|
||||
|
||||
enum scsi_command : BYTE {
|
||||
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,
|
||||
eCmdRcvDiag = 0x1C,
|
||||
eCmdSendDiag = 0x1D,
|
||||
eCmdRemoval = 0x1E,
|
||||
eCmdReadCapacity = 0x25,
|
||||
eCmdRead10 = 0x28,
|
||||
eCmdWrite10 = 0x2A,
|
||||
eCmdSeek10 = 0x2B,
|
||||
eCmdWriteAndVerify10 = 0x2E,
|
||||
eCmdVerify = 0x2F,
|
||||
eCmdSynchronizeCache = 0x35,
|
||||
eCmdReadDefectData10 = 0x37,
|
||||
eCmdReadToc = 0x43,
|
||||
eCmdPlayAudio10 = 0x45,
|
||||
eCmdPlayAudioMSF = 0x47,
|
||||
eCmdPlayAudioTrack = 0x48,
|
||||
eCmdModeSelect10 = 0x55,
|
||||
eCmdReserve10 = 0x56,
|
||||
eCmdRelease10 = 0x57,
|
||||
eCmdModeSense10 = 0x5A,
|
||||
eCmdInvalid = 0xC2, // (SASI only/Suppress warning when using SxSI)
|
||||
eCmdSasiCmdAssign = 0x0e, // This isn't used by SCSI, and can probably be removed.
|
||||
};
|
||||
|
||||
public:
|
||||
enum {
|
||||
UnitMax = 8 // Maximum number of logical units
|
||||
|
|
|
@ -39,74 +39,6 @@ public:
|
|||
BYTE msb[256];
|
||||
} scsi_t;
|
||||
|
||||
|
||||
enum scsi_message_code : BYTE {
|
||||
eMsgCodeAbort = 0x06,
|
||||
eMsgCodeAbortTag = 0x0D,
|
||||
eMsgCodeBusDeviceReset = 0x0C,
|
||||
eMsgCodeClearQueue = 0x0E,
|
||||
eMsgCodeCommandComplete = 0x00,
|
||||
eMsgCodeDisconnect = 0x04,
|
||||
eMsgCodeIdentify = 0x80,
|
||||
eMsgCodeIgnoreWideResidue = 0x23, // (Two Bytes)
|
||||
eMsgCodeInitiateRecovery = 0x0F,
|
||||
eMsgCodeInitiatorDetectedError = 0x05,
|
||||
eMsgCodeLinkedCommandComplete = 0x0A,
|
||||
eMsgCodeLinkedCommandCompleteWithFlag = 0x0B,
|
||||
eMsgCodeMessageParityError = 0x09,
|
||||
eMsgCodeMessageReject = 0x07,
|
||||
eMsgCodeNoOperation = 0x08,
|
||||
eMsgCodeHeadOfQueueTag = 0x21,
|
||||
eMsgCodeOrderedQueueTag = 0x22,
|
||||
eMsgCodeSimpleQueueTag = 0x20,
|
||||
eMsgCodeReleaseRecovery = 0x10,
|
||||
eMsgCodeRestorePointers = 0x03,
|
||||
eMsgCodeSaveDataPointer = 0x02,
|
||||
eMsgCodeTerminateIOProcess = 0x11,
|
||||
};
|
||||
|
||||
enum scsi_command : BYTE {
|
||||
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,
|
||||
eCmdRcvDiag = 0x1C,
|
||||
eCmdSendDiag = 0x1D,
|
||||
eCmdRemoval = 0x1E,
|
||||
eCmdReadCapacity = 0x25,
|
||||
eCmdRead10 = 0x28,
|
||||
eCmdWrite10 = 0x2A,
|
||||
eCmdSeek10 = 0x2B,
|
||||
eCmdWriteAndVerify10 = 0x2E,
|
||||
eCmdVerify = 0x2F,
|
||||
eCmdSynchronizeCache = 0x35,
|
||||
eCmdReadDefectData10 = 0x37,
|
||||
eCmdReadToc = 0x43,
|
||||
eCmdPlayAudio10 = 0x45,
|
||||
eCmdPlayAudioMSF = 0x47,
|
||||
eCmdPlayAudioTrack = 0x48,
|
||||
eCmdModeSelect10 = 0x55,
|
||||
eCmdReserve10 = 0x56,
|
||||
eCmdRelease10 = 0x57,
|
||||
eCmdModeSense10 = 0x5A,
|
||||
eCmdInvalid = 0xC2, // (SASI only/Suppress warning when using SxSI)
|
||||
eCmdSasiCmdAssign = 0x0e, // This isn't used by SCSI, and can probably be removed.
|
||||
};
|
||||
|
||||
std::map<BYTE, const char*> scsi_command_strings;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue
Block a user