tretornesp wrote:
If you don't mind I would really appreciate if you could confirm if the following structure values apply all your suggestions or if i'm missing something:
All of the ATA task file registers/bits I didn't list in my previous post are unused and should be zero.
Code:
command_fis->feature_low |= 1;
command_fis->feature_low |= (1 << 2); //Setting feature bits 0 and 2
Unused bits of the features register should be zero. Drives that don't use bit 2 may reject commands with bit 2 set, but QEMU's emulated drive probably doesn't care.
Code:
command_fis->device_register = 1 << 6;
ATAPI devices are supposed to ignore this bit, but I'd set the whole register to 0 just in case.
Code:
command_fis->count_low = sector_count & 0xFF;
command_fis->count_high = (sector_count >> 8);
This register is unused in ATAPI and should be zero.
Code:
command_table->atapi_command[2] = (uint8_t)(sector_high >> 8);
command_table->atapi_command[3] = (uint8_t)sector_high;
command_table->atapi_command[4] = (uint8_t)(sector_low >> 24);
command_table->atapi_command[5] = (uint8_t)(sector_low >> 16);
READ(12) uses 32-bit LBA. You should use only sector_low to fill these four bytes.
Code:
command_table->atapi_command[6] = (uint8_t)(sector_low >> 8);
command_table->atapi_command[7] = (uint8_t)sector_low;
command_table->atapi_command[8] = 0x00;
command_table->atapi_command[9] = 0x00;
You should use sector_count to fill these four bytes.
tretornesp wrote:
I guess it would be a good idea to spend the time writing support for the IDENTIFY PACKET DEVICE command.
You should be able to get QEMU to work without it.