From: Eric Kohl Date: Thu, 19 Sep 2002 16:18:50 +0000 (+0000) Subject: Moved SCSI headers because they are used by usetup. X-Git-Tag: ReactOS-0.0.21~168 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=f38f607dc457af590270e4b82196c84050fc240e Moved SCSI headers because they are used by usetup. svn path=/trunk/; revision=3521 --- diff --git a/reactos/drivers/storage/atapi/atapi.c b/reactos/drivers/storage/atapi/atapi.c index 41eca614c4a..a0ce4f724fe 100644 --- a/reactos/drivers/storage/atapi/atapi.c +++ b/reactos/drivers/storage/atapi/atapi.c @@ -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 @@ -46,10 +46,9 @@ // ------------------------------------------------------------------------- #include - -#include "../include/srb.h" -#include "../include/scsi.h" -#include "../include/ntddscsi.h" +#include +#include +#include #include "atapi.h" diff --git a/reactos/drivers/storage/cdrom/cdrom.c b/reactos/drivers/storage/cdrom/cdrom.c index 84801952ab1..6a73af332a7 100644 --- a/reactos/drivers/storage/cdrom/cdrom.c +++ b/reactos/drivers/storage/cdrom/cdrom.c @@ -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 @@ -34,10 +34,9 @@ /* INCLUDES *****************************************************************/ #include - -#include "../include/scsi.h" -#include "../include/class2.h" -#include "../include/ntddscsi.h" +#include +#include +#include #define NDEBUG #include diff --git a/reactos/drivers/storage/class2/class2.c b/reactos/drivers/storage/class2/class2.c index 0b0d3799468..e62bff79a48 100644 --- a/reactos/drivers/storage/class2/class2.c +++ b/reactos/drivers/storage/class2/class2.c @@ -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 -#include "../include/scsi.h" -#include "../include/class2.h" +#include +#include #define NDEBUG #include diff --git a/reactos/drivers/storage/disk/disk.c b/reactos/drivers/storage/disk/disk.c index 106418428ab..b6ceead5f26 100644 --- a/reactos/drivers/storage/disk/disk.c +++ b/reactos/drivers/storage/disk/disk.c @@ -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 @@ -28,10 +28,9 @@ /* INCLUDES *****************************************************************/ #include - -#include "../include/scsi.h" -#include "../include/class2.h" -#include "../include/ntddscsi.h" +#include +#include +#include #define NDEBUG #include @@ -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; diff --git a/reactos/drivers/storage/scsiport/scsiport.c b/reactos/drivers/storage/scsiport/scsiport.c index a2c6908c099..40d3d428e6c 100644 --- a/reactos/drivers/storage/scsiport/scsiport.c +++ b/reactos/drivers/storage/scsiport/scsiport.c @@ -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 -#include "../include/srb.h" -#include "../include/scsi.h" -#include "../include/ntddscsi.h" +#include +#include +#include #define NDEBUG #include @@ -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 */ diff --git a/reactos/drivers/storage/include/class2.h b/reactos/include/ddk/class2.h similarity index 98% rename from reactos/drivers/storage/include/class2.h rename to reactos/include/ddk/class2.h index 7c351342698..f6b83926241 100644 --- a/reactos/drivers/storage/include/class2.h +++ b/reactos/include/ddk/class2.h @@ -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 diff --git a/reactos/drivers/storage/include/ntddscsi.h b/reactos/include/ddk/ntddscsi.h similarity index 97% rename from reactos/drivers/storage/include/ntddscsi.h rename to reactos/include/ddk/ntddscsi.h index 88f1ef6a7fc..73984629220 100644 --- a/reactos/drivers/storage/include/ntddscsi.h +++ b/reactos/include/ddk/ntddscsi.h @@ -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 diff --git a/reactos/drivers/storage/include/scsi.h b/reactos/include/ddk/scsi.h similarity index 99% rename from reactos/drivers/storage/include/scsi.h rename to reactos/include/ddk/scsi.h index 3bea1ec235c..acd2369d285 100644 --- a/reactos/drivers/storage/include/scsi.h +++ b/reactos/include/ddk/scsi.h @@ -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 diff --git a/reactos/drivers/storage/include/srb.h b/reactos/include/ddk/srb.h similarity index 99% rename from reactos/drivers/storage/include/srb.h rename to reactos/include/ddk/srb.h index f60dadabd27..1b96964553d 100644 --- a/reactos/drivers/storage/include/srb.h +++ b/reactos/include/ddk/srb.h @@ -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