Merge pull request #114 from mihaip/upstream-atahd-fix

Fix ATA HD initialization on Beige G3 when booting 9.2
This commit is contained in:
Maxim Poliakovski
2024-08-23 12:59:51 +02:00
committed by GitHub
2 changed files with 4 additions and 7 deletions

View File

@@ -105,13 +105,13 @@ int AtaHardDisk::perform_command() {
uint64_t offset = this->get_lba() * ATA_HD_SEC_SIZE;
uint32_t ints_size = ATA_HD_SEC_SIZE;
if (this->r_command == READ_MULTIPLE) {
if (this->multiple_sector_count == 0) {
if (this->sec_per_block == 0) {
LOG_F(ERROR, "%s: READ MULTIPLE with SET MULTIPLE==0", this->name.c_str());
this->r_status |= ERR;
this->r_status &= ~BSY;
break;
}
ints_size *= this->multiple_sector_count;
ints_size *= this->sec_per_block;
}
hdd_img.read(buffer, offset, xfer_size);
this->data_ptr = (uint16_t *)this->buffer;
@@ -130,13 +130,13 @@ int AtaHardDisk::perform_command() {
uint32_t xfer_size = sec_count * ATA_HD_SEC_SIZE;
uint32_t ints_size = ATA_HD_SEC_SIZE;
if (this->r_command == WRITE_MULTIPLE) {
if (this->multiple_sector_count == 0) {
if (this->sec_per_block == 0) {
LOG_F(ERROR, "%s: WRITE MULTIPLE with SET MULTIPLE==0", this->name.c_str());
this->r_status |= ERR;
this->r_status &= ~BSY;
break;
}
ints_size *= this->multiple_sector_count;
ints_size *= this->sec_per_block;
}
this->prepare_xfer(xfer_size, ints_size);
this->post_xfer_action = [this]() {

View File

@@ -69,9 +69,6 @@ private:
uint8_t heads;
uint8_t sectors;
//number of sectors for r/w multiple
uint8_t multiple_sector_count = 0;
uint8_t sec_per_block = 8; // sectors per block for READ_MULTIPLE/WRITE_MULTIPLE
bool multiple_enabled = true; // READ_MULTIPLE/WRITE_MULTIPLE enabled