SASI Format opcode is 0x06, not 0x04 (see comment in code)

This commit is contained in:
Uwe Seimet 2021-08-30 11:09:17 +02:00
parent c5240e62e1
commit 0677b9f9bf
4 changed files with 11 additions and 46 deletions

View File

@ -1122,7 +1122,7 @@ bool SASIDEV::XferOut(bool cont)
Disk *device = ctrl.unit[lun]; Disk *device = ctrl.unit[lun];
switch ((SASIDEV::sasi_command) ctrl.cmd[0]) { switch ((SASIDEV::sasi_command) ctrl.cmd[0]) {
case SASIDEV::eCmdModeSelect: case SASIDEV::eCmdModeSelect6:
case SASIDEV::eCmdModeSelect10: case SASIDEV::eCmdModeSelect10:
if (!device->ModeSelect(ctrl.cmd, ctrl.buffer, ctrl.offset)) { if (!device->ModeSelect(ctrl.cmd, ctrl.buffer, ctrl.offset)) {
// MODE SELECT failed // MODE SELECT failed
@ -1228,7 +1228,7 @@ void SASIDEV::FlushUnit()
case SASIDEV::eCmdVerify16: case SASIDEV::eCmdVerify16:
break; break;
case SASIDEV::eCmdModeSelect: case SASIDEV::eCmdModeSelect6:
case SASIDEV::eCmdModeSelect10: case SASIDEV::eCmdModeSelect10:
// Debug code related to Issue #2 on github, where we get an unhandled Mode Select when // Debug code related to Issue #2 on github, where we get an unhandled Mode Select when
// the mac is rebooted // the mac is rebooted

View File

@ -60,13 +60,13 @@ private:
eCmdTestUnitReady = 0x00, eCmdTestUnitReady = 0x00,
eCmdRezero = 0x01, eCmdRezero = 0x01,
eCmdRequestSense = 0x03, eCmdRequestSense = 0x03,
eCmdFormat = 0x04, eCmdFormat = 0x06,
eCmdReassign = 0x07, eCmdReassign = 0x07,
eCmdRead6 = 0x08, eCmdRead6 = 0x08,
eCmdWrite6 = 0x0A, eCmdWrite6 = 0x0A,
eCmdSeek6 = 0x0B, eCmdSeek6 = 0x0B,
eCmdSetMcastAddr = 0x0D, // DaynaPort specific command eCmdSetMcastAddr = 0x0D, // DaynaPort specific command
eCmdModeSelect = 0x15, eCmdModeSelect6 = 0x15,
eCmdReserve6 = 0x16, eCmdReserve6 = 0x16,
eCmdRelease6 = 0x17, eCmdRelease6 = 0x17,
eCmdRead10 = 0x28, eCmdRead10 = 0x28,

View File

@ -40,10 +40,10 @@ public:
eCmdSetMcastAddr = 0x0D, // DaynaPort specific command eCmdSetMcastAddr = 0x0D, // DaynaPort specific command
eCmdEnableInterface = 0x0E, // DaynaPort specific command eCmdEnableInterface = 0x0E, // DaynaPort specific command
eCmdInquiry = 0x12, eCmdInquiry = 0x12,
eCmdModeSelect = 0x15, eCmdModeSelect6 = 0x15,
eCmdReserve6 = 0x16, eCmdReserve6 = 0x16,
eCmdRelease6 = 0x17, eCmdRelease6 = 0x17,
eCmdModeSense = 0x1A, eCmdModeSense6 = 0x1A,
eCmdStartStop = 0x1B, eCmdStartStop = 0x1B,
eCmdSendDiag = 0x1D, eCmdSendDiag = 0x1D,
eCmdRemoval = 0x1E, eCmdRemoval = 0x1E,

View File

@ -54,10 +54,10 @@ Disk::Disk(const std::string id) : Device(id), ScsiPrimaryCommands(), ScsiBlockC
AddCommand(SCSIDEV::eCmdWrite6, "Write6", &Disk::Write6); AddCommand(SCSIDEV::eCmdWrite6, "Write6", &Disk::Write6);
AddCommand(SCSIDEV::eCmdSeek6, "Seek6", &Disk::Seek6); AddCommand(SCSIDEV::eCmdSeek6, "Seek6", &Disk::Seek6);
AddCommand(SCSIDEV::eCmdInquiry, "Inquiry", &Disk::Inquiry); AddCommand(SCSIDEV::eCmdInquiry, "Inquiry", &Disk::Inquiry);
AddCommand(SCSIDEV::eCmdModeSelect, "ModeSelect", &Disk::ModeSelect); AddCommand(SCSIDEV::eCmdModeSelect6, "ModeSelect6", &Disk::ModeSelect);
AddCommand(SCSIDEV::eCmdReserve6, "Reserve6", &Disk::Reserve6); AddCommand(SCSIDEV::eCmdReserve6, "Reserve6", &Disk::Reserve6);
AddCommand(SCSIDEV::eCmdRelease6, "Release6", &Disk::Release6); AddCommand(SCSIDEV::eCmdRelease6, "Release6", &Disk::Release6);
AddCommand(SCSIDEV::eCmdModeSense, "ModeSense", &Disk::ModeSense); AddCommand(SCSIDEV::eCmdModeSense6, "ModeSense6", &Disk::ModeSense);
AddCommand(SCSIDEV::eCmdStartStop, "StartStopUnit", &Disk::StartStopUnit); AddCommand(SCSIDEV::eCmdStartStop, "StartStopUnit", &Disk::StartStopUnit);
AddCommand(SCSIDEV::eCmdSendDiag, "SendDiagnostic", &Disk::SendDiagnostic); AddCommand(SCSIDEV::eCmdSendDiag, "SendDiagnostic", &Disk::SendDiagnostic);
AddCommand(SCSIDEV::eCmdRemoval, "PreventAllowMediumRemoval", &Disk::PreventAllowMediumRemoval); AddCommand(SCSIDEV::eCmdRemoval, "PreventAllowMediumRemoval", &Disk::PreventAllowMediumRemoval);
@ -732,7 +732,6 @@ int Disk::ModeSense(const DWORD *cdb, BYTE *buf)
{ {
ASSERT(cdb); ASSERT(cdb);
ASSERT(buf); ASSERT(buf);
ASSERT(cdb[0] == 0x1a);
// Get length, clear buffer // Get length, clear buffer
int length = (int)cdb[4]; int length = (int)cdb[4];
@ -854,13 +853,11 @@ int Disk::ModeSense(const DWORD *cdb, BYTE *buf)
// MODE SENSE(10) // MODE SENSE(10)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// TODO Remove duplicate code, see MODE SENSE above
int Disk::ModeSense10(const DWORD *cdb, BYTE *buf) int Disk::ModeSense10(const DWORD *cdb, BYTE *buf)
{ {
int ret;
ASSERT(cdb); ASSERT(cdb);
ASSERT(buf); ASSERT(buf);
ASSERT(cdb[0] == 0x5a);
// Get length, clear buffer // Get length, clear buffer
int length = cdb[7]; int length = cdb[7];
@ -957,7 +954,7 @@ int Disk::ModeSense10(const DWORD *cdb, BYTE *buf)
} }
// Page (vendor special) // Page (vendor special)
ret = AddVendor(page, change, &buf[size]); int ret = AddVendor(page, change, &buf[size]);
if (ret > 0) { if (ret > 0) {
size += ret; size += ret;
valid = true; valid = true;
@ -988,11 +985,6 @@ int Disk::AddError(bool change, BYTE *buf)
buf[0] = 0x01; buf[0] = 0x01;
buf[1] = 0x0a; buf[1] = 0x0a;
// No changeable area
if (change) {
return 12;
}
// Retry count is 0, limit time uses internal default value // Retry count is 0, limit time uses internal default value
return 12; return 12;
} }
@ -1004,8 +996,6 @@ int Disk::AddError(bool change, BYTE *buf)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int Disk::AddFormat(bool change, BYTE *buf) int Disk::AddFormat(bool change, BYTE *buf)
{ {
int size;
ASSERT(buf); ASSERT(buf);
// Set the message length // Set the message length
@ -1029,7 +1019,7 @@ int Disk::AddFormat(bool change, BYTE *buf)
buf[0xb] = 0x19; buf[0xb] = 0x19;
// Set the number of bytes in the physical sector // Set the number of bytes in the physical sector
size = 1 << disk.size; int size = 1 << disk.size;
buf[0xc] = (BYTE)(size >> 8); buf[0xc] = (BYTE)(size >> 8);
buf[0xd] = (BYTE)size; buf[0xd] = (BYTE)size;
} }
@ -1090,11 +1080,6 @@ int Disk::AddOpt(bool change, BYTE *buf)
buf[0] = 0x06; buf[0] = 0x06;
buf[1] = 0x02; buf[1] = 0x02;
// No changeable area
if (change) {
return 4;
}
// Do not report update blocks // Do not report update blocks
return 4; return 4;
} }
@ -1112,11 +1097,6 @@ int Disk::AddCache(bool change, BYTE *buf)
buf[0] = 0x08; buf[0] = 0x08;
buf[1] = 0x0a; buf[1] = 0x0a;
// No changeable area
if (change) {
return 12;
}
// Only read cache is valid, no prefetch // Only read cache is valid, no prefetch
return 12; return 12;
} }
@ -1162,11 +1142,6 @@ int Disk::AddCDDA(bool change, BYTE *buf)
buf[0] = 0x0e; buf[0] = 0x0e;
buf[1] = 0x0e; buf[1] = 0x0e;
// No changeable area
if (change) {
return 16;
}
// Audio waits for operation completion and allows // Audio waits for operation completion and allows
// PLAY across multiple tracks // PLAY across multiple tracks
return 16; return 16;
@ -1193,7 +1168,6 @@ int Disk::ReadDefectData10(const DWORD *cdb, BYTE *buf)
{ {
ASSERT(cdb); ASSERT(cdb);
ASSERT(buf); ASSERT(buf);
ASSERT(cdb[0] == 0x37);
// Get length, clear buffer // Get length, clear buffer
DWORD length = cdb[7]; DWORD length = cdb[7];
@ -1224,12 +1198,6 @@ int Disk::ReadDefectData10(const DWORD *cdb, BYTE *buf)
return 4; return 4;
} }
//---------------------------------------------------------------------------
//
// Command
//
//---------------------------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// FORMAT UNIT // FORMAT UNIT
@ -1422,7 +1390,6 @@ bool Disk::Assign(const DWORD* /*cdb*/)
bool Disk::StartStop(const DWORD *cdb) bool Disk::StartStop(const DWORD *cdb)
{ {
ASSERT(cdb); ASSERT(cdb);
ASSERT(cdb[0] == 0x1b);
// Look at the eject bit and eject if necessary // Look at the eject bit and eject if necessary
if (cdb[4] & 0x02) { if (cdb[4] & 0x02) {
@ -1447,7 +1414,6 @@ bool Disk::StartStop(const DWORD *cdb)
bool Disk::SendDiag(const DWORD *cdb) bool Disk::SendDiag(const DWORD *cdb)
{ {
ASSERT(cdb); ASSERT(cdb);
ASSERT(cdb[0] == 0x1d);
// Do not support PF bit // Do not support PF bit
if (cdb[1] & 0x10) { if (cdb[1] & 0x10) {
@ -1472,7 +1438,6 @@ bool Disk::SendDiag(const DWORD *cdb)
bool Disk::Removal(const DWORD *cdb) bool Disk::Removal(const DWORD *cdb)
{ {
ASSERT(cdb); ASSERT(cdb);
ASSERT(cdb[0] == 0x1e);
// Status check // Status check
if (!CheckReady()) { if (!CheckReady()) {