shithub: riscv

Download patch

ref: beb665051bc635299e905ecb8abc5dfd9c3f011e
parent: 8fea0399b0535193af7c1cba0c7a72c00c146a78
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 2 00:23:21 EDT 2014

sdide: never timeout or retry scsi commands from the controller driver

this was a big mistake. we should never attempt to
timeout or retry a scsi command from the controller
driver because theres no way to tell how long a
command would take or if a command has side effects
when being retried.

--- a/sys/src/9/pc/sdide.c
+++ b/sys/src/9/pc/sdide.c
@@ -1115,11 +1115,14 @@
 		atadmastart(ctlr, drive->write);
 	iunlock(ctlr);
 
-	if(iowait(drive, 30*1000, 0) <= 0){
-		ilock(ctlr);
+	while(iowait(drive, 30*1000, 1) == 0)
+		;
+
+	ilock(ctlr);
+	if(!ctlr->done){
+		rv = SDcheck;
 		ataabort(drive, 0);
-	} else
-		ilock(ctlr);
+	}
 	if(drive->error){
 		if(drive->pktdma)
 			atadmastop(ctlr);
@@ -1128,12 +1131,11 @@
 	}
 	iunlock(ctlr);
 
-	if(drive->status & Chk){
+	if(rv != SDcheck && drive->status & Chk){
 		rv = SDcheck;
 		if(drive->pktdma){
 			print("atapktio: disabling dma\n");
 			drive->dmactl = 0;
-			rv = SDretry;
 		}
 	}
 	return rv;
--