Skip to content

Commit e3839bd

Browse files
committed
Start vendor-specific SCSI commands
1 parent 742a810 commit e3839bd

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

devices/common/scsi/scsi.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ enum ScsiCommand : uint8_t {
143143
READ_TOC = 0x43,
144144
SET_CD_SPEED = 0xBB,
145145
READ_CD = 0xBE,
146+
147+
// vendor specific commands
148+
VENDOR_09 = 0x09,
149+
EJECT = 0xC0,
150+
READ_CDDA = 0xD8, //TOSHIBA
151+
READ_CDDA_MSF = 0xD9, //TOSHIBA
146152
};
147153

148154
enum ScsiSense : int {

devices/common/scsi/scsicdrom.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ void ScsiCdrom::process_command()
4545
{
4646
uint32_t lba;
4747

48+
uint32_t cdda_start, cdda_end, cdda_len;
49+
4850
this->pre_xfer_action = nullptr;
4951
this->post_xfer_action = nullptr;
5052

@@ -98,6 +100,19 @@ void ScsiCdrom::process_command()
98100
this->switch_phase(ScsiPhase::DATA_IN);
99101
}
100102
break;
103+
case ScsiCommand::READ_CDDA:
104+
lba = READ_DWORD_BE_U(&cmd[2]);
105+
cdda_len = READ_DWORD_BE_U(&cmd[6]);
106+
this->read(lba, cdda_len, 12);
107+
break;
108+
case ScsiCommand::READ_CDDA_MSF:
109+
cdda_start = (cmd[3] * 60 * 75) + (cmd[4] * 75) + cmd[5];
110+
cdda_end = (cmd[7] * 60 * 75) + (cmd[8] * 75) + cmd[9];
111+
112+
cdda_len = (cdda_end > cdda_start) ? (cdda_end - cdda_start) : 0;
113+
114+
this->read(cdda_start, cdda_len, 12);
115+
break;
101116
default:
102117
LOG_F(ERROR, "%s: unsupported command 0x%X", this->name.c_str(), cmd[0]);
103118
this->illegal_command(cmd);

0 commit comments

Comments
 (0)