mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-24 12:30:05 +00:00
scsidevice: Add check_lun.
This will create a CHECK_CONDITON if the LUN doesn't match.
This commit is contained in:
parent
bcd057d45b
commit
1fb9e37ec5
@ -182,6 +182,7 @@ public:
|
||||
virtual int xfer_data();
|
||||
virtual int send_data(uint8_t* dst_ptr, int count);
|
||||
virtual int rcv_data(const uint8_t* src_ptr, const int count);
|
||||
virtual bool check_lun();
|
||||
|
||||
virtual bool prepare_data() = 0;
|
||||
virtual bool get_more_data() = 0;
|
||||
@ -202,7 +203,12 @@ protected:
|
||||
int data_size;
|
||||
int incoming_size;
|
||||
uint8_t status;
|
||||
|
||||
int sense;
|
||||
int asc;
|
||||
int ascq;
|
||||
int sksv;
|
||||
int field;
|
||||
|
||||
ScsiBus* bus_obj;
|
||||
|
||||
|
@ -216,3 +216,19 @@ int ScsiDevice::rcv_data(const uint8_t* src_ptr, const int count)
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
bool ScsiDevice::check_lun()
|
||||
{
|
||||
if (this->cmd_buf[1] >> 5 != this->lun) {
|
||||
LOG_F(ERROR, "%s: non-matching LUN", this->name.c_str());
|
||||
this->status = ScsiStatus::CHECK_CONDITION;
|
||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = 0x25; // Logical Unit Not Supported
|
||||
this->ascq = 0;
|
||||
this->sksv = 0;
|
||||
this->field = 0;
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user