mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-02-02 08:30:45 +00:00
Use ScsiError constants instead of magic numbers.
This commit is contained in:
parent
a81156c3e3
commit
7855770ca7
@ -239,7 +239,7 @@ void ScsiCdrom::mode_sense_6()
|
|||||||
LOG_F(WARNING, "%s: unsupported page 0x%02x in MODE_SENSE_6", this->name.c_str(), page_code);
|
LOG_F(WARNING, "%s: unsupported page 0x%02x in MODE_SENSE_6", this->name.c_str(), page_code);
|
||||||
this->status = ScsiStatus::CHECK_CONDITION;
|
this->status = ScsiStatus::CHECK_CONDITION;
|
||||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||||
this->asc = 0x24; // Invalid Field in CDB
|
this->asc = ScsiError::INVALID_CDB;
|
||||||
this->ascq = 0;
|
this->ascq = 0;
|
||||||
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||||
this->field = 2;
|
this->field = 2;
|
||||||
@ -300,7 +300,7 @@ void ScsiCdrom::read_toc()
|
|||||||
start_track);
|
start_track);
|
||||||
this->status = ScsiStatus::CHECK_CONDITION;
|
this->status = ScsiStatus::CHECK_CONDITION;
|
||||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||||
this->asc = 0x24; // Invalid Field in CDB
|
this->asc = ScsiError::INVALID_CDB;
|
||||||
this->ascq = 0;
|
this->ascq = 0;
|
||||||
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||||
this->field = 6; // offset of start_track
|
this->field = 6; // offset of start_track
|
||||||
@ -361,7 +361,7 @@ void ScsiCdrom::read_capacity_10()
|
|||||||
LOG_F(ERROR, "%s: non-zero LBA for PMI=0", this->name.c_str());
|
LOG_F(ERROR, "%s: non-zero LBA for PMI=0", this->name.c_str());
|
||||||
this->status = ScsiStatus::CHECK_CONDITION;
|
this->status = ScsiStatus::CHECK_CONDITION;
|
||||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||||
this->asc = 0x24; // Invalid Field in CDB
|
this->asc = ScsiError::INVALID_CDB;
|
||||||
this->ascq = 0;
|
this->ascq = 0;
|
||||||
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||||
this->field = 8;
|
this->field = 8;
|
||||||
|
@ -221,13 +221,12 @@ int ScsiDevice::rcv_data(const uint8_t* src_ptr, const int count)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScsiDevice::check_lun()
|
bool ScsiDevice::check_lun() {
|
||||||
{
|
|
||||||
if (this->cmd_buf[1] >> 5 != this->lun) {
|
if (this->cmd_buf[1] >> 5 != this->lun) {
|
||||||
LOG_F(ERROR, "%s: non-matching LUN", this->name.c_str());
|
LOG_F(ERROR, "%s: non-matching LUN", this->name.c_str());
|
||||||
this->status = ScsiStatus::CHECK_CONDITION;
|
this->status = ScsiStatus::CHECK_CONDITION;
|
||||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||||
this->asc = 0x25; // Logical Unit Not Supported
|
this->asc = ScsiError::INVALID_LUN;
|
||||||
this->ascq = 0;
|
this->ascq = 0;
|
||||||
this->sksv = 0;
|
this->sksv = 0;
|
||||||
this->field = 0;
|
this->field = 0;
|
||||||
@ -237,14 +236,13 @@ bool ScsiDevice::check_lun()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScsiDevice::illegal_command(const uint8_t *cmd)
|
void ScsiDevice::illegal_command(const uint8_t *cmd) {
|
||||||
{
|
|
||||||
LOG_F(ERROR, "%s: unsupported command: 0x%02x", this->name.c_str(), cmd[0]);
|
LOG_F(ERROR, "%s: unsupported command: 0x%02x", this->name.c_str(), cmd[0]);
|
||||||
this->status = ScsiStatus::CHECK_CONDITION;
|
this->status = ScsiStatus::CHECK_CONDITION;
|
||||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||||
this->asc = 0x20; // Invalid command operation code
|
this->asc = ScsiError::INVALID_CMD;
|
||||||
this->ascq = 0;
|
this->ascq = 0;
|
||||||
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
this->sksv = 0xC0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||||
this->field = 0;
|
this->field = 0;
|
||||||
this->switch_phase(ScsiPhase::STATUS);
|
this->switch_phase(ScsiPhase::STATUS);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user