Skip to content

Commit

Permalink
minor ATA tweaks
Browse files Browse the repository at this point in the history
From @Wack0's branch
  • Loading branch information
dingusdev committed Aug 24, 2024
1 parent 47237ff commit ebf4b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion devices/common/ata/atabasedevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ uint16_t AtaBaseDevice::read(const uint8_t reg_addr) {
void AtaBaseDevice::write(const uint8_t reg_addr, const uint16_t value) {
switch (reg_addr) {
case ATA_Reg::DATA:
if (this->has_data()) {
if (is_selected() && this->has_data()) {
*this->cur_data_ptr++ = BYTESWAP_16(value);
this->chunk_cnt -= 2;
if (this->chunk_cnt <= 0) {
Expand Down
5 changes: 5 additions & 0 deletions devices/common/ata/atapibasedevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ int AtapiBaseDevice::perform_command() {
this->r_status |= BSY;

switch (this->r_command) {
case ATAPI_SOFT_RESET:
this->device_reset(true);
this->device_set_signature();
this->r_status &= ~BSY;
break;
case ATAPI_PACKET:
this->data_ptr = (uint16_t *)this->cmd_pkt;
this->xfer_cnt = sizeof(this->cmd_pkt);
Expand Down

0 comments on commit ebf4b0e

Please sign in to comment.