Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions devices/common/ata/atapibasedevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ int AtapiBaseDevice::perform_command() {
LOG_F(ERROR, "%s: unsupported command 0x%X", this->name.c_str(), this->r_command);
this->r_error |= ATA_Error::ABRT;
this->r_status |= ATA_Status::ERR;
this->r_status &= ~BSY;
this->update_intrq(1);
}
return 0;
}
Expand Down
28 changes: 0 additions & 28 deletions devices/common/scsi/scsicdrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ ScsiCdrom::ScsiCdrom(std::string name, int my_id) : ScsiPhysDevice(name, my_id)
this->set_vendor_id(my_vendor_id);
this->set_product_id(my_product_id);
this->set_revision_id(my_revision_id);

this->add_page_getter(this, 49, &ScsiCdrom::get_apple_page_49);
}

void ScsiCdrom::process_command() {
Expand Down Expand Up @@ -80,32 +78,6 @@ void ScsiCdrom::process_command() {
// Apple SCSI/ATAPI driver requests this page in the case of a device error.
// PearPC implements it under the name "Apple Features".
// I couldn't find any drive whose firmware supports it.
int ScsiCdrom::get_apple_page_49(uint8_t subpage, uint8_t ctrl, uint8_t *out_ptr,
int avail_len)
{
LOG_F(WARNING, "Page 0x31 requested");

if (subpage && subpage != 0xFFU)
return FORMAT_ERR_BAD_SUBPAGE;

if (ctrl == 3)
return FORMAT_ERR_BAD_CONTROL;

int page_size = 6;

if (page_size > avail_len)
return FORMAT_ERR_DATA_TOO_BIG;

std::memset(out_ptr, 0, page_size);

out_ptr[0] = '.';
out_ptr[1] = 'A';
out_ptr[2] = 'p';
out_ptr[3] = 'p';

return page_size;
}

void ScsiCdrom::mode_select_6(uint8_t param_len)
{
if (!param_len)
Expand Down
3 changes: 0 additions & 3 deletions devices/common/scsi/scsicdrom.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class ScsiCdrom : public ScsiPhysDevice, public ScsiCdromCmds {
protected:
bool is_device_ready() override { return this->is_ready; }

int get_apple_page_49(uint8_t subpage, uint8_t ctrl, uint8_t *out_ptr,
int avail_len);

void mode_select_6(uint8_t param_len);

private:
Expand Down
31 changes: 31 additions & 0 deletions devices/common/scsi/scsicdromcmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ ScsiCdromCmds::ScsiCdromCmds() {

this->add_page_getter(this, ModePage::CDROM_CAPABILITIES,
&ScsiCdromCmds::get_cd_capabilities_page);

this->add_page_getter(this, ModePage::VENDOR_PAGE_31,
&ScsiCdromCmds::get_apple_page_49);
}

void ScsiCdromCmds::process_command() {
Expand Down Expand Up @@ -223,6 +226,34 @@ int ScsiCdromCmds:: read_toc() {
return ScsiPhase::DATA_IN;
}

// Apple SCSI/ATAPI driver requests this page in the case of a device error.
// PearPC implements it under the name "Apple Features".
int ScsiCdromCmds::get_apple_page_49(uint8_t subpage, uint8_t ctrl,
uint8_t *out_ptr, int avail_len)
{
LOG_F(WARNING, "Page 0x31 requested");

if (subpage && subpage != 0xFFU)
return FORMAT_ERR_BAD_SUBPAGE;

if (ctrl == 3)
return FORMAT_ERR_BAD_CONTROL;

int page_size = 6;

if (page_size > avail_len)
return FORMAT_ERR_DATA_TOO_BIG;

std::memset(out_ptr, 0, page_size);

out_ptr[0] = '.';
out_ptr[1] = 'A';
out_ptr[2] = 'p';
out_ptr[3] = 'p';

return page_size;
}

int ScsiCdromCmds::set_cd_speed() {
phy_impl->set_status(ScsiStatus::GOOD);

Expand Down
3 changes: 3 additions & 0 deletions devices/common/scsi/scsicdromcmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class ScsiCdromCmds : public ScsiBlockCmds, public CdromDrive {
protected:
virtual void process_command() override;

int get_apple_page_49(uint8_t subpage, uint8_t ctrl,
uint8_t *out_ptr, int avail_len);

int read_toc();
int set_cd_speed();

Expand Down