Commit in reactos/drivers/storage/atapi on MAIN
atapi.c+11-71.46 -> 1.47
- Fixed the returned values for a data underrun.  
- Fixed the write count in packet interrupts.

reactos/drivers/storage/atapi
atapi.c 1.46 -> 1.47
diff -u -r1.46 -r1.47
--- atapi.c	29 Feb 2004 12:27:52 -0000	1.46
+++ atapi.c	29 Feb 2004 22:01:21 -0000	1.47
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: atapi.c,v 1.46 2004/02/29 12:27:52 hbirr Exp $
+/* $Id: atapi.c,v 1.47 2004/02/29 22:01:21 hbirr Exp $
  *
  * COPYRIGHT:   See COPYING in the top level directory
  * PROJECT:     ReactOS ATAPI miniport driver
@@ -2439,10 +2439,15 @@
   DPRINT("AtapiCompleteRequest(DevExt %x, SrbStatus %x)\n", DevExt, SrbStatus);
 
   Srb->SrbStatus = SrbStatus;
-  if (SrbStatus != SRB_STATUS_SUCCESS)
+  if (SrbStatus == SRB_STATUS_ERROR)
     {
       Srb->SrbStatus = AtapiErrorToScsi((PVOID)DevExt, Srb);
     }
+  else if (SrbStatus == SRB_STATUS_DATA_OVERRUN)
+    {
+      Srb->DataTransferLength -= DevExt->DataTransferLength;
+    }
+      
   DevExt->Handler = NULL;
   ScsiPortNotification(RequestComplete, (PVOID)DevExt, Srb);
   ScsiPortNotification(NextRequest, (PVOID)DevExt, NULL);
@@ -2494,7 +2499,7 @@
         {
 	  DPRINT1("AtapiPacketInterrupt: data underrun (%d bytes), command was %02x\n", 
 	          DevExt->DataTransferLength, Srb->Cdb[0]);
-	  SrbStatus = SRB_STATUS_ERROR;
+	  SrbStatus = SRB_STATUS_DATA_OVERRUN;
 	}
       else
         {
@@ -2558,7 +2563,6 @@
   else if (Srb->SrbFlags & SRB_FLAGS_DATA_OUT)
     {
       DPRINT("write data\n");
-      TransferSize = DevExt->TransferSize[Srb->TargetId];
       if (DevExt->DataTransferLength < TransferSize)
         {
 	  TransferSize = DevExt->DataTransferLength;
@@ -2566,7 +2570,7 @@
 
       TargetAddress = DevExt->DataBuffer;
 
-      DPRINT1("TargetAddress %x, TransferSize %x\n", TargetAddress, TransferSize);
+      DPRINT("TargetAddress %x, TransferSize %x\n", TargetAddress, TransferSize);
 
       DevExt->DataBuffer += TransferSize;
       DevExt->DataTransferLength -= TransferSize;
@@ -2595,13 +2599,13 @@
 {
   BYTE Status;
 
-  DPRINT1("AtapiNoDataInterrupt()\n");
+  DPRINT("AtapiNoDataInterrupt()\n");
 
   Status = IDEReadStatus(DevExt->CommandPortBase);
   AtapiCompleteRequest(DevExt,
                        (Status & (IDE_SR_DRDY|IDE_SR_BUSY|IDE_SR_ERR|IDE_SR_DRQ)) == IDE_SR_DRDY ? SRB_STATUS_SUCCESS : SRB_STATUS_ERROR);
 
-  DPRINT1("AtapiNoDatanterrupt() done!\n");
+  DPRINT("AtapiNoDatanterrupt() done!\n");
   return TRUE;
 }
 
CVSspam 0.2.8