Skip to content

Commit ebf4b0e

Browse files
committed
minor ATA tweaks
From @Wack0's branch
1 parent 47237ff commit ebf4b0e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

devices/common/ata/atabasedevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ uint16_t AtaBaseDevice::read(const uint8_t reg_addr) {
107107
void AtaBaseDevice::write(const uint8_t reg_addr, const uint16_t value) {
108108
switch (reg_addr) {
109109
case ATA_Reg::DATA:
110-
if (this->has_data()) {
110+
if (is_selected() && this->has_data()) {
111111
*this->cur_data_ptr++ = BYTESWAP_16(value);
112112
this->chunk_cnt -= 2;
113113
if (this->chunk_cnt <= 0) {

devices/common/ata/atapibasedevice.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ int AtapiBaseDevice::perform_command() {
149149
this->r_status |= BSY;
150150

151151
switch (this->r_command) {
152+
case ATAPI_SOFT_RESET:
153+
this->device_reset(true);
154+
this->device_set_signature();
155+
this->r_status &= ~BSY;
156+
break;
152157
case ATAPI_PACKET:
153158
this->data_ptr = (uint16_t *)this->cmd_pkt;
154159
this->xfer_cnt = sizeof(this->cmd_pkt);

0 commit comments

Comments
 (0)