35 RequestReference->Irp =
Irp;
36 RequestReference->Srb =
Srb;
43 RequestReference->ExtendedRequest = &RequestReference->Ex;
44 RtlZeroMemory(RequestReference->ExtendedRequest,
sizeof(*RequestReference->ExtendedRequest));
65 ExAllocateFromNPagedLookasideList(&
PdoExtension->FdoExtension->RequestReferenceLookaside);
66 if (RequestReference ==
NULL)
73 return RequestReference;
97 RequestReference =
FdoExtension->ReservedRequestReference;
101 return RequestReference;
128 ExFreeToNPagedLookasideList(&
FdoExtension->RequestReferenceLookaside, RequestReference);
166 DPRINT(
"StorpAssignTagToSrb: Assigned Tag %x, TagCounter was %x\n",
Srb->
QueueTag, NewTag);
181 PVOID MiniportExtension;
190 MiniportExtension = &
FdoExtension->Miniport.MiniportExtension->HwDeviceExtension;
204 MiniportSrb = RequestReference->
Srb;
214 CanStartIo = HwInitData->
HwBuildIo(MiniportExtension, MiniportSrb);
223 HwInitData->
HwStartIo(MiniportExtension, MiniportSrb);
271 if (RequestReference ==
NULL)
274 if (RequestReference ==
NULL)
281 if (SrbExtensionSize == 0)
321 Irp = RequestReference->Irp;
344 if (RequestReference->Irp->MdlAddress)
355 RequestReference->MappedSystemVa = (
PVOID)1;
359 RequestReference->WriteToDevice =
366 RequestReference->Irp,
383 RequestReference->Irp->MdlAddress,
385 RequestReference->Srb->DataTransferLength,
387 (
PVOID)RequestReference,
388 RequestReference->WriteToDevice);
395 RequestReference->Irp,
413 RequestReference->IsOutstanding =
FALSE;
441 RequestReference->IsOutstanding =
TRUE;
464 &RequestReference->PdoEntry);
465 IssueRequest =
FALSE;
473 RequestReference->StrongOrdered =
TRUE;
474 StrongOrderedRequest =
TRUE;
485 &RequestReference->PdoEntry);
486 IssueRequest =
FALSE;
497 &RequestReference->PdoEntry);
500 &RequestReference->PdoEntry);
514 &RequestReference->FdoEntry);
569 Irp->IoStatus.Information = 0;
604 DPRINT(
"New request (%d:%d:%d) ReqRef %p Srb %p Irp %p Tag %x SrbExt %p(%d)\n",
782 Srb = RequestReference->Srb;
783 Irp = RequestReference->Irp;
788 FromReserve = RequestReference->FromReserve;
796 DPRINT(
"Completing request: (%d:%d:%d) ReqRef %p Srb %p Irp %p Tag %x\n",
800 if (RequestReference->ScatterGatherList)
805 RequestReference->WriteToDevice);
806 RequestReference->ScatterGatherList =
NULL;
810 if (RequestReference->MappedSystemVa)
813 RequestReference->MappedSystemVa =
NULL;
817 if (RequestReference->IsOutstanding)
829 if (
FdoExtension->FlowControl.OutstandingRequestCount == 0 ||
843 if (
PdoExtension->FlowControl.OutstandingRequestCount == 0 ||
851 if (RequestReference->StrongOrdered)
858 RequestReference =
NULL;
913 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
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
#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
VOID NTAPI StorpBuildExtendedSrb(_In_ PSCSI_REQUEST_BLOCK Srb, _Out_ PEXTENDED_REQUEST Request)
Fills in the extended request a miniport will be given.
#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
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
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
#define SRB_TYPE_STORAGE_REQUEST_BLOCK
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.
PORT_CONFIGURATION_INFORMATION PortConfig
PFDO_DEVICE_EXTENSION FdoExtension
LIST_ENTRY ActiveRequestsListHead
ULONG OutstandingRequestCount
LIST_ENTRY AwaitingRequestsListHead
PEXTENDED_REQUEST ExtendedRequest
PSTOR_SCATTER_GATHER_LIST ScatterGatherList
PPDO_DEVICE_EXTENSION PdoExtension
#define FIELD_OFFSET(t, f)
#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)