35 RequestReference->Irp =
Irp;
36 RequestReference->Srb =
Srb;
59 ExAllocateFromNPagedLookasideList(&
PdoExtension->FdoExtension->RequestReferenceLookaside);
60 if (RequestReference ==
NULL)
67 return RequestReference;
91 RequestReference =
FdoExtension->ReservedRequestReference;
95 return RequestReference;
122 ExFreeToNPagedLookasideList(&
FdoExtension->RequestReferenceLookaside, RequestReference);
160 DPRINT(
"StorpAssignTagToSrb: Assigned Tag %x, TagCounter was %x\n",
Srb->
QueueTag, NewTag);
175 PVOID MiniportExtension;
183 MiniportExtension = &
FdoExtension->Miniport.MiniportExtension->HwDeviceExtension;
196 CanStartIo = HwInitData->
HwBuildIo(MiniportExtension, RequestReference->
Srb);
205 HwInitData->
HwStartIo(MiniportExtension, RequestReference->
Srb);
253 if (RequestReference ==
NULL)
256 if (RequestReference ==
NULL)
263 if (SrbExtensionSize == 0)
300 Irp = RequestReference->Irp;
323 if (RequestReference->Irp->MdlAddress)
334 RequestReference->MappedSystemVa = (
PVOID)1;
345 RequestReference->WriteToDevice =
351 RequestReference->Irp->MdlAddress,
353 RequestReference->Srb->DataTransferLength,
355 (
PVOID)RequestReference,
356 RequestReference->WriteToDevice);
363 RequestReference->Irp,
381 RequestReference->IsOutstanding =
FALSE;
409 RequestReference->IsOutstanding =
TRUE;
432 &RequestReference->PdoEntry);
433 IssueRequest =
FALSE;
441 RequestReference->StrongOrdered =
TRUE;
442 StrongOrderedRequest =
TRUE;
453 &RequestReference->PdoEntry);
454 IssueRequest =
FALSE;
465 &RequestReference->PdoEntry);
468 &RequestReference->PdoEntry);
482 &RequestReference->FdoEntry);
538 Irp->IoStatus.Information = 0;
574 DPRINT(
"New request (%d:%d:%d) ReqRef %p Srb %p Irp %p Tag %x SrbExt %p(%d)\n",
752 Srb = RequestReference->Srb;
753 Irp = RequestReference->Irp;
758 FromReserve = RequestReference->FromReserve;
766 DPRINT(
"Completing request: (%d:%d:%d) ReqRef %p Srb %p Irp %p Tag %x\n",
770 if (RequestReference->ScatterGatherList)
775 RequestReference->WriteToDevice);
776 RequestReference->ScatterGatherList =
NULL;
784 if (RequestReference->MappedSystemVa)
791 if (RequestReference->IsOutstanding)
803 if (
FdoExtension->FlowControl.OutstandingRequestCount == 0 ||
817 if (
PdoExtension->FlowControl.OutstandingRequestCount == 0 ||
825 if (RequestReference->StrongOrdered)
832 RequestReference =
NULL;
887 DPRINT(
"Calling IoCompleteRequest\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedIncrement
#define InterlockedExchange
_In_ PSCSI_REQUEST_BLOCK Srb
#define TEST_FLAG(Flags, Bit)
#define STATUS_NOT_IMPLEMENTED
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define SRB_FUNCTION_RELEASE_DEVICE
#define SRB_FUNCTION_CLAIM_DEVICE
#define SRB_FUNCTION_IO_CONTROL
#define SRB_FLAGS_BYPASS_FROZEN_QUEUE
#define SRB_FUNCTION_EXECUTE_SCSI
#define SRB_FLAGS_DATA_OUT
#define SRB_ORDERED_QUEUE_TAG_REQUEST
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
#define SRB_FUNCTION_FLUSH
#define SRB_FUNCTION_SHUTDOWN
#define SRB_HEAD_OF_QUEUE_TAG_REQUEST
#define SRB_FLAGS_BYPASS_LOCKED_QUEUE
#define SRB_FLAGS_UNSPECIFIED_DIRECTION
#define SRB_STATUS(Status)
#define SRB_STATUS_INTERNAL_ERROR
#define SRB_STATUS_SUCCESS
#define SRB_STATUS_INVALID_REQUEST
#define TAG_SRB_EXTENSION
struct _QUEUED_REQUEST_REFERENCE * PQUEUED_REQUEST_REFERENCE
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define KeLowerIrql(oldIrql)
#define RemoveTailList(ListHead)
KIRQL FASTCALL KfRaiseIrql(IN KIRQL NewIrql)
VOID FASTCALL KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
VOID FASTCALL KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
#define StorpCheckFlowControl(...)
FORCEINLINE VOID StorpCompleteRequest(_In_ PIRP Irp, _In_ UCHAR SrbStatus, _In_ NTSTATUS IrpStatus)
Completes a request with specified SRB status and IRP status.
#define InterlockedCompareExchange
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
#define ExFreePoolWithTag(_P, _T)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define IoCompleteRequest
void __cdecl __debugbreak(void)
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
NTSTATUS NTAPI PortPdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
FORCEINLINE BOOLEAN StorpAssignTagToSrb(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
Assigns a queue tag to a request if it stated it supports one.
static NTSTATUS PortPdoStarveRequest(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ PIRP Irp)
Parks a request that is out of memory, or fails it if there is no reserve to wait for....
static VOID PortCompleteRequest(_In_ PQUEUED_REQUEST_REFERENCE RequestReference)
BOOLEAN PortPdoScheduleRequestFlowControlled(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PQUEUED_REQUEST_REFERENCE RequestReference)
Schedules an outstanding request and return a boolean value to indicate if the request can be immedia...
static PQUEUED_REQUEST_REFERENCE StorpSrbAcquireReservedRequestReference(_In_ PSCSI_REQUEST_BLOCK Srb, _In_ PIRP Irp, _In_ PPDO_DEVICE_EXTENSION PdoExtension)
Takes the adapter reserve, if it is there and nobody else holds it.
static VOID StorpSrbInitRequestReference(_In_ PQUEUED_REQUEST_REFERENCE RequestReference, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ PIRP Irp, _In_ PPDO_DEVICE_EXTENSION PdoExtension)
Initializes a request reference and sets the SRB => ReqRef link.
VOID StorpSrbFreeRequestReference(_In_ PSCSI_REQUEST_BLOCK Srb)
Frees an SRB's Request Reference and restore Srb->OriginalRequest field to IRP. This function does no...
static VOID PortScheduleComingRequestsOnCompletion(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PFDO_DEVICE_EXTENSION FdoExtension)
VOID PortPdoScheduleRequestNoFlowControl(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PQUEUED_REQUEST_REFERENCE RequestReference)
VOID NTAPI PortPdoAfterBuildingScatterGatherList(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PSCATTER_GATHER_LIST ScatterGatherList, _In_ PVOID Context)
static PQUEUED_REQUEST_REFERENCE StorpSrbAllocateRequestReference(_In_ PSCSI_REQUEST_BLOCK Srb, _In_ PIRP Irp, _In_ PPDO_DEVICE_EXTENSION PdoExtension)
Allocates QUEUED_REQUEST_REFERENCE for an SRB that is going to be processed.
NTSTATUS PortPdoSrbAllocatePrivateContexts(_In_ PSCSI_REQUEST_BLOCK Srb, _In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PFDO_DEVICE_EXTENSION FdoExtension)
VOID NTAPI PortCompletionDpc(_In_ PKDPC Dpc, _In_ PVOID Context, _In_ PVOID SystemArgument1, _In_ PVOID SystemArgument2)
NTSTATUS PortPdoIssueRequest(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PQUEUED_REQUEST_REFERENCE RequestReference)
VOID PortQueueStarvedRequest(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Queues a request that could not allocate its private contexts.
VOID PortRetryStarvedRequest(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Retries one queued request, so each completion lets exactly one through.
PHW_INITIALIZATION_DATA InitData
PFDO_DEVICE_EXTENSION FdoExtension
LIST_ENTRY ActiveRequestsListHead
ULONG OutstandingRequestCount
LIST_ENTRY AwaitingRequestsListHead
PSTOR_SCATTER_GATHER_LIST ScatterGatherList
PPDO_DEVICE_EXTENSION PdoExtension
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_UNSUCCESSFUL
#define STATUS_DEVICE_BUSY
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
NTSYSAPI void WINAPI DbgBreakPoint(void)
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
#define IO_DISK_INCREMENT
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
#define MmGetMdlVirtualAddress(_Mdl)
#define MDL_SOURCE_IS_NONPAGED_POOL
#define MDL_MAPPED_TO_SYSTEM_VA
#define InterlockedFlushSList(SListHead)