Various DaynaPort related logging updates (#477)

* Removed duplicate CDB logging

* Updated logging

* Logging update

* Log level update

* Removed more duplicate logging

* Logging update

* Logging update

* Comment update

* Logging update

* Removed assertion

* Removed dummy method (doing nothing)

* Logging update
This commit is contained in:
Uwe Seimet 2021-11-19 02:24:36 +01:00 committed by GitHub
parent 111920edb0
commit f46453bbd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 43 deletions

View File

@ -326,7 +326,7 @@ void SASIDEV::Command()
// Command data transfer
for (int i = 0; i < (int)ctrl.length; i++) {
ctrl.cmd[i] = (DWORD)ctrl.buffer[i];
LOGTRACE("%s Command Byte %d: $%02X",__PRETTY_FUNCTION__, i, ctrl.cmd[i]);
LOGTRACE("%s CDB[%d]=$%02X",__PRETTY_FUNCTION__, i, ctrl.cmd[i]);
}
// Clear length and block
@ -1198,8 +1198,7 @@ bool SASIDEV::XferOut(bool cont)
break;
default:
LOGWARN("Received an unexpected command (%02X) in %s", (WORD)ctrl.cmd[0] , __PRETTY_FUNCTION__)
ASSERT(FALSE);
LOGWARN("Received an unexpected command ($%02X) in %s", (WORD)ctrl.cmd[0] , __PRETTY_FUNCTION__)
break;
}
@ -1261,10 +1260,7 @@ void SASIDEV::FlushUnit()
break;
default:
LOGWARN("Received an unexpected flush command %02X!!!!!\n",(WORD)ctrl.cmd[0]);
// The following statement makes debugging a huge pain. You can un-comment it
// if you're not trying to add new devices....
// ASSERT(FALSE);
LOGWARN("Received an unexpected flush command $%02X\n",(WORD)ctrl.cmd[0]);
break;
}
}

View File

@ -109,7 +109,6 @@ bool SCSIDaynaPort::Init(const map<string, string>& params)
SetReset(false);
// Generate MAC Address
LOGTRACE("%s memset(m_mac_addr, 0x00, 6);", __PRETTY_FUNCTION__);
memset(m_mac_addr, 0x00, 6);
// if (m_bTapEnable) {
@ -118,7 +117,6 @@ bool SCSIDaynaPort::Init(const map<string, string>& params)
// }
// !!!!!!!!!!!!!!!!! For now, hard code the MAC address. Its annoying when it keeps changing during development!
// TODO: Remove this hard-coded address
LOGTRACE("%s m_mac_addr[0]=0x00;", __PRETTY_FUNCTION__);
m_mac_addr[0]=0x00;
m_mac_addr[1]=0x80;
m_mac_addr[2]=0x19;
@ -143,9 +141,6 @@ void SCSIDaynaPort::Open(const Filepath& path)
int SCSIDaynaPort::Inquiry(const DWORD *cdb, BYTE *buf)
{
int allocation_length = cdb[4] + (((DWORD)cdb[3]) << 8);
LOGTRACE("%s Inquiry, allocation length: %d",__PRETTY_FUNCTION__, allocation_length);
if (allocation_length > 4) {
if (allocation_length > 44) {
allocation_length = 44;
@ -407,12 +402,7 @@ bool SCSIDaynaPort::Write(const DWORD *cdb, const BYTE *buf, DWORD block)
int SCSIDaynaPort::RetrieveStats(const DWORD *cdb, BYTE *buffer)
{
int allocation_length = cdb[4] + (((DWORD)cdb[3]) << 8);
LOGTRACE("%s Retrieve Stats buffer size is %d", __PRETTY_FUNCTION__, (int)allocation_length);
// if(cdb[4] != 0x12)
// {
// LOGWARN("%s cdb[4] was not 0x12, as I expected. It was %02X.", __PRETTY_FUNCTION__, (unsigned int)cdb[4]);
// }
// memset(buffer,0,18);
// memcpy(&buffer[0],m_mac_addr,sizeof(m_mac_addr));
// uint32_t frame_alignment_errors;
@ -428,18 +418,11 @@ int SCSIDaynaPort::RetrieveStats(const DWORD *cdb, BYTE *buffer)
// frames_lost = htonl(0);
// memcpy(&(buffer[14]),&frames_lost,sizeof(frames_lost));
for (int i = 0; i < 6; i++) {
LOGTRACE("%s CDB byte %d: %02X",__PRETTY_FUNCTION__, i, (unsigned int)cdb[i]);
}
int response_size = sizeof(m_scsi_link_stats);
memcpy(buffer, &m_scsi_link_stats, sizeof(m_scsi_link_stats));
LOGTRACE("%s response size is %d", __PRETTY_FUNCTION__, (int)response_size);
if (response_size > allocation_length) {
response_size = allocation_length;
LOGINFO("%s Truncating the inquiry response", __PRETTY_FUNCTION__)
}
// Success
@ -604,10 +587,9 @@ void SCSIDaynaPort::SetInterfaceMode(SASIDEV *controller)
ctrl->length = RetrieveStats(ctrl->cmd, ctrl->buffer);
switch(ctrl->cmd[5]){
case SCSIDaynaPort::CMD_SCSILINK_SETMODE:
SetMode(ctrl->cmd, ctrl->buffer);
// TODO Not implemented, do nothing
controller->Status();
break;
break;
case SCSIDaynaPort::CMD_SCSILINK_SETMAC:
ctrl->length = 6;
@ -645,19 +627,3 @@ void SCSIDaynaPort::EnableInterface(SASIDEV *controller)
controller->Status();
}
//---------------------------------------------------------------------------
//
// Set Mode - enable broadcast messages
//
//---------------------------------------------------------------------------
void SCSIDaynaPort::SetMode(const DWORD *cdb, BYTE *buffer)
{
LOGTRACE("%s Setting mode", __PRETTY_FUNCTION__);
for (int i = 0; i < 6; i++) {
LOGTRACE("%s %d: %02X",__PRETTY_FUNCTION__, (unsigned int)i, (int)cdb[i]);
}
}

View File

@ -73,7 +73,6 @@ public:
bool EnableInterface(const DWORD *cdb);
void SetMacAddr(const DWORD *cdb, BYTE *buffer); // Set MAC address
void SetMode(const DWORD *cdb, BYTE *buffer); // Set the mode: whether broadcast traffic is enabled or not
void TestUnitReady(SASIDEV *) override;
void Read6(SASIDEV *) override;