mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SCSIPORT][FORMATTING] Fix formatting and PCH generation
This commit is contained in:
parent
3da04a9b68
commit
fdc47e7ea7
4 changed files with 677 additions and 746 deletions
|
@ -3,15 +3,14 @@ spec2def(scsiport.sys scsiport.spec ADD_IMPORTLIB)
|
|||
|
||||
list(APPEND SOURCE
|
||||
scsiport.c
|
||||
stubs.c
|
||||
precomp.h)
|
||||
stubs.c)
|
||||
|
||||
add_library(scsiport MODULE
|
||||
${SOURCE}
|
||||
scsiport.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/scsiport.def)
|
||||
|
||||
add_pch(scsiport precomp.h SOURCE)
|
||||
add_pch(scsiport scsiport.h "")
|
||||
set_module_type(scsiport kernelmodedriver)
|
||||
add_importlibs(scsiport ntoskrnl hal)
|
||||
add_cd_file(TARGET scsiport DESTINATION reactos/system32/drivers NO_CAB FOR all)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef _SCSIPORT_PCH_
|
||||
#define _SCSIPORT_PCH_
|
||||
|
||||
#include <wdm.h>
|
||||
|
||||
#endif /* _SCSIPORT_PCH_ */
|
|
@ -1,46 +1,18 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2001, 2002 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Storage Stack
|
||||
* FILE: drivers/storage/scsiport/scsiport.c
|
||||
* PURPOSE: SCSI port driver
|
||||
* PROGRAMMER: Eric Kohl
|
||||
* Aleksey Bragin (aleksey reactos org)
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: SCSI Port driver SCSI requests handling
|
||||
* COPYRIGHT: Eric Kohl (eric.kohl@reactos.org)
|
||||
* Aleksey Bragin (aleksey@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <ntddk.h>
|
||||
#include <stdio.h>
|
||||
#include <scsi.h>
|
||||
#include <ntddscsi.h>
|
||||
#include <ntdddisk.h>
|
||||
#include <mountdev.h>
|
||||
#include "scsiport.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#include "scsiport_int.h"
|
||||
|
||||
ULONG InternalDebugLevel = 0x00;
|
||||
|
||||
#undef ScsiPortMoveMemory
|
||||
|
@ -1005,7 +977,8 @@ SpiInitOpenKeys(PCONFIGURATION_INFO ConfigInfo, PUNICODE_STRING RegistryPath)
|
|||
*/
|
||||
|
||||
ULONG NTAPI
|
||||
ScsiPortInitialize(IN PVOID Argument1,
|
||||
ScsiPortInitialize(
|
||||
IN PVOID Argument1,
|
||||
IN PVOID Argument2,
|
||||
IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
|
||||
IN PVOID HwContext)
|
||||
|
@ -1231,25 +1204,19 @@ CreatePortConfig:
|
|||
if ((HwInitializationData->AdapterInterfaceType == PCIBus) &&
|
||||
(HwInitializationData->VendorIdLength > 0) &&
|
||||
(HwInitializationData->VendorId != NULL) &&
|
||||
(HwInitializationData->DeviceIdLength > 0) &&
|
||||
(HwInitializationData->DeviceId != NULL))
|
||||
(HwInitializationData->DeviceIdLength > 0) && (HwInitializationData->DeviceId != NULL))
|
||||
{
|
||||
PortConfig->BusInterruptLevel = 0;
|
||||
|
||||
/* Get PCI device data */
|
||||
DPRINT("VendorId '%.*s' DeviceId '%.*s'\n",
|
||||
HwInitializationData->VendorIdLength,
|
||||
HwInitializationData->VendorId,
|
||||
HwInitializationData->DeviceIdLength,
|
||||
DPRINT(
|
||||
"VendorId '%.*s' DeviceId '%.*s'\n", HwInitializationData->VendorIdLength,
|
||||
HwInitializationData->VendorId, HwInitializationData->DeviceIdLength,
|
||||
HwInitializationData->DeviceId);
|
||||
|
||||
if (!SpiGetPciConfigData(DriverObject,
|
||||
PortDeviceObject,
|
||||
HwInitializationData,
|
||||
PortConfig,
|
||||
RegistryPath,
|
||||
ConfigInfo.BusNumber,
|
||||
&SlotNumber))
|
||||
if (!SpiGetPciConfigData(
|
||||
DriverObject, PortDeviceObject, HwInitializationData, PortConfig, RegistryPath,
|
||||
ConfigInfo.BusNumber, &SlotNumber))
|
||||
{
|
||||
/* Continue to the next bus, nothing here */
|
||||
ConfigInfo.BusNumber++;
|
||||
|
@ -1275,15 +1242,12 @@ CreatePortConfig:
|
|||
/* Note: HwFindAdapter is called once for each bus */
|
||||
Again = FALSE;
|
||||
DPRINT("Calling HwFindAdapter() for Bus %lu\n", PortConfig->SystemIoBusNumber);
|
||||
Result = (HwInitializationData->HwFindAdapter)(&DeviceExtension->MiniPortDeviceExtension,
|
||||
HwContext,
|
||||
0, /* BusInformation */
|
||||
Result = (HwInitializationData->HwFindAdapter)(
|
||||
&DeviceExtension->MiniPortDeviceExtension, HwContext, 0, /* BusInformation */
|
||||
ConfigInfo.Parameter, /* ArgumentString */
|
||||
PortConfig,
|
||||
&Again);
|
||||
PortConfig, &Again);
|
||||
|
||||
DPRINT("HwFindAdapter() Result: %lu Again: %s\n",
|
||||
Result, (Again) ? "True" : "False");
|
||||
DPRINT("HwFindAdapter() Result: %lu Again: %s\n", Result, (Again) ? "True" : "False");
|
||||
|
||||
/* Free MapRegisterBase, it's not needed anymore */
|
||||
if (DeviceExtension->MapRegisterBase != NULL)
|
||||
|
@ -1313,7 +1277,8 @@ CreatePortConfig:
|
|||
break;
|
||||
}
|
||||
|
||||
DPRINT("ScsiPortInitialize(): Found HBA! (%x), adapter Id %d\n",
|
||||
DPRINT(
|
||||
"ScsiPortInitialize(): Found HBA! (%x), adapter Id %d\n",
|
||||
PortConfig->BusInterruptVector, PortConfig->InitiatorBusId[0]);
|
||||
|
||||
/* If the SRB extension size was updated */
|
||||
|
@ -1322,15 +1287,13 @@ CreatePortConfig:
|
|||
{
|
||||
/* Set it (rounding to LONGLONG again) */
|
||||
DeviceExtension->SrbExtensionSize =
|
||||
(PortConfig->SrbExtensionSize +
|
||||
sizeof(LONGLONG)) & ~(sizeof(LONGLONG) - 1);
|
||||
(PortConfig->SrbExtensionSize + sizeof(LONGLONG)) & ~(sizeof(LONGLONG) - 1);
|
||||
}
|
||||
|
||||
/* The same with LUN extension size */
|
||||
if (PortConfig->SpecificLuExtensionSize != DeviceExtension->LunExtensionSize)
|
||||
DeviceExtension->LunExtensionSize = PortConfig->SpecificLuExtensionSize;
|
||||
|
||||
|
||||
if (!((HwInitializationData->AdapterInterfaceType == PCIBus) &&
|
||||
(HwInitializationData->VendorIdLength > 0) &&
|
||||
(HwInitializationData->VendorId != NULL) &&
|
||||
|
@ -1338,8 +1301,7 @@ CreatePortConfig:
|
|||
(HwInitializationData->DeviceId != NULL)))
|
||||
{
|
||||
/* Construct a resource list */
|
||||
ResourceList = SpiConfigToResource(DeviceExtension,
|
||||
PortConfig);
|
||||
ResourceList = SpiConfigToResource(DeviceExtension, PortConfig);
|
||||
|
||||
if (ResourceList)
|
||||
{
|
||||
|
@ -1354,8 +1316,8 @@ CreatePortConfig:
|
|||
ResourceList,
|
||||
FIELD_OFFSET(CM_RESOURCE_LIST,
|
||||
List[0].PartialResourceList.PartialDescriptors) +
|
||||
ResourceList->List[0].PartialResourceList.Count
|
||||
* sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
|
||||
ResourceList->List[0].PartialResourceList.Count *
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
|
||||
FALSE,
|
||||
&Conflict);
|
||||
ExFreePool(ResourceList);
|
||||
|
@ -1393,8 +1355,7 @@ CreatePortConfig:
|
|||
DeviceExtension->SupportsTaggedQueuing = PortConfig->MultipleRequestPerLu = FALSE;
|
||||
|
||||
/* Check if we need to alloc SRB data */
|
||||
if (DeviceExtension->SupportsTaggedQueuing ||
|
||||
DeviceExtension->MultipleReqsPerLun)
|
||||
if (DeviceExtension->SupportsTaggedQueuing || DeviceExtension->MultipleReqsPerLun)
|
||||
{
|
||||
DeviceExtension->NeedSrbDataAlloc = TRUE;
|
||||
}
|
||||
|
@ -1418,8 +1379,7 @@ CreatePortConfig:
|
|||
}
|
||||
|
||||
if (DeviceExtension->SrbExtensionBuffer == NULL &&
|
||||
(DeviceExtension->SrbExtensionSize != 0 ||
|
||||
PortConfig->AutoRequestSense))
|
||||
(DeviceExtension->SrbExtensionSize != 0 || PortConfig->AutoRequestSense))
|
||||
{
|
||||
DeviceExtension->SupportsAutoSense = PortConfig->AutoRequestSense;
|
||||
DeviceExtension->NeedSrbExtensionAlloc = TRUE;
|
||||
|
@ -1444,7 +1404,8 @@ CreatePortConfig:
|
|||
Count = DeviceExtension->RequestsNumber * 2;
|
||||
|
||||
/* Allocate the data */
|
||||
SrbData = ExAllocatePoolWithTag(NonPagedPool, Count * sizeof(SCSI_REQUEST_BLOCK_INFO), TAG_SCSIPORT);
|
||||
SrbData = ExAllocatePoolWithTag(
|
||||
NonPagedPool, Count * sizeof(SCSI_REQUEST_BLOCK_INFO), TAG_SCSIPORT);
|
||||
if (SrbData == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -1526,16 +1487,16 @@ CreatePortConfig:
|
|||
InterruptMode[0] = PortConfig->InterruptMode;
|
||||
InterruptMode[1] = PortConfig->InterruptMode2;
|
||||
|
||||
DeviceExtension->InterruptCount = (PortConfig->BusInterruptLevel2 != 0 || PortConfig->BusInterruptVector2 != 0) ? 2 : 1;
|
||||
DeviceExtension->InterruptCount =
|
||||
(PortConfig->BusInterruptLevel2 != 0 ||
|
||||
PortConfig->BusInterruptVector2 != 0) ? 2 : 1;
|
||||
|
||||
for (i = 0; i < DeviceExtension->InterruptCount; i++)
|
||||
{
|
||||
/* Register an interrupt handler for this device */
|
||||
MappedIrq[i] = HalGetInterruptVector(PortConfig->AdapterInterfaceType,
|
||||
PortConfig->SystemIoBusNumber,
|
||||
DeviceExtension->InterruptLevel[i],
|
||||
InterruptVector[i],
|
||||
&Dirql[i],
|
||||
MappedIrq[i] = HalGetInterruptVector(
|
||||
PortConfig->AdapterInterfaceType, PortConfig->SystemIoBusNumber,
|
||||
DeviceExtension->InterruptLevel[i], InterruptVector[i], &Dirql[i],
|
||||
&Affinity[i]);
|
||||
}
|
||||
|
||||
|
@ -1557,22 +1518,14 @@ CreatePortConfig:
|
|||
InterruptShareable = FALSE;
|
||||
}
|
||||
|
||||
Status = IoConnectInterrupt(&DeviceExtension->Interrupt[i],
|
||||
(PKSERVICE_ROUTINE)ScsiPortIsr,
|
||||
DeviceExtension,
|
||||
&DeviceExtension->IrqLock,
|
||||
MappedIrq[i],
|
||||
Dirql[i],
|
||||
MaxDirql,
|
||||
InterruptMode[i],
|
||||
InterruptShareable,
|
||||
Affinity[i],
|
||||
FALSE);
|
||||
Status = IoConnectInterrupt(
|
||||
&DeviceExtension->Interrupt[i], (PKSERVICE_ROUTINE)ScsiPortIsr, DeviceExtension,
|
||||
&DeviceExtension->IrqLock, MappedIrq[i], Dirql[i], MaxDirql, InterruptMode[i],
|
||||
InterruptShareable, Affinity[i], FALSE);
|
||||
|
||||
if (!(NT_SUCCESS(Status)))
|
||||
{
|
||||
DPRINT1("Could not connect interrupt %d\n",
|
||||
InterruptVector[i]);
|
||||
DPRINT1("Could not connect interrupt %d\n", InterruptVector[i]);
|
||||
DeviceExtension->Interrupt[i] = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -1585,8 +1538,7 @@ CreatePortConfig:
|
|||
/* Save IoAddress (from access ranges) */
|
||||
if (HwInitializationData->NumberOfAccessRanges != 0)
|
||||
{
|
||||
DeviceExtension->IoAddress =
|
||||
((*(PortConfig->AccessRanges))[0]).RangeStart.LowPart;
|
||||
DeviceExtension->IoAddress = ((*(PortConfig->AccessRanges))[0]).RangeStart.LowPart;
|
||||
|
||||
DPRINT("Io Address %x\n", DeviceExtension->IoAddress);
|
||||
}
|
||||
|
@ -1598,8 +1550,7 @@ CreatePortConfig:
|
|||
DeviceExtension->ActiveRequestCounter = -1;
|
||||
|
||||
/* Analyze what we have about DMA */
|
||||
if (DeviceExtension->AdapterObject != NULL &&
|
||||
PortConfig->Master &&
|
||||
if (DeviceExtension->AdapterObject != NULL && PortConfig->Master &&
|
||||
PortConfig->NeedPhysicalAddresses)
|
||||
{
|
||||
DeviceExtension->MapRegisters = TRUE;
|
||||
|
@ -1612,8 +1563,8 @@ CreatePortConfig:
|
|||
/* Call HwInitialize at DISPATCH_LEVEL */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
|
||||
if (!KeSynchronizeExecution(DeviceExtension->Interrupt[0],
|
||||
DeviceExtension->HwInitialize,
|
||||
if (!KeSynchronizeExecution(
|
||||
DeviceExtension->Interrupt[0], DeviceExtension->HwInitialize,
|
||||
DeviceExtension->MiniPortDeviceExtension))
|
||||
{
|
||||
DPRINT1("HwInitialize() failed!\n");
|
||||
|
@ -1626,10 +1577,7 @@ CreatePortConfig:
|
|||
if (DeviceExtension->InterruptData.Flags & SCSI_PORT_NOTIFICATION_NEEDED)
|
||||
{
|
||||
/* Call DPC right away, because we're already at DISPATCH_LEVEL */
|
||||
ScsiPortDpcForIsr(NULL,
|
||||
DeviceExtension->DeviceObject,
|
||||
NULL,
|
||||
NULL);
|
||||
ScsiPortDpcForIsr(NULL, DeviceExtension->DeviceObject, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Lower irql back to what it was */
|
||||
|
@ -1639,11 +1587,11 @@ CreatePortConfig:
|
|||
IoStartTimer(PortDeviceObject);
|
||||
|
||||
/* Initialize bus scanning information */
|
||||
BusConfigSize = FIELD_OFFSET(BUSES_CONFIGURATION_INFORMATION,
|
||||
BusConfigSize = FIELD_OFFSET(
|
||||
BUSES_CONFIGURATION_INFORMATION,
|
||||
BusScanInfo[DeviceExtension->PortConfig->NumberOfBuses]);
|
||||
DeviceExtension->BusesConfig = ExAllocatePoolWithTag(PagedPool,
|
||||
BusConfigSize,
|
||||
TAG_SCSIPORT);
|
||||
DeviceExtension->BusesConfig =
|
||||
ExAllocatePoolWithTag(PagedPool, BusConfigSize, TAG_SCSIPORT);
|
||||
if (!DeviceExtension->BusesConfig)
|
||||
{
|
||||
DPRINT1("Out of resources!\n");
|
||||
|
@ -1661,13 +1609,10 @@ CreatePortConfig:
|
|||
SpiScanAdapter(DeviceExtension);
|
||||
|
||||
/* Build the registry device map */
|
||||
SpiBuildDeviceMap(DeviceExtension,
|
||||
(PUNICODE_STRING)Argument2);
|
||||
SpiBuildDeviceMap(DeviceExtension, (PUNICODE_STRING)Argument2);
|
||||
|
||||
/* Create the dos device link */
|
||||
swprintf(DosNameBuffer,
|
||||
L"\\??\\Scsi%lu:",
|
||||
SystemConfig->ScsiPortCount);
|
||||
swprintf(DosNameBuffer, L"\\??\\Scsi%lu:", SystemConfig->ScsiPortCount);
|
||||
RtlInitUnicodeString(&DosDeviceName, DosNameBuffer);
|
||||
IoCreateSymbolicLink(&DosDeviceName, &DeviceName);
|
||||
|
||||
|
@ -1866,18 +1811,15 @@ ScsiPortMoveMemory(OUT PVOID Destination,
|
|||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType,
|
||||
IN PVOID HwDeviceExtension,
|
||||
...)
|
||||
ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType, IN PVOID HwDeviceExtension, ...)
|
||||
{
|
||||
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||
va_list ap;
|
||||
|
||||
DPRINT("ScsiPortNotification() called\n");
|
||||
|
||||
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||
SCSI_PORT_DEVICE_EXTENSION,
|
||||
MiniPortDeviceExtension);
|
||||
DeviceExtension =
|
||||
CONTAINING_RECORD(HwDeviceExtension, SCSI_PORT_DEVICE_EXTENSION, MiniPortDeviceExtension);
|
||||
|
||||
DPRINT("DeviceExtension %p\n", DeviceExtension);
|
||||
|
||||
|
@ -1896,7 +1838,9 @@ ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType,
|
|||
|
||||
/* Make sure Srb is alright */
|
||||
ASSERT(Srb->SrbStatus != SRB_STATUS_PENDING);
|
||||
ASSERT(Srb->Function != SRB_FUNCTION_EXECUTE_SCSI || Srb->SrbStatus != SRB_STATUS_SUCCESS || Srb->ScsiStatus == SCSISTAT_GOOD);
|
||||
ASSERT(
|
||||
Srb->Function != SRB_FUNCTION_EXECUTE_SCSI ||
|
||||
Srb->SrbStatus != SRB_STATUS_SUCCESS || Srb->ScsiStatus == SCSISTAT_GOOD);
|
||||
|
||||
if (!(Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE))
|
||||
{
|
||||
|
@ -1916,11 +1860,8 @@ ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType,
|
|||
else
|
||||
{
|
||||
/* Get the SRB data */
|
||||
SrbData = SpiGetSrbData(DeviceExtension,
|
||||
Srb->PathId,
|
||||
Srb->TargetId,
|
||||
Srb->Lun,
|
||||
Srb->QueueTag);
|
||||
SrbData = SpiGetSrbData(
|
||||
DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun, Srb->QueueTag);
|
||||
|
||||
/* Make sure there are no CompletedRequests and there is a Srb */
|
||||
ASSERT(SrbData->CompletedRequests == NULL && SrbData->Srb != NULL);
|
||||
|
@ -1954,24 +1895,21 @@ ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType,
|
|||
TargetId = (UCHAR)va_arg(ap, int);
|
||||
Lun = (UCHAR)va_arg(ap, int);
|
||||
|
||||
DPRINT("Notify: NextLuRequest(PathId %u TargetId %u Lun %u)\n",
|
||||
PathId, TargetId, Lun);
|
||||
DPRINT(
|
||||
"Notify: NextLuRequest(PathId %u TargetId %u Lun %u)\n", PathId, TargetId, Lun);
|
||||
|
||||
/* Mark it in the flags field */
|
||||
DeviceExtension->InterruptData.Flags |= SCSI_PORT_NEXT_REQUEST_READY;
|
||||
|
||||
/* Get the LUN extension */
|
||||
LunExtension = SpiGetLunExtension(DeviceExtension,
|
||||
PathId,
|
||||
TargetId,
|
||||
Lun);
|
||||
LunExtension = SpiGetLunExtension(DeviceExtension, PathId, TargetId, Lun);
|
||||
|
||||
/* If returned LunExtension is NULL, break out */
|
||||
if (!LunExtension) break;
|
||||
if (!LunExtension)
|
||||
break;
|
||||
|
||||
/* This request should not be processed if */
|
||||
if ((LunExtension->ReadyLun) ||
|
||||
(LunExtension->SrbInfo.Srb))
|
||||
if ((LunExtension->ReadyLun) || (LunExtension->SrbInfo.Srb))
|
||||
{
|
||||
/* Nothing to do here */
|
||||
break;
|
||||
|
@ -1986,8 +1924,7 @@ ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType,
|
|||
case ResetDetected:
|
||||
DPRINT("Notify: ResetDetected\n");
|
||||
/* Add RESET flags */
|
||||
DeviceExtension->InterruptData.Flags |=
|
||||
SCSI_PORT_RESET | SCSI_PORT_RESET_REPORTED;
|
||||
DeviceExtension->InterruptData.Flags |= SCSI_PORT_RESET | SCSI_PORT_RESET_REPORTED;
|
||||
break;
|
||||
|
||||
case CallDisableInterrupts:
|
||||
|
@ -2556,8 +2493,7 @@ SpiHandleAttachRelease(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
|||
*/
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
|
||||
{
|
||||
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||
PSCSI_PORT_LUN_EXTENSION LunExtension;
|
||||
|
@ -2568,8 +2504,7 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
|||
PIRP NextIrp, IrpList;
|
||||
PKDEVICE_QUEUE_ENTRY Entry;
|
||||
|
||||
DPRINT("ScsiPortDispatchScsi(DeviceObject %p Irp %p)\n",
|
||||
DeviceObject, Irp);
|
||||
DPRINT("ScsiPortDispatchScsi(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
@ -2592,10 +2527,7 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
|||
DPRINT("Srb->Function: %lu\n", Srb->Function);
|
||||
DPRINT("PathId: %lu TargetId: %lu Lun: %lu\n", Srb->PathId, Srb->TargetId, Srb->Lun);
|
||||
|
||||
LunExtension = SpiGetLunExtension(DeviceExtension,
|
||||
Srb->PathId,
|
||||
Srb->TargetId,
|
||||
Srb->Lun);
|
||||
LunExtension = SpiGetLunExtension(DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
|
||||
if (LunExtension == NULL)
|
||||
{
|
||||
DPRINT("ScsiPortDispatchScsi() called with an invalid LUN\n");
|
||||
|
@ -2644,7 +2576,8 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
|||
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
|
||||
|
||||
/* Insert IRP into the queue */
|
||||
if (!KeInsertByKeyDeviceQueue(&LunExtension->DeviceQueue,
|
||||
if (!KeInsertByKeyDeviceQueue(
|
||||
&LunExtension->DeviceQueue,
|
||||
&Irp->Tail.Overlay.DeviceQueueEntry,
|
||||
Srb->QueueSortKey))
|
||||
{
|
||||
|
@ -2686,7 +2619,6 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
|||
Srb->SrbStatus = SRB_STATUS_SUCCESS;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* Unfreeze the queue */
|
||||
|
@ -2706,7 +2638,6 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
|||
KeReleaseSpinLock(&DeviceExtension->SpinLock, Irql);
|
||||
}
|
||||
|
||||
|
||||
Srb->SrbStatus = SRB_STATUS_SUCCESS;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -2773,10 +2704,9 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <wdm.h>
|
||||
#include <ntddk.h>
|
||||
#include <stdio.h>
|
||||
#include <scsi.h>
|
||||
#include <ntddscsi.h>
|
||||
#include <ntdddisk.h>
|
||||
#include <mountdev.h>
|
||||
|
||||
#define VERSION "0.0.3"
|
||||
|
||||
#ifndef PAGE_ROUND_UP
|
Loading…
Reference in a new issue