Provide better sense data. Turn off auto-sense

for ATAPI, as we can't report anything.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25653 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2008-05-24 23:08:11 +00:00
parent 205acfb4dc
commit d53ddcce75
3 changed files with 13 additions and 3 deletions
@@ -144,6 +144,7 @@ enum {
enum {
ATA_BSY = 0x80,
ATA_DF = 0x20,
ATA_DRQ = 0x08,
ATA_ERR = 0x01,
};
@@ -902,7 +902,7 @@ void
AHCIPort::ScsiGetRestrictions(bool *isATAPI, bool *noAutoSense, uint32 *maxBlocks)
{
*isATAPI = fIsATAPI;
*noAutoSense = false;
*noAutoSense = fIsATAPI; // emulated auto sense for ATA, but not ATAPI
*maxBlocks = fUse48BitCommands ? 65536 : 256;
TRACE("AHCIPort::ScsiGetRestrictions port %d: isATAPI %d, noAutoSense %d, maxBlocks %lu\n",
fIndex, *isATAPI, *noAutoSense, *maxBlocks);
@@ -100,10 +100,18 @@ sata_request::finish(int tfd, size_t bytesTransfered)
dprintf("ahci: sata_request::finish ATA_ERR set for command 0x%02x\n", fFis[2]);
if (fCcb) {
fCcb->data_resid = fCcb->data_length - bytesTransfered;
fCcb->subsys_status = (tfd & ATA_ERR) ? SCSI_REQ_CMP_ERR : SCSI_REQ_CMP;
if (fIsATAPI && (tfd & ATA_ERR)) {
fCcb->subsys_status = SCSI_REQ_CMP;
if (tfd & (ATA_ERR | ATA_DF)) {
uint8 error = (tfd >> 8) & 0xff;
dprintf("ahci: sata_request::finish status 0x%02x, error 0x%02x\n", tfd & 0xff, error);
if (fIsATAPI) {
fCcb->subsys_status = SCSI_REQ_CMP_ERR;
fCcb->device_status = SCSI_STATUS_CHECK_CONDITION;
} else {
fCcb->subsys_status = SCSI_REQ_CMP_ERR;
// TODO error handling goes here
}
/*
if (error & 0x04) { // ABRT
fCcb->subsys_status = SCSI_REQ_ABORTED;
} else {
@@ -116,6 +124,7 @@ sata_request::finish(int tfd, size_t bytesTransfered)
sense->asc = 0;
sense->ascq = 0;
}
*/
}
gSCSI->finished(fCcb, 1);
delete this;