mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-15 11:34:09 +00:00
Merge branch 'feature_controller_cleanup' into uweseimet_develop
This commit is contained in:
commit
073113539c
@ -466,7 +466,17 @@ void SASIDEV::Execute()
|
||||
}
|
||||
|
||||
// Unsupported command
|
||||
CmdInvalid();
|
||||
LOGWARN("%s ID %d received unsupported command: $%02X", __PRETTY_FUNCTION__, GetSCSIID(), (BYTE)ctrl.cmd[0]);
|
||||
|
||||
// Logical Unit
|
||||
DWORD lun = (ctrl.cmd[1] >> 5) & 0x07;
|
||||
if (ctrl.unit[lun]) {
|
||||
// Command processing on drive
|
||||
ctrl.unit[lun]->SetStatusCode(STATUS_INVALIDCMD);
|
||||
}
|
||||
|
||||
// Failure (Error)
|
||||
Error();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -960,26 +970,6 @@ void SASIDEV::CmdSpecify()
|
||||
DataOut();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Unsupported command
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void SASIDEV::CmdInvalid()
|
||||
{
|
||||
LOGWARN("%s ID %d received unsupported command: $%02X", __PRETTY_FUNCTION__, GetSCSIID(), (BYTE)ctrl.cmd[0]);
|
||||
|
||||
// Logical Unit
|
||||
DWORD lun = (ctrl.cmd[1] >> 5) & 0x07;
|
||||
if (ctrl.unit[lun]) {
|
||||
// Command processing on drive
|
||||
ctrl.unit[lun]->SetStatusCode(STATUS_INVALIDCMD);
|
||||
}
|
||||
|
||||
// Failure (Error)
|
||||
Error();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Data transfer
|
||||
@ -993,14 +983,12 @@ void SASIDEV::CmdInvalid()
|
||||
//---------------------------------------------------------------------------
|
||||
void SASIDEV::Send()
|
||||
{
|
||||
int len;
|
||||
|
||||
ASSERT(!ctrl.bus->GetREQ());
|
||||
ASSERT(ctrl.bus->GetIO());
|
||||
|
||||
// Check that the length isn't 0
|
||||
if (ctrl.length != 0) {
|
||||
len = ctrl.bus->SendHandShake(
|
||||
int len = ctrl.bus->SendHandShake(
|
||||
&ctrl.buffer[ctrl.offset], ctrl.length, BUS::SEND_NO_DELAY);
|
||||
|
||||
// If you can not send it all, move on to the status phase
|
||||
@ -1084,8 +1072,6 @@ void SASIDEV::Send()
|
||||
//---------------------------------------------------------------------------
|
||||
void SASIDEV::Receive()
|
||||
{
|
||||
int len;
|
||||
|
||||
// REQ is low
|
||||
ASSERT(!ctrl.bus->GetREQ());
|
||||
ASSERT(!ctrl.bus->GetIO());
|
||||
@ -1093,7 +1079,7 @@ void SASIDEV::Receive()
|
||||
// Length != 0 if received
|
||||
if (ctrl.length != 0) {
|
||||
// Receive
|
||||
len = ctrl.bus->ReceiveHandShake(
|
||||
int len = ctrl.bus->ReceiveHandShake(
|
||||
&ctrl.buffer[ctrl.offset], ctrl.length);
|
||||
LOGDEBUG("%s Received %d bytes", __PRETTY_FUNCTION__, len);
|
||||
|
||||
|
@ -173,7 +173,7 @@ protected:
|
||||
virtual void Command(); // Command phase
|
||||
virtual void Execute(); // Execution phase
|
||||
|
||||
// commands
|
||||
// Commands
|
||||
void CmdTestUnitReady(); // TEST UNIT READY command
|
||||
void CmdRezero(); // REZERO UNIT command
|
||||
void CmdRequestSense(); // REQUEST SENSE command
|
||||
@ -186,10 +186,9 @@ protected:
|
||||
void CmdSeek6(); // SEEK(6) command
|
||||
void CmdAssign(); // ASSIGN command
|
||||
void CmdSpecify(); // SPECIFY command
|
||||
void CmdInvalid(); // Unsupported command
|
||||
// データ転送
|
||||
virtual void Send(); // Send data
|
||||
|
||||
// Data transfer
|
||||
virtual void Send(); // Send data
|
||||
virtual void Receive(); // Receive data
|
||||
|
||||
BOOL XferIn(BYTE* buf); // Data transfer IN
|
||||
|
@ -1277,7 +1277,7 @@ bool Disk::Dispatch(SCSIDEV *controller)
|
||||
//---------------------------------------------------------------------------
|
||||
void Disk::Open(const Filepath& path)
|
||||
{
|
||||
ASSERT((disk.size >= 8) && (disk.size <= 11));
|
||||
ASSERT((disk.size >= 8) && (disk.size <= 12));
|
||||
ASSERT(disk.blocks > 0);
|
||||
|
||||
SetReady(true);
|
||||
@ -1367,7 +1367,6 @@ BOOL Disk::CheckReady()
|
||||
}
|
||||
|
||||
// Initialization with no error
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
LOGDEBUG("%s Disk is ready!", __PRETTY_FUNCTION__);
|
||||
|
||||
return TRUE;
|
||||
@ -1415,9 +1414,6 @@ int Disk::RequestSense(const DWORD *cdb, BYTE *buf)
|
||||
buf[12] = (BYTE)(GetStatusCode() >> 8);
|
||||
buf[13] = (BYTE)GetStatusCode();
|
||||
|
||||
// Clear the code
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -1616,8 +1612,6 @@ int Disk::ModeSense(const DWORD *cdb, BYTE *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// MODE SENSE success
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return length;
|
||||
}
|
||||
|
||||
@ -1745,8 +1739,6 @@ int Disk::ModeSense10(const DWORD *cdb, BYTE *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// MODE SENSE success
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return length;
|
||||
}
|
||||
|
||||
@ -2177,8 +2169,6 @@ bool Disk::Write(const DWORD *cdb, const BYTE *buf, DWORD block)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Success
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2248,8 +2238,6 @@ bool Disk::StartStop(const DWORD *cdb)
|
||||
Eject(false);
|
||||
}
|
||||
|
||||
// OK
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2275,8 +2263,6 @@ bool Disk::SendDiag(const DWORD *cdb)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Always successful
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,6 @@
|
||||
// DaynaPort SCSI Link Ethernet Adapter
|
||||
//
|
||||
//===========================================================================
|
||||
const char* SCSIDaynaPort::m_vendor_name = "DAYNA ";
|
||||
const char* SCSIDaynaPort::m_device_name = "SCSI/Link ";
|
||||
const char* SCSIDaynaPort::m_revision = "1.4a";
|
||||
const char* SCSIDaynaPort::m_firmware_version = "01.00.00";
|
||||
|
||||
const BYTE SCSIDaynaPort::m_bcast_addr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
const BYTE SCSIDaynaPort::m_apple_talk_addr[6] = { 0x09, 0x00, 0x07, 0xff, 0xff, 0xff };
|
||||
|
||||
@ -143,6 +138,8 @@ void SCSIDaynaPort::Open(const Filepath& path, BOOL attn)
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGTRACE("%s Calling base class for dispatching $%02X", __PRETTY_FUNCTION__, (unsigned int)ctrl->cmd[0]);
|
||||
|
||||
// The base class handles the less specific commands
|
||||
return Disk::Dispatch(controller);
|
||||
}
|
||||
@ -199,7 +196,6 @@ int SCSIDaynaPort::Inquiry(const DWORD *cdb, BYTE *buffer)
|
||||
//---------------------------------------------------------------------------
|
||||
int SCSIDaynaPort::Read(const DWORD *cdb, BYTE *buf, DWORD block)
|
||||
{
|
||||
WORD requested_length = 0;
|
||||
int rx_packet_size = 0;
|
||||
BOOL send_message_to_host;
|
||||
scsi_resp_read_t *response = (scsi_resp_read_t*)buf;
|
||||
@ -216,7 +212,7 @@ int SCSIDaynaPort::Read(const DWORD *cdb, BYTE *buf, DWORD block)
|
||||
LOGERROR("Received unexpected cdb command: %02X. Expected 0x08", (unsigned int)command->operation_code);
|
||||
}
|
||||
|
||||
requested_length = (WORD)command->transfer_length;
|
||||
WORD requested_length = (WORD)command->transfer_length;
|
||||
LOGTRACE("%s Read maximum length %d, (%04X)", __PRETTY_FUNCTION__, (unsigned int)requested_length, (unsigned int)requested_length);
|
||||
|
||||
|
||||
@ -362,12 +358,10 @@ int SCSIDaynaPort::WriteCheck(DWORD block)
|
||||
//---------------------------------------------------------------------------
|
||||
bool SCSIDaynaPort::Write(const DWORD *cdb, const BYTE *buf, DWORD block)
|
||||
{
|
||||
BYTE data_format;
|
||||
WORD data_length;
|
||||
// const scsi_cmd_daynaport_write_t* command = (const scsi_cmd_daynaport_write_t*)cdb;
|
||||
|
||||
data_format = cdb[5];
|
||||
data_length = (WORD)cdb[4] + ((WORD)cdb[3] << 8);
|
||||
BYTE data_format = cdb[5];
|
||||
WORD data_length = (WORD)cdb[4] + ((WORD)cdb[3] << 8);
|
||||
|
||||
// if(data_format != command->format){
|
||||
// LOGDEBUG("%s CDB: %02X %02X %02X %02X %02X %02X", __PRETTY_FUNCTION__, (unsigned int)cdb[0], (unsigned int)cdb[1], (unsigned int)cdb[2], (unsigned int)cdb[3], (unsigned int)cdb[4], (unsigned int)cdb[5] );
|
||||
@ -398,7 +392,6 @@ bool SCSIDaynaPort::Write(const DWORD *cdb, const BYTE *buf, DWORD block)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RetrieveStats
|
||||
@ -476,7 +469,6 @@ int SCSIDaynaPort::RetrieveStats(const DWORD *cdb, BYTE *buffer)
|
||||
// response->frame_alignment_errors = 0;
|
||||
|
||||
// // Success
|
||||
// disk.code = DISK_NOERROR;
|
||||
// return sizeof(scsi_resp_link_stats_t);
|
||||
}
|
||||
|
||||
@ -579,7 +571,6 @@ void SCSIDaynaPort::CmdWrite6(SASIDEV *controller)
|
||||
void SCSIDaynaPort::CmdRetrieveStats(SASIDEV *controller)
|
||||
{
|
||||
ctrl->length = RetrieveStats(ctrl->cmd, ctrl->buffer);
|
||||
|
||||
if (ctrl->length <= 0) {
|
||||
// Failure (Error)
|
||||
controller->Error();
|
||||
@ -618,8 +609,6 @@ void SCSIDaynaPort::CmdSetIfaceMode(SASIDEV *controller)
|
||||
void SCSIDaynaPort::CmdSetMcastAddr(SASIDEV *controller)
|
||||
{
|
||||
ctrl->length = (DWORD)ctrl->cmd[4];
|
||||
|
||||
// ASSERT(ctrl.length >= 0);
|
||||
if (ctrl->length == 0) {
|
||||
LOGWARN("%s Not supported SetMcastAddr Command %02X", __PRETTY_FUNCTION__, (WORD)ctrl->cmd[2]);
|
||||
|
||||
@ -659,7 +648,7 @@ void SCSIDaynaPort::SetMode(const DWORD *cdb, BYTE *buffer)
|
||||
{
|
||||
LOGTRACE("%s Setting mode", __PRETTY_FUNCTION__);
|
||||
|
||||
for(size_t i=0; i<sizeof(6); i++)
|
||||
for(size_t i = 0; i < sizeof(6); i++)
|
||||
{
|
||||
LOGTRACE("%s %d: %02X",__PRETTY_FUNCTION__, (unsigned int)i,(WORD)cdb[i]);
|
||||
}
|
||||
|
@ -161,11 +161,6 @@ private:
|
||||
DWORD frames_lost;
|
||||
} scsi_resp_link_stats_t;
|
||||
|
||||
static const char* m_vendor_name;
|
||||
static const char* m_device_name;
|
||||
static const char* m_revision;
|
||||
static const char* m_firmware_version;
|
||||
|
||||
scsi_resp_link_stats_t m_scsi_link_stats = {
|
||||
.mac_address = { 0x00, 0x80, 0x19, 0x10, 0x98, 0xE3 },//MAC address of @PotatoFi's DayanPort
|
||||
.frame_alignment_errors = 0,
|
||||
|
@ -36,7 +36,7 @@ SCSIBR::SCSIBR() : Disk("SCBR")
|
||||
{
|
||||
SetRemovable(false);
|
||||
|
||||
SetProduct("RASCSI BRIDGE");
|
||||
SetProduct("BRIDGE");
|
||||
|
||||
fsoptlen = 0;
|
||||
fsoutlen = 0;
|
||||
@ -141,7 +141,6 @@ int SCSIBR::Inquiry(const DWORD *cdb, BYTE *buf)
|
||||
}
|
||||
|
||||
// Success
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -153,7 +152,6 @@ int SCSIBR::Inquiry(const DWORD *cdb, BYTE *buf)
|
||||
bool SCSIBR::TestUnitReady(const DWORD* /*cdb*/)
|
||||
{
|
||||
// TEST UNIT READY Success
|
||||
SetStatusCode(STATUS_NOERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -285,6 +285,8 @@ bool SCSICD::Dispatch(SCSIDEV *controller)
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGTRACE("%s Calling base class for dispatching $%02X", __PRETTY_FUNCTION__, (unsigned int)ctrl->cmd[0]);
|
||||
|
||||
// The base class handles the less specific commands
|
||||
return Disk::Dispatch(controller);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user