first attempt to report sense data

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25652 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2008-05-24 22:34:40 +00:00
parent ad36dc4f21
commit 205acfb4dc
2 changed files with 23 additions and 7 deletions
@@ -466,6 +466,7 @@ AHCIPort::WaitForTransfer(int *tfd, bigtime_t timeout)
fCommandsActive &= ~1;
result = B_TIMED_OUT;
} else if (fError) {
*tfd = fRegs->tfd;
result = B_ERROR;
fError = false;
} else {
@@ -748,15 +749,13 @@ AHCIPort::ExecuteSataRequest(sata_request *request, bool isWrite)
FinishTransfer();
if (status < B_OK) {
if (status == B_TIMED_OUT) {
TRACE("ExecuteAtaRequest port %d: device timeout\n", fIndex);
fResetPort = true;
} else
TRACE("ExecuteAtaRequest port %d: device error\n", fIndex);
if (status == B_TIMED_OUT) {
TRACE("ExecuteAtaRequest port %d: device timeout\n", fIndex);
fResetPort = true;
request->abort();
} else
} else {
request->finish(tfd, bytesTransfered);
}
}
@@ -4,6 +4,7 @@
*/
#include "sata_request.h"
#include "scsi_cmds.h"
#include <string.h>
sata_request::sata_request()
@@ -100,6 +101,22 @@ sata_request::finish(int tfd, size_t bytesTransfered)
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)) {
uint8 error = (tfd >> 8) & 0xff;
dprintf("ahci: sata_request::finish status 0x%02x, error 0x%02x\n", tfd & 0xff, error);
if (error & 0x04) { // ABRT
fCcb->subsys_status = SCSI_REQ_ABORTED;
} else {
fCcb->device_status = SCSI_STATUS_CHECK_CONDITION;
fCcb->subsys_status |= SCSI_AUTOSNS_VALID;
fCcb->sense_resid = 0; //FIXME
scsi_sense *sense = (scsi_sense *)fCcb->sense;
sense->error_code = SCSIS_CURR_ERROR;
sense->sense_key = error >> 4;
sense->asc = 0;
sense->ascq = 0;
}
}
gSCSI->finished(fCcb, 1);
delete this;
} else {