Enabled reading of multiple sectors.
authorEric Kohl <eric.kohl@reactos.org>
Mon, 4 Mar 2002 22:31:51 +0000 (22:31 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 4 Mar 2002 22:31:51 +0000 (22:31 +0000)
svn path=/trunk/; revision=2670

reactos/drivers/storage/atapi/atapi.c
reactos/drivers/storage/class2/class2.c
reactos/drivers/storage/disk/disk.c
reactos/drivers/storage/scsiport/scsiport.c

index f9c67c3..8186105 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: atapi.c,v 1.8 2002/03/03 19:37:41 ekohl Exp $
+/* $Id: atapi.c,v 1.9 2002/03/04 22:31:06 ekohl Exp $
  *
  * COPYRIGHT:   See COPYING in the top level directory
  * PROJECT:     ReactOS ATAPI miniport driver
@@ -615,8 +615,6 @@ AtapiInterrupt(IN PVOID DeviceExtension)
       return(FALSE);
     }
 
-  DevExt->ExpectingInterrupt = FALSE;
-
   Srb = DevExt->CurrentSrb;
 
   DPRINT("Srb: %p\n", Srb);
@@ -678,7 +676,7 @@ AtapiInterrupt(IN PVOID DeviceExtension)
       switch (Srb->Cdb[0])
        {
          case SCSIOP_READ:
-           DPRINT1("SCSIOP_READ\n");
+           DPRINT("SCSIOP_READ\n");
 
            /* Update controller/device state variables */
            TargetAddress = Srb->DataBuffer;
@@ -687,7 +685,8 @@ AtapiInterrupt(IN PVOID DeviceExtension)
 //         DevExt->SectorsTransferred++;
 
            /* Remember whether DRQ should be low at end (last block read) */
-           IsLastBlock = Srb->DataTransferLength == 0;
+           IsLastBlock = (Srb->DataTransferLength == 0);
+           DPRINT("IsLastBlock == %s\n", (IsLastBlock)?"TRUE":"FALSE");
 
            /* Wait for DRQ assertion */
            for (Retries = 0; Retries < IDE_MAX_DRQ_RETRIES &&
@@ -753,6 +752,7 @@ AtapiInterrupt(IN PVOID DeviceExtension)
          case SCSIOP_WRITE:
            DPRINT1("AtapiInterrupt(): SCSIOP_WRITE not implemented yet!\n");
            RequestIsComplete = TRUE;
+           IsLastBlock = TRUE;
            break;
       }
     }
@@ -785,14 +785,19 @@ AtapiInterrupt(IN PVOID DeviceExtension)
 #endif
     }
 
-  ScsiPortNotification(RequestComplete,
-                      DeviceExtension,
-                      Srb);
+  if (IsLastBlock)
+    {
+      DevExt->ExpectingInterrupt = FALSE;
 
-  ScsiPortNotification(NextRequest,
-                      DeviceExtension,
-                      NULL);
+      ScsiPortNotification(RequestComplete,
+                          DeviceExtension,
+                          Srb);
 
+      ScsiPortNotification(NextRequest,
+                          DeviceExtension,
+                          NULL);
+    }
+}
 
   DPRINT("AtapiInterrupt() done!\n");
 
index d63a73f..2b9b4f3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: class2.c,v 1.8 2002/03/03 23:45:30 ekohl Exp $
+/* $Id: class2.c,v 1.9 2002/03/04 22:31:22 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -727,6 +727,7 @@ ScsiClassIoComplete(PDEVICE_OBJECT DeviceObject,
     {
       IoMarkIrpPending(Irp);
     }
+#endif
 
   if (DeviceExtension->ClassStartIo != NULL)
     {
@@ -736,7 +737,6 @@ ScsiClassIoComplete(PDEVICE_OBJECT DeviceObject,
                            FALSE);
        }
     }
-#endif
 
   DPRINT1("ScsiClassIoComplete() done (Status %lx)\n", Status);
 
index ecc724a..1d66bc2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: disk.c,v 1.6 2002/03/01 23:18:35 ekohl Exp $
+/* $Id: disk.c,v 1.7 2002/03/04 22:31:35 ekohl Exp $
  *
  */
 
@@ -423,8 +423,6 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
     }
 
   DiskDeviceExtension = DiskDeviceObject->DeviceExtension;
-//  DiskData = (PDISK_DEVICE_EXTENSION)((PUCHAR)DiskDeviceExtension + sizeof(DEVICE_EXTENSION));
-
   DiskDeviceExtension->LockCount = 0;
   DiskDeviceExtension->DeviceNumber = DiskNumber;
   DiskDeviceExtension->PortDeviceObject = PortDeviceObject;
@@ -519,7 +517,8 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
       if (!NT_SUCCESS(Status))
        {
          /* Drive is not ready. */
-//       diskData->DriveNotReady = TRUE;
+         DPRINT1("Drive not ready\n");
+         DiskData->DriveNotReady = TRUE;
        }
       else
        {
@@ -695,6 +694,12 @@ DiskClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
            Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
            Irp->IoStatus.Information = 0;
          }
+       else if (DeviceExtension->DiskGeometry == NULL)
+         {
+           DPRINT1("No disk geometry available!\n");
+           Irp->IoStatus.Status = STATUS_NO_SUCH_DEVICE;
+           Irp->IoStatus.Information = 0;
+         }
        else
          {
            PDISK_GEOMETRY Geometry;
index 4a1d6e4..e435ccb 100644 (file)
@@ -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: scsiport.c,v 1.8 2002/03/03 23:46:01 ekohl Exp $
+/* $Id: scsiport.c,v 1.9 2002/03/04 22:31:51 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -756,29 +756,9 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
     {
       case SRB_FUNCTION_EXECUTE_SCSI:
        DPRINT1("  SRB_FUNCTION_EXECUTE_SCSI\n");
-
-       switch (Srb->Cdb[0])
-         {
-#if 0
-           case SCSIOP_INQUIRY:
-           case SCSIOP_READ_CAPACITY:
-             DeviceExtension->Initializing = TRUE;
-             if(DeviceExtension->HwStartIo(&DeviceExtension->MiniPortDeviceExtension,
-                                           Srb) == TRUE)
-               Status = STATUS_SUCCESS;
-             else
-               Status = STATUS_UNSUCCESSFUL;
-             DeviceExtension->Initializing = FALSE;
-             break;
-#endif
-
-           default:
-             DPRINT1("Starting packet!\n");
-             IoStartPacket(DeviceObject, Irp, NULL, NULL);
-             DPRINT1("Returning STATUS_PENDING\n");
-             return(STATUS_PENDING);
-         }
-       break;
+       IoStartPacket(DeviceObject, Irp, NULL, NULL);
+       DPRINT1("Returning STATUS_PENDING\n");
+       return(STATUS_PENDING);
 
       case SRB_FUNCTION_CLAIM_DEVICE:
        {
@@ -1322,7 +1302,7 @@ ScsiPortIsr(IN PKINTERRUPT Interrupt,
   PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
   BOOLEAN Result;
 
-  DPRINT1("ScsiPortIsr() called!\n");
+  DPRINT("ScsiPortIsr() called!\n");
 
   DeviceExtension = (PSCSI_PORT_DEVICE_EXTENSION)ServiceContext;
 
@@ -1332,9 +1312,12 @@ ScsiPortIsr(IN PKINTERRUPT Interrupt,
       return(FALSE);
     }
 
-  IoRequestDpc(DeviceExtension->DeviceObject,
-              DeviceExtension->CurrentIrp,
-              DeviceExtension);
+  if (DeviceExtension->IrpFlags)
+    {
+      IoRequestDpc(DeviceExtension->DeviceObject,
+                  DeviceExtension->CurrentIrp,
+                  DeviceExtension);
+    }
 
   return(TRUE);
 }