atahd: fix RECALIBRATE command.

Although being optional in ATA-3 and absent in >= ATA-4,
RECALIBRATE is issued by Open Firmware 3.1.1 during device
initialization. If it fails, the drive is considered non-bootable.
This commit is contained in:
Maxim Poliakovski 2024-08-21 21:15:17 +02:00
parent bd16b7c69e
commit 3bf088f2c8

View File

@ -85,10 +85,14 @@ int AtaHardDisk::perform_command() {
switch (this->r_command) {
case NOP:
break;
case RECALIBRATE:
this->r_error = 0;
this->r_cylinder_lo = 0;
case RECALIBRATE: // is optional in ATA-3; disappeared in >= ATA-4
// OF 3.1.1 won't boot off the drive that reports error for this command
this->r_cylinder_hi = 0;
this->r_cylinder_lo = 0;
this->r_dev_head &= 0xF0;
this->r_sect_num = (this->r_dev_head & ATA_Dev_Head::LBA) ? 0 : 1;
this->r_status &= ~BSY;
this->update_intrq(1);
break;
case READ_SECTOR:
case READ_SECTOR_NR: {