ATA: Implement PMI for SCSI READ CAPACITY

Implementing PMI for READ CAPACITY gets rid of the "cannot find track size, assuming 68" error in HDToolbox
This commit is contained in:
Matt Harlum 2023-08-04 14:29:52 +00:00
parent 5212f4c30d
commit 58d8e9a524
2 changed files with 21 additions and 1 deletions

View File

@ -76,9 +76,20 @@ static BYTE scsi_read_capaity_ata(struct IDEUnit *unit, struct SCSICmd *scsi_com
return error;
}
data->lba = (unit->logicalSectors) - 1;
struct SCSI_READ_CAPACITY_10 *cdb = (struct SCSI_READ_CAPACITY_10 *)scsi_command->scsi_Command;
data->block_size = unit->blockSize;
if (cdb->flags & 0x01) {
// Partial Medium Indicator - Return end of cylinder
// Implement this so HDToolbox stops moaning about track size
ULONG spc = unit->cylinders * unit->heads;
data->lba = (((cdb->lba / spc) + 1) * spc) - 1;
} else {
data->lba = (unit->logicalSectors) - 1;
}
scsi_command->scsi_Actual = 8;
return 0;

9
scsi.h
View File

@ -47,6 +47,15 @@ struct __attribute__((packed)) SCSI_CDB_10 {
UBYTE control;
};
struct __attribute__((packed)) SCSI_READ_CAPACITY_10 {
UBYTE operation;
UBYTE reserved1;
ULONG lba;
UWORD reserved2;
UBYTE flags;
UBYTE control;
};
struct __attribute__((packed)) SCSI_CAPACITY_10 {
ULONG lba;
ULONG block_size;