Moved SCSI headers because they are used by usetup.
authorEric Kohl <eric.kohl@reactos.org>
Thu, 19 Sep 2002 16:18:50 +0000 (16:18 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Thu, 19 Sep 2002 16:18:50 +0000 (16:18 +0000)
svn path=/trunk/; revision=3521

reactos/drivers/storage/atapi/atapi.c
reactos/drivers/storage/cdrom/cdrom.c
reactos/drivers/storage/class2/class2.c
reactos/drivers/storage/disk/disk.c
reactos/drivers/storage/scsiport/scsiport.c
reactos/include/ddk/class2.h [moved from reactos/drivers/storage/include/class2.h with 98% similarity]
reactos/include/ddk/ntddscsi.h [moved from reactos/drivers/storage/include/ntddscsi.h with 97% similarity]
reactos/include/ddk/scsi.h [moved from reactos/drivers/storage/include/scsi.h with 99% similarity]
reactos/include/ddk/srb.h [moved from reactos/drivers/storage/include/srb.h with 99% similarity]

index 41eca61..a0ce4f7 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: atapi.c,v 1.28 2002/09/04 21:33:26 ekohl Exp $
+/* $Id: atapi.c,v 1.29 2002/09/19 16:17:35 ekohl Exp $
  *
  * COPYRIGHT:   See COPYING in the top level directory
  * PROJECT:     ReactOS ATAPI miniport driver
 //  -------------------------------------------------------------------------
 
 #include <ddk/ntddk.h>
-
-#include "../include/srb.h"
-#include "../include/scsi.h"
-#include "../include/ntddscsi.h"
+#include <ddk/srb.h>
+#include <ddk/scsi.h>
+#include <ddk/ntddscsi.h>
 
 #include "atapi.h"
 
index 8480195..6a73af3 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: cdrom.c,v 1.16 2002/09/17 20:35:21 hbirr Exp $
+/* $Id: cdrom.c,v 1.17 2002/09/19 16:17:48 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
-
-#include "../include/scsi.h"
-#include "../include/class2.h"
-#include "../include/ntddscsi.h"
+#include <ddk/scsi.h>
+#include <ddk/class2.h>
+#include <ddk/ntddscsi.h>
 
 #define NDEBUG
 #include <debug.h>
index 0b0d379..e62bff7 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: class2.c,v 1.24 2002/09/08 10:22:22 chorns Exp $
+/* $Id: class2.c,v 1.25 2002/09/19 16:18:00 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -33,8 +33,8 @@
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
-#include "../include/scsi.h"
-#include "../include/class2.h"
+#include <ddk/scsi.h>
+#include <ddk/class2.h>
 
 #define NDEBUG
 #include <debug.h>
index 1064184..b6ceead 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: disk.c,v 1.18 2002/09/08 10:22:22 chorns Exp $
+/* $Id: disk.c,v 1.19 2002/09/19 16:18:14 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
-
-#include "../include/scsi.h"
-#include "../include/class2.h"
-#include "../include/ntddscsi.h"
+#include <ddk/scsi.h>
+#include <ddk/class2.h>
+#include <ddk/ntddscsi.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -840,6 +839,45 @@ DiskClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
        break;
 
       case IOCTL_DISK_SET_DRIVE_LAYOUT:
+       if (IrpStack->Parameters.DeviceIoControl.InputBufferLength <
+           sizeof(DRIVE_LAYOUT_INFORMATION))
+         {
+           Status = STATUS_INFO_LENGTH_MISMATCH;
+         }
+       else if (DeviceExtension->PhysicalDevice->DeviceExtension != DeviceExtension)
+         {
+           Status = STATUS_INVALID_PARAMETER;
+         }
+       else
+         {
+           PDRIVE_LAYOUT_INFORMATION PartitionList;
+           ULONG TableSize;
+
+           PartitionList = Irp->AssociatedIrp.SystemBuffer;
+           TableSize = sizeof(DRIVE_LAYOUT_INFORMATION) +
+                       ((PartitionList->PartitionCount - 1) * sizeof(PARTITION_INFORMATION));
+
+           if (IrpStack->Parameters.DeviceIoControl.InputBufferLength < TableSize)
+             {
+               Status = STATUS_BUFFER_TOO_SMALL;
+             }
+           else
+             {
+               Status = IoWritePartitionTable(DeviceExtension->DeviceObject,
+                                              DeviceExtension->DiskGeometry->BytesPerSector,
+                                              DeviceExtension->DiskGeometry->SectorsPerTrack,
+                                              DeviceExtension->DiskGeometry->TracksPerCylinder,
+                                              PartitionList);
+               if (NT_SUCCESS(Status))
+                 {
+                   /* FIXME: Update partition device objects */
+
+                   Information = TableSize;
+                 }
+             }
+         }
+       break;
+
       case IOCTL_DISK_VERIFY:
       case IOCTL_DISK_FORMAT_TRACKS:
       case IOCTL_DISK_PERFORMANCE:
@@ -851,7 +889,7 @@ DiskClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
       case IOCTL_DISK_HISTOGRAM_RESET:
       case IOCTL_DISK_REQUEST_STRUCTURE:
       case IOCTL_DISK_REQUEST_DATA:
-       /* If we get here, something went wrong.  inform the requestor */
+       /* If we get here, something went wrong. Inform the requestor */
        DPRINT1("Unhandled control code: %lx\n", ControlCode);
        Status = STATUS_INVALID_DEVICE_REQUEST;
        Information = 0;
index a2c6908..40d3d42 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.20 2002/09/08 10:22:23 chorns Exp $
+/* $Id: scsiport.c,v 1.21 2002/09/19 16:18:50 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -28,9 +28,9 @@
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
-#include "../include/srb.h"
-#include "../include/scsi.h"
-#include "../include/ntddscsi.h"
+#include <ddk/srb.h>
+#include <ddk/scsi.h>
+#include <ddk/ntddscsi.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -64,6 +64,7 @@ typedef struct _SCSI_PORT_DEVICE_EXTENSION
   ULONG Length;
   ULONG MiniPortExtensionSize;
   PORT_CONFIGURATION_INFORMATION PortConfig;
+  ULONG PortNumber;
   
   KSPIN_LOCK SpinLock;
   PKINTERRUPT Interrupt;
@@ -1116,7 +1117,7 @@ ScsiPortCreatePortDevice(IN PDRIVER_OBJECT DriverObject,
         AccessRangeSize);
 
   PortDeviceExtension->DeviceObject = PortDeviceObject;
-
+  PortDeviceExtension->PortNumber = PortNumber;
 
   /* Initialize the spin lock in the controller extension */
   KeInitializeSpinLock(&PortDeviceExtension->SpinLock);
@@ -1476,4 +1477,118 @@ ScsiPortFreeSenseRequestSrb(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
 }
 
 
+#if 0
+static NTSTATUS
+ScsiPortBuildDeviceMap(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
+{
+  OBJECT_ATTRIBUTES ObjectAttributes;
+  UNICODE_STRING KeyName;
+  WCHAR NameBuffer[32];
+  ULONG Disposition;
+  HANDLE ScsiKey;
+  HANDLE ScsiPortKey;
+  HANDLE ScsiBusKey;
+  HANDLE ScsiTargetKey;
+  HANDLE ScsiUnitKey;
+  ULONG BusNumber;
+  NTSTATUS Status;
+
+  /* Open or create the 'Scsi' subkey */
+  RtlInitUnicodeStringFromLiteral(&KeyName,
+       L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
+  InitializeObjectAttributes(&ObjectAttributes,
+                            &KeyName,
+                            OBJ_OPENIF,
+                            0,
+                            NULL);
+  Status = NtCreateKey(&ScsiKey,
+                      KEY_ALL_ACCESS,
+                      &ObjectAttributes,
+                      0,
+                      NULL,
+                      REG_OPTION_VOLATILE,
+                      &Disposition);
+  if (!NT_SUCCESS(Status))
+    return(Status);
+
+  /* Create new 'Scsi Port X' subkey */
+  swprintf(NameBuffer,
+          L"Scsi Port %lu",
+          DeviceExtension->PortNumber);
+  RtlInitUnicodeString(&KeyName,
+                      NameBuffer);
+  InitializeObjectAttributes(&ObjectAttributes,
+                            &KeyName,
+                            0,
+                            ScsiKey,
+                            NULL);
+  Status = NtCreateKey(&ScsiPortKey,
+                      KEY_ALL_ACCESS,
+                      &ObjectAttributes,
+                      0,
+                      NULL,
+                      REG_OPTION_VOLATILE,
+                      &Disposition);
+  if (!NT_SUCCESS(Status))
+    {
+      NtClose(ScsiKey);
+      return(Status);
+    }
+
+  /* Add port-specific values */
+
+  /* 'DMA Enabled' (REG_DWORD) */
+  DPRINT1("DMA Enabled = %s\n",
+         (DeviceExtension->PortCapabilities->AdapterUsesPio)?"TRUE":"FALSE");
+
+  /* 'Driver' (REG_SZ) */
+
+  /* 'Interrupt' (REG_DWORD) (NT4 only) */
+  DPRINT1("Interrupt = %lx\n", DeviceExtension->PortConfig.BusInterruptLevel);
+
+  /* 'IOAddress' (REG_DWORD) (NT4 only) */
+  DPRINT1("IOAddress = %lx\n",
+         ScsiPortConvertPhysicalAddressToUlong(DeviceExtension->PortConfig.AccessRanges[0].RangeStart));
+
+
+  /* Create 'Scsi Bus X' keys */
+  for (BusNumber = 0; BusNumber < DeviceExtension->PortConfig.NumberOfBuses; BusNumber++)
+     {
+       swprintf(NameBuffer,
+                L"Scsi Bus %lu",
+                DeviceExtension->PortNumber);
+       RtlInitUnicodeString(&KeyName,
+                            NameBuffer);
+       InitializeObjectAttributes(&ObjectAttributes,
+                                  &KeyName,
+                                  0,
+                                  ScsiPortKey,
+                                  NULL);
+       Status = NtCreateKey(&ScsiBusKey,
+                            KEY_ALL_ACCESS,
+                            &ObjectAttributes,
+                            0,
+                            NULL,
+                            REG_OPTION_VOLATILE,
+                            &Disposition);
+       if (!NT_SUCCESS(Status))
+         {
+           NtClose(ScsiPortKey);
+           NtClose(ScsiKey);
+           return(Status);
+         }
+
+       /* Create target keys */
+
+
+       NtClose(ScsiBusKey);
+     }
+
+  NtClose(ScsiPortKey);
+  NtClose(ScsiKey);
+
+  return(Status);
+}
+#endif
+
 /* EOF */
similarity index 98%
rename from reactos/drivers/storage/include/class2.h
rename to reactos/include/ddk/class2.h
index 7c35134..f6b8392 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: class2.h,v 1.6 2002/09/08 10:22:23 chorns Exp $
+/* $Id: class2.h,v 1.1 2002/09/19 16:17:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
similarity index 97%
rename from reactos/drivers/storage/include/ntddscsi.h
rename to reactos/include/ddk/ntddscsi.h
index 88f1ef6..7398462 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ntddscsi.h,v 1.5 2002/09/08 10:22:23 chorns Exp $
+/* $Id: ntddscsi.h,v 1.1 2002/09/19 16:17:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
similarity index 99%
rename from reactos/drivers/storage/include/scsi.h
rename to reactos/include/ddk/scsi.h
index 3bea1ec..acd2369 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: scsi.h,v 1.6 2002/09/08 10:22:23 chorns Exp $
+/* $Id: scsi.h,v 1.1 2002/09/19 16:17:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
similarity index 99%
rename from reactos/drivers/storage/include/srb.h
rename to reactos/include/ddk/srb.h
index f60dada..1b96964 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: srb.h,v 1.7 2002/09/08 10:22:23 chorns Exp $
+/* $Id: srb.h,v 1.1 2002/09/19 16:17:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel